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.
- package/dist/alerts/index.js +3 -3
- package/dist/audit/index.js +1 -1
- package/dist/benchmarks/index.js +3 -3
- package/dist/budget/index.d.ts +7 -0
- package/dist/budget/index.js +3 -3
- package/dist/cache/index.js +2 -2
- package/dist/cards/index.js +17 -5
- package/dist/chunks/{chunk-6NSCPTOY.js → chunk-4GK56PRO.js} +691 -441
- package/dist/chunks/{chunk-MW4C6LTN.js → chunk-7TASUWPC.js} +2 -2
- package/dist/chunks/{chunk-M2VXGLLZ.js → chunk-CPACP4YD.js} +1 -1
- package/dist/chunks/{chunk-4AVYRVN5.js → chunk-FTK4JS65.js} +31 -10
- package/dist/chunks/{chunk-YW6FFVSZ.js → chunk-HXB2IOJJ.js} +1 -1
- package/dist/chunks/{chunk-T5MJMW3R.js → chunk-IKKCMWBK.js} +1 -1
- package/dist/chunks/{chunk-FHKSLCVW.js → chunk-KVAG5GM2.js} +19 -0
- package/dist/chunks/{chunk-7I3EPR23.js → chunk-MPE6VLLY.js} +3 -3
- package/dist/chunks/{chunk-UFQ4WMLU.js → chunk-NFWWA7MI.js} +1 -1
- package/dist/chunks/{chunk-GL7BABF2.js → chunk-OMCDMELK.js} +1 -1
- package/dist/chunks/{chunk-JRL3QRBS.js → chunk-OVTYA3IB.js} +88 -28
- package/dist/chunks/{chunk-HIAK2GCI.js → chunk-RMAHQ2OZ.js} +5 -1
- package/dist/chunks/{chunk-65YAGEWZ.js → chunk-RQLOPMMR.js} +153 -39
- package/dist/chunks/{chunk-OK3GAZMT.js → chunk-SYUMA3CP.js} +12 -0
- package/dist/chunks/{chunk-LVZGIKNF.js → chunk-U5AK6OJM.js} +1 -1
- package/dist/chunks/{chunk-KTYTE2BU.js → chunk-UAHYPASH.js} +20 -11
- package/dist/chunks/{chunk-BNDHEDHD.js → chunk-UOJG4VYF.js} +3 -3
- package/dist/chunks/{chunk-LD6F46UT.js → chunk-UWD65SK7.js} +2 -2
- package/dist/chunks/{chunk-I7DXXGNZ.js → chunk-UZLFZZ2U.js} +5 -5
- package/dist/chunks/{chunk-DNPNTD5W.js → chunk-VVDBCQLK.js} +1 -1
- package/dist/chunks/{chunk-IVH3NMQZ.js → chunk-WROJO6XB.js} +1 -1
- package/dist/chunks/chunk-XMCNRU4H.js +7279 -0
- package/dist/chunks/{chunk-QFC4ZHD3.js → chunk-XYHM4KHC.js} +1 -1
- package/dist/chunks/{chunk-NAWZ73QS.js → chunk-YFJ3OQZS.js} +8 -1
- package/dist/chunks/tools-II7GXAOM.js +23 -0
- package/dist/cli/args.d.ts +48 -0
- package/dist/cli/bin.js +14 -14
- package/dist/cli/commands.d.ts +0 -7
- package/dist/cli/config.d.ts +31 -2
- package/dist/cli/envelope.d.ts +2 -0
- package/dist/cli/index.d.ts +4 -0
- package/dist/cli/index.js +19 -15
- package/dist/cli/listing.d.ts +5 -2
- package/dist/cli/mcp.d.ts +9 -0
- package/dist/cli/offered.d.ts +10 -0
- package/dist/cli/options.d.ts +6 -0
- package/dist/cli/progress.d.ts +27 -0
- package/dist/cli/serve.d.ts +17 -0
- package/dist/clients/index.js +3 -3
- package/dist/combine/index.js +154 -35
- package/dist/combine/newest.d.ts +18 -0
- package/dist/combine/route.d.ts +19 -5
- package/dist/emailbison/index.js +22 -14
- package/dist/emailbison/map-sequence.d.ts +2 -1
- package/dist/exporter/index.js +1 -1
- package/dist/failover/index.js +3 -3
- package/dist/fixtures/index.js +4 -4
- package/dist/heyreach/capabilities.d.ts +4 -0
- package/dist/heyreach/conversations.d.ts +23 -0
- package/dist/heyreach/inbox.d.ts +0 -1
- package/dist/heyreach/index.js +251 -92
- package/dist/identity/index.js +2 -2
- package/dist/index.js +7 -7
- package/dist/insights/capped.d.ts +6 -6
- package/dist/insights/copy/index.d.ts +2 -0
- package/dist/insights/copy/reply-timing.d.ts +4 -0
- package/dist/insights/cost.d.ts +11 -1
- package/dist/insights/define.d.ts +25 -16
- package/dist/insights/inbox.d.ts +12 -0
- package/dist/insights/index.js +42 -6578
- package/dist/insights/inputs.generated.d.ts +60 -24
- package/dist/insights/ops/anomalies.d.ts +9 -0
- package/dist/insights/ops/index.d.ts +2 -0
- package/dist/insights/ops/period-comparison.d.ts +7 -8
- package/dist/insights/ops/pipeline-forecast.d.ts +10 -0
- package/dist/insights/ops/shared.d.ts +6 -1
- package/dist/insights/people/auto-replies.d.ts +11 -7
- package/dist/insights/people/dropped-replies.d.ts +13 -4
- package/dist/insights/people/hot-leads-read.d.ts +31 -0
- package/dist/insights/people/hot-leads.d.ts +15 -3
- package/dist/insights/people/index.d.ts +10 -2
- package/dist/insights/people/read.d.ts +1 -1
- package/dist/insights/registry.d.ts +14 -2
- package/dist/insights/run-cap.d.ts +10 -0
- package/dist/insights/senders/read.d.ts +0 -3
- package/dist/insights/tools.d.ts +12 -0
- package/dist/insights/tracked-reads.d.ts +53 -0
- package/dist/instantly/capabilities.d.ts +13 -1
- package/dist/instantly/index.js +122 -46
- package/dist/instantly/map-account.d.ts +2 -1
- package/dist/instantly/map-lead.d.ts +1 -0
- package/dist/instantly/map.d.ts +4 -3
- package/dist/internal/adapter.d.ts +17 -0
- package/dist/internal/capabilities.d.ts +13 -0
- package/dist/internal/engine/budget.d.ts +9 -1
- package/dist/internal/engine/engine.d.ts +2 -1
- package/dist/internal/engine/request.d.ts +2 -0
- package/dist/internal/errors.d.ts +5 -0
- package/dist/internal/hooks.d.ts +11 -0
- package/dist/internal/notes.d.ts +16 -0
- package/dist/internal/outbound/api.d.ts +14 -0
- package/dist/internal/outbound/core.d.ts +4 -1
- package/dist/internal/outbound/operation-shared.d.ts +2 -0
- package/dist/internal/sha256.d.ts +2 -0
- package/dist/internal/url.d.ts +1 -0
- package/dist/loader/index.js +3 -3
- package/dist/memory/index.js +6 -6
- package/dist/redact/index.d.ts +1 -1
- package/dist/redact/index.js +107 -19
- package/dist/redact/plugin.d.ts +26 -3
- package/dist/smartlead/index.js +22 -13
- package/dist/smartlead/map.d.ts +3 -2
- package/dist/sync/index.js +2 -2
- package/dist/tools/ai-sdk.js +5 -5
- package/dist/tools/by-name.d.ts +9 -1
- package/dist/tools/campaign-tools.d.ts +3 -1
- package/dist/tools/claude-agent.js +5 -5
- package/dist/tools/index.js +6 -6
- package/dist/tools/registry.d.ts +6 -0
- package/dist/tools/shared.d.ts +5 -1
- package/dist/tracing/index.js +1 -1
- package/dist/webhooks/index.js +11 -11
- package/package.json +1 -1
package/dist/insights/cost.d.ts
CHANGED
|
@@ -21,6 +21,13 @@ export interface Price {
|
|
|
21
21
|
readonly one: (action: string) => number;
|
|
22
22
|
/** Leads found by an email or a profile, up to `max`: `leads.lookup` where the adapter prices it. */
|
|
23
23
|
readonly lookup: (max: number) => number;
|
|
24
|
+
/**
|
|
25
|
+
* One campaign's senders, up to `max`: `senders.byCampaign` where the
|
|
26
|
+
* adapter prices it apart, as Instantly does because it reads the campaign
|
|
27
|
+
* again with each page of the workspace's mailboxes, otherwise a listing
|
|
28
|
+
* of `senders.list`.
|
|
29
|
+
*/
|
|
30
|
+
readonly campaignSenders: (max: number) => number;
|
|
24
31
|
/**
|
|
25
32
|
* A count only the data decides, up to `max`: 0 at the least, `max` at the
|
|
26
33
|
* most. For example the active campaigns among those read.
|
|
@@ -51,7 +58,7 @@ export interface Bounds {
|
|
|
51
58
|
export declare const boundsOf: <Input>(outbound: OutboundApi, cost: InsightCost<Input> | undefined, input: Input, found?: number) => Bounds | null;
|
|
52
59
|
/**
|
|
53
60
|
* The cap an insight runs under when none is set: the most it can cost, a
|
|
54
|
-
* quarter more for retries (each retry is a request too) and
|
|
61
|
+
* quarter more for retries (each retry is a request too) and 20 on top.
|
|
55
62
|
*/
|
|
56
63
|
export declare const defaultCap: (bounds: Bounds | null) => number;
|
|
57
64
|
/** The cap a run is under, and where it came from, for the message when it stops. */
|
|
@@ -71,6 +78,9 @@ export interface CapStop extends CapInEffect {
|
|
|
71
78
|
}
|
|
72
79
|
/** What a cap stop of an insight says, or `undefined` for any other error. */
|
|
73
80
|
export declare const capStopOf: (cause: unknown) => CapStop | undefined;
|
|
81
|
+
export declare const capWords: (effect: CapInEffect) => string;
|
|
82
|
+
/** What to change for a run that stopped at its cap: the input to lower, and the setting to raise. */
|
|
83
|
+
export declare const advice: (stop: CapStop) => string;
|
|
74
84
|
export declare const capError: (message: string, stop: CapStop, provider: string) => OutboundError;
|
|
75
85
|
/** The error for a run refused before a request it cannot afford. */
|
|
76
86
|
export declare const refusal: (name: string, bounds: Bounds, room: number, stop: CapStop, provider: string) => OutboundError;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ZodObject, ZodType } from "zod";
|
|
2
2
|
import type { CapabilityKey } from "../internal/capabilities.ts";
|
|
3
|
-
import type { Evidence, MetricRow } from "../internal/entities.ts";
|
|
3
|
+
import type { Evidence, Lead, MetricRow } from "../internal/entities.ts";
|
|
4
4
|
import type { Json } from "../internal/json.ts";
|
|
5
5
|
import type { ListAll, OutboundApi, PageResult, StatsResult, WithMeta } from "../internal/outbound/api.ts";
|
|
6
6
|
import type { InsightCost } from "./cost.ts";
|
|
7
7
|
import type { CapOptions } from "./run-cap.ts";
|
|
8
|
+
import type { Cap } from "./tracked-reads.ts";
|
|
8
9
|
export interface InsightMeta {
|
|
9
10
|
/** `exact` only when every read behind the answer was exact. */
|
|
10
11
|
readonly evidence: Evidence;
|
|
@@ -24,6 +25,13 @@ export interface Masking {
|
|
|
24
25
|
readonly strategy: "hash" | "mask";
|
|
25
26
|
/** The token the plugin writes in place of a value in a masked field. */
|
|
26
27
|
readonly hash?: ((value: string) => string) | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* What a token the plugin wrote stands for, `email` or `linkedin`, or
|
|
30
|
+
* `null` when it cannot put the value back on a call to the vendor.
|
|
31
|
+
*/
|
|
32
|
+
readonly resolves?: ((token: string) => "email" | "linkedin" | null) | undefined;
|
|
33
|
+
/** The leads behind address tokens, read through the plugin and returned masked. */
|
|
34
|
+
readonly leadsByToken?: ((tokens: readonly string[], campaign: string | null) => ListAll<Lead>) | undefined;
|
|
27
35
|
}
|
|
28
36
|
/**
|
|
29
37
|
* Says why an insight cannot answer with these fields masked, for example
|
|
@@ -39,26 +47,12 @@ export type Lacks = (outbound: OutboundApi) => string | null;
|
|
|
39
47
|
export declare const maskingOf: (outbound: OutboundApi) => Masking | null;
|
|
40
48
|
/** Why the entry cannot answer under this instance's redact plugin, or `null`. */
|
|
41
49
|
export declare const maskedOutBy: (outbound: OutboundApi, entry: Pick<InsightEntry, "maskedOut">) => string | null;
|
|
50
|
+
export type { Cap } from "./tracked-reads.ts";
|
|
42
51
|
export interface InsightResult<Data> {
|
|
43
52
|
readonly insight: string;
|
|
44
53
|
readonly data: Data;
|
|
45
54
|
readonly meta: InsightMeta;
|
|
46
55
|
}
|
|
47
|
-
/**
|
|
48
|
-
* The cap a listing was read up to, for the note when it stops early:
|
|
49
|
-
* `{ input: "max_campaigns", max: 25, what: "campaigns" }` gives "Stopped at
|
|
50
|
-
* 25 campaigns (max_campaigns); more exist."
|
|
51
|
-
*/
|
|
52
|
-
export interface Cap {
|
|
53
|
-
/** The cap as the caller set it, not the room left under it. */
|
|
54
|
-
readonly max: number;
|
|
55
|
-
/** What was counted, in the plural: `campaigns`, `leads of a campaign`. */
|
|
56
|
-
readonly what: string;
|
|
57
|
-
/** The input that raises the cap, or `null` for a cap no input sets. */
|
|
58
|
-
readonly input: string | null;
|
|
59
|
-
}
|
|
60
|
-
/** The note for a listing that a cap stopped with more records left. */
|
|
61
|
-
export declare const capNote: (cap: Cap) => string;
|
|
62
56
|
/** What an insight reads through. Every helper records the read's cost and evidence. */
|
|
63
57
|
export interface InsightContext {
|
|
64
58
|
readonly outbound: OutboundApi;
|
|
@@ -78,6 +72,14 @@ export interface InsightContext {
|
|
|
78
72
|
readonly one: <Item>(item: WithMeta<Item>) => Item;
|
|
79
73
|
/** Records a stats read's cost and returns its rows. */
|
|
80
74
|
readonly rows: (stats: StatsResult) => readonly MetricRow[];
|
|
75
|
+
/**
|
|
76
|
+
* Reads each item, a few side by side, and returns the results in order.
|
|
77
|
+
* In an insight with `partialOnCap`, an item whose read a request cap
|
|
78
|
+
* stopped is left out, and the answer is marked incomplete with a note
|
|
79
|
+
* such as `Read 18 of 24 campaigns`; `what` names the items in the plural.
|
|
80
|
+
* Any other failure, and every failure elsewhere, is thrown.
|
|
81
|
+
*/
|
|
82
|
+
readonly each: <Item, Result>(items: readonly Item[], read: (item: Item) => Promise<Result>, what: string) => Promise<Result[]>;
|
|
81
83
|
/** Adds a note to the answer. The same note is kept once. */
|
|
82
84
|
readonly note: (text: string) => void;
|
|
83
85
|
/** Marks the answer as covering part of the data, with the reason as a note. */
|
|
@@ -154,6 +156,13 @@ export interface InsightSpec<Key extends string, Input, Data, Given = Input> {
|
|
|
154
156
|
readonly cost?: InsightCost<Input> | undefined;
|
|
155
157
|
/** The input that makes a run cheaper when lowered, such as `max_campaigns`. */
|
|
156
158
|
readonly scales?: (keyof Input & string) | undefined;
|
|
159
|
+
/**
|
|
160
|
+
* `true` when the answer still means something over part of the data: a
|
|
161
|
+
* request cap that stops `context.all` or `context.each` part way then
|
|
162
|
+
* keeps what they read, and the answer comes back with `complete: false`
|
|
163
|
+
* and a note naming the cap, instead of failing with `RateLimited`.
|
|
164
|
+
*/
|
|
165
|
+
readonly partialOnCap?: boolean | undefined;
|
|
157
166
|
readonly run: (context: InsightContext, input: Input) => Promise<Data>;
|
|
158
167
|
}
|
|
159
168
|
export interface InsightDefinition<Key extends string = string, Input = never, Data = Json, Given = Input> extends InsightEntry {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OutboundApi } from "../internal/outbound/api.ts";
|
|
2
|
+
interface FromTool {
|
|
3
|
+
readonly provider: string;
|
|
4
|
+
readonly workspaceId: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Whether the tool a record came from has conversations in no campaign. A
|
|
8
|
+
* combined instance holds each key only when every tool does, so each tool
|
|
9
|
+
* answers for its own records.
|
|
10
|
+
*/
|
|
11
|
+
export declare const inboxOf: (outbound: OutboundApi) => ((record: FromTool) => boolean);
|
|
12
|
+
export {};
|