outbound-sdk 0.10.0 → 0.12.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 (85) hide show
  1. package/dist/alerts/index.js +1 -1
  2. package/dist/cards/index.js +201 -92
  3. package/dist/cards/sender-tool-cards.d.ts +6 -0
  4. package/dist/chunks/{chunk-MEEJIIIA.js → chunk-2ADIGC2N.js} +77 -8
  5. package/dist/chunks/{chunk-NAYVG7SI.js → chunk-3DDYXUDG.js} +1 -1
  6. package/dist/chunks/{chunk-UAHYPASH.js → chunk-3LRIWQEJ.js} +2 -1
  7. package/dist/chunks/{chunk-UZLFZZ2U.js → chunk-AWNH4I5D.js} +11 -2
  8. package/dist/chunks/{chunk-A7DLJUA6.js → chunk-B72F56HF.js} +3 -1
  9. package/dist/chunks/{chunk-KMQHXFIZ.js → chunk-CTRYCW4G.js} +648 -182
  10. package/dist/chunks/{chunk-OVTYA3IB.js → chunk-HDTOGEVN.js} +532 -182
  11. package/dist/chunks/{chunk-POBAY3TI.js → chunk-HXCZMMSD.js} +21 -0
  12. package/dist/chunks/chunk-I7GBBHD2.js +80 -0
  13. package/dist/chunks/{chunk-FTK4JS65.js → chunk-KNWJIJVO.js} +73 -4
  14. package/dist/chunks/{chunk-UOJG4VYF.js → chunk-LD5OAELW.js} +1 -1
  15. package/dist/chunks/{chunk-YFJ3OQZS.js → chunk-OPLXELPS.js} +5 -1
  16. package/dist/chunks/{chunk-KQCIF5IT.js → chunk-UIINRLHQ.js} +23 -9
  17. package/dist/chunks/{chunk-OMCDMELK.js → chunk-UWNQEQIX.js} +1 -1
  18. package/dist/chunks/{chunk-MPE6VLLY.js → chunk-UZ4YWUZ7.js} +1 -1
  19. package/dist/chunks/{tools-AVJ3XJ5A.js → tools-EKLZKXZU.js} +5 -4
  20. package/dist/cli/bin.js +11 -10
  21. package/dist/cli/config.d.ts +2 -0
  22. package/dist/cli/index.js +10 -9
  23. package/dist/combine/index.js +36 -2
  24. package/dist/emailbison/index.js +4 -4
  25. package/dist/fixtures/index.js +4 -4
  26. package/dist/heyreach/index.js +14 -6
  27. package/dist/identity/index.js +46 -11
  28. package/dist/identity/keys.d.ts +1 -1
  29. package/dist/index.js +8 -6
  30. package/dist/insights/define.d.ts +1 -1
  31. package/dist/insights/index.js +5 -4
  32. package/dist/insights/inputs.generated.d.ts +68 -5
  33. package/dist/insights/ops/channel-mix.d.ts +8 -1
  34. package/dist/insights/ops/period-comparison.d.ts +13 -2
  35. package/dist/insights/ops/shared.d.ts +11 -1
  36. package/dist/insights/ops/tag-rollup.d.ts +8 -1
  37. package/dist/insights/people/dropped-replies-check.d.ts +14 -2
  38. package/dist/insights/people/find.d.ts +5 -4
  39. package/dist/insights/people/hot-leads.d.ts +10 -1
  40. package/dist/insights/people/index.d.ts +26 -2
  41. package/dist/insights/people/person-summary.d.ts +15 -3
  42. package/dist/insights/people/thread-context.d.ts +79 -0
  43. package/dist/insights/people/thread-contexts.d.ts +59 -0
  44. package/dist/insights/people/thread-read.d.ts +22 -0
  45. package/dist/insights/registry.d.ts +25 -3
  46. package/dist/insights/senders/domain-health.d.ts +1 -1
  47. package/dist/insights/senders/index.d.ts +1 -1
  48. package/dist/insights/senders/read.d.ts +9 -0
  49. package/dist/instantly/adapter.d.ts +3 -2
  50. package/dist/instantly/capabilities.d.ts +5 -0
  51. package/dist/instantly/index.js +148 -45
  52. package/dist/instantly/senders.d.ts +3 -0
  53. package/dist/internal/adapter.d.ts +7 -0
  54. package/dist/internal/capabilities.d.ts +8 -0
  55. package/dist/internal/entities.d.ts +20 -0
  56. package/dist/internal/fields.d.ts +8 -0
  57. package/dist/internal/outbound/api.d.ts +12 -0
  58. package/dist/internal/outbound/operations-account.d.ts +4 -1
  59. package/dist/internal/outbound/outbound.d.ts +2 -1
  60. package/dist/internal/outbound/specs-account.d.ts +2 -1
  61. package/dist/internal/person.d.ts +32 -0
  62. package/dist/internal/records.d.ts +2 -2
  63. package/dist/internal/url.d.ts +2 -1
  64. package/dist/loader/index.js +1 -1
  65. package/dist/memory/data.d.ts +2 -1
  66. package/dist/memory/index.js +6 -4
  67. package/dist/redact/index.d.ts +1 -1
  68. package/dist/redact/index.js +48 -26
  69. package/dist/redact/plugin.d.ts +12 -4
  70. package/dist/redact/tokens.d.ts +21 -0
  71. package/dist/smartlead/index.js +18 -7
  72. package/dist/tools/account-tools.d.ts +0 -5
  73. package/dist/tools/ai-sdk.js +5 -3
  74. package/dist/tools/campaign-tools.d.ts +0 -4
  75. package/dist/tools/claude-agent.js +5 -3
  76. package/dist/tools/deliverability-check.d.ts +9 -0
  77. package/dist/tools/index.js +6 -4
  78. package/dist/tools/people-tools.d.ts +4 -1
  79. package/dist/tools/person-input.d.ts +17 -0
  80. package/dist/tools/sender-health.d.ts +8 -0
  81. package/dist/tools/sender-impact.d.ts +38 -0
  82. package/dist/tools/shared.d.ts +5 -0
  83. package/dist/webhooks/index.js +6 -6
  84. package/package.json +1 -1
  85. /package/dist/chunks/{chunk-5XLR6XVV.js → chunk-TOZKA7JR.js} +0 -0
