outbound-sdk 0.2.0 → 0.4.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 (140) hide show
  1. package/dist/alerts/index.js +50 -19
  2. package/dist/alerts/plugin.d.ts +20 -3
  3. package/dist/audit/index.js +2 -2
  4. package/dist/benchmarks/index.js +5 -5
  5. package/dist/budget/index.d.ts +3 -2
  6. package/dist/budget/index.js +11 -10
  7. package/dist/cards/content.d.ts +6 -1
  8. package/dist/cards/format.d.ts +17 -2
  9. package/dist/cards/index.d.ts +1 -1
  10. package/dist/cards/index.js +297 -132
  11. package/dist/cards/parts.d.ts +9 -2
  12. package/dist/cards/render.d.ts +20 -3
  13. package/dist/chunks/{chunk-U2D34ARZ.js → chunk-2D42TQFU.js} +3 -3
  14. package/dist/chunks/chunk-4PA526S7.js +17 -0
  15. package/dist/chunks/{chunk-6CVZOUHB.js → chunk-5CFO3CXG.js} +24 -0
  16. package/dist/chunks/{chunk-XNFESPZH.js → chunk-5FVKRIEJ.js} +168 -31
  17. package/dist/chunks/{chunk-PMSSUWD7.js → chunk-7LNJJ2RO.js} +217 -58
  18. package/dist/chunks/{chunk-XC6CZP73.js → chunk-7ZDS6SZD.js} +7 -1
  19. package/dist/chunks/{chunk-SBIZDCRY.js → chunk-A6WVOCA4.js} +4 -4
  20. package/dist/chunks/{chunk-VQSCHOBV.js → chunk-BLCJHP5H.js} +11 -4
  21. package/dist/chunks/{chunk-4PSO6JEK.js → chunk-BOWXGMN3.js} +6 -21
  22. package/dist/chunks/{chunk-DJ2IUQEU.js → chunk-C4LS2HNV.js} +3 -3
  23. package/dist/chunks/{chunk-AFU5E5QB.js → chunk-E6DSDCPI.js} +98 -69
  24. package/dist/chunks/{chunk-IPUYZD4O.js → chunk-GFDNRWR3.js} +1 -1
  25. package/dist/chunks/{chunk-PURHK3JU.js → chunk-IZFTTMJP.js} +4 -4
  26. package/dist/chunks/{chunk-E7JHLNLG.js → chunk-J7DDZ4C2.js} +15 -2
  27. package/dist/chunks/{chunk-FKH5N47I.js → chunk-K4USHN4C.js} +1 -1
  28. package/dist/chunks/chunk-LVQUSKEX.js +17 -0
  29. package/dist/chunks/{chunk-YOTW5ESM.js → chunk-PQSTQKRD.js} +2 -2
  30. package/dist/chunks/chunk-PTZO4QXR.js +15 -0
  31. package/dist/chunks/{chunk-LVYG7XZJ.js → chunk-QAKJ76HB.js} +1 -1
  32. package/dist/chunks/chunk-QGRZDTX4.js +26 -0
  33. package/dist/chunks/{chunk-R3Y56YVF.js → chunk-Y5RAJ6PZ.js} +2 -2
  34. package/dist/chunks/{chunk-RCZ7ZZFU.js → chunk-ZFVHM5JI.js} +3 -3
  35. package/dist/chunks/{chunk-UAT3JSJZ.js → chunk-ZOAG2C6V.js} +2 -2
  36. package/dist/cli/bin.js +17 -13
  37. package/dist/cli/commands.d.ts +11 -0
  38. package/dist/cli/index.js +17 -13
  39. package/dist/cli/mcp.d.ts +5 -0
  40. package/dist/cli/version.d.ts +2 -0
  41. package/dist/clients/index.d.ts +1 -1
  42. package/dist/clients/index.js +35 -10
  43. package/dist/clients/plugin.d.ts +9 -2
  44. package/dist/combine/index.js +7 -6
  45. package/dist/exporter/index.d.ts +5 -2
  46. package/dist/exporter/index.js +2 -2
  47. package/dist/failover/index.js +3 -3
  48. package/dist/fixtures/index.js +5 -4
  49. package/dist/heyreach/client.d.ts +2 -0
  50. package/dist/heyreach/index.js +71 -39
  51. package/dist/heyreach/map.d.ts +5 -2
  52. package/dist/identity/index.js +33 -17
  53. package/dist/identity/plugin.d.ts +2 -0
  54. package/dist/index.d.ts +2 -2
  55. package/dist/index.js +13 -10
  56. package/dist/insights/campaign.d.ts +3 -0
  57. package/dist/insights/capped.d.ts +29 -0
  58. package/dist/insights/copy/copy-audit.d.ts +2 -0
  59. package/dist/insights/copy/copy-reuse.d.ts +27 -3
  60. package/dist/insights/copy/index.d.ts +8 -8
  61. package/dist/insights/copy/reply-timing.d.ts +8 -0
  62. package/dist/insights/copy/reuse-base.d.ts +32 -0
  63. package/dist/insights/copy/shared.d.ts +39 -15
  64. package/dist/insights/copy/step-funnel.d.ts +16 -5
  65. package/dist/insights/copy/variant-test.d.ts +19 -8
  66. package/dist/insights/define.d.ts +56 -2
  67. package/dist/insights/fields.d.ts +16 -0
  68. package/dist/insights/index.d.ts +2 -1
  69. package/dist/insights/index.js +1494 -730
  70. package/dist/insights/inputs.generated.d.ts +951 -0
  71. package/dist/insights/ops/campaign-diagnosis.d.ts +3 -1
  72. package/dist/insights/ops/campaign-ranking.d.ts +12 -4
  73. package/dist/insights/ops/channel-mix.d.ts +2 -1
  74. package/dist/insights/ops/client-report.d.ts +18 -5
  75. package/dist/insights/ops/index.d.ts +6 -2
  76. package/dist/insights/ops/period-comparison.d.ts +14 -3
  77. package/dist/insights/ops/pipeline-forecast.d.ts +14 -4
  78. package/dist/insights/ops/shared.d.ts +29 -24
  79. package/dist/insights/ops/tag-rollup.d.ts +2 -1
  80. package/dist/insights/people/account-summary.d.ts +13 -0
  81. package/dist/insights/people/dropped-replies.d.ts +8 -0
  82. package/dist/insights/people/find.d.ts +7 -1
  83. package/dist/insights/people/hot-leads.d.ts +16 -1
  84. package/dist/insights/people/person-summary.d.ts +6 -0
  85. package/dist/insights/people/read.d.ts +26 -10
  86. package/dist/insights/people/suppression-check.d.ts +11 -2
  87. package/dist/insights/plugin.d.ts +7 -5
  88. package/dist/insights/ref.d.ts +6 -0
  89. package/dist/insights/registry.d.ts +28 -16
  90. package/dist/insights/senders/bounce-watch.d.ts +25 -8
  91. package/dist/insights/senders/capacity-sends.d.ts +22 -0
  92. package/dist/insights/senders/domain-health.d.ts +10 -4
  93. package/dist/insights/senders/index.d.ts +14 -6
  94. package/dist/insights/senders/read.d.ts +15 -14
  95. package/dist/insights/senders/sender-capacity.d.ts +5 -13
  96. package/dist/insights/senders/sender-load.d.ts +2 -0
  97. package/dist/insights/stats.d.ts +8 -0
  98. package/dist/insights/tools.d.ts +3 -2
  99. package/dist/instantly/client.d.ts +2 -0
  100. package/dist/instantly/index.js +44 -29
  101. package/dist/instantly/map.d.ts +6 -2
  102. package/dist/internal/engine/request.d.ts +5 -0
  103. package/dist/internal/entities.d.ts +3 -20
  104. package/dist/internal/errors.d.ts +44 -0
  105. package/dist/internal/fields.d.ts +1 -1
  106. package/dist/internal/json.d.ts +9 -2
  107. package/dist/internal/lists.d.ts +24 -0
  108. package/dist/internal/numbers.d.ts +8 -0
  109. package/dist/internal/outbound/collections.d.ts +4 -0
  110. package/dist/internal/outbound/create.d.ts +24 -3
  111. package/dist/internal/outbound/outbound.d.ts +13 -1
  112. package/dist/internal/outbound/validate.d.ts +4 -0
  113. package/dist/internal/outbound/walker.d.ts +3 -2
  114. package/dist/internal/plural.d.ts +12 -0
  115. package/dist/internal/renamed.d.ts +28 -0
  116. package/dist/internal/vocabulary.d.ts +20 -0
  117. package/dist/loader/index.js +5 -5
  118. package/dist/memory/adapter.d.ts +7 -0
  119. package/dist/memory/demo-stats.d.ts +3 -0
  120. package/dist/memory/demo.d.ts +14 -3
  121. package/dist/memory/index.d.ts +1 -0
  122. package/dist/memory/index.js +200 -95
  123. package/dist/providers/index.d.ts +72 -0
  124. package/dist/providers/index.js +3 -1
  125. package/dist/reconcile/index.js +5 -4
  126. package/dist/redact/index.js +10 -4
  127. package/dist/redact/plugin.d.ts +7 -0
  128. package/dist/smartlead/index.js +102 -49
  129. package/dist/smartlead/shared.d.ts +13 -0
  130. package/dist/sync/index.js +2 -2
  131. package/dist/tools/ai-sdk.js +8 -6
  132. package/dist/tools/campaign-tools.d.ts +1 -1
  133. package/dist/tools/claude-agent.js +8 -6
  134. package/dist/tools/index.js +9 -7
  135. package/dist/tools/input-problem.d.ts +8 -0
  136. package/dist/tools/registry.d.ts +7 -2
  137. package/dist/tools/shared.d.ts +7 -0
  138. package/dist/tracing/index.js +2 -2
  139. package/dist/webhooks/index.js +10 -9
  140. package/package.json +1 -1
