sproutkit-code 1.16.1 → 1.17.1

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.
Files changed (2) hide show
  1. package/dist/index.js +53 -19
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -231,6 +231,30 @@ var require_db = __commonJS({
231
231
  } catch {
232
232
  }
233
233
  db2.exec(`
234
+ CREATE TABLE IF NOT EXISTS chat_threads (
235
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
236
+ title TEXT,
237
+ session_id TEXT,
238
+ created_at TEXT DEFAULT (datetime('now')),
239
+ updated_at TEXT DEFAULT (datetime('now'))
240
+ );
241
+ `);
242
+ try {
243
+ db2.exec("ALTER TABLE chat_messages ADD COLUMN thread_id INTEGER");
244
+ } catch {
245
+ }
246
+ {
247
+ const orphan = db2.get("SELECT COUNT(*) AS n, MIN(created_at) AS first, MAX(created_at) AS last FROM chat_messages WHERE thread_id IS NULL", []);
248
+ if (orphan && orphan.n > 0) {
249
+ db2.run("INSERT INTO chat_threads (title, created_at, updated_at) VALUES ('Earlier chat', ?, ?)", [
250
+ orphan.first ?? (/* @__PURE__ */ new Date()).toISOString(),
251
+ orphan.last ?? (/* @__PURE__ */ new Date()).toISOString()
252
+ ]);
253
+ const t = db2.get("SELECT MAX(id) AS id FROM chat_threads", []);
254
+ db2.run("UPDATE chat_messages SET thread_id = ? WHERE thread_id IS NULL", [t.id]);
255
+ }
256
+ }
257
+ db2.exec(`
234
258
  CREATE TABLE IF NOT EXISTS invoices (
235
259
  id INTEGER PRIMARY KEY AUTOINCREMENT,
236
260
  number TEXT UNIQUE NOT NULL,
@@ -98510,6 +98534,34 @@ Want it live on your own domain?`;
98510
98534
  let harvested = 0;
98511
98535
  for (const r of eligible) {
98512
98536
  const isBookingLead = r.lead_kind === "no_booking";
98537
+ const e164 = toE164(r.phone ?? "");
98538
+ if (!r.email && smtp && (preferEmail || !e164)) {
98539
+ ctx.emitProgress?.({
98540
+ channel: "outreach:progress",
98541
+ payload: { msg: `Looking up an email for ${r.name}\u2026` }
98542
+ });
98543
+ const found = await (0, email_harvest_1.harvestEmail)({
98544
+ name: r.name,
98545
+ address: r.address ?? "",
98546
+ city: r.city ?? "",
98547
+ apiKey: getDecryptedSetting("anthropic_key")
98548
+ });
98549
+ if (found) {
98550
+ db2.run("UPDATE leads SET email = ? WHERE id = ?", [found, r.id]);
98551
+ r.email = found;
98552
+ harvested++;
98553
+ }
98554
+ }
98555
+ if (!(smtp && r.email && (preferEmail || !e164)) && !(e164 && linkChannel)) {
98556
+ prepared.push({
98557
+ id: r.id,
98558
+ name: r.name,
98559
+ via: "none",
98560
+ email: r.email ?? void 0,
98561
+ message: ""
98562
+ });
98563
+ continue;
98564
+ }
98513
98565
  let videoUrl = r.pitch_video_url ?? null;
98514
98566
  if (!isBookingLead && !videoUrl && r.site_url && getDecryptedSetting("pitch_auto") === "1") {
98515
98567
  ctx.emitProgress?.({ channel: "outreach:progress", payload: { msg: `Recording a video for ${r.name}\u2026` } });
@@ -98532,24 +98584,6 @@ Want it live on your own domain?`;
98532
98584
  }
98533
98585
  }
98534
98586
  const message = (0, pitch_text_1.withVideo)((0, pitch_text_1.withReceptionist)((isBookingLead ? bookingTemplate : template).replace(/\{name\}/g, r.name).replace(/\{site_url\}/g, (isBookingLead ? r.booking_url : r.site_url) ?? r.site_url ?? "").replace(/\{booking_how\}/g, r.booking_platform || "WhatsApp/phone"), isBookingLead ? null : receptionistUrl, isBookingLead ? null : receptionistLine, r.name, !!r.front_desk_chat), isBookingLead ? null : videoUrl);
98535
- const e164 = toE164(r.phone ?? "");
98536
- if (!r.email && smtp && (preferEmail || !e164)) {
98537
- ctx.emitProgress?.({
98538
- channel: "outreach:progress",
98539
- payload: { msg: `Looking up an email for ${r.name}\u2026` }
98540
- });
98541
- const found = await (0, email_harvest_1.harvestEmail)({
98542
- name: r.name,
98543
- address: r.address ?? "",
98544
- city: r.city ?? "",
98545
- apiKey: getDecryptedSetting("anthropic_key")
98546
- });
98547
- if (found) {
98548
- db2.run("UPDATE leads SET email = ? WHERE id = ?", [found, r.id]);
98549
- r.email = found;
98550
- harvested++;
98551
- }
98552
- }
98553
98587
  if (r.email && (0, guardrails_1.isSuppressed)(r.email)) {
98554
98588
  prepared.push({ id: r.id, name: r.name, via: "none", email: r.email, message, emailError: "On the do-not-contact list" });
98555
98589
  continue;
@@ -100542,7 +100576,7 @@ var require_package2 = __commonJS({
100542
100576
  "package.json"(exports2, module2) {
100543
100577
  module2.exports = {
100544
100578
  name: "sproutkit-code",
100545
- version: "1.16.1",
100579
+ version: "1.17.1",
100546
100580
  description: "Sproutkit in your terminal \u2014 find leads, build sites, run outreach, all via chat.",
100547
100581
  bin: {
100548
100582
  sproutkit: "./dist/index.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sproutkit-code",
3
- "version": "1.16.1",
3
+ "version": "1.17.1",
4
4
  "description": "Sproutkit in your terminal — find leads, build sites, run outreach, all via chat.",
5
5
  "bin": {
6
6
  "sproutkit": "./dist/index.js"