outbound-sdk 0.12.0 → 0.13.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 (67) hide show
  1. package/dist/alerts/index.js +1 -1
  2. package/dist/budget/index.js +1 -1
  3. package/dist/cards/index.js +16 -8
  4. package/dist/chunks/{chunk-AWNH4I5D.js → chunk-6BSFR5SF.js} +3 -0
  5. package/dist/chunks/{chunk-KNWJIJVO.js → chunk-BTIJ24UY.js} +17 -6
  6. package/dist/chunks/{chunk-HDTOGEVN.js → chunk-EAG5NIPM.js} +85 -27
  7. package/dist/chunks/{chunk-B72F56HF.js → chunk-FT6HMMMP.js} +1 -1
  8. package/dist/chunks/{chunk-CTRYCW4G.js → chunk-LJNU4LAR.js} +1471 -857
  9. package/dist/chunks/{chunk-HXCZMMSD.js → chunk-NLYGMVXS.js} +9 -0
  10. package/dist/chunks/{chunk-3DDYXUDG.js → chunk-OE45PREW.js} +1 -1
  11. package/dist/chunks/{chunk-2ADIGC2N.js → chunk-OP2GL7ZT.js} +2 -2
  12. package/dist/chunks/{chunk-UIINRLHQ.js → chunk-PDYE6CWS.js} +130 -62
  13. package/dist/chunks/{chunk-UWNQEQIX.js → chunk-PUIHJFK4.js} +1 -1
  14. package/dist/chunks/{tools-EKLZKXZU.js → tools-VCCH3JNL.js} +11 -5
  15. package/dist/cli/bin.js +9 -9
  16. package/dist/cli/config.d.ts +0 -2
  17. package/dist/cli/index.js +8 -8
  18. package/dist/cli/offered.d.ts +31 -2
  19. package/dist/cli/serve.d.ts +4 -2
  20. package/dist/combine/index.js +26 -4
  21. package/dist/emailbison/index.js +2 -2
  22. package/dist/fixtures/index.js +1 -1
  23. package/dist/heyreach/index.js +4 -1
  24. package/dist/index.js +3 -3
  25. package/dist/insights/capped.d.ts +14 -1
  26. package/dist/insights/define.d.ts +7 -5
  27. package/dist/insights/index.d.ts +1 -1
  28. package/dist/insights/index.js +10 -60
  29. package/dist/insights/inputs.generated.d.ts +26 -14
  30. package/dist/insights/ops/campaign-ranking.d.ts +8 -1
  31. package/dist/insights/ops/client-report.d.ts +28 -18
  32. package/dist/insights/ops/client-runway.d.ts +43 -0
  33. package/dist/insights/ops/index.d.ts +6 -1
  34. package/dist/insights/ops/period-comparison.d.ts +23 -1
  35. package/dist/insights/ops/pipeline-forecast.d.ts +14 -9
  36. package/dist/insights/ops/shared.d.ts +38 -1
  37. package/dist/insights/people/coverage.d.ts +26 -0
  38. package/dist/insights/people/dropped-replies-check.d.ts +5 -1
  39. package/dist/insights/people/dropped-replies.d.ts +6 -2
  40. package/dist/insights/people/index.d.ts +2 -2
  41. package/dist/insights/people/lead-collisions.d.ts +18 -1
  42. package/dist/insights/people/suppression-check.d.ts +18 -1
  43. package/dist/insights/people/thread-contexts.d.ts +2 -2
  44. package/dist/insights/people/thread-read.d.ts +11 -0
  45. package/dist/insights/registry.d.ts +6 -2
  46. package/dist/insights/tools.d.ts +35 -2
  47. package/dist/instantly/index.js +108 -22
  48. package/dist/instantly/lead-ids.d.ts +11 -0
  49. package/dist/instantly/map-lead.d.ts +19 -2
  50. package/dist/internal/entities.d.ts +4 -1
  51. package/dist/internal/fields.d.ts +2 -0
  52. package/dist/internal/reply-people.d.ts +25 -7
  53. package/dist/internal/runway.d.ts +38 -5
  54. package/dist/loader/index.js +1 -1
  55. package/dist/memory/index.js +1 -1
  56. package/dist/redact/index.d.ts +1 -1
  57. package/dist/redact/index.js +59 -28
  58. package/dist/redact/plugin.d.ts +13 -11
  59. package/dist/redact/tokens.d.ts +18 -1
  60. package/dist/smartlead/index.js +4 -1
  61. package/dist/tools/ai-sdk.js +3 -3
  62. package/dist/tools/claude-agent.js +3 -3
  63. package/dist/tools/index.js +4 -4
  64. package/dist/tools/registry.d.ts +8 -1
  65. package/dist/webhooks/index.js +2 -2
  66. package/package.json +1 -1
  67. /package/dist/chunks/{chunk-TOZKA7JR.js → chunk-HNYJO6B4.js} +0 -0