@@ -16,11 +16,47 @@ export interface InsightMeta {
16
16
  /** When the insight was computed, ISO 8601 UTC. */
17
17
  readonly computedAt: string;
18
18
  }
19
+ /** What the redact plugin masks on an instance. */
20
+ export interface Masking {
21
+ readonly fields: readonly string[];
22
+ readonly strategy: "hash" | "mask";
23
+ /** The token the plugin writes in place of a value in a masked field. */
24
+ readonly hash?: ((value: string) => string) | undefined;
25
+ }
26
+ /**
27
+ * Says why an insight cannot answer with these fields masked, for example
28
+ * `email addresses, which it matches people by`, or `null` when it can.
29
+ */
30
+ export type MaskedOut = (masking: Masking) => string | null;
31
+ /**
32
+ * Names what this adapter does not report that the insight needs, for
33
+ * example `campaign tags`, or `null` when it reports it.
34
+ */
35
+ export type Lacks = (outbound: OutboundApi) => string | null;
36
+ /** What the redact plugin masks here, or `null` without it. */
37
+ export declare const maskingOf: (outbound: OutboundApi) => Masking | null;
38
+ /** Why the entry cannot answer under this instance's redact plugin, or `null`. */
39
+ export declare const maskedOutBy: (outbound: OutboundApi, entry: Pick<InsightEntry, "maskedOut">) => string | null;
19
40
  export interface InsightResult<Data> {
20
41
  readonly insight: string;
21
42
  readonly data: Data;
22
43
  readonly meta: InsightMeta;
23
44
  }
