outbound-sdk 0.7.0 → 0.8.0

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.
Files changed (121) hide show
  1. package/dist/alerts/index.js +3 -3
  2. package/dist/audit/index.js +1 -1
  3. package/dist/benchmarks/index.js +3 -3
  4. package/dist/budget/index.d.ts +7 -0
  5. package/dist/budget/index.js +3 -3
  6. package/dist/cache/index.js +2 -2
  7. package/dist/cards/index.js +17 -5
  8. package/dist/chunks/{chunk-ZJCVLBAE.js → chunk-4GK56PRO.js} +667 -363
  9. package/dist/chunks/{chunk-MW4C6LTN.js → chunk-7TASUWPC.js} +2 -2
  10. package/dist/chunks/{chunk-M2VXGLLZ.js → chunk-CPACP4YD.js} +1 -1
  11. package/dist/chunks/{chunk-4AVYRVN5.js → chunk-FTK4JS65.js} +31 -10
  12. package/dist/chunks/{chunk-YW6FFVSZ.js → chunk-HXB2IOJJ.js} +1 -1
  13. package/dist/chunks/{chunk-Y7KECJAV.js → chunk-IKKCMWBK.js} +1 -1
  14. package/dist/chunks/{chunk-FHKSLCVW.js → chunk-KVAG5GM2.js} +19 -0
  15. package/dist/chunks/{chunk-7I3EPR23.js → chunk-MPE6VLLY.js} +3 -3
  16. package/dist/chunks/{chunk-UFQ4WMLU.js → chunk-NFWWA7MI.js} +1 -1
  17. package/dist/chunks/{chunk-GL7BABF2.js → chunk-OMCDMELK.js} +1 -1
  18. package/dist/chunks/{chunk-JRL3QRBS.js → chunk-OVTYA3IB.js} +88 -28
  19. package/dist/chunks/{chunk-HIAK2GCI.js → chunk-RMAHQ2OZ.js} +5 -1
  20. package/dist/chunks/{chunk-65YAGEWZ.js → chunk-RQLOPMMR.js} +153 -39
  21. package/dist/chunks/{chunk-OK3GAZMT.js → chunk-SYUMA3CP.js} +12 -0
  22. package/dist/chunks/{chunk-LVZGIKNF.js → chunk-U5AK6OJM.js} +1 -1
  23. package/dist/chunks/{chunk-KTYTE2BU.js → chunk-UAHYPASH.js} +20 -11
  24. package/dist/chunks/{chunk-BNDHEDHD.js → chunk-UOJG4VYF.js} +3 -3
  25. package/dist/chunks/{chunk-LD6F46UT.js → chunk-UWD65SK7.js} +2 -2
  26. package/dist/chunks/{chunk-I7DXXGNZ.js → chunk-UZLFZZ2U.js} +5 -5
  27. package/dist/chunks/{chunk-DNPNTD5W.js → chunk-VVDBCQLK.js} +1 -1
  28. package/dist/chunks/{chunk-IVH3NMQZ.js → chunk-WROJO6XB.js} +1 -1
  29. package/dist/chunks/chunk-XMCNRU4H.js +7279 -0
  30. package/dist/chunks/{chunk-QFC4ZHD3.js → chunk-XYHM4KHC.js} +1 -1
  31. package/dist/chunks/{chunk-NAWZ73QS.js → chunk-YFJ3OQZS.js} +8 -1
  32. package/dist/chunks/tools-II7GXAOM.js +23 -0
  33. package/dist/cli/args.d.ts +48 -0
  34. package/dist/cli/bin.js +14 -14
  35. package/dist/cli/commands.d.ts +0 -7
  36. package/dist/cli/config.d.ts +31 -2
  37. package/dist/cli/envelope.d.ts +2 -0
  38. package/dist/cli/index.d.ts +6 -0
  39. package/dist/cli/index.js +19 -15
  40. package/dist/cli/listing.d.ts +5 -2
  41. package/dist/cli/mcp.d.ts +9 -0
  42. package/dist/cli/offered.d.ts +10 -0
  43. package/dist/cli/options.d.ts +6 -0
  44. package/dist/cli/progress.d.ts +27 -0
  45. package/dist/cli/serve.d.ts +17 -0
  46. package/dist/cli/update.d.ts +25 -2
  47. package/dist/clients/index.js +3 -3
  48. package/dist/combine/index.js +154 -35
  49. package/dist/combine/newest.d.ts +18 -0
  50. package/dist/combine/route.d.ts +19 -5
  51. package/dist/emailbison/index.js +22 -14
  52. package/dist/emailbison/map-sequence.d.ts +2 -1
  53. package/dist/exporter/index.js +1 -1
  54. package/dist/failover/index.js +3 -3
  55. package/dist/fixtures/index.js +4 -4
  56. package/dist/heyreach/capabilities.d.ts +4 -0
  57. package/dist/heyreach/conversations.d.ts +23 -0
  58. package/dist/heyreach/inbox.d.ts +0 -1
  59. package/dist/heyreach/index.js +251 -92
  60. package/dist/identity/index.js +2 -2
  61. package/dist/index.js +7 -7
  62. package/dist/insights/capped.d.ts +6 -6
  63. package/dist/insights/copy/index.d.ts +2 -0
  64. package/dist/insights/copy/reply-timing.d.ts +4 -0
  65. package/dist/insights/cost.d.ts +11 -1
  66. package/dist/insights/define.d.ts +25 -16
  67. package/dist/insights/inbox.d.ts +12 -0
  68. package/dist/insights/index.js +42 -6578
  69. package/dist/insights/inputs.generated.d.ts +60 -24
  70. package/dist/insights/ops/anomalies.d.ts +9 -0
  71. package/dist/insights/ops/index.d.ts +2 -0
  72. package/dist/insights/ops/period-comparison.d.ts +7 -8
  73. package/dist/insights/ops/pipeline-forecast.d.ts +10 -0
  74. package/dist/insights/ops/shared.d.ts +6 -1
  75. package/dist/insights/people/auto-replies.d.ts +11 -7
  76. package/dist/insights/people/dropped-replies.d.ts +13 -4
  77. package/dist/insights/people/hot-leads-read.d.ts +31 -0
  78. package/dist/insights/people/hot-leads.d.ts +15 -3
  79. package/dist/insights/people/index.d.ts +10 -2
  80. package/dist/insights/people/read.d.ts +1 -1
  81. package/dist/insights/registry.d.ts +14 -2
  82. package/dist/insights/run-cap.d.ts +10 -0
  83. package/dist/insights/senders/read.d.ts +0 -3
  84. package/dist/insights/tools.d.ts +12 -0
  85. package/dist/insights/tracked-reads.d.ts +53 -0
  86. package/dist/instantly/capabilities.d.ts +13 -1
  87. package/dist/instantly/index.js +122 -46
  88. package/dist/instantly/map-account.d.ts +2 -1
  89. package/dist/instantly/map-lead.d.ts +1 -0
  90. package/dist/instantly/map.d.ts +4 -3
  91. package/dist/internal/adapter.d.ts +17 -0
  92. package/dist/internal/capabilities.d.ts +13 -0
  93. package/dist/internal/engine/budget.d.ts +9 -1
  94. package/dist/internal/engine/engine.d.ts +2 -1
  95. package/dist/internal/engine/request.d.ts +2 -0
  96. package/dist/internal/errors.d.ts +5 -0
  97. package/dist/internal/hooks.d.ts +11 -0
  98. package/dist/internal/notes.d.ts +16 -0
  99. package/dist/internal/outbound/api.d.ts +14 -0
  100. package/dist/internal/outbound/core.d.ts +4 -1
  101. package/dist/internal/outbound/operation-shared.d.ts +2 -0
  102. package/dist/internal/sha256.d.ts +2 -0
  103. package/dist/internal/url.d.ts +1 -0
  104. package/dist/loader/index.js +3 -3
  105. package/dist/memory/index.js +6 -6
  106. package/dist/redact/index.d.ts +1 -1
  107. package/dist/redact/index.js +107 -19
  108. package/dist/redact/plugin.d.ts +26 -3
  109. package/dist/smartlead/index.js +22 -13
  110. package/dist/smartlead/map.d.ts +3 -2
  111. package/dist/sync/index.js +2 -2
  112. package/dist/tools/ai-sdk.js +5 -5
  113. package/dist/tools/by-name.d.ts +9 -1
  114. package/dist/tools/campaign-tools.d.ts +3 -1
  115. package/dist/tools/claude-agent.js +5 -5
  116. package/dist/tools/index.js +6 -6
  117. package/dist/tools/registry.d.ts +6 -0
  118. package/dist/tools/shared.d.ts +5 -1
  119. package/dist/tracing/index.js +1 -1
  120. package/dist/webhooks/index.js +11 -11
  121. package/package.json +1 -1