@@ -23,6 +23,8 @@ export interface Capabilities {
23
23
  "senders.warmup": boolean;
24
24
  /** DNS records, connection state and warmup traffic for one sender. */
25
25
  "senders.health": boolean;
26
+ /** The same health for every sender, a page at a time, in a few requests a page instead of a few per sender. */
27
+ "senders.healthList": boolean;
26
28
  /** List every lead on the credential, across campaigns. */
27
29
  "leads.list": boolean;
28
30
  "leads.get": boolean;
@@ -81,6 +83,12 @@ export interface Capabilities {
81
83
  "stats.byDay": StatGrade;
82
84
  "stats.byStep": StatGrade;
83
85
  "stats.bySender": StatGrade;
86
+ /**
87
+ * Several senders in one read: `stats({ scope: "sender", scopeIds })`,
88
+ * a row per sender (and day) in a few requests instead of a few per sender.
89
+ * Graded like `stats.bySender`.
90
+ */
91
+ "stats.bySenders": StatGrade;
84
92
  workspaces: boolean;
85
93
  /** The addresses, domains and profiles the account never contacts. */
86
94
  blocklist: boolean;
@@ -113,6 +113,18 @@ export declare const recipientMailProviderSchema: z.ZodEnum<{
113
113
  other: "other";
114
114
  }>;
115
115
  export type RecipientMailProvider = z.infer<typeof recipientMailProviderSchema>;
116
+ /**
117
+ * Where a lead's meeting stands, as the vendor records it on the lead:
118
+ * `booked`, `completed`, `no_show` (booked and missed) or `won` (the deal
119
+ * closed, so the meeting happened).
120
+ */
121
+ export declare const meetingStatusSchema: z.ZodEnum<{
122
+ completed: "completed";
123
+ booked: "booked";
124
+ no_show: "no_show";
125
+ won: "won";
126
+ }>;
127
+ export type MeetingStatus = z.infer<typeof meetingStatusSchema>;
116
128
  export declare const senderSchema: z.ZodObject<{
117
129
  address: z.ZodNullable<z.ZodString>;
118
130
  dailyLimit: z.ZodNullable<z.ZodNumber>;
@@ -216,6 +228,12 @@ export declare const leadSchema: z.ZodObject<{
216
228
  }>>;
217
229
  lastName: z.ZodNullable<z.ZodString>;
218
230
  linkedinUrl: z.ZodNullable<z.ZodString>;
231
+ meeting: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
232
+ completed: "completed";
233
+ booked: "booked";
234
+ no_show: "no_show";
235
+ won: "won";
236
+ }>>>;
219
237
  location: z.ZodNullable<z.ZodString>;
220
238
  phone: z.ZodNullable<z.ZodString>;
221
239
  progress: z.ZodEnum<{
@@ -282,6 +300,7 @@ export declare const messageSchema: z.ZodObject<{
282
300
  stepIndex: z.ZodNullable<z.ZodNumber>;
283
301
  subject: z.ZodNullable<z.ZodString>;
284
302
  threadId: z.ZodNullable<z.ZodString>;
303
+ url: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
285
304
  variantKey: z.ZodNullable<z.ZodString>;
286
305
  provider: z.ZodString;
287
306
  raw: z.ZodJSONSchema;
@@ -331,6 +350,7 @@ export declare const replySchema: z.ZodObject<{
331
350
  stepIndex: z.ZodNullable<z.ZodNumber>;
332
351
  subject: z.ZodNullable<z.ZodString>;
333
352
  threadId: z.ZodNullable<z.ZodString>;
353
+ url: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
334
354
  variantKey: z.ZodNullable<z.ZodString>;
335
355
  provider: z.ZodString;
336
356
  raw: z.ZodJSONSchema;
@@ -117,6 +117,12 @@ export declare const RECORD_SCHEMAS: {
117
117
  }>>;
118
118
  lastName: z.ZodNullable<z.ZodString>;
119
119
  linkedinUrl: z.ZodNullable<z.ZodString>;
120
+ meeting: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
121
+ completed: "completed";
122
+ booked: "booked";
123
+ no_show: "no_show";
124
+ won: "won";
125
+ }>>>;
120
126
  location: z.ZodNullable<z.ZodString>;
121
127
  phone: z.ZodNullable<z.ZodString>;
122
128
  progress: z.ZodEnum<{
@@ -191,6 +197,7 @@ export declare const RECORD_SCHEMAS: {
191
197
  stepIndex: z.ZodNullable<z.ZodNumber>;
192
198
  subject: z.ZodNullable<z.ZodString>;
193
199
  threadId: z.ZodNullable<z.ZodString>;
200
+ url: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
194
201
  variantKey: z.ZodNullable<z.ZodString>;
195
202
  provider: z.ZodString;
196
203
  raw: z.ZodJSONSchema;
@@ -314,6 +321,7 @@ export declare const RECORD_SCHEMAS: {
314
321
  stepIndex: z.ZodNullable<z.ZodNumber>;
315
322
  subject: z.ZodNullable<z.ZodString>;
316
323
  threadId: z.ZodNullable<z.ZodString>;
324
+ url: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
317
325
  variantKey: z.ZodNullable<z.ZodString>;
318
326
  provider: z.ZodString;
319
327
  raw: z.ZodJSONSchema;
@@ -151,6 +151,12 @@ export interface TopLevelStatsOptions extends StatsOptions {
151
151
  * The `campaign` scope without one returns a row per campaign, in one call.
152
152
  */
153
153
  readonly scopeId?: string | undefined;
154
+ /**
155
+ * Several senders in one read, for the `sender` scope in place of
156
+ * `scopeId`. Each row's `scopeRef` says which sender it is; a sender the
157
+ * vendor has no rows for has none. Needs `stats.bySenders`.
158
+ */
159
+ readonly scopeIds?: readonly string[] | undefined;
154
160
  }
155
161
  export interface StatsResult {
156
162
  readonly rows: readonly MetricRow[];
@@ -276,6 +282,12 @@ export interface OutboundApi {
276
282
  readonly fields: FieldCoverage;
277
283
  readonly campaigns: Collection<Campaign, CampaignFilters>;
278
284
  readonly senders: Collection<Sender, SenderFilters>;
285
+ /**
286
+ * Every sender's health, listed like `senders`: DNS records, connection
287
+ * state and warmup traffic in a few requests a page, where one sender's
288
+ * `health()` costs a few requests each. Needs `senders.healthList`.
289
+ */
290
+ readonly senderHealth: ReadCollection<SenderHealth, SenderFilters>;
279
291
  readonly leads: Collection<Lead, LeadFilters>;
280
292
  readonly messages: ReadCollection<Message, MessageFilters>;
281
293
  readonly replies: ReadCollection<Reply, ReplyFilters>;
@@ -1,4 +1,4 @@
1
- import type { PageQuery, SubsequenceQuery, WebhookQuery } from "../adapter.ts";
1
+ import type { PageQuery, SenderQuery, SubsequenceQuery, WebhookQuery } from "../adapter.ts";
2
2
  import type { DispatchTarget, OperationOutput } from "./operation-shared.ts";
3
3
  export type AccountOperation = {
4
4
  readonly kind: "blocklist.list";
@@ -21,6 +21,9 @@ export type AccountOperation = {
21
21
  } | {
22
22
  readonly kind: "senders.health";
23
23
  readonly id: string;
24
+ } | {
25
+ readonly kind: "senders.healthList";
26
+ readonly query: SenderQuery;
24
27
  } | {
25
28
  readonly kind: "sequence.subsequences";
26
29
  readonly query: SubsequenceQuery;
@@ -4,7 +4,7 @@ import { RequestEngine } from "../engine/engine.ts";
4
4
  import type { LimitsSnapshot, OperationOptions } from "../engine/engine.ts";
5
5
  import type { RateLimitStore } from "../engine/rate-store.ts";
6
6
  import type { Runtime } from "../engine/runtime.ts";
7
- import type { BlockEntry, LeadList, PlacementTest, Tag, WebhookSubscription } from "../entities-account.ts";
7
+ import type { BlockEntry, LeadList, PlacementTest, SenderHealth, Tag, WebhookSubscription } from "../entities-account.ts";
8
8
  import type { Campaign, Lead, Message, Reply, Sender, Workspace } from "../entities.ts";
9
9
  import type { FieldCoverage } from "../fields.ts";
10
10
  import type { OutboundHooks } from "../hooks.ts";
@@ -45,6 +45,7 @@ export declare class Outbound<Native extends NativeCatalog = NoNative> implement
45
45
  #private;
46
46
  readonly campaigns: Collection<Campaign, CampaignFilters>;
47
47
  readonly senders: Collection<Sender, SenderFilters>;
48
+ readonly senderHealth: ReadCollection<SenderHealth, SenderFilters>;
48
49
  readonly leads: Collection<Lead, LeadFilters>;
49
50
  readonly messages: ReadCollection<Message, MessageFilters>;
50
51
  readonly replies: ReadCollection<Reply, ReplyFilters>;
@@ -1,12 +1,13 @@
1
1
  import type { BlockEntry, CampaignProgress, CampaignSettings, LeadList, PlacementTest, SenderHealth, Tag, WebhookSubscription } from "../entities-account.ts";
2
2
  import type { Sequence } from "../entities.ts";
3
- import type { WebhookFilters } from "./api.ts";
3
+ import type { SenderFilters, WebhookFilters } from "./api.ts";
4
4
  import type { GetSpec, ListSpec } from "./collections.ts";
5
5
  import type { Core } from "./core.ts";
6
6
  type NoFilters = Record<never, never>;
7
7
  export declare const settingsGet: (core: Core) => GetSpec<CampaignSettings>;
8
8
  export declare const progressGet: (core: Core) => GetSpec<CampaignProgress>;
9
9
  export declare const healthGet: (core: Core) => GetSpec<SenderHealth>;
10
+ export declare const healthList: (core: Core) => ListSpec<SenderHealth, SenderFilters>;
10
11
  export declare const subsequenceList: (core: Core) => ListSpec<Sequence, {
11
12
  readonly campaignId?: string | undefined;
12
13
  }>;
@@ -0,0 +1,32 @@
1
+ import type { OutboundApi } from "./outbound/api.ts";
2
+ import type { RefParts } from "./ref.ts";
3
+ /** What a person input accepts, for the messages that refuse one. */
4
+ export declare const PERSON_FORMS = "an email address, a LinkedIn profile URL or a lead ref as another tool returned it (provider:workspace:id)";
5
+ /** The provider, workspace and vendor id of a lead ref, or `null` when the text is not one. */
6
+ export declare const leadRefParts: (identifier: string) => RefParts | null;
7
+ /** `email:<address>` or `linkedin:<slug>`, or `null` when the text is neither, a lead ref included. */
8
+ export declare const personKey: (identifier: string) => string | null;
9
+ /** Why the text names no person. */
10
+ export declare const notAPerson: (identifier: string) => string;
11
+ export interface PersonInput {
12
+ /**
13
+ * The identifier to look the person up by. For a lead ref, the one its
14
+ * vendor id already is (an Instantly reply's ref holds the address, a
15
+ * HeyReach ref the profile URL); `null` when the lead must be read for it.
16
+ */
17
+ readonly key: string | null;
18
+ /** Set when the input is a lead ref. */
19
+ readonly ref: (RefParts & {
20
+ readonly text: string;
21
+ }) | null;
22
+ }
23
+ /** Reads a person input, or throws `Invalid` saying what is accepted. */
24
+ export declare const parsePerson: (identifier: string, provider: string) => PersonInput;
25
+ type Instance = Pick<OutboundApi, "provider" | "workspace" | "workspaceId">;
26
+ /**
27
+ * Refuses, before any request, a lead ref of a tool or workspace this
28
+ * instance does not read. On a combined instance the ref's provider and
29
+ * workspace name the member that reads it.
30
+ */
31
+ export declare const assertRefReadable: (outbound: Instance, ref: NonNullable<PersonInput["ref"]>) => void;
32
+ export {};
@@ -1,5 +1,5 @@
1
- export { campaignSchema, campaignStatusSchema, channelSchema, eventDataSchema, eventTypeSchema, evidenceSchema, leadProgressSchema, leadSchema, leadStatusSchema, mailProviderSchema, messageSchema, metricRowSchema, metricScopeSchema, outboundEventSchema, recipientMailProviderSchema, replyCategorySchema, replySchema, SCHEMA_VERSION, senderSchema, senderStatusSchema, sequenceSchema, workspaceSchema, } from "./entities.ts";
2
- export type { Campaign, CampaignStatus, Channel, EventData, EventType, Evidence, Lead, LeadEngagement, LeadProgress, LeadStatus, MailProvider, Message, MetricRow, MetricScope, OutboundEvent, RecipientMailProvider, Reply, ReplyCategory, Sender, SenderStatus, Sequence, SequenceStep, SequenceVariant, Workspace, } from "./entities.ts";
1
+ export { campaignSchema, campaignStatusSchema, channelSchema, eventDataSchema, eventTypeSchema, evidenceSchema, leadProgressSchema, leadSchema, leadStatusSchema, mailProviderSchema, meetingStatusSchema, messageSchema, metricRowSchema, metricScopeSchema, outboundEventSchema, recipientMailProviderSchema, replyCategorySchema, replySchema, SCHEMA_VERSION, senderSchema, senderStatusSchema, sequenceSchema, workspaceSchema, } from "./entities.ts";
2
+ export type { Campaign, CampaignStatus, Channel, EventData, EventType, Evidence, Lead, LeadEngagement, LeadProgress, LeadStatus, MailProvider, MeetingStatus, Message, MetricRow, MetricScope, OutboundEvent, RecipientMailProvider, Reply, ReplyCategory, Sender, SenderStatus, Sequence, SequenceStep, SequenceVariant, Workspace, } from "./entities.ts";
3
3
  export { blockEntrySchema, campaignProgressSchema, campaignSettingsSchema, leadListSchema, placementTestSchema, senderHealthSchema, tagSchema, webhookSubscriptionSchema, } from "./entities-account.ts";
4
4
  export type { BlockEntry, CampaignProgress, CampaignSettings, Entity, LeadList, PlacementTest, SenderHealth, SendingWindow, Tag, WebhookSubscription, } from "./entities-account.ts";
5
5
  export { resolveFields } from "./fields.ts";
@@ -1,4 +1,5 @@
1
- export type QueryValue = string | number | boolean | null | undefined;
1
+ /** A list is sent as the key repeated, once per item. */
2
+ export type QueryValue = string | number | boolean | readonly string[] | null | undefined;
2
3
  /** Joins a base URL and a path and appends the defined query values. */
3
4
  export declare const buildUrl: (baseUrl: string, path: string, query?: Readonly<Record<string, QueryValue>>) => string;
4
5
  /**
@@ -3,7 +3,7 @@ import {
3
3
  configuredProviders,
4
4
  fromEnv,
5
5
  loadableProviders
6
- } from "../chunks/chunk-5XLR6XVV.js";
6
+ } from "../chunks/chunk-TOZKA7JR.js";
7
7
  import "../chunks/chunk-NFWWA7MI.js";
8
8
  import "../chunks/chunk-XYHM4KHC.js";
9
9
  import "../chunks/chunk-45TXPJW7.js";
@@ -1,4 +1,4 @@
1
- import type { Campaign, CampaignStatus, Channel, Lead, LeadEngagement, LeadProgress, LeadStatus, MailProvider, Message, MetricRow, RecipientMailProvider, Reply, ReplyCategory, Sender, SenderStatus, Sequence } from "../internal/entities.ts";
1
+ import type { Campaign, CampaignStatus, Channel, Lead, LeadEngagement, LeadProgress, LeadStatus, MailProvider, Message, MetricRow, MeetingStatus, RecipientMailProvider, Reply, ReplyCategory, Sender, SenderStatus, Sequence } from "../internal/entities.ts";
2
2
  import type { MetricCounts } from "../internal/metrics.ts";
3
3
  import type { Identity } from "../internal/record.ts";
4
4
  import type { MemoryBlockEntry, MemoryHealth, MemoryList, MemoryPlacementTest, MemorySettings, MemoryTag, MemoryWebhook } from "./account.ts";
@@ -72,6 +72,7 @@ export interface MemoryLead {
72
72
  readonly companyLinkedinUrl?: string;
73
73
  readonly recipientMailProvider?: RecipientMailProvider;
74
74
  readonly location?: string;
75
+ readonly meeting?: MeetingStatus;
75
76
  readonly phone?: string;
76
77
  readonly website?: string;
77
78
  readonly tags?: readonly string[];
@@ -5,7 +5,7 @@ import {
5
5
  } from "../chunks/chunk-U5AK6OJM.js";
6
6
  import {
7
7
  leadProgressSchema
8
- } from "../chunks/chunk-POBAY3TI.js";
8
+ } from "../chunks/chunk-HXCZMMSD.js";
9
9
  import {
10
10
  emptyCounts,
11
11
  sumCounts
@@ -13,13 +13,13 @@ import {
13
13
  import {
14
14
  SCHEMA_VERSION
15
15
  } from "../chunks/chunk-QGRZDTX4.js";
16
+ import {
17
+ profileSlug
18
+ } from "../chunks/chunk-OPLXELPS.js";
16
19
  import {
17
20
  assertWorkspaceId,
18
21
  makeRef
19
22
  } from "../chunks/chunk-HXB2IOJJ.js";
20
- import {
21
- profileSlug
22
- } from "../chunks/chunk-YFJ3OQZS.js";
23
23
  import {
24
24
  stableId
25
25
  } from "../chunks/chunk-KVAG5GM2.js";
@@ -212,6 +212,7 @@ var toLead = (identity, seed) => ({
212
212
  lastName: seed.lastName ?? null,
213
213
  linkedinUrl: seed.linkedinUrl ?? null,
214
214
  location: seed.location ?? null,
215
+ meeting: seed.meeting ?? null,
215
216
  phone: seed.phone ?? null,
216
217
  recipientMailProvider: seed.recipientMailProvider ?? null,
217
218
  title: seed.title ?? null,
@@ -229,6 +230,7 @@ var messageFields = (identity, seed, channel, includeBody) => ({
229
230
  stepIndex: seed.stepIndex ?? null,
230
231
  subject: seed.subject ?? null,
231
232
  threadId: seed.threadId ?? null,
233
+ url: null,
232
234
  variantKey: seed.variantKey ?? null
233
235
  });
234
236
  var toMessage = (identity, seed, channel, includeBody) => {
@@ -1,2 +1,2 @@
1
- export { ALL_FIELDS, KNOWN_TOKENS, MASK, redact } from "./plugin.ts";
1
+ export { ALL_FIELDS, KNOWN_TOKENS, MASK, MIN_KEY_LENGTH, redact, } from "./plugin.ts";
2
2
  export type { RedactExtension, RedactField, RedactOptions } from "./plugin.ts";
@@ -1,10 +1,10 @@
1
+ import {
2
+ profileSlug
3
+ } from "../chunks/chunk-OPLXELPS.js";
1
4
  import {
2
5
  makeRef,
3
6
  parseRef
4
7
  } from "../chunks/chunk-HXB2IOJJ.js";
5
- import {
6
- profileSlug
7
- } from "../chunks/chunk-YFJ3OQZS.js";
8
8
  import {
9
9
  hmacSha256Hex,
10
10
  stableId
@@ -18,28 +18,30 @@ import {
18
18
  isString
19
19
  } from "../chunks/chunk-45TXPJW7.js";
20
20
 
21
- // src/redact/plugin.ts
22
- var ALL_FIELDS = [
23
- "body",
24
- "company",
25
- "custom",
26
- "email",
27
- "linkedin",
28
- "name",
29
- "phone",
30
- "subject"
31
- ];
32
- var MASK = "[redacted]";
33
- var replacer = (strategy) => (value) => {
34
- if (value === null) {
35
- return null;
36
- }
37
- return strategy === "mask" ? MASK : `redacted:${stableId(value).slice(0, 16)}`;
38
- };
39
- var keyedToken = () => {
40
- const key = crypto.getRandomValues(new Uint8Array(32));
21
+ // src/redact/tokens.ts
22
+ var MIN_KEY_LENGTH = 32;
23
+ var keyedToken = (secret) => {
24
+ const key = secret === void 0 ? crypto.getRandomValues(new Uint8Array(32)) : new TextEncoder().encode(secret);
41
25
  return (value) => `redacted:${hmacSha256Hex(key, value).slice(0, 16)}`;
42
26
  };
27
+ var checkedKey = (key, strategy) => {
28
+ if (key === void 0) {
29
+ return void 0;
30
+ }
31
+ if (strategy !== "mask") {
32
+ throw new OutboundError(
33
+ "Invalid",
34
+ 'redact takes a key only with strategy "mask": "hash" writes the same token without one'
35
+ );
36
+ }
37
+ if (key.length < MIN_KEY_LENGTH) {
38
+ throw new OutboundError(
39
+ "Invalid",
40
+ `The redact key must be at least ${MIN_KEY_LENGTH} characters. It is a secret: make one with \`openssl rand -hex 32\``
41
+ );
42
+ }
43
+ return key;
44
+ };
43
45
  var KNOWN_TOKENS = 1e4;
44
46
  var TOKEN = /redacted:[0-9a-f]{16}/gu;
45
47
  var knownTokens = () => {
@@ -67,8 +69,27 @@ var knownTokens = () => {
67
69
  unmask: (text) => text.replaceAll(TOKEN, (token) => values.get(token)?.value ?? token)
68
70
  };
69
71
  };
72
+
73
+ // src/redact/plugin.ts
74
+ var ALL_FIELDS = [
75
+ "body",
76
+ "company",
77
+ "custom",
78
+ "email",
79
+ "linkedin",
80
+ "name",
81
+ "phone",
82
+ "subject"
83
+ ];
84
+ var MASK = "[redacted]";
85
+ var replacer = (strategy) => (value) => {
86
+ if (value === null) {
87
+ return null;
88
+ }
89
+ return strategy === "mask" ? MASK : `redacted:${stableId(value).slice(0, 16)}`;
90
+ };
70
91
  var maskIdentifier = (masks, field, value) => masks.has(field) ? masks.identifier(field, value) : value;
71
- var masksFor = (fields, strategy) => {
92
+ var masksFor = (fields, strategy, secret) => {
72
93
  const replace = replacer(strategy);
73
94
  const has = (field) => fields.has(field);
74
95
  const known = knownTokens();
@@ -81,7 +102,7 @@ var masksFor = (fields, strategy) => {
81
102
  token: (kind, value, original = value) => known.remember(replace(value) ?? MASK, kind, original)
82
103
  };
83
104
  }
84
- const keyed = keyedToken();
105
+ const keyed = keyedToken(secret);
85
106
  const token = (kind, value, original = value) => known.remember(keyed(value), kind, original);
86
107
  return {
87
108
  has,
@@ -255,7 +276,7 @@ var unmasked = (known, operation) => {
255
276
  var redact = (options = {}) => {
256
277
  const fields = new Set(options.fields ?? ALL_FIELDS);
257
278
  const strategy = options.strategy ?? "mask";
258
- const masks = masksFor(fields, strategy);
279
+ const masks = masksFor(fields, strategy, checkedKey(options.key, strategy));
259
280
  return {
260
281
  // Asking for bodies while they are being removed is a contradiction, so
261
282
  // the capability is turned off and the request is refused up front.
@@ -300,5 +321,6 @@ export {
300
321
  ALL_FIELDS,
301
322
  KNOWN_TOKENS,
302
323
  MASK,
324
+ MIN_KEY_LENGTH,
303
325
  redact
304
326
  };
@@ -1,6 +1,8 @@
1
1
  import type { Lead } from "../internal/entities.ts";
2
2
  import type { ListAll } from "../internal/outbound/api.ts";
3
3
  import type { OutboundPlugin } from "../internal/outbound/plugins.ts";
4
+ import type { Identifier } from "./tokens.ts";
5
+ export { KNOWN_TOKENS, MIN_KEY_LENGTH } from "./tokens.ts";
4
6
  export type RedactField = "body" | "company" | "custom" | "email" | "linkedin" | "name" | "phone" | "subject";
5
7
  export interface RedactOptions {
6
8
  /** What to mask. Defaults to everything. */
@@ -12,6 +14,16 @@ export interface RedactOptions {
12
14
  * so the same person gets the same token from one run to the next.
13
15
  */
14
16
  readonly strategy?: "hash" | "mask" | undefined;
17
+ /**
18
+ * A secret, at least `MIN_KEY_LENGTH` (32) characters, that keys the
19
+ * tokens `mask` writes for addresses and profiles. With it the same person
20
+ * gets the same token in every instance and process given the same key, so
21
+ * redacted data can be joined across runs. Without it each plugin makes a
22
+ * random key of its own. Anyone holding the key can test a guessed address
23
+ * against a token, and a new key gives every person a new token. Only for
24
+ * `mask`; `hash` needs no key.
25
+ */
26
+ readonly key?: string | undefined;
15
27
  }
16
28
  export declare const ALL_FIELDS: readonly RedactField[];
17
29
  export declare const MASK = "[redacted]";
@@ -44,9 +56,5 @@ export interface RedactExtension {
44
56
  readonly leadsByToken: (tokens: readonly string[], campaign: string | null) => ListAll<Lead>;
45
57
  };
46
58
  }
47
- type Identifier = "email" | "linkedin";
48
- /** The most tokens one redact remembers the value of; the oldest go first. */
49
- export declare const KNOWN_TOKENS = 10000;
50
59
  /** Masks emails, names, companies, LinkedIn URLs, custom fields and message text. */
51
60
  export declare const redact: (options?: RedactOptions) => OutboundPlugin<RedactExtension>;
52
- export {};
@@ -0,0 +1,21 @@
1
+ /** The shortest `key` `redact` accepts. */
2
+ export declare const MIN_KEY_LENGTH = 32;
3
+ export declare const keyedToken: (secret: string | undefined) => ((value: string) => string);
4
+ export declare const checkedKey: (key: string | undefined, strategy: "hash" | "mask") => string | undefined;
5
+ export type Identifier = "email" | "linkedin";
6
+ /** The most tokens one redact remembers the value of; the oldest go first. */
7
+ export declare const KNOWN_TOKENS = 10000;
8
+ export declare const TOKEN: RegExp;
9
+ /**
10
+ * The values behind the tokens this redact wrote for addresses and profiles,
11
+ * held in memory for its lifetime and never written out.
12
+ */
13
+ export interface Known {
14
+ readonly remember: (token: string, kind: Identifier, value: string) => string;
15
+ readonly kindOf: (token: string) => Identifier | null;
16
+ /** Puts each known token's value back, for a call on its way to the vendor. */
17
+ readonly unmask: (text: string) => string;
18
+ /** Puts the tokens back where a value from `unmask` appears. */
19
+ readonly remask: (text: string) => string;
20
+ }
21
+ export declare const knownTokens: () => Known;
@@ -13,7 +13,7 @@ import {
13
13
  toWorkspace,
14
14
  unwrap,
15
15
  withoutSecrets
16
- } from "../chunks/chunk-UAHYPASH.js";
16
+ } from "../chunks/chunk-3LRIWQEJ.js";
17
17
  import {
18
18
  applyTracking,
19
19
  ownTracking,
@@ -32,7 +32,7 @@ import {
32
32
  createVendorClient,
33
33
  fromOne,
34
34
  listIn
35
- } from "../chunks/chunk-UOJG4VYF.js";
35
+ } from "../chunks/chunk-LD5OAELW.js";
36
36
  import {
37
37
  normalizeBody
38
38
  } from "../chunks/chunk-FALWG5U3.js";
@@ -50,7 +50,7 @@ import {
50
50
  refTo,
51
51
  refsTo
52
52
  } from "../chunks/chunk-U5AK6OJM.js";
53
- import "../chunks/chunk-POBAY3TI.js";
53
+ import "../chunks/chunk-HXCZMMSD.js";
54
54
  import {
55
55
  emptyCounts,
56
56
  metricRow
@@ -58,10 +58,10 @@ import {
58
58
  import {
59
59
  replyCategorySchema
60
60
  } from "../chunks/chunk-QGRZDTX4.js";
61
+ import "../chunks/chunk-OPLXELPS.js";
61
62
  import {
62
63
  assertWorkspaceId
63
64
  } from "../chunks/chunk-HXB2IOJJ.js";
64
- import "../chunks/chunk-YFJ3OQZS.js";
65
65
  import {
66
66
  stableId
67
67
  } from "../chunks/chunk-KVAG5GM2.js";
@@ -186,11 +186,18 @@ var fields = {
186
186
  lead: {
187
187
  companyLinkedinUrl: false,
188
188
  engagement: false,
189
+ meeting: false,
189
190
  recipientMailProvider: false,
190
191
  title: false
191
192
  },
192
- // A message is not marked automatic; a reply is.
193
- message: { isAuto: false, isAutoSource: false, variantKey: false },
193
+ // A message is not marked automatic; a reply is. No link to one master
194
+ // inbox conversation is documented.
195
+ message: {
196
+ isAuto: false,
197
+ isAutoSource: false,
198
+ url: false,
199
+ variantKey: false
200
+ },
194
201
  metricRow: {
195
202
  completed: false,
196
203
  connectionsAccepted: false,
@@ -218,6 +225,7 @@ var fields = {
218
225
  leftCompany: "derived",
219
226
  // The master inbox does not say which step a reply answers.
220
227
  stepIndex: false,
228
+ url: false,
221
229
  variantKey: false
222
230
  },
223
231
  sender: { linkedinUrl: false },
@@ -308,7 +316,8 @@ var caveats = [
308
316
  "Tags come from GET /email-accounts/tags; whether campaign tags share that list is unconfirmed.",
309
317
  "Webhooks are listed per campaign; without one the adapter walks the campaigns and returns each once. User-level or client-level webhooks may appear under none.",
310
318
  "Placement tests are read from SmartDelivery (smartdelivery.smartlead.ai) with the same key: an account without the product is refused. The list is documented without pages, and manual is read as a one-time test. A test's results stay native, because SmartDelivery reports them as rates.",
311
- "Block list entries with an @ are emails, the rest domains."
319
+ "Block list entries with an @ are emails, the rest domains.",
320
+ "A message's or reply's url is null: Smartlead documents no link to one master inbox conversation. The app_url and ui_master_inbox_link of its webhooks are documented with the master inbox page only (https://app.smartlead.ai/app/master-inbox), and no read returns a link."
312
321
  ];
313
322
 
314
323
  // src/smartlead/map-account.ts
@@ -551,6 +560,8 @@ var messageFields = (identity, place, parts, includeBody) => ({
551
560
  stepIndex: place.stepIndex ?? null,
552
561
  subject: parts.subject,
553
562
  threadId: place.threadId ?? null,
563
+ // Smartlead documents no link to one master inbox conversation.
564
+ url: null,
554
565
  variantKey: null
555
566
  });
556
567
  var activityMessages = (identity, row, activity, includeBody) => {
@@ -4,11 +4,6 @@ declare const setupInput: z.ZodObject<{
4
4
  campaign: z.ZodString;
5
5
  }, z.core.$strip>;
6
6
  export declare const campaignSetup: ToolDefinition<z.infer<typeof setupInput>>;
7
- declare const deliverabilityInput: z.ZodObject<{
8
- campaign: z.ZodOptional<z.ZodString>;
9
- limit: z.ZodDefault<z.ZodNumber>;
10
- }, z.core.$strip>;
11
- export declare const deliverabilityCheck: ToolDefinition<z.infer<typeof deliverabilityInput>>;
12
7
  declare const nativeInput: z.ZodObject<{
13
8
  name: z.ZodOptional<z.ZodString>;
14
9
  params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  createTools
3
- } from "../chunks/chunk-OVTYA3IB.js";
4
- import "../chunks/chunk-FTK4JS65.js";
3
+ } from "../chunks/chunk-HDTOGEVN.js";
4
+ import "../chunks/chunk-KNWJIJVO.js";
5
5
  import "../chunks/chunk-4PA526S7.js";
6
+ import "../chunks/chunk-I7GBBHD2.js";
6
7
  import "../chunks/chunk-HZCTYL22.js";
7
8
  import "../chunks/chunk-HPNGSG5E.js";
8
9
  import "../chunks/chunk-PTZO4QXR.js";
9
- import "../chunks/chunk-POBAY3TI.js";
10
+ import "../chunks/chunk-HXCZMMSD.js";
10
11
  import "../chunks/chunk-CPACP4YD.js";
11
12
  import "../chunks/chunk-QGRZDTX4.js";
13
+ import "../chunks/chunk-OPLXELPS.js";
12
14
  import "../chunks/chunk-HXB2IOJJ.js";
13
15
  import "../chunks/chunk-XYHM4KHC.js";
14
16
  import "../chunks/chunk-45TXPJW7.js";
@@ -38,10 +38,6 @@ declare const stepsInput: z.ZodObject<{
38
38
  to: z.ZodOptional<z.ZodString>;
39
39
  }, z.core.$strip>;
40
40
  export declare const winningSteps: ToolDefinition<z.infer<typeof stepsInput>>;
41
- declare const healthInput: z.ZodObject<{
42
- limit: z.ZodDefault<z.ZodNumber>;
43
- }, z.core.$strip>;
44
- export declare const senderHealth: ToolDefinition<z.infer<typeof healthInput>>;
45
41
  declare const samplesInput: z.ZodObject<{
46
42
  campaign: z.ZodOptional<z.ZodString>;
47
43
  by: z.ZodDefault<z.ZodEnum<{
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  createTools
3
- } from "../chunks/chunk-OVTYA3IB.js";
4
- import "../chunks/chunk-FTK4JS65.js";
3
+ } from "../chunks/chunk-HDTOGEVN.js";
4
+ import "../chunks/chunk-KNWJIJVO.js";
5
5
  import "../chunks/chunk-4PA526S7.js";
6
+ import "../chunks/chunk-I7GBBHD2.js";
6
7
  import "../chunks/chunk-HZCTYL22.js";
7
8
  import "../chunks/chunk-HPNGSG5E.js";
8
9
  import "../chunks/chunk-PTZO4QXR.js";
9
- import "../chunks/chunk-POBAY3TI.js";
10
+ import "../chunks/chunk-HXCZMMSD.js";
10
11
  import "../chunks/chunk-CPACP4YD.js";
11
12
  import "../chunks/chunk-QGRZDTX4.js";
13
+ import "../chunks/chunk-OPLXELPS.js";
12
14
  import "../chunks/chunk-HXB2IOJJ.js";
13
15
  import "../chunks/chunk-XYHM4KHC.js";
14
16
  import "../chunks/chunk-45TXPJW7.js";
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+ import type { ToolDefinition } from "./shared.ts";
3
+ declare const checkInput: z.ZodObject<{
4
+ campaign: z.ZodOptional<z.ZodString>;
5
+ limit: z.ZodDefault<z.ZodNumber>;
6
+ max_checked: z.ZodOptional<z.ZodNumber>;
7
+ }, z.core.$strip>;
8
+ export declare const deliverabilityCheck: ToolDefinition<z.infer<typeof checkInput>>;
9
+ export {};