outbound-sdk 0.7.1 → 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 (120) 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-6NSCPTOY.js → chunk-4GK56PRO.js} +691 -441
  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-T5MJMW3R.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 +4 -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/clients/index.js +3 -3
  47. package/dist/combine/index.js +154 -35
  48. package/dist/combine/newest.d.ts +18 -0
  49. package/dist/combine/route.d.ts +19 -5
  50. package/dist/emailbison/index.js +22 -14
  51. package/dist/emailbison/map-sequence.d.ts +2 -1
  52. package/dist/exporter/index.js +1 -1
  53. package/dist/failover/index.js +3 -3
  54. package/dist/fixtures/index.js +4 -4
  55. package/dist/heyreach/capabilities.d.ts +4 -0
  56. package/dist/heyreach/conversations.d.ts +23 -0
  57. package/dist/heyreach/inbox.d.ts +0 -1
  58. package/dist/heyreach/index.js +251 -92
  59. package/dist/identity/index.js +2 -2
  60. package/dist/index.js +7 -7
  61. package/dist/insights/capped.d.ts +6 -6
  62. package/dist/insights/copy/index.d.ts +2 -0
  63. package/dist/insights/copy/reply-timing.d.ts +4 -0
  64. package/dist/insights/cost.d.ts +11 -1
  65. package/dist/insights/define.d.ts +25 -16
  66. package/dist/insights/inbox.d.ts +12 -0
  67. package/dist/insights/index.js +42 -6578
  68. package/dist/insights/inputs.generated.d.ts +60 -24
  69. package/dist/insights/ops/anomalies.d.ts +9 -0
  70. package/dist/insights/ops/index.d.ts +2 -0
  71. package/dist/insights/ops/period-comparison.d.ts +7 -8
  72. package/dist/insights/ops/pipeline-forecast.d.ts +10 -0
  73. package/dist/insights/ops/shared.d.ts +6 -1
  74. package/dist/insights/people/auto-replies.d.ts +11 -7
  75. package/dist/insights/people/dropped-replies.d.ts +13 -4
  76. package/dist/insights/people/hot-leads-read.d.ts +31 -0
  77. package/dist/insights/people/hot-leads.d.ts +15 -3
  78. package/dist/insights/people/index.d.ts +10 -2
  79. package/dist/insights/people/read.d.ts +1 -1
  80. package/dist/insights/registry.d.ts +14 -2
  81. package/dist/insights/run-cap.d.ts +10 -0
  82. package/dist/insights/senders/read.d.ts +0 -3
  83. package/dist/insights/tools.d.ts +12 -0
  84. package/dist/insights/tracked-reads.d.ts +53 -0
  85. package/dist/instantly/capabilities.d.ts +13 -1
  86. package/dist/instantly/index.js +122 -46
  87. package/dist/instantly/map-account.d.ts +2 -1
  88. package/dist/instantly/map-lead.d.ts +1 -0
  89. package/dist/instantly/map.d.ts +4 -3
  90. package/dist/internal/adapter.d.ts +17 -0
  91. package/dist/internal/capabilities.d.ts +13 -0
  92. package/dist/internal/engine/budget.d.ts +9 -1
  93. package/dist/internal/engine/engine.d.ts +2 -1
  94. package/dist/internal/engine/request.d.ts +2 -0
  95. package/dist/internal/errors.d.ts +5 -0
  96. package/dist/internal/hooks.d.ts +11 -0
  97. package/dist/internal/notes.d.ts +16 -0
  98. package/dist/internal/outbound/api.d.ts +14 -0
  99. package/dist/internal/outbound/core.d.ts +4 -1
  100. package/dist/internal/outbound/operation-shared.d.ts +2 -0
  101. package/dist/internal/sha256.d.ts +2 -0
  102. package/dist/internal/url.d.ts +1 -0
  103. package/dist/loader/index.js +3 -3
  104. package/dist/memory/index.js +6 -6
  105. package/dist/redact/index.d.ts +1 -1
  106. package/dist/redact/index.js +107 -19
  107. package/dist/redact/plugin.d.ts +26 -3
  108. package/dist/smartlead/index.js +22 -13
  109. package/dist/smartlead/map.d.ts +3 -2
  110. package/dist/sync/index.js +2 -2
  111. package/dist/tools/ai-sdk.js +5 -5
  112. package/dist/tools/by-name.d.ts +9 -1
  113. package/dist/tools/campaign-tools.d.ts +3 -1
  114. package/dist/tools/claude-agent.js +5 -5
  115. package/dist/tools/index.js +6 -6
  116. package/dist/tools/registry.d.ts +6 -0
  117. package/dist/tools/shared.d.ts +5 -1
  118. package/dist/tracing/index.js +1 -1
  119. package/dist/webhooks/index.js +11 -11
  120. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  readEnv