45
+ /**
46
+ * The cap a listing was read up to, for the note when it stops early:
47
+ * `{ input: "max_campaigns", max: 25, what: "campaigns" }` gives "Stopped at
48
+ * 25 campaigns (max_campaigns); more exist."
49
+ */
50
+ export interface Cap {
51
+ /** The cap as the caller set it, not the room left under it. */
52
+ readonly max: number;
53
+ /** What was counted, in the plural: `campaigns`, `leads of a campaign`. */
54
+ readonly what: string;
55
+ /** The input that raises the cap, or `null` for a cap no input sets. */
56
+ readonly input: string | null;
57
+ }
58
+ /** The note for a listing that a cap stopped with more records left. */
59
+ export declare const capNote: (cap: Cap) => string;
24
60
  /** What an insight reads through. Every helper records the read's cost and evidence. */
25
61
  export interface InsightContext {
26
62
  readonly outbound: OutboundApi;
@@ -31,9 +67,11 @@ export interface InsightContext {
31
67
  /**
32
68
  * Walks a listing to its end or its `max`, records the cost and returns the
33
69
  * records. When `max` cut it short the answer is marked incomplete; `cap`
34
- * names what was capped for the note, for example `50 campaigns`.
70
+ * names what was capped and the input that raises it, for the note. A
71
+ * string such as `50 campaigns` is still accepted, for insights written
72
+ * before the input could be named.
35
73
  */
36
- readonly all: <Item>(walk: ListAll<Item>, cap?: string) => Promise<Item[]>;
74
+ readonly all: <Item>(walk: ListAll<Item>, cap?: Cap | string) => Promise<Item[]>;
37
75
  /** Records one lookup's cost and returns the record. */
38
76
  readonly one: <Item>(item: WithMeta<Item>) => Item;
39
77
  /** Records a stats read's cost and returns its rows. */
@@ -61,6 +99,10 @@ export interface InsightEntry {
61
99
  readonly needs: readonly CapabilityKey[];
62
100
  /** What to ask next, for an agent. */
63
101
  readonly next: string;
102
+ /** Why the insight cannot answer while the redact plugin masks what it matches on. */
103
+ readonly maskedOut?: MaskedOut | undefined;
104
+ /** What the adapter does not report that the insight needs, beyond a capability. */
105
+ readonly lacks?: Lacks | undefined;
64
106
  /** Checks the input and the capabilities, then runs the insight. */
65
107
  readonly execute: (outbound: OutboundApi, input?: Json, options?: RunOptions) => Promise<InsightResult<Json>>;
66
108
  }
@@ -80,6 +122,18 @@ export interface InsightSpec<Key extends string, Input, Data, Given = Input> {
80
122
  */
81
123
  readonly needsFor?: ((input: Input) => readonly CapabilityKey[]) | undefined;
82
124
  readonly next: string;
125
+ /**
126
+ * What makes the insight unable to answer under the redact plugin, for an
127
+ * insight that matches records by a field redact can mask. Checked before
128
+ * any request, and an insight it refuses is not offered as a tool.
129
+ */
130
+ readonly maskedOut?: MaskedOut | undefined;
131
+ /**
132
+ * What the adapter does not report that the insight needs beyond a
133
+ * capability, such as a field its records never fill. Checked before any
134
+ * request, and an insight it refuses is not offered as a tool.
135
+ */
136
+ readonly lacks?: Lacks | undefined;
83
137
  readonly run: (context: InsightContext, input: Input) => Promise<Data>;
84
138
  }
85
139
  export interface InsightDefinition<Key extends string = string, Input = never, Data = Json, Given = Input> extends InsightEntry {
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ import type { CampaignStatus } from "../internal/entities.ts";
3
+ /** `from` and `to`: an inclusive range of UTC days, where `null` is no bound. */
4
+ export declare const rangeFields: {
5
+ from: z.ZodDefault<z.ZodNullable<z.ZodISODate>>;
6
+ to: z.ZodDefault<z.ZodNullable<z.ZodISODate>>;
7
+ };
8
+ /** `statuses`: only campaigns in one of these states are read. */
9
+ export declare const statusesInput: (fallback: readonly [CampaignStatus, ...CampaignStatus[]]) => z.ZodDefault<z.ZodArray<z.ZodEnum<{
10
+ active: "active";
11
+ archived: "archived";
12
+ completed: "completed";
13
+ draft: "draft";
14
+ paused: "paused";
15
+ unknown: "unknown";
16
+ }>>>;
@@ -1,9 +1,10 @@
1
1
  export { insights, listInsights, runInsightByName } from "./plugin.ts";
2
2
  export type { Insights, InsightsExtension } from "./plugin.ts";
3
+ export type { InsightInputs } from "./inputs.generated.ts";
3
4
  export { insightTools } from "./tools.ts";
4
5
  export type { InsightToolsOptions } from "./tools.ts";
5
6
  export { defineInsight, runInsight } from "./define.ts";
6
- export type { InsightContext, InsightDefinition, InsightMeta, InsightResult, RunOptions, } from "./define.ts";
7
+ export type { Cap, InsightContext, InsightDefinition, InsightMeta, InsightResult, RunOptions, } from "./define.ts";
7
8
  export { INSIGHTS } from "./registry.ts";
8
9
  export { compareRates, deviation, mean, median, percentile, rate, round, tally, total, wilson, zScore, } from "./stats.ts";
9
10
  export type { Interval, ProportionTest, Sample } from "./stats.ts";