@@ -195,6 +195,15 @@ var messageFields = {
195
195
  bodyText: z.string().nullable(),
196
196
  campaignRef: z.string().nullable(),
197
197
  channel: channelSchema,
198
+ /**
199
+ * The address of the lead the message is with, as the message names it.
200
+ * `null` when it names none; absent from adapters that do not read it.
201
+ */
202
+ leadEmail: z.string().nullable().optional(),
203
+ /**
204
+ * The lead's ref, the same one `leads.list` returns, so a message joins to
205
+ * its lead by ref. `null` when the vendor ties the message to no lead.
206
+ */
198
207
  leadRef: z.string().nullable(),
199
208
  senderRef: z.string().nullable(),
200
209
  sentAt: isoDateTime,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  run
3
- } from "./chunk-UIINRLHQ.js";
3
+ } from "./chunk-PDYE6CWS.js";
4
4
 
5
5
  // src/cli/bin.ts
6
6
  import process from "node:process";
@@ -18,7 +18,7 @@ import {
18
18
  senderHealthSchema,
19
19
  tagSchema,
20
20
  webhookSubscriptionSchema
21
- } from "./chunk-B72F56HF.js";
21
+ } from "./chunk-FT6HMMMP.js";
22
22
  import {
23
23
  plural
24
24
  } from "./chunk-PTZO4QXR.js";
@@ -31,7 +31,7 @@ import {
31
31
  senderSchema,
32
32
  sequenceSchema,
33
33
  workspaceSchema
34
- } from "./chunk-HXCZMMSD.js";
34
+ } from "./chunk-NLYGMVXS.js";
35
35
  import {
36
36
  buildUrl
37
37
  } from "./chunk-OPLXELPS.js";
@@ -5,17 +5,17 @@ import {
5
5
  describeReplyCounts,
6
6
  leftOutReason,
7
7
  repliesByPerson
8
- } from "./chunk-HDTOGEVN.js";
8
+ } from "./chunk-EAG5NIPM.js";
9
9
  import {
10
10
  resolveCampaign,
11
11
  resolveList
12
- } from "./chunk-KNWJIJVO.js";
12
+ } from "./chunk-BTIJ24UY.js";
13
13
  import {
14
14
  plural as plural2
15
15
  } from "./chunk-4PA526S7.js";
16
16
  import {
17
17
  createOutbound
18
- } from "./chunk-2ADIGC2N.js";
18
+ } from "./chunk-OP2GL7ZT.js";
19
19
  import {
20
20
  plural
21
21
  } from "./chunk-PTZO4QXR.js";
@@ -25,10 +25,7 @@ import {
25
25
  } from "./chunk-QGRZDTX4.js";
26
26
  import {
27
27
  fromEnv
28
- } from "./chunk-TOZKA7JR.js";
29
- import {
30
- readEnv
31
- } from "./chunk-NFWWA7MI.js";
28
+ } from "./chunk-HNYJO6B4.js";
32
29
  import {
33
30
  OutboundError
34
31
  } from "./chunk-XYHM4KHC.js";
@@ -147,7 +144,6 @@ var wantsRedact = (flags, fromConfig, mcp) => {
147
144
  }
148
145
  return !fromConfig && (flags.redact === true || mcp);
149
146
  };
150
- var REDACT_KEY_ENV = "OUTBOUND_REDACT_KEY";
151
147
  var capSetting = (mcp) => mcp ? "--max-requests on outbound mcp" : "--max-requests";
