outbound-sdk 0.2.1 → 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.
- package/dist/alerts/index.js +50 -19
- package/dist/alerts/plugin.d.ts +20 -3
- package/dist/audit/index.js +2 -2
- package/dist/benchmarks/index.js +5 -5
- package/dist/budget/index.d.ts +3 -2
- package/dist/budget/index.js +11 -10
- package/dist/cards/content.d.ts +6 -1
- package/dist/cards/format.d.ts +17 -2
- package/dist/cards/index.d.ts +1 -1
- package/dist/cards/index.js +297 -132
- package/dist/cards/parts.d.ts +9 -2
- package/dist/cards/render.d.ts +20 -3
- package/dist/chunks/{chunk-U2D34ARZ.js → chunk-2D42TQFU.js} +3 -3
- package/dist/chunks/chunk-4PA526S7.js +17 -0
- package/dist/chunks/{chunk-6CVZOUHB.js → chunk-5CFO3CXG.js} +24 -0
- package/dist/chunks/{chunk-XNFESPZH.js → chunk-5FVKRIEJ.js} +168 -31
- package/dist/chunks/{chunk-P3IJBJUI.js → chunk-7LNJJ2RO.js} +200 -57
- package/dist/chunks/{chunk-XC6CZP73.js → chunk-7ZDS6SZD.js} +7 -1
- package/dist/chunks/{chunk-SBIZDCRY.js → chunk-A6WVOCA4.js} +4 -4
- package/dist/chunks/{chunk-VQSCHOBV.js → chunk-BLCJHP5H.js} +11 -4
- package/dist/chunks/{chunk-4PSO6JEK.js → chunk-BOWXGMN3.js} +6 -21
- package/dist/chunks/{chunk-DJ2IUQEU.js → chunk-C4LS2HNV.js} +3 -3
- package/dist/chunks/{chunk-AFU5E5QB.js → chunk-E6DSDCPI.js} +98 -69
- package/dist/chunks/{chunk-IPUYZD4O.js → chunk-GFDNRWR3.js} +1 -1
- package/dist/chunks/{chunk-PURHK3JU.js → chunk-IZFTTMJP.js} +4 -4
- package/dist/chunks/{chunk-E7JHLNLG.js → chunk-J7DDZ4C2.js} +15 -2
- package/dist/chunks/{chunk-FKH5N47I.js → chunk-K4USHN4C.js} +1 -1
- package/dist/chunks/chunk-LVQUSKEX.js +17 -0
- package/dist/chunks/{chunk-YOTW5ESM.js → chunk-PQSTQKRD.js} +2 -2
- package/dist/chunks/chunk-PTZO4QXR.js +15 -0
- package/dist/chunks/{chunk-LVYG7XZJ.js → chunk-QAKJ76HB.js} +1 -1
- package/dist/chunks/chunk-QGRZDTX4.js +26 -0
- package/dist/chunks/{chunk-R3Y56YVF.js → chunk-Y5RAJ6PZ.js} +2 -2
- package/dist/chunks/{chunk-RCZ7ZZFU.js → chunk-ZFVHM5JI.js} +3 -3
- package/dist/chunks/{chunk-UAT3JSJZ.js → chunk-ZOAG2C6V.js} +2 -2
- package/dist/cli/bin.js +17 -13
- package/dist/cli/commands.d.ts +11 -0
- package/dist/cli/index.js +17 -13
- package/dist/cli/mcp.d.ts +5 -0
- package/dist/clients/index.d.ts +1 -1
- package/dist/clients/index.js +35 -10
- package/dist/clients/plugin.d.ts +9 -2
- package/dist/combine/index.js +7 -6
- package/dist/exporter/index.d.ts +5 -2
- package/dist/exporter/index.js +2 -2
- package/dist/failover/index.js +3 -3
- package/dist/fixtures/index.js +5 -4
- package/dist/heyreach/client.d.ts +2 -0
- package/dist/heyreach/index.js +71 -39
- package/dist/heyreach/map.d.ts +5 -2
- package/dist/identity/index.js +33 -17
- package/dist/identity/plugin.d.ts +2 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -10
- package/dist/insights/campaign.d.ts +3 -0
- package/dist/insights/capped.d.ts +29 -0
- package/dist/insights/copy/copy-audit.d.ts +2 -0
- package/dist/insights/copy/copy-reuse.d.ts +27 -3
- package/dist/insights/copy/index.d.ts +8 -8
- package/dist/insights/copy/reply-timing.d.ts +8 -0
- package/dist/insights/copy/reuse-base.d.ts +32 -0
- package/dist/insights/copy/shared.d.ts +39 -15
- package/dist/insights/copy/step-funnel.d.ts +16 -5
- package/dist/insights/copy/variant-test.d.ts +19 -8
- package/dist/insights/define.d.ts +56 -2
- package/dist/insights/fields.d.ts +16 -0
- package/dist/insights/index.d.ts +2 -1
- package/dist/insights/index.js +1494 -730
- package/dist/insights/inputs.generated.d.ts +951 -0
- package/dist/insights/ops/campaign-diagnosis.d.ts +3 -1
- package/dist/insights/ops/campaign-ranking.d.ts +12 -4
- package/dist/insights/ops/channel-mix.d.ts +2 -1
- package/dist/insights/ops/client-report.d.ts +18 -5
- package/dist/insights/ops/index.d.ts +6 -2
- package/dist/insights/ops/period-comparison.d.ts +14 -3
- package/dist/insights/ops/pipeline-forecast.d.ts +14 -4
- package/dist/insights/ops/shared.d.ts +29 -24
- package/dist/insights/ops/tag-rollup.d.ts +2 -1
- package/dist/insights/people/account-summary.d.ts +13 -0
- package/dist/insights/people/dropped-replies.d.ts +8 -0
- package/dist/insights/people/find.d.ts +7 -1
- package/dist/insights/people/hot-leads.d.ts +16 -1
- package/dist/insights/people/person-summary.d.ts +6 -0
- package/dist/insights/people/read.d.ts +26 -10
- package/dist/insights/people/suppression-check.d.ts +11 -2
- package/dist/insights/plugin.d.ts +7 -5
- package/dist/insights/ref.d.ts +6 -0
- package/dist/insights/registry.d.ts +28 -16
- package/dist/insights/senders/bounce-watch.d.ts +25 -8
- package/dist/insights/senders/capacity-sends.d.ts +22 -0
- package/dist/insights/senders/domain-health.d.ts +10 -4
- package/dist/insights/senders/index.d.ts +14 -6
- package/dist/insights/senders/read.d.ts +15 -14
- package/dist/insights/senders/sender-capacity.d.ts +5 -13
- package/dist/insights/senders/sender-load.d.ts +2 -0
- package/dist/insights/stats.d.ts +8 -0
- package/dist/insights/tools.d.ts +3 -2
- package/dist/instantly/client.d.ts +2 -0
- package/dist/instantly/index.js +44 -29
- package/dist/instantly/map.d.ts +6 -2
- package/dist/internal/engine/request.d.ts +5 -0
- package/dist/internal/entities.d.ts +3 -20
- package/dist/internal/errors.d.ts +44 -0
- package/dist/internal/fields.d.ts +1 -1
- package/dist/internal/json.d.ts +9 -2
- package/dist/internal/lists.d.ts +24 -0
- package/dist/internal/numbers.d.ts +8 -0
- package/dist/internal/outbound/collections.d.ts +4 -0
- package/dist/internal/outbound/create.d.ts +24 -3
- package/dist/internal/outbound/outbound.d.ts +13 -1
- package/dist/internal/outbound/validate.d.ts +4 -0
- package/dist/internal/outbound/walker.d.ts +3 -2
- package/dist/internal/plural.d.ts +12 -0
- package/dist/internal/renamed.d.ts +28 -0
- package/dist/internal/vocabulary.d.ts +20 -0
- package/dist/loader/index.js +5 -5
- package/dist/memory/adapter.d.ts +7 -0
- package/dist/memory/demo-stats.d.ts +3 -0
- package/dist/memory/demo.d.ts +14 -3
- package/dist/memory/index.d.ts +1 -0
- package/dist/memory/index.js +200 -95
- package/dist/providers/index.d.ts +72 -0
- package/dist/providers/index.js +3 -1
- package/dist/reconcile/index.js +5 -4
- package/dist/redact/index.js +10 -4
- package/dist/redact/plugin.d.ts +7 -0
- package/dist/smartlead/index.js +102 -49
- package/dist/smartlead/shared.d.ts +13 -0
- package/dist/sync/index.js +2 -2
- package/dist/tools/ai-sdk.js +8 -6
- package/dist/tools/campaign-tools.d.ts +1 -1
- package/dist/tools/claude-agent.js +8 -6
- package/dist/tools/index.js +9 -7
- package/dist/tools/input-problem.d.ts +8 -0
- package/dist/tools/registry.d.ts +7 -2
- package/dist/tools/shared.d.ts +7 -0
- package/dist/tracing/index.js +2 -2
- package/dist/webhooks/index.js +10 -9
- package/package.json +1 -1
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createTools
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-E6DSDCPI.js";
|
|
4
|
+
import {
|
|
5
|
+
plural
|
|
6
|
+
} from "./chunk-4PA526S7.js";
|
|
4
7
|
import {
|
|
5
8
|
createOutbound
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-5FVKRIEJ.js";
|
|
7
10
|
import {
|
|
8
11
|
fromEnv
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZFVHM5JI.js";
|
|
10
13
|
import {
|
|
11
14
|
providers
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-7ZDS6SZD.js";
|
|
13
16
|
import {
|
|
14
17
|
campaignStatusSchema,
|
|
15
18
|
replyCategorySchema
|
|
16
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-QGRZDTX4.js";
|
|
17
20
|
import {
|
|
18
21
|
OutboundError
|
|
19
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-J7DDZ4C2.js";
|
|
20
23
|
import {
|
|
21
24
|
field,
|
|
22
25
|
isJsonObject,
|
|
@@ -24,7 +27,7 @@ import {
|
|
|
24
27
|
isString,
|
|
25
28
|
parseJson,
|
|
26
29
|
toJson
|
|
27
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-BLCJHP5H.js";
|
|
28
31
|
|
|
29
32
|
// src/cli/index.ts
|
|
30
33
|
import { parseArgs } from "node:util";
|
|
@@ -80,7 +83,15 @@ var fieldExceptions = (outbound) => Object.fromEntries(
|
|
|
80
83
|
return stated.length === 0 ? [] : [[record, Object.fromEntries(stated)]];
|
|
81
84
|
})
|
|
82
85
|
);
|
|
83
|
-
var listing = async (walk) =>
|
|
86
|
+
var listing = async (walk, input, one, many) => {
|
|
87
|
+
const items = await walk.toArray();
|
|
88
|
+
if (walk.truncated) {
|
|
89
|
+
input.note(
|
|
90
|
+
`Stopped at ${plural(items.length, one, many)}; more exist. Pass --limit to read more.`
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
return asJson(items);
|
|
94
|
+
};
|
|
84
95
|
var wantsCard = (input) => input.flags.slack === true || input.flags.card === true;
|
|
85
96
|
var drawn = async (name, result2, input) => {
|
|
86
97
|
if (!wantsCard(input)) {
|
|
@@ -104,46 +115,91 @@ var runInsight = async (outbound, input) => {
|
|
|
104
115
|
const [asTool] = wantsCard(input) ? insightTools(outbound, { only: [name] }) : [];
|
|
105
116
|
return asTool === void 0 ? asJson(await runInsightByName(outbound, name, insightInput)) : drawn(name, await asTool.call(insightInput), input);
|
|
106
117
|
};
|
|
118
|
+
var GLOBAL_FLAGS = [
|
|
119
|
+
"cache",
|
|
120
|
+
"compact",
|
|
121
|
+
"config",
|
|
122
|
+
"help",
|
|
123
|
+
"max-requests",
|
|
124
|
+
"no-redact",
|
|
125
|
+
"provider",
|
|
126
|
+
"redact"
|
|
127
|
+
];
|
|
128
|
+
var checkFlags = (name, flags, given) => {
|
|
129
|
+
const stray = given.find(
|
|
130
|
+
(flag) => !GLOBAL_FLAGS.includes(flag) && !flags.includes(flag)
|
|
131
|
+
);
|
|
132
|
+
if (stray !== void 0) {
|
|
133
|
+
throw new OutboundError(
|
|
134
|
+
"Invalid",
|
|
135
|
+
`--${stray} is not an option of ${name}`
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
var SECTIONS = ["sequence", "settings", "stats", "subsequences"];
|
|
107
140
|
var COMMAND_TABLE = {
|
|
108
141
|
blocklist: {
|
|
142
|
+
flags: ["limit"],
|
|
109
143
|
help: "blocklist [--limit N]",
|
|
110
|
-
run: (outbound, input) => listing(
|
|
144
|
+
run: (outbound, input) => listing(
|
|
145
|
+
outbound.blocklist.listAll({ max: count(input, "limit", 50) }),
|
|
146
|
+
input,
|
|
147
|
+
"entry",
|
|
148
|
+
"entries"
|
|
149
|
+
)
|
|
111
150
|
},
|
|
112
151
|
campaign: {
|
|
152
|
+
flags: [
|
|
153
|
+
"by",
|
|
154
|
+
"from",
|
|
155
|
+
"sequence",
|
|
156
|
+
"settings",
|
|
157
|
+
"stats",
|
|
158
|
+
"subsequences",
|
|
159
|
+
"to"
|
|
160
|
+
],
|
|
113
161
|
help: "campaign <id> [--stats] [--sequence] [--subsequences] [--settings] [--from YYYY-MM-DD] [--to YYYY-MM-DD] [--by day|total]",
|
|
114
162
|
run: async (outbound, input) => {
|
|
115
163
|
const campaign = outbound.campaign(required(input, 0, "a campaign id"));
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
if (input.flags.settings === true) {
|
|
123
|
-
return asJson(await campaign.settings());
|
|
124
|
-
}
|
|
125
|
-
if (input.flags.stats === true) {
|
|
126
|
-
return asJson(
|
|
164
|
+
const by = choice(input, "by", BY);
|
|
165
|
+
const read = {
|
|
166
|
+
sequence: async () => asJson(await campaign.sequence()),
|
|
167
|
+
settings: async () => asJson(await campaign.settings()),
|
|
168
|
+
stats: async () => asJson(
|
|
127
169
|
await campaign.stats({
|
|
128
|
-
by
|
|
170
|
+
by,
|
|
129
171
|
from: text(input, "from"),
|
|
130
172
|
to: text(input, "to")
|
|
131
173
|
})
|
|
132
|
-
)
|
|
174
|
+
),
|
|
175
|
+
subsequences: () => listing(campaign.subsequences.listAll(), input, "subsequence")
|
|
176
|
+
};
|
|
177
|
+
const wanted = SECTIONS.filter(
|
|
178
|
+
(section) => input.flags[section] === true
|
|
179
|
+
);
|
|
180
|
+
if (wanted.length === 0) {
|
|
181
|
+
return asJson(await campaign.get());
|
|
133
182
|
}
|
|
134
|
-
|
|
183
|
+
const answers = await Promise.all(
|
|
184
|
+
wanted.map(async (section) => [section, await read[section]()])
|
|
185
|
+
);
|
|
186
|
+
return answers.length === 1 ? answers[0]?.[1] ?? null : Object.fromEntries(answers);
|
|
135
187
|
}
|
|
136
188
|
},
|
|
137
189
|
campaigns: {
|
|
190
|
+
flags: ["limit", "status"],
|
|
138
191
|
help: "campaigns [--status active|paused|draft|completed|archived] [--limit N]",
|
|
139
192
|
run: (outbound, input) => listing(
|
|
140
193
|
outbound.campaigns.listAll({
|
|
141
194
|
max: count(input, "limit", 50),
|
|
142
195
|
status: choice(input, "status", campaignStatusSchema.options)
|
|
143
|
-
})
|
|
196
|
+
}),
|
|
197
|
+
input,
|
|
198
|
+
"campaign"
|
|
144
199
|
)
|
|
145
200
|
},
|
|
146
201
|
capabilities: {
|
|
202
|
+
flags: [],
|
|
147
203
|
help: "capabilities",
|
|
148
204
|
run: (outbound) => Promise.resolve({
|
|
149
205
|
capabilities: { ...outbound.capabilities },
|
|
@@ -155,32 +211,44 @@ var COMMAND_TABLE = {
|
|
|
155
211
|
})
|
|
156
212
|
},
|
|
157
213
|
health: {
|
|
214
|
+
flags: [],
|
|
158
215
|
help: "health <sender id>",
|
|
159
216
|
run: async (outbound, input) => asJson(await outbound.sender(required(input, 0, "a sender id")).health())
|
|
160
217
|
},
|
|
161
218
|
insight: {
|
|
219
|
+
flags: ["card", "input", "slack"],
|
|
162
220
|
help: "insight [name] [--input JSON] [--card | --slack] computed answers; no name lists them",
|
|
163
221
|
run: runInsight
|
|
164
222
|
},
|
|
165
223
|
leads: {
|
|
224
|
+
flags: ["campaign", "limit", "list"],
|
|
166
225
|
help: "leads [--campaign ID | --list ID] [--limit N]",
|
|
167
226
|
run: (outbound, input) => listing(
|
|
168
227
|
outbound.leads.listAll({
|
|
169
228
|
campaignId: text(input, "campaign"),
|
|
170
229
|
listId: text(input, "list"),
|
|
171
230
|
max: count(input, "limit", 50)
|
|
172
|
-
})
|
|
231
|
+
}),
|
|
232
|
+
input,
|
|
233
|
+
"lead"
|
|
173
234
|
)
|
|
174
235
|
},
|
|
175
236
|
lists: {
|
|
237
|
+
flags: ["limit"],
|
|
176
238
|
help: "lists [--limit N]",
|
|
177
|
-
run: (outbound, input) => listing(
|
|
239
|
+
run: (outbound, input) => listing(
|
|
240
|
+
outbound.lists.listAll({ max: count(input, "limit", 50) }),
|
|
241
|
+
input,
|
|
242
|
+
"list"
|
|
243
|
+
)
|
|
178
244
|
},
|
|
179
245
|
limits: {
|
|
246
|
+
flags: [],
|
|
180
247
|
help: "limits",
|
|
181
248
|
run: async (outbound) => asJson(await outbound.limits())
|
|
182
249
|
},
|
|
183
250
|
native: {
|
|
251
|
+
flags: ["input"],
|
|
184
252
|
help: "native [name] [--input JSON] the vendor's own reads; no name lists them",
|
|
185
253
|
run: async (outbound, input) => {
|
|
186
254
|
const [name] = input.positionals;
|
|
@@ -195,9 +263,11 @@ var COMMAND_TABLE = {
|
|
|
195
263
|
}
|
|
196
264
|
},
|
|
197
265
|
person: {
|
|
266
|
+
flags: ["card", "limit", "slack"],
|
|
198
267
|
help: "person <email or LinkedIn URL> [--limit N] [--card | --slack] one person's campaigns across every tool",
|
|
199
268
|
// The person_summary insight, with its input taken from the arguments.
|
|
200
269
|
run: (outbound, input) => runInsight(outbound, {
|
|
270
|
+
...input,
|
|
201
271
|
flags: {
|
|
202
272
|
...input.flags,
|
|
203
273
|
input: JSON.stringify({
|
|
@@ -209,6 +279,7 @@ var COMMAND_TABLE = {
|
|
|
209
279
|
})
|
|
210
280
|
},
|
|
211
281
|
replies: {
|
|
282
|
+
flags: ["bodies", "campaign", "category", "limit", "since"],
|
|
212
283
|
help: "replies [--campaign ID] [--category positive|negative|neutral|ooo|...] [--since ISO] [--limit N] [--bodies]",
|
|
213
284
|
run: (outbound, input) => listing(
|
|
214
285
|
outbound.replies.listAll({
|
|
@@ -217,14 +288,23 @@ var COMMAND_TABLE = {
|
|
|
217
288
|
include: input.flags.bodies === true ? ["body"] : void 0,
|
|
218
289
|
max: count(input, "limit", 50),
|
|
219
290
|
since: text(input, "since")
|
|
220
|
-
})
|
|
291
|
+
}),
|
|
292
|
+
input,
|
|
293
|
+
"reply",
|
|
294
|
+
"replies"
|
|
221
295
|
)
|
|
222
296
|
},
|
|
223
297
|
senders: {
|
|
298
|
+
flags: ["limit"],
|
|
224
299
|
help: "senders [--limit N]",
|
|
225
|
-
run: (outbound, input) => listing(
|
|
300
|
+
run: (outbound, input) => listing(
|
|
301
|
+
outbound.senders.listAll({ max: count(input, "limit", 50) }),
|
|
302
|
+
input,
|
|
303
|
+
"sender"
|
|
304
|
+
)
|
|
226
305
|
},
|
|
227
306
|
stats: {
|
|
307
|
+
flags: ["by", "from", "to"],
|
|
228
308
|
help: "stats [--from YYYY-MM-DD] [--to YYYY-MM-DD] [--by day|total]",
|
|
229
309
|
run: async (outbound, input) => asJson(
|
|
230
310
|
await outbound.stats({
|
|
@@ -235,10 +315,16 @@ var COMMAND_TABLE = {
|
|
|
235
315
|
)
|
|
236
316
|
},
|
|
237
317
|
tags: {
|
|
318
|
+
flags: ["limit"],
|
|
238
319
|
help: "tags [--limit N]",
|
|
239
|
-
run: (outbound, input) => listing(
|
|
320
|
+
run: (outbound, input) => listing(
|
|
321
|
+
outbound.tags.listAll({ max: count(input, "limit", 50) }),
|
|
322
|
+
input,
|
|
323
|
+
"tag"
|
|
324
|
+
)
|
|
240
325
|
},
|
|
241
326
|
thread: {
|
|
327
|
+
flags: ["bodies"],
|
|
242
328
|
help: "thread <id> [--bodies]",
|
|
243
329
|
run: async (outbound, input) => asJson(
|
|
244
330
|
await outbound.thread(required(input, 0, "a thread id")).messages({
|
|
@@ -247,6 +333,7 @@ var COMMAND_TABLE = {
|
|
|
247
333
|
)
|
|
248
334
|
},
|
|
249
335
|
tool: {
|
|
336
|
+
flags: ["card", "input", "slack"],
|
|
250
337
|
help: "tool <name> [--input JSON] [--card | --slack]",
|
|
251
338
|
run: async (outbound, input) => {
|
|
252
339
|
const name = required(input, 0, "a tool name");
|
|
@@ -266,6 +353,7 @@ var COMMAND_TABLE = {
|
|
|
266
353
|
}
|
|
267
354
|
},
|
|
268
355
|
tools: {
|
|
356
|
+
flags: [],
|
|
269
357
|
help: "tools",
|
|
270
358
|
run: async (outbound) => {
|
|
271
359
|
const offered = await offeredTools(outbound);
|
|
@@ -276,12 +364,15 @@ var COMMAND_TABLE = {
|
|
|
276
364
|
}
|
|
277
365
|
},
|
|
278
366
|
webhooks: {
|
|
367
|
+
flags: ["campaign", "limit"],
|
|
279
368
|
help: "webhooks [--campaign ID] [--limit N]",
|
|
280
369
|
run: (outbound, input) => listing(
|
|
281
370
|
outbound.webhooks.listAll({
|
|
282
371
|
campaignId: text(input, "campaign"),
|
|
283
372
|
max: count(input, "limit", 50)
|
|
284
|
-
})
|
|
373
|
+
}),
|
|
374
|
+
input,
|
|
375
|
+
"webhook"
|
|
285
376
|
)
|
|
286
377
|
}
|
|
287
378
|
};
|
|
@@ -299,15 +390,7 @@ var listProviders = () => providers.map((provider) => ({
|
|
|
299
390
|
name: provider.name,
|
|
300
391
|
note: provider.note
|
|
301
392
|
}));
|
|
302
|
-
var
|
|
303
|
-
"outbound: read-only access to outbound sending tools",
|
|
304
|
-
"",
|
|
305
|
-
"Usage: outbound <command> [options]",
|
|
306
|
-
"",
|
|
307
|
-
" providers",
|
|
308
|
-
...[...COMMANDS.values()].map((command) => ` ${command.help}`),
|
|
309
|
-
" mcp start a local MCP server on stdio (redact is on)",
|
|
310
|
-
"",
|
|
393
|
+
var GLOBAL_HELP = [
|
|
311
394
|
"Options:",
|
|
312
395
|
" --provider <id> the adapter to use, or all for every provider whose key is set (default: OUTBOUND_SDK_PROVIDER)",
|
|
313
396
|
" --compact print JSON on one line",
|
|
@@ -318,7 +401,19 @@ var helpText = () => [
|
|
|
318
401
|
" --max-requests <n> the most vendor requests one command, or one MCP tool call, may make",
|
|
319
402
|
"",
|
|
320
403
|
"Each adapter reads its own key from the environment, for example INSTANTLY_API_KEY."
|
|
404
|
+
];
|
|
405
|
+
var helpText = () => [
|
|
406
|
+
"outbound: read-only access to outbound sending tools",
|
|
407
|
+
"",
|
|
408
|
+
"Usage: outbound <command> [options]",
|
|
409
|
+
"",
|
|
410
|
+
" providers",
|
|
411
|
+
...[...COMMANDS.values()].map((command) => ` ${command.help}`),
|
|
412
|
+
" mcp start a local MCP server on stdio (redact is on)",
|
|
413
|
+
"",
|
|
414
|
+
...GLOBAL_HELP
|
|
321
415
|
].join("\n");
|
|
416
|
+
var commandHelp = (command) => [`Usage: outbound ${command.help}`, "", ...GLOBAL_HELP].join("\n");
|
|
322
417
|
|
|
323
418
|
// src/cli/config.ts
|
|
324
419
|
import path from "node:path";
|
|
@@ -463,10 +558,11 @@ var createMcpServer = (outbound, options = {}) => {
|
|
|
463
558
|
const name = field(params, "name");
|
|
464
559
|
const tool = isString(name) ? byName.get(name) : void 0;
|
|
465
560
|
if (tool === void 0) {
|
|
561
|
+
const why = isString(name) ? options.leftOut?.[name] : void 0;
|
|
466
562
|
return failure(
|
|
467
563
|
id,
|
|
468
564
|
INVALID_PARAMS,
|
|
469
|
-
`Unknown tool: ${isString(name) ? name : "(none)"}`
|
|
565
|
+
why ?? `Unknown tool: ${isString(name) ? name : "(none)"}`
|
|
470
566
|
);
|
|
471
567
|
}
|
|
472
568
|
budget?.reset();
|
|
@@ -586,10 +682,21 @@ var OPTIONS = {
|
|
|
586
682
|
subsequences: { type: "boolean" },
|
|
587
683
|
to: { type: "string" }
|
|
588
684
|
};
|
|
589
|
-
var serve = async (outbound, io) => {
|
|
685
|
+
var serve = async (outbound, io, unmasked) => {
|
|
590
686
|
const { insightTools } = await import("../insights/index.js");
|
|
687
|
+
const offered = (instance) => createTools(instance, { extra: insightTools(instance) }).map(
|
|
688
|
+
(tool) => tool.name
|
|
689
|
+
);
|
|
690
|
+
const here = new Set(offered(outbound));
|
|
691
|
+
const leftOut = Object.fromEntries(
|
|
692
|
+
(unmasked === void 0 ? [] : offered(unmasked)).filter((name) => !here.has(name)).map((name) => [
|
|
693
|
+
name,
|
|
694
|
+
`${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.`
|
|
695
|
+
])
|
|
696
|
+
);
|
|
591
697
|
const server = createMcpServer(outbound, {
|
|
592
698
|
extra: insightTools(outbound),
|
|
699
|
+
leftOut,
|
|
593
700
|
version: packageVersion()
|
|
594
701
|
});
|
|
595
702
|
await serveStdio(server, { input: io.stdin?.() ?? [], write: io.stdout });
|
|
@@ -597,39 +704,75 @@ var serve = async (outbound, io) => {
|
|
|
597
704
|
var print = (io, value, compact) => {
|
|
598
705
|
io.stdout(compact ? JSON.stringify(value) : JSON.stringify(value, null, 2));
|
|
599
706
|
};
|
|
707
|
+
var parseStrict = (argv) => parseArgs({ allowPositionals: true, args: [...argv], options: OPTIONS });
|
|
708
|
+
var helpFor = (name, asked) => {
|
|
709
|
+
const command = name === void 0 ? void 0 : COMMANDS.get(name);
|
|
710
|
+
if (name === void 0 || name === "help" || asked && !command) {
|
|
711
|
+
return helpText();
|
|
712
|
+
}
|
|
713
|
+
return asked && command ? commandHelp(command) : void 0;
|
|
714
|
+
};
|
|
715
|
+
var parse = (argv) => {
|
|
716
|
+
const loose = parseArgs({
|
|
717
|
+
allowPositionals: true,
|
|
718
|
+
args: [...argv],
|
|
719
|
+
options: OPTIONS,
|
|
720
|
+
strict: false,
|
|
721
|
+
tokens: true
|
|
722
|
+
});
|
|
723
|
+
const [name] = loose.positionals;
|
|
724
|
+
const command = name === void 0 ? void 0 : COMMANDS.get(name);
|
|
725
|
+
const named = name !== void 0 && name !== "help";
|
|
726
|
+
if (named && !command && !["mcp", "providers"].includes(name)) {
|
|
727
|
+
throw new OutboundError(
|
|
728
|
+
"Invalid",
|
|
729
|
+
`Unknown command "${name}". Run "outbound help"`
|
|
730
|
+
);
|
|
731
|
+
}
|
|
732
|
+
if (named) {
|
|
733
|
+
checkFlags(
|
|
734
|
+
name,
|
|
735
|
+
command?.flags ?? [],
|
|
736
|
+
loose.tokens.flatMap(
|
|
737
|
+
(token) => token.kind === "option" ? [token.name] : []
|
|
738
|
+
)
|
|
739
|
+
);
|
|
740
|
+
}
|
|
741
|
+
const { positionals, values } = parseStrict(argv);
|
|
742
|
+
return {
|
|
743
|
+
help: helpFor(name, values.help === true),
|
|
744
|
+
name,
|
|
745
|
+
rest: positionals.slice(1),
|
|
746
|
+
values
|
|
747
|
+
};
|
|
748
|
+
};
|
|
600
749
|
var run = async (argv, io) => {
|
|
601
750
|
try {
|
|
602
|
-
const {
|
|
603
|
-
allowPositionals: true,
|
|
604
|
-
args: [...argv],
|
|
605
|
-
options: OPTIONS
|
|
606
|
-
});
|
|
607
|
-
const [name, ...rest] = positionals;
|
|
751
|
+
const { help, name, rest, values } = parse(argv);
|
|
608
752
|
const compact = values.compact === true;
|
|
609
|
-
if (
|
|
610
|
-
io.stdout(
|
|
753
|
+
if (help !== void 0) {
|
|
754
|
+
io.stdout(help);
|
|
611
755
|
return 0;
|
|
612
756
|
}
|
|
613
757
|
if (name === "providers") {
|
|
614
758
|
print(io, listProviders(), compact);
|
|
615
759
|
return 0;
|
|
616
760
|
}
|
|
617
|
-
const command = name ===
|
|
618
|
-
if (name !== "mcp" && command === void 0) {
|
|
619
|
-
throw new OutboundError(
|
|
620
|
-
"Invalid",
|
|
621
|
-
`Unknown command "${name}". Run "outbound help"`
|
|
622
|
-
);
|
|
623
|
-
}
|
|
761
|
+
const command = name === void 0 ? void 0 : COMMANDS.get(name);
|
|
624
762
|
const adapter = io.adapter ?? await fromEnv({ provider: values.provider });
|
|
625
763
|
const plugins = await pluginsFor(values, command === void 0);
|
|
626
764
|
const outbound = createOutbound({ adapter, plugins });
|
|
627
765
|
if (command === void 0) {
|
|
628
|
-
|
|
766
|
+
const unmasked = plugins.some((plugin) => plugin.name === "redact") ? createOutbound({
|
|
767
|
+
adapter,
|
|
768
|
+
plugins: plugins.filter((plugin) => plugin.name !== "redact")
|
|
769
|
+
}) : void 0;
|
|
770
|
+
await serve(outbound, io, unmasked);
|
|
629
771
|
return 0;
|
|
630
772
|
}
|
|
631
773
|
const answer = await command.run(outbound, {
|
|
632
774
|
flags: values,
|
|
775
|
+
note: io.stderr,
|
|
633
776
|
positionals: rest
|
|
634
777
|
});
|
|
635
778
|
print(io, answer, compact);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/providers/index.ts
|
|
2
|
-
var
|
|
2
|
+
var CATALOG = [
|
|
3
3
|
{
|
|
4
4
|
channels: ["email"],
|
|
5
5
|
docsUrl: "https://developer.instantly.ai/",
|
|
@@ -70,11 +70,17 @@ var providers = [
|
|
|
70
70
|
note: "Holds data in memory. For tests and demos; there is no vendor behind it."
|
|
71
71
|
}
|
|
72
72
|
];
|
|
73
|
+
var providers = CATALOG;
|
|
74
|
+
var IDS = new Set(
|
|
75
|
+
providers.map((provider) => provider.id)
|
|
76
|
+
);
|
|
77
|
+
var isProviderId = (value) => typeof value === "string" && IDS.has(value);
|
|
73
78
|
var findProvider = (id) => providers.find((provider) => provider.id === id);
|
|
74
79
|
var PROVIDER_ENV = "OUTBOUND_SDK_PROVIDER";
|
|
75
80
|
|
|
76
81
|
export {
|
|
77
82
|
providers,
|
|
83
|
+
isProviderId,
|
|
78
84
|
findProvider,
|
|
79
85
|
PROVIDER_ENV
|
|
80
86
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fromOne,
|
|
3
3
|
variantKey
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-K4USHN4C.js";
|
|
5
5
|
import {
|
|
6
6
|
stableId
|
|
7
7
|
} from "./chunk-FHKSLCVW.js";
|
|
8
8
|
import {
|
|
9
9
|
eventData,
|
|
10
10
|
refTo
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-2D42TQFU.js";
|
|
12
12
|
import {
|
|
13
13
|
SCHEMA_VERSION
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-QGRZDTX4.js";
|
|
15
15
|
import {
|
|
16
16
|
emailAddress,
|
|
17
17
|
flag,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
isString,
|
|
20
20
|
text,
|
|
21
21
|
timestamp
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-BLCJHP5H.js";
|
|
23
23
|
|
|
24
24
|
// src/instantly/webhooks.ts
|
|
25
25
|
var EVENT_TYPES = /* @__PURE__ */ new Map([
|
|
@@ -67,13 +67,18 @@ var compactObject = (entries) => {
|
|
|
67
67
|
return result;
|
|
68
68
|
};
|
|
69
69
|
var toJson = (value) => parseJson(JSON.stringify(value) ?? "null") ?? null;
|
|
70
|
-
var
|
|
71
|
-
|
|
70
|
+
var jsonInput = (value) => {
|
|
71
|
+
try {
|
|
72
|
+
return toJson(value);
|
|
73
|
+
} catch {
|
|
72
74
|
return void 0;
|
|
73
75
|
}
|
|
74
|
-
const stray = Object.keys(input).find((key) => !known.includes(key));
|
|
75
|
-
return stray === void 0 ? void 0 : `"${stray}" is not an input. It takes: ${known.toSorted().join(", ") || "nothing"}`;
|
|
76
76
|
};
|
|
77
|
+
var strayKey = (known, given, noun = "an input") => {
|
|
78
|
+
const stray = given.find((key) => !known.includes(key));
|
|
79
|
+
return stray === void 0 ? void 0 : `"${stray}" is not ${noun}. It takes: ${known.toSorted().join(", ") || "nothing"}`;
|
|
80
|
+
};
|
|
81
|
+
var unknownKey = (known, input) => strayKey(known, isJsonObject(input) ? Object.keys(input) : []);
|
|
77
82
|
var withoutKeys = (value, secret) => {
|
|
78
83
|
if (isJsonArray(value)) {
|
|
79
84
|
return value.map((entry) => withoutKeys(entry, secret));
|
|
@@ -106,6 +111,8 @@ export {
|
|
|
106
111
|
stringMap,
|
|
107
112
|
compactObject,
|
|
108
113
|
toJson,
|
|
114
|
+
jsonInput,
|
|
115
|
+
strayKey,
|
|
109
116
|
unknownKey,
|
|
110
117
|
withoutKeys
|
|
111
118
|
};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SCHEMA_VERSION,
|
|
3
|
+
campaignStatusSchema,
|
|
4
|
+
replyCategorySchema
|
|
5
|
+
} from "./chunk-QGRZDTX4.js";
|
|
6
|
+
|
|
1
7
|
// src/internal/entities.ts
|
|
2
8
|
import { z } from "zod";
|
|
3
|
-
var SCHEMA_VERSION = 1;
|
|
4
9
|
var baseFields = {
|
|
5
10
|
provider: z.string().min(1),
|
|
6
11
|
raw: z.json(),
|
|
@@ -13,14 +18,6 @@ var base = baseFields;
|
|
|
13
18
|
var count = z.number().nonnegative().nullable();
|
|
14
19
|
var isoDateTime = z.iso.datetime({ offset: true }).nullable();
|
|
15
20
|
var channelSchema = z.enum(["email", "linkedin"]);
|
|
16
|
-
var campaignStatusSchema = z.enum([
|
|
17
|
-
"active",
|
|
18
|
-
"archived",
|
|
19
|
-
"completed",
|
|
20
|
-
"draft",
|
|
21
|
-
"paused",
|
|
22
|
-
"unknown"
|
|
23
|
-
]);
|
|
24
21
|
var campaignSchema = z.object({
|
|
25
22
|
...base,
|
|
26
23
|
channel: channelSchema,
|
|
@@ -92,15 +89,6 @@ var senderSchema = z.object({
|
|
|
92
89
|
score: z.number().nullable()
|
|
93
90
|
}).nullable()
|
|
94
91
|
});
|
|
95
|
-
var replyCategorySchema = z.enum([
|
|
96
|
-
"bounce",
|
|
97
|
-
"negative",
|
|
98
|
-
"neutral",
|
|
99
|
-
"ooo",
|
|
100
|
-
"positive",
|
|
101
|
-
"unknown",
|
|
102
|
-
"unsubscribe"
|
|
103
|
-
]);
|
|
104
92
|
var leadStatusSchema = z.enum([
|
|
105
93
|
"active",
|
|
106
94
|
"bounced",
|
|
@@ -330,18 +318,15 @@ var outboundEventSchema = z.object({
|
|
|
330
318
|
});
|
|
331
319
|
|
|
332
320
|
export {
|
|
333
|
-
SCHEMA_VERSION,
|
|
334
321
|
baseFields,
|
|
335
322
|
count,
|
|
336
323
|
isoDateTime,
|
|
337
324
|
channelSchema,
|
|
338
|
-
campaignStatusSchema,
|
|
339
325
|
campaignSchema,
|
|
340
326
|
sequenceSchema,
|
|
341
327
|
senderStatusSchema,
|
|
342
328
|
mailProviderSchema,
|
|
343
329
|
senderSchema,
|
|
344
|
-
replyCategorySchema,
|
|
345
330
|
leadStatusSchema,
|
|
346
331
|
leadProgressSchema,
|
|
347
332
|
leadSchema,
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
eventData,
|
|
6
6
|
refTo
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-2D42TQFU.js";
|
|
8
8
|
import {
|
|
9
9
|
SCHEMA_VERSION
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QGRZDTX4.js";
|
|
11
11
|
import {
|
|
12
12
|
compactObject,
|
|
13
13
|
emailAddress,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
objects,
|
|
20
20
|
text,
|
|
21
21
|
timestamp
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-BLCJHP5H.js";
|
|
23
23
|
|
|
24
24
|
// src/heyreach/webhooks.ts
|
|
25
25
|
var EVENT_TYPES = /* @__PURE__ */ new Map([
|