3
- } from "./chunk-UFQ4WMLU.js";
3
+ } from "./chunk-NFWWA7MI.js";
4
4
  import {
5
5
  OutboundError
6
- } from "./chunk-QFC4ZHD3.js";
6
+ } from "./chunk-XYHM4KHC.js";
7
7
  import {
8
8
  PROVIDER_ENV,
9
9
  providers
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-QGRZDTX4.js";
4
4
  import {
5
5
  makeRef
6
- } from "./chunk-YW6FFVSZ.js";
6
+ } from "./chunk-HXB2IOJJ.js";
7
7
 
8
8
  // src/internal/metrics.ts
9
9
  var METRIC_DEFINITIONS = {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  computeRates
3
- } from "./chunk-M2VXGLLZ.js";
3
+ } from "./chunk-CPACP4YD.js";
4
4
  import {
5
5
  parseRef
6
- } from "./chunk-YW6FFVSZ.js";
6
+ } from "./chunk-HXB2IOJJ.js";
7
7
  import {
8
8
  OutboundError
9
- } from "./chunk-QFC4ZHD3.js";
9
+ } from "./chunk-XYHM4KHC.js";
10
10
  import {
11
11
  isJsonObject
12
12
  } from "./chunk-45TXPJW7.js";
@@ -52,8 +52,8 @@ var weakest = (all) => {
52
52
  return all.includes("sampled") ? "sampled" : "exact";
53
53
  };
54
54
  var DEFAULT_TOOL_REQUESTS = 100;
