outbound-sdk 0.11.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.
- package/dist/alerts/index.js +1 -1
- package/dist/budget/index.js +1 -1
- package/dist/cards/index.js +217 -100
- package/dist/cards/sender-tool-cards.d.ts +6 -0
- package/dist/chunks/{chunk-UAHYPASH.js → chunk-3LRIWQEJ.js} +2 -1
- package/dist/chunks/{chunk-UZLFZZ2U.js → chunk-6BSFR5SF.js} +14 -2
- package/dist/chunks/{chunk-FTK4JS65.js → chunk-BTIJ24UY.js} +89 -9
- package/dist/chunks/{chunk-OVTYA3IB.js → chunk-EAG5NIPM.js} +614 -206
- package/dist/chunks/{chunk-A7DLJUA6.js → chunk-FT6HMMMP.js} +3 -1
- package/dist/chunks/chunk-I7GBBHD2.js +80 -0
- package/dist/chunks/{chunk-UOJG4VYF.js → chunk-LD5OAELW.js} +1 -1
- package/dist/chunks/{chunk-KMQHXFIZ.js → chunk-LJNU4LAR.js} +2094 -1014
- package/dist/chunks/{chunk-POBAY3TI.js → chunk-NLYGMVXS.js} +30 -0
- package/dist/chunks/{chunk-V7JKTNRO.js → chunk-OE45PREW.js} +1 -1
- package/dist/chunks/{chunk-MEEJIIIA.js → chunk-OP2GL7ZT.js} +77 -8
- package/dist/chunks/{chunk-YFJ3OQZS.js → chunk-OPLXELPS.js} +5 -1
- package/dist/chunks/{chunk-CVLGFVDC.js → chunk-PDYE6CWS.js} +136 -64
- package/dist/chunks/{chunk-OMCDMELK.js → chunk-PUIHJFK4.js} +1 -1
- package/dist/chunks/{chunk-MPE6VLLY.js → chunk-UZ4YWUZ7.js} +1 -1
- package/dist/chunks/{tools-AVJ3XJ5A.js → tools-VCCH3JNL.js} +13 -6
- package/dist/cli/bin.js +11 -10
- package/dist/cli/config.d.ts +0 -2
- package/dist/cli/index.js +10 -9
- package/dist/cli/offered.d.ts +31 -2
- package/dist/cli/serve.d.ts +4 -2
- package/dist/combine/index.js +60 -4
- package/dist/emailbison/index.js +4 -4
- package/dist/fixtures/index.js +4 -4
- package/dist/heyreach/index.js +17 -6
- package/dist/identity/index.js +46 -11
- package/dist/identity/keys.d.ts +1 -1
- package/dist/index.js +8 -6
- package/dist/insights/capped.d.ts +14 -1
- package/dist/insights/define.d.ts +8 -6
- package/dist/insights/index.d.ts +1 -1
- package/dist/insights/index.js +12 -61
- package/dist/insights/inputs.generated.d.ts +91 -16
- package/dist/insights/ops/campaign-ranking.d.ts +8 -1
- package/dist/insights/ops/channel-mix.d.ts +8 -1
- package/dist/insights/ops/client-report.d.ts +28 -18
- package/dist/insights/ops/client-runway.d.ts +43 -0
- package/dist/insights/ops/index.d.ts +6 -1
- package/dist/insights/ops/period-comparison.d.ts +35 -2
- package/dist/insights/ops/pipeline-forecast.d.ts +14 -9
- package/dist/insights/ops/shared.d.ts +49 -2
- package/dist/insights/ops/tag-rollup.d.ts +8 -1
- package/dist/insights/people/coverage.d.ts +26 -0
- package/dist/insights/people/dropped-replies-check.d.ts +19 -3
- package/dist/insights/people/dropped-replies.d.ts +6 -2
- package/dist/insights/people/find.d.ts +5 -4
- package/dist/insights/people/hot-leads.d.ts +10 -1
- package/dist/insights/people/index.d.ts +26 -2
- package/dist/insights/people/lead-collisions.d.ts +18 -1
- package/dist/insights/people/person-summary.d.ts +15 -3
- package/dist/insights/people/suppression-check.d.ts +18 -1
- package/dist/insights/people/thread-context.d.ts +79 -0
- package/dist/insights/people/thread-contexts.d.ts +59 -0
- package/dist/insights/people/thread-read.d.ts +33 -0
- package/dist/insights/registry.d.ts +29 -3
- package/dist/insights/senders/domain-health.d.ts +1 -1
- package/dist/insights/senders/index.d.ts +1 -1
- package/dist/insights/senders/read.d.ts +9 -0
- package/dist/insights/tools.d.ts +35 -2
- package/dist/instantly/adapter.d.ts +3 -2
- package/dist/instantly/capabilities.d.ts +5 -0
- package/dist/instantly/index.js +255 -66
- package/dist/instantly/lead-ids.d.ts +11 -0
- package/dist/instantly/map-lead.d.ts +19 -2
- package/dist/instantly/senders.d.ts +3 -0
- package/dist/internal/adapter.d.ts +7 -0
- package/dist/internal/capabilities.d.ts +8 -0
- package/dist/internal/entities.d.ts +24 -1
- package/dist/internal/fields.d.ts +10 -0
- package/dist/internal/outbound/api.d.ts +12 -0
- package/dist/internal/outbound/operations-account.d.ts +4 -1
- package/dist/internal/outbound/outbound.d.ts +2 -1
- package/dist/internal/outbound/specs-account.d.ts +2 -1
- package/dist/internal/person.d.ts +32 -0
- package/dist/internal/records.d.ts +2 -2
- package/dist/internal/reply-people.d.ts +25 -7
- package/dist/internal/runway.d.ts +38 -5
- package/dist/internal/url.d.ts +2 -1
- package/dist/loader/index.js +1 -1
- package/dist/memory/data.d.ts +2 -1
- package/dist/memory/index.js +6 -4
- package/dist/redact/index.d.ts +1 -1
- package/dist/redact/index.js +62 -31
- package/dist/redact/plugin.d.ts +13 -11
- package/dist/redact/tokens.d.ts +18 -1
- package/dist/smartlead/index.js +21 -7
- package/dist/tools/account-tools.d.ts +0 -5
- package/dist/tools/ai-sdk.js +5 -3
- package/dist/tools/campaign-tools.d.ts +0 -4
- package/dist/tools/claude-agent.js +5 -3
- package/dist/tools/deliverability-check.d.ts +9 -0
- package/dist/tools/index.js +6 -4
- package/dist/tools/people-tools.d.ts +4 -1
- package/dist/tools/person-input.d.ts +17 -0
- package/dist/tools/registry.d.ts +8 -1
- package/dist/tools/sender-health.d.ts +8 -0
- package/dist/tools/sender-impact.d.ts +38 -0
- package/dist/tools/shared.d.ts +5 -0
- package/dist/webhooks/index.js +6 -6
- package/package.json +1 -1
- /package/dist/chunks/{chunk-5XLR6XVV.js → chunk-HNYJO6B4.js} +0 -0
|
@@ -76,6 +76,12 @@ var recipientMailProviderSchema = z.enum([
|
|
|
76
76
|
"microsoft",
|
|
77
77
|
"other"
|
|
78
78
|
]);
|
|
79
|
+
var meetingStatusSchema = z.enum([
|
|
80
|
+
"booked",
|
|
81
|
+
"completed",
|
|
82
|
+
"no_show",
|
|
83
|
+
"won"
|
|
84
|
+
]);
|
|
79
85
|
var senderSchema = z.object({
|
|
80
86
|
...base,
|
|
81
87
|
/** Lowercased mailbox address. `null` for a LinkedIn seat. */
|
|
@@ -148,6 +154,14 @@ var leadSchema = z.object({
|
|
|
148
154
|
interestCategory: replyCategorySchema.nullable(),
|
|
149
155
|
lastName: z.string().nullable(),
|
|
150
156
|
linkedinUrl: z.string().nullable(),
|
|
157
|
+
/**
|
|
158
|
+
* The meeting the vendor records for the lead, from its own status field,
|
|
159
|
+
* never from a label's wording. `null` when it records none. Where
|
|
160
|
+
* `fields.lead.meeting` is `false` the vendor records no meetings at all,
|
|
161
|
+
* so `null` says nothing. Optional, so a lead built or stored before the
|
|
162
|
+
* field existed still matches the schema.
|
|
163
|
+
*/
|
|
164
|
+
meeting: meetingStatusSchema.nullable().optional(),
|
|
151
165
|
/** Where the lead is, in the vendor's own words. */
|
|
152
166
|
location: z.string().nullable(),
|
|
153
167
|
phone: z.string().nullable(),
|
|
@@ -181,12 +195,27 @@ var messageFields = {
|
|
|
181
195
|
bodyText: z.string().nullable(),
|
|
182
196
|
campaignRef: z.string().nullable(),
|
|
183
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
|
+
*/
|
|
184
207
|
leadRef: z.string().nullable(),
|
|
185
208
|
senderRef: z.string().nullable(),
|
|
186
209
|
sentAt: isoDateTime,
|
|
187
210
|
stepIndex: z.number().int().nonnegative().nullable(),
|
|
188
211
|
subject: z.string().nullable(),
|
|
189
212
|
threadId: z.string().nullable(),
|
|
213
|
+
/**
|
|
214
|
+
* A link that opens this conversation in the vendor's app, built only from
|
|
215
|
+
* a URL scheme the vendor documents or that was verified live. `null` when
|
|
216
|
+
* the vendor has none; absent from adapters that predate it.
|
|
217
|
+
*/
|
|
218
|
+
url: z.url().nullable().optional(),
|
|
190
219
|
variantKey: z.string().nullable()
|
|
191
220
|
};
|
|
192
221
|
var autoSourceSchema = z.enum(["rule", "vendor"]);
|
|
@@ -402,6 +431,7 @@ export {
|
|
|
402
431
|
senderStatusSchema,
|
|
403
432
|
mailProviderSchema,
|
|
404
433
|
recipientMailProviderSchema,
|
|
434
|
+
meetingStatusSchema,
|
|
405
435
|
senderSchema,
|
|
406
436
|
leadStatusSchema,
|
|
407
437
|
leadProgressSchema,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
senderHealthSchema,
|
|
19
19
|
tagSchema,
|
|
20
20
|
webhookSubscriptionSchema
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-FT6HMMMP.js";
|
|
22
22
|
import {
|
|
23
23
|
plural
|
|
24
24
|
} from "./chunk-PTZO4QXR.js";
|
|
@@ -31,13 +31,13 @@ import {
|
|
|
31
31
|
senderSchema,
|
|
32
32
|
sequenceSchema,
|
|
33
33
|
workspaceSchema
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-NLYGMVXS.js";
|
|
35
|
+
import {
|
|
36
|
+
buildUrl
|
|
37
|
+
} from "./chunk-OPLXELPS.js";
|
|
35
38
|
import {
|
|
36
39
|
sourceIdFor
|
|
37
40
|
} from "./chunk-HXB2IOJJ.js";
|
|
38
|
-
import {
|
|
39
|
-
buildUrl
|
|
40
|
-
} from "./chunk-YFJ3OQZS.js";
|
|
41
41
|
import {
|
|
42
42
|
sha256Hex
|
|
43
43
|
} from "./chunk-KVAG5GM2.js";
|
|
@@ -1140,6 +1140,31 @@ var healthGet = (core) => ({
|
|
|
1140
1140
|
toOperation: (id) => ({ id, kind: "senders.health" }),
|
|
1141
1141
|
what: "Health for sender"
|
|
1142
1142
|
});
|
|
1143
|
+
var healthList = (core) => ({
|
|
1144
|
+
action: "senders.healthList",
|
|
1145
|
+
takes: { campaignId: true },
|
|
1146
|
+
keyOf: (item) => item.senderRef,
|
|
1147
|
+
prepare: (filters) => {
|
|
1148
|
+
requireCapability(
|
|
1149
|
+
core.gate,
|
|
1150
|
+
"senders.healthList",
|
|
1151
|
+
"Listing every sender's health"
|
|
1152
|
+
);
|
|
1153
|
+
if (filters.campaignId !== void 0) {
|
|
1154
|
+
requireCapability(
|
|
1155
|
+
core.gate,
|
|
1156
|
+
"senders.byCampaign",
|
|
1157
|
+
"Listing a campaign's senders"
|
|
1158
|
+
);
|
|
1159
|
+
}
|
|
1160
|
+
return { campaignId: filters.campaignId };
|
|
1161
|
+
},
|
|
1162
|
+
schema: senderHealthSchema,
|
|
1163
|
+
toOperation: (filters, page) => ({
|
|
1164
|
+
kind: "senders.healthList",
|
|
1165
|
+
query: { ...filters, ...page }
|
|
1166
|
+
})
|
|
1167
|
+
});
|
|
1143
1168
|
var subsequenceList = (core) => ({
|
|
1144
1169
|
action: "sequence.subsequences",
|
|
1145
1170
|
takes: { campaignId: true },
|
|
@@ -1617,6 +1642,21 @@ var SCOPE_CAPABILITY = {
|
|
|
1617
1642
|
step: "stats.byStep",
|
|
1618
1643
|
workspace: "stats.workspace"
|
|
1619
1644
|
};
|
|
1645
|
+
var sendersOf = (options) => {
|
|
1646
|
+
if (options.scopeIds === void 0) {
|
|
1647
|
+
return void 0;
|
|
1648
|
+
}
|
|
1649
|
+
if (options.scope !== "sender" || options.scopeId !== void 0) {
|
|
1650
|
+
throw new OutboundError(
|
|
1651
|
+
"Invalid",
|
|
1652
|
+
"scopeIds is for the sender scope, in place of scopeId"
|
|
1653
|
+
);
|
|
1654
|
+
}
|
|
1655
|
+
if (options.scopeIds.length === 0) {
|
|
1656
|
+
throw new OutboundError("Invalid", "scopeIds needs at least one sender");
|
|
1657
|
+
}
|
|
1658
|
+
return options.scopeIds.map((id) => assertId(id, "Sender"));
|
|
1659
|
+
};
|
|
1620
1660
|
var readStats = async (core, options = {}) => {
|
|
1621
1661
|
const scope = options.scope ?? "workspace";
|
|
1622
1662
|
const by = options.by ?? "total";
|
|
@@ -1625,8 +1665,9 @@ var readStats = async (core, options = {}) => {
|
|
|
1625
1665
|
if (from !== void 0 && to !== void 0 && from > to) {
|
|
1626
1666
|
throw new OutboundError("Invalid", "from must not be after to");
|
|
1627
1667
|
}
|
|
1668
|
+
const scopeIds = sendersOf(options);
|
|
1628
1669
|
const everyCampaign = scope === "campaign" && options.scopeId === void 0;
|
|
1629
|
-
if (scope !== "workspace" && options.scopeId === void 0 && !everyCampaign) {
|
|
1670
|
+
if (scope !== "workspace" && options.scopeId === void 0 && scopeIds === void 0 && !everyCampaign) {
|
|
1630
1671
|
throw new OutboundError(
|
|
1631
1672
|
"Invalid",
|
|
1632
1673
|
`stats for the ${scope} scope need a scopeId`
|
|
@@ -1637,6 +1678,13 @@ var readStats = async (core, options = {}) => {
|
|
|
1637
1678
|
everyCampaign ? "stats.allCampaigns" : SCOPE_CAPABILITY[scope],
|
|
1638
1679
|
everyCampaign ? "Reading stats for every campaign in one call" : `Reading stats for the ${scope} scope`
|
|
1639
1680
|
);
|
|
1681
|
+
if (scopeIds !== void 0) {
|
|
1682
|
+
requireCapability(
|
|
1683
|
+
core.gate,
|
|
1684
|
+
"stats.bySenders",
|
|
1685
|
+
"Reading stats for several senders in one call"
|
|
1686
|
+
);
|
|
1687
|
+
}
|
|
1640
1688
|
if (by === "day") {
|
|
1641
1689
|
requireCapability(core.gate, "stats.byDay", "Reading stats by day");
|
|
1642
1690
|
}
|
|
@@ -1644,7 +1692,7 @@ var readStats = async (core, options = {}) => {
|
|
|
1644
1692
|
const output2 = await core.run(
|
|
1645
1693
|
{
|
|
1646
1694
|
kind: "stats",
|
|
1647
|
-
query: { by, from, scope, scopeId: options.scopeId, to }
|
|
1695
|
+
query: { by, from, scope, scopeId: options.scopeId, scopeIds, to }
|
|
1648
1696
|
},
|
|
1649
1697
|
infoFor(core, state)
|
|
1650
1698
|
);
|
|
@@ -1933,6 +1981,7 @@ var ACCOUNT_KINDS = /* @__PURE__ */ new Set([
|
|
|
1933
1981
|
"lists.list",
|
|
1934
1982
|
"placementTests.list",
|
|
1935
1983
|
"senders.health",
|
|
1984
|
+
"senders.healthList",
|
|
1936
1985
|
"sequence.subsequences",
|
|
1937
1986
|
"tags.list",
|
|
1938
1987
|
"webhooks.get",
|
|
@@ -2015,6 +2064,20 @@ var dispatchAccount = async (target, operation) => {
|
|
|
2015
2064
|
}
|
|
2016
2065
|
return output(await adapter.listPlacementTests(operation.query, ctx));
|
|
2017
2066
|
}
|
|
2067
|
+
case "senders.healthList": {
|
|
2068
|
+
if (adapter.listSenderHealth === void 0) {
|
|
2069
|
+
throw unsupported(adapter, operation.kind);
|
|
2070
|
+
}
|
|
2071
|
+
return output(
|
|
2072
|
+
await adapter.listSenderHealth(
|
|
2073
|
+
{
|
|
2074
|
+
...operation.query,
|
|
2075
|
+
campaignId: optionalId(adapter, operation.query.campaignId)
|
|
2076
|
+
},
|
|
2077
|
+
ctx
|
|
2078
|
+
)
|
|
2079
|
+
);
|
|
2080
|
+
}
|
|
2018
2081
|
case "tags.list": {
|
|
2019
2082
|
if (adapter.listTags === void 0) {
|
|
2020
2083
|
throw unsupported(adapter, operation.kind);
|
|
@@ -2156,7 +2219,11 @@ var stats = async (target, query) => {
|
|
|
2156
2219
|
throw unsupported(adapter, "stats");
|
|
2157
2220
|
}
|
|
2158
2221
|
const rows = await adapter.stats(
|
|
2159
|
-
{
|
|
2222
|
+
{
|
|
2223
|
+
...query,
|
|
2224
|
+
scopeId: optionalId(adapter, query.scopeId),
|
|
2225
|
+
scopeIds: query.scopeIds === void 0 ? void 0 : [...new Set(query.scopeIds.map((id) => idFor(adapter, id)))]
|
|
2226
|
+
},
|
|
2160
2227
|
ctx
|
|
2161
2228
|
);
|
|
2162
2229
|
const derived = rows.some((row) => row.evidence !== "exact");
|
|
@@ -2411,6 +2478,7 @@ var Outbound = class _Outbound {
|
|
|
2411
2478
|
#layers;
|
|
2412
2479
|
campaigns;
|
|
2413
2480
|
senders;
|
|
2481
|
+
senderHealth;
|
|
2414
2482
|
leads;
|
|
2415
2483
|
messages;
|
|
2416
2484
|
replies;
|
|
@@ -2463,6 +2531,7 @@ var Outbound = class _Outbound {
|
|
|
2463
2531
|
senderList(this.#core),
|
|
2464
2532
|
senderGet(this.#core)
|
|
2465
2533
|
);
|
|
2534
|
+
this.senderHealth = makeReadCollection(this.#core, healthList(this.#core));
|
|
2466
2535
|
this.leads = makeCollection(
|
|
2467
2536
|
this.#core,
|
|
2468
2537
|
leadList(this.#core),
|
|
@@ -4,7 +4,11 @@ var buildUrl = (baseUrl, path, query = {}) => {
|
|
|
4
4
|
`${baseUrl.replace(/\/+$/u, "")}/${path.replace(/^\/+/u, "")}`
|
|
5
5
|
);
|
|
6
6
|
for (const [key, value] of Object.entries(query)) {
|
|
7
|
-
if (value
|
|
7
|
+
if (Array.isArray(value)) {
|
|
8
|
+
for (const item of value) {
|
|
9
|
+
url.searchParams.append(key, item);
|
|
10
|
+
}
|
|
11
|
+
} else if (value !== void 0 && value !== null) {
|
|
8
12
|
url.searchParams.set(key, String(value));
|
|
9
13
|
}
|
|
10
14
|
}
|
|
@@ -5,17 +5,17 @@ import {
|
|
|
5
5
|
describeReplyCounts,
|
|
6
6
|
leftOutReason,
|
|
7
7
|
repliesByPerson
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-EAG5NIPM.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveCampaign,
|
|
11
11
|
resolveList
|
|
12
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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(
|
|
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
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
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
|
|
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
|
|
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
|
|
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);
|
|
@@ -665,7 +739,7 @@ var COMMAND_TABLE = {
|
|
|
665
739
|
},
|
|
666
740
|
person: {
|
|
667
741
|
flags: ["card", "limit", "slack"],
|
|
668
|
-
help: "person <email or
|
|
742
|
+
help: "person <email, LinkedIn URL or lead ref> [--limit N] [--card | --slack] one person's campaigns across every tool; a lead ref is taken as another command printed it",
|
|
669
743
|
// The person_summary insight, with its input taken from the arguments.
|
|
670
744
|
run: (outbound, input) => runInsight(outbound, {
|
|
671
745
|
...input,
|
|
@@ -673,7 +747,11 @@ var COMMAND_TABLE = {
|
|
|
673
747
|
...input.flags,
|
|
674
748
|
input: JSON.stringify({
|
|
675
749
|
max_campaigns: count(input, "limit", 20),
|
|
676
|
-
person: required(
|
|
750
|
+
person: required(
|
|
751
|
+
input,
|
|
752
|
+
0,
|
|
753
|
+
"an email address, a LinkedIn URL or a lead ref"
|
|
754
|
+
)
|
|
677
755
|
})
|
|
678
756
|
},
|
|
679
757
|
positionals: ["person_summary"]
|
|
@@ -762,16 +840,11 @@ var COMMAND_TABLE = {
|
|
|
762
840
|
help: "tool <name> [--input JSON] [--card | --slack] without --input, a tool that needs input fails with what it takes (exit 2)",
|
|
763
841
|
run: async (outbound, input) => {
|
|
764
842
|
const name = required(input, 0, "a tool name");
|
|
765
|
-
const
|
|
843
|
+
const catalogued = await offeredTools(outbound, input.flags);
|
|
844
|
+
const offered = catalogued.tools;
|
|
766
845
|
const tool = offered.find((candidate) => candidate.name === name);
|
|
767
846
|
if (tool === void 0) {
|
|
768
|
-
|
|
769
|
-
const why = leftOutReason(outbound, name) ?? insightLeftOutReason(outbound, name);
|
|
770
|
-
if (why !== void 0) {
|
|
771
|
-
throw new OutboundError("Unsupported", why, {
|
|
772
|
-
provider: outbound.provider
|
|
773
|
-
});
|
|
774
|
-
}
|
|
847
|
+
refuseLeftOut(outbound, catalogued, name);
|
|
775
848
|
throw new OutboundError(
|
|
776
849
|
"Invalid",
|
|
777
850
|
`Unknown tool "${name}".${didYouMean(
|
|
@@ -800,8 +873,11 @@ var COMMAND_TABLE = {
|
|
|
800
873
|
flags: [],
|
|
801
874
|
help: "tools",
|
|
802
875
|
run: async (outbound, input) => {
|
|
803
|
-
const offered = await offeredTools(
|
|
804
|
-
|
|
876
|
+
const { leftOut, tools: offered } = await offeredTools(
|
|
877
|
+
outbound,
|
|
878
|
+
input.flags
|
|
879
|
+
);
|
|
880
|
+
return listedWith(asJson(offered.map(describeTool)), leftOut);
|
|
805
881
|
}
|
|
806
882
|
},
|
|
807
883
|
webhooks: {
|
|
@@ -1232,15 +1308,17 @@ var describePlugins = (outbound) => {
|
|
|
1232
1308
|
return `Plugins on: ${names.join(", ")}.${masked}`;
|
|
1233
1309
|
};
|
|
1234
1310
|
var describeLeftOut = (outbound, leftOut) => {
|
|
1235
|
-
const
|
|
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.`;
|
|
1236
1317
|
if (names.length === 0) {
|
|
1237
|
-
return
|
|
1238
|
-
}
|
|
1239
|
-
if (!outbound.plugins.some((plugin) => plugin.name === "redact")) {
|
|
1240
|
-
return ` Left out of this server: ${names.join(", ")}. A call to one returns the reason.`;
|
|
1318
|
+
return elsewhere;
|
|
1241
1319
|
}
|
|
1242
1320
|
const native = names.includes("vendor_read") ? " (vendor_read returns unmasked vendor payloads)" : "";
|
|
1243
|
-
return
|
|
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.`;
|
|
1244
1322
|
};
|
|
1245
1323
|
var hasRequestBudget = (value) => "requestBudget" in value && typeof value.requestBudget === "object" && value.requestBudget !== null && "reset" in value.requestBudget && typeof value.requestBudget.reset === "function";
|
|
1246
1324
|
var budgetOf = (outbound) => hasRequestBudget(outbound) ? outbound.requestBudget : void 0;
|
|
@@ -1398,38 +1476,32 @@ var namedTools = (given) => {
|
|
|
1398
1476
|
return new Set(names);
|
|
1399
1477
|
};
|
|
1400
1478
|
var serve = async (outbound, io, unmasked, wanted, caps) => {
|
|
1401
|
-
const {
|
|
1402
|
-
|
|
1403
|
-
|
|
1479
|
+
const { leftOut, offered, tools, turnOn } = await catalog(
|
|
1480
|
+
outbound,
|
|
1481
|
+
caps,
|
|
1482
|
+
unmasked,
|
|
1483
|
+
wanted
|
|
1404
1484
|
);
|
|
1405
|
-
const here = offered(outbound);
|
|
1406
|
-
const masked = (unmasked === void 0 ? [] : offered(unmasked)).filter(
|
|
1407
|
-
(name) => !here.includes(name)
|
|
1408
|
-
);
|
|
1409
|
-
const known = [...here, ...masked];
|
|
1410
1485
|
for (const name of wanted ?? []) {
|
|
1411
|
-
|
|
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)) {
|
|
1412
1493
|
throw new OutboundError(
|
|
1413
1494
|
"Invalid",
|
|
1414
|
-
`--tools: "${name}" is not a tool this server can offer.${didYouMean(name,
|
|
1495
|
+
`--tools: "${name}" is not a tool this server can offer.${didYouMean(name, [...offered, ...Object.keys(leftOut)])} Run "outbound tools" to list them`
|
|
1415
1496
|
);
|
|
1416
1497
|
}
|
|
1417
1498
|
}
|
|
1418
|
-
const keeps = (name) => wanted === void 0 || wanted.has(name);
|
|
1419
|
-
const leftOut = Object.fromEntries(
|
|
1420
|
-
masked.filter(keeps).map((name) => [
|
|
1421
|
-
name,
|
|
1422
|
-
`${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.`
|
|
1423
|
-
])
|
|
1424
|
-
);
|
|
1425
1499
|
const server = createMcpServer(outbound, {
|
|
1426
|
-
//
|
|
1427
|
-
extra:
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
leftOut,
|
|
1432
|
-
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: [],
|
|
1433
1505
|
throttled: io.throttled,
|
|
1434
1506
|
version: packageVersion()
|
|
1435
1507
|
});
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
INSIGHT_TOOL_CEILING,
|
|
3
3
|
insightLeftOutReason,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
insightPlacement,
|
|
5
|
+
insightTools,
|
|
6
|
+
membersOf,
|
|
7
|
+
runPlaced
|
|
8
|
+
} from "./chunk-LJNU4LAR.js";
|
|
9
|
+
import "./chunk-BTIJ24UY.js";
|
|
7
10
|
import "./chunk-4PA526S7.js";
|
|
11
|
+
import "./chunk-I7GBBHD2.js";
|
|
8
12
|
import "./chunk-HZCTYL22.js";
|
|
9
13
|
import "./chunk-HPNGSG5E.js";
|
|
10
14
|
import "./chunk-PTZO4QXR.js";
|
|
11
15
|
import "./chunk-FALWG5U3.js";
|
|
12
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-NLYGMVXS.js";
|
|
13
17
|
import "./chunk-CPACP4YD.js";
|
|
14
18
|
import "./chunk-QGRZDTX4.js";
|
|
19
|
+
import "./chunk-OPLXELPS.js";
|
|
15
20
|
import "./chunk-HXB2IOJJ.js";
|
|
16
|
-
import "./chunk-YFJ3OQZS.js";
|
|
17
21
|
import "./chunk-XYHM4KHC.js";
|
|
18
22
|
import "./chunk-45TXPJW7.js";
|
|
19
23
|
export {
|
|
20
24
|
INSIGHT_TOOL_CEILING,
|
|
21
25
|
insightLeftOutReason,
|
|
22
|
-
|
|
26
|
+
insightPlacement,
|
|
27
|
+
insightTools,
|
|
28
|
+
membersOf,
|
|
29
|
+
runPlaced
|
|
23
30
|
};
|
package/dist/cli/bin.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "../chunks/chunk-
|
|
3
|
-
import "../chunks/chunk-
|
|
4
|
-
import "../chunks/chunk-
|
|
5
|
-
import "../chunks/chunk-
|
|
6
|
-
import "../chunks/chunk-
|
|
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
|
+
import "../chunks/chunk-I7GBBHD2.js";
|
|
8
9
|
import "../chunks/chunk-HZCTYL22.js";
|
|
9
|
-
import "../chunks/chunk-
|
|
10
|
+
import "../chunks/chunk-OP2GL7ZT.js";
|
|
10
11
|
import "../chunks/chunk-4O2HRTTI.js";
|
|
11
12
|
import "../chunks/chunk-HPNGSG5E.js";
|
|
12
|
-
import "../chunks/chunk-
|
|
13
|
+
import "../chunks/chunk-FT6HMMMP.js";
|
|
13
14
|
import "../chunks/chunk-PTZO4QXR.js";
|
|
14
|
-
import "../chunks/chunk-
|
|
15
|
+
import "../chunks/chunk-NLYGMVXS.js";
|
|
15
16
|
import "../chunks/chunk-CPACP4YD.js";
|
|
16
17
|
import "../chunks/chunk-QGRZDTX4.js";
|
|
18
|
+
import "../chunks/chunk-OPLXELPS.js";
|
|
17
19
|
import "../chunks/chunk-HXB2IOJJ.js";
|
|
18
|
-
import "../chunks/chunk-YFJ3OQZS.js";
|
|
19
20
|
import "../chunks/chunk-KVAG5GM2.js";
|
|
20
|
-
import "../chunks/chunk-
|
|
21
|
+
import "../chunks/chunk-HNYJO6B4.js";
|
|
21
22
|
import "../chunks/chunk-NFWWA7MI.js";
|
|
22
23
|
import "../chunks/chunk-XYHM4KHC.js";
|
|
23
24
|
import "../chunks/chunk-45TXPJW7.js";
|
package/dist/cli/config.d.ts
CHANGED
|
@@ -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
|
/**
|