152
148
  var insightCaps = (flags, mcp) => ({
153
149
  capSetting: capSetting(mcp),
@@ -165,14 +161,9 @@ var setupFor = async (flags, mcp, note) => {
165
161
  const configured = loaded.plugins;
166
162
  const fromConfig = configured.some((plugin) => plugin.name === "redact");
167
163
  const plugins = [];
168
- const key = readEnv(REDACT_KEY_ENV);
169
164
  if (wantsRedact(flags, fromConfig, mcp)) {
170
165
  const { redact } = await import("../redact/index.js");
171
- plugins.push(redact({ key }));
172
- } else if (fromConfig && key !== void 0) {
173
- note(
174
- `${REDACT_KEY_ENV} is set, but the config file's redact() takes its own options, so it is not used. Pass it there as redact({ key: process.env.${REDACT_KEY_ENV} }).`
175
- );
166
+ plugins.push(redact());
176
167
  }
177
168
  plugins.push(...configured);
178
169
  if (flags.cache !== void 0) {
@@ -404,12 +395,67 @@ var readNative = async (outbound, name, params) => {
404
395
  };
405
396
 
406
397
  // src/cli/offered.ts
407
- var offeredTools = async (outbound, flags) => {
408
- const { insightTools } = await import("../insights/index.js");
409
- return createTools(outbound, {
410
- extra: insightTools(outbound, insightToolCaps(flags, false))
411
- });
398
+ var NO_REDACT = "Start the server with --no-redact to offer it; personal fields are then not masked.";
399
+ var catalog = async (outbound, caps, unmasked, wanted) => {
400
+ const { insightTools, listInsights, membersOf } = await import("../insights/index.js");
401
+ const { insightLeftOutReason } = await import("./tools-VCCH3JNL.js");
402
+ const offer = async (instance, only) => {
403
+ const members = await membersOf(instance);
404
+ const names = only === void 0 ? void 0 : [...only];
405
+ return {
406
+ members,
407
+ tools: createTools(instance, {
408
+ extra: insightTools(instance, { ...caps, members, only: names }),
409
+ members,
410
+ only: TOOL_NAMES.filter((name) => only?.has(name) ?? true)
411
+ })
412
+ };
413
+ };
414
+ const here = await offer(outbound, wanted);
415
+ const every = wanted === void 0 ? here : await offer(outbound);
416
+ const offered = new Set(every.tools.map((tool) => tool.name));
417
+ const open = unmasked === void 0 ? void 0 : await offer(unmasked);
418
+ const unmaskedNames = new Set(open?.tools.map((tool) => tool.name));
419
+ const servedAlone = (name) => here.members.find(
420
+ (member) => leftOutReason(member, name) === void 0 && insightLeftOutReason(member, name) === void 0
421
+ );
422
+ const reasonFor = (name) => {
423
+ if (unmaskedNames.has(name)) {
424
+ return [
425
+ `${name} is left out while the redact plugin is on: it needs what redact masks. ${NO_REDACT}`,
426
+ true
427
+ ];
428
+ }
429
+ const why = leftOutReason(outbound, name, here.members) ?? insightLeftOutReason(outbound, name, here.members) ?? `${name} is not available on this instance`;
430
+ const alone = servedAlone(name);
431
+ return alone === void 0 ? [why, false] : [
432
+ `${why}. Run it with --provider ${alone.provider} to read ${alone.provider} on its own.`,
433
+ true
434
+ ];
435
+ };
436
+ const leftOut = {};
437
+ const turnOn = {};
438
+ for (const name of [
439
+ ...TOOL_NAMES,
440
+ ...listInsights().map((insight) => insight.name)
441
+ ]) {
442
+ if (!offered.has(name)) {
443
+ const [why, elsewhere] = reasonFor(name);
444
+ leftOut[name] = why;
445
+ if (elsewhere) {
446
+ turnOn[name] = why;
447
+ }
448
+ }
449
+ }
450
+ return {
451
+ leftOut,
452
+ members: here.members,
453
+ offered: [...offered],
454
+ tools: here.tools,
455
+ turnOn
456
+ };
412
457
  };
458
+ var offeredTools = async (outbound, flags) => await catalog(outbound, insightToolCaps(flags, false));
413
459
  var describeTool = (tool) => ({
414
460
  description: tool.description,
415
461
  name: tool.name,
@@ -419,6 +465,29 @@ var requiresInput = (tool) => {
419
465
  const { parameters } = tool;
420
466
  return isJsonObject(parameters) && Array.isArray(parameters.required) && parameters.required.length > 0;
421
467
  };
468
+ var listedWith = (items, leftOut) => new Answer(items, { complete: true, notes: Object.values(leftOut) }, true);
469
+ var listedInsights = async ({
470
+ leftOut,
471
+ offered
472
+ }) => {
473
+ const { listInsights } = await import("../insights/index.js");
474
+ const insights = listInsights();
475
+ const isInsight = (name) => insights.some((insight) => insight.name === name);
476
+ return listedWith(
477
+ toJson(insights.filter((insight) => offered.includes(insight.name))),
478
+ Object.fromEntries(
479
+ Object.entries(leftOut).filter(([name]) => isInsight(name))
480
+ )
481
+ );
482
+ };
483
+ var refuseLeftOut = (outbound, { leftOut }, name) => {
484
+ const why = leftOut[name];
485
+ if (why !== void 0) {
486
+ throw new OutboundError("Unsupported", why, {
487
+ provider: outbound.provider
488
+ });
489
+ }
490
+ };
422
491
 
423
492
  // src/cli/commands.ts
424
493
  var text = (input, name) => {
@@ -485,21 +554,26 @@ var drawn = async (name, result2, input) => {
485
554
  );
486
555
  };
487
556
  var runInsight = async (outbound, input) => {
488
- const { insightTools, listInsights, runInsightByName } = await import("../insights/index.js");
557
+ const { insightTools } = await import("../insights/index.js");
558
+ const { runPlaced } = await import("./tools-VCCH3JNL.js");
559
+ const offered = await offeredTools(outbound, input.flags);
489
560
  const [name] = input.positionals;
490
561
  if (name === void 0) {
491
- return asJson(listInsights());
562
+ return await listedInsights(offered);
492
563
  }
564
+ refuseLeftOut(outbound, offered, name);
493
565
  const insightInput = parseInput(text(input, "input"));
494
566
  const [asTool] = wantsCard(input) ? insightTools(outbound, {
495
567
  ...insightToolCaps(input.flags, false),
568
+ members: offered.members,
496
569
  only: [name]
497
570
  }) : [];
498
571
  return asTool === void 0 ? asJson(
499
- await runInsightByName(
572
+ await runPlaced(
500
573
  outbound,
501
574
  name,
502
575
  insightInput,
576
+ offered.members,
503
577
  insightCaps(input.flags, false)
504
578
  )
505
579
  ) : drawn(name, await asTool.call(insightInput), input);
@@ -766,16 +840,11 @@ var COMMAND_TABLE = {
766
840
  help: "tool <name> [--input JSON] [--card | --slack] without --input, a tool that needs input fails with what it takes (exit 2)",
767
841
  run: async (outbound, input) => {
768
842
  const name = required(input, 0, "a tool name");
769
- const offered = await offeredTools(outbound, input.flags);
843
+ const catalogued = await offeredTools(outbound, input.flags);
844
+ const offered = catalogued.tools;
770
845
  const tool = offered.find((candidate) => candidate.name === name);
771
846
  if (tool === void 0) {
772
- const { insightLeftOutReason } = await import("./tools-EKLZKXZU.js");
773
- const why = leftOutReason(outbound, name) ?? insightLeftOutReason(outbound, name);
774
- if (why !== void 0) {
775
- throw new OutboundError("Unsupported", why, {
776
- provider: outbound.provider
777
- });
778
- }
847
+ refuseLeftOut(outbound, catalogued, name);
779
848
  throw new OutboundError(
780
849
  "Invalid",
781
850
  `Unknown tool "${name}".${didYouMean(
@@ -804,8 +873,11 @@ var COMMAND_TABLE = {
804
873
  flags: [],
805
874
  help: "tools",
806
875
  run: async (outbound, input) => {
807
- const offered = await offeredTools(outbound, input.flags);
808
- return offered.map(describeTool);
876
+ const { leftOut, tools: offered } = await offeredTools(
877
+ outbound,
878
+ input.flags
879
+ );
880
+ return listedWith(asJson(offered.map(describeTool)), leftOut);
809
881
  }
810
882
  },
811
883
  webhooks: {
@@ -1236,15 +1308,17 @@ var describePlugins = (outbound) => {
1236
1308
  return `Plugins on: ${names.join(", ")}.${masked}`;
1237
1309
  };
1238
1310
  var describeLeftOut = (outbound, leftOut) => {
1239
- const names = Object.keys(leftOut ?? {});
1311
+ const reasons = Object.entries(leftOut ?? {});
1312
+ const redactOn = outbound.plugins.some((plugin) => plugin.name === "redact");
1313
+ const isRedacts = ([name, why]) => redactOn && !why.startsWith(`${name} is not available`);
1314
+ const names = reasons.filter(isRedacts).map(([name]) => name);
1315
+ const others = reasons.filter((entry) => !isRedacts(entry)).map(([name]) => name);
1316
+ const elsewhere = others.length === 0 ? "" : ` Left out of this server: ${others.join(", ")}. A call to one returns the reason.`;
1240
1317
  if (names.length === 0) {
1241
- return "";
1242
- }
1243
- if (!outbound.plugins.some((plugin) => plugin.name === "redact")) {
1244
- return ` Left out of this server: ${names.join(", ")}. A call to one returns the reason.`;
1318
+ return elsewhere;
1245
1319
  }
1246
1320
  const native = names.includes("vendor_read") ? " (vendor_read returns unmasked vendor payloads)" : "";
1247
- return ` Left out while redact is on: ${names.join(", ")}. They match people by email or LinkedIn profile, which redact masks${native}. Start the server with --no-redact to offer them; personal fields are then not masked.`;
1321
+ return `${elsewhere} Left out while redact is on: ${names.join(", ")}. They match people by email or LinkedIn profile, which redact masks${native}. Start the server with --no-redact to offer them; personal fields are then not masked.`;
1248
1322
  };
1249
1323
  var hasRequestBudget = (value) => "requestBudget" in value && typeof value.requestBudget === "object" && value.requestBudget !== null && "reset" in value.requestBudget && typeof value.requestBudget.reset === "function";
1250
1324
  var budgetOf = (outbound) => hasRequestBudget(outbound) ? outbound.requestBudget : void 0;
@@ -1402,38 +1476,32 @@ var namedTools = (given) => {
1402
1476
  return new Set(names);
1403
1477
  };
1404
1478
  var serve = async (outbound, io, unmasked, wanted, caps) => {
1405
- const { insightTools } = await import("../insights/index.js");
1406
- const offered = (instance) => createTools(instance, { extra: insightTools(instance, caps) }).map(
1407
- (tool) => tool.name
1479
+ const { leftOut, offered, tools, turnOn } = await catalog(
1480
+ outbound,
1481
+ caps,
1482
+ unmasked,
1483
+ wanted
1408
1484
  );
1409
- const here = offered(outbound);
1410
- const masked = (unmasked === void 0 ? [] : offered(unmasked)).filter(
1411
- (name) => !here.includes(name)
1412
- );
1413
- const known = [...here, ...masked];
1414
1485
  for (const name of wanted ?? []) {
1415
- if (!known.includes(name)) {
1486
+ const why = leftOut[name];
1487
+ if (why !== void 0) {
1488
+ throw new OutboundError("Unsupported", `--tools: ${why}`, {
1489
+ provider: outbound.provider
1490
+ });
1491
+ }
1492
+ if (!offered.includes(name)) {
1416
1493
  throw new OutboundError(
1417
1494
  "Invalid",
1418
- `--tools: "${name}" is not a tool this server can offer.${didYouMean(name, known)} Run "outbound tools" to list them`
1495
+ `--tools: "${name}" is not a tool this server can offer.${didYouMean(name, [...offered, ...Object.keys(leftOut)])} Run "outbound tools" to list them`
1419
1496
  );
1420
1497
  }
1421
1498
  }
1422
- const keeps = (name) => wanted === void 0 || wanted.has(name);
1423
- const leftOut = Object.fromEntries(
1424
- masked.filter(keeps).map((name) => [
1425
- name,
1426
- `${name} is left out while the redact plugin is on: it needs what redact masks. Start the server with --no-redact to offer it; personal fields are then not masked.`
1427
- ])
1428
- );
1429
1499
  const server = createMcpServer(outbound, {
1430
- // Given the allowlist, so no insight's hint names an insight left out.
1431
- extra: insightTools(outbound, {
1432
- ...caps,
1433
- only: wanted === void 0 ? void 0 : [...wanted]
1434
- }),
1435
- leftOut,
1436
- only: TOOL_NAMES.filter(keeps),
1500
+ // The catalog's own tools, so the server offers what `outbound tools` lists.
1501
+ extra: tools,
1502
+ // Named in initialize, and a call to one answered with how to get it.
1503
+ leftOut: wanted === void 0 ? turnOn : {},
1504
+ only: [],
1437
1505
  throttled: io.throttled,
1438
1506
  version: packageVersion()
1439
1507
  });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createTools
3
- } from "./chunk-HDTOGEVN.js";
3
+ } from "./chunk-EAG5NIPM.js";
4
4
  import {
5
5
  parseJson
6
6
  } from "./chunk-45TXPJW7.js";
@@ -1,16 +1,19 @@
1
1
  import {
2
2
  INSIGHT_TOOL_CEILING,
3
3
  insightLeftOutReason,
4
- insightTools
5
- } from "./chunk-CTRYCW4G.js";
6
- import "./chunk-KNWJIJVO.js";
4
+ insightPlacement,
5
+ insightTools,
6
+ membersOf,
7
+ runPlaced
8
+ } from "./chunk-LJNU4LAR.js";
9
+ import "./chunk-BTIJ24UY.js";
7
10
  import "./chunk-4PA526S7.js";
8
11
  import "./chunk-I7GBBHD2.js";
9
12
  import "./chunk-HZCTYL22.js";
10
13
  import "./chunk-HPNGSG5E.js";
11
14
  import "./chunk-PTZO4QXR.js";
12
15
  import "./chunk-FALWG5U3.js";
13
- import "./chunk-HXCZMMSD.js";
16
+ import "./chunk-NLYGMVXS.js";
14
17
  import "./chunk-CPACP4YD.js";
15
18
  import "./chunk-QGRZDTX4.js";
16
19
  import "./chunk-OPLXELPS.js";
@@ -20,5 +23,8 @@ import "./chunk-45TXPJW7.js";
20
23
  export {
21
24
  INSIGHT_TOOL_CEILING,
22
25
  insightLeftOutReason,
23
- insightTools
26
+ insightPlacement,
27
+ insightTools,
28
+ membersOf,
29
+ runPlaced
24
30
  };
package/dist/cli/bin.js CHANGED
@@ -1,24 +1,24 @@
1
1
  #!/usr/bin/env node
2
- import "../chunks/chunk-3DDYXUDG.js";
3
- import "../chunks/chunk-UIINRLHQ.js";
4
- import "../chunks/chunk-UWNQEQIX.js";
5
- import "../chunks/chunk-HDTOGEVN.js";
6
- import "../chunks/chunk-KNWJIJVO.js";
2
+ import "../chunks/chunk-OE45PREW.js";
3
+ import "../chunks/chunk-PDYE6CWS.js";
4
+ import "../chunks/chunk-PUIHJFK4.js";
5
+ import "../chunks/chunk-EAG5NIPM.js";
6
+ import "../chunks/chunk-BTIJ24UY.js";
7
7
  import "../chunks/chunk-4PA526S7.js";
8
8
  import "../chunks/chunk-I7GBBHD2.js";
9
9
  import "../chunks/chunk-HZCTYL22.js";
10
- import "../chunks/chunk-2ADIGC2N.js";
10
+ import "../chunks/chunk-OP2GL7ZT.js";
11
11
  import "../chunks/chunk-4O2HRTTI.js";
12
12
  import "../chunks/chunk-HPNGSG5E.js";
13
- import "../chunks/chunk-B72F56HF.js";
13
+ import "../chunks/chunk-FT6HMMMP.js";
14
14
  import "../chunks/chunk-PTZO4QXR.js";
15
- import "../chunks/chunk-HXCZMMSD.js";
15
+ import "../chunks/chunk-NLYGMVXS.js";
16
16
  import "../chunks/chunk-CPACP4YD.js";
17
17
  import "../chunks/chunk-QGRZDTX4.js";
18
18
  import "../chunks/chunk-OPLXELPS.js";
19
19
  import "../chunks/chunk-HXB2IOJJ.js";
20
20
  import "../chunks/chunk-KVAG5GM2.js";
21
- import "../chunks/chunk-TOZKA7JR.js";
21
+ import "../chunks/chunk-HNYJO6B4.js";
22
22
  import "../chunks/chunk-NFWWA7MI.js";
23
23
  import "../chunks/chunk-XYHM4KHC.js";
24
24
  import "../chunks/chunk-45TXPJW7.js";
@@ -21,8 +21,6 @@ export interface PluginFlags {
21
21
  readonly "max-requests"?: string | undefined;
22
22
  readonly cache?: string | undefined;
23
23
  }
24
- /** The secret that keys redact's tokens across runs, when set. Never printed. */
25
- export declare const REDACT_KEY_ENV = "OUTBOUND_REDACT_KEY";
26
24
  /** What a cap message tells a CLI user to raise. */
27
25
  export declare const capSetting: (mcp: boolean) => string;
28
26
  /**
package/dist/cli/index.js CHANGED
@@ -6,25 +6,25 @@ import {
6
6
  run,
7
7
  serveStdio,
8
8
  throttleMonitor
9
- } from "../chunks/chunk-UIINRLHQ.js";
10
- import "../chunks/chunk-UWNQEQIX.js";
11
- import "../chunks/chunk-HDTOGEVN.js";
12
- import "../chunks/chunk-KNWJIJVO.js";
9
+ } from "../chunks/chunk-PDYE6CWS.js";
10
+ import "../chunks/chunk-PUIHJFK4.js";
11
+ import "../chunks/chunk-EAG5NIPM.js";
12
+ import "../chunks/chunk-BTIJ24UY.js";
13
13
  import "../chunks/chunk-4PA526S7.js";
14
14
  import "../chunks/chunk-I7GBBHD2.js";
15
15
  import "../chunks/chunk-HZCTYL22.js";
16
- import "../chunks/chunk-2ADIGC2N.js";
16
+ import "../chunks/chunk-OP2GL7ZT.js";
17
17
  import "../chunks/chunk-4O2HRTTI.js";
18
18
  import "../chunks/chunk-HPNGSG5E.js";
19
- import "../chunks/chunk-B72F56HF.js";
19
+ import "../chunks/chunk-FT6HMMMP.js";
20
20
  import "../chunks/chunk-PTZO4QXR.js";
21
- import "../chunks/chunk-HXCZMMSD.js";
21
+ import "../chunks/chunk-NLYGMVXS.js";
22
22
  import "../chunks/chunk-CPACP4YD.js";
23
23
  import "../chunks/chunk-QGRZDTX4.js";
24
24
  import "../chunks/chunk-OPLXELPS.js";
25
25
  import "../chunks/chunk-HXB2IOJJ.js";
26
26
  import "../chunks/chunk-KVAG5GM2.js";
27
- import "../chunks/chunk-TOZKA7JR.js";
27
+ import "../chunks/chunk-HNYJO6B4.js";
28
28
  import "../chunks/chunk-NFWWA7MI.js";
29
29
  import "../chunks/chunk-XYHM4KHC.js";
30
30
  import "../chunks/chunk-45TXPJW7.js";
@@ -1,10 +1,39 @@
1
1
  import type { Json } from "../internal/json.ts";
2
2
  import type { OutboundApi } from "../internal/outbound/api.ts";
3
3
  import type { OutboundTool } from "../tools/index.ts";
4
- import type { PluginFlags } from "./config.ts";
4
+ import type { InsightToolCaps, PluginFlags } from "./config.ts";
5
+ import { Answer } from "./envelope.ts";
6
+ export interface Catalog {
7
+ /** The tools this instance offers: the built-in ones, then the insights. */
8
+ readonly tools: readonly OutboundTool[];
9
+ /** Every other tool, by name, with the reason it is left out. */
10
+ readonly leftOut: Readonly<Record<string, string>>;
11
+ /**
12
+ * Of `leftOut`, the tools another setting would offer, with how: those
13
+ * redact left out, and those one tool of a combined instance serves alone.
14
+ * The MCP server names them; what the vendor cannot do it does not.
15
+ */
16
+ readonly turnOn: Readonly<Record<string, string>>;
17
+ /** Each tool of a combined instance as its own instance; none on any other. */
18
+ readonly members: readonly OutboundApi[];
19
+ /** What the instance offers by name, whatever `wanted` names. */
20
+ readonly offered: readonly string[];
21
+ }
22
+ /**
23
+ * The one catalog every CLI surface reads. `unmasked` is the same instance
24
+ * without redact, to tell which tools redact left out; `wanted` is what
25
+ * `--tools` names, which narrows what is offered but not what is left out.
26
+ */
27
+ export declare const catalog: (outbound: OutboundApi, caps: InsightToolCaps, unmasked?: OutboundApi | undefined, wanted?: ReadonlySet<string> | undefined) => Promise<Catalog>;
5
28
  /** The tools `outbound mcp` offers: the built-in ones, then the insights. */
6
- export declare const offeredTools: (outbound: OutboundApi, flags: PluginFlags) => Promise<OutboundTool[]>;
29
+ export declare const offeredTools: (outbound: OutboundApi, flags: PluginFlags) => Promise<Catalog>;
7
30
  /** A tool as `outbound tools` lists it: its inputs as JSON Schema, as `outbound insight` lists them. */
8
31
  export declare const describeTool: (tool: OutboundTool) => Json;
9
32
  /** Whether the tool has an input with no default, so it cannot run on none. */
10
33
  export declare const requiresInput: (tool: OutboundTool) => boolean;
34
+ /** A catalog list, with each left-out tool's reason as a note. */
35
+ export declare const listedWith: (items: Json, leftOut: Readonly<Record<string, string>>) => Answer;
36
+ /** `outbound insight` with no name: the catalog's insights, and why each other one is left out. */
37
+ export declare const listedInsights: ({ leftOut, offered, }: Catalog) => Promise<Answer>;
38
+ /** Throws `Unsupported` with the reason when the catalog leaves the tool out. */
39
+ export declare const refuseLeftOut: (outbound: OutboundApi, { leftOut }: Catalog, name: string) => void;
@@ -11,7 +11,9 @@ export interface ServeIo {
11
11
  readonly throttled?: (() => ThrottleTotal) | undefined;
12
12
  }
13
13
  /**
14
- * Serves MCP on stdio. `unmasked` is the same instance without redact, to
15
- * tell which tools redact left out; `wanted` is what `--tools` names.
14
+ * Serves MCP on stdio: the CLI's catalog, and every tool it leaves out named
15
+ * with the reason. `unmasked` is the same instance without redact, to tell
16
+ * which tools redact left out; `wanted` is what `--tools` names, and a name
17
+ * the catalog leaves out is refused with its reason.
16
18
  */
17
19
  export declare const serve: (outbound: OutboundApi, io: ServeIo, unmasked: OutboundApi | undefined, wanted: ReadonlySet<string> | undefined, caps: InsightToolCaps) => Promise<void>;
@@ -3,11 +3,11 @@ import {
3
3
  mergeFields,
4
4
  resolveCapabilities,
5
5
  resolveFields
6
- } from "../chunks/chunk-B72F56HF.js";
6
+ } from "../chunks/chunk-FT6HMMMP.js";
7
7
  import {
8
8
  recordBase
9
9
  } from "../chunks/chunk-U5AK6OJM.js";
10
- import "../chunks/chunk-HXCZMMSD.js";
10
+ import "../chunks/chunk-NLYGMVXS.js";
11
11
  import "../chunks/chunk-QGRZDTX4.js";
12
12
  import {
13
13
  parseRef
@@ -378,8 +378,30 @@ var lists = (members) => ({
378
378
  }))
379
379
  })
380
380
  });
381
+ var readsThreads = (member) => resolveCapabilities(member.capabilities)["messages.byThread"];
382
+ var pageThread = (members, ctx, query) => pageNewestFirst(
383
+ members.filter(readsThreads),
384
+ ctx,
385
+ query,
386
+ async (member, memberCtx, next) => {
387
+ if (member.listMessages === void 0) {
388
+ throw missing2(member, "listMessages");
389
+ }
390
+ try {
391
+ return await member.listMessages({ ...query, next }, memberCtx);
392
+ } catch (error) {
393
+ if (OutboundError.is(error) && (error.code === "Invalid" || error.code === "NotFound")) {
394
+ return { items: [] };
395
+ }
396
+ throw error;
397
+ }
398
+ }
399
+ );
381
400
  var messageLists = (members) => ({
382
401
  listMessages: (query, ctx) => {
402
+ if (query.threadId !== void 0 && query.leadId === void 0 && query.campaignId === void 0) {
403
+ return pageThread(members, ctx, query);
404
+ }
383
405
  const lead = query.leadId === void 0 ? void 0 : routeRef(members, ctx, query.leadId, "Lead");
384
406
  return scopedOrAcross(
385
407
  lead === void 0 ? members : [lead.member],
@@ -513,8 +535,8 @@ var combine = (members) => {
513
535
  ...accountReads(members),
514
536
  capabilities: {
515
537
  ...intersectCapabilities(first ?? resolveCapabilities(), ...rest),
516
- // A thread id is the vendor's own and names no member, so it cannot be routed.
517
- "messages.byThread": false,
538
+ // A thread id names no member, so every member that reads threads is asked.
539
+ "messages.byThread": members.some(readsThreads),
518
540
  // A native read belongs to one vendor; reach it through workspace(id).
519
541
  native: false,
520
542
  // A combined instance always knows its workspaces: they are its members.
@@ -22,7 +22,7 @@ import {
22
22
  toTag,
23
23
  toWebhook,
24
24
  toWorkspace
25
- } from "../chunks/chunk-AWNH4I5D.js";
25
+ } from "../chunks/chunk-6BSFR5SF.js";
26
26
  import {
27
27
  applyTracking,
28
28
  ownTracking,
@@ -52,7 +52,7 @@ import {
52
52
  recordBase,
53
53
  refTo
54
54
  } from "../chunks/chunk-U5AK6OJM.js";
55
- import "../chunks/chunk-HXCZMMSD.js";
55
+ import "../chunks/chunk-NLYGMVXS.js";
56
56
  import {
57
57
  emptyCounts,
58
58
  metricRow,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  evidenceSchema
3
- } from "../chunks/chunk-HXCZMMSD.js";
3
+ } from "../chunks/chunk-NLYGMVXS.js";
4
4
  import "../chunks/chunk-QGRZDTX4.js";
5
5
  import {
6
6
  profileSlug
@@ -26,7 +26,7 @@ import {
26
26
  refTo,
27
27
  refsTo
28
28
  } from "../chunks/chunk-U5AK6OJM.js";
29
- import "../chunks/chunk-HXCZMMSD.js";
29
+ import "../chunks/chunk-NLYGMVXS.js";
30
30
  import {
31
31
  emptyCounts,
32
32
  metricRow
@@ -436,6 +436,8 @@ var fields = {
436
436
  },
437
437
  message: {
438
438
  bodyHtml: false,
439
+ // Read only by the Instantly adapter, whose emails name their lead by address.
440
+ leadEmail: false,
439
441
  isAuto: false,
440
442
  isAutoSource: false,
441
443
  stepIndex: false,
@@ -468,6 +470,7 @@ var fields = {
468
470
  placementTest: false,
469
471
  reply: {
470
472
  bodyHtml: false,
473
+ leadEmail: false,
471
474
  // The lead's newest auto-tag, not a label on the message.
472
475
  category: "derived",
473
476
  categorySource: "derived",
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Outbound,
4
4
  createOutbound,
5
5
  fullJitterBackoff
6
- } from "./chunks/chunk-2ADIGC2N.js";
6
+ } from "./chunks/chunk-OP2GL7ZT.js";
7
7
  import {
8
8
  MemoryRateLimitStore
9
9
  } from "./chunks/chunk-4O2HRTTI.js";
@@ -22,7 +22,7 @@ import {
22
22
  senderHealthSchema,
23
23
  tagSchema,
24
24
  webhookSubscriptionSchema
25
- } from "./chunks/chunk-B72F56HF.js";
25
+ } from "./chunks/chunk-FT6HMMMP.js";
26
26
  import "./chunks/chunk-PTZO4QXR.js";
27
27
  import {
28
28
  defineNative
@@ -48,7 +48,7 @@ import {
48
48
  senderStatusSchema,
49
49
  sequenceSchema,
50
50
  workspaceSchema
51
- } from "./chunks/chunk-HXCZMMSD.js";
51
+ } from "./chunks/chunk-NLYGMVXS.js";
52
52
  import {
53
53
  METRIC_DEFINITIONS,
54
54
  computeRates,