@dench.com/cli 3.11.13-staging.526 → 3.11.14
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 +19 -5
- package/package.json +1 -1
package/lib/campaign-agent.ts
CHANGED
|
@@ -1611,6 +1611,7 @@ type RunDraft = {
|
|
|
1611
1611
|
workflowSteps?: unknown[];
|
|
1612
1612
|
sending?: Record<string, unknown>;
|
|
1613
1613
|
approvalMode?: "auto" | "manual";
|
|
1614
|
+
brief?: Record<string, unknown>;
|
|
1614
1615
|
emails?: { finding: number; missing: number };
|
|
1615
1616
|
name?: string;
|
|
1616
1617
|
};
|
|
@@ -1738,6 +1739,20 @@ async function builderRun(ctx: Context, input: Record<string, unknown>) {
|
|
|
1738
1739
|
};
|
|
1739
1740
|
if (!saved?.draftId) throw new Error("The campaign setup wasn't saved");
|
|
1740
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
|
+
});
|
|
1741
1756
|
} else if (Object.keys(setup).length) {
|
|
1742
1757
|
throw new Error(
|
|
1743
1758
|
"--draft resumes a saved setup as it is; change it with dench campaign builder save first",
|
|
@@ -1788,12 +1803,11 @@ async function builderRun(ctx: Context, input: Record<string, unknown>) {
|
|
|
1788
1803
|
const hasSteps = Boolean(
|
|
1789
1804
|
draft.draftSteps?.length || draft.workflowSteps?.length,
|
|
1790
1805
|
);
|
|
1791
|
-
|
|
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) {
|
|
1792
1809
|
notice("Writing the sequence from the brief (AI credits apply).");
|
|
1793
|
-
await invoke(ctx, "campaigns.builder.sequence", {
|
|
1794
|
-
draftId,
|
|
1795
|
-
brief: outreach.brief,
|
|
1796
|
-
});
|
|
1810
|
+
await invoke(ctx, "campaigns.builder.sequence", { draftId, brief });
|
|
1797
1811
|
} else if (!Array.isArray(outreach.steps) && !hasSteps) {
|
|
1798
1812
|
notes.push(
|
|
1799
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.",
|