sproutkit-code 1.8.0 → 1.9.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 (3) hide show
  1. package/README.md +8 -4
  2. package/dist/index.js +1365 -868
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6,9 +6,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __esm = (fn, res) => function __init() {
10
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
11
+ };
9
12
  var __commonJS = (cb, mod) => function __require() {
10
13
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
14
  };
15
+ var __export = (target, all) => {
16
+ for (var name in all)
17
+ __defProp(target, name, { get: all[name], enumerable: true });
18
+ };
12
19
  var __copyProps = (to, from, except, desc) => {
13
20
  if (from && typeof from === "object" || typeof from === "function") {
14
21
  for (let key of __getOwnPropNames(from))
@@ -29,19 +36,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
36
  // ../../node_modules/electron/index.js
30
37
  var require_electron = __commonJS({
31
38
  "../../node_modules/electron/index.js"(exports2, module2) {
32
- var fs3 = require("fs");
33
- var path3 = require("path");
34
- var pathFile = path3.join(__dirname, "path.txt");
39
+ var fs4 = require("fs");
40
+ var path4 = require("path");
41
+ var pathFile = path4.join(__dirname, "path.txt");
35
42
  function getElectronPath() {
36
43
  let executablePath;
37
- if (fs3.existsSync(pathFile)) {
38
- executablePath = fs3.readFileSync(pathFile, "utf-8");
44
+ if (fs4.existsSync(pathFile)) {
45
+ executablePath = fs4.readFileSync(pathFile, "utf-8");
39
46
  }
40
47
  if (process.env.ELECTRON_OVERRIDE_DIST_PATH) {
41
- return path3.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath || "electron");
48
+ return path4.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath || "electron");
42
49
  }
43
50
  if (executablePath) {
44
- return path3.join(__dirname, "dist", executablePath);
51
+ return path4.join(__dirname, "dist", executablePath);
45
52
  } else {
46
53
  throw new Error("Electron failed to install correctly, please delete node_modules/electron and try installing again");
47
54
  }
@@ -59,6 +66,7 @@ var require_runtime = __commonJS({
59
66
  };
60
67
  Object.defineProperty(exports2, "__esModule", { value: true });
61
68
  exports2.userDataDir = userDataDir;
69
+ exports2.isSecretSetting = isSecretSetting;
62
70
  exports2.decryptSettingValue = decryptSettingValue;
63
71
  exports2.runningHeadless = runningHeadless;
64
72
  var path_1 = __importDefault(require("path"));
@@ -80,9 +88,21 @@ var require_runtime = __commonJS({
80
88
  }
81
89
  return process.env.SPROUTKIT_DATA_DIR || path_1.default.join(os_1.default.homedir(), ".sproutkit");
82
90
  }
91
+ var SECRET_SETTINGS = /* @__PURE__ */ new Set([
92
+ "anthropic_key",
93
+ "places_key",
94
+ "vercel_token",
95
+ "blob_token",
96
+ "resend_key",
97
+ "report_key",
98
+ "smtp_pass",
99
+ "imap_pass"
100
+ ]);
101
+ function isSecretSetting(key) {
102
+ return SECRET_SETTINGS.has(key);
103
+ }
83
104
  function decryptSettingValue(key, stored) {
84
- const isSecret = key.endsWith("_key") || key.endsWith("_token");
85
- if (!isSecret)
105
+ if (!isSecretSetting(key))
86
106
  return stored;
87
107
  if (!isHeadless && electronSafeStorage) {
88
108
  try {
@@ -107,6 +127,7 @@ var require_db = __commonJS({
107
127
  return mod && mod.__esModule ? mod : { "default": mod };
108
128
  };
109
129
  Object.defineProperty(exports2, "__esModule", { value: true });
130
+ exports2.databasePath = databasePath;
110
131
  exports2.initDatabase = initDatabase2;
111
132
  exports2.getDb = getDb2;
112
133
  var node_sqlite3_wasm_1 = require("node-sqlite3-wasm");
@@ -114,11 +135,14 @@ var require_db = __commonJS({
114
135
  var fs_1 = __importDefault(require("fs"));
115
136
  var runtime_1 = require_runtime();
116
137
  var db2;
138
+ function databasePath() {
139
+ return path_1.default.join((0, runtime_1.userDataDir)(), "data", "sproutio.db");
140
+ }
117
141
  function initDatabase2() {
118
142
  const dataDir = path_1.default.join((0, runtime_1.userDataDir)(), "data");
119
143
  if (!fs_1.default.existsSync(dataDir))
120
144
  fs_1.default.mkdirSync(dataDir, { recursive: true });
121
- db2 = new node_sqlite3_wasm_1.Database(path_1.default.join(dataDir, "sproutio.db"));
145
+ db2 = new node_sqlite3_wasm_1.Database(databasePath());
122
146
  db2.exec(`
123
147
  CREATE TABLE IF NOT EXISTS settings (
124
148
  key TEXT PRIMARY KEY,
@@ -269,6 +293,28 @@ var require_db = __commonJS({
269
293
  } catch {
270
294
  }
271
295
  }
296
+ for (const col of ["last_email_message_id TEXT", "last_reply_snippet TEXT"]) {
297
+ try {
298
+ db2.exec(`ALTER TABLE leads ADD COLUMN ${col}`);
299
+ } catch {
300
+ }
301
+ }
302
+ db2.exec(`
303
+ CREATE TABLE IF NOT EXISTS schedules (
304
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
305
+ name TEXT NOT NULL,
306
+ action TEXT NOT NULL,
307
+ cadence TEXT NOT NULL DEFAULT 'daily',
308
+ days TEXT,
309
+ at_hour INTEGER NOT NULL DEFAULT 9,
310
+ at_minute INTEGER NOT NULL DEFAULT 0,
311
+ enabled INTEGER NOT NULL DEFAULT 1,
312
+ max_items INTEGER NOT NULL DEFAULT 10,
313
+ last_run_at TEXT,
314
+ last_result TEXT,
315
+ created_at TEXT DEFAULT (datetime('now'))
316
+ );
317
+ `);
272
318
  }
273
319
  function getDb2() {
274
320
  return db2;
@@ -1064,14 +1110,14 @@ var require_url_state_machine = __commonJS({
1064
1110
  return url.replace(/\u0009|\u000A|\u000D/g, "");
1065
1111
  }
1066
1112
  function shortenPath(url) {
1067
- const path3 = url.path;
1068
- if (path3.length === 0) {
1113
+ const path4 = url.path;
1114
+ if (path4.length === 0) {
1069
1115
  return;
1070
1116
  }
1071
- if (url.scheme === "file" && path3.length === 1 && isNormalizedWindowsDriveLetter(path3[0])) {
1117
+ if (url.scheme === "file" && path4.length === 1 && isNormalizedWindowsDriveLetter(path4[0])) {
1072
1118
  return;
1073
1119
  }
1074
- path3.pop();
1120
+ path4.pop();
1075
1121
  }
1076
1122
  function includesCredentials(url) {
1077
1123
  return url.username !== "" || url.password !== "";
@@ -6787,7 +6833,7 @@ var require_lib3 = __commonJS({
6787
6833
  return new fetch2.Promise(function(resolve, reject) {
6788
6834
  const request = new Request2(url, opts);
6789
6835
  const options = getNodeRequestOptions(request);
6790
- const send = (options.protocol === "https:" ? https : http).request;
6836
+ const send2 = (options.protocol === "https:" ? https : http).request;
6791
6837
  const signal = request.signal;
6792
6838
  let response = null;
6793
6839
  const abort = function abort2() {
@@ -6807,7 +6853,7 @@ var require_lib3 = __commonJS({
6807
6853
  abort();
6808
6854
  finalize();
6809
6855
  };
6810
- const req = send(options);
6856
+ const req = send2(options);
6811
6857
  let reqTimeout;
6812
6858
  if (signal) {
6813
6859
  signal.addEventListener("abort", abortAndFinalize);
@@ -10906,14 +10952,14 @@ var require_fileFromPath = __commonJS({
10906
10952
  return "File";
10907
10953
  }
10908
10954
  };
10909
- function createFileFromPath(path3, { mtimeMs, size }, filenameOrOptions, options = {}) {
10955
+ function createFileFromPath(path4, { mtimeMs, size }, filenameOrOptions, options = {}) {
10910
10956
  let filename;
10911
10957
  if ((0, isPlainObject_1.default)(filenameOrOptions)) {
10912
10958
  [options, filename] = [filenameOrOptions, void 0];
10913
10959
  } else {
10914
10960
  filename = filenameOrOptions;
10915
10961
  }
10916
- const file = new FileFromPath({ path: path3, size, lastModified: mtimeMs });
10962
+ const file = new FileFromPath({ path: path4, size, lastModified: mtimeMs });
10917
10963
  if (!filename) {
10918
10964
  filename = file.name;
10919
10965
  }
@@ -10922,14 +10968,14 @@ var require_fileFromPath = __commonJS({
10922
10968
  lastModified: file.lastModified
10923
10969
  });
10924
10970
  }
10925
- function fileFromPathSync(path3, filenameOrOptions, options = {}) {
10926
- const stats = (0, fs_1.statSync)(path3);
10927
- return createFileFromPath(path3, stats, filenameOrOptions, options);
10971
+ function fileFromPathSync(path4, filenameOrOptions, options = {}) {
10972
+ const stats = (0, fs_1.statSync)(path4);
10973
+ return createFileFromPath(path4, stats, filenameOrOptions, options);
10928
10974
  }
10929
10975
  exports2.fileFromPathSync = fileFromPathSync;
10930
- async function fileFromPath(path3, filenameOrOptions, options) {
10931
- const stats = await fs_1.promises.stat(path3);
10932
- return createFileFromPath(path3, stats, filenameOrOptions, options);
10976
+ async function fileFromPath(path4, filenameOrOptions, options) {
10977
+ const stats = await fs_1.promises.stat(path4);
10978
+ return createFileFromPath(path4, stats, filenameOrOptions, options);
10933
10979
  }
10934
10980
  exports2.fileFromPath = fileFromPath;
10935
10981
  }
@@ -10981,13 +11027,13 @@ var require_node_runtime = __commonJS({
10981
11027
  var MultipartBody_1 = require_MultipartBody();
10982
11028
  var web_1 = require("node:stream/web");
10983
11029
  var fileFromPathWarned = false;
10984
- async function fileFromPath(path3, ...args) {
11030
+ async function fileFromPath(path4, ...args) {
10985
11031
  const { fileFromPath: _fileFromPath } = await Promise.resolve().then(() => __importStar(require_fileFromPath()));
10986
11032
  if (!fileFromPathWarned) {
10987
- console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path3)}) instead`);
11033
+ console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path4)}) instead`);
10988
11034
  fileFromPathWarned = true;
10989
11035
  }
10990
- return await _fileFromPath(path3, ...args);
11036
+ return await _fileFromPath(path4, ...args);
10991
11037
  }
10992
11038
  var defaultHttpAgent = new agentkeepalive_1.default({ keepAlive: true, timeout: 5 * 60 * 1e3 });
10993
11039
  var defaultHttpsAgent = new agentkeepalive_1.default.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1e3 });
@@ -11752,29 +11798,29 @@ var require_core = __commonJS({
11752
11798
  defaultIdempotencyKey() {
11753
11799
  return `stainless-node-retry-${uuid4()}`;
11754
11800
  }
11755
- get(path3, opts) {
11756
- return this.methodRequest("get", path3, opts);
11801
+ get(path4, opts) {
11802
+ return this.methodRequest("get", path4, opts);
11757
11803
  }
11758
- post(path3, opts) {
11759
- return this.methodRequest("post", path3, opts);
11804
+ post(path4, opts) {
11805
+ return this.methodRequest("post", path4, opts);
11760
11806
  }
11761
- patch(path3, opts) {
11762
- return this.methodRequest("patch", path3, opts);
11807
+ patch(path4, opts) {
11808
+ return this.methodRequest("patch", path4, opts);
11763
11809
  }
11764
- put(path3, opts) {
11765
- return this.methodRequest("put", path3, opts);
11810
+ put(path4, opts) {
11811
+ return this.methodRequest("put", path4, opts);
11766
11812
  }
11767
- delete(path3, opts) {
11768
- return this.methodRequest("delete", path3, opts);
11813
+ delete(path4, opts) {
11814
+ return this.methodRequest("delete", path4, opts);
11769
11815
  }
11770
- methodRequest(method, path3, opts) {
11816
+ methodRequest(method, path4, opts) {
11771
11817
  return this.request(Promise.resolve(opts).then(async (opts2) => {
11772
11818
  const body = opts2 && (0, uploads_1.isBlobLike)(opts2?.body) ? new DataView(await opts2.body.arrayBuffer()) : opts2?.body instanceof DataView ? opts2.body : opts2?.body instanceof ArrayBuffer ? new DataView(opts2.body) : opts2 && ArrayBuffer.isView(opts2?.body) ? new DataView(opts2.body.buffer) : opts2?.body;
11773
- return { method, path: path3, ...opts2, body };
11819
+ return { method, path: path4, ...opts2, body };
11774
11820
  }));
11775
11821
  }
11776
- getAPIList(path3, Page, opts) {
11777
- return this.requestAPIList(Page, { method: "get", path: path3, ...opts });
11822
+ getAPIList(path4, Page, opts) {
11823
+ return this.requestAPIList(Page, { method: "get", path: path4, ...opts });
11778
11824
  }
11779
11825
  calculateContentLength(body) {
11780
11826
  if (typeof body === "string") {
@@ -11792,10 +11838,10 @@ var require_core = __commonJS({
11792
11838
  return null;
11793
11839
  }
11794
11840
  buildRequest(options, { retryCount = 0 } = {}) {
11795
- const { method, path: path3, query, headers = {} } = options;
11841
+ const { method, path: path4, query, headers = {} } = options;
11796
11842
  const body = ArrayBuffer.isView(options.body) || options.__binaryRequest && typeof options.body === "string" ? options.body : (0, uploads_1.isMultipartBody)(options.body) ? options.body.body : options.body ? JSON.stringify(options.body, null, 2) : null;
11797
11843
  const contentLength = this.calculateContentLength(body);
11798
- const url = this.buildURL(path3, query);
11844
+ const url = this.buildURL(path4, query);
11799
11845
  if ("timeout" in options)
11800
11846
  validatePositiveInteger("timeout", options.timeout);
11801
11847
  const timeout = options.timeout ?? this.timeout;
@@ -11908,8 +11954,8 @@ var require_core = __commonJS({
11908
11954
  const request = this.makeRequest(options, null);
11909
11955
  return new PagePromise(this, request, Page);
11910
11956
  }
11911
- buildURL(path3, query) {
11912
- const url = isAbsoluteURL(path3) ? new URL(path3) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path3.startsWith("/") ? path3.slice(1) : path3));
11957
+ buildURL(path4, query) {
11958
+ const url = isAbsoluteURL(path4) ? new URL(path4) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path4.startsWith("/") ? path4.slice(1) : path4));
11913
11959
  const defaultQuery = this.defaultQuery();
11914
11960
  if (!isEmptyObj(defaultQuery)) {
11915
11961
  query = { ...defaultQuery, ...query };
@@ -13202,9 +13248,9 @@ var require_PromptCachingBetaMessageStream = __commonJS({
13202
13248
  _addPromptCachingBetaMessageParam(message) {
13203
13249
  this.messages.push(message);
13204
13250
  }
13205
- _addPromptCachingBetaMessage(message, emit = true) {
13251
+ _addPromptCachingBetaMessage(message, emit2 = true) {
13206
13252
  this.receivedMessages.push(message);
13207
- if (emit) {
13253
+ if (emit2) {
13208
13254
  this._emit("message", message);
13209
13255
  }
13210
13256
  }
@@ -13826,9 +13872,9 @@ var require_MessageStream = __commonJS({
13826
13872
  _addMessageParam(message) {
13827
13873
  this.messages.push(message);
13828
13874
  }
13829
- _addMessage(message, emit = true) {
13875
+ _addMessage(message, emit2 = true) {
13830
13876
  this.receivedMessages.push(message);
13831
- if (emit) {
13877
+ if (emit2) {
13832
13878
  this._emit("message", message);
13833
13879
  }
13834
13880
  }
@@ -23246,11 +23292,11 @@ var require_mime_types = __commonJS({
23246
23292
  }
23247
23293
  return exts[0];
23248
23294
  }
23249
- function lookup(path3) {
23250
- if (!path3 || typeof path3 !== "string") {
23295
+ function lookup(path4) {
23296
+ if (!path4 || typeof path4 !== "string") {
23251
23297
  return false;
23252
23298
  }
23253
- var extension2 = extname("x." + path3).toLowerCase().substr(1);
23299
+ var extension2 = extname("x." + path4).toLowerCase().substr(1);
23254
23300
  if (!extension2) {
23255
23301
  return false;
23256
23302
  }
@@ -24355,11 +24401,11 @@ var require_form_data = __commonJS({
24355
24401
  "use strict";
24356
24402
  var CombinedStream = require_combined_stream();
24357
24403
  var util = require("util");
24358
- var path3 = require("path");
24404
+ var path4 = require("path");
24359
24405
  var http = require("http");
24360
24406
  var https = require("https");
24361
24407
  var parseUrl = require("url").parse;
24362
- var fs3 = require("fs");
24408
+ var fs4 = require("fs");
24363
24409
  var Stream = require("stream").Stream;
24364
24410
  var crypto2 = require("crypto");
24365
24411
  var mime = require_mime_types();
@@ -24426,7 +24472,7 @@ var require_form_data = __commonJS({
24426
24472
  if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
24427
24473
  callback(null, value.end + 1 - (value.start ? value.start : 0));
24428
24474
  } else {
24429
- fs3.stat(value.path, function(err, stat) {
24475
+ fs4.stat(value.path, function(err, stat) {
24430
24476
  if (err) {
24431
24477
  callback(err);
24432
24478
  return;
@@ -24483,11 +24529,11 @@ var require_form_data = __commonJS({
24483
24529
  FormData2.prototype._getContentDisposition = function(value, options) {
24484
24530
  var filename;
24485
24531
  if (typeof options.filepath === "string") {
24486
- filename = path3.normalize(options.filepath).replace(/\\/g, "/");
24532
+ filename = path4.normalize(options.filepath).replace(/\\/g, "/");
24487
24533
  } else if (options.filename || value && (value.name || value.path)) {
24488
- filename = path3.basename(options.filename || value && (value.name || value.path));
24534
+ filename = path4.basename(options.filename || value && (value.name || value.path));
24489
24535
  } else if (value && value.readable && hasOwn(value, "httpVersion")) {
24490
- filename = path3.basename(value.client._httpMessage.path || "");
24536
+ filename = path4.basename(value.client._httpMessage.path || "");
24491
24537
  }
24492
24538
  if (filename) {
24493
24539
  return 'filename="' + filename + '"';
@@ -25032,7 +25078,7 @@ var require_has_flag = __commonJS({
25032
25078
  var require_supports_color = __commonJS({
25033
25079
  "../../node_modules/supports-color/index.js"(exports2, module2) {
25034
25080
  "use strict";
25035
- var os4 = require("os");
25081
+ var os5 = require("os");
25036
25082
  var tty = require("tty");
25037
25083
  var hasFlag = require_has_flag();
25038
25084
  var { env } = process;
@@ -25080,7 +25126,7 @@ var require_supports_color = __commonJS({
25080
25126
  return min;
25081
25127
  }
25082
25128
  if (process.platform === "win32") {
25083
- const osRelease = os4.release().split(".");
25129
+ const osRelease = os5.release().split(".");
25084
25130
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
25085
25131
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
25086
25132
  }
@@ -26308,7 +26354,7 @@ var require_axios = __commonJS({
26308
26354
  var https = require("https");
26309
26355
  var http2 = require("http2");
26310
26356
  var util = require("util");
26311
- var path3 = require("path");
26357
+ var path4 = require("path");
26312
26358
  var followRedirects = require_follow_redirects();
26313
26359
  var zlib = require("zlib");
26314
26360
  var stream = require("stream");
@@ -27195,9 +27241,9 @@ var require_axios = __commonJS({
27195
27241
  function removeBrackets(key) {
27196
27242
  return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
27197
27243
  }
27198
- function renderKey(path4, key, dots) {
27199
- if (!path4) return key;
27200
- return path4.concat(key).map(function each(token, i) {
27244
+ function renderKey(path5, key, dots) {
27245
+ if (!path5) return key;
27246
+ return path5.concat(key).map(function each(token, i) {
27201
27247
  token = removeBrackets(token);
27202
27248
  return !dots && i ? "[" + token + "]" : token;
27203
27249
  }).join(dots ? "." : "");
@@ -27246,13 +27292,13 @@ var require_axios = __commonJS({
27246
27292
  }
27247
27293
  return value;
27248
27294
  }
27249
- function defaultVisitor(value, key, path4) {
27295
+ function defaultVisitor(value, key, path5) {
27250
27296
  let arr = value;
27251
27297
  if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
27252
- formData.append(renderKey(path4, key, dots), convertValue(value));
27298
+ formData.append(renderKey(path5, key, dots), convertValue(value));
27253
27299
  return false;
27254
27300
  }
27255
- if (value && !path4 && typeof value === "object") {
27301
+ if (value && !path5 && typeof value === "object") {
27256
27302
  if (utils$1.endsWith(key, "{}")) {
27257
27303
  key = metaTokens ? key : key.slice(0, -2);
27258
27304
  value = JSON.stringify(value);
@@ -27271,7 +27317,7 @@ var require_axios = __commonJS({
27271
27317
  if (isVisitable(value)) {
27272
27318
  return true;
27273
27319
  }
27274
- formData.append(renderKey(path4, key, dots), convertValue(value));
27320
+ formData.append(renderKey(path5, key, dots), convertValue(value));
27275
27321
  return false;
27276
27322
  }
27277
27323
  const stack = [];
@@ -27280,19 +27326,19 @@ var require_axios = __commonJS({
27280
27326
  convertValue,
27281
27327
  isVisitable
27282
27328
  });
27283
- function build(value, path4, depth = 0) {
27329
+ function build(value, path5, depth = 0) {
27284
27330
  if (utils$1.isUndefined(value)) return;
27285
27331
  if (depth > maxDepth) {
27286
27332
  throw new AxiosError("Object is too deeply nested (" + depth + " levels). Max depth: " + maxDepth, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
27287
27333
  }
27288
27334
  if (stack.indexOf(value) !== -1) {
27289
- throw Error("Circular reference detected in " + path4.join("."));
27335
+ throw Error("Circular reference detected in " + path5.join("."));
27290
27336
  }
27291
27337
  stack.push(value);
27292
27338
  utils$1.forEach(value, function each(el, key) {
27293
- const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path4, exposedHelpers);
27339
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path5, exposedHelpers);
27294
27340
  if (result === true) {
27295
- build(el, path4 ? path4.concat(key) : [key], depth + 1);
27341
+ build(el, path5 ? path5.concat(key) : [key], depth + 1);
27296
27342
  }
27297
27343
  });
27298
27344
  stack.pop();
@@ -27480,7 +27526,7 @@ var require_axios = __commonJS({
27480
27526
  };
27481
27527
  function toURLEncodedForm(data, options) {
27482
27528
  return toFormData(data, new platform.classes.URLSearchParams(), {
27483
- visitor: function(value, key, path4, helpers) {
27529
+ visitor: function(value, key, path5, helpers) {
27484
27530
  if (platform.isNode && utils$1.isBuffer(value)) {
27485
27531
  this.append(key, value.toString("base64"));
27486
27532
  return false;
@@ -27508,11 +27554,11 @@ var require_axios = __commonJS({
27508
27554
  return obj;
27509
27555
  }
27510
27556
  function formDataToJSON(formData) {
27511
- function buildPath(path4, value, target, index) {
27512
- let name = path4[index++];
27557
+ function buildPath(path5, value, target, index) {
27558
+ let name = path5[index++];
27513
27559
  if (name === "__proto__") return true;
27514
27560
  const isNumericKey = Number.isFinite(+name);
27515
- const isLast = index >= path4.length;
27561
+ const isLast = index >= path5.length;
27516
27562
  name = !name && utils$1.isArray(target) ? target.length : name;
27517
27563
  if (isLast) {
27518
27564
  if (utils$1.hasOwnProp(target, name)) {
@@ -27525,7 +27571,7 @@ var require_axios = __commonJS({
27525
27571
  if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
27526
27572
  target[name] = [];
27527
27573
  }
27528
- const result = buildPath(path4, value, target[name], index);
27574
+ const result = buildPath(path5, value, target[name], index);
27529
27575
  if (result && utils$1.isArray(target[name])) {
27530
27576
  target[name] = arrayToObject(target[name]);
27531
27577
  }
@@ -28895,8 +28941,8 @@ var require_axios = __commonJS({
28895
28941
  }
28896
28942
  if (config.allowedSocketPaths != null) {
28897
28943
  const allowed = Array.isArray(config.allowedSocketPaths) ? config.allowedSocketPaths : [config.allowedSocketPaths];
28898
- const resolvedSocket = path3.resolve(config.socketPath);
28899
- const isAllowed = allowed.some((entry) => typeof entry === "string" && path3.resolve(entry) === resolvedSocket);
28944
+ const resolvedSocket = path4.resolve(config.socketPath);
28945
+ const isAllowed = allowed.some((entry) => typeof entry === "string" && path4.resolve(entry) === resolvedSocket);
28900
28946
  if (!isAllowed) {
28901
28947
  return reject(new AxiosError(`socketPath "${config.socketPath}" is not permitted by allowedSocketPaths`, AxiosError.ERR_BAD_OPTION_VALUE, config));
28902
28948
  }
@@ -29150,14 +29196,14 @@ var require_axios = __commonJS({
29150
29196
  var cookies = platform.hasStandardBrowserEnv ? (
29151
29197
  // Standard browser envs support document.cookie
29152
29198
  {
29153
- write(name, value, expires, path4, domain, secure, sameSite) {
29199
+ write(name, value, expires, path5, domain, secure, sameSite) {
29154
29200
  if (typeof document === "undefined") return;
29155
29201
  const cookie = [`${name}=${encodeURIComponent(value)}`];
29156
29202
  if (utils$1.isNumber(expires)) {
29157
29203
  cookie.push(`expires=${new Date(expires).toUTCString()}`);
29158
29204
  }
29159
- if (utils$1.isString(path4)) {
29160
- cookie.push(`path=${path4}`);
29205
+ if (utils$1.isString(path5)) {
29206
+ cookie.push(`path=${path5}`);
29161
29207
  }
29162
29208
  if (utils$1.isString(domain)) {
29163
29209
  cookie.push(`domain=${domain}`);
@@ -31238,12 +31284,21 @@ var require_agency = __commonJS({
31238
31284
  "../desktop/dist/main/lib/agency.js"(exports2) {
31239
31285
  "use strict";
31240
31286
  Object.defineProperty(exports2, "__esModule", { value: true });
31287
+ exports2.DEFAULT_CURRENCY = exports2.CURRENCIES = void 0;
31241
31288
  exports2.getAgencyProfile = getAgencyProfile2;
31242
31289
  exports2.setAgencyProfile = setAgencyProfile2;
31243
31290
  exports2.agencyConfigured = agencyConfigured2;
31244
31291
  exports2.siteCredit = siteCredit;
31245
31292
  exports2.formatMoney = formatMoney2;
31246
31293
  var db_1 = require_db();
31294
+ exports2.CURRENCIES = [
31295
+ { code: "USD", symbol: "$", label: "US dollar" },
31296
+ { code: "GBP", symbol: "\xA3", label: "Pound sterling" },
31297
+ { code: "EUR", symbol: "\u20AC", label: "Euro" },
31298
+ { code: "CAD", symbol: "CA$", label: "Canadian dollar" },
31299
+ { code: "AUD", symbol: "A$", label: "Australian dollar" }
31300
+ ];
31301
+ exports2.DEFAULT_CURRENCY = "USD";
31247
31302
  var KEYS = {
31248
31303
  name: "agency_name",
31249
31304
  logoPath: "agency_logo_path",
@@ -31289,7 +31344,7 @@ var require_agency = __commonJS({
31289
31344
  bankAccount: read(KEYS.bankAccount),
31290
31345
  bankSortCode: read(KEYS.bankSortCode),
31291
31346
  paymentTerms: read(KEYS.paymentTerms),
31292
- currency: read("agency_currency") ?? "GBP"
31347
+ currency: read("agency_currency") ?? exports2.DEFAULT_CURRENCY
31293
31348
  };
31294
31349
  }
31295
31350
  function setAgencyProfile2(patch) {
@@ -31313,9 +31368,8 @@ var require_agency = __commonJS({
31313
31368
  return { label: "Sproutkit", url: "https://sproutkit.app" };
31314
31369
  return { label: p.name, url: p.website };
31315
31370
  }
31316
- function formatMoney2(pence, currency = "GBP") {
31317
- const symbols = { GBP: "\xA3", USD: "$", EUR: "\u20AC" };
31318
- const sym = symbols[currency] ?? "";
31371
+ function formatMoney2(pence, currency = exports2.DEFAULT_CURRENCY) {
31372
+ const sym = exports2.CURRENCIES.find((c2) => c2.code === currency)?.symbol ?? "";
31319
31373
  const value = (pence / 100).toFixed(2);
31320
31374
  return `${sym}${value}`;
31321
31375
  }
@@ -35811,7 +35865,7 @@ var require_lib4 = __commonJS({
35811
35865
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
35812
35866
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
35813
35867
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
35814
- var __export = (target, all) => {
35868
+ var __export2 = (target, all) => {
35815
35869
  for (var name in all)
35816
35870
  __defProp2(target, name, { get: all[name], enumerable: true });
35817
35871
  };
@@ -35825,7 +35879,7 @@ var require_lib4 = __commonJS({
35825
35879
  };
35826
35880
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
35827
35881
  var src_exports = {};
35828
- __export(src_exports, {
35882
+ __export2(src_exports, {
35829
35883
  isNodeProcess: () => isNodeProcess
35830
35884
  });
35831
35885
  module2.exports = __toCommonJS(src_exports);
@@ -35862,7 +35916,7 @@ var require_version2 = __commonJS({
35862
35916
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
35863
35917
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
35864
35918
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
35865
- var __export = (target, all) => {
35919
+ var __export2 = (target, all) => {
35866
35920
  for (var name in all)
35867
35921
  __defProp2(target, name, { get: all[name], enumerable: true });
35868
35922
  };
@@ -35876,7 +35930,7 @@ var require_version2 = __commonJS({
35876
35930
  };
35877
35931
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
35878
35932
  var version_exports = {};
35879
- __export(version_exports, {
35933
+ __export2(version_exports, {
35880
35934
  version: () => version
35881
35935
  });
35882
35936
  module2.exports = __toCommonJS(version_exports);
@@ -35892,7 +35946,7 @@ var require_exchange_vercel_oidc_token = __commonJS({
35892
35946
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
35893
35947
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
35894
35948
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
35895
- var __export = (target, all) => {
35949
+ var __export2 = (target, all) => {
35896
35950
  for (var name in all)
35897
35951
  __defProp2(target, name, { get: all[name], enumerable: true });
35898
35952
  };
@@ -35906,7 +35960,7 @@ var require_exchange_vercel_oidc_token = __commonJS({
35906
35960
  };
35907
35961
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
35908
35962
  var exchange_vercel_oidc_token_exports = {};
35909
- __export(exchange_vercel_oidc_token_exports, {
35963
+ __export2(exchange_vercel_oidc_token_exports, {
35910
35964
  exchangeVercelOidcToken: () => exchangeVercelOidcToken2
35911
35965
  });
35912
35966
  module2.exports = __toCommonJS(exchange_vercel_oidc_token_exports);
@@ -36031,7 +36085,7 @@ var require_get_context = __commonJS({
36031
36085
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
36032
36086
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
36033
36087
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
36034
- var __export = (target, all) => {
36088
+ var __export2 = (target, all) => {
36035
36089
  for (var name in all)
36036
36090
  __defProp2(target, name, { get: all[name], enumerable: true });
36037
36091
  };
@@ -36045,7 +36099,7 @@ var require_get_context = __commonJS({
36045
36099
  };
36046
36100
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
36047
36101
  var get_context_exports = {};
36048
- __export(get_context_exports, {
36102
+ __export2(get_context_exports, {
36049
36103
  SYMBOL_FOR_REQ_CONTEXT: () => SYMBOL_FOR_REQ_CONTEXT,
36050
36104
  getContext: () => getContext2
36051
36105
  });
@@ -36066,7 +36120,7 @@ var require_get_vercel_oidc_token_sync = __commonJS({
36066
36120
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
36067
36121
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
36068
36122
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
36069
- var __export = (target, all) => {
36123
+ var __export2 = (target, all) => {
36070
36124
  for (var name in all)
36071
36125
  __defProp2(target, name, { get: all[name], enumerable: true });
36072
36126
  };
@@ -36080,7 +36134,7 @@ var require_get_vercel_oidc_token_sync = __commonJS({
36080
36134
  };
36081
36135
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
36082
36136
  var get_vercel_oidc_token_sync_exports = {};
36083
- __export(get_vercel_oidc_token_sync_exports, {
36137
+ __export2(get_vercel_oidc_token_sync_exports, {
36084
36138
  getVercelOidcTokenSync: () => getVercelOidcTokenSync2
36085
36139
  });
36086
36140
  module2.exports = __toCommonJS(get_vercel_oidc_token_sync_exports);
@@ -36105,7 +36159,7 @@ var require_token_error = __commonJS({
36105
36159
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
36106
36160
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
36107
36161
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
36108
- var __export = (target, all) => {
36162
+ var __export2 = (target, all) => {
36109
36163
  for (var name in all)
36110
36164
  __defProp2(target, name, { get: all[name], enumerable: true });
36111
36165
  };
@@ -36119,7 +36173,7 @@ var require_token_error = __commonJS({
36119
36173
  };
36120
36174
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
36121
36175
  var token_error_exports = {};
36122
- __export(token_error_exports, {
36176
+ __export2(token_error_exports, {
36123
36177
  VercelOidcTokenError: () => VercelOidcTokenError
36124
36178
  });
36125
36179
  module2.exports = __toCommonJS(token_error_exports);
@@ -36147,7 +36201,7 @@ var require_errors = __commonJS({
36147
36201
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
36148
36202
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
36149
36203
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
36150
- var __export = (target, all) => {
36204
+ var __export2 = (target, all) => {
36151
36205
  for (var name in all)
36152
36206
  __defProp2(target, name, { get: all[name], enumerable: true });
36153
36207
  };
@@ -36161,7 +36215,7 @@ var require_errors = __commonJS({
36161
36215
  };
36162
36216
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
36163
36217
  var errors_exports = {};
36164
- __export(errors_exports, {
36218
+ __export2(errors_exports, {
36165
36219
  VercelCliError: () => VercelCliError2,
36166
36220
  assertValidCwd: () => assertValidCwd,
36167
36221
  getCliNotFoundMessage: () => getCliNotFoundMessage,
@@ -36300,8 +36354,8 @@ var require_windows = __commonJS({
36300
36354
  "../../node_modules/isexe/windows.js"(exports2, module2) {
36301
36355
  module2.exports = isexe;
36302
36356
  isexe.sync = sync;
36303
- var fs3 = require("fs");
36304
- function checkPathExt(path3, options) {
36357
+ var fs4 = require("fs");
36358
+ function checkPathExt(path4, options) {
36305
36359
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
36306
36360
  if (!pathext) {
36307
36361
  return true;
@@ -36312,25 +36366,25 @@ var require_windows = __commonJS({
36312
36366
  }
36313
36367
  for (var i = 0; i < pathext.length; i++) {
36314
36368
  var p = pathext[i].toLowerCase();
36315
- if (p && path3.substr(-p.length).toLowerCase() === p) {
36369
+ if (p && path4.substr(-p.length).toLowerCase() === p) {
36316
36370
  return true;
36317
36371
  }
36318
36372
  }
36319
36373
  return false;
36320
36374
  }
36321
- function checkStat(stat, path3, options) {
36375
+ function checkStat(stat, path4, options) {
36322
36376
  if (!stat.isSymbolicLink() && !stat.isFile()) {
36323
36377
  return false;
36324
36378
  }
36325
- return checkPathExt(path3, options);
36379
+ return checkPathExt(path4, options);
36326
36380
  }
36327
- function isexe(path3, options, cb) {
36328
- fs3.stat(path3, function(er, stat) {
36329
- cb(er, er ? false : checkStat(stat, path3, options));
36381
+ function isexe(path4, options, cb) {
36382
+ fs4.stat(path4, function(er, stat) {
36383
+ cb(er, er ? false : checkStat(stat, path4, options));
36330
36384
  });
36331
36385
  }
36332
- function sync(path3, options) {
36333
- return checkStat(fs3.statSync(path3), path3, options);
36386
+ function sync(path4, options) {
36387
+ return checkStat(fs4.statSync(path4), path4, options);
36334
36388
  }
36335
36389
  }
36336
36390
  });
@@ -36340,14 +36394,14 @@ var require_mode = __commonJS({
36340
36394
  "../../node_modules/isexe/mode.js"(exports2, module2) {
36341
36395
  module2.exports = isexe;
36342
36396
  isexe.sync = sync;
36343
- var fs3 = require("fs");
36344
- function isexe(path3, options, cb) {
36345
- fs3.stat(path3, function(er, stat) {
36397
+ var fs4 = require("fs");
36398
+ function isexe(path4, options, cb) {
36399
+ fs4.stat(path4, function(er, stat) {
36346
36400
  cb(er, er ? false : checkStat(stat, options));
36347
36401
  });
36348
36402
  }
36349
- function sync(path3, options) {
36350
- return checkStat(fs3.statSync(path3), options);
36403
+ function sync(path4, options) {
36404
+ return checkStat(fs4.statSync(path4), options);
36351
36405
  }
36352
36406
  function checkStat(stat, options) {
36353
36407
  return stat.isFile() && checkMode(stat, options);
@@ -36371,7 +36425,7 @@ var require_mode = __commonJS({
36371
36425
  // ../../node_modules/isexe/index.js
36372
36426
  var require_isexe = __commonJS({
36373
36427
  "../../node_modules/isexe/index.js"(exports2, module2) {
36374
- var fs3 = require("fs");
36428
+ var fs4 = require("fs");
36375
36429
  var core;
36376
36430
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
36377
36431
  core = require_windows();
@@ -36380,7 +36434,7 @@ var require_isexe = __commonJS({
36380
36434
  }
36381
36435
  module2.exports = isexe;
36382
36436
  isexe.sync = sync;
36383
- function isexe(path3, options, cb) {
36437
+ function isexe(path4, options, cb) {
36384
36438
  if (typeof options === "function") {
36385
36439
  cb = options;
36386
36440
  options = {};
@@ -36390,7 +36444,7 @@ var require_isexe = __commonJS({
36390
36444
  throw new TypeError("callback not provided");
36391
36445
  }
36392
36446
  return new Promise(function(resolve, reject) {
36393
- isexe(path3, options || {}, function(er, is) {
36447
+ isexe(path4, options || {}, function(er, is) {
36394
36448
  if (er) {
36395
36449
  reject(er);
36396
36450
  } else {
@@ -36399,7 +36453,7 @@ var require_isexe = __commonJS({
36399
36453
  });
36400
36454
  });
36401
36455
  }
36402
- core(path3, options || {}, function(er, is) {
36456
+ core(path4, options || {}, function(er, is) {
36403
36457
  if (er) {
36404
36458
  if (er.code === "EACCES" || options && options.ignoreErrors) {
36405
36459
  er = null;
@@ -36409,9 +36463,9 @@ var require_isexe = __commonJS({
36409
36463
  cb(er, is);
36410
36464
  });
36411
36465
  }
36412
- function sync(path3, options) {
36466
+ function sync(path4, options) {
36413
36467
  try {
36414
- return core.sync(path3, options || {});
36468
+ return core.sync(path4, options || {});
36415
36469
  } catch (er) {
36416
36470
  if (options && options.ignoreErrors || er.code === "EACCES") {
36417
36471
  return false;
@@ -36427,7 +36481,7 @@ var require_isexe = __commonJS({
36427
36481
  var require_which = __commonJS({
36428
36482
  "../../node_modules/which/which.js"(exports2, module2) {
36429
36483
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
36430
- var path3 = require("path");
36484
+ var path4 = require("path");
36431
36485
  var COLON = isWindows ? ";" : ":";
36432
36486
  var isexe = require_isexe();
36433
36487
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -36465,7 +36519,7 @@ var require_which = __commonJS({
36465
36519
  return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
36466
36520
  const ppRaw = pathEnv[i];
36467
36521
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
36468
- const pCmd = path3.join(pathPart, cmd);
36522
+ const pCmd = path4.join(pathPart, cmd);
36469
36523
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
36470
36524
  resolve(subStep(p, i, 0));
36471
36525
  });
@@ -36492,7 +36546,7 @@ var require_which = __commonJS({
36492
36546
  for (let i = 0; i < pathEnv.length; i++) {
36493
36547
  const ppRaw = pathEnv[i];
36494
36548
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
36495
- const pCmd = path3.join(pathPart, cmd);
36549
+ const pCmd = path4.join(pathPart, cmd);
36496
36550
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
36497
36551
  for (let j = 0; j < pathExt.length; j++) {
36498
36552
  const cur = p + pathExt[j];
@@ -36540,7 +36594,7 @@ var require_path_key = __commonJS({
36540
36594
  var require_resolveCommand = __commonJS({
36541
36595
  "../../node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
36542
36596
  "use strict";
36543
- var path3 = require("path");
36597
+ var path4 = require("path");
36544
36598
  var which = require_which();
36545
36599
  var getPathKey = require_path_key();
36546
36600
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -36558,7 +36612,7 @@ var require_resolveCommand = __commonJS({
36558
36612
  try {
36559
36613
  resolved = which.sync(parsed.command, {
36560
36614
  path: env[getPathKey({ env })],
36561
- pathExt: withoutPathExt ? path3.delimiter : void 0
36615
+ pathExt: withoutPathExt ? path4.delimiter : void 0
36562
36616
  });
36563
36617
  } catch (e) {
36564
36618
  } finally {
@@ -36567,7 +36621,7 @@ var require_resolveCommand = __commonJS({
36567
36621
  }
36568
36622
  }
36569
36623
  if (resolved) {
36570
- resolved = path3.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
36624
+ resolved = path4.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
36571
36625
  }
36572
36626
  return resolved;
36573
36627
  }
@@ -36621,8 +36675,8 @@ var require_shebang_command = __commonJS({
36621
36675
  if (!match) {
36622
36676
  return null;
36623
36677
  }
36624
- const [path3, argument] = match[0].replace(/#! ?/, "").split(" ");
36625
- const binary = path3.split("/").pop();
36678
+ const [path4, argument] = match[0].replace(/#! ?/, "").split(" ");
36679
+ const binary = path4.split("/").pop();
36626
36680
  if (binary === "env") {
36627
36681
  return argument;
36628
36682
  }
@@ -36635,16 +36689,16 @@ var require_shebang_command = __commonJS({
36635
36689
  var require_readShebang = __commonJS({
36636
36690
  "../../node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
36637
36691
  "use strict";
36638
- var fs3 = require("fs");
36692
+ var fs4 = require("fs");
36639
36693
  var shebangCommand = require_shebang_command();
36640
36694
  function readShebang(command) {
36641
36695
  const size = 150;
36642
36696
  const buffer = Buffer.alloc(size);
36643
36697
  let fd;
36644
36698
  try {
36645
- fd = fs3.openSync(command, "r");
36646
- fs3.readSync(fd, buffer, 0, size, 0);
36647
- fs3.closeSync(fd);
36699
+ fd = fs4.openSync(command, "r");
36700
+ fs4.readSync(fd, buffer, 0, size, 0);
36701
+ fs4.closeSync(fd);
36648
36702
  } catch (e) {
36649
36703
  }
36650
36704
  return shebangCommand(buffer.toString());
@@ -36657,7 +36711,7 @@ var require_readShebang = __commonJS({
36657
36711
  var require_parse = __commonJS({
36658
36712
  "../../node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
36659
36713
  "use strict";
36660
- var path3 = require("path");
36714
+ var path4 = require("path");
36661
36715
  var resolveCommand = require_resolveCommand();
36662
36716
  var escape = require_escape();
36663
36717
  var readShebang = require_readShebang();
@@ -36682,7 +36736,7 @@ var require_parse = __commonJS({
36682
36736
  const needsShell = !isExecutableRegExp.test(commandFile);
36683
36737
  if (parsed.options.forceShell || needsShell) {
36684
36738
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
36685
- parsed.command = path3.normalize(parsed.command);
36739
+ parsed.command = path4.normalize(parsed.command);
36686
36740
  parsed.command = escape.command(parsed.command);
36687
36741
  parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
36688
36742
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -36778,7 +36832,7 @@ var require_cross_spawn = __commonJS({
36778
36832
  enoent.hookChildProcess(spawned, parsed);
36779
36833
  return spawned;
36780
36834
  }
36781
- function spawnSync4(command, args, options) {
36835
+ function spawnSync5(command, args, options) {
36782
36836
  const parsed = parse(command, args, options);
36783
36837
  const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
36784
36838
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
@@ -36786,7 +36840,7 @@ var require_cross_spawn = __commonJS({
36786
36840
  }
36787
36841
  module2.exports = spawn2;
36788
36842
  module2.exports.spawn = spawn2;
36789
- module2.exports.sync = spawnSync4;
36843
+ module2.exports.sync = spawnSync5;
36790
36844
  module2.exports._parse = parse;
36791
36845
  module2.exports._enoent = enoent;
36792
36846
  }
@@ -36814,7 +36868,7 @@ var require_strip_final_newline = __commonJS({
36814
36868
  var require_npm_run_path = __commonJS({
36815
36869
  "../../node_modules/npm-run-path/index.js"(exports2, module2) {
36816
36870
  "use strict";
36817
- var path3 = require("path");
36871
+ var path4 = require("path");
36818
36872
  var pathKey = require_path_key();
36819
36873
  var npmRunPath = (options) => {
36820
36874
  options = {
@@ -36824,16 +36878,16 @@ var require_npm_run_path = __commonJS({
36824
36878
  ...options
36825
36879
  };
36826
36880
  let previous;
36827
- let cwdPath = path3.resolve(options.cwd);
36881
+ let cwdPath = path4.resolve(options.cwd);
36828
36882
  const result = [];
36829
36883
  while (previous !== cwdPath) {
36830
- result.push(path3.join(cwdPath, "node_modules/.bin"));
36884
+ result.push(path4.join(cwdPath, "node_modules/.bin"));
36831
36885
  previous = cwdPath;
36832
- cwdPath = path3.resolve(cwdPath, "..");
36886
+ cwdPath = path4.resolve(cwdPath, "..");
36833
36887
  }
36834
- const execPathDir = path3.resolve(options.cwd, options.execPath, "..");
36888
+ const execPathDir = path4.resolve(options.cwd, options.execPath, "..");
36835
36889
  result.push(execPathDir);
36836
- return result.concat(options.path).join(path3.delimiter);
36890
+ return result.concat(options.path).join(path4.delimiter);
36837
36891
  };
36838
36892
  module2.exports = npmRunPath;
36839
36893
  module2.exports.default = npmRunPath;
@@ -36843,9 +36897,9 @@ var require_npm_run_path = __commonJS({
36843
36897
  ...options
36844
36898
  };
36845
36899
  const env = { ...options.env };
36846
- const path4 = pathKey({ env });
36847
- options.path = env[path4];
36848
- env[path4] = module2.exports(options);
36900
+ const path5 = pathKey({ env });
36901
+ options.path = env[path5];
36902
+ env[path5] = module2.exports(options);
36849
36903
  return env;
36850
36904
  };
36851
36905
  }
@@ -37527,7 +37581,7 @@ var require_signal_exit = __commonJS({
37527
37581
  emitter.count -= 1;
37528
37582
  };
37529
37583
  module2.exports.unload = unload;
37530
- emit = function emit2(event, code, signal) {
37584
+ emit2 = function emit3(event, code, signal) {
37531
37585
  if (emitter.emitted[event]) {
37532
37586
  return;
37533
37587
  }
@@ -37543,8 +37597,8 @@ var require_signal_exit = __commonJS({
37543
37597
  var listeners = process2.listeners(sig);
37544
37598
  if (listeners.length === emitter.count) {
37545
37599
  unload();
37546
- emit("exit", null, sig);
37547
- emit("afterexit", null, sig);
37600
+ emit2("exit", null, sig);
37601
+ emit2("afterexit", null, sig);
37548
37602
  if (isWin && sig === "SIGHUP") {
37549
37603
  sig = "SIGINT";
37550
37604
  }
@@ -37581,8 +37635,8 @@ var require_signal_exit = __commonJS({
37581
37635
  }
37582
37636
  process2.exitCode = code || /* istanbul ignore next */
37583
37637
  0;
37584
- emit("exit", process2.exitCode, null);
37585
- emit("afterexit", process2.exitCode, null);
37638
+ emit2("exit", process2.exitCode, null);
37639
+ emit2("afterexit", process2.exitCode, null);
37586
37640
  originalProcessReallyExit.call(process2, process2.exitCode);
37587
37641
  };
37588
37642
  originalProcessEmit = process2.emit;
@@ -37592,8 +37646,8 @@ var require_signal_exit = __commonJS({
37592
37646
  process2.exitCode = arg;
37593
37647
  }
37594
37648
  var ret = originalProcessEmit.apply(this, arguments);
37595
- emit("exit", process2.exitCode, null);
37596
- emit("afterexit", process2.exitCode, null);
37649
+ emit2("exit", process2.exitCode, null);
37650
+ emit2("afterexit", process2.exitCode, null);
37597
37651
  return ret;
37598
37652
  } else {
37599
37653
  return originalProcessEmit.apply(this, arguments);
@@ -37606,7 +37660,7 @@ var require_signal_exit = __commonJS({
37606
37660
  var EE;
37607
37661
  var emitter;
37608
37662
  var unload;
37609
- var emit;
37663
+ var emit2;
37610
37664
  var sigListeners;
37611
37665
  var loaded;
37612
37666
  var load;
@@ -37621,7 +37675,7 @@ var require_signal_exit = __commonJS({
37621
37675
  var require_kill = __commonJS({
37622
37676
  "../../node_modules/execa/lib/kill.js"(exports2, module2) {
37623
37677
  "use strict";
37624
- var os4 = require("os");
37678
+ var os5 = require("os");
37625
37679
  var onExit = require_signal_exit();
37626
37680
  var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
37627
37681
  var spawnedKill = (kill, signal = "SIGTERM", options = {}) => {
@@ -37645,7 +37699,7 @@ var require_kill = __commonJS({
37645
37699
  return isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
37646
37700
  };
37647
37701
  var isSigterm = (signal) => {
37648
- return signal === os4.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
37702
+ return signal === os5.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
37649
37703
  };
37650
37704
  var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
37651
37705
  if (forceKillAfterTimeout === true) {
@@ -38027,7 +38081,7 @@ var require_command = __commonJS({
38027
38081
  var require_execa = __commonJS({
38028
38082
  "../../node_modules/execa/index.js"(exports2, module2) {
38029
38083
  "use strict";
38030
- var path3 = require("path");
38084
+ var path4 = require("path");
38031
38085
  var childProcess = require("child_process");
38032
38086
  var crossSpawn = require_cross_spawn();
38033
38087
  var stripFinalNewline = require_strip_final_newline();
@@ -38069,7 +38123,7 @@ var require_execa = __commonJS({
38069
38123
  };
38070
38124
  options.env = getEnv(options);
38071
38125
  options.stdio = normalizeStdio(options);
38072
- if (process.platform === "win32" && path3.basename(file, ".exe") === "cmd") {
38126
+ if (process.platform === "win32" && path4.basename(file, ".exe") === "cmd") {
38073
38127
  args.unshift("/q");
38074
38128
  }
38075
38129
  return { file, args, options, parsed };
@@ -38261,7 +38315,7 @@ var require_envpath = __commonJS({
38261
38315
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
38262
38316
  var __getProtoOf2 = Object.getPrototypeOf;
38263
38317
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
38264
- var __export = (target, all) => {
38318
+ var __export2 = (target, all) => {
38265
38319
  for (var name in all)
38266
38320
  __defProp2(target, name, { get: all[name], enumerable: true });
38267
38321
  };
@@ -38283,7 +38337,7 @@ var require_envpath = __commonJS({
38283
38337
  ));
38284
38338
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
38285
38339
  var envpath_exports = {};
38286
- __export(envpath_exports, {
38340
+ __export2(envpath_exports, {
38287
38341
  getEnvPath: () => getEnvPath,
38288
38342
  prependPathEntries: () => prependPathEntries,
38289
38343
  setEnvPath: () => setEnvPath,
@@ -38347,7 +38401,7 @@ var require_errutils = __commonJS({
38347
38401
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
38348
38402
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
38349
38403
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
38350
- var __export = (target, all) => {
38404
+ var __export2 = (target, all) => {
38351
38405
  for (var name in all)
38352
38406
  __defProp2(target, name, { get: all[name], enumerable: true });
38353
38407
  };
@@ -38361,7 +38415,7 @@ var require_errutils = __commonJS({
38361
38415
  };
38362
38416
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
38363
38417
  var errutils_exports = {};
38364
- __export(errutils_exports, {
38418
+ __export2(errutils_exports, {
38365
38419
  getErrorMessage: () => getErrorMessage,
38366
38420
  isMissingPathError: () => isMissingPathError
38367
38421
  });
@@ -38388,7 +38442,7 @@ var require_fsutils = __commonJS({
38388
38442
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
38389
38443
  var __getProtoOf2 = Object.getPrototypeOf;
38390
38444
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
38391
- var __export = (target, all) => {
38445
+ var __export2 = (target, all) => {
38392
38446
  for (var name in all)
38393
38447
  __defProp2(target, name, { get: all[name], enumerable: true });
38394
38448
  };
@@ -38410,7 +38464,7 @@ var require_fsutils = __commonJS({
38410
38464
  ));
38411
38465
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
38412
38466
  var fsutils_exports = {};
38413
- __export(fsutils_exports, {
38467
+ __export2(fsutils_exports, {
38414
38468
  getCanonicalPath: () => getCanonicalPath,
38415
38469
  getCommandBase: () => getCommandBase,
38416
38470
  getDirectoriesBetween: () => getDirectoriesBetween,
@@ -38482,7 +38536,7 @@ var require_safety = __commonJS({
38482
38536
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
38483
38537
  var __getProtoOf2 = Object.getPrototypeOf;
38484
38538
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
38485
- var __export = (target, all) => {
38539
+ var __export2 = (target, all) => {
38486
38540
  for (var name in all)
38487
38541
  __defProp2(target, name, { get: all[name], enumerable: true });
38488
38542
  };
@@ -38504,7 +38558,7 @@ var require_safety = __commonJS({
38504
38558
  ));
38505
38559
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
38506
38560
  var safety_exports = {};
38507
- __export(safety_exports, {
38561
+ __export2(safety_exports, {
38508
38562
  getSkippedNodeModulesReason: () => getSkippedNodeModulesReason,
38509
38563
  getUnsafeDirectoryReason: () => getUnsafeDirectoryReason,
38510
38564
  getUnsafePackageBinReason: () => getUnsafePackageBinReason,
@@ -38650,7 +38704,7 @@ var require_lookup = __commonJS({
38650
38704
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
38651
38705
  var __getProtoOf2 = Object.getPrototypeOf;
38652
38706
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
38653
- var __export = (target, all) => {
38707
+ var __export2 = (target, all) => {
38654
38708
  for (var name in all)
38655
38709
  __defProp2(target, name, { get: all[name], enumerable: true });
38656
38710
  };
@@ -38672,7 +38726,7 @@ var require_lookup = __commonJS({
38672
38726
  ));
38673
38727
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
38674
38728
  var lookup_exports = {};
38675
- __export(lookup_exports, {
38729
+ __export2(lookup_exports, {
38676
38730
  clearCachedCliInvocation: () => clearCachedCliInvocation,
38677
38731
  clearVercelCliLookupCache: () => clearVercelCliLookupCache2,
38678
38732
  findVercelCli: () => findVercelCli2,
@@ -39118,7 +39172,7 @@ var require_exec = __commonJS({
39118
39172
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
39119
39173
  var __getProtoOf2 = Object.getPrototypeOf;
39120
39174
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
39121
- var __export = (target, all) => {
39175
+ var __export2 = (target, all) => {
39122
39176
  for (var name in all)
39123
39177
  __defProp2(target, name, { get: all[name], enumerable: true });
39124
39178
  };
@@ -39140,7 +39194,7 @@ var require_exec = __commonJS({
39140
39194
  ));
39141
39195
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
39142
39196
  var exec_exports = {};
39143
- __export(exec_exports, {
39197
+ __export2(exec_exports, {
39144
39198
  execVercelCli: () => execVercelCli2
39145
39199
  });
39146
39200
  module2.exports = __toCommonJS(exec_exports);
@@ -39231,7 +39285,7 @@ var require_dist2 = __commonJS({
39231
39285
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
39232
39286
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
39233
39287
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
39234
- var __export = (target, all) => {
39288
+ var __export2 = (target, all) => {
39235
39289
  for (var name in all)
39236
39290
  __defProp2(target, name, { get: all[name], enumerable: true });
39237
39291
  };
@@ -39245,7 +39299,7 @@ var require_dist2 = __commonJS({
39245
39299
  };
39246
39300
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
39247
39301
  var src_exports = {};
39248
- __export(src_exports, {
39302
+ __export2(src_exports, {
39249
39303
  VercelCliError: () => import_errors.VercelCliError,
39250
39304
  clearVercelCliLookupCache: () => import_lookup.clearVercelCliLookupCache,
39251
39305
  execVercelCli: () => import_exec.execVercelCli,
@@ -39515,10 +39569,10 @@ var require_util = __commonJS({
39515
39569
  function cloneDef(schema) {
39516
39570
  return mergeDefs(schema._zod.def);
39517
39571
  }
39518
- function getElementAtPath(obj, path3) {
39519
- if (!path3)
39572
+ function getElementAtPath(obj, path4) {
39573
+ if (!path4)
39520
39574
  return obj;
39521
- return path3.reduce((acc, key) => acc?.[key], obj);
39575
+ return path4.reduce((acc, key) => acc?.[key], obj);
39522
39576
  }
39523
39577
  function promiseAllObject(promisesObj) {
39524
39578
  const keys = Object.keys(promisesObj);
@@ -39880,11 +39934,11 @@ var require_util = __commonJS({
39880
39934
  }
39881
39935
  return false;
39882
39936
  }
39883
- function prefixIssues(path3, issues) {
39937
+ function prefixIssues(path4, issues) {
39884
39938
  return issues.map((iss) => {
39885
39939
  var _a;
39886
39940
  (_a = iss).path ?? (_a.path = []);
39887
- iss.path.unshift(path3);
39941
+ iss.path.unshift(path4);
39888
39942
  return iss;
39889
39943
  });
39890
39944
  }
@@ -40094,7 +40148,7 @@ var require_errors2 = __commonJS({
40094
40148
  return issue.message;
40095
40149
  };
40096
40150
  const result = { errors: [] };
40097
- const processError = (error2, path3 = []) => {
40151
+ const processError = (error2, path4 = []) => {
40098
40152
  var _a, _b;
40099
40153
  for (const issue of error2.issues) {
40100
40154
  if (issue.code === "invalid_union" && issue.errors.length) {
@@ -40104,7 +40158,7 @@ var require_errors2 = __commonJS({
40104
40158
  } else if (issue.code === "invalid_element") {
40105
40159
  processError({ issues: issue.issues }, issue.path);
40106
40160
  } else {
40107
- const fullpath = [...path3, ...issue.path];
40161
+ const fullpath = [...path4, ...issue.path];
40108
40162
  if (fullpath.length === 0) {
40109
40163
  result.errors.push(mapper(issue));
40110
40164
  continue;
@@ -40136,8 +40190,8 @@ var require_errors2 = __commonJS({
40136
40190
  }
40137
40191
  function toDotPath(_path) {
40138
40192
  const segs = [];
40139
- const path3 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
40140
- for (const seg of path3) {
40193
+ const path4 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
40194
+ for (const seg of path4) {
40141
40195
  if (typeof seg === "number")
40142
40196
  segs.push(`[${seg}]`);
40143
40197
  else if (typeof seg === "symbol")
@@ -53981,27 +54035,27 @@ var require_schema = __commonJS({
53981
54035
  var require_lib5 = __commonJS({
53982
54036
  "../../node_modules/os-paths/src/lib/index.js"(exports2, module2) {
53983
54037
  "use strict";
53984
- var os4 = require("os");
54038
+ var os5 = require("os");
53985
54039
  var paths = require("path");
53986
54040
  var isWinOS = /^win/i.test(process.platform);
53987
- function normalize_path(path3) {
53988
- return paths.normalize(paths.join(path3, "."));
54041
+ function normalize_path(path4) {
54042
+ return paths.normalize(paths.join(path4, "."));
53989
54043
  }
53990
54044
  var base = () => {
53991
54045
  const { env } = process;
53992
54046
  const object = {};
53993
- object.home = () => normalize_path(os4.homedir ? os4.homedir() : env.HOME);
53994
- object.temp = () => normalize_path(os4.tmpdir ? os4.tmpdir() : env.TMPDIR || env.TEMP || env.TMP);
54047
+ object.home = () => normalize_path(os5.homedir ? os5.homedir() : env.HOME);
54048
+ object.temp = () => normalize_path(os5.tmpdir ? os5.tmpdir() : env.TMPDIR || env.TEMP || env.TMP);
53995
54049
  return object;
53996
54050
  };
53997
54051
  var windows = () => {
53998
54052
  const { env } = process;
53999
54053
  const object = {};
54000
54054
  object.home = () => normalize_path(
54001
- os4.homedir ? os4.homedir() : env.USERPROFILE || paths.join(env.HOMEDRIVE, env.HOMEPATH) || env.HOME
54055
+ os5.homedir ? os5.homedir() : env.USERPROFILE || paths.join(env.HOMEDRIVE, env.HOMEPATH) || env.HOME
54002
54056
  );
54003
54057
  object.temp = () => normalize_path(
54004
- os4.tmpdir ? os4.tmpdir() : env.TEMP || env.TMP || paths.join(env.LOCALAPPDATA || env.SystemRoot || env.windir, "Temp")
54058
+ os5.tmpdir ? os5.tmpdir() : env.TEMP || env.TMP || paths.join(env.LOCALAPPDATA || env.SystemRoot || env.windir, "Temp")
54005
54059
  );
54006
54060
  return object;
54007
54061
  };
@@ -54026,44 +54080,44 @@ var require_lib5 = __commonJS({
54026
54080
  var require_lib6 = __commonJS({
54027
54081
  "../../node_modules/xdg-portable/src/lib/index.js"(exports2, module2) {
54028
54082
  "use strict";
54029
- var path3 = require("path");
54083
+ var path4 = require("path");
54030
54084
  var osPaths = require_lib5();
54031
54085
  var linux = () => {
54032
54086
  const object = {};
54033
- object.cache = () => process.env.XDG_CACHE_HOME || path3.join(osPaths.home() || osPaths.temp(), ".cache");
54034
- object.config = () => process.env.XDG_CONFIG_HOME || path3.join(osPaths.home() || osPaths.temp(), ".config");
54035
- object.data = () => process.env.XDG_DATA_HOME || path3.join(osPaths.home() || osPaths.temp(), ".local", "share");
54087
+ object.cache = () => process.env.XDG_CACHE_HOME || path4.join(osPaths.home() || osPaths.temp(), ".cache");
54088
+ object.config = () => process.env.XDG_CONFIG_HOME || path4.join(osPaths.home() || osPaths.temp(), ".config");
54089
+ object.data = () => process.env.XDG_DATA_HOME || path4.join(osPaths.home() || osPaths.temp(), ".local", "share");
54036
54090
  object.runtime = () => process.env.XDG_RUNTIME_DIR || void 0;
54037
- object.state = () => process.env.XDG_STATE_HOME || path3.join(osPaths.home() || osPaths.temp(), ".local", "state");
54091
+ object.state = () => process.env.XDG_STATE_HOME || path4.join(osPaths.home() || osPaths.temp(), ".local", "state");
54038
54092
  return object;
54039
54093
  };
54040
54094
  var macos = () => {
54041
54095
  const object = {};
54042
- object.cache = () => process.env.XDG_CACHE_HOME || path3.join(path3.join(osPaths.home() || osPaths.temp(), "Library"), "Caches");
54043
- object.config = () => process.env.XDG_CONFIG_HOME || path3.join(path3.join(osPaths.home() || osPaths.temp(), "Library"), "Preferences");
54044
- object.data = () => process.env.XDG_DATA_HOME || path3.join(path3.join(osPaths.home() || osPaths.temp(), "Library"), "Application Support");
54096
+ object.cache = () => process.env.XDG_CACHE_HOME || path4.join(path4.join(osPaths.home() || osPaths.temp(), "Library"), "Caches");
54097
+ object.config = () => process.env.XDG_CONFIG_HOME || path4.join(path4.join(osPaths.home() || osPaths.temp(), "Library"), "Preferences");
54098
+ object.data = () => process.env.XDG_DATA_HOME || path4.join(path4.join(osPaths.home() || osPaths.temp(), "Library"), "Application Support");
54045
54099
  object.runtime = () => process.env.XDG_RUNTIME_DIR || void 0;
54046
- object.state = () => process.env.XDG_STATE_HOME || path3.join(path3.join(osPaths.home() || osPaths.temp(), "Library"), "State");
54100
+ object.state = () => process.env.XDG_STATE_HOME || path4.join(path4.join(osPaths.home() || osPaths.temp(), "Library"), "State");
54047
54101
  return object;
54048
54102
  };
54049
54103
  var windows = () => {
54050
54104
  const object = {};
54051
54105
  object.cache = () => {
54052
- const localAppData = process.env.LOCALAPPDATA || path3.join(osPaths.home() || osPaths.temp(), "AppData", "Local");
54053
- return process.env.XDG_CACHE_HOME || path3.join(localAppData, "xdg.cache");
54106
+ const localAppData = process.env.LOCALAPPDATA || path4.join(osPaths.home() || osPaths.temp(), "AppData", "Local");
54107
+ return process.env.XDG_CACHE_HOME || path4.join(localAppData, "xdg.cache");
54054
54108
  };
54055
54109
  object.config = () => {
54056
- const appData = process.env.APPDATA || path3.join(osPaths.home() || osPaths.temp(), "AppData", "Roaming");
54057
- return process.env.XDG_CONFIG_HOME || path3.join(appData, "xdg.config");
54110
+ const appData = process.env.APPDATA || path4.join(osPaths.home() || osPaths.temp(), "AppData", "Roaming");
54111
+ return process.env.XDG_CONFIG_HOME || path4.join(appData, "xdg.config");
54058
54112
  };
54059
54113
  object.data = () => {
54060
- const appData = process.env.APPDATA || path3.join(osPaths.home() || osPaths.temp(), "AppData", "Roaming");
54061
- return process.env.XDG_DATA_HOME || path3.join(appData, "xdg.data");
54114
+ const appData = process.env.APPDATA || path4.join(osPaths.home() || osPaths.temp(), "AppData", "Roaming");
54115
+ return process.env.XDG_DATA_HOME || path4.join(appData, "xdg.data");
54062
54116
  };
54063
54117
  object.runtime = () => process.env.XDG_RUNTIME_DIR || void 0;
54064
54118
  object.state = () => {
54065
- const localAppData = process.env.LOCALAPPDATA || path3.join(osPaths.home() || osPaths.temp(), "AppData", "Local");
54066
- return process.env.XDG_STATE_HOME || path3.join(localAppData, "xdg.state");
54119
+ const localAppData = process.env.LOCALAPPDATA || path4.join(osPaths.home() || osPaths.temp(), "AppData", "Local");
54120
+ return process.env.XDG_STATE_HOME || path4.join(localAppData, "xdg.state");
54067
54121
  };
54068
54122
  return object;
54069
54123
  };
@@ -54083,7 +54137,7 @@ var require_lib6 = __commonJS({
54083
54137
  const dirs = [];
54084
54138
  dirs.push(extension.config());
54085
54139
  if (process.env.XDG_CONFIG_DIRS) {
54086
- dirs.push(...process.env.XDG_CONFIG_DIRS.split(path3.delimiter));
54140
+ dirs.push(...process.env.XDG_CONFIG_DIRS.split(path4.delimiter));
54087
54141
  }
54088
54142
  return dirs;
54089
54143
  };
@@ -54091,7 +54145,7 @@ var require_lib6 = __commonJS({
54091
54145
  const dirs = [];
54092
54146
  dirs.push(extension.data());
54093
54147
  if (process.env.XDG_DATA_DIRS) {
54094
- dirs.push(...process.env.XDG_DATA_DIRS.split(path3.delimiter));
54148
+ dirs.push(...process.env.XDG_DATA_DIRS.split(path4.delimiter));
54095
54149
  }
54096
54150
  return dirs;
54097
54151
  };
@@ -54108,7 +54162,7 @@ var require_lib6 = __commonJS({
54108
54162
  var require_lib7 = __commonJS({
54109
54163
  "../../node_modules/xdg-app-paths/src/lib/index.js"(exports2, module2) {
54110
54164
  "use strict";
54111
- var path3 = require("path");
54165
+ var path4 = require("path");
54112
54166
  var xdg = require_lib6();
54113
54167
  function normalizeOptions_(options, isolated) {
54114
54168
  if (!isObject(options)) {
@@ -54160,38 +54214,38 @@ var require_lib7 = __commonJS({
54160
54214
  throw new TypeError(`Expected string for "name" argument, got ${typeOf(name_)}`);
54161
54215
  }
54162
54216
  if (!name_) {
54163
- name_ = path3.parse(require.main && require.main.filename || process.execPath).name;
54217
+ name_ = path4.parse(require.main && require.main.filename || process.execPath).name;
54164
54218
  }
54165
54219
  name_ += suffix_ || "";
54166
54220
  XDGAppPaths.$name = () => name_;
54167
54221
  XDGAppPaths.$isolated = () => isolated_;
54168
54222
  XDGAppPaths.cache = (dirOptions = null) => {
54169
54223
  dirOptions = normalizeOptions_(dirOptions, isolated_);
54170
- return path3.join(xdg.cache(), dirOptions.isolated ? name_ : "");
54224
+ return path4.join(xdg.cache(), dirOptions.isolated ? name_ : "");
54171
54225
  };
54172
54226
  XDGAppPaths.config = function(dirOptions = null) {
54173
54227
  dirOptions = normalizeOptions_(dirOptions, isolated_);
54174
- return path3.join(xdg.config(), dirOptions.isolated ? name_ : "");
54228
+ return path4.join(xdg.config(), dirOptions.isolated ? name_ : "");
54175
54229
  };
54176
54230
  XDGAppPaths.data = function(dirOptions = null) {
54177
54231
  dirOptions = normalizeOptions_(dirOptions, isolated_);
54178
- return path3.join(xdg.data(), dirOptions.isolated ? name_ : "");
54232
+ return path4.join(xdg.data(), dirOptions.isolated ? name_ : "");
54179
54233
  };
54180
54234
  XDGAppPaths.runtime = function(dirOptions = null) {
54181
54235
  dirOptions = normalizeOptions_(dirOptions, isolated_);
54182
- return xdg.runtime() ? path3.join(xdg.runtime(), dirOptions.isolated ? name_ : "") : void 0;
54236
+ return xdg.runtime() ? path4.join(xdg.runtime(), dirOptions.isolated ? name_ : "") : void 0;
54183
54237
  };
54184
54238
  XDGAppPaths.state = function(dirOptions = null) {
54185
54239
  dirOptions = normalizeOptions_(dirOptions, isolated_);
54186
- return path3.join(xdg.state(), dirOptions.isolated ? name_ : "");
54240
+ return path4.join(xdg.state(), dirOptions.isolated ? name_ : "");
54187
54241
  };
54188
54242
  XDGAppPaths.configDirs = function(dirOptions = null) {
54189
54243
  dirOptions = normalizeOptions_(dirOptions, isolated_);
54190
- return xdg.configDirs().map((s) => path3.join(s, dirOptions.isolated ? name_ : ""));
54244
+ return xdg.configDirs().map((s) => path4.join(s, dirOptions.isolated ? name_ : ""));
54191
54245
  };
54192
54246
  XDGAppPaths.dataDirs = function(dirOptions = null) {
54193
54247
  dirOptions = normalizeOptions_(dirOptions, isolated_);
54194
- return xdg.dataDirs().map((s) => path3.join(s, dirOptions.isolated ? name_ : ""));
54248
+ return xdg.dataDirs().map((s) => path4.join(s, dirOptions.isolated ? name_ : ""));
54195
54249
  };
54196
54250
  this.fn = XDGAppPaths;
54197
54251
  }
@@ -54485,7 +54539,7 @@ var require_token_io = __commonJS({
54485
54539
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
54486
54540
  var __getProtoOf2 = Object.getPrototypeOf;
54487
54541
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
54488
- var __export = (target, all) => {
54542
+ var __export2 = (target, all) => {
54489
54543
  for (var name in all)
54490
54544
  __defProp2(target, name, { get: all[name], enumerable: true });
54491
54545
  };
@@ -54507,24 +54561,24 @@ var require_token_io = __commonJS({
54507
54561
  ));
54508
54562
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
54509
54563
  var token_io_exports = {};
54510
- __export(token_io_exports, {
54564
+ __export2(token_io_exports, {
54511
54565
  findRootDir: () => findRootDir,
54512
54566
  getUserDataDir: () => getUserDataDir
54513
54567
  });
54514
54568
  module2.exports = __toCommonJS(token_io_exports);
54515
- var import_path3 = __toESM2(require("path"));
54516
- var import_fs3 = __toESM2(require("fs"));
54517
- var import_os4 = __toESM2(require("os"));
54569
+ var import_path4 = __toESM2(require("path"));
54570
+ var import_fs4 = __toESM2(require("fs"));
54571
+ var import_os5 = __toESM2(require("os"));
54518
54572
  var import_token_error = require_token_error();
54519
54573
  function findRootDir() {
54520
54574
  try {
54521
54575
  let dir = process.cwd();
54522
- while (dir !== import_path3.default.dirname(dir)) {
54523
- const pkgPath = import_path3.default.join(dir, ".vercel");
54524
- if (import_fs3.default.existsSync(pkgPath)) {
54576
+ while (dir !== import_path4.default.dirname(dir)) {
54577
+ const pkgPath = import_path4.default.join(dir, ".vercel");
54578
+ if (import_fs4.default.existsSync(pkgPath)) {
54525
54579
  return dir;
54526
54580
  }
54527
- dir = import_path3.default.dirname(dir);
54581
+ dir = import_path4.default.dirname(dir);
54528
54582
  }
54529
54583
  } catch (_e) {
54530
54584
  throw new import_token_error.VercelOidcTokenError(
@@ -54537,11 +54591,11 @@ var require_token_io = __commonJS({
54537
54591
  if (process.env.XDG_DATA_HOME) {
54538
54592
  return process.env.XDG_DATA_HOME;
54539
54593
  }
54540
- switch (import_os4.default.platform()) {
54594
+ switch (import_os5.default.platform()) {
54541
54595
  case "darwin":
54542
- return import_path3.default.join(import_os4.default.homedir(), "Library/Application Support");
54596
+ return import_path4.default.join(import_os5.default.homedir(), "Library/Application Support");
54543
54597
  case "linux":
54544
- return import_path3.default.join(import_os4.default.homedir(), ".local/share");
54598
+ return import_path4.default.join(import_os5.default.homedir(), ".local/share");
54545
54599
  case "win32":
54546
54600
  if (process.env.LOCALAPPDATA) {
54547
54601
  return process.env.LOCALAPPDATA;
@@ -54562,7 +54616,7 @@ var require_oauth = __commonJS({
54562
54616
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
54563
54617
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
54564
54618
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
54565
- var __export = (target, all) => {
54619
+ var __export2 = (target, all) => {
54566
54620
  for (var name in all)
54567
54621
  __defProp2(target, name, { get: all[name], enumerable: true });
54568
54622
  };
@@ -54576,15 +54630,15 @@ var require_oauth = __commonJS({
54576
54630
  };
54577
54631
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
54578
54632
  var oauth_exports = {};
54579
- __export(oauth_exports, {
54633
+ __export2(oauth_exports, {
54580
54634
  processTokenResponse: () => processTokenResponse,
54581
54635
  refreshTokenRequest: () => refreshTokenRequest
54582
54636
  });
54583
54637
  module2.exports = __toCommonJS(oauth_exports);
54584
- var import_os4 = require("os");
54638
+ var import_os5 = require("os");
54585
54639
  var VERCEL_ISSUER = "https://vercel.com";
54586
54640
  var VERCEL_CLI_CLIENT_ID = "cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp";
54587
- var userAgent = `@vercel/oidc node-${process.version} ${(0, import_os4.platform)()} (${(0, import_os4.arch)()}) ${(0, import_os4.hostname)()}`;
54641
+ var userAgent = `@vercel/oidc node-${process.version} ${(0, import_os5.platform)()} (${(0, import_os5.arch)()}) ${(0, import_os5.hostname)()}`;
54588
54642
  var _tokenEndpoint = null;
54589
54643
  async function getTokenEndpoint() {
54590
54644
  if (_tokenEndpoint) {
@@ -54651,7 +54705,7 @@ var require_auth_errors = __commonJS({
54651
54705
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
54652
54706
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
54653
54707
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
54654
- var __export = (target, all) => {
54708
+ var __export2 = (target, all) => {
54655
54709
  for (var name in all)
54656
54710
  __defProp2(target, name, { get: all[name], enumerable: true });
54657
54711
  };
@@ -54665,7 +54719,7 @@ var require_auth_errors = __commonJS({
54665
54719
  };
54666
54720
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
54667
54721
  var auth_errors_exports = {};
54668
- __export(auth_errors_exports, {
54722
+ __export2(auth_errors_exports, {
54669
54723
  AccessTokenMissingError: () => AccessTokenMissingError2,
54670
54724
  RefreshAccessTokenFailedError: () => RefreshAccessTokenFailedError2
54671
54725
  });
@@ -54700,7 +54754,7 @@ var require_token_util = __commonJS({
54700
54754
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
54701
54755
  var __getProtoOf2 = Object.getPrototypeOf;
54702
54756
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
54703
- var __export = (target, all) => {
54757
+ var __export2 = (target, all) => {
54704
54758
  for (var name in all)
54705
54759
  __defProp2(target, name, { get: all[name], enumerable: true });
54706
54760
  };
@@ -54722,7 +54776,7 @@ var require_token_util = __commonJS({
54722
54776
  ));
54723
54777
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
54724
54778
  var token_util_exports = {};
54725
- __export(token_util_exports, {
54779
+ __export2(token_util_exports, {
54726
54780
  assertVercelOidcTokenResponse: () => assertVercelOidcTokenResponse,
54727
54781
  findProjectInfo: () => findProjectInfo,
54728
54782
  getTokenPayload: () => getTokenPayload,
@@ -54734,8 +54788,8 @@ var require_token_util = __commonJS({
54734
54788
  saveToken: () => saveToken
54735
54789
  });
54736
54790
  module2.exports = __toCommonJS(token_util_exports);
54737
- var path3 = __toESM2(require("path"));
54738
- var fs3 = __toESM2(require("fs"));
54791
+ var path4 = __toESM2(require("path"));
54792
+ var fs4 = __toESM2(require("fs"));
54739
54793
  var import_cli_exec = require_dist2();
54740
54794
  var import_cli_config = require_dist3();
54741
54795
  var import_token_error = require_token_error();
@@ -54859,13 +54913,13 @@ ${stderr}`.trim();
54859
54913
  "Unable to find project root directory. Have you linked your project with `vc link?`"
54860
54914
  );
54861
54915
  }
54862
- const prjPath = path3.join(dir, ".vercel", "project.json");
54863
- if (!fs3.existsSync(prjPath)) {
54916
+ const prjPath = path4.join(dir, ".vercel", "project.json");
54917
+ if (!fs4.existsSync(prjPath)) {
54864
54918
  throw new import_token_error.VercelOidcTokenError(
54865
54919
  "project.json not found, have you linked your project with `vc link?`"
54866
54920
  );
54867
54921
  }
54868
- const prj = JSON.parse(fs3.readFileSync(prjPath, "utf8"));
54922
+ const prj = JSON.parse(fs4.readFileSync(prjPath, "utf8"));
54869
54923
  if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
54870
54924
  throw new TypeError(
54871
54925
  "Expected a string-valued projectId property. Try running `vc link` to re-link your project."
@@ -54880,11 +54934,11 @@ ${stderr}`.trim();
54880
54934
  "Unable to find user data directory. Please reach out to Vercel support."
54881
54935
  );
54882
54936
  }
54883
- const tokenPath = path3.join(dir, "com.vercel.token", `${projectId}.json`);
54937
+ const tokenPath = path4.join(dir, "com.vercel.token", `${projectId}.json`);
54884
54938
  const tokenJson = JSON.stringify(token);
54885
- fs3.mkdirSync(path3.dirname(tokenPath), { mode: 504, recursive: true });
54886
- fs3.writeFileSync(tokenPath, tokenJson);
54887
- fs3.chmodSync(tokenPath, 432);
54939
+ fs4.mkdirSync(path4.dirname(tokenPath), { mode: 504, recursive: true });
54940
+ fs4.writeFileSync(tokenPath, tokenJson);
54941
+ fs4.chmodSync(tokenPath, 432);
54888
54942
  return;
54889
54943
  }
54890
54944
  function loadToken(projectId) {
@@ -54894,11 +54948,11 @@ ${stderr}`.trim();
54894
54948
  "Unable to find user data directory. Please reach out to Vercel support."
54895
54949
  );
54896
54950
  }
54897
- const tokenPath = path3.join(dir, "com.vercel.token", `${projectId}.json`);
54898
- if (!fs3.existsSync(tokenPath)) {
54951
+ const tokenPath = path4.join(dir, "com.vercel.token", `${projectId}.json`);
54952
+ if (!fs4.existsSync(tokenPath)) {
54899
54953
  return null;
54900
54954
  }
54901
- const token = JSON.parse(fs3.readFileSync(tokenPath, "utf8"));
54955
+ const token = JSON.parse(fs4.readFileSync(tokenPath, "utf8"));
54902
54956
  assertVercelOidcTokenResponse(token);
54903
54957
  return token;
54904
54958
  }
@@ -54928,7 +54982,7 @@ var require_token = __commonJS({
54928
54982
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
54929
54983
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
54930
54984
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
54931
- var __export = (target, all) => {
54985
+ var __export2 = (target, all) => {
54932
54986
  for (var name in all)
54933
54987
  __defProp2(target, name, { get: all[name], enumerable: true });
54934
54988
  };
@@ -54942,7 +54996,7 @@ var require_token = __commonJS({
54942
54996
  };
54943
54997
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
54944
54998
  var token_exports = {};
54945
- __export(token_exports, {
54999
+ __export2(token_exports, {
54946
55000
  refreshToken: () => refreshToken
54947
55001
  });
54948
55002
  module2.exports = __toCommonJS(token_exports);
@@ -54996,7 +55050,7 @@ var require_get_vercel_oidc_token_with_refresh = __commonJS({
54996
55050
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
54997
55051
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
54998
55052
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
54999
- var __export = (target, all) => {
55053
+ var __export2 = (target, all) => {
55000
55054
  for (var name in all)
55001
55055
  __defProp2(target, name, { get: all[name], enumerable: true });
55002
55056
  };
@@ -55010,7 +55064,7 @@ var require_get_vercel_oidc_token_with_refresh = __commonJS({
55010
55064
  };
55011
55065
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
55012
55066
  var get_vercel_oidc_token_with_refresh_exports = {};
55013
- __export(get_vercel_oidc_token_with_refresh_exports, {
55067
+ __export2(get_vercel_oidc_token_with_refresh_exports, {
55014
55068
  getVercelOidcToken: () => getVercelOidcToken2
55015
55069
  });
55016
55070
  module2.exports = __toCommonJS(get_vercel_oidc_token_with_refresh_exports);
@@ -59484,7 +59538,7 @@ var require_verify_vercel_oidc_token = __commonJS({
59484
59538
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
59485
59539
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
59486
59540
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
59487
- var __export = (target, all) => {
59541
+ var __export2 = (target, all) => {
59488
59542
  for (var name in all)
59489
59543
  __defProp2(target, name, { get: all[name], enumerable: true });
59490
59544
  };
@@ -59498,7 +59552,7 @@ var require_verify_vercel_oidc_token = __commonJS({
59498
59552
  };
59499
59553
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
59500
59554
  var verify_vercel_oidc_token_exports = {};
59501
- __export(verify_vercel_oidc_token_exports, {
59555
+ __export2(verify_vercel_oidc_token_exports, {
59502
59556
  verifyVercelOidcToken: () => verifyVercelOidcToken2
59503
59557
  });
59504
59558
  module2.exports = __toCommonJS(verify_vercel_oidc_token_exports);
@@ -59607,7 +59661,7 @@ var require_dist4 = __commonJS({
59607
59661
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
59608
59662
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
59609
59663
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
59610
- var __export = (target, all) => {
59664
+ var __export2 = (target, all) => {
59611
59665
  for (var name in all)
59612
59666
  __defProp2(target, name, { get: all[name], enumerable: true });
59613
59667
  };
@@ -59621,7 +59675,7 @@ var require_dist4 = __commonJS({
59621
59675
  };
59622
59676
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
59623
59677
  var src_exports = {};
59624
- __export(src_exports, {
59678
+ __export2(src_exports, {
59625
59679
  AccessTokenMissingError: () => import_auth_errors.AccessTokenMissingError,
59626
59680
  RefreshAccessTokenFailedError: () => import_auth_errors.RefreshAccessTokenFailedError,
59627
59681
  exchangeVercelOidcToken: () => import_exchange_vercel_oidc_token.exchangeVercelOidcToken,
@@ -59875,7 +59929,7 @@ var require_lib8 = __commonJS({
59875
59929
  "../../node_modules/async-retry/lib/index.js"(exports2, module2) {
59876
59930
  var retrier = require_retry2();
59877
59931
  function retry(fn, opts) {
59878
- function run(resolve, reject) {
59932
+ function run2(resolve, reject) {
59879
59933
  var options = opts || {};
59880
59934
  var op;
59881
59935
  if (!("randomize" in options)) {
@@ -59910,7 +59964,7 @@ var require_lib8 = __commonJS({
59910
59964
  }
59911
59965
  op.attempt(runAttempt);
59912
59966
  }
59913
- return new Promise(run);
59967
+ return new Promise(run2);
59914
59968
  }
59915
59969
  module2.exports = retry;
59916
59970
  }
@@ -60718,14 +60772,14 @@ var require_util2 = __commonJS({
60718
60772
  }
60719
60773
  const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
60720
60774
  let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
60721
- let path3 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
60775
+ let path4 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
60722
60776
  if (origin[origin.length - 1] === "/") {
60723
60777
  origin = origin.slice(0, origin.length - 1);
60724
60778
  }
60725
- if (path3 && path3[0] !== "/") {
60726
- path3 = `/${path3}`;
60779
+ if (path4 && path4[0] !== "/") {
60780
+ path4 = `/${path4}`;
60727
60781
  }
60728
- return new URL(`${origin}${path3}`);
60782
+ return new URL(`${origin}${path4}`);
60729
60783
  }
60730
60784
  if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
60731
60785
  throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
@@ -61176,39 +61230,39 @@ var require_diagnostics = __commonJS({
61176
61230
  });
61177
61231
  diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
61178
61232
  const {
61179
- request: { method, path: path3, origin }
61233
+ request: { method, path: path4, origin }
61180
61234
  } = evt;
61181
- debuglog("sending request to %s %s/%s", method, origin, path3);
61235
+ debuglog("sending request to %s %s/%s", method, origin, path4);
61182
61236
  });
61183
61237
  diagnosticsChannel.channel("undici:request:headers").subscribe((evt) => {
61184
61238
  const {
61185
- request: { method, path: path3, origin },
61239
+ request: { method, path: path4, origin },
61186
61240
  response: { statusCode }
61187
61241
  } = evt;
61188
61242
  debuglog(
61189
61243
  "received response to %s %s/%s - HTTP %d",
61190
61244
  method,
61191
61245
  origin,
61192
- path3,
61246
+ path4,
61193
61247
  statusCode
61194
61248
  );
61195
61249
  });
61196
61250
  diagnosticsChannel.channel("undici:request:trailers").subscribe((evt) => {
61197
61251
  const {
61198
- request: { method, path: path3, origin }
61252
+ request: { method, path: path4, origin }
61199
61253
  } = evt;
61200
- debuglog("trailers received from %s %s/%s", method, origin, path3);
61254
+ debuglog("trailers received from %s %s/%s", method, origin, path4);
61201
61255
  });
61202
61256
  diagnosticsChannel.channel("undici:request:error").subscribe((evt) => {
61203
61257
  const {
61204
- request: { method, path: path3, origin },
61258
+ request: { method, path: path4, origin },
61205
61259
  error
61206
61260
  } = evt;
61207
61261
  debuglog(
61208
61262
  "request to %s %s/%s errored - %s",
61209
61263
  method,
61210
61264
  origin,
61211
- path3,
61265
+ path4,
61212
61266
  error.message
61213
61267
  );
61214
61268
  });
@@ -61257,9 +61311,9 @@ var require_diagnostics = __commonJS({
61257
61311
  });
61258
61312
  diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
61259
61313
  const {
61260
- request: { method, path: path3, origin }
61314
+ request: { method, path: path4, origin }
61261
61315
  } = evt;
61262
- debuglog("sending request to %s %s/%s", method, origin, path3);
61316
+ debuglog("sending request to %s %s/%s", method, origin, path4);
61263
61317
  });
61264
61318
  }
61265
61319
  diagnosticsChannel.channel("undici:websocket:open").subscribe((evt) => {
@@ -61322,7 +61376,7 @@ var require_request = __commonJS({
61322
61376
  var kHandler = Symbol("handler");
61323
61377
  var Request2 = class {
61324
61378
  constructor(origin, {
61325
- path: path3,
61379
+ path: path4,
61326
61380
  method,
61327
61381
  body,
61328
61382
  headers,
@@ -61337,11 +61391,11 @@ var require_request = __commonJS({
61337
61391
  expectContinue,
61338
61392
  servername
61339
61393
  }, handler) {
61340
- if (typeof path3 !== "string") {
61394
+ if (typeof path4 !== "string") {
61341
61395
  throw new InvalidArgumentError("path must be a string");
61342
- } else if (path3[0] !== "/" && !(path3.startsWith("http://") || path3.startsWith("https://")) && method !== "CONNECT") {
61396
+ } else if (path4[0] !== "/" && !(path4.startsWith("http://") || path4.startsWith("https://")) && method !== "CONNECT") {
61343
61397
  throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
61344
- } else if (invalidPathRegex.test(path3)) {
61398
+ } else if (invalidPathRegex.test(path4)) {
61345
61399
  throw new InvalidArgumentError("invalid request path");
61346
61400
  }
61347
61401
  if (typeof method !== "string") {
@@ -61407,7 +61461,7 @@ var require_request = __commonJS({
61407
61461
  this.completed = false;
61408
61462
  this.aborted = false;
61409
61463
  this.upgrade = upgrade || null;
61410
- this.path = query ? buildURL(path3, query) : path3;
61464
+ this.path = query ? buildURL(path4, query) : path4;
61411
61465
  this.origin = origin;
61412
61466
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
61413
61467
  this.blocking = blocking == null ? false : blocking;
@@ -66029,7 +66083,7 @@ var require_client_h1 = __commonJS({
66029
66083
  return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
66030
66084
  }
66031
66085
  function writeH1(client, request) {
66032
- const { method, path: path3, host, upgrade, blocking, reset } = request;
66086
+ const { method, path: path4, host, upgrade, blocking, reset } = request;
66033
66087
  let { body, headers, contentLength } = request;
66034
66088
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
66035
66089
  if (util.isFormDataLike(body)) {
@@ -66096,7 +66150,7 @@ var require_client_h1 = __commonJS({
66096
66150
  if (blocking) {
66097
66151
  socket[kBlocking] = true;
66098
66152
  }
66099
- let header = `${method} ${path3} HTTP/1.1\r
66153
+ let header = `${method} ${path4} HTTP/1.1\r
66100
66154
  `;
66101
66155
  if (typeof host === "string") {
66102
66156
  header += `host: ${host}\r
@@ -66622,7 +66676,7 @@ var require_client_h2 = __commonJS({
66622
66676
  }
66623
66677
  function writeH2(client, request) {
66624
66678
  const session = client[kHTTP2Session];
66625
- const { method, path: path3, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
66679
+ const { method, path: path4, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
66626
66680
  let { body } = request;
66627
66681
  if (upgrade) {
66628
66682
  util.errorRequest(client, request, new Error("Upgrade not supported for H2"));
@@ -66689,7 +66743,7 @@ var require_client_h2 = __commonJS({
66689
66743
  });
66690
66744
  return true;
66691
66745
  }
66692
- headers[HTTP2_HEADER_PATH] = path3;
66746
+ headers[HTTP2_HEADER_PATH] = path4;
66693
66747
  headers[HTTP2_HEADER_SCHEME] = "https";
66694
66748
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
66695
66749
  if (body && typeof body.read === "function") {
@@ -67042,9 +67096,9 @@ var require_redirect_handler = __commonJS({
67042
67096
  return this.handler.onHeaders(statusCode, headers, resume, statusText);
67043
67097
  }
67044
67098
  const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
67045
- const path3 = search ? `${pathname}${search}` : pathname;
67099
+ const path4 = search ? `${pathname}${search}` : pathname;
67046
67100
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
67047
- this.opts.path = path3;
67101
+ this.opts.path = path4;
67048
67102
  this.opts.origin = origin;
67049
67103
  this.opts.maxRedirections = 0;
67050
67104
  this.opts.query = null;
@@ -68279,10 +68333,10 @@ var require_proxy_agent = __commonJS({
68279
68333
  };
68280
68334
  const {
68281
68335
  origin,
68282
- path: path3 = "/",
68336
+ path: path4 = "/",
68283
68337
  headers = {}
68284
68338
  } = opts;
68285
- opts.path = origin + path3;
68339
+ opts.path = origin + path4;
68286
68340
  if (!("host" in headers) && !("Host" in headers)) {
68287
68341
  const { host } = new URL2(origin);
68288
68342
  headers.host = host;
@@ -70203,20 +70257,20 @@ var require_mock_utils = __commonJS({
70203
70257
  }
70204
70258
  return true;
70205
70259
  }
70206
- function safeUrl(path3) {
70207
- if (typeof path3 !== "string") {
70208
- return path3;
70260
+ function safeUrl(path4) {
70261
+ if (typeof path4 !== "string") {
70262
+ return path4;
70209
70263
  }
70210
- const pathSegments = path3.split("?");
70264
+ const pathSegments = path4.split("?");
70211
70265
  if (pathSegments.length !== 2) {
70212
- return path3;
70266
+ return path4;
70213
70267
  }
70214
70268
  const qp = new URLSearchParams(pathSegments.pop());
70215
70269
  qp.sort();
70216
70270
  return [...pathSegments, qp.toString()].join("?");
70217
70271
  }
70218
- function matchKey(mockDispatch2, { path: path3, method, body, headers }) {
70219
- const pathMatch = matchValue(mockDispatch2.path, path3);
70272
+ function matchKey(mockDispatch2, { path: path4, method, body, headers }) {
70273
+ const pathMatch = matchValue(mockDispatch2.path, path4);
70220
70274
  const methodMatch = matchValue(mockDispatch2.method, method);
70221
70275
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
70222
70276
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -70238,7 +70292,7 @@ var require_mock_utils = __commonJS({
70238
70292
  function getMockDispatch(mockDispatches, key) {
70239
70293
  const basePath = key.query ? buildURL(key.path, key.query) : key.path;
70240
70294
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
70241
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path3 }) => matchValue(safeUrl(path3), resolvedPath));
70295
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path4 }) => matchValue(safeUrl(path4), resolvedPath));
70242
70296
  if (matchedMockDispatches.length === 0) {
70243
70297
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
70244
70298
  }
@@ -70276,9 +70330,9 @@ var require_mock_utils = __commonJS({
70276
70330
  }
70277
70331
  }
70278
70332
  function buildKey(opts) {
70279
- const { path: path3, method, body, headers, query } = opts;
70333
+ const { path: path4, method, body, headers, query } = opts;
70280
70334
  return {
70281
- path: path3,
70335
+ path: path4,
70282
70336
  method,
70283
70337
  body,
70284
70338
  headers,
@@ -70741,10 +70795,10 @@ var require_pending_interceptors_formatter = __commonJS({
70741
70795
  }
70742
70796
  format(pendingInterceptors) {
70743
70797
  const withPrettyHeaders = pendingInterceptors.map(
70744
- ({ method, path: path3, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
70798
+ ({ method, path: path4, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
70745
70799
  Method: method,
70746
70800
  Origin: origin,
70747
- Path: path3,
70801
+ Path: path4,
70748
70802
  "Status code": statusCode,
70749
70803
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
70750
70804
  Invocations: timesInvoked,
@@ -75625,9 +75679,9 @@ var require_util7 = __commonJS({
75625
75679
  }
75626
75680
  }
75627
75681
  }
75628
- function validateCookiePath(path3) {
75629
- for (let i = 0; i < path3.length; ++i) {
75630
- const code = path3.charCodeAt(i);
75682
+ function validateCookiePath(path4) {
75683
+ for (let i = 0; i < path4.length; ++i) {
75684
+ const code = path4.charCodeAt(i);
75631
75685
  if (code < 32 || // exclude CTLs (0-31)
75632
75686
  code === 127 || // DEL
75633
75687
  code === 59) {
@@ -78320,11 +78374,11 @@ var require_undici = __commonJS({
78320
78374
  if (typeof opts.path !== "string") {
78321
78375
  throw new InvalidArgumentError("invalid opts.path");
78322
78376
  }
78323
- let path3 = opts.path;
78377
+ let path4 = opts.path;
78324
78378
  if (!opts.path.startsWith("/")) {
78325
- path3 = `/${path3}`;
78379
+ path4 = `/${path4}`;
78326
78380
  }
78327
- url = new URL(util.parseOrigin(url).origin + path3);
78381
+ url = new URL(util.parseOrigin(url).origin + path4);
78328
78382
  } else {
78329
78383
  if (!opts) {
78330
78384
  opts = typeof url === "object" ? url : {};
@@ -80908,8 +80962,8 @@ var require_builder = __commonJS({
80908
80962
  var db_1 = require_db();
80909
80963
  var llm_1 = require_llm();
80910
80964
  var qa_1 = require_qa();
80911
- var fs3 = __importStar(require("fs"));
80912
- var path3 = __importStar(require("path"));
80965
+ var fs4 = __importStar(require("fs"));
80966
+ var path4 = __importStar(require("path"));
80913
80967
  var models_1 = require_models();
80914
80968
  var cms_template_1 = require_cms_template();
80915
80969
  var vercel_domains_1 = require_vercel_domains();
@@ -81033,44 +81087,44 @@ var require_builder = __commonJS({
81033
81087
  </div>`;
81034
81088
  }
81035
81089
  function snapshotDir(leadId) {
81036
- return path3.join((0, runtime_1.userDataDir)(), "data", "sites", String(leadId));
81090
+ return path4.join((0, runtime_1.userDataDir)(), "data", "sites", String(leadId));
81037
81091
  }
81038
81092
  function saveSnapshot(leadId, files) {
81039
81093
  const dir = snapshotDir(leadId);
81040
81094
  try {
81041
- fs3.mkdirSync(dir, { recursive: true });
81095
+ fs4.mkdirSync(dir, { recursive: true });
81042
81096
  for (const f of files) {
81043
- const target = path3.join(dir, f.file);
81044
- fs3.mkdirSync(path3.dirname(target), { recursive: true });
81097
+ const target = path4.join(dir, f.file);
81098
+ fs4.mkdirSync(path4.dirname(target), { recursive: true });
81045
81099
  if (f.encoding === "base64") {
81046
- fs3.writeFileSync(target, Buffer.from(f.data, "base64"));
81100
+ fs4.writeFileSync(target, Buffer.from(f.data, "base64"));
81047
81101
  } else {
81048
- fs3.writeFileSync(target, f.data, "utf-8");
81102
+ fs4.writeFileSync(target, f.data, "utf-8");
81049
81103
  }
81050
81104
  }
81051
- fs3.writeFileSync(path3.join(dir, ".snapshot.json"), JSON.stringify({ savedAt: Date.now() }));
81105
+ fs4.writeFileSync(path4.join(dir, ".snapshot.json"), JSON.stringify({ savedAt: Date.now() }));
81052
81106
  } catch {
81053
81107
  }
81054
81108
  }
81055
81109
  function loadSnapshot(leadId) {
81056
81110
  const dir = snapshotDir(leadId);
81057
- if (!fs3.existsSync(dir))
81111
+ if (!fs4.existsSync(dir))
81058
81112
  return null;
81059
81113
  const out = [];
81060
81114
  function walk(rel) {
81061
- const abs = path3.join(dir, rel);
81062
- const stat = fs3.statSync(abs);
81115
+ const abs = path4.join(dir, rel);
81116
+ const stat = fs4.statSync(abs);
81063
81117
  if (stat.isDirectory()) {
81064
- for (const child of fs3.readdirSync(abs)) {
81118
+ for (const child of fs4.readdirSync(abs)) {
81065
81119
  if (child.startsWith("."))
81066
81120
  continue;
81067
81121
  walk(rel ? `${rel}/${child}` : child);
81068
81122
  }
81069
81123
  } else if (stat.isFile()) {
81070
81124
  if (/\.(jpg|jpeg|png|gif|webp|avif)$/i.test(rel)) {
81071
- out.push({ file: rel, data: fs3.readFileSync(abs).toString("base64"), encoding: "base64" });
81125
+ out.push({ file: rel, data: fs4.readFileSync(abs).toString("base64"), encoding: "base64" });
81072
81126
  } else {
81073
- out.push({ file: rel, data: fs3.readFileSync(abs, "utf-8"), encoding: "utf-8" });
81127
+ out.push({ file: rel, data: fs4.readFileSync(abs, "utf-8"), encoding: "utf-8" });
81074
81128
  }
81075
81129
  }
81076
81130
  }
@@ -83464,8 +83518,8 @@ var require_invoicing = __commonJS({
83464
83518
  exports2.renderInvoicePdf = renderInvoicePdf;
83465
83519
  exports2.renderLetterPdf = renderLetterPdf2;
83466
83520
  var pdfkit_1 = __importDefault(require("pdfkit"));
83467
- var fs3 = __importStar(require("fs"));
83468
- var path3 = __importStar(require("path"));
83521
+ var fs4 = __importStar(require("fs"));
83522
+ var path4 = __importStar(require("path"));
83469
83523
  var db_1 = require_db();
83470
83524
  var runtime_1 = require_runtime();
83471
83525
  var agency_1 = require_agency();
@@ -83515,8 +83569,8 @@ var require_invoicing = __commonJS({
83515
83569
  return prefix + String(n).padStart(3, "0");
83516
83570
  }
83517
83571
  function invoiceDir() {
83518
- const dir = path3.join((0, runtime_1.userDataDir)(), "data", "invoices");
83519
- fs3.mkdirSync(dir, { recursive: true });
83572
+ const dir = path4.join((0, runtime_1.userDataDir)(), "data", "invoices");
83573
+ fs4.mkdirSync(dir, { recursive: true });
83520
83574
  return dir;
83521
83575
  }
83522
83576
  function addDays(iso, days) {
@@ -83593,7 +83647,7 @@ var require_invoicing = __commonJS({
83593
83647
  const accent = hexOrDefault(p.accent, "#556B45");
83594
83648
  const right = doc.page.width - PAGE_MARGIN;
83595
83649
  let leftBottom = PAGE_MARGIN;
83596
- if (p.logoPath && fs3.existsSync(p.logoPath)) {
83650
+ if (p.logoPath && fs4.existsSync(p.logoPath)) {
83597
83651
  try {
83598
83652
  doc.image(p.logoPath, PAGE_MARGIN, PAGE_MARGIN, { fit: [150, 50] });
83599
83653
  leftBottom = PAGE_MARGIN + 50;
@@ -83633,12 +83687,12 @@ var require_invoicing = __commonJS({
83633
83687
  }
83634
83688
  const accent = hexOrDefault(p.accent, "#556B45");
83635
83689
  const items = JSON.parse(invoice.line_items);
83636
- const file = outPath ?? path3.join(invoiceDir(), `${invoice.number}.pdf`);
83690
+ const file = outPath ?? path4.join(invoiceDir(), `${invoice.number}.pdf`);
83637
83691
  const doc = new pdfkit_1.default({ size: "A4", margin: PAGE_MARGIN, info: {
83638
83692
  Title: `Invoice ${invoice.number}`,
83639
83693
  Author: p.name
83640
83694
  } });
83641
- const stream = fs3.createWriteStream(file);
83695
+ const stream = fs4.createWriteStream(file);
83642
83696
  doc.pipe(stream);
83643
83697
  let y = drawLetterhead(doc, p);
83644
83698
  const right = doc.page.width - PAGE_MARGIN;
@@ -83746,15 +83800,15 @@ var require_invoicing = __commonJS({
83746
83800
  if (!p.name) {
83747
83801
  throw new Error("No agency details set \u2014 run `sproutkit brand` first.");
83748
83802
  }
83749
- const dir = path3.join((0, runtime_1.userDataDir)(), "data", "letters");
83750
- fs3.mkdirSync(dir, { recursive: true });
83803
+ const dir = path4.join((0, runtime_1.userDataDir)(), "data", "letters");
83804
+ fs4.mkdirSync(dir, { recursive: true });
83751
83805
  const safe = args.to.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 40);
83752
- const file = args.outPath ?? path3.join(dir, `letter-${safe}-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.pdf`);
83806
+ const file = args.outPath ?? path4.join(dir, `letter-${safe}-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.pdf`);
83753
83807
  const doc = new pdfkit_1.default({ size: "A4", margin: PAGE_MARGIN, info: {
83754
83808
  Title: args.subject ?? `Letter to ${args.to}`,
83755
83809
  Author: p.name
83756
83810
  } });
83757
- const stream = fs3.createWriteStream(file);
83811
+ const stream = fs4.createWriteStream(file);
83758
83812
  doc.pipe(stream);
83759
83813
  let y = drawLetterhead(doc, p);
83760
83814
  const width = doc.page.width - PAGE_MARGIN * 2;
@@ -84019,8 +84073,8 @@ var require_cookies2 = __commonJS({
84019
84073
  if (urlparts.hostname !== cookie.domain && (cookie.domain.charAt(0) !== "." || ("." + urlparts.hostname).substr(-cookie.domain.length) !== cookie.domain)) {
84020
84074
  return false;
84021
84075
  }
84022
- const path3 = this.getPath(urlparts.pathname);
84023
- if (path3.substr(0, cookie.path.length) !== cookie.path) {
84076
+ const path4 = this.getPath(urlparts.pathname);
84077
+ if (path4.substr(0, cookie.path.length) !== cookie.path) {
84024
84078
  return false;
84025
84079
  }
84026
84080
  if (cookie.secure && urlparts.protocol !== "https:") {
@@ -84078,16 +84132,16 @@ var require_cookies2 = __commonJS({
84078
84132
  * @returns {String} Normalized path
84079
84133
  */
84080
84134
  getPath(pathname) {
84081
- let path3 = (pathname || "/").split("/");
84082
- path3.pop();
84083
- path3 = path3.join("/").trim();
84084
- if (path3.charAt(0) !== "/") {
84085
- path3 = "/" + path3;
84135
+ let path4 = (pathname || "/").split("/");
84136
+ path4.pop();
84137
+ path4 = path4.join("/").trim();
84138
+ if (path4.charAt(0) !== "/") {
84139
+ path4 = "/" + path4;
84086
84140
  }
84087
- if (path3.substr(-1) !== "/") {
84088
- path3 += "/";
84141
+ if (path4.substr(-1) !== "/") {
84142
+ path4 += "/";
84089
84143
  }
84090
- return path3;
84144
+ return path4;
84091
84145
  }
84092
84146
  };
84093
84147
  module2.exports = Cookies;
@@ -84431,12 +84485,12 @@ var require_shared = __commonJS({
84431
84485
  "use strict";
84432
84486
  var urllib = require("url");
84433
84487
  var util = require("util");
84434
- var fs3 = require("fs");
84488
+ var fs4 = require("fs");
84435
84489
  var nmfetch = require_fetch2();
84436
84490
  var errors = require_errors6();
84437
84491
  var dns = require("dns");
84438
84492
  var net = require("net");
84439
- var os4 = require("os");
84493
+ var os5 = require("os");
84440
84494
  var DNS_TTL = 5 * 60 * 1e3;
84441
84495
  var CACHE_CLEANUP_INTERVAL = 30 * 1e3;
84442
84496
  var MAX_CACHE_SIZE = 1e3;
@@ -84447,7 +84501,7 @@ var require_shared = __commonJS({
84447
84501
  };
84448
84502
  var networkInterfaces;
84449
84503
  try {
84450
- networkInterfaces = os4.networkInterfaces();
84504
+ networkInterfaces = os5.networkInterfaces();
84451
84505
  } catch (_err) {
84452
84506
  }
84453
84507
  module2.exports.networkInterfaces = networkInterfaces;
@@ -84859,7 +84913,7 @@ var require_shared = __commonJS({
84859
84913
  callback(err);
84860
84914
  });
84861
84915
  }
84862
- return resolveStream(fs3.createReadStream(content.path), callback);
84916
+ return resolveStream(fs4.createReadStream(content.path), callback);
84863
84917
  }
84864
84918
  }
84865
84919
  if (typeof data[key].content === "string" && !["utf8", "usascii", "ascii"].includes(encoding)) {
@@ -84972,7 +85026,7 @@ var require_shared = __commonJS({
84972
85026
  var require_mime_types2 = __commonJS({
84973
85027
  "../../node_modules/nodemailer/lib/mime-funcs/mime-types.js"(exports2, module2) {
84974
85028
  "use strict";
84975
- var path3 = require("path");
85029
+ var path4 = require("path");
84976
85030
  var defaultMimeType = "application/octet-stream";
84977
85031
  var defaultExtension = "bin";
84978
85032
  var mimeTypes = /* @__PURE__ */ new Map([
@@ -87039,7 +87093,7 @@ var require_mime_types2 = __commonJS({
87039
87093
  if (!filename) {
87040
87094
  return defaultMimeType;
87041
87095
  }
87042
- const parsed = path3.parse(filename);
87096
+ const parsed = path4.parse(filename);
87043
87097
  const extension = (parsed.ext.substr(1) || parsed.name || "").split("?").shift().trim().toLowerCase();
87044
87098
  const value = extensions.has(extension) ? extensions.get(extension) : defaultMimeType;
87045
87099
  if (Array.isArray(value)) {
@@ -88467,7 +88521,7 @@ var require_mime_node = __commonJS({
88467
88521
  "../../node_modules/nodemailer/lib/mime-node/index.js"(exports2, module2) {
88468
88522
  "use strict";
88469
88523
  var crypto2 = require("crypto");
88470
- var fs3 = require("fs");
88524
+ var fs4 = require("fs");
88471
88525
  var punycode = require_punycode();
88472
88526
  var { PassThrough } = require("stream");
88473
88527
  var shared = require_shared();
@@ -89189,7 +89243,7 @@ var require_mime_node = __commonJS({
89189
89243
  });
89190
89244
  return contentStream;
89191
89245
  }
89192
- return fs3.createReadStream(content.path);
89246
+ return fs4.createReadStream(content.path);
89193
89247
  }
89194
89248
  if (content && typeof content.href === "string") {
89195
89249
  if (this.disableUrlAccess) {
@@ -90255,8 +90309,8 @@ var require_dkim = __commonJS({
90255
90309
  var RelaxedBody = require_relaxed_body();
90256
90310
  var sign = require_sign7();
90257
90311
  var { PassThrough } = require("stream");
90258
- var fs3 = require("fs");
90259
- var path3 = require("path");
90312
+ var fs4 = require("fs");
90313
+ var path4 = require("path");
90260
90314
  var crypto2 = require("crypto");
90261
90315
  var DKIM_ALGO = "sha256";
90262
90316
  var MAX_MESSAGE_SIZE = 2 * 1024 * 1024;
@@ -90270,7 +90324,7 @@ var require_dkim = __commonJS({
90270
90324
  this.chunks = [];
90271
90325
  this.chunklen = 0;
90272
90326
  this.readPos = 0;
90273
- this.cachePath = this.cacheDir ? path3.join(this.cacheDir, "message." + Date.now() + "-" + crypto2.randomBytes(14).toString("hex")) : false;
90327
+ this.cachePath = this.cacheDir ? path4.join(this.cacheDir, "message." + Date.now() + "-" + crypto2.randomBytes(14).toString("hex")) : false;
90274
90328
  this.cache = false;
90275
90329
  this.headers = false;
90276
90330
  this.bodyHash = false;
@@ -90290,10 +90344,10 @@ var require_dkim = __commonJS({
90290
90344
  if (!this.cache || !this.cachePath) {
90291
90345
  return;
90292
90346
  }
90293
- fs3.unlink(this.cachePath, () => false);
90347
+ fs4.unlink(this.cachePath, () => false);
90294
90348
  }
90295
90349
  createReadCache() {
90296
- this.cache = fs3.createReadStream(this.cachePath);
90350
+ this.cache = fs4.createReadStream(this.cachePath);
90297
90351
  this.cache.once("error", (err) => {
90298
90352
  this.cleanup();
90299
90353
  this.output.emit("error", err);
@@ -90349,7 +90403,7 @@ var require_dkim = __commonJS({
90349
90403
  }
90350
90404
  createWriteCache() {
90351
90405
  this.output.usingCache = true;
90352
- this.cache = fs3.createWriteStream(this.cachePath);
90406
+ this.cache = fs4.createWriteStream(this.cachePath);
90353
90407
  this.cache.once("error", (err) => {
90354
90408
  this.cleanup();
90355
90409
  this.relaxedBody.unpipe(this.cache);
@@ -91290,7 +91344,7 @@ var require_smtp_connection = __commonJS({
91290
91344
  var { EventEmitter } = require("events");
91291
91345
  var net = require("net");
91292
91346
  var tls = require("tls");
91293
- var os4 = require("os");
91347
+ var os5 = require("os");
91294
91348
  var crypto2 = require("crypto");
91295
91349
  var DataStream = require_data_stream();
91296
91350
  var { PassThrough } = require("stream");
@@ -92741,7 +92795,7 @@ var require_smtp_connection = __commonJS({
92741
92795
  _getHostname() {
92742
92796
  let defaultHostname;
92743
92797
  try {
92744
- defaultHostname = os4.hostname() || "";
92798
+ defaultHostname = os5.hostname() || "";
92745
92799
  } catch (_err) {
92746
92800
  defaultHostname = "localhost";
92747
92801
  }
@@ -95553,13 +95607,13 @@ var require_email = __commonJS({
95553
95607
  secure: cfg.port === 465,
95554
95608
  auth: { user: cfg.user, pass: cfg.pass }
95555
95609
  });
95556
- await transporter.sendMail({
95610
+ const info = await transporter.sendMail({
95557
95611
  from: cfg.from,
95558
95612
  to: args.to,
95559
95613
  subject: args.subject,
95560
95614
  text: args.text
95561
95615
  });
95562
- return { ok: true };
95616
+ return { ok: true, messageId: info.messageId };
95563
95617
  } catch (e) {
95564
95618
  return { ok: false, error: e.message };
95565
95619
  }
@@ -95658,6 +95712,7 @@ var require_chat_tools = __commonJS({
95658
95712
  "use strict";
95659
95713
  Object.defineProperty(exports2, "__esModule", { value: true });
95660
95714
  exports2.TOOLS = void 0;
95715
+ exports2.normaliseChannel = normaliseChannel;
95661
95716
  exports2.runTool = runTool2;
95662
95717
  var db_1 = require_db();
95663
95718
  var runtime_1 = require_runtime();
@@ -95766,7 +95821,7 @@ var require_chat_tools = __commonJS({
95766
95821
  },
95767
95822
  {
95768
95823
  name: "prepare_outreach",
95769
- description: "Prepare outreach for one or more leads that have a website built. For each lead it fills in the user's outreach template (name + demo site URL), moves the lead to the 'contacted' column, and returns a ready-to-open messaging link for the user's chosen channel (Messages on Mac, Phone Link on Windows, or WhatsApp). The user opens each message themselves \u2014 messaging apps can't be truly auto-sent \u2014 so this is the 'send the outreach' step after building sites. Use it for 'message everyone I just built', 'send outreach to the ready column', etc.",
95824
+ description: "Send or prepare outreach for one or more leads that have a website built. Fills in the user's outreach template (name + demo site URL) and moves each lead to the 'contacted' column. Behaviour depends on the channel: on 'email' (the default) it ACTUALLY SENDS via the user's SMTP \u2014 report exactly who was emailed; on 'whatsapp'/'sms' it returns a ready-to-open messaging link the user opens themselves, because messaging apps can't be auto-sent. Leads with no address on file get one looked up automatically where possible; any lead we can't reach at all is reported as such rather than skipped silently. Use it for 'message everyone I just built', 'send outreach to the ready column', etc.",
95770
95825
  input_schema: {
95771
95826
  type: "object",
95772
95827
  properties: {
@@ -95777,8 +95832,8 @@ var require_chat_tools = __commonJS({
95777
95832
  },
95778
95833
  channel: {
95779
95834
  type: "string",
95780
- enum: ["whatsapp", "sms"],
95781
- description: "Messaging channel for leads that have a phone: 'whatsapp' opens WhatsApp, 'sms' opens the device's Messages app (Messages on macOS, Phone Link on Windows). Omit to use the saved preference."
95835
+ enum: ["email", "whatsapp", "sms"],
95836
+ description: "Preferred channel. 'email' (default) sends via the user's SMTP \u2014 the only channel that works unattended on every platform \u2014 falling back to a WhatsApp link for leads with no email address. 'whatsapp' opens WhatsApp and 'sms' opens the device's Messages app (Messages on macOS, Phone Link on Windows); both fall back to email when a lead has no phone. Omit to use the saved preference."
95782
95837
  }
95783
95838
  }
95784
95839
  },
@@ -96153,6 +96208,21 @@ It's not fully live yet. We can make it live for \xA3199 \u2014 your own domain,
96153
96208
 
96154
96209
  Interested?`;
96155
96210
  }
96211
+ function normaliseChannel(value) {
96212
+ switch (String(value ?? "").toLowerCase()) {
96213
+ case "email":
96214
+ return "email";
96215
+ case "sms":
96216
+ case "messages_mac":
96217
+ case "phone_link_win":
96218
+ case "manual":
96219
+ return "sms";
96220
+ case "whatsapp":
96221
+ return "whatsapp";
96222
+ default:
96223
+ return null;
96224
+ }
96225
+ }
96156
96226
  function outreachLink(channel, e164, message) {
96157
96227
  if (channel === "whatsapp") {
96158
96228
  return `https://wa.me/${e164.replace(/^\+/, "")}?text=${encodeURIComponent(message)}`;
@@ -96309,10 +96379,11 @@ Interested?`;
96309
96379
  };
96310
96380
  }
96311
96381
  const channelRow = db2.get("SELECT value FROM settings WHERE key = ?", ["outreach_channel"]);
96312
- const requested = String(input.channel ?? "").toLowerCase();
96313
- const channel = requested === "sms" || requested === "whatsapp" ? requested : channelRow?.value || "whatsapp";
96382
+ const channel = normaliseChannel(input.channel) ?? normaliseChannel(channelRow?.value) ?? "email";
96314
96383
  const template = outreachTemplate(db2);
96315
96384
  const bookingTemplate = bookingOutreachTemplate(db2);
96385
+ const preferEmail = channel === "email";
96386
+ const linkChannel = channel === "email" ? "whatsapp" : channel;
96316
96387
  const smtp = (0, email_1.smtpFromSettings)((k) => getDecryptedSetting(k));
96317
96388
  const emailSubject = getDecryptedSetting("outreach_email_subject") || "A free demo website for {name}";
96318
96389
  const prepared = [];
@@ -96321,7 +96392,7 @@ Interested?`;
96321
96392
  const isBookingLead = r.lead_kind === "no_booking";
96322
96393
  const message = (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");
96323
96394
  const e164 = toE164(r.phone ?? "");
96324
- if (!e164 && !r.email && smtp) {
96395
+ if (!r.email && smtp && (preferEmail || !e164)) {
96325
96396
  ctx.emitProgress?.({
96326
96397
  channel: "outreach:progress",
96327
96398
  payload: { msg: `Looking up an email for ${r.name}\u2026` }
@@ -96338,23 +96409,31 @@ Interested?`;
96338
96409
  harvested++;
96339
96410
  }
96340
96411
  }
96341
- if (e164) {
96412
+ const leadEmail = smtp && r.email ? r.email : null;
96413
+ const useEmail = leadEmail !== null && (preferEmail || !e164);
96414
+ if (!useEmail && e164) {
96342
96415
  prepared.push({
96343
96416
  id: r.id,
96344
96417
  name: r.name,
96345
96418
  via: "phone",
96346
96419
  phone: e164,
96347
- url: outreachLink(channel, e164, message),
96420
+ url: outreachLink(linkChannel, e164, message),
96348
96421
  message
96349
96422
  });
96350
- } else if (r.email && smtp) {
96423
+ } else if (useEmail && smtp && leadEmail) {
96351
96424
  const subject = emailSubject.replace(/\{name\}/g, r.name);
96352
- const res = await (0, email_1.sendEmail)(smtp, { to: r.email, subject, text: message });
96425
+ const res = await (0, email_1.sendEmail)(smtp, { to: leadEmail, subject, text: message });
96426
+ if (res.ok && res.messageId) {
96427
+ db2.run("UPDATE leads SET last_email_message_id = ? WHERE id = ?", [
96428
+ res.messageId,
96429
+ r.id
96430
+ ]);
96431
+ }
96353
96432
  prepared.push({
96354
96433
  id: r.id,
96355
96434
  name: r.name,
96356
96435
  via: "email",
96357
- email: r.email,
96436
+ email: leadEmail,
96358
96437
  emailSent: res.ok,
96359
96438
  emailError: res.ok ? void 0 : res.error,
96360
96439
  message
@@ -96368,7 +96447,8 @@ Interested?`;
96368
96447
  message
96369
96448
  });
96370
96449
  }
96371
- const reached = e164 || r.email && smtp && prepared[prepared.length - 1].emailSent;
96450
+ const last = prepared[prepared.length - 1];
96451
+ const reached = last.via === "phone" || last.via === "email" && last.emailSent;
96372
96452
  if (reached) {
96373
96453
  db2.run("UPDATE leads SET status = 'contacted', contacted_at = ? WHERE id = ?", [
96374
96454
  (/* @__PURE__ */ new Date()).toISOString(),
@@ -96377,7 +96457,7 @@ Interested?`;
96377
96457
  (0, followup_1.logContact)({
96378
96458
  leadId: r.id,
96379
96459
  direction: "out",
96380
- channel: e164 ? channel : "email"
96460
+ channel: last.via === "email" ? "email" : linkChannel
96381
96461
  });
96382
96462
  }
96383
96463
  }
@@ -96385,7 +96465,7 @@ Interested?`;
96385
96465
  const emailsSent = prepared.filter((p) => p.via === "email" && p.emailSent).length;
96386
96466
  const emailsFailed = prepared.filter((p) => p.via === "email" && !p.emailSent).length;
96387
96467
  const unreachable = prepared.filter((p) => p.via === "none").length;
96388
- const smtpMissing = eligible.some((r) => !toE164(r.phone ?? "") && r.email) && !smtp;
96468
+ const smtpMissing = !smtp && (preferEmail || eligible.some((r) => !toE164(r.phone ?? "")));
96389
96469
  return {
96390
96470
  ok: true,
96391
96471
  channel,
@@ -96395,8 +96475,8 @@ Interested?`;
96395
96475
  emailsFailed,
96396
96476
  emailsFound: harvested,
96397
96477
  unreachable,
96398
- // Guide the user if email-only leads were skipped for want of SMTP.
96399
- note: smtpMissing ? "Some leads have only an email but SMTP isn't set up \u2014 run 'sproutkit setup' to add SMTP and email them." : void 0,
96478
+ // Guide the user if leads were skipped for want of SMTP.
96479
+ note: smtpMissing ? "Email outreach needs SMTP, which isn't set up yet \u2014 add it in Sproutkit \u2192 Settings \u2192 Email outreach, or run 'sproutkit setup'." : void 0,
96400
96480
  outreach: prepared
96401
96481
  };
96402
96482
  }
@@ -96652,7 +96732,9 @@ Interested?`;
96652
96732
  paid: r.paid_at,
96653
96733
  pdf: r.pdf_path
96654
96734
  })),
96655
- outstanding: (0, agency_1.formatMoney)(outstanding)
96735
+ // Use the agency's currency, not formatMoney's fallback — otherwise a
96736
+ // non-default agency sees the wrong symbol on their own total.
96737
+ outstanding: (0, agency_1.formatMoney)(outstanding, (0, agency_1.getAgencyProfile)().currency)
96656
96738
  };
96657
96739
  }
96658
96740
  case "mark_invoice_paid": {
@@ -97786,12 +97868,504 @@ var require_vercel_store = __commonJS({
97786
97868
  }
97787
97869
  });
97788
97870
 
97871
+ // src/engine.ts
97872
+ var db, chat, chatTools, autoMode, cms, bookingPreset, builder, vercelStore, agency, followup, invoicing, models, llm, initDatabase, getDb, chatWithTools, runTool, TOOLS, startAutoJob, cancelAutoJob, provisionCmsForLead, generatePreset, deployBookingOnly, deployStandaloneBooking, handoverSite, createBlobStore, refreshModels, refreshIfStale, listCachedModels, getPreferredModel, getAgencyProfile, setAgencyProfile, agencyConfigured, formatMoney, dueFollowUps, outreachStats, contactHistory, renderLetterPdf, listInvoicesRaw, checkClaudeCodeAuth, llmBackend, claudeBin, CLAUDE_CODE_MODELS, getClaudeCodeModel;
97873
+ var init_engine = __esm({
97874
+ "src/engine.ts"() {
97875
+ "use strict";
97876
+ db = require_db();
97877
+ chat = require_chat();
97878
+ chatTools = require_chat_tools();
97879
+ autoMode = require_auto_mode();
97880
+ cms = require_cms_provision();
97881
+ bookingPreset = require_booking_preset();
97882
+ builder = require_builder();
97883
+ vercelStore = require_vercel_store();
97884
+ agency = require_agency();
97885
+ followup = require_followup();
97886
+ invoicing = require_invoicing();
97887
+ models = require_models();
97888
+ llm = require_llm();
97889
+ initDatabase = db.initDatabase;
97890
+ getDb = db.getDb;
97891
+ chatWithTools = chat.chatWithTools;
97892
+ runTool = chatTools.runTool;
97893
+ TOOLS = chatTools.TOOLS;
97894
+ startAutoJob = autoMode.startAutoJob;
97895
+ cancelAutoJob = autoMode.cancelAutoJob;
97896
+ provisionCmsForLead = cms.provisionCmsForLead;
97897
+ generatePreset = bookingPreset.generatePreset;
97898
+ deployBookingOnly = builder.deployBookingOnly;
97899
+ deployStandaloneBooking = builder.deployStandaloneBooking;
97900
+ handoverSite = builder.handoverSite;
97901
+ createBlobStore = vercelStore.createBlobStore;
97902
+ refreshModels = models.refreshModels;
97903
+ refreshIfStale = models.refreshIfStale;
97904
+ listCachedModels = models.listCachedModels;
97905
+ getPreferredModel = models.getPreferredModel;
97906
+ getAgencyProfile = agency.getAgencyProfile;
97907
+ setAgencyProfile = agency.setAgencyProfile;
97908
+ agencyConfigured = agency.agencyConfigured;
97909
+ formatMoney = agency.formatMoney;
97910
+ dueFollowUps = followup.dueFollowUps;
97911
+ outreachStats = followup.outreachStats;
97912
+ contactHistory = followup.contactHistory;
97913
+ renderLetterPdf = invoicing.renderLetterPdf;
97914
+ listInvoicesRaw = invoicing.listInvoices;
97915
+ checkClaudeCodeAuth = llm.checkClaudeCodeAuth;
97916
+ llmBackend = llm.getBackend;
97917
+ claudeBin = llm.claudeBin;
97918
+ CLAUDE_CODE_MODELS = llm.CLAUDE_CODE_MODELS;
97919
+ getClaudeCodeModel = llm.getClaudeCodeModel;
97920
+ }
97921
+ });
97922
+
97923
+ // src/config.ts
97924
+ function getSetting(key) {
97925
+ const row = getDb().get("SELECT value FROM settings WHERE key = ?", [key]);
97926
+ return row?.value ?? null;
97927
+ }
97928
+ function setSetting(key, value) {
97929
+ getDb().run(
97930
+ "INSERT INTO settings (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value",
97931
+ [key, value]
97932
+ );
97933
+ }
97934
+ function getBackend() {
97935
+ return getSetting("ai_backend") === "claude_code" ? "claude_code" : "api";
97936
+ }
97937
+ function setBackend(b) {
97938
+ setSetting("ai_backend", b);
97939
+ }
97940
+ function missingRequiredKeys() {
97941
+ const backend = getBackend();
97942
+ return REQUIRED_KEYS.filter((k) => {
97943
+ if (!k.required) return false;
97944
+ if ("apiBackendOnly" in k && k.apiBackendOnly && backend !== "api") return false;
97945
+ return !getSetting(k.key);
97946
+ }).map((k) => ({ key: k.key, label: k.label, hint: k.hint }));
97947
+ }
97948
+ var REQUIRED_KEYS;
97949
+ var init_config = __esm({
97950
+ "src/config.ts"() {
97951
+ "use strict";
97952
+ init_engine();
97953
+ REQUIRED_KEYS = [
97954
+ { key: "anthropic_key", label: "Anthropic API key", hint: "sk-ant-\u2026 \u2014 powers the chat + site generation", required: true, apiBackendOnly: true },
97955
+ { key: "places_key", label: "Google Places API key", hint: "finds businesses, photos, reviews", required: true },
97956
+ { key: "vercel_token", label: "Vercel token", hint: "deploys the generated sites", required: true },
97957
+ { key: "blob_token", label: "Vercel Blob token", hint: "required for booking sites & CMS (stores form config/submissions)", required: false },
97958
+ { key: "resend_key", label: "Resend API key", hint: "optional \u2014 emails the business owner when a booking comes in", required: false },
97959
+ // SMTP for email outreach — used per-lead when a business has no phone. All
97960
+ // optional; without them, email-only leads are simply skipped.
97961
+ { key: "smtp_host", label: "SMTP host", hint: "optional \u2014 for email outreach, e.g. smtp.gmail.com", required: false },
97962
+ { key: "smtp_port", label: "SMTP port", hint: "optional \u2014 587 (STARTTLS) or 465 (TLS); default 587", required: false },
97963
+ { key: "smtp_user", label: "SMTP username", hint: "optional \u2014 your email login", required: false },
97964
+ { key: "smtp_pass", label: "SMTP password", hint: "optional \u2014 password or app-password", required: false },
97965
+ { key: "smtp_from", label: "Email 'From'", hint: "optional \u2014 e.g. You <you@domain.com>; defaults to the username", required: false }
97966
+ ];
97967
+ }
97968
+ });
97969
+
97970
+ // src/tty.ts
97971
+ function iface() {
97972
+ if (!rl) rl = import_readline.default.createInterface({ input: process.stdin, output: process.stdout });
97973
+ return rl;
97974
+ }
97975
+ function ask(question) {
97976
+ return new Promise((resolve) => iface().question(question, (a) => resolve(a.trim())));
97977
+ }
97978
+ function askSecret(question) {
97979
+ return new Promise((resolve) => {
97980
+ const i = iface();
97981
+ process.stdout.write(question);
97982
+ const stdin = process.stdin;
97983
+ const onData = (char) => {
97984
+ const s = char.toString();
97985
+ if (s === "\n" || s === "\r" || s === "") return;
97986
+ };
97987
+ const realWrite = i._writeToOutput;
97988
+ i._writeToOutput = (str) => {
97989
+ if (str.includes(question)) process.stdout.write(str);
97990
+ else process.stdout.write("*");
97991
+ };
97992
+ i.question("", (answer) => {
97993
+ i._writeToOutput = realWrite;
97994
+ process.stdout.write("\n");
97995
+ stdin.removeListener("data", onData);
97996
+ resolve(answer.trim());
97997
+ });
97998
+ });
97999
+ }
98000
+ function closeTty() {
98001
+ rl?.close();
98002
+ rl = null;
98003
+ }
98004
+ function onStopRequested(onStop) {
98005
+ let stopped = false;
98006
+ const stdin = process.stdin;
98007
+ const wasRaw = !!stdin.isTTY && stdin.isRaw;
98008
+ const handler = (buf) => {
98009
+ const s = buf.toString();
98010
+ if (s === "q" || s === "Q" || s === "\x1B" || s === "") {
98011
+ if (!stopped) {
98012
+ stopped = true;
98013
+ onStop?.();
98014
+ }
98015
+ }
98016
+ };
98017
+ if (stdin.isTTY) {
98018
+ try {
98019
+ stdin.setRawMode(true);
98020
+ stdin.resume();
98021
+ stdin.on("data", handler);
98022
+ } catch {
98023
+ }
98024
+ }
98025
+ return {
98026
+ stopped: () => stopped,
98027
+ release: () => {
98028
+ if (!stdin.isTTY) return;
98029
+ try {
98030
+ stdin.removeListener("data", handler);
98031
+ stdin.setRawMode(wasRaw);
98032
+ stdin.pause();
98033
+ } catch {
98034
+ }
98035
+ }
98036
+ };
98037
+ }
98038
+ function say(msg = "") {
98039
+ process.stdout.write(msg + "\n");
98040
+ }
98041
+ var import_readline, useColor, wrap, c, rl, FRAMES, Status, STATE_MARK, StatusBoard;
98042
+ var init_tty = __esm({
98043
+ "src/tty.ts"() {
98044
+ "use strict";
98045
+ import_readline = __toESM(require("readline"));
98046
+ useColor = process.stdout.isTTY && !process.env.NO_COLOR;
98047
+ wrap = (code) => (s) => useColor ? `\x1B[${code}m${s}\x1B[0m` : s;
98048
+ c = {
98049
+ green: wrap("38;5;65"),
98050
+ // moss, matches the brand
98051
+ greenBold: wrap("1;38;5;65"),
98052
+ dim: wrap("2"),
98053
+ bold: wrap("1"),
98054
+ red: wrap("31"),
98055
+ amber: wrap("33"),
98056
+ cyan: wrap("36")
98057
+ };
98058
+ rl = null;
98059
+ FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
98060
+ Status = class {
98061
+ timer = null;
98062
+ frame = 0;
98063
+ label = "";
98064
+ stage = "";
98065
+ tty = process.stdout.isTTY && useColor;
98066
+ start(label) {
98067
+ this.label = label;
98068
+ this.stage = "";
98069
+ if (!this.tty) {
98070
+ say(c.cyan(` \u27F3 ${label}`));
98071
+ return;
98072
+ }
98073
+ this.render();
98074
+ this.timer = setInterval(() => {
98075
+ this.frame = (this.frame + 1) % FRAMES.length;
98076
+ this.render();
98077
+ }, 80);
98078
+ }
98079
+ // Update the current stage (e.g. "Generating site with Claude…").
98080
+ update(stage) {
98081
+ this.stage = stage;
98082
+ if (!this.tty) {
98083
+ say(c.dim(` \u2026 ${stage}`));
98084
+ return;
98085
+ }
98086
+ this.render();
98087
+ }
98088
+ render() {
98089
+ const spin = c.cyan(FRAMES[this.frame]);
98090
+ const stage = this.stage ? c.dim(` \xB7 ${this.stage}`) : "";
98091
+ process.stdout.write(`\r\x1B[2K ${spin} ${this.label}${stage}`);
98092
+ }
98093
+ // Stop with a terminal state, leaving one clean line behind.
98094
+ done(ok, finalLabel) {
98095
+ if (this.timer) {
98096
+ clearInterval(this.timer);
98097
+ this.timer = null;
98098
+ }
98099
+ const label = finalLabel ?? this.label;
98100
+ const mark2 = ok ? c.green("\u2713") : c.red("\u2717");
98101
+ if (this.tty) process.stdout.write(`\r\x1B[2K ${mark2} ${label}
98102
+ `);
98103
+ else say(` ${mark2} ${label}`);
98104
+ }
98105
+ };
98106
+ STATE_MARK = {
98107
+ queued: () => c.dim("\xB7"),
98108
+ building: () => c.cyan(""),
98109
+ // spinner frame filled in at render time
98110
+ built: () => c.green("\u2713"),
98111
+ failed: () => c.red("\u2717"),
98112
+ skipped: () => c.dim("\u2013")
98113
+ };
98114
+ StatusBoard = class {
98115
+ rows = [];
98116
+ frame = 0;
98117
+ timer = null;
98118
+ lastLineCount = 0;
98119
+ tty = process.stdout.isTTY && useColor;
98120
+ // Non-TTY: remember the last printed signature per row so we only log changes.
98121
+ lastSig = /* @__PURE__ */ new Map();
98122
+ header = "";
98123
+ start(header, rows) {
98124
+ this.header = header;
98125
+ this.rows = rows;
98126
+ if (!this.tty) {
98127
+ say(c.cyan(` \u27F3 ${header}`));
98128
+ this.rows.forEach((r) => this.logRowIfChanged(r));
98129
+ return;
98130
+ }
98131
+ say(c.cyan(` \u27F3 ${header}`));
98132
+ this.render();
98133
+ this.timer = setInterval(() => {
98134
+ this.frame = (this.frame + 1) % FRAMES.length;
98135
+ this.render();
98136
+ }, 90);
98137
+ }
98138
+ update(row) {
98139
+ const i = this.rows.findIndex((r) => r.key === row.key);
98140
+ if (i >= 0) this.rows[i] = row;
98141
+ else this.rows.push(row);
98142
+ if (!this.tty) this.logRowIfChanged(row);
98143
+ else this.render();
98144
+ }
98145
+ // Replace the whole set at once (e.g. from a job snapshot).
98146
+ set(rows) {
98147
+ this.rows = rows;
98148
+ if (!this.tty) rows.forEach((r) => this.logRowIfChanged(r));
98149
+ else this.render();
98150
+ }
98151
+ line(r) {
98152
+ const mark2 = r.state === "building" ? c.cyan(FRAMES[this.frame]) : STATE_MARK[r.state]();
98153
+ const detail = r.detail ? c.dim(` \xB7 ${r.detail}`) : "";
98154
+ return ` ${mark2} ${r.label}${detail}`;
98155
+ }
98156
+ logRowIfChanged(r) {
98157
+ const sig = `${r.state}:${r.detail ?? ""}`;
98158
+ if (this.lastSig.get(r.key) === sig) return;
98159
+ this.lastSig.set(r.key, sig);
98160
+ const mark2 = r.state === "built" ? "\u2713" : r.state === "failed" ? "\u2717" : r.state === "skipped" ? "\u2013" : "\u2026";
98161
+ say(` ${mark2} ${r.label}${r.detail ? ` \xB7 ${r.detail}` : ""}`);
98162
+ }
98163
+ render() {
98164
+ if (this.lastLineCount > 0) process.stdout.write(`\x1B[${this.lastLineCount}A`);
98165
+ const out = this.rows.map((r) => `\x1B[2K${this.line(r)}`).join("\n");
98166
+ process.stdout.write(out + "\n");
98167
+ this.lastLineCount = this.rows.length;
98168
+ }
98169
+ stop() {
98170
+ if (this.timer) {
98171
+ clearInterval(this.timer);
98172
+ this.timer = null;
98173
+ }
98174
+ if (this.tty) this.render();
98175
+ }
98176
+ };
98177
+ }
98178
+ });
98179
+
98180
+ // src/desktop-install.ts
98181
+ var desktop_install_exports = {};
98182
+ __export(desktop_install_exports, {
98183
+ desktopInstallPath: () => desktopInstallPath,
98184
+ desktopSupported: () => desktopSupported,
98185
+ installDesktop: () => installDesktop,
98186
+ openDesktop: () => openDesktop,
98187
+ runDesktopCommand: () => runDesktopCommand
98188
+ });
98189
+ function installCandidates() {
98190
+ const home = import_os3.default.homedir();
98191
+ if (process.platform === "darwin") {
98192
+ const override = process.env.SPROUTKIT_DESKTOP_DIR;
98193
+ if (override) return [import_path2.default.join(override, "Sproutkit.app")];
98194
+ return ["/Applications/Sproutkit.app", import_path2.default.join(home, "Applications", "Sproutkit.app")];
98195
+ }
98196
+ if (process.platform === "win32") {
98197
+ const local = process.env.LOCALAPPDATA || import_path2.default.join(home, "AppData", "Local");
98198
+ const progs = [process.env.ProgramFiles, process.env["ProgramFiles(x86)"]].filter(Boolean);
98199
+ return [
98200
+ import_path2.default.join(local, "Programs", "Sproutkit", "Sproutkit.exe"),
98201
+ ...progs.map((p) => import_path2.default.join(p, "Sproutkit", "Sproutkit.exe"))
98202
+ ];
98203
+ }
98204
+ return [];
98205
+ }
98206
+ function desktopSupported() {
98207
+ return process.platform === "darwin" || process.platform === "win32";
98208
+ }
98209
+ function desktopInstallPath() {
98210
+ return installCandidates().find((p) => import_fs2.default.existsSync(p)) ?? null;
98211
+ }
98212
+ function isAppleSilicon() {
98213
+ if (process.arch === "arm64") return true;
98214
+ const r = (0, import_child_process.spawnSync)("sysctl", ["-n", "hw.optional.arm64"], { encoding: "utf-8" });
98215
+ return r.status === 0 && r.stdout.trim() === "1";
98216
+ }
98217
+ function pickAsset(assets) {
98218
+ if (process.platform === "darwin") {
98219
+ const dmgs = assets.filter((a) => a.name.endsWith(".dmg"));
98220
+ return isAppleSilicon() ? dmgs.find((a) => a.name.includes("arm64")) : dmgs.find((a) => !a.name.includes("arm64"));
98221
+ }
98222
+ if (process.platform === "win32") return assets.find((a) => a.name.endsWith(".exe"));
98223
+ return void 0;
98224
+ }
98225
+ async function latestRelease() {
98226
+ try {
98227
+ const r = await fetch(RELEASES_API, {
98228
+ headers: { Accept: "application/vnd.github+json", "User-Agent": "sproutkit-code" },
98229
+ signal: AbortSignal.timeout(1e4)
98230
+ });
98231
+ if (!r.ok) return { error: `GitHub answered ${r.status}` };
98232
+ const j = await r.json();
98233
+ const asset = pickAsset(j.assets ?? []);
98234
+ if (!asset) return { error: `No ${process.platform}/${process.arch} build in release ${j.tag_name}` };
98235
+ return { version: j.tag_name.replace(/^v/, ""), asset };
98236
+ } catch (e) {
98237
+ return { error: e.message };
98238
+ }
98239
+ }
98240
+ async function download(url, dest, total) {
98241
+ const r = await fetch(url, { redirect: "follow" });
98242
+ if (!r.ok || !r.body) throw new Error(`download failed (${r.status})`);
98243
+ const out = import_fs2.default.createWriteStream(dest);
98244
+ const tty = process.stdout.isTTY;
98245
+ let got = 0;
98246
+ let lastPct = -1;
98247
+ const reader = r.body.getReader();
98248
+ try {
98249
+ while (true) {
98250
+ const { done, value } = await reader.read();
98251
+ if (done) break;
98252
+ got += value.length;
98253
+ if (!out.write(value)) await new Promise((res) => out.once("drain", () => res()));
98254
+ const pct = total ? Math.floor(got / total * 100) : 0;
98255
+ if (tty && pct !== lastPct) {
98256
+ lastPct = pct;
98257
+ const mb = (n) => (n / 1048576).toFixed(0);
98258
+ process.stdout.write(`\r ${c.dim(`Downloading\u2026 ${pct}% (${mb(got)} / ${mb(total)} MB)`)}`);
98259
+ }
98260
+ }
98261
+ } finally {
98262
+ await new Promise((res, rej) => out.end((err) => err ? rej(err) : res()));
98263
+ if (tty) process.stdout.write("\n");
98264
+ }
98265
+ if (total && got !== total) throw new Error(`download incomplete (${got} of ${total} bytes)`);
98266
+ }
98267
+ function run(cmd, args) {
98268
+ const r = (0, import_child_process.spawnSync)(cmd, args, { encoding: "utf-8" });
98269
+ return { ok: r.status === 0, out: `${r.stdout ?? ""}${r.stderr ?? ""}`.trim() };
98270
+ }
98271
+ function canWrite(dir) {
98272
+ try {
98273
+ import_fs2.default.accessSync(dir, import_fs2.default.constants.W_OK);
98274
+ return true;
98275
+ } catch {
98276
+ return false;
98277
+ }
98278
+ }
98279
+ function installMac(dmg) {
98280
+ const mount = import_fs2.default.mkdtempSync(import_path2.default.join(import_os3.default.tmpdir(), "sproutkit-mnt-"));
98281
+ const attach = run("hdiutil", ["attach", dmg, "-nobrowse", "-readonly", "-mountpoint", mount]);
98282
+ if (!attach.ok) throw new Error(`couldn't open the disk image: ${attach.out}`);
98283
+ try {
98284
+ const src = import_path2.default.join(mount, "Sproutkit.app");
98285
+ if (!import_fs2.default.existsSync(src)) throw new Error("Sproutkit.app not found in the disk image");
98286
+ const destDir = process.env.SPROUTKIT_DESKTOP_DIR || (canWrite("/Applications") ? "/Applications" : import_path2.default.join(import_os3.default.homedir(), "Applications"));
98287
+ import_fs2.default.mkdirSync(destDir, { recursive: true });
98288
+ const dest = import_path2.default.join(destDir, "Sproutkit.app");
98289
+ import_fs2.default.rmSync(dest, { recursive: true, force: true });
98290
+ const copy = run("ditto", [src, dest]);
98291
+ if (!copy.ok) throw new Error(`couldn't copy the app: ${copy.out}`);
98292
+ run("xattr", ["-cr", dest]);
98293
+ return dest;
98294
+ } finally {
98295
+ run("hdiutil", ["detach", mount, "-quiet"]);
98296
+ import_fs2.default.rmSync(mount, { recursive: true, force: true });
98297
+ }
98298
+ }
98299
+ function installWindows(exe) {
98300
+ const r = run(exe, ["/S"]);
98301
+ if (!r.ok) throw new Error(`installer exited with an error${r.out ? `: ${r.out}` : ""}`);
98302
+ const p = desktopInstallPath();
98303
+ if (!p) throw new Error("installer finished but Sproutkit.exe wasn't found");
98304
+ return p;
98305
+ }
98306
+ async function installDesktop() {
98307
+ if (!desktopSupported()) {
98308
+ return { ok: false, error: "The desktop app is only available for macOS and Windows." };
98309
+ }
98310
+ say(c.dim(" Finding the latest desktop release\u2026"));
98311
+ const rel = await latestRelease();
98312
+ if ("error" in rel) return { ok: false, error: `Couldn't find a download: ${rel.error}` };
98313
+ const tmp = import_fs2.default.mkdtempSync(import_path2.default.join(import_os3.default.tmpdir(), "sproutkit-dl-"));
98314
+ const file = import_path2.default.join(tmp, rel.asset.name);
98315
+ try {
98316
+ await download(rel.asset.browser_download_url, file, rel.asset.size);
98317
+ say(c.dim(" Installing\u2026"));
98318
+ const dest = process.platform === "darwin" ? installMac(file) : installWindows(file);
98319
+ return { ok: true, path: dest, version: rel.version };
98320
+ } catch (e) {
98321
+ return { ok: false, error: e.message };
98322
+ } finally {
98323
+ import_fs2.default.rmSync(tmp, { recursive: true, force: true });
98324
+ }
98325
+ }
98326
+ function openDesktop() {
98327
+ const p = desktopInstallPath();
98328
+ if (!p) return false;
98329
+ const r = process.platform === "darwin" ? (0, import_child_process.spawnSync)("open", [p], { stdio: "ignore" }) : (0, import_child_process.spawnSync)("cmd", ["/c", "start", "", p], { stdio: "ignore" });
98330
+ return r.status === 0;
98331
+ }
98332
+ async function runDesktopCommand(args) {
98333
+ const existing = desktopInstallPath();
98334
+ if (existing && !args.includes("--update")) {
98335
+ say(c.green(` \u2713 The desktop app is installed (${existing}).`));
98336
+ if (!args.includes("--no-open") && openDesktop()) say(c.dim(" Opening it now."));
98337
+ say(c.dim(" Run 'sproutkit desktop --update' to reinstall the latest version."));
98338
+ return;
98339
+ }
98340
+ const res = await installDesktop();
98341
+ if (!res.ok) {
98342
+ say(c.red(` ${res.error}`));
98343
+ say(c.dim(" You can also download it from https://sproutkit.app/install"));
98344
+ process.exitCode = 1;
98345
+ return;
98346
+ }
98347
+ say(c.green(` \u2713 Sproutkit ${res.version} installed to ${res.path}`));
98348
+ if (!args.includes("--no-open") && openDesktop()) say(c.dim(" Opening it now."));
98349
+ }
98350
+ var import_fs2, import_os3, import_path2, import_child_process, RELEASES_API;
98351
+ var init_desktop_install = __esm({
98352
+ "src/desktop-install.ts"() {
98353
+ "use strict";
98354
+ import_fs2 = __toESM(require("fs"));
98355
+ import_os3 = __toESM(require("os"));
98356
+ import_path2 = __toESM(require("path"));
98357
+ import_child_process = require("child_process");
98358
+ init_tty();
98359
+ RELEASES_API = "https://api.github.com/repos/shaz2k/sproutkit-downloads/releases/latest";
98360
+ }
98361
+ });
98362
+
97789
98363
  // package.json
97790
98364
  var require_package2 = __commonJS({
97791
98365
  "package.json"(exports2, module2) {
97792
98366
  module2.exports = {
97793
98367
  name: "sproutkit-code",
97794
- version: "1.8.0",
98368
+ version: "1.9.1",
97795
98369
  description: "Sproutkit in your terminal \u2014 find leads, build sites, run outreach, all via chat.",
97796
98370
  bin: {
97797
98371
  sproutkit: "./dist/index.js"
@@ -97831,94 +98405,297 @@ var require_package2 = __commonJS({
97831
98405
  }
97832
98406
  });
97833
98407
 
97834
- // src/engine.ts
97835
- var db = require_db();
97836
- var chat = require_chat();
97837
- var chatTools = require_chat_tools();
97838
- var autoMode = require_auto_mode();
97839
- var cms = require_cms_provision();
97840
- var bookingPreset = require_booking_preset();
97841
- var builder = require_builder();
97842
- var vercelStore = require_vercel_store();
97843
- var agency = require_agency();
97844
- var followup = require_followup();
97845
- var invoicing = require_invoicing();
97846
- var models = require_models();
97847
- var llm = require_llm();
97848
- var initDatabase = db.initDatabase;
97849
- var getDb = db.getDb;
97850
- var chatWithTools = chat.chatWithTools;
97851
- var runTool = chatTools.runTool;
97852
- var startAutoJob = autoMode.startAutoJob;
97853
- var cancelAutoJob = autoMode.cancelAutoJob;
97854
- var provisionCmsForLead = cms.provisionCmsForLead;
97855
- var generatePreset = bookingPreset.generatePreset;
97856
- var deployBookingOnly = builder.deployBookingOnly;
97857
- var deployStandaloneBooking = builder.deployStandaloneBooking;
97858
- var handoverSite = builder.handoverSite;
97859
- var createBlobStore = vercelStore.createBlobStore;
97860
- var refreshModels = models.refreshModels;
97861
- var refreshIfStale = models.refreshIfStale;
97862
- var listCachedModels = models.listCachedModels;
97863
- var getPreferredModel = models.getPreferredModel;
97864
- var getAgencyProfile = agency.getAgencyProfile;
97865
- var setAgencyProfile = agency.setAgencyProfile;
97866
- var agencyConfigured = agency.agencyConfigured;
97867
- var formatMoney = agency.formatMoney;
97868
- var dueFollowUps = followup.dueFollowUps;
97869
- var outreachStats = followup.outreachStats;
97870
- var contactHistory = followup.contactHistory;
97871
- var renderLetterPdf = invoicing.renderLetterPdf;
97872
- var listInvoicesRaw = invoicing.listInvoices;
97873
- var checkClaudeCodeAuth = llm.checkClaudeCodeAuth;
97874
- var llmBackend = llm.getBackend;
97875
- var claudeBin = llm.claudeBin;
97876
- var CLAUDE_CODE_MODELS = llm.CLAUDE_CODE_MODELS;
97877
- var getClaudeCodeModel = llm.getClaudeCodeModel;
98408
+ // src/invoke-ipc.ts
98409
+ async function requireBlobToken(vercelToken, emit2, leadId) {
98410
+ const existing = getSetting("blob_token");
98411
+ if (existing) return existing;
98412
+ emit2("bookings:progress", { leadId, msg: "No Blob token yet \u2014 creating a Blob store for you\u2026" });
98413
+ const created = await createBlobStore({ vercelToken, name: "sproutkit" });
98414
+ if (created.ok) {
98415
+ throw new Error(
98416
+ "Created a Vercel Blob store for you \u2713 \u2014 one last one-time step: open " + (created.dashboardUrl || "https://vercel.com/dashboard/stores") + " , open the 'sproutkit' store, copy its BLOB_READ_WRITE_TOKEN, then run 'sproutkit setup' and paste it. You only do this once \u2014 it's reused for every booking site."
98417
+ );
98418
+ }
98419
+ if (created.alreadyExists) {
98420
+ throw new Error(
98421
+ "You already have a Blob store. Open https://vercel.com/dashboard/stores , copy its BLOB_READ_WRITE_TOKEN, and run 'sproutkit setup' to paste it (one-time \u2014 reused for all sites)."
98422
+ );
98423
+ }
98424
+ throw new Error(
98425
+ `Booking needs a Vercel Blob token and I couldn't auto-create a store (${created.error ?? "unknown"}). Create one at https://vercel.com/dashboard/stores (Create \u2192 Blob), copy BLOB_READ_WRITE_TOKEN, then 'sproutkit setup'.`
98426
+ );
98427
+ }
98428
+ function makeInvokeIpc(emit2) {
98429
+ return async (channel, payload) => {
98430
+ if (channel === "auto:build:start") {
98431
+ const args = payload;
98432
+ const anthropicKey = getSetting("anthropic_key");
98433
+ const vercelToken = getSetting("vercel_token");
98434
+ const placesKey = getSetting("places_key");
98435
+ if (!anthropicKey) throw new Error("Anthropic API key not set");
98436
+ if (!vercelToken) throw new Error("Vercel token not set");
98437
+ return startAutoJob({
98438
+ leadIds: args.leadIds,
98439
+ concurrency: args.concurrency,
98440
+ anthropicKey,
98441
+ vercelToken,
98442
+ placesKey,
98443
+ emit: emit2
98444
+ });
98445
+ }
98446
+ if (channel === "cms:provision") {
98447
+ const leadId = Number(payload);
98448
+ const db2 = getDb();
98449
+ const lead = db2.get("SELECT * FROM leads WHERE id = ?", [leadId]);
98450
+ if (!lead) throw new Error("Lead not found");
98451
+ const placesKey = getSetting("places_key");
98452
+ const vercelToken = getSetting("vercel_token");
98453
+ const licenseKey = getSetting("license_key");
98454
+ const apiBaseUrl = process.env.SPROUTKIT_API_BASE_URL ?? "https://sproutkit.app";
98455
+ if (!vercelToken) throw new Error("Vercel token not set");
98456
+ emit2("cms:progress", { leadId, msg: "Starting\u2026" });
98457
+ const result = await provisionCmsForLead({
98458
+ lead,
98459
+ placesKey,
98460
+ vercelToken,
98461
+ apiBaseUrl,
98462
+ licenseKey,
98463
+ onProgress: (msg) => emit2("cms:progress", { leadId, msg })
98464
+ });
98465
+ db2.run("UPDATE leads SET site_url = ?, status = 'won' WHERE id = ?", [
98466
+ result.publicUrl,
98467
+ leadId
98468
+ ]);
98469
+ emit2("cms:done", { leadId, ok: true, ...result });
98470
+ return result;
98471
+ }
98472
+ if (channel === "bookings:provision") {
98473
+ const p = payload;
98474
+ const db2 = getDb();
98475
+ const lead = db2.get("SELECT * FROM leads WHERE id = ?", [p.leadId]);
98476
+ if (!lead) throw new Error("Lead not found");
98477
+ const anthropicKey = getSetting("anthropic_key");
98478
+ const vercelToken = getSetting("vercel_token");
98479
+ const resendKey = getSetting("resend_key");
98480
+ if (!anthropicKey) throw new Error("Anthropic API key not set");
98481
+ if (!vercelToken) throw new Error("Vercel token not set");
98482
+ const blobToken = await requireBlobToken(vercelToken, emit2, p.leadId);
98483
+ emit2("bookings:progress", { leadId: p.leadId, msg: "Designing the booking form\u2026" });
98484
+ const leadInfo = lead;
98485
+ const config = await generatePreset({
98486
+ anthropicKey,
98487
+ lead: { name: leadInfo.name, type: leadInfo.type, city: leadInfo.city },
98488
+ instructions: p.instructions,
98489
+ archetypeOverride: p.archetypeOverride
98490
+ });
98491
+ const result = await deployBookingOnly({
98492
+ lead,
98493
+ vercelToken,
98494
+ blobToken,
98495
+ resendKey: resendKey || "",
98496
+ ownerEmail: p.ownerEmail ?? "",
98497
+ bookingConfig: config,
98498
+ anthropicKey,
98499
+ onProgress: (msg) => emit2("bookings:progress", { leadId: p.leadId, msg })
98500
+ });
98501
+ db2.run(
98502
+ "UPDATE leads SET booking_url = ?, owner_email = ?, booking_archetype = ?, booking_config = ? WHERE id = ?",
98503
+ [
98504
+ result.bookingUrl,
98505
+ p.ownerEmail ?? "",
98506
+ config.archetype,
98507
+ JSON.stringify(config),
98508
+ p.leadId
98509
+ ]
98510
+ );
98511
+ emit2("bookings:done", { leadId: p.leadId, ...result });
98512
+ return result;
98513
+ }
98514
+ if (channel === "bookings:provision-standalone") {
98515
+ const p = payload;
98516
+ const db2 = getDb();
98517
+ const lead = db2.get("SELECT * FROM leads WHERE id = ?", [p.leadId]);
98518
+ if (!lead) throw new Error("Lead not found");
98519
+ const vercelToken = getSetting("vercel_token");
98520
+ const resendKey = getSetting("resend_key");
98521
+ if (!vercelToken) throw new Error("Vercel token not set");
98522
+ const blobToken = await requireBlobToken(vercelToken, emit2, p.leadId);
98523
+ emit2("bookings:progress", { leadId: p.leadId, msg: "Designing the booking form\u2026" });
98524
+ const leadInfo = lead;
98525
+ const config = await generatePreset({
98526
+ anthropicKey: getSetting("anthropic_key") ?? "",
98527
+ lead: { name: leadInfo.name, type: leadInfo.type, city: leadInfo.city },
98528
+ instructions: p.instructions,
98529
+ archetypeOverride: p.archetypeOverride
98530
+ });
98531
+ const result = await deployStandaloneBooking({
98532
+ lead,
98533
+ vercelToken,
98534
+ blobToken,
98535
+ resendKey: resendKey || "",
98536
+ ownerEmail: p.ownerEmail ?? "",
98537
+ bookingConfig: config,
98538
+ reuseAdminPassword: lead.booking_admin_password ?? null,
98539
+ onProgress: (msg) => emit2("bookings:progress", { leadId: p.leadId, msg })
98540
+ });
98541
+ db2.run(
98542
+ `UPDATE leads SET booking_url = ?, owner_email = ?, booking_archetype = ?, booking_config = ?,
98543
+ booking_admin_url = ?, booking_admin_password = ?,
98544
+ status = CASE WHEN status = 'discovered' THEN 'site_built' ELSE status END
98545
+ WHERE id = ?`,
98546
+ [
98547
+ result.bookingUrl,
98548
+ p.ownerEmail ?? "",
98549
+ config.archetype,
98550
+ JSON.stringify(config),
98551
+ result.admin.url,
98552
+ result.admin.password,
98553
+ p.leadId
98554
+ ]
98555
+ );
98556
+ emit2("bookings:done", { leadId: p.leadId, ...result });
98557
+ return result;
98558
+ }
98559
+ if (channel === "site:handover") {
98560
+ const p = payload;
98561
+ const db2 = getDb();
98562
+ const lead = db2.get("SELECT * FROM leads WHERE id = ?", [p.leadId]);
98563
+ if (!lead) throw new Error("Lead not found");
98564
+ const vercelToken = getSetting("vercel_token");
98565
+ if (!vercelToken) throw new Error("Vercel token not set");
98566
+ return await handoverSite({
98567
+ lead,
98568
+ vercelToken,
98569
+ blobToken: getSetting("blob_token"),
98570
+ domain: p.domain ?? null,
98571
+ onProgress: (msg) => emit2("sites:progress", { leadId: p.leadId, msg })
98572
+ });
98573
+ }
98574
+ throw new Error(`channel not supported in CLI: ${channel}`);
98575
+ };
98576
+ }
98577
+ var init_invoke_ipc = __esm({
98578
+ "src/invoke-ipc.ts"() {
98579
+ "use strict";
98580
+ init_engine();
98581
+ init_config();
98582
+ }
98583
+ });
97878
98584
 
97879
- // src/config.ts
97880
- var REQUIRED_KEYS = [
97881
- { key: "anthropic_key", label: "Anthropic API key", hint: "sk-ant-\u2026 \u2014 powers the chat + site generation", required: true, apiBackendOnly: true },
97882
- { key: "places_key", label: "Google Places API key", hint: "finds businesses, photos, reviews", required: true },
97883
- { key: "vercel_token", label: "Vercel token", hint: "deploys the generated sites", required: true },
97884
- { key: "blob_token", label: "Vercel Blob token", hint: "required for booking sites & CMS (stores form config/submissions)", required: false },
97885
- { key: "resend_key", label: "Resend API key", hint: "optional \u2014 emails the business owner when a booking comes in", required: false },
97886
- // SMTP for email outreach — used per-lead when a business has no phone. All
97887
- // optional; without them, email-only leads are simply skipped.
97888
- { key: "smtp_host", label: "SMTP host", hint: "optional \u2014 for email outreach, e.g. smtp.gmail.com", required: false },
97889
- { key: "smtp_port", label: "SMTP port", hint: "optional \u2014 587 (STARTTLS) or 465 (TLS); default 587", required: false },
97890
- { key: "smtp_user", label: "SMTP username", hint: "optional \u2014 your email login", required: false },
97891
- { key: "smtp_pass", label: "SMTP password", hint: "optional \u2014 password or app-password", required: false },
97892
- { key: "smtp_from", label: "Email 'From'", hint: "optional \u2014 e.g. You <you@domain.com>; defaults to the username", required: false }
97893
- ];
97894
- function getSetting(key) {
97895
- const row = getDb().get("SELECT value FROM settings WHERE key = ?", [key]);
97896
- return row?.value ?? null;
98585
+ // src/mcp.ts
98586
+ var mcp_exports = {};
98587
+ __export(mcp_exports, {
98588
+ runMcpServer: () => runMcpServer
98589
+ });
98590
+ function send(msg) {
98591
+ process.stdout.write(JSON.stringify(msg) + "\n");
97897
98592
  }
97898
- function setSetting(key, value) {
97899
- getDb().run(
97900
- "INSERT INTO settings (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value",
97901
- [key, value]
97902
- );
98593
+ function reply(id, result) {
98594
+ if (id === void 0 || id === null) return;
98595
+ send({ jsonrpc: "2.0", id, result });
97903
98596
  }
97904
- function getBackend() {
97905
- return getSetting("ai_backend") === "claude_code" ? "claude_code" : "api";
98597
+ function replyError(id, code, message) {
98598
+ if (id === void 0 || id === null) return;
98599
+ send({ jsonrpc: "2.0", id, error: { code, message } });
97906
98600
  }
97907
- function setBackend(b) {
97908
- setSetting("ai_backend", b);
98601
+ async function handle(req) {
98602
+ switch (req.method) {
98603
+ case "initialize":
98604
+ reply(req.id, {
98605
+ protocolVersion: PROTOCOL_VERSION,
98606
+ capabilities: { tools: {} },
98607
+ serverInfo: { name: "sproutkit", version: "1.0.0" }
98608
+ });
98609
+ return;
98610
+ case "notifications/initialized":
98611
+ return;
98612
+ case "tools/list":
98613
+ reply(req.id, {
98614
+ tools: TOOLS.map((t) => ({
98615
+ name: t.name,
98616
+ description: t.description,
98617
+ inputSchema: t.input_schema
98618
+ }))
98619
+ });
98620
+ return;
98621
+ case "tools/call": {
98622
+ const name = String(req.params?.name ?? "");
98623
+ const args = req.params?.arguments ?? {};
98624
+ if (!TOOLS.some((t) => t.name === name)) {
98625
+ replyError(req.id, -32602, `Unknown tool: ${name}`);
98626
+ return;
98627
+ }
98628
+ try {
98629
+ const out = await runTool(name, args, {
98630
+ invokeIpc: makeInvokeIpc(emit),
98631
+ emitProgress: (e) => emit(e.channel, e.payload)
98632
+ });
98633
+ reply(req.id, {
98634
+ content: [{ type: "text", text: JSON.stringify(out ?? { ok: true }, null, 2) }]
98635
+ });
98636
+ } catch (e) {
98637
+ reply(req.id, {
98638
+ content: [{ type: "text", text: `Error: ${e.message}` }],
98639
+ isError: true
98640
+ });
98641
+ }
98642
+ return;
98643
+ }
98644
+ default:
98645
+ replyError(req.id, -32601, `Method not found: ${req.method}`);
98646
+ }
97909
98647
  }
97910
- function missingRequiredKeys() {
97911
- const backend = getBackend();
97912
- return REQUIRED_KEYS.filter((k) => {
97913
- if (!k.required) return false;
97914
- if ("apiBackendOnly" in k && k.apiBackendOnly && backend !== "api") return false;
97915
- return !getSetting(k.key);
97916
- }).map((k) => ({ key: k.key, label: k.label, hint: k.hint }));
98648
+ async function runMcpServer() {
98649
+ process.stdin.setEncoding("utf-8");
98650
+ let buffer = "";
98651
+ process.stdin.on("data", (chunk) => {
98652
+ buffer += chunk;
98653
+ let idx;
98654
+ while ((idx = buffer.indexOf("\n")) !== -1) {
98655
+ const line = buffer.slice(0, idx).trim();
98656
+ buffer = buffer.slice(idx + 1);
98657
+ if (!line) continue;
98658
+ let req;
98659
+ try {
98660
+ req = JSON.parse(line);
98661
+ } catch {
98662
+ process.stderr.write(`[sproutkit-mcp] bad JSON: ${line.slice(0, 200)}
98663
+ `);
98664
+ continue;
98665
+ }
98666
+ void handle(req).catch((e) => {
98667
+ process.stderr.write(`[sproutkit-mcp] handler failed: ${e.message}
98668
+ `);
98669
+ replyError(req.id, -32603, e.message);
98670
+ });
98671
+ }
98672
+ });
98673
+ await new Promise((resolve) => process.stdin.on("end", resolve));
97917
98674
  }
98675
+ var PROTOCOL_VERSION, emit;
98676
+ var init_mcp = __esm({
98677
+ "src/mcp.ts"() {
98678
+ "use strict";
98679
+ init_engine();
98680
+ init_invoke_ipc();
98681
+ PROTOCOL_VERSION = "2024-11-05";
98682
+ emit = (channel, payload) => {
98683
+ process.stderr.write(`[sproutkit-mcp] ${channel} ${JSON.stringify(payload)}
98684
+ `);
98685
+ };
98686
+ }
98687
+ });
98688
+
98689
+ // src/index.ts
98690
+ init_engine();
98691
+
98692
+ // src/onboarding.ts
98693
+ init_config();
97918
98694
 
97919
98695
  // src/license.ts
97920
98696
  var import_os = __toESM(require("os"));
97921
98697
  var import_crypto = require("crypto");
98698
+ init_config();
97922
98699
  var GRACE_MS = 7 * 24 * 60 * 60 * 1e3;
97923
98700
  function apiBase() {
97924
98701
  return process.env.SPROUTKIT_API_BASE_URL ?? "https://sproutkit.app";
@@ -97947,7 +98724,7 @@ async function activate(key) {
97947
98724
  if (!result) return { status: "missing" };
97948
98725
  if (!result.valid) {
97949
98726
  return {
97950
- status: result.reason === "revoked" ? "revoked" : result.reason === "refunded" ? "refunded" : "missing",
98727
+ status: result.reason === "revoked" ? "revoked" : result.reason === "refunded" ? "refunded" : result.reason === "expired" ? "expired" : "missing",
97951
98728
  email: result.email
97952
98729
  };
97953
98730
  }
@@ -97966,7 +98743,7 @@ async function check() {
97966
98743
  return { status: "active", email: result.email };
97967
98744
  }
97968
98745
  return {
97969
- status: result.reason === "revoked" ? "revoked" : result.reason === "refunded" ? "refunded" : "missing",
98746
+ status: result.reason === "revoked" ? "revoked" : result.reason === "refunded" ? "refunded" : result.reason === "expired" ? "expired" : "missing",
97970
98747
  email: result.email
97971
98748
  };
97972
98749
  }
@@ -97975,209 +98752,9 @@ async function check() {
97975
98752
  return { status: "offline_grace_expired" };
97976
98753
  }
97977
98754
 
97978
- // src/tty.ts
97979
- var import_readline = __toESM(require("readline"));
97980
- var useColor = process.stdout.isTTY && !process.env.NO_COLOR;
97981
- var wrap = (code) => (s) => useColor ? `\x1B[${code}m${s}\x1B[0m` : s;
97982
- var c = {
97983
- green: wrap("38;5;65"),
97984
- // moss, matches the brand
97985
- greenBold: wrap("1;38;5;65"),
97986
- dim: wrap("2"),
97987
- bold: wrap("1"),
97988
- red: wrap("31"),
97989
- amber: wrap("33"),
97990
- cyan: wrap("36")
97991
- };
97992
- var rl = null;
97993
- function iface() {
97994
- if (!rl) rl = import_readline.default.createInterface({ input: process.stdin, output: process.stdout });
97995
- return rl;
97996
- }
97997
- function ask(question) {
97998
- return new Promise((resolve) => iface().question(question, (a) => resolve(a.trim())));
97999
- }
98000
- function askSecret(question) {
98001
- return new Promise((resolve) => {
98002
- const i = iface();
98003
- process.stdout.write(question);
98004
- const stdin = process.stdin;
98005
- const onData = (char) => {
98006
- const s = char.toString();
98007
- if (s === "\n" || s === "\r" || s === "") return;
98008
- };
98009
- const realWrite = i._writeToOutput;
98010
- i._writeToOutput = (str) => {
98011
- if (str.includes(question)) process.stdout.write(str);
98012
- else process.stdout.write("*");
98013
- };
98014
- i.question("", (answer) => {
98015
- i._writeToOutput = realWrite;
98016
- process.stdout.write("\n");
98017
- stdin.removeListener("data", onData);
98018
- resolve(answer.trim());
98019
- });
98020
- });
98021
- }
98022
- function closeTty() {
98023
- rl?.close();
98024
- rl = null;
98025
- }
98026
- function onStopRequested(onStop) {
98027
- let stopped = false;
98028
- const stdin = process.stdin;
98029
- const wasRaw = !!stdin.isTTY && stdin.isRaw;
98030
- const handler = (buf) => {
98031
- const s = buf.toString();
98032
- if (s === "q" || s === "Q" || s === "\x1B" || s === "") {
98033
- if (!stopped) {
98034
- stopped = true;
98035
- onStop?.();
98036
- }
98037
- }
98038
- };
98039
- if (stdin.isTTY) {
98040
- try {
98041
- stdin.setRawMode(true);
98042
- stdin.resume();
98043
- stdin.on("data", handler);
98044
- } catch {
98045
- }
98046
- }
98047
- return {
98048
- stopped: () => stopped,
98049
- release: () => {
98050
- if (!stdin.isTTY) return;
98051
- try {
98052
- stdin.removeListener("data", handler);
98053
- stdin.setRawMode(wasRaw);
98054
- stdin.pause();
98055
- } catch {
98056
- }
98057
- }
98058
- };
98059
- }
98060
- function say(msg = "") {
98061
- process.stdout.write(msg + "\n");
98062
- }
98063
- var FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
98064
- var Status = class {
98065
- timer = null;
98066
- frame = 0;
98067
- label = "";
98068
- stage = "";
98069
- tty = process.stdout.isTTY && useColor;
98070
- start(label) {
98071
- this.label = label;
98072
- this.stage = "";
98073
- if (!this.tty) {
98074
- say(c.cyan(` \u27F3 ${label}`));
98075
- return;
98076
- }
98077
- this.render();
98078
- this.timer = setInterval(() => {
98079
- this.frame = (this.frame + 1) % FRAMES.length;
98080
- this.render();
98081
- }, 80);
98082
- }
98083
- // Update the current stage (e.g. "Generating site with Claude…").
98084
- update(stage) {
98085
- this.stage = stage;
98086
- if (!this.tty) {
98087
- say(c.dim(` \u2026 ${stage}`));
98088
- return;
98089
- }
98090
- this.render();
98091
- }
98092
- render() {
98093
- const spin = c.cyan(FRAMES[this.frame]);
98094
- const stage = this.stage ? c.dim(` \xB7 ${this.stage}`) : "";
98095
- process.stdout.write(`\r\x1B[2K ${spin} ${this.label}${stage}`);
98096
- }
98097
- // Stop with a terminal state, leaving one clean line behind.
98098
- done(ok, finalLabel) {
98099
- if (this.timer) {
98100
- clearInterval(this.timer);
98101
- this.timer = null;
98102
- }
98103
- const label = finalLabel ?? this.label;
98104
- const mark2 = ok ? c.green("\u2713") : c.red("\u2717");
98105
- if (this.tty) process.stdout.write(`\r\x1B[2K ${mark2} ${label}
98106
- `);
98107
- else say(` ${mark2} ${label}`);
98108
- }
98109
- };
98110
- var STATE_MARK = {
98111
- queued: () => c.dim("\xB7"),
98112
- building: () => c.cyan(""),
98113
- // spinner frame filled in at render time
98114
- built: () => c.green("\u2713"),
98115
- failed: () => c.red("\u2717"),
98116
- skipped: () => c.dim("\u2013")
98117
- };
98118
- var StatusBoard = class {
98119
- rows = [];
98120
- frame = 0;
98121
- timer = null;
98122
- lastLineCount = 0;
98123
- tty = process.stdout.isTTY && useColor;
98124
- // Non-TTY: remember the last printed signature per row so we only log changes.
98125
- lastSig = /* @__PURE__ */ new Map();
98126
- header = "";
98127
- start(header, rows) {
98128
- this.header = header;
98129
- this.rows = rows;
98130
- if (!this.tty) {
98131
- say(c.cyan(` \u27F3 ${header}`));
98132
- this.rows.forEach((r) => this.logRowIfChanged(r));
98133
- return;
98134
- }
98135
- say(c.cyan(` \u27F3 ${header}`));
98136
- this.render();
98137
- this.timer = setInterval(() => {
98138
- this.frame = (this.frame + 1) % FRAMES.length;
98139
- this.render();
98140
- }, 90);
98141
- }
98142
- update(row) {
98143
- const i = this.rows.findIndex((r) => r.key === row.key);
98144
- if (i >= 0) this.rows[i] = row;
98145
- else this.rows.push(row);
98146
- if (!this.tty) this.logRowIfChanged(row);
98147
- else this.render();
98148
- }
98149
- // Replace the whole set at once (e.g. from a job snapshot).
98150
- set(rows) {
98151
- this.rows = rows;
98152
- if (!this.tty) rows.forEach((r) => this.logRowIfChanged(r));
98153
- else this.render();
98154
- }
98155
- line(r) {
98156
- const mark2 = r.state === "building" ? c.cyan(FRAMES[this.frame]) : STATE_MARK[r.state]();
98157
- const detail = r.detail ? c.dim(` \xB7 ${r.detail}`) : "";
98158
- return ` ${mark2} ${r.label}${detail}`;
98159
- }
98160
- logRowIfChanged(r) {
98161
- const sig = `${r.state}:${r.detail ?? ""}`;
98162
- if (this.lastSig.get(r.key) === sig) return;
98163
- this.lastSig.set(r.key, sig);
98164
- const mark2 = r.state === "built" ? "\u2713" : r.state === "failed" ? "\u2717" : r.state === "skipped" ? "\u2013" : "\u2026";
98165
- say(` ${mark2} ${r.label}${r.detail ? ` \xB7 ${r.detail}` : ""}`);
98166
- }
98167
- render() {
98168
- if (this.lastLineCount > 0) process.stdout.write(`\x1B[${this.lastLineCount}A`);
98169
- const out = this.rows.map((r) => `\x1B[2K${this.line(r)}`).join("\n");
98170
- process.stdout.write(out + "\n");
98171
- this.lastLineCount = this.rows.length;
98172
- }
98173
- stop() {
98174
- if (this.timer) {
98175
- clearInterval(this.timer);
98176
- this.timer = null;
98177
- }
98178
- if (this.tty) this.render();
98179
- }
98180
- };
98755
+ // src/onboarding.ts
98756
+ init_engine();
98757
+ init_tty();
98181
98758
 
98182
98759
  // src/skill-install.ts
98183
98760
  var import_fs = __toESM(require("fs"));
@@ -98255,11 +98832,12 @@ function installSkill() {
98255
98832
  }
98256
98833
 
98257
98834
  // src/onboarding.ts
98258
- var import_child_process = require("child_process");
98835
+ init_desktop_install();
98836
+ var import_child_process2 = require("child_process");
98259
98837
  function claudeCliPresent() {
98260
98838
  try {
98261
98839
  const bin = process.env.SPROUTKIT_CLAUDE_BIN || "claude";
98262
- const r = (0, import_child_process.spawnSync)(bin, ["--version"], { stdio: "ignore", timeout: 1e4 });
98840
+ const r = (0, import_child_process2.spawnSync)(bin, ["--version"], { stdio: "ignore", timeout: 1e4 });
98263
98841
  return r.status === 0;
98264
98842
  } catch {
98265
98843
  return false;
@@ -98341,6 +98919,26 @@ async function offerSkillInstall(force) {
98341
98919
  }
98342
98920
  say();
98343
98921
  }
98922
+ async function offerDesktopInstall() {
98923
+ if (!desktopSupported() || desktopInstallPath()) return;
98924
+ say(` ${c.bold("Desktop app")}`);
98925
+ say(c.dim(" The map, pipeline board and Workflows live in the desktop app, and your"));
98926
+ say(c.dim(" terminal leads sync into it. It's about a 100 MB download."));
98927
+ const ans = (await ask(c.green(" Install it now? [Y/n] "))).trim().toLowerCase();
98928
+ if (ans === "n" || ans === "no") {
98929
+ say(c.dim(" Skipped \u2014 install it any time with 'sproutkit desktop'."));
98930
+ say();
98931
+ return;
98932
+ }
98933
+ const res = await installDesktop();
98934
+ if (res.ok) {
98935
+ say(c.green(` \u2713 Sproutkit ${res.version} installed to ${res.path}`));
98936
+ } else {
98937
+ say(c.amber(` Couldn't install the desktop app: ${res.error}`));
98938
+ say(c.dim(" Try again with 'sproutkit desktop', or download it from https://sproutkit.app/install"));
98939
+ }
98940
+ say();
98941
+ }
98344
98942
  async function onboardLicense(force) {
98345
98943
  if (!force) {
98346
98944
  const state = await check();
@@ -98362,7 +98960,7 @@ async function onboardLicense(force) {
98362
98960
  say();
98363
98961
  return true;
98364
98962
  }
98365
- const msg = state.status === "revoked" ? "That licence has been revoked." : state.status === "refunded" ? "That licence was refunded." : "Couldn't validate that key (check it, or your connection).";
98963
+ const msg = state.status === "revoked" ? "That licence has been revoked." : state.status === "refunded" ? "That licence was refunded." : state.status === "expired" ? "That subscription has ended \u2014 renew at https://sproutkit.app/#pricing." : "Couldn't validate that key (check it, or your connection).";
98366
98964
  say(c.red(` ${msg} Try again, or press Enter to quit.`));
98367
98965
  }
98368
98966
  }
@@ -98398,6 +98996,7 @@ async function runOnboarding(force = false) {
98398
98996
  } catch {
98399
98997
  }
98400
98998
  }
98999
+ await offerDesktopInstall();
98401
99000
  const stillMissing = missingRequiredKeys();
98402
99001
  if (stillMissing.length > 0) {
98403
99002
  say(c.amber(` Still missing: ${stillMissing.map((m) => m.label).join(", ")}.`));
@@ -98411,9 +99010,11 @@ async function runOnboarding(force = false) {
98411
99010
  }
98412
99011
 
98413
99012
  // src/update.ts
98414
- var import_child_process2 = require("child_process");
99013
+ var import_child_process3 = require("child_process");
98415
99014
  var import_util = require("util");
98416
- var execFileP = (0, import_util.promisify)(import_child_process2.execFile);
99015
+ init_config();
99016
+ init_tty();
99017
+ var execFileP = (0, import_util.promisify)(import_child_process3.execFile);
98417
99018
  var PKG = "sproutkit-code";
98418
99019
  var CURRENT_VERSION = require_package2().version;
98419
99020
  async function latestOnRegistry() {
@@ -98476,10 +99077,12 @@ async function notifyIfOutdated() {
98476
99077
  }
98477
99078
 
98478
99079
  // src/sync.ts
98479
- var import_os3 = __toESM(require("os"));
98480
- var import_path2 = __toESM(require("path"));
98481
- var import_fs2 = __toESM(require("fs"));
98482
- var COLS = [
99080
+ var import_os4 = __toESM(require("os"));
99081
+ var import_path3 = __toESM(require("path"));
99082
+ var import_fs3 = __toESM(require("fs"));
99083
+ init_engine();
99084
+ init_tty();
99085
+ var WANTED_COLS = [
98483
99086
  "place_id",
98484
99087
  "name",
98485
99088
  "type",
@@ -98498,50 +99101,79 @@ var COLS = [
98498
99101
  "notes",
98499
99102
  "score",
98500
99103
  "price_level",
98501
- "business_status"
99104
+ "business_status",
99105
+ // Deliverables and stage timestamps — without these the desktop board can't
99106
+ // show booking pages, attached domains, delivered status or stalled leads.
99107
+ "booking_url",
99108
+ "custom_domain",
99109
+ "handed_over_at",
99110
+ "replied_at",
99111
+ "dead_at",
99112
+ "email"
99113
+ ];
99114
+ var UPDATE_COLS = [
99115
+ "status",
99116
+ "site_url",
99117
+ "site_built_at",
99118
+ "score",
99119
+ "booking_url",
99120
+ "custom_domain",
99121
+ "handed_over_at",
99122
+ "replied_at",
99123
+ "dead_at",
99124
+ "email"
98502
99125
  ];
99126
+ function columnsOf(db2, table) {
99127
+ const rows = db2.all(`PRAGMA table_info(${table})`);
99128
+ return new Set(rows.map((r) => r.name));
99129
+ }
98503
99130
  function desktopDbPath() {
98504
- const home = import_os3.default.homedir();
99131
+ const home = import_os4.default.homedir();
98505
99132
  const candidates = [];
98506
99133
  if (process.platform === "darwin") {
98507
- candidates.push(import_path2.default.join(home, "Library", "Application Support", "Sproutkit", "data", "sproutio.db"));
99134
+ candidates.push(import_path3.default.join(home, "Library", "Application Support", "Sproutkit", "data", "sproutio.db"));
98508
99135
  } else if (process.platform === "win32") {
98509
- const appData = process.env.APPDATA || import_path2.default.join(home, "AppData", "Roaming");
98510
- candidates.push(import_path2.default.join(appData, "Sproutkit", "data", "sproutio.db"));
99136
+ const appData = process.env.APPDATA || import_path3.default.join(home, "AppData", "Roaming");
99137
+ candidates.push(import_path3.default.join(appData, "Sproutkit", "data", "sproutio.db"));
98511
99138
  } else {
98512
- const cfg = process.env.XDG_CONFIG_HOME || import_path2.default.join(home, ".config");
98513
- candidates.push(import_path2.default.join(cfg, "Sproutkit", "data", "sproutio.db"));
99139
+ const cfg = process.env.XDG_CONFIG_HOME || import_path3.default.join(home, ".config");
99140
+ candidates.push(import_path3.default.join(cfg, "Sproutkit", "data", "sproutio.db"));
98514
99141
  }
98515
- return candidates.find((p) => import_fs2.default.existsSync(p)) ?? null;
99142
+ return candidates.find((p) => import_fs3.default.existsSync(p)) ?? null;
98516
99143
  }
98517
99144
  function syncToDesktop(opts = {}) {
98518
99145
  const dest = desktopDbPath();
98519
99146
  if (!dest) return { ok: false, reason: "no_desktop_db", inserted: 0, updated: 0 };
98520
- const cliLeads = getDb().all(
98521
- `SELECT ${COLS.join(", ")} FROM leads WHERE place_id IS NOT NULL AND place_id != ''`,
98522
- []
98523
- );
98524
- if (cliLeads.length === 0) return { ok: true, inserted: 0, updated: 0 };
98525
99147
  const { Database } = require("node-sqlite3-wasm");
98526
99148
  const ddb = new Database(dest);
98527
99149
  let inserted = 0;
98528
99150
  let updated = 0;
98529
99151
  try {
99152
+ const shared = new Set(
99153
+ [...columnsOf(getDb(), "leads")].filter((n) => columnsOf(ddb, "leads").has(n))
99154
+ );
99155
+ const cols = WANTED_COLS.filter((c2) => shared.has(c2));
99156
+ const updateCols = UPDATE_COLS.filter((c2) => shared.has(c2));
99157
+ const cliLeads = getDb().all(
99158
+ `SELECT ${cols.join(", ")} FROM leads WHERE place_id IS NOT NULL AND place_id != ''`,
99159
+ []
99160
+ );
99161
+ if (cliLeads.length === 0) return { ok: true, inserted: 0, updated: 0 };
98530
99162
  for (const lead of cliLeads) {
98531
99163
  const existing = ddb.get("SELECT id FROM leads WHERE place_id = ?", [lead.place_id]);
98532
99164
  if (existing) {
98533
99165
  ddb.run(
98534
- "UPDATE leads SET status = ?, site_url = ?, site_built_at = ?, score = ? WHERE place_id = ?",
98535
- [lead.status, lead.site_url, lead.site_built_at, lead.score, lead.place_id].map(
99166
+ `UPDATE leads SET ${updateCols.map((k) => `${k} = ?`).join(", ")} WHERE place_id = ?`,
99167
+ [...updateCols.map((k) => lead[k]), lead.place_id].map(
98536
99168
  (v) => v ?? null
98537
99169
  )
98538
99170
  );
98539
99171
  updated++;
98540
99172
  } else {
98541
- const placeholders = COLS.map(() => "?").join(", ");
99173
+ const placeholders = cols.map(() => "?").join(", ");
98542
99174
  ddb.run(
98543
- `INSERT INTO leads (${COLS.join(", ")}) VALUES (${placeholders})`,
98544
- COLS.map((k) => lead[k] ?? null)
99175
+ `INSERT INTO leads (${cols.join(", ")}) VALUES (${placeholders})`,
99176
+ cols.map((k) => lead[k] ?? null)
98545
99177
  );
98546
99178
  inserted++;
98547
99179
  }
@@ -98567,6 +99199,9 @@ function autoSync() {
98567
99199
  }
98568
99200
 
98569
99201
  // src/models-cmd.ts
99202
+ init_engine();
99203
+ init_config();
99204
+ init_tty();
98570
99205
  async function runModelsClaudeCode() {
98571
99206
  const current = getClaudeCodeModel();
98572
99207
  say();
@@ -98639,187 +99274,21 @@ async function runModels() {
98639
99274
  say(c.green(` \u2713 Now using ${models2[idx].display_name ?? models2[idx].id}.`));
98640
99275
  }
98641
99276
 
98642
- // src/invoke-ipc.ts
98643
- async function requireBlobToken(vercelToken, emit, leadId) {
98644
- const existing = getSetting("blob_token");
98645
- if (existing) return existing;
98646
- emit("bookings:progress", { leadId, msg: "No Blob token yet \u2014 creating a Blob store for you\u2026" });
98647
- const created = await createBlobStore({ vercelToken, name: "sproutkit" });
98648
- if (created.ok) {
98649
- throw new Error(
98650
- "Created a Vercel Blob store for you \u2713 \u2014 one last one-time step: open " + (created.dashboardUrl || "https://vercel.com/dashboard/stores") + " , open the 'sproutkit' store, copy its BLOB_READ_WRITE_TOKEN, then run 'sproutkit setup' and paste it. You only do this once \u2014 it's reused for every booking site."
98651
- );
98652
- }
98653
- if (created.alreadyExists) {
98654
- throw new Error(
98655
- "You already have a Blob store. Open https://vercel.com/dashboard/stores , copy its BLOB_READ_WRITE_TOKEN, and run 'sproutkit setup' to paste it (one-time \u2014 reused for all sites)."
98656
- );
98657
- }
98658
- throw new Error(
98659
- `Booking needs a Vercel Blob token and I couldn't auto-create a store (${created.error ?? "unknown"}). Create one at https://vercel.com/dashboard/stores (Create \u2192 Blob), copy BLOB_READ_WRITE_TOKEN, then 'sproutkit setup'.`
98660
- );
98661
- }
98662
- function makeInvokeIpc(emit) {
98663
- return async (channel, payload) => {
98664
- if (channel === "auto:build:start") {
98665
- const args = payload;
98666
- const anthropicKey = getSetting("anthropic_key");
98667
- const vercelToken = getSetting("vercel_token");
98668
- const placesKey = getSetting("places_key");
98669
- if (!anthropicKey) throw new Error("Anthropic API key not set");
98670
- if (!vercelToken) throw new Error("Vercel token not set");
98671
- return startAutoJob({
98672
- leadIds: args.leadIds,
98673
- concurrency: args.concurrency,
98674
- anthropicKey,
98675
- vercelToken,
98676
- placesKey,
98677
- emit
98678
- });
98679
- }
98680
- if (channel === "cms:provision") {
98681
- const leadId = Number(payload);
98682
- const db2 = getDb();
98683
- const lead = db2.get("SELECT * FROM leads WHERE id = ?", [leadId]);
98684
- if (!lead) throw new Error("Lead not found");
98685
- const placesKey = getSetting("places_key");
98686
- const vercelToken = getSetting("vercel_token");
98687
- const licenseKey = getSetting("license_key");
98688
- const apiBaseUrl = process.env.SPROUTKIT_API_BASE_URL ?? "https://sproutkit.app";
98689
- if (!vercelToken) throw new Error("Vercel token not set");
98690
- emit("cms:progress", { leadId, msg: "Starting\u2026" });
98691
- const result = await provisionCmsForLead({
98692
- lead,
98693
- placesKey,
98694
- vercelToken,
98695
- apiBaseUrl,
98696
- licenseKey,
98697
- onProgress: (msg) => emit("cms:progress", { leadId, msg })
98698
- });
98699
- db2.run("UPDATE leads SET site_url = ?, status = 'won' WHERE id = ?", [
98700
- result.publicUrl,
98701
- leadId
98702
- ]);
98703
- emit("cms:done", { leadId, ok: true, ...result });
98704
- return result;
98705
- }
98706
- if (channel === "bookings:provision") {
98707
- const p = payload;
98708
- const db2 = getDb();
98709
- const lead = db2.get("SELECT * FROM leads WHERE id = ?", [p.leadId]);
98710
- if (!lead) throw new Error("Lead not found");
98711
- const anthropicKey = getSetting("anthropic_key");
98712
- const vercelToken = getSetting("vercel_token");
98713
- const resendKey = getSetting("resend_key");
98714
- if (!anthropicKey) throw new Error("Anthropic API key not set");
98715
- if (!vercelToken) throw new Error("Vercel token not set");
98716
- const blobToken = await requireBlobToken(vercelToken, emit, p.leadId);
98717
- emit("bookings:progress", { leadId: p.leadId, msg: "Designing the booking form\u2026" });
98718
- const leadInfo = lead;
98719
- const config = await generatePreset({
98720
- anthropicKey,
98721
- lead: { name: leadInfo.name, type: leadInfo.type, city: leadInfo.city },
98722
- instructions: p.instructions,
98723
- archetypeOverride: p.archetypeOverride
98724
- });
98725
- const result = await deployBookingOnly({
98726
- lead,
98727
- vercelToken,
98728
- blobToken,
98729
- resendKey: resendKey || "",
98730
- ownerEmail: p.ownerEmail ?? "",
98731
- bookingConfig: config,
98732
- anthropicKey,
98733
- onProgress: (msg) => emit("bookings:progress", { leadId: p.leadId, msg })
98734
- });
98735
- db2.run(
98736
- "UPDATE leads SET booking_url = ?, owner_email = ?, booking_archetype = ?, booking_config = ? WHERE id = ?",
98737
- [
98738
- result.bookingUrl,
98739
- p.ownerEmail ?? "",
98740
- config.archetype,
98741
- JSON.stringify(config),
98742
- p.leadId
98743
- ]
98744
- );
98745
- emit("bookings:done", { leadId: p.leadId, ...result });
98746
- return result;
98747
- }
98748
- if (channel === "bookings:provision-standalone") {
98749
- const p = payload;
98750
- const db2 = getDb();
98751
- const lead = db2.get("SELECT * FROM leads WHERE id = ?", [p.leadId]);
98752
- if (!lead) throw new Error("Lead not found");
98753
- const vercelToken = getSetting("vercel_token");
98754
- const resendKey = getSetting("resend_key");
98755
- if (!vercelToken) throw new Error("Vercel token not set");
98756
- const blobToken = await requireBlobToken(vercelToken, emit, p.leadId);
98757
- emit("bookings:progress", { leadId: p.leadId, msg: "Designing the booking form\u2026" });
98758
- const leadInfo = lead;
98759
- const config = await generatePreset({
98760
- anthropicKey: getSetting("anthropic_key") ?? "",
98761
- lead: { name: leadInfo.name, type: leadInfo.type, city: leadInfo.city },
98762
- instructions: p.instructions,
98763
- archetypeOverride: p.archetypeOverride
98764
- });
98765
- const result = await deployStandaloneBooking({
98766
- lead,
98767
- vercelToken,
98768
- blobToken,
98769
- resendKey: resendKey || "",
98770
- ownerEmail: p.ownerEmail ?? "",
98771
- bookingConfig: config,
98772
- reuseAdminPassword: lead.booking_admin_password ?? null,
98773
- onProgress: (msg) => emit("bookings:progress", { leadId: p.leadId, msg })
98774
- });
98775
- db2.run(
98776
- `UPDATE leads SET booking_url = ?, owner_email = ?, booking_archetype = ?, booking_config = ?,
98777
- booking_admin_url = ?, booking_admin_password = ?,
98778
- status = CASE WHEN status = 'discovered' THEN 'site_built' ELSE status END
98779
- WHERE id = ?`,
98780
- [
98781
- result.bookingUrl,
98782
- p.ownerEmail ?? "",
98783
- config.archetype,
98784
- JSON.stringify(config),
98785
- result.admin.url,
98786
- result.admin.password,
98787
- p.leadId
98788
- ]
98789
- );
98790
- emit("bookings:done", { leadId: p.leadId, ...result });
98791
- return result;
98792
- }
98793
- if (channel === "site:handover") {
98794
- const p = payload;
98795
- const db2 = getDb();
98796
- const lead = db2.get("SELECT * FROM leads WHERE id = ?", [p.leadId]);
98797
- if (!lead) throw new Error("Lead not found");
98798
- const vercelToken = getSetting("vercel_token");
98799
- if (!vercelToken) throw new Error("Vercel token not set");
98800
- return await handoverSite({
98801
- lead,
98802
- vercelToken,
98803
- blobToken: getSetting("blob_token"),
98804
- domain: p.domain ?? null,
98805
- onProgress: (msg) => emit("sites:progress", { leadId: p.leadId, msg })
98806
- });
98807
- }
98808
- throw new Error(`channel not supported in CLI: ${channel}`);
98809
- };
98810
- }
98811
-
98812
99277
  // src/commands.ts
99278
+ init_engine();
99279
+ init_invoke_ipc();
99280
+ init_config();
99281
+ init_tty();
98813
99282
  function makeCtx(opts) {
98814
- const emit = (channel, payload) => {
99283
+ const emit2 = (channel, payload) => {
98815
99284
  opts.onEvent?.(channel, payload);
98816
99285
  if (opts.json) return;
98817
99286
  const p = payload;
98818
99287
  if (p?.msg && opts.status) opts.status.update(p.msg);
98819
99288
  };
98820
99289
  return {
98821
- invokeIpc: makeInvokeIpc(emit),
98822
- emitProgress: (e) => emit(e.channel, e.payload)
99290
+ invokeIpc: makeInvokeIpc(emit2),
99291
+ emitProgress: (e) => emit2(e.channel, e.payload)
98823
99292
  };
98824
99293
  }
98825
99294
  function parseArgs(argv) {
@@ -99982,7 +100451,7 @@ async function cmdBuildAll(argv) {
99982
100451
  detail: l.status === "built" ? l.siteUrl : l.status === "failed" ? l.error : l.message
99983
100452
  });
99984
100453
  await new Promise((resolve) => {
99985
- const emit = (channel, payload) => {
100454
+ const emit2 = (channel, payload) => {
99986
100455
  const snap2 = payload;
99987
100456
  if (channel === "auto:progress" && board) board.set(snap2.leads.map(stateToRow));
99988
100457
  if (channel === "auto:done") {
@@ -100009,7 +100478,7 @@ async function cmdBuildAll(argv) {
100009
100478
  anthropicKey: anthropicKey ?? "",
100010
100479
  vercelToken,
100011
100480
  placesKey: getSetting("places_key"),
100012
- emit
100481
+ emit: emit2
100013
100482
  });
100014
100483
  if (board) {
100015
100484
  board.start(`Building ${leadIds.length} sites (up to ${concurrency} at once)`, snap.leads.map(stateToRow));
@@ -100077,7 +100546,11 @@ COMMANDS:
100077
100546
  If no command fits the request, say so in one line and name the closest thing you can do. Never invent results.`;
100078
100547
 
100079
100548
  // src/doctor.ts
100080
- var import_child_process3 = require("child_process");
100549
+ init_config();
100550
+ init_engine();
100551
+ init_desktop_install();
100552
+ init_tty();
100553
+ var import_child_process4 = require("child_process");
100081
100554
  function mark(l) {
100082
100555
  return l === "ok" ? c.green("\u2713") : l === "warn" ? c.amber("!") : c.red("\u2717");
100083
100556
  }
@@ -100096,7 +100569,7 @@ async function runDoctor() {
100096
100569
  if (backend === "claude_code") {
100097
100570
  const present = (() => {
100098
100571
  try {
100099
- return (0, import_child_process3.spawnSync)(claudeBin(), ["--version"], { stdio: "ignore", timeout: 1e4 }).status === 0;
100572
+ return (0, import_child_process4.spawnSync)(claudeBin(), ["--version"], { stdio: "ignore", timeout: 1e4 }).status === 0;
100100
100573
  } catch {
100101
100574
  return false;
100102
100575
  }
@@ -100182,6 +100655,17 @@ async function runDoctor() {
100182
100655
  fix: "Run 'sproutkit setup' and say yes to installing the skill, so `claude` can drive Sproutkit."
100183
100656
  }
100184
100657
  );
100658
+ if (desktopSupported()) {
100659
+ const desktop = desktopInstallPath();
100660
+ rows.push(
100661
+ desktop ? { level: "ok", label: "Desktop app", detail: desktop } : {
100662
+ level: "warn",
100663
+ label: "Desktop app",
100664
+ detail: "not installed",
100665
+ fix: "Run 'sproutkit desktop' to install it \u2014 your terminal leads sync into its map and board."
100666
+ }
100667
+ );
100668
+ }
100185
100669
  rows.push(
100186
100670
  commandsInstalled() ? { level: "ok", label: "Slash commands", detail: commandsTargetDir() } : {
100187
100671
  level: "warn",
@@ -100208,12 +100692,13 @@ async function runDoctor() {
100208
100692
  }
100209
100693
 
100210
100694
  // src/index.ts
100211
- var import_child_process4 = require("child_process");
100695
+ init_tty();
100696
+ var import_child_process5 = require("child_process");
100212
100697
  process.env.SPROUTKIT_HEADLESS = "1";
100213
100698
  function claudePresent() {
100214
100699
  try {
100215
100700
  const bin = process.env.SPROUTKIT_CLAUDE_BIN || "claude";
100216
- return (0, import_child_process4.spawnSync)(bin, ["--version"], { stdio: "ignore", timeout: 1e4 }).status === 0;
100701
+ return (0, import_child_process5.spawnSync)(bin, ["--version"], { stdio: "ignore", timeout: 1e4 }).status === 0;
100217
100702
  } catch {
100218
100703
  return false;
100219
100704
  }
@@ -100221,6 +100706,11 @@ function claudePresent() {
100221
100706
  async function main() {
100222
100707
  const arg = process.argv[2];
100223
100708
  initDatabase();
100709
+ if (arg === "mcp") {
100710
+ const { runMcpServer: runMcpServer2 } = await Promise.resolve().then(() => (init_mcp(), mcp_exports));
100711
+ await runMcpServer2();
100712
+ return;
100713
+ }
100224
100714
  if (arg === "update") {
100225
100715
  await runUpdate();
100226
100716
  closeTty();
@@ -100240,11 +100730,17 @@ async function main() {
100240
100730
  const r = syncToDesktop();
100241
100731
  if (!r.ok && r.reason === "no_desktop_db") {
100242
100732
  say(c.dim(" No desktop Sproutkit database found \u2014 nothing to sync to."));
100243
- say(c.dim(" Install the desktop app and run it once to create it."));
100733
+ say(c.dim(" Install it with 'sproutkit desktop' and open it once to create it."));
100244
100734
  }
100245
100735
  closeTty();
100246
100736
  return;
100247
100737
  }
100738
+ if (arg === "desktop") {
100739
+ const { runDesktopCommand: runDesktopCommand2 } = await Promise.resolve().then(() => (init_desktop_install(), desktop_install_exports));
100740
+ await runDesktopCommand2(process.argv.slice(3));
100741
+ closeTty();
100742
+ return;
100743
+ }
100248
100744
  if (arg === "setup") {
100249
100745
  await runOnboarding(true);
100250
100746
  closeTty();
@@ -100367,7 +100863,7 @@ async function main() {
100367
100863
  }
100368
100864
  const lic2 = await check();
100369
100865
  if (lic2.status !== "active") {
100370
- const msg = lic2.status === "offline_grace_expired" ? "Licence check offline and grace expired \u2014 reconnect and retry." : "No active licence. Run 'sproutkit setup' first.";
100866
+ const msg = lic2.status === "expired" ? "Your Sproutkit subscription has ended. Renew at https://sproutkit.app/#pricing." : lic2.status === "offline_grace_expired" ? "Licence check offline and grace expired \u2014 reconnect and retry." : "No active licence. Run 'sproutkit setup' first.";
100371
100867
  if (subArgs.includes("--json")) process.stdout.write(JSON.stringify({ ok: false, error: msg }) + "\n");
100372
100868
  else say(c.red(` ${msg}`));
100373
100869
  closeTty();
@@ -100412,6 +100908,7 @@ async function main() {
100412
100908
  say(` ${c.bold("sproutkit setup")} set or update keys, licence, backend`);
100413
100909
  say(` ${c.bold("sproutkit doctor")} check everything is wired up`);
100414
100910
  say(` ${c.bold("sproutkit models")} list Claude models and pick one`);
100911
+ say(` ${c.bold("sproutkit desktop")} install and open the desktop app (--update)`);
100415
100912
  say(` ${c.bold("sproutkit sync")} push your leads into the desktop app`);
100416
100913
  say(` ${c.bold("sproutkit update")} update to the latest version`);
100417
100914
  say(` ${c.bold("sproutkit version")} show the installed version`);
@@ -100431,7 +100928,7 @@ async function main() {
100431
100928
  }
100432
100929
  const lic = await check();
100433
100930
  if (lic.status !== "active") {
100434
- const why = lic.status === "revoked" ? "Your licence has been revoked." : lic.status === "refunded" ? "Your licence was refunded." : lic.status === "offline_grace_expired" ? "Can't reach the licence server and your offline grace period has expired. Reconnect and try again." : "No active licence. Run 'sproutkit setup' to enter your key, or buy one at https://sproutkit.app";
100931
+ const why = lic.status === "revoked" ? "Your licence has been revoked." : lic.status === "refunded" ? "Your licence was refunded." : lic.status === "expired" ? "Your Sproutkit subscription has ended. Renew at https://sproutkit.app/#pricing, then run 'sproutkit setup' with your new key." : lic.status === "offline_grace_expired" ? "Can't reach the licence server and your offline grace period has expired. Reconnect and try again." : "No active licence. Run 'sproutkit setup' to enter your key, or buy one at https://sproutkit.app";
100435
100932
  say(c.red(` ${why}`));
100436
100933
  closeTty();
100437
100934
  return;
@@ -100472,7 +100969,7 @@ async function main() {
100472
100969
  ];
100473
100970
  if (oneShot) claudeArgs.push(oneShot);
100474
100971
  closeTty();
100475
- const child = (0, import_child_process4.spawn)(claudeBin(), claudeArgs, { stdio: "inherit" });
100972
+ const child = (0, import_child_process5.spawn)(claudeBin(), claudeArgs, { stdio: "inherit" });
100476
100973
  child.on("error", (e) => {
100477
100974
  say(c.red(` Couldn't start Claude Code: ${e.message}`));
100478
100975
  process.exitCode = 1;