@@ -123,11 +123,17 @@ export interface InsightInputs {
123
123
  */
124
124
  readonly include_auto?: boolean | undefined;
125
125
  /**
126
- * The most replies to read. Each conversation among them costs one more request to check.
126
+ * Set to true to also check replies in conversations that belong to no campaign, such as a LinkedIn account's own messages on HeyReach. false sets them aside and counts them in totals.notInCampaign.
127
127
  *
128
- * A whole number from 1 to 1000. Defaults to `50`.
128
+ * Defaults to `false`.
129
129
  */
130
- readonly max_replies?: number | undefined;
130
+ readonly include_inbox?: boolean | undefined;
131
+ /**
132
+ * The most replies to read. Null reads every reply since `since`, up to 2,000.
133
+ *
134
+ * A whole number from 1 to 2000. Defaults to `null`.
135
+ */
136
+ readonly max_replies?: number | null | undefined;
131
137
  /**
132
138
  * A reply counts as dropped only after waiting this many hours without an answer
133
139
  *
@@ -162,11 +168,29 @@ export interface InsightInputs {
162
168
  */
163
169
  readonly limit?: number | undefined;
164
170
  /**
165
- * The most leads to read and score. A vendor request returns about 50 to 100 leads. When more exist, the leads behind recent replies are read as well, so engaged leads past the cap are still ranked.
171
+ * The most leads a lead listing reads: the leads labelled positive where the tool filters by interest, and the lead list itself where it cannot or include_engagement_only is true. A vendor request returns about 50 to 100 leads. The leads behind replies within recency_days are read on top.
166
172
  *
167
- * A whole number from 1 to 20,000. Defaults to `500`.
173
+ * A whole number from 1 to 20,000. Defaults to `2000`.
168
174
  */
169
175
  readonly max_leads?: number | undefined;
176
+ /**
177
+ * The most replies within recency_days to read: a safety ceiling, not a sample. A vendor request returns about 100 replies.
178
+ *
179
+ * A whole number from 1 to 20,000. Defaults to `1000`.
180
+ */
181
+ readonly max_replies?: number | undefined;
182
+ /**
183
+ * A positive interest label earns its full points while the last reply is within recency_days, fading evenly to none at this many days, and a lead whose last reply is older ranks after every lead with a fresher one. A label with no reply time keeps its points.
184
+ *
185
+ * A number, 1 or more. Defaults to `90`.
186
+ */
187
+ readonly max_age_days?: number | undefined;
188
+ /**
189
+ * Also walk the lead list up to max_leads, to rank leads whose only signal is opens or clicks. Where the tool cannot filter leads by interest the list is walked anyway.
190
+ *
191
+ * Defaults to `false`.
192
+ */
193
+ readonly include_engagement_only?: boolean | undefined;
170
194
  /**
171
195
  * Vendor interest labels that count as interested, matched without regard to case
172
196
  *
@@ -416,6 +440,12 @@ export interface InsightInputs {
416
440
  * Defaults to `false`.
417
441
  */
418
442
  readonly include_auto?: boolean | undefined;
443
+ /**
444
+ * Also time conversations that belong to no campaign, such as a LinkedIn account's own messages on HeyReach. false leaves their messages out of every figure and counts them in counts.notInCampaign.
445
+ *
446
+ * Defaults to `false`.
447
+ */
448
+ readonly include_inbox?: boolean | undefined;
419
449
  /**
420
450
  * The most messages to read, sent and received together. A page of messages costs 1 request.
421
451
  *
@@ -459,15 +489,15 @@ export interface InsightInputs {
459
489
  */
460
490
  readonly days?: number | undefined;
461
491
  /**
462
- * The most active campaigns to read. Each costs up to 2 requests, or 3 when the vendor has no workspace totals.
492
+ * The most active campaigns to read. Each costs one read of its settings and one listing of its senders, plus 1 request when the vendor has no workspace totals.
463
493
  *
464
- * A whole number from 1 to 200. Defaults to `25`.
494
+ * A whole number from 1 to 200. Defaults to `50`.
465
495
  */
466
496
  readonly max_campaigns?: number | undefined;
467
497
  /**
468
- * The most senders to read for the workspace, and for each campaign
498
+ * The most senders to read for the workspace, and for each campaign. A listing costs 1 request per 100 senders, and on Instantly a campaign's listing costs 2 per 100 mailboxes in the workspace.
469
499
  *
470
- * A whole number from 1 to 1000. Defaults to `200`.
500
+ * A whole number from 1 to 1000. Defaults to `1000`.
471
501
  */
472
502
  readonly max_senders?: number | undefined;
473
503
  /**
@@ -537,9 +567,9 @@ export interface InsightInputs {
537
567
  */
538
568
  readonly check_health?: boolean | undefined;
539
569
  /**
540
- * The most senders to check
570
+ * The most senders to check. The listing costs 1 request per 100 senders.
541
571
  *
542
- * A whole number from 1 to 1000. Defaults to `100`.
572
+ * A whole number from 1 to 1000. Defaults to `1000`.
543
573
  */
544
574
  readonly max_senders?: number | undefined;
545
575
  /**
@@ -558,9 +588,9 @@ export interface InsightInputs {
558
588
  /** The input of `senderLoad` (the `sender_load` tool). */
559
589
  readonly senderLoad: {
560
590
  /**
561
- * The most campaigns to read. Each costs 1 request.
591
+ * The most campaigns to read. Each costs one listing of its senders.
562
592
  *
563
- * A whole number from 1 to 200. Defaults to `25`.
593
+ * A whole number from 1 to 200. Defaults to `50`.
564
594
  */
565
595
  readonly max_campaigns?: number | undefined;
566
596
  /**
@@ -570,9 +600,9 @@ export interface InsightInputs {
570
600
  */
571
601
  readonly max_campaigns_per_sender?: number | undefined;
572
602
  /**
573
- * The most senders to read for the workspace, and for each campaign
603
+ * The most senders to read for the workspace, and for each campaign. A listing costs 1 request per 100 senders, and on Instantly a campaign's listing costs 2 per 100 mailboxes in the workspace.
574
604
  *
575
- * A whole number from 1 to 1000. Defaults to `200`.
605
+ * A whole number from 1 to 1000. Defaults to `1000`.
576
606
  */
577
607
  readonly max_senders?: number | undefined;
578
608
  /**
@@ -755,6 +785,12 @@ export interface InsightInputs {
755
785
  * At least 1 item. Each one of `sent`, `contacted`, `replied`, `positive`, `bounced`, `opened`, `clicked`, `unsubscribed`. Defaults to `["sent","replied","bounced"]`.
756
786
  */
757
787
  readonly metrics?: ("sent" | "contacted" | "replied" | "positive" | "bounced" | "opened" | "clicked" | "unsubscribed")[] | undefined;
788
+ /**
789
+ * A day is judged only when its count or its baseline mean reaches this many, so one reply on a quiet day is not flagged. 0 judges every day.
790
+ *
791
+ * A whole number from 0 to 9,007,199,254,740,991. Defaults to `3`.
792
+ */
793
+ readonly min_count?: number | undefined;
758
794
  /**
759
795
  * The fewest baseline days with data a day needs to be tested
760
796
  *
@@ -773,13 +809,13 @@ export interface InsightInputs {
773
809
  /**
774
810
  * The most campaigns to read. Each costs two stats requests.
775
811
  *
776
- * A whole number from 1 to 200. Defaults to `25`.
812
+ * A whole number from 1 to 200. Defaults to `50`.
777
813
  */
778
814
  readonly max_campaigns?: number | undefined;
779
815
  /**
780
816
  * Only campaigns in one of these states are read: active, paused, completed, draft, archived or unknown
781
817
  *
782
- * At least 1 item. Each one of `active`, `archived`, `completed`, `draft`, `paused`, `unknown`. Defaults to `["active","paused","completed"]`.
818
+ * At least 1 item. Each one of `active`, `archived`, `completed`, `draft`, `paused`, `unknown`. Defaults to `["active"]`.
783
819
  */
784
820
  readonly statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
785
821
  /**
@@ -818,13 +854,13 @@ export interface InsightInputs {
818
854
  /**
819
855
  * The most campaigns to read. Each costs one stats request.
820
856
  *
821
- * A whole number from 1 to 200. Defaults to `25`.
857
+ * A whole number from 1 to 200. Defaults to `50`.
822
858
  */
823
859
  readonly max_campaigns?: number | undefined;
824
860
  /**
825
861
  * Only campaigns in one of these states are read: active, paused, completed, draft, archived or unknown
826
862
  *
827
- * At least 1 item. Each one of `active`, `archived`, `completed`, `draft`, `paused`, `unknown`. Defaults to `["active","paused","completed"]`.
863
+ * At least 1 item. Each one of `active`, `archived`, `completed`, `draft`, `paused`, `unknown`. Defaults to `["active"]`.
828
864
  */
829
865
  readonly statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
830
866
  /**
@@ -857,7 +893,7 @@ export interface InsightInputs {
857
893
  /**
858
894
  * The most campaigns to read. Each costs one stats request.
859
895
  *
860
- * A whole number from 1 to 200. Defaults to `25`.
896
+ * A whole number from 1 to 200. Defaults to `150`.
861
897
  */
862
898
  readonly max_campaigns?: number | undefined;
863
899
  /**
@@ -890,13 +926,13 @@ export interface InsightInputs {
890
926
  /**
891
927
  * The most campaigns to read. Each costs one stats request.
892
928
  *
893
- * A whole number from 1 to 200. Defaults to `25`.
929
+ * A whole number from 1 to 200. Defaults to `50`.
894
930
  */
895
931
  readonly max_campaigns?: number | undefined;
896
932
  /**
897
933
  * Only campaigns in one of these states are read: active, paused, completed, draft, archived or unknown
898
934
  *
899
- * At least 1 item. Each one of `active`, `archived`, `completed`, `draft`, `paused`, `unknown`. Defaults to `["active","paused","completed"]`.
935
+ * At least 1 item. Each one of `active`, `archived`, `completed`, `draft`, `paused`, `unknown`. Defaults to `["active"]`.
900
936
  */
901
937
  readonly statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
902
938
  /**
@@ -911,13 +947,13 @@ export interface InsightInputs {
911
947
  /**
912
948
  * The most campaigns to read. Each costs two stats requests, and three more plus its leads when active.
913
949
  *
914
- * A whole number from 1 to 200. Defaults to `25`.
950
+ * A whole number from 1 to 200. Defaults to `50`.
915
951
  */
916
952
  readonly max_campaigns?: number | undefined;
917
953
  /**
918
954
  * Only campaigns in one of these states are read: active, paused, completed, draft, archived or unknown
919
955
  *
920
- * At least 1 item. Each one of `active`, `archived`, `completed`, `draft`, `paused`, `unknown`. Defaults to `["active","paused","completed"]`.
956
+ * At least 1 item. Each one of `active`, `archived`, `completed`, `draft`, `paused`, `unknown`. Defaults to `["active"]`.
921
957
  */
922
958
  readonly statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
923
959
  /**
@@ -11,6 +11,11 @@ declare const metricSchema: z.ZodEnum<{
11
11
  sent: "sent";
12
12
  }>;
13
13
  export type AnomalyMetric = z.infer<typeof metricSchema>;
14
+ /**
15
+ * A day and its baseline both under this count are not judged: one LinkedIn
16
+ * reply against an average of 0.1 a day is a z-score of 3.5 and no news.
17
+ */
18
+ export declare const MIN_COUNT = 3;
14
19
  export interface Anomaly {
15
20
  /** `YYYY-MM-DD`. */
16
21
  readonly date: string;
@@ -45,6 +50,8 @@ export interface AnomalyOptions {
45
50
  readonly threshold: number;
46
51
  readonly baselineDays: number;
47
52
  readonly minBaselinePoints: number;
53
+ /** A day whose count and baseline mean are both under this is not judged. Defaults to `MIN_COUNT`. */
54
+ readonly minCount?: number | undefined;
48
55
  /** The first day that is tested. Earlier days only feed baselines. */
49
56
  readonly firstDay: string;
50
57
  }
@@ -67,6 +74,7 @@ export declare const anomalies: import("../define.ts").InsightDefinition<"anomal
67
74
  campaign: string | null;
68
75
  days: number;
69
76
  metrics: ("positive" | "bounced" | "replied" | "unsubscribed" | "clicked" | "contacted" | "opened" | "sent")[];
77
+ min_count: number;
70
78
  min_baseline_points: number;
71
79
  threshold: number;
72
80
  }, Anomalies, {
@@ -74,6 +82,7 @@ export declare const anomalies: import("../define.ts").InsightDefinition<"anomal
74
82
  campaign?: string | null | undefined;
75
83
  days?: number | undefined;
76
84
  metrics?: ("positive" | "bounced" | "replied" | "unsubscribed" | "clicked" | "contacted" | "opened" | "sent")[] | undefined;
85
+ min_count?: number | undefined;
77
86
  min_baseline_points?: number | undefined;
78
87
  threshold?: number | undefined;
79
88
  }>;
@@ -39,6 +39,7 @@ export declare const OPS_INSIGHTS: readonly [import("../define.ts").InsightDefin
39
39
  campaign: string | null;
40
40
  days: number;
41
41
  metrics: ("positive" | "bounced" | "replied" | "unsubscribed" | "clicked" | "contacted" | "opened" | "sent")[];
42
+ min_count: number;
42
43
  min_baseline_points: number;
43
44
  threshold: number;
44
45
  }, import("./anomalies.ts").Anomalies, {
@@ -46,6 +47,7 @@ export declare const OPS_INSIGHTS: readonly [import("../define.ts").InsightDefin
46
47
  campaign?: string | null | undefined;
47
48
  days?: number | undefined;
48
49
  metrics?: ("positive" | "bounced" | "replied" | "unsubscribed" | "clicked" | "contacted" | "opened" | "sent")[] | undefined;
50
+ min_count?: number | undefined;
49
51
  min_baseline_points?: number | undefined;
50
52
  threshold?: number | undefined;
51
53
  }>, import("../define.ts").InsightDefinition<"periodComparison", {
@@ -1,6 +1,6 @@
1
- import type { Campaign, CampaignStatus } from "../../internal/entities.ts";
1
+ import type { Campaign } from "../../internal/entities.ts";
2
2
  import type { MetricCounts } from "../../internal/metrics.ts";
3
- import type { CampaignsRead } from "../capped.ts";
3
+ import type { CampaignsRead, Capped } from "../capped.ts";
4
4
  import type { InsightContext } from "../define.ts";
5
5
  import type { ProportionTest } from "../stats.ts";
6
6
  import type { CampaignLabel, DayRange, ReplyBasis, Totals } from "./shared.ts";
@@ -72,12 +72,11 @@ export interface Periods {
72
72
  readonly campaigns: readonly CampaignPeriods[];
73
73
  readonly read: CampaignsRead;
74
74
  }
75
- /** Each campaign's totals for the last `days` and the `days` before: two stats requests per campaign. */
76
- export declare const readPeriods: (context: InsightContext, options: {
77
- readonly days: number;
78
- readonly max_campaigns: number;
79
- readonly statuses: readonly CampaignStatus[];
80
- }) => Promise<Periods>;
75
+ /**
76
+ * The campaigns listed, each with its totals for the last `days` and the
77
+ * `days` before: two stats requests per campaign.
78
+ */
79
+ export declare const readPeriods: (context: InsightContext, listed: Capped<Campaign>, days: number) => Promise<Periods>;
81
80
  /** Every campaign's two periods added together. */
82
81
  export declare const totalOf: (campaigns: readonly CampaignPeriods[], alpha: number) => ComparedAcross;
83
82
  /** Says in a note which rates of a total leave rows out. Returns the comparison. */
@@ -53,6 +53,16 @@ export interface ForecastOptions {
53
53
  readonly leadsWhat: string;
54
54
  }
55
55
  /** Reads one campaign's leads, totals and recent pace, and projects what is left. */
56
+ /** How long a campaign's leads last: its leads by status and the recent pace of new leads started. */
57
+ export declare const runwayOf: (context: InsightContext, campaign: Campaign, options: ForecastOptions) => Promise<{
58
+ byStatus: Record<"active" | "completed" | "paused" | "unknown" | "bounced" | "replied" | "skipped" | "unsubscribed", number>;
59
+ complete: boolean;
60
+ daysLeft: number | null;
61
+ leadsRead: number;
62
+ pace: number | null;
63
+ remaining: number;
64
+ split: import("../../internal/runway.ts").ActiveSplit;
65
+ }>;
56
66
  export declare const forecastCampaign: (context: InsightContext, campaign: Campaign, options: ForecastOptions) => Promise<PipelineForecast>;
57
67
  export declare const pipelineForecast: import("../define.ts").InsightDefinition<"pipelineForecast", {
58
68
  campaign: string;
@@ -35,7 +35,11 @@ export declare const campaignTotalsCost: (input: {
35
35
  readonly max_campaigns: number;
36
36
  readonly statuses: readonly string[];
37
37
  }, price: Price) => number;
38
- export declare const listFields: (costPerCampaign: string) => {
38
+ interface ListDefaults {
39
+ readonly maxCampaigns: number;
40
+ readonly statuses: readonly [CampaignStatus, ...CampaignStatus[]];
41
+ }
42
+ export declare const listFields: (costPerCampaign: string, defaults?: ListDefaults) => {
39
43
  max_campaigns: z.ZodDefault<z.ZodNumber>;
40
44
  statuses: z.ZodDefault<z.ZodArray<z.ZodEnum<{
41
45
  active: "active";
@@ -166,3 +170,4 @@ export interface DayCounts {
166
170
  * tool on a combined instance) are added together.
167
171
  */
168
172
  export declare const readDaily: (context: InsightContext, campaign: string | null, range: DayRange) => Promise<DayCounts[]>;
173
+ export {};
@@ -1,14 +1,18 @@
1
- import type { Lead } from "../../internal/entities.ts";
1
+ import type { Lead, Reply } from "../../internal/entities.ts";
2
2
  import type { InsightContext } from "../define.ts";
3
- /** The most replies read to find leads whose replies were all automatic. */
4
- export declare const AUTO_CHECK_REPLIES = 200;
3
+ /** The start of a note for a check redact keeps from running. */
4
+ export declare const ADDRESSES_MASKED = "The redact plugin masks email addresses, which a reply can name its lead by, so";
5
+ /**
6
+ * `true` when the redact plugin masks email addresses. A reply can name its
7
+ * lead by address (Instantly's do), and a masked address cannot be read back
8
+ * as a lead.
9
+ */
10
+ export declare const addressesMasked: (context: InsightContext) => boolean;
5
11
  /** A lead's own ref and, when it has an address, the ref a reply may name it by. */
6
12
  export declare const refsOf: (lead: Lead) => string[];
7
13
  /**
8
14
  * The refs of leads whose every reply read is flagged automatic, by the
9
15
  * vendor or by a fixed rule. A lead with one reply not flagged is not in it,
10
- * nor is a lead none of whose replies were read. Reads at most
11
- * `AUTO_CHECK_REPLIES` replies, newest first, and nothing when no lead
12
- * counted replies or the tool cannot list replies.
16
+ * nor is a lead none of whose replies were read.
13
17
  */
14
- export declare const autoOnlyRefs: (context: InsightContext, campaign: string | null, leads: readonly Lead[]) => Promise<ReadonlySet<string>>;
18
+ export declare const autoOnlyRefs: (replies: readonly Reply[], leads: readonly Lead[]) => ReadonlySet<string>;
@@ -30,15 +30,22 @@ export interface DroppedReplies {
30
30
  readonly skippedByCategory: number;
31
31
  /** Left out because they are flagged automatic, by the vendor or by a fixed rule. */
32
32
  readonly skippedAuto: number;
33
+ /**
34
+ * Set aside because their conversation belongs to no campaign, such as a
35
+ * LinkedIn account's own messages; 0 with `include_inbox`. `null` when the
36
+ * vendor's replies are all campaign replies (no `replies.inbox`). Always
37
+ * set by dropped_replies; optional so a value built by hand stays valid.
38
+ */
39
+ readonly notInCampaign?: number | null;
33
40
  /** Conversations the remaining replies belong to. */
34
41
  readonly conversations: number;
35
42
  readonly answered: number;
36
43
  readonly dropped: number;
37
- /** Unanswered, but waiting less than `older_than_hours`. */
44
+ /** Unanswered, as far as was read, but waiting less than `older_than_hours`. */
38
45
  readonly tooRecent: number;
39
46
  /** Could not be checked: no thread or lead to read, or no time on the reply. Not counted as dropped. */
40
47
  readonly unchecked: number;
41
- /** `true` when `max_replies` stopped the read with more replies left, so dropped ones may be missing. */
48
+ /** `true` when `max_replies`, or the 2,000 replies one window reads, stopped the read with more replies left, so dropped ones may be missing. */
42
49
  readonly moreRepliesExist: boolean;
43
50
  };
44
51
  readonly since: string;
@@ -47,13 +54,15 @@ export interface DroppedReplies {
47
54
  export declare const droppedReplies: import("../define.ts").InsightDefinition<"droppedReplies", {
48
55
  categories: ("unknown" | "bounce" | "negative" | "neutral" | "ooo" | "positive" | "unsubscribe")[];
49
56
  include_auto: boolean;
50
- max_replies: number;
57
+ include_inbox: boolean;
58
+ max_replies: number | null;
51
59
  older_than_hours: number;
52
60
  since: string | null;
53
61
  }, DroppedReplies, {
54
62
  categories?: ("unknown" | "bounce" | "negative" | "neutral" | "ooo" | "positive" | "unsubscribe")[] | undefined;
55
63
  include_auto?: boolean | undefined;
56
- max_replies?: number | undefined;
64
+ include_inbox?: boolean | undefined;
65
+ max_replies?: number | null | undefined;
57
66
  older_than_hours?: number | undefined;
58
67
  since?: string | null | undefined;
59
68
  }>;
@@ -0,0 +1,31 @@
1
+ import type { Lead, Reply } from "../../internal/entities.ts";
2
+ import type { InsightContext } from "../define.ts";
3
+ /** What the reads take from the input. */
4
+ export interface ReadInput {
5
+ readonly campaign: string | null;
6
+ readonly include_engagement_only: boolean;
7
+ readonly limit: number;
8
+ readonly max_leads: number;
9
+ readonly max_replies: number;
10
+ readonly positive_labels: readonly string[];
11
+ readonly recency_days: number;
12
+ }
13
+ export interface Candidates {
14
+ /** Every lead read, each once. */
15
+ readonly leads: readonly Lead[];
16
+ /** The replies read within `recency_days`, `null` when none could be read. */
17
+ readonly replies: readonly Reply[] | null;
18
+ /** Leads read because they replied within `recency_days`. */
19
+ readonly fromReplies: number;
20
+ /** Leads that replied within `recency_days` and could not be read, probably deleted. */
21
+ readonly unreadable: number;
22
+ /** `true` when `max_leads` stopped a lead listing with more leads left. */
23
+ readonly moreLeadsExist: boolean;
24
+ }
25
+ /**
26
+ * Every lead hot_leads scores. Candidates come from the signal: the replies
27
+ * within `recency_days` and the leads the vendor labels positive. The lead
28
+ * list is walked as well where the vendor cannot filter by interest, or when
29
+ * `include_engagement_only` asks for leads with only opens or clicks.
30
+ */
31
+ export declare const readCandidates: (context: InsightContext, values: ReadInput) => Promise<Candidates>;
@@ -43,12 +43,18 @@ export interface HotLeads {
43
43
  /** Unsubscribed or bounced leads, left out. */
44
44
  readonly excluded: number;
45
45
  /**
46
- * `true` when `max_leads` stopped the lead listing with more leads left:
47
- * those were not scored, except the ones found through recent replies.
46
+ * `true` when `max_leads` stopped a lead listing with more leads left:
47
+ * those were not scored, except the ones found through their replies.
48
48
  */
49
49
  readonly moreLeadsExist: boolean;
50
- /** Leads past the cap, read because they replied within `recency_days`. Counted in `leadsRead`. */
50
+ /** Replies within `recency_days` read. */
51
+ readonly repliesRead: number;
52
+ /** Leads no listing read, read because they replied within `recency_days`. Counted in `leadsRead`. */
51
53
  readonly fromReplies: number;
54
+ /** Leads that replied within `recency_days` and could not be read, probably deleted. Not scored. */
55
+ readonly unreadable: number;
56
+ /** Leads with a score above 0 whose last reply is older than `max_age_days`, listed after every fresher one. */
57
+ readonly stale: number;
52
58
  /**
53
59
  * Leads with replies that earned no points because they were automatic:
54
60
  * the vendor labels the lead out-of-office or bounced, or every reply of
@@ -64,6 +70,9 @@ export declare const hotLeads: import("../define.ts").InsightDefinition<"hotLead
64
70
  count_cap: number;
65
71
  limit: number;
66
72
  max_leads: number;
73
+ max_replies: number;
74
+ max_age_days: number;
75
+ include_engagement_only: boolean;
67
76
  positive_labels: string[];
68
77
  recency_days: number;
69
78
  weight_click: number;
@@ -76,6 +85,9 @@ export declare const hotLeads: import("../define.ts").InsightDefinition<"hotLead
76
85
  count_cap?: number | undefined;
77
86
  limit?: number | undefined;
78
87
  max_leads?: number | undefined;
88
+ max_replies?: number | undefined;
89
+ max_age_days?: number | undefined;
90
+ include_engagement_only?: boolean | undefined;
79
91
  positive_labels?: string[] | undefined;
80
92
  recency_days?: number | undefined;
81
93
  weight_click?: number | undefined;
@@ -41,13 +41,15 @@ export declare const PEOPLE_INSIGHTS: readonly [import("../define.ts").InsightDe
41
41
  }>, import("../define.ts").InsightDefinition<"droppedReplies", {
42
42
  categories: ("unknown" | "bounce" | "negative" | "neutral" | "ooo" | "positive" | "unsubscribe")[];
43
43
  include_auto: boolean;
44
- max_replies: number;
44
+ include_inbox: boolean;
45
+ max_replies: number | null;
45
46
  older_than_hours: number;
46
47
  since: string | null;
47
48
  }, import("./dropped-replies.ts").DroppedReplies, {
48
49
  categories?: ("unknown" | "bounce" | "negative" | "neutral" | "ooo" | "positive" | "unsubscribe")[] | undefined;
49
50
  include_auto?: boolean | undefined;
50
- max_replies?: number | undefined;
51
+ include_inbox?: boolean | undefined;
52
+ max_replies?: number | null | undefined;
51
53
  older_than_hours?: number | undefined;
52
54
  since?: string | null | undefined;
53
55
  }>, import("../define.ts").InsightDefinition<"hotLeads", {
@@ -55,6 +57,9 @@ export declare const PEOPLE_INSIGHTS: readonly [import("../define.ts").InsightDe
55
57
  count_cap: number;
56
58
  limit: number;
57
59
  max_leads: number;
60
+ max_replies: number;
61
+ max_age_days: number;
62
+ include_engagement_only: boolean;
58
63
  positive_labels: string[];
59
64
  recency_days: number;
60
65
  weight_click: number;
@@ -67,6 +72,9 @@ export declare const PEOPLE_INSIGHTS: readonly [import("../define.ts").InsightDe
67
72
  count_cap?: number | undefined;
68
73
  limit?: number | undefined;
69
74
  max_leads?: number | undefined;
75
+ max_replies?: number | undefined;
76
+ max_age_days?: number | undefined;
77
+ include_engagement_only?: boolean | undefined;
70
78
  positive_labels?: string[] | undefined;
71
79
  recency_days?: number | undefined;
72
80
  weight_click?: number | undefined;
@@ -53,4 +53,4 @@ export declare const isNegative: (lead: Lead) => boolean;
53
53
  * and the ones with no counts on any lead are named. `effect` finishes the
54
54
  * sentence, for example `those are null`.
55
55
  */
56
- export declare const noteEngagement: (context: InsightContext, leads: readonly Lead[], effect: string) => void;
56
+ export declare const noteEngagement: (context: InsightContext, leads: readonly Lead[], effect: string, counts?: string) => void;
@@ -42,13 +42,15 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
42
42
  }>, import("./define.ts").InsightDefinition<"droppedReplies", {
43
43
  categories: ("unknown" | "bounce" | "negative" | "neutral" | "ooo" | "positive" | "unsubscribe")[];
44
44
  include_auto: boolean;
45
- max_replies: number;
45
+ include_inbox: boolean;
46
+ max_replies: number | null;
46
47
  older_than_hours: number;
47
48
  since: string | null;
48
49
  }, import("./people/dropped-replies.ts").DroppedReplies, {
49
50
  categories?: ("unknown" | "bounce" | "negative" | "neutral" | "ooo" | "positive" | "unsubscribe")[] | undefined;
50
51
  include_auto?: boolean | undefined;
51
- max_replies?: number | undefined;
52
+ include_inbox?: boolean | undefined;
53
+ max_replies?: number | null | undefined;
52
54
  older_than_hours?: number | undefined;
53
55
  since?: string | null | undefined;
54
56
  }>, import("./define.ts").InsightDefinition<"hotLeads", {
@@ -56,6 +58,9 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
56
58
  count_cap: number;
57
59
  limit: number;
58
60
  max_leads: number;
61
+ max_replies: number;
62
+ max_age_days: number;
63
+ include_engagement_only: boolean;
59
64
  positive_labels: string[];
60
65
  recency_days: number;
61
66
  weight_click: number;
@@ -68,6 +73,9 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
68
73
  count_cap?: number | undefined;
69
74
  limit?: number | undefined;
70
75
  max_leads?: number | undefined;
76
+ max_replies?: number | undefined;
77
+ max_age_days?: number | undefined;
78
+ include_engagement_only?: boolean | undefined;
71
79
  positive_labels?: string[] | undefined;
72
80
  recency_days?: number | undefined;
73
81
  weight_click?: number | undefined;
@@ -148,12 +156,14 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
148
156
  }>, import("./define.ts").InsightDefinition<"replyTiming", {
149
157
  campaign: string | null;
150
158
  include_auto: boolean;
159
+ include_inbox: boolean;
151
160
  max_messages: number;
152
161
  since: string | null;
153
162
  timezone_offset_minutes: number;
154
163
  }, import("./copy/reply-timing.ts").ReplyTiming, {
155
164
  campaign?: string | null | undefined;
156
165
  include_auto?: boolean | undefined;
166
+ include_inbox?: boolean | undefined;
157
167
  max_messages?: number | undefined;
158
168
  since?: string | null | undefined;
159
169
  timezone_offset_minutes?: number | undefined;
@@ -268,6 +278,7 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
268
278
  campaign: string | null;
269
279
  days: number;
270
280
  metrics: ("positive" | "bounced" | "replied" | "unsubscribed" | "clicked" | "contacted" | "opened" | "sent")[];
281
+ min_count: number;
271
282
  min_baseline_points: number;
272
283
  threshold: number;
273
284
  }, import("./ops/anomalies.ts").Anomalies, {
@@ -275,6 +286,7 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
275
286
  campaign?: string | null | undefined;
276
287
  days?: number | undefined;
277
288
  metrics?: ("positive" | "bounced" | "replied" | "unsubscribed" | "clicked" | "contacted" | "opened" | "sent")[] | undefined;
289
+ min_count?: number | undefined;
278
290
  min_baseline_points?: number | undefined;
279
291
  threshold?: number | undefined;
280
292
  }>, import("./define.ts").InsightDefinition<"periodComparison", {
@@ -1,3 +1,4 @@
1
+ import { OutboundError } from "../internal/errors.ts";
1
2
  import type { OutboundApi } from "../internal/outbound/api.ts";
2
3
  import type { InsightCost } from "./cost.ts";
3
4
  export interface CapOptions {
@@ -31,5 +32,14 @@ export interface RunCap {
31
32
  readonly failed: (cause: unknown) => never;
32
33
  /** The note for a run that finished without reads the cap stopped. */
33
34
  readonly shortNote: () => string | undefined;
35
+ /**
36
+ * What stopped a read, in words with what to raise, when a request cap
37
+ * did: this run's own, a `budget()` or a cap per call. `undefined` for
38
+ * any other failure.
39
+ */
40
+ readonly capReached: (cause: unknown) => string | undefined;
41
+ /** Requests counted so far, every read of the run. */
42
+ readonly used: () => number;
34
43
  }
44
+ export declare const isCapStop: (cause: unknown) => cause is OutboundError;
35
45
  export declare const runCap: <Input>(outbound: OutboundApi, spec: Capped<Input>, input: Input, options: CapOptions) => RunCap;
@@ -1,10 +1,7 @@
1
1
  import type { SenderHealth } from "../../internal/entities-account.ts";
2
2
  import type { Campaign, CampaignStatus, Sender } from "../../internal/entities.ts";
3
- import type { ListAll } from "../../internal/outbound/api.ts";
4
3
  import type { Capped } from "../capped.ts";
5
4
  import type { InsightContext } from "../define.ts";
6
- /** Walks a listing up to `max` records, and says so in a note naming `input` when more exist. */
7
- export declare const readCapped: <Item>(context: InsightContext, walk: (max: number) => ListAll<Item>, max: number, what: string, input: string) => Promise<Item[]>;
8
5
  /** The campaigns in the given statuses, up to `max_campaigns`. */
9
6
  export declare const readCampaigns: (context: InsightContext, statuses: readonly CampaignStatus[], max: number) => Promise<Campaign[]>;
10
7
  /** The senders attached to one campaign, up to `max`. */
@@ -11,9 +11,21 @@ export interface InsightToolsOptions {
11
11
  * removes the default.
12
12
  */
13
13
  readonly maxRequestsPerToolCall?: number | undefined;
14
+ /**
15
+ * What a cap message tells the user to raise. Defaults to
16
+ * `maxRequestsPerToolCall`; a surface that sets the cap its own way names
17
+ * its own, as `outbound mcp` names `--max-requests`.
18
+ */
19
+ readonly capSetting?: string | undefined;
14
20
  }
15
21
  /** The most an insight tool call may send when no cap is set, whatever its input. */
16
22
  export declare const INSIGHT_TOOL_CEILING = 500;
23
+ /**
24
+ * Why `insightTools` leaves an insight out on this instance, in the words of
25
+ * an `Unsupported` error. `undefined` for a name that is no insight, or one
26
+ * the instance offers.
27
+ */
28
+ export declare const insightLeftOutReason: (outbound: OutboundApi, name: string) => string | undefined;
17
29
  /**
18
30
  * The insights this instance can serve, as tools. An insight whose adapter
19
31
  * lacks a capability or a field it needs, or that cannot match records while the redact