55
- var capNext = (cap, isDefault, lower) => {
56
- const ask = `the user to raise maxRequestsPerToolCall (${isDefault ? "default" : "set to"} ${cap} here)`;
55
+ var capNext = (cap, isDefault, lower, setting = "maxRequestsPerToolCall") => {
56
+ const ask = `the user to raise ${setting} (${isDefault ? "default" : "set to"} ${cap} here)`;
57
57
  return `Do not call again with the same input. ${lower === void 0 ? `Ask ${ask}` : `Lower ${lower.input} to ${lower.to}${lower.sure ? "" : " or less"}, or ask ${ask}`}.`;
58
58
  };
59
59
  var nextFor = (cause, code) => {
@@ -63,6 +63,9 @@ var nextFor = (cause, code) => {
63
63
  if (OutboundError.is(cause) && code === "RateLimited") {
64
64
  return cause.permanent ? "A request cap the user set was reached; the message says which. Do not call again with the same input." : "The vendor's rate limit was reached. Wait a minute before calling again.";
65
65
  }
66
+ if (OutboundError.is(cause) && code === "Provider" && cause.permanent && !cause.aborted) {
67
+ return "The vendor returned data the SDK cannot read, and it returns the same data on every call. Do not call again with the same input. Try another campaign, or report the field the message names.";
68
+ }
66
69
  return "Check the input and try again.";
67
70
  };
68
71
  var failure = (cause, requests, next) => {
@@ -82,6 +85,7 @@ var failure = (cause, requests, next) => {
82
85
 
83
86
  // src/tools/by-name.ts
84
87
  import { z as z2 } from "zod";
88
+ var COMBINED = "combined";
85
89
  var UUID = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu;
86
90
  var DIGITS = /^\d+$/u;
87
91
  var ID_FORMS = /* @__PURE__ */ new Map([
@@ -94,6 +98,9 @@ var isIdentifier = (outbound, value) => {
94
98
  if (parseRef(value) !== null) {
95
99
  return true;
96
100
  }
101
+ if (outbound.provider === COMBINED) {
102
+ return false;
103
+ }
97
104
  const form = ID_FORMS.get(outbound.provider);
98
105
  return form === void 0 ? !/\s/u.test(value) : form.test(value);
99
106
  };
@@ -103,13 +110,11 @@ var listed = (matches) => {
103
110
  return matches.length > SHOWN ? `${shown} and ${matches.length - SHOWN} more` : shown;
104
111
  };
105
112
  var pick = (records, value, what) => {
106
- if (records.some((record) => record.sourceId === value)) {
107
- return value;
108
- }
109
113
  const wanted = value.trim().toLowerCase();
110
114
  const nameOf = (record) => (record.name ?? "").trim().toLowerCase();
115
+ const byId = records.filter((record) => record.sourceId === value);
111
116
  const exact = records.filter((record) => nameOf(record) === wanted);
112
- const matches = exact.length > 0 ? exact : records.filter((record) => nameOf(record).includes(wanted));
117
+ const matches = [byId, exact].find((found) => found.length > 0) ?? records.filter((record) => nameOf(record).includes(wanted));
113
118
  if (matches.length > 1) {
114
119
  throw new OutboundError(
115
120
  "Invalid",
@@ -127,7 +132,7 @@ var resolve = async (outbound, value, what, records) => {
127
132
  if (found !== void 0) {
128
133
  return found;
129
134
  }
130
- if (ID_FORMS.has(outbound.provider) || outbound.provider === "combined") {
135
+ if (ID_FORMS.has(outbound.provider) || outbound.provider === COMBINED) {
131
136
  throw new OutboundError(
132
137
  "NotFound",
133
138
  `No ${what} has the id or name "${value}". Give its ref or id, or list the ${what}s to find it`
@@ -147,6 +152,21 @@ var namesCampaign = (outbound, input) => {
147
152
  const parsed = withCampaignField.safeParse(input);
148
153
  return parsed.success && !isIdentifier(outbound, parsed.data.campaign);
149
154
  };
155
+ var routedByCampaign = (outbound, input) => {
156
+ const parsed = withCampaignField.safeParse(input);
157
+ const parts = parsed.success ? parseRef(parsed.data.campaign) : null;
158
+ if (outbound.provider !== COMBINED || parts === null) {
159
+ return outbound;
160
+ }
161
+ try {
162
+ return outbound.workspace(`${parts.provider}:${parts.workspaceId}`);
163
+ } catch (error) {
164
+ if (OutboundError.is(error) && error.code === "NotFound") {
165
+ return outbound;
166
+ }
167
+ throw error;
168
+ }
169
+ };
150
170
  var withCampaign = async (outbound, input, read = toArray) => {
151
171
  const parsed = withCampaignField.safeParse(input);
152
172
  if (!parsed.success) {
@@ -229,6 +249,7 @@ export {
229
249
  resolveCampaign,
230
250
  resolveList,
231
251
  namesCampaign,
252
+ routedByCampaign,
232
253
  withCampaign,
233
254
  inputProblem,
234
255
  paceWindow,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  OutboundError
3
- } from "./chunk-QFC4ZHD3.js";
3
+ } from "./chunk-XYHM4KHC.js";
4
4
 
5
5
  // src/internal/ref.ts
6
6
  var SEPARATOR = ":";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  run
3
- } from "./chunk-6NSCPTOY.js";
3
+ } from "./chunk-4GK56PRO.js";
4
4
 
5
5
  // src/cli/bin.ts
6
6
  import process from "node:process";
@@ -142,6 +142,24 @@ var sha256Hex = (input) => Array.from(
142
142
  sha256(new TextEncoder().encode(input)),
143
143
  (byte) => byte.toString(16).padStart(2, "0")
144
144
  ).join("");
145
+ var BLOCK = 64;
146
+ var hmacSha256Hex = (key, message) => {
147
+ const block = new Uint8Array(BLOCK);
148
+ block.set(key.length > BLOCK ? sha256(key) : key);
149
+ const text = new TextEncoder().encode(message);
150
+ const inner = new Uint8Array(BLOCK + text.length);
151
+ const outer = new Uint8Array(BLOCK + 32);
152
+ for (const [index, byte] of block.entries()) {
153
+ inner[index] = byte ^ 54;
154
+ outer[index] = byte ^ 92;
155
+ }
156
+ inner.set(text, BLOCK);
157
+ outer.set(sha256(inner), BLOCK);
158
+ return Array.from(
159
+ sha256(outer),
160
+ (byte) => byte.toString(16).padStart(2, "0")
161
+ ).join("");
162
+ };
145
163
  var stableId = (...parts) => sha256Hex(parts.map((part) => String(part ?? "")).join("")).slice(
146
164
  0,
147
165
  32
@@ -150,5 +168,6 @@ var stableId = (...parts) => sha256Hex(parts.map((part) => String(part ?? "")).j
150
168
  export {
151
169
  sha256,
152
170
  sha256Hex,
171
+ hmacSha256Hex,
153
172
  stableId
154
173
  };
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  fromOne,
3
3
  variantKey
4
- } from "./chunk-BNDHEDHD.js";
4
+ } from "./chunk-UOJG4VYF.js";
5
5
  import {
6
6
  eventData,
7
7
  refTo
8
- } from "./chunk-LVZGIKNF.js";
8
+ } from "./chunk-U5AK6OJM.js";
9
9
  import {
10
10
  SCHEMA_VERSION
11
11
  } from "./chunk-QGRZDTX4.js";
12
12
  import {
13
13
  stableId
14
- } from "./chunk-FHKSLCVW.js";
14
+ } from "./chunk-KVAG5GM2.js";
15
15
  import {
16
16
  emailAddress,
17
17
  flag,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  OutboundError
3
- } from "./chunk-QFC4ZHD3.js";
3
+ } from "./chunk-XYHM4KHC.js";
4
4
 
5
5
  // src/internal/env.ts
6
6
  var readEnv = (name) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createTools
3
- } from "./chunk-JRL3QRBS.js";
3
+ } from "./chunk-OVTYA3IB.js";
4
4
  import {
5
5
  parseJson
6
6
  } from "./chunk-45TXPJW7.js";
@@ -16,7 +16,7 @@ import {
16
16
  untrusted,
17
17
  weakest,
18
18
  withCampaign
19
- } from "./chunk-4AVYRVN5.js";
19
+ } from "./chunk-FTK4JS65.js";
20
20
  import {
21
21
  plural as plural2
22
22
  } from "./chunk-4PA526S7.js";
@@ -36,7 +36,7 @@ import {
36
36
  } from "./chunk-QGRZDTX4.js";
37
37
  import {
38
38
  OutboundError
39
- } from "./chunk-QFC4ZHD3.js";
39
+ } from "./chunk-XYHM4KHC.js";
40
40
  import {
41
41
  jsonInput,
42
42
  toJson,
@@ -76,7 +76,7 @@ var campaignSetup = {
76
76
  meta: {
77
77
  complete: settings.meta.complete,
78
78
  evidence: settings.meta.evidence,
79
- notes: [],
79
+ notes: [...settings.meta.notes],
80
80
  provider: outbound.provider,
81
81
  requests: settings.meta.requests
82
82
  },
@@ -235,7 +235,7 @@ var vendorRead = {
235
235
  meta: {
236
236
  complete: result.meta.complete,
237
237
  evidence: result.meta.evidence,
238
- notes: [],
238
+ notes: [...result.meta.notes],
239
239
  provider: outbound.provider,
240
240
  requests: result.meta.requests
241
241
  },
@@ -331,23 +331,46 @@ var repliesByPerson = (replies) => {
331
331
  // src/tools/campaign-tools.ts
332
332
  var overviewInput = z2.object({
333
333
  ...optionalRange,
334
+ campaign: z2.string().min(1).optional().describe(
335
+ "One campaign's ref, id or name, to read only it; status and limit are then not used. Leave out for every campaign with the status"
336
+ ),
334
337
  limit: z2.number().int().min(1).max(50).default(10).describe("How many campaigns to include"),
335
338
  status: campaignStatusSchema.default("active").describe("Which campaigns to include")
336
339
  });
340
+ var readOverview = async (outbound, input) => {
341
+ if (input.campaign !== void 0) {
342
+ const campaign = await outbound.campaign(input.campaign).get();
343
+ return {
344
+ campaigns: [campaign],
345
+ requests: campaign.meta.requests,
346
+ truncated: false
347
+ };
348
+ }
349
+ const walk = outbound.campaigns.listAll({
350
+ max: input.limit,
351
+ status: input.status
352
+ });
353
+ const campaigns = await walk.toArray();
354
+ return {
355
+ campaigns,
356
+ requests: walk.meta?.requests ?? 0,
357
+ truncated: walk.truncated
358
+ };
359
+ };
337
360
  var campaignOverview = {
338
- description: "How every campaign is doing right now: sends, replies, positive replies, bounces and reply rate for each campaign with the given status. One vendor request per campaign. Rates are computed from counts; a null means the vendor does not report that count. meta.complete: false means limit cut the list, and meta.notes says so.",
361
+ description: "How every campaign is doing right now: sends, replies, positive replies, bounces and reply rate for each campaign with the given status, or for the one campaign given. One vendor request per campaign. Rates are computed from counts; a null means the vendor does not report that count. meta.complete: false means limit cut the list, and meta.notes says so.",
339
362
  inputSchema: overviewInput,
340
363
  name: "campaign_overview",
341
364
  needs: ["campaigns.status", "stats.campaign"],
342
365
  run: async (outbound, input) => {
343
- const walk = outbound.campaigns.listAll({
344
- max: input.limit,
345
- status: input.status
346
- });
347
- const campaigns = await walk.toArray();
366
+ const {
367
+ campaigns,
368
+ requests: listed,
369
+ truncated
370
+ } = await readOverview(outbound, input);
348
371
  const rows = [];
349
372
  const evidence = [];
350
- let requests = walk.meta?.requests ?? 0;
373
+ let requests = listed;
351
374
  const read = await mapConcurrent(campaigns, async (campaign) => ({
352
375
  campaign,
353
376
  stats: await outbound.campaign(campaign.ref).stats({ from: input.from, to: input.to })
@@ -367,9 +390,9 @@ var campaignOverview = {
367
390
  return {
368
391
  data: { campaigns: rows },
369
392
  meta: {
370
- complete: !walk.truncated,
393
+ complete: !truncated,
371
394
  evidence: weakest(evidence),
372
- notes: walk.truncated ? [
395
+ notes: truncated ? [
373
396
  `Stopped at ${plural2(rows.length, "campaign")} (limit); more ${input.status} campaigns exist.`
374
397
  ] : [],
375
398
  provider: outbound.provider,
@@ -432,7 +455,7 @@ var campaignTrend = {
432
455
  meta: {
433
456
  complete: stats.meta.complete,
434
457
  evidence: stats.meta.evidence,
435
- notes: [],
458
+ notes: [...stats.meta.notes],
436
459
  provider: outbound.provider,
437
460
  requests: stats.meta.requests
438
461
  },
@@ -486,7 +509,7 @@ var winningSteps = {
486
509
  meta: {
487
510
  complete: stats.meta.complete,
488
511
  evidence: stats.meta.evidence,
489
- notes: [],
512
+ notes: [...stats.meta.notes],
490
513
  provider: outbound.provider,
491
514
  requests: stats.meta.requests
492
515
  },
@@ -512,6 +535,7 @@ var senderHealth = {
512
535
  const senders = await walk.toArray();
513
536
  const cut = walk.truncated || senders.length > input.limit;
514
537
  const notes = [
538
+ ...walk.meta?.notes ?? [],
515
539
  ...walk.truncated ? [
516
540
  `More senders exist than the ${senders.length} checked; unhealthy counts only those.`
517
541
  ] : [],
@@ -864,6 +888,53 @@ var withOfferedHints = (tool, offered) => {
864
888
  }
865
889
  };
866
890
  };
891
+ var pluginsOf = (outbound) => /* @__PURE__ */ new Map([
892
+ ["clients", "clients" in outbound],
893
+ // person() refuses when redact masks the identifiers it links by.
894
+ ["identity", "person" in outbound && !masksIdentifiers(outbound)],
895
+ // Offered only when the vendor has reads of its own and no plugin turned them off.
896
+ [
897
+ "native",
898
+ outbound.capabilities.native && Object.keys(outbound.native.catalog).length > 0
899
+ ]
900
+ ]);
901
+ var metOn = (outbound) => {
902
+ const added = pluginsOf(outbound);
903
+ const { capabilities } = outbound;
904
+ const isCapability = (need) => Object.hasOwn(capabilities, need);
905
+ return (need) => added.get(need) ?? (isCapability(need) && capabilities[need] !== false);
906
+ };
907
+ var NEEDS = new Map(
908
+ [
909
+ campaignOverview,
910
+ campaignTrend,
911
+ winningSteps,
912
+ senderHealth,
913
+ replySamples,
914
+ leadRunway,
915
+ compareClients,
916
+ crossChannelLead,
917
+ campaignSetup,
918
+ deliverabilityCheck,
919
+ audienceLists,
920
+ vendorRead
921
+ ].map((definition) => [definition.name, definition.needs])
922
+ );
923
+ var leftOutReason = (outbound, name) => {
924
+ const met = metOn(outbound);
925
+ const unmet = (NEEDS.get(name) ?? []).filter((need) => !met(need));
926
+ if (unmet.length === 0) {
927
+ return void 0;
928
+ }
929
+ const plugins = unmet.filter((need) => pluginsOf(outbound).has(need));
930
+ const capabilities = unmet.filter((need) => !plugins.includes(need));
931
+ return `${name} is not available: ${[
932
+ ...capabilities.length > 0 ? [
933
+ `the ${outbound.provider} adapter does not support ${capabilities.join(", ")}`
934
+ ] : [],
935
+ ...plugins.length > 0 ? [`it needs ${plugins.join(", ")}, which this instance does not offer`] : []
936
+ ].join("; ")}`;
937
+ };
867
938
  var createTools = (outbound, options = {}) => {
868
939
  checkCap(options.maxRequestsPerToolCall, "maxRequestsPerToolCall");
869
940
  const all = [
@@ -881,19 +952,7 @@ var createTools = (outbound, options = {}) => {
881
952
  bind(outbound, vendorRead)
882
953
  ];
883
954
  const wanted = options.only === void 0 ? void 0 : new Set(options.only);
884
- const added = /* @__PURE__ */ new Map([
885
- ["clients", "clients" in outbound],
886
- // person() refuses when redact masks the identifiers it links by.
887
- ["identity", "person" in outbound && !masksIdentifiers(outbound)],
888
- // Offered only when the vendor has reads of its own and no plugin turned them off.
889
- [
890
- "native",
891
- outbound.capabilities.native && Object.keys(outbound.native.catalog).length > 0
892
- ]
893
- ]);
894
- const { capabilities } = outbound;
895
- const isCapability = (need) => Object.hasOwn(capabilities, need);
896
- const met = (need) => added.get(need) ?? (isCapability(need) && capabilities[need] !== false);
955
+ const met = metOn(outbound);
897
956
  const offered = [
898
957
  ...all.filter(
899
958
  (tool) => (wanted === void 0 || wanted.has(tool.name)) && tool.needs.every(met)
@@ -918,5 +977,6 @@ export {
918
977
  describeReplyCounts,
919
978
  repliesByPerson,
920
979
  TOOL_NAMES,
980
+ leftOutReason,
921
981
  createTools
922
982
  };
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-POBAY3TI.js";
15
15
  import {
16
16
  OutboundError
17
- } from "./chunk-QFC4ZHD3.js";
17
+ } from "./chunk-XYHM4KHC.js";
18
18
 
19
19
  // src/internal/capabilities.ts
20
20
  var NO_CAPABILITIES = {
@@ -28,16 +28,19 @@ var NO_CAPABILITIES = {
28
28
  "events.verify": false,
29
29
  "leads.byCampaign": false,
30
30
  "leads.byDomain": false,
31
+ "leads.byInterest": false,
31
32
  "leads.engagement": false,
32
33
  "leads.get": false,
33
34
  "leads.list": false,
34
35
  "leads.lookup": false,
36
+ "leads.lookupMany": false,
35
37
  "leads.since": false,
36
38
  "leads.timeline": false,
37
39
  "lists.get": false,
38
40
  "lists.leads": false,
39
41
  "lists.list": false,
40
42
  "messages.body": false,
43
+ "messages.byHand": false,
41
44
  "messages.byThread": false,
42
45
  "messages.list": false,
43
46
  "messages.since": false,
@@ -45,6 +48,7 @@ var NO_CAPABILITIES = {
45
48
  "placementTests.list": false,
46
49
  "replies.category": false,
47
50
  "replies.list": false,
51
+ "replies.inbox": false,
48
52
  "replies.since": false,
49
53
  "replies.unread": false,
50
54
  "senders.byCampaign": false,