@dench.com/cli 3.11.12-staging.525 → 3.11.14-staging.532
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/lib/campaign-agent.ts +22 -6
- package/package.json +1 -1
package/lib/campaign-agent.ts
CHANGED
|
@@ -1509,6 +1509,7 @@ async function draft(ctx: Context) {
|
|
|
1509
1509
|
// The draft starts with the caller's own accounts. A channel with none of
|
|
1510
1510
|
// their own takes the accounts teammates shared with them, named, rather
|
|
1511
1511
|
// than leaving a campaign that can't launch.
|
|
1512
|
+
let usesShared = false;
|
|
1512
1513
|
if (
|
|
1513
1514
|
campaign.status === "draft" &&
|
|
1514
1515
|
!senderPools.emailMailboxAccountIds &&
|
|
@@ -1524,6 +1525,7 @@ async function draft(ctx: Context) {
|
|
|
1524
1525
|
try {
|
|
1525
1526
|
await invoke(ctx, "campaigns.update", { sequenceId, ...fill });
|
|
1526
1527
|
campaign = await readCampaign(ctx, sequenceId);
|
|
1528
|
+
usesShared = true;
|
|
1527
1529
|
for (const line of [
|
|
1528
1530
|
...(fill.emailMailboxAccountIds
|
|
1529
1531
|
? sharedSenderNotes(senders.mailboxes, "email")
|
|
@@ -1551,7 +1553,7 @@ async function draft(ctx: Context) {
|
|
|
1551
1553
|
!senderPools.linkedinAccountIds
|
|
1552
1554
|
)
|
|
1553
1555
|
notice(
|
|
1554
|
-
|
|
1556
|
+
`${usesShared ? "Sending from" : "Sending from every connected account you own:"} ${plural(emailMailboxAccountIds.length, "mailbox", "mailboxes")} and ${plural(linkedinAccountIds.length, "LinkedIn account", "LinkedIn accounts")}${usesShared ? ", including the shared ones above" : ""}. Choose with --email-mailboxes / --linkedin-accounts (ids from dench campaign accounts).`,
|
|
1555
1557
|
);
|
|
1556
1558
|
const sendSchedules = campaign.sendSchedules ?? [];
|
|
1557
1559
|
const windows = sendSchedules
|
|
@@ -1609,6 +1611,7 @@ type RunDraft = {
|
|
|
1609
1611
|
workflowSteps?: unknown[];
|
|
1610
1612
|
sending?: Record<string, unknown>;
|
|
1611
1613
|
approvalMode?: "auto" | "manual";
|
|
1614
|
+
brief?: Record<string, unknown>;
|
|
1612
1615
|
emails?: { finding: number; missing: number };
|
|
1613
1616
|
name?: string;
|
|
1614
1617
|
};
|
|
@@ -1736,6 +1739,20 @@ async function builderRun(ctx: Context, input: Record<string, unknown>) {
|
|
|
1736
1739
|
};
|
|
1737
1740
|
if (!saved?.draftId) throw new Error("The campaign setup wasn't saved");
|
|
1738
1741
|
draftId = saved.draftId;
|
|
1742
|
+
// Saved before the billable build: a build that fails or outlasts --wait
|
|
1743
|
+
// is resumed with --draft alone, which must read these back, not defaults.
|
|
1744
|
+
if (Object.keys(outreach).length)
|
|
1745
|
+
await invoke(ctx, "campaigns.builder.outreach", {
|
|
1746
|
+
draftId,
|
|
1747
|
+
...(outreach.brief ? { brief: outreach.brief } : {}),
|
|
1748
|
+
...(outreach.sending ? { sending: outreach.sending } : {}),
|
|
1749
|
+
...(outreach.approvalMode
|
|
1750
|
+
? { approvalMode: outreach.approvalMode }
|
|
1751
|
+
: {}),
|
|
1752
|
+
...(Array.isArray(outreach.steps)
|
|
1753
|
+
? { steps: outreach.steps, outreachMode: "manual" }
|
|
1754
|
+
: {}),
|
|
1755
|
+
});
|
|
1739
1756
|
} else if (Object.keys(setup).length) {
|
|
1740
1757
|
throw new Error(
|
|
1741
1758
|
"--draft resumes a saved setup as it is; change it with dench campaign builder save first",
|
|
@@ -1786,12 +1803,11 @@ async function builderRun(ctx: Context, input: Record<string, unknown>) {
|
|
|
1786
1803
|
const hasSteps = Boolean(
|
|
1787
1804
|
draft.draftSteps?.length || draft.workflowSteps?.length,
|
|
1788
1805
|
);
|
|
1789
|
-
|
|
1806
|
+
// A resumed run has no input: the brief saved before the build stands in.
|
|
1807
|
+
const brief = outreach.brief ?? draft.brief;
|
|
1808
|
+
if (!Array.isArray(outreach.steps) && !hasSteps && brief) {
|
|
1790
1809
|
notice("Writing the sequence from the brief (AI credits apply).");
|
|
1791
|
-
await invoke(ctx, "campaigns.builder.sequence", {
|
|
1792
|
-
draftId,
|
|
1793
|
-
brief: outreach.brief,
|
|
1794
|
-
});
|
|
1810
|
+
await invoke(ctx, "campaigns.builder.sequence", { draftId, brief });
|
|
1795
1811
|
} else if (!Array.isArray(outreach.steps) && !hasSteps) {
|
|
1796
1812
|
notes.push(
|
|
1797
1813
|
"No brief or steps were given, so it uses Dench's default signal sequence. Pass a brief (goal, helpWith, tone, channels) to write one for this audience.",
|