sproutkit-code 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +584 -275
- package/dist/skill/SKILL.md +79 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29,19 +29,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
// ../../node_modules/electron/index.js
|
|
30
30
|
var require_electron = __commonJS({
|
|
31
31
|
"../../node_modules/electron/index.js"(exports2, module2) {
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var pathFile =
|
|
32
|
+
var fs3 = require("fs");
|
|
33
|
+
var path3 = require("path");
|
|
34
|
+
var pathFile = path3.join(__dirname, "path.txt");
|
|
35
35
|
function getElectronPath() {
|
|
36
36
|
let executablePath;
|
|
37
|
-
if (
|
|
38
|
-
executablePath =
|
|
37
|
+
if (fs3.existsSync(pathFile)) {
|
|
38
|
+
executablePath = fs3.readFileSync(pathFile, "utf-8");
|
|
39
39
|
}
|
|
40
40
|
if (process.env.ELECTRON_OVERRIDE_DIST_PATH) {
|
|
41
|
-
return
|
|
41
|
+
return path3.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath || "electron");
|
|
42
42
|
}
|
|
43
43
|
if (executablePath) {
|
|
44
|
-
return
|
|
44
|
+
return path3.join(__dirname, "dist", executablePath);
|
|
45
45
|
} else {
|
|
46
46
|
throw new Error("Electron failed to install correctly, please delete node_modules/electron and try installing again");
|
|
47
47
|
}
|
|
@@ -982,14 +982,14 @@ var require_url_state_machine = __commonJS({
|
|
|
982
982
|
return url.replace(/\u0009|\u000A|\u000D/g, "");
|
|
983
983
|
}
|
|
984
984
|
function shortenPath(url) {
|
|
985
|
-
const
|
|
986
|
-
if (
|
|
985
|
+
const path3 = url.path;
|
|
986
|
+
if (path3.length === 0) {
|
|
987
987
|
return;
|
|
988
988
|
}
|
|
989
|
-
if (url.scheme === "file" &&
|
|
989
|
+
if (url.scheme === "file" && path3.length === 1 && isNormalizedWindowsDriveLetter(path3[0])) {
|
|
990
990
|
return;
|
|
991
991
|
}
|
|
992
|
-
|
|
992
|
+
path3.pop();
|
|
993
993
|
}
|
|
994
994
|
function includesCredentials(url) {
|
|
995
995
|
return url.username !== "" || url.password !== "";
|
|
@@ -10824,14 +10824,14 @@ var require_fileFromPath = __commonJS({
|
|
|
10824
10824
|
return "File";
|
|
10825
10825
|
}
|
|
10826
10826
|
};
|
|
10827
|
-
function createFileFromPath(
|
|
10827
|
+
function createFileFromPath(path3, { mtimeMs, size }, filenameOrOptions, options = {}) {
|
|
10828
10828
|
let filename;
|
|
10829
10829
|
if ((0, isPlainObject_1.default)(filenameOrOptions)) {
|
|
10830
10830
|
[options, filename] = [filenameOrOptions, void 0];
|
|
10831
10831
|
} else {
|
|
10832
10832
|
filename = filenameOrOptions;
|
|
10833
10833
|
}
|
|
10834
|
-
const file = new FileFromPath({ path:
|
|
10834
|
+
const file = new FileFromPath({ path: path3, size, lastModified: mtimeMs });
|
|
10835
10835
|
if (!filename) {
|
|
10836
10836
|
filename = file.name;
|
|
10837
10837
|
}
|
|
@@ -10840,14 +10840,14 @@ var require_fileFromPath = __commonJS({
|
|
|
10840
10840
|
lastModified: file.lastModified
|
|
10841
10841
|
});
|
|
10842
10842
|
}
|
|
10843
|
-
function fileFromPathSync(
|
|
10844
|
-
const stats = (0, fs_1.statSync)(
|
|
10845
|
-
return createFileFromPath(
|
|
10843
|
+
function fileFromPathSync(path3, filenameOrOptions, options = {}) {
|
|
10844
|
+
const stats = (0, fs_1.statSync)(path3);
|
|
10845
|
+
return createFileFromPath(path3, stats, filenameOrOptions, options);
|
|
10846
10846
|
}
|
|
10847
10847
|
exports2.fileFromPathSync = fileFromPathSync;
|
|
10848
|
-
async function fileFromPath(
|
|
10849
|
-
const stats = await fs_1.promises.stat(
|
|
10850
|
-
return createFileFromPath(
|
|
10848
|
+
async function fileFromPath(path3, filenameOrOptions, options) {
|
|
10849
|
+
const stats = await fs_1.promises.stat(path3);
|
|
10850
|
+
return createFileFromPath(path3, stats, filenameOrOptions, options);
|
|
10851
10851
|
}
|
|
10852
10852
|
exports2.fileFromPath = fileFromPath;
|
|
10853
10853
|
}
|
|
@@ -10899,13 +10899,13 @@ var require_node_runtime = __commonJS({
|
|
|
10899
10899
|
var MultipartBody_1 = require_MultipartBody();
|
|
10900
10900
|
var web_1 = require("node:stream/web");
|
|
10901
10901
|
var fileFromPathWarned = false;
|
|
10902
|
-
async function fileFromPath(
|
|
10902
|
+
async function fileFromPath(path3, ...args) {
|
|
10903
10903
|
const { fileFromPath: _fileFromPath } = await Promise.resolve().then(() => __importStar(require_fileFromPath()));
|
|
10904
10904
|
if (!fileFromPathWarned) {
|
|
10905
|
-
console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(
|
|
10905
|
+
console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path3)}) instead`);
|
|
10906
10906
|
fileFromPathWarned = true;
|
|
10907
10907
|
}
|
|
10908
|
-
return await _fileFromPath(
|
|
10908
|
+
return await _fileFromPath(path3, ...args);
|
|
10909
10909
|
}
|
|
10910
10910
|
var defaultHttpAgent = new agentkeepalive_1.default({ keepAlive: true, timeout: 5 * 60 * 1e3 });
|
|
10911
10911
|
var defaultHttpsAgent = new agentkeepalive_1.default.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1e3 });
|
|
@@ -11670,29 +11670,29 @@ var require_core = __commonJS({
|
|
|
11670
11670
|
defaultIdempotencyKey() {
|
|
11671
11671
|
return `stainless-node-retry-${uuid4()}`;
|
|
11672
11672
|
}
|
|
11673
|
-
get(
|
|
11674
|
-
return this.methodRequest("get",
|
|
11673
|
+
get(path3, opts) {
|
|
11674
|
+
return this.methodRequest("get", path3, opts);
|
|
11675
11675
|
}
|
|
11676
|
-
post(
|
|
11677
|
-
return this.methodRequest("post",
|
|
11676
|
+
post(path3, opts) {
|
|
11677
|
+
return this.methodRequest("post", path3, opts);
|
|
11678
11678
|
}
|
|
11679
|
-
patch(
|
|
11680
|
-
return this.methodRequest("patch",
|
|
11679
|
+
patch(path3, opts) {
|
|
11680
|
+
return this.methodRequest("patch", path3, opts);
|
|
11681
11681
|
}
|
|
11682
|
-
put(
|
|
11683
|
-
return this.methodRequest("put",
|
|
11682
|
+
put(path3, opts) {
|
|
11683
|
+
return this.methodRequest("put", path3, opts);
|
|
11684
11684
|
}
|
|
11685
|
-
delete(
|
|
11686
|
-
return this.methodRequest("delete",
|
|
11685
|
+
delete(path3, opts) {
|
|
11686
|
+
return this.methodRequest("delete", path3, opts);
|
|
11687
11687
|
}
|
|
11688
|
-
methodRequest(method,
|
|
11688
|
+
methodRequest(method, path3, opts) {
|
|
11689
11689
|
return this.request(Promise.resolve(opts).then(async (opts2) => {
|
|
11690
11690
|
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;
|
|
11691
|
-
return { method, path:
|
|
11691
|
+
return { method, path: path3, ...opts2, body };
|
|
11692
11692
|
}));
|
|
11693
11693
|
}
|
|
11694
|
-
getAPIList(
|
|
11695
|
-
return this.requestAPIList(Page, { method: "get", path:
|
|
11694
|
+
getAPIList(path3, Page, opts) {
|
|
11695
|
+
return this.requestAPIList(Page, { method: "get", path: path3, ...opts });
|
|
11696
11696
|
}
|
|
11697
11697
|
calculateContentLength(body) {
|
|
11698
11698
|
if (typeof body === "string") {
|
|
@@ -11710,10 +11710,10 @@ var require_core = __commonJS({
|
|
|
11710
11710
|
return null;
|
|
11711
11711
|
}
|
|
11712
11712
|
buildRequest(options, { retryCount = 0 } = {}) {
|
|
11713
|
-
const { method, path:
|
|
11713
|
+
const { method, path: path3, query, headers = {} } = options;
|
|
11714
11714
|
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;
|
|
11715
11715
|
const contentLength = this.calculateContentLength(body);
|
|
11716
|
-
const url = this.buildURL(
|
|
11716
|
+
const url = this.buildURL(path3, query);
|
|
11717
11717
|
if ("timeout" in options)
|
|
11718
11718
|
validatePositiveInteger("timeout", options.timeout);
|
|
11719
11719
|
const timeout = options.timeout ?? this.timeout;
|
|
@@ -11826,8 +11826,8 @@ var require_core = __commonJS({
|
|
|
11826
11826
|
const request = this.makeRequest(options, null);
|
|
11827
11827
|
return new PagePromise(this, request, Page);
|
|
11828
11828
|
}
|
|
11829
|
-
buildURL(
|
|
11830
|
-
const url = isAbsoluteURL(
|
|
11829
|
+
buildURL(path3, query) {
|
|
11830
|
+
const url = isAbsoluteURL(path3) ? new URL(path3) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path3.startsWith("/") ? path3.slice(1) : path3));
|
|
11831
11831
|
const defaultQuery = this.defaultQuery();
|
|
11832
11832
|
if (!isEmptyObj(defaultQuery)) {
|
|
11833
11833
|
query = { ...defaultQuery, ...query };
|
|
@@ -23164,11 +23164,11 @@ var require_mime_types = __commonJS({
|
|
|
23164
23164
|
}
|
|
23165
23165
|
return exts[0];
|
|
23166
23166
|
}
|
|
23167
|
-
function lookup(
|
|
23168
|
-
if (!
|
|
23167
|
+
function lookup(path3) {
|
|
23168
|
+
if (!path3 || typeof path3 !== "string") {
|
|
23169
23169
|
return false;
|
|
23170
23170
|
}
|
|
23171
|
-
var extension2 = extname("x." +
|
|
23171
|
+
var extension2 = extname("x." + path3).toLowerCase().substr(1);
|
|
23172
23172
|
if (!extension2) {
|
|
23173
23173
|
return false;
|
|
23174
23174
|
}
|
|
@@ -24273,11 +24273,11 @@ var require_form_data = __commonJS({
|
|
|
24273
24273
|
"use strict";
|
|
24274
24274
|
var CombinedStream = require_combined_stream();
|
|
24275
24275
|
var util = require("util");
|
|
24276
|
-
var
|
|
24276
|
+
var path3 = require("path");
|
|
24277
24277
|
var http = require("http");
|
|
24278
24278
|
var https = require("https");
|
|
24279
24279
|
var parseUrl = require("url").parse;
|
|
24280
|
-
var
|
|
24280
|
+
var fs3 = require("fs");
|
|
24281
24281
|
var Stream = require("stream").Stream;
|
|
24282
24282
|
var crypto2 = require("crypto");
|
|
24283
24283
|
var mime = require_mime_types();
|
|
@@ -24344,7 +24344,7 @@ var require_form_data = __commonJS({
|
|
|
24344
24344
|
if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
|
|
24345
24345
|
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
24346
24346
|
} else {
|
|
24347
|
-
|
|
24347
|
+
fs3.stat(value.path, function(err, stat) {
|
|
24348
24348
|
if (err) {
|
|
24349
24349
|
callback(err);
|
|
24350
24350
|
return;
|
|
@@ -24401,11 +24401,11 @@ var require_form_data = __commonJS({
|
|
|
24401
24401
|
FormData2.prototype._getContentDisposition = function(value, options) {
|
|
24402
24402
|
var filename;
|
|
24403
24403
|
if (typeof options.filepath === "string") {
|
|
24404
|
-
filename =
|
|
24404
|
+
filename = path3.normalize(options.filepath).replace(/\\/g, "/");
|
|
24405
24405
|
} else if (options.filename || value && (value.name || value.path)) {
|
|
24406
|
-
filename =
|
|
24406
|
+
filename = path3.basename(options.filename || value && (value.name || value.path));
|
|
24407
24407
|
} else if (value && value.readable && hasOwn(value, "httpVersion")) {
|
|
24408
|
-
filename =
|
|
24408
|
+
filename = path3.basename(value.client._httpMessage.path || "");
|
|
24409
24409
|
}
|
|
24410
24410
|
if (filename) {
|
|
24411
24411
|
return 'filename="' + filename + '"';
|
|
@@ -24950,7 +24950,7 @@ var require_has_flag = __commonJS({
|
|
|
24950
24950
|
var require_supports_color = __commonJS({
|
|
24951
24951
|
"../../node_modules/supports-color/index.js"(exports2, module2) {
|
|
24952
24952
|
"use strict";
|
|
24953
|
-
var
|
|
24953
|
+
var os4 = require("os");
|
|
24954
24954
|
var tty = require("tty");
|
|
24955
24955
|
var hasFlag = require_has_flag();
|
|
24956
24956
|
var { env } = process;
|
|
@@ -24998,7 +24998,7 @@ var require_supports_color = __commonJS({
|
|
|
24998
24998
|
return min;
|
|
24999
24999
|
}
|
|
25000
25000
|
if (process.platform === "win32") {
|
|
25001
|
-
const osRelease =
|
|
25001
|
+
const osRelease = os4.release().split(".");
|
|
25002
25002
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
25003
25003
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
25004
25004
|
}
|
|
@@ -26226,7 +26226,7 @@ var require_axios = __commonJS({
|
|
|
26226
26226
|
var https = require("https");
|
|
26227
26227
|
var http2 = require("http2");
|
|
26228
26228
|
var util = require("util");
|
|
26229
|
-
var
|
|
26229
|
+
var path3 = require("path");
|
|
26230
26230
|
var followRedirects = require_follow_redirects();
|
|
26231
26231
|
var zlib = require("zlib");
|
|
26232
26232
|
var stream = require("stream");
|
|
@@ -27113,9 +27113,9 @@ var require_axios = __commonJS({
|
|
|
27113
27113
|
function removeBrackets(key) {
|
|
27114
27114
|
return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
27115
27115
|
}
|
|
27116
|
-
function renderKey(
|
|
27117
|
-
if (!
|
|
27118
|
-
return
|
|
27116
|
+
function renderKey(path4, key, dots) {
|
|
27117
|
+
if (!path4) return key;
|
|
27118
|
+
return path4.concat(key).map(function each(token, i) {
|
|
27119
27119
|
token = removeBrackets(token);
|
|
27120
27120
|
return !dots && i ? "[" + token + "]" : token;
|
|
27121
27121
|
}).join(dots ? "." : "");
|
|
@@ -27164,13 +27164,13 @@ var require_axios = __commonJS({
|
|
|
27164
27164
|
}
|
|
27165
27165
|
return value;
|
|
27166
27166
|
}
|
|
27167
|
-
function defaultVisitor(value, key,
|
|
27167
|
+
function defaultVisitor(value, key, path4) {
|
|
27168
27168
|
let arr = value;
|
|
27169
27169
|
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
27170
|
-
formData.append(renderKey(
|
|
27170
|
+
formData.append(renderKey(path4, key, dots), convertValue(value));
|
|
27171
27171
|
return false;
|
|
27172
27172
|
}
|
|
27173
|
-
if (value && !
|
|
27173
|
+
if (value && !path4 && typeof value === "object") {
|
|
27174
27174
|
if (utils$1.endsWith(key, "{}")) {
|
|
27175
27175
|
key = metaTokens ? key : key.slice(0, -2);
|
|
27176
27176
|
value = JSON.stringify(value);
|
|
@@ -27189,7 +27189,7 @@ var require_axios = __commonJS({
|
|
|
27189
27189
|
if (isVisitable(value)) {
|
|
27190
27190
|
return true;
|
|
27191
27191
|
}
|
|
27192
|
-
formData.append(renderKey(
|
|
27192
|
+
formData.append(renderKey(path4, key, dots), convertValue(value));
|
|
27193
27193
|
return false;
|
|
27194
27194
|
}
|
|
27195
27195
|
const stack = [];
|
|
@@ -27198,19 +27198,19 @@ var require_axios = __commonJS({
|
|
|
27198
27198
|
convertValue,
|
|
27199
27199
|
isVisitable
|
|
27200
27200
|
});
|
|
27201
|
-
function build(value,
|
|
27201
|
+
function build(value, path4, depth = 0) {
|
|
27202
27202
|
if (utils$1.isUndefined(value)) return;
|
|
27203
27203
|
if (depth > maxDepth) {
|
|
27204
27204
|
throw new AxiosError("Object is too deeply nested (" + depth + " levels). Max depth: " + maxDepth, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
|
|
27205
27205
|
}
|
|
27206
27206
|
if (stack.indexOf(value) !== -1) {
|
|
27207
|
-
throw Error("Circular reference detected in " +
|
|
27207
|
+
throw Error("Circular reference detected in " + path4.join("."));
|
|
27208
27208
|
}
|
|
27209
27209
|
stack.push(value);
|
|
27210
27210
|
utils$1.forEach(value, function each(el, key) {
|
|
27211
|
-
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key,
|
|
27211
|
+
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path4, exposedHelpers);
|
|
27212
27212
|
if (result === true) {
|
|
27213
|
-
build(el,
|
|
27213
|
+
build(el, path4 ? path4.concat(key) : [key], depth + 1);
|
|
27214
27214
|
}
|
|
27215
27215
|
});
|
|
27216
27216
|
stack.pop();
|
|
@@ -27398,7 +27398,7 @@ var require_axios = __commonJS({
|
|
|
27398
27398
|
};
|
|
27399
27399
|
function toURLEncodedForm(data, options) {
|
|
27400
27400
|
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
27401
|
-
visitor: function(value, key,
|
|
27401
|
+
visitor: function(value, key, path4, helpers) {
|
|
27402
27402
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
27403
27403
|
this.append(key, value.toString("base64"));
|
|
27404
27404
|
return false;
|
|
@@ -27426,11 +27426,11 @@ var require_axios = __commonJS({
|
|
|
27426
27426
|
return obj;
|
|
27427
27427
|
}
|
|
27428
27428
|
function formDataToJSON(formData) {
|
|
27429
|
-
function buildPath(
|
|
27430
|
-
let name =
|
|
27429
|
+
function buildPath(path4, value, target, index) {
|
|
27430
|
+
let name = path4[index++];
|
|
27431
27431
|
if (name === "__proto__") return true;
|
|
27432
27432
|
const isNumericKey = Number.isFinite(+name);
|
|
27433
|
-
const isLast = index >=
|
|
27433
|
+
const isLast = index >= path4.length;
|
|
27434
27434
|
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
27435
27435
|
if (isLast) {
|
|
27436
27436
|
if (utils$1.hasOwnProp(target, name)) {
|
|
@@ -27443,7 +27443,7 @@ var require_axios = __commonJS({
|
|
|
27443
27443
|
if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
|
|
27444
27444
|
target[name] = [];
|
|
27445
27445
|
}
|
|
27446
|
-
const result = buildPath(
|
|
27446
|
+
const result = buildPath(path4, value, target[name], index);
|
|
27447
27447
|
if (result && utils$1.isArray(target[name])) {
|
|
27448
27448
|
target[name] = arrayToObject(target[name]);
|
|
27449
27449
|
}
|
|
@@ -28813,8 +28813,8 @@ var require_axios = __commonJS({
|
|
|
28813
28813
|
}
|
|
28814
28814
|
if (config.allowedSocketPaths != null) {
|
|
28815
28815
|
const allowed = Array.isArray(config.allowedSocketPaths) ? config.allowedSocketPaths : [config.allowedSocketPaths];
|
|
28816
|
-
const resolvedSocket =
|
|
28817
|
-
const isAllowed = allowed.some((entry) => typeof entry === "string" &&
|
|
28816
|
+
const resolvedSocket = path3.resolve(config.socketPath);
|
|
28817
|
+
const isAllowed = allowed.some((entry) => typeof entry === "string" && path3.resolve(entry) === resolvedSocket);
|
|
28818
28818
|
if (!isAllowed) {
|
|
28819
28819
|
return reject(new AxiosError(`socketPath "${config.socketPath}" is not permitted by allowedSocketPaths`, AxiosError.ERR_BAD_OPTION_VALUE, config));
|
|
28820
28820
|
}
|
|
@@ -29068,14 +29068,14 @@ var require_axios = __commonJS({
|
|
|
29068
29068
|
var cookies = platform.hasStandardBrowserEnv ? (
|
|
29069
29069
|
// Standard browser envs support document.cookie
|
|
29070
29070
|
{
|
|
29071
|
-
write(name, value, expires,
|
|
29071
|
+
write(name, value, expires, path4, domain, secure, sameSite) {
|
|
29072
29072
|
if (typeof document === "undefined") return;
|
|
29073
29073
|
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
29074
29074
|
if (utils$1.isNumber(expires)) {
|
|
29075
29075
|
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
29076
29076
|
}
|
|
29077
|
-
if (utils$1.isString(
|
|
29078
|
-
cookie.push(`path=${
|
|
29077
|
+
if (utils$1.isString(path4)) {
|
|
29078
|
+
cookie.push(`path=${path4}`);
|
|
29079
29079
|
}
|
|
29080
29080
|
if (utils$1.isString(domain)) {
|
|
29081
29081
|
cookie.push(`domain=${domain}`);
|
|
@@ -30441,14 +30441,20 @@ var require_llm = __commonJS({
|
|
|
30441
30441
|
}
|
|
30442
30442
|
}))
|
|
30443
30443
|
] : args.prompt;
|
|
30444
|
-
const
|
|
30444
|
+
const req = {
|
|
30445
30445
|
model: args.model || "claude-sonnet-4-6",
|
|
30446
30446
|
max_tokens: args.maxTokens ?? 8192,
|
|
30447
30447
|
messages: [{ role: "user", content }]
|
|
30448
|
-
}
|
|
30449
|
-
|
|
30448
|
+
};
|
|
30449
|
+
if (args.allowWebSearch) {
|
|
30450
|
+
req.tools = [
|
|
30451
|
+
{ type: "web_search_20250305", name: "web_search", max_uses: 3 }
|
|
30452
|
+
];
|
|
30453
|
+
}
|
|
30454
|
+
const res = await anthropic.messages.create(req);
|
|
30455
|
+
const text = res.content.filter((b) => b.type === "text").map((b) => b.text).join("\n").trim();
|
|
30450
30456
|
return {
|
|
30451
|
-
text
|
|
30457
|
+
text,
|
|
30452
30458
|
stopReason: res.stop_reason ?? null,
|
|
30453
30459
|
backend: "api"
|
|
30454
30460
|
};
|
|
@@ -30461,6 +30467,8 @@ var require_llm = __commonJS({
|
|
|
30461
30467
|
const alias = getClaudeCodeModel2();
|
|
30462
30468
|
if (alias)
|
|
30463
30469
|
cliArgs.push("--model", alias);
|
|
30470
|
+
if (args.allowWebSearch)
|
|
30471
|
+
cliArgs.push("--allowedTools", "WebSearch");
|
|
30464
30472
|
const bin = claudeBin2();
|
|
30465
30473
|
const timeoutMs = args.timeoutMs ?? 18e4;
|
|
30466
30474
|
return new Promise((resolve, reject) => {
|
|
@@ -34875,8 +34883,8 @@ var require_windows = __commonJS({
|
|
|
34875
34883
|
"../../node_modules/isexe/windows.js"(exports2, module2) {
|
|
34876
34884
|
module2.exports = isexe;
|
|
34877
34885
|
isexe.sync = sync;
|
|
34878
|
-
var
|
|
34879
|
-
function checkPathExt(
|
|
34886
|
+
var fs3 = require("fs");
|
|
34887
|
+
function checkPathExt(path3, options) {
|
|
34880
34888
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
34881
34889
|
if (!pathext) {
|
|
34882
34890
|
return true;
|
|
@@ -34887,25 +34895,25 @@ var require_windows = __commonJS({
|
|
|
34887
34895
|
}
|
|
34888
34896
|
for (var i = 0; i < pathext.length; i++) {
|
|
34889
34897
|
var p = pathext[i].toLowerCase();
|
|
34890
|
-
if (p &&
|
|
34898
|
+
if (p && path3.substr(-p.length).toLowerCase() === p) {
|
|
34891
34899
|
return true;
|
|
34892
34900
|
}
|
|
34893
34901
|
}
|
|
34894
34902
|
return false;
|
|
34895
34903
|
}
|
|
34896
|
-
function checkStat(stat,
|
|
34904
|
+
function checkStat(stat, path3, options) {
|
|
34897
34905
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
34898
34906
|
return false;
|
|
34899
34907
|
}
|
|
34900
|
-
return checkPathExt(
|
|
34908
|
+
return checkPathExt(path3, options);
|
|
34901
34909
|
}
|
|
34902
|
-
function isexe(
|
|
34903
|
-
|
|
34904
|
-
cb(er, er ? false : checkStat(stat,
|
|
34910
|
+
function isexe(path3, options, cb) {
|
|
34911
|
+
fs3.stat(path3, function(er, stat) {
|
|
34912
|
+
cb(er, er ? false : checkStat(stat, path3, options));
|
|
34905
34913
|
});
|
|
34906
34914
|
}
|
|
34907
|
-
function sync(
|
|
34908
|
-
return checkStat(
|
|
34915
|
+
function sync(path3, options) {
|
|
34916
|
+
return checkStat(fs3.statSync(path3), path3, options);
|
|
34909
34917
|
}
|
|
34910
34918
|
}
|
|
34911
34919
|
});
|
|
@@ -34915,14 +34923,14 @@ var require_mode = __commonJS({
|
|
|
34915
34923
|
"../../node_modules/isexe/mode.js"(exports2, module2) {
|
|
34916
34924
|
module2.exports = isexe;
|
|
34917
34925
|
isexe.sync = sync;
|
|
34918
|
-
var
|
|
34919
|
-
function isexe(
|
|
34920
|
-
|
|
34926
|
+
var fs3 = require("fs");
|
|
34927
|
+
function isexe(path3, options, cb) {
|
|
34928
|
+
fs3.stat(path3, function(er, stat) {
|
|
34921
34929
|
cb(er, er ? false : checkStat(stat, options));
|
|
34922
34930
|
});
|
|
34923
34931
|
}
|
|
34924
|
-
function sync(
|
|
34925
|
-
return checkStat(
|
|
34932
|
+
function sync(path3, options) {
|
|
34933
|
+
return checkStat(fs3.statSync(path3), options);
|
|
34926
34934
|
}
|
|
34927
34935
|
function checkStat(stat, options) {
|
|
34928
34936
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -34946,7 +34954,7 @@ var require_mode = __commonJS({
|
|
|
34946
34954
|
// ../../node_modules/isexe/index.js
|
|
34947
34955
|
var require_isexe = __commonJS({
|
|
34948
34956
|
"../../node_modules/isexe/index.js"(exports2, module2) {
|
|
34949
|
-
var
|
|
34957
|
+
var fs3 = require("fs");
|
|
34950
34958
|
var core;
|
|
34951
34959
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
34952
34960
|
core = require_windows();
|
|
@@ -34955,7 +34963,7 @@ var require_isexe = __commonJS({
|
|
|
34955
34963
|
}
|
|
34956
34964
|
module2.exports = isexe;
|
|
34957
34965
|
isexe.sync = sync;
|
|
34958
|
-
function isexe(
|
|
34966
|
+
function isexe(path3, options, cb) {
|
|
34959
34967
|
if (typeof options === "function") {
|
|
34960
34968
|
cb = options;
|
|
34961
34969
|
options = {};
|
|
@@ -34965,7 +34973,7 @@ var require_isexe = __commonJS({
|
|
|
34965
34973
|
throw new TypeError("callback not provided");
|
|
34966
34974
|
}
|
|
34967
34975
|
return new Promise(function(resolve, reject) {
|
|
34968
|
-
isexe(
|
|
34976
|
+
isexe(path3, options || {}, function(er, is) {
|
|
34969
34977
|
if (er) {
|
|
34970
34978
|
reject(er);
|
|
34971
34979
|
} else {
|
|
@@ -34974,7 +34982,7 @@ var require_isexe = __commonJS({
|
|
|
34974
34982
|
});
|
|
34975
34983
|
});
|
|
34976
34984
|
}
|
|
34977
|
-
core(
|
|
34985
|
+
core(path3, options || {}, function(er, is) {
|
|
34978
34986
|
if (er) {
|
|
34979
34987
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
34980
34988
|
er = null;
|
|
@@ -34984,9 +34992,9 @@ var require_isexe = __commonJS({
|
|
|
34984
34992
|
cb(er, is);
|
|
34985
34993
|
});
|
|
34986
34994
|
}
|
|
34987
|
-
function sync(
|
|
34995
|
+
function sync(path3, options) {
|
|
34988
34996
|
try {
|
|
34989
|
-
return core.sync(
|
|
34997
|
+
return core.sync(path3, options || {});
|
|
34990
34998
|
} catch (er) {
|
|
34991
34999
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
34992
35000
|
return false;
|
|
@@ -35002,7 +35010,7 @@ var require_isexe = __commonJS({
|
|
|
35002
35010
|
var require_which = __commonJS({
|
|
35003
35011
|
"../../node_modules/which/which.js"(exports2, module2) {
|
|
35004
35012
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
35005
|
-
var
|
|
35013
|
+
var path3 = require("path");
|
|
35006
35014
|
var COLON = isWindows ? ";" : ":";
|
|
35007
35015
|
var isexe = require_isexe();
|
|
35008
35016
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -35040,7 +35048,7 @@ var require_which = __commonJS({
|
|
|
35040
35048
|
return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
35041
35049
|
const ppRaw = pathEnv[i];
|
|
35042
35050
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
35043
|
-
const pCmd =
|
|
35051
|
+
const pCmd = path3.join(pathPart, cmd);
|
|
35044
35052
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
35045
35053
|
resolve(subStep(p, i, 0));
|
|
35046
35054
|
});
|
|
@@ -35067,7 +35075,7 @@ var require_which = __commonJS({
|
|
|
35067
35075
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
35068
35076
|
const ppRaw = pathEnv[i];
|
|
35069
35077
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
35070
|
-
const pCmd =
|
|
35078
|
+
const pCmd = path3.join(pathPart, cmd);
|
|
35071
35079
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
35072
35080
|
for (let j = 0; j < pathExt.length; j++) {
|
|
35073
35081
|
const cur = p + pathExt[j];
|
|
@@ -35115,7 +35123,7 @@ var require_path_key = __commonJS({
|
|
|
35115
35123
|
var require_resolveCommand = __commonJS({
|
|
35116
35124
|
"../../node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
|
|
35117
35125
|
"use strict";
|
|
35118
|
-
var
|
|
35126
|
+
var path3 = require("path");
|
|
35119
35127
|
var which = require_which();
|
|
35120
35128
|
var getPathKey = require_path_key();
|
|
35121
35129
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -35133,7 +35141,7 @@ var require_resolveCommand = __commonJS({
|
|
|
35133
35141
|
try {
|
|
35134
35142
|
resolved = which.sync(parsed.command, {
|
|
35135
35143
|
path: env[getPathKey({ env })],
|
|
35136
|
-
pathExt: withoutPathExt ?
|
|
35144
|
+
pathExt: withoutPathExt ? path3.delimiter : void 0
|
|
35137
35145
|
});
|
|
35138
35146
|
} catch (e) {
|
|
35139
35147
|
} finally {
|
|
@@ -35142,7 +35150,7 @@ var require_resolveCommand = __commonJS({
|
|
|
35142
35150
|
}
|
|
35143
35151
|
}
|
|
35144
35152
|
if (resolved) {
|
|
35145
|
-
resolved =
|
|
35153
|
+
resolved = path3.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
35146
35154
|
}
|
|
35147
35155
|
return resolved;
|
|
35148
35156
|
}
|
|
@@ -35196,8 +35204,8 @@ var require_shebang_command = __commonJS({
|
|
|
35196
35204
|
if (!match) {
|
|
35197
35205
|
return null;
|
|
35198
35206
|
}
|
|
35199
|
-
const [
|
|
35200
|
-
const binary =
|
|
35207
|
+
const [path3, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
35208
|
+
const binary = path3.split("/").pop();
|
|
35201
35209
|
if (binary === "env") {
|
|
35202
35210
|
return argument;
|
|
35203
35211
|
}
|
|
@@ -35210,16 +35218,16 @@ var require_shebang_command = __commonJS({
|
|
|
35210
35218
|
var require_readShebang = __commonJS({
|
|
35211
35219
|
"../../node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
|
|
35212
35220
|
"use strict";
|
|
35213
|
-
var
|
|
35221
|
+
var fs3 = require("fs");
|
|
35214
35222
|
var shebangCommand = require_shebang_command();
|
|
35215
35223
|
function readShebang(command) {
|
|
35216
35224
|
const size = 150;
|
|
35217
35225
|
const buffer = Buffer.alloc(size);
|
|
35218
35226
|
let fd;
|
|
35219
35227
|
try {
|
|
35220
|
-
fd =
|
|
35221
|
-
|
|
35222
|
-
|
|
35228
|
+
fd = fs3.openSync(command, "r");
|
|
35229
|
+
fs3.readSync(fd, buffer, 0, size, 0);
|
|
35230
|
+
fs3.closeSync(fd);
|
|
35223
35231
|
} catch (e) {
|
|
35224
35232
|
}
|
|
35225
35233
|
return shebangCommand(buffer.toString());
|
|
@@ -35232,7 +35240,7 @@ var require_readShebang = __commonJS({
|
|
|
35232
35240
|
var require_parse = __commonJS({
|
|
35233
35241
|
"../../node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
|
|
35234
35242
|
"use strict";
|
|
35235
|
-
var
|
|
35243
|
+
var path3 = require("path");
|
|
35236
35244
|
var resolveCommand = require_resolveCommand();
|
|
35237
35245
|
var escape = require_escape();
|
|
35238
35246
|
var readShebang = require_readShebang();
|
|
@@ -35257,7 +35265,7 @@ var require_parse = __commonJS({
|
|
|
35257
35265
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
35258
35266
|
if (parsed.options.forceShell || needsShell) {
|
|
35259
35267
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
35260
|
-
parsed.command =
|
|
35268
|
+
parsed.command = path3.normalize(parsed.command);
|
|
35261
35269
|
parsed.command = escape.command(parsed.command);
|
|
35262
35270
|
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
35263
35271
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -35389,7 +35397,7 @@ var require_strip_final_newline = __commonJS({
|
|
|
35389
35397
|
var require_npm_run_path = __commonJS({
|
|
35390
35398
|
"../../node_modules/npm-run-path/index.js"(exports2, module2) {
|
|
35391
35399
|
"use strict";
|
|
35392
|
-
var
|
|
35400
|
+
var path3 = require("path");
|
|
35393
35401
|
var pathKey = require_path_key();
|
|
35394
35402
|
var npmRunPath = (options) => {
|
|
35395
35403
|
options = {
|
|
@@ -35399,16 +35407,16 @@ var require_npm_run_path = __commonJS({
|
|
|
35399
35407
|
...options
|
|
35400
35408
|
};
|
|
35401
35409
|
let previous;
|
|
35402
|
-
let cwdPath =
|
|
35410
|
+
let cwdPath = path3.resolve(options.cwd);
|
|
35403
35411
|
const result = [];
|
|
35404
35412
|
while (previous !== cwdPath) {
|
|
35405
|
-
result.push(
|
|
35413
|
+
result.push(path3.join(cwdPath, "node_modules/.bin"));
|
|
35406
35414
|
previous = cwdPath;
|
|
35407
|
-
cwdPath =
|
|
35415
|
+
cwdPath = path3.resolve(cwdPath, "..");
|
|
35408
35416
|
}
|
|
35409
|
-
const execPathDir =
|
|
35417
|
+
const execPathDir = path3.resolve(options.cwd, options.execPath, "..");
|
|
35410
35418
|
result.push(execPathDir);
|
|
35411
|
-
return result.concat(options.path).join(
|
|
35419
|
+
return result.concat(options.path).join(path3.delimiter);
|
|
35412
35420
|
};
|
|
35413
35421
|
module2.exports = npmRunPath;
|
|
35414
35422
|
module2.exports.default = npmRunPath;
|
|
@@ -35418,9 +35426,9 @@ var require_npm_run_path = __commonJS({
|
|
|
35418
35426
|
...options
|
|
35419
35427
|
};
|
|
35420
35428
|
const env = { ...options.env };
|
|
35421
|
-
const
|
|
35422
|
-
options.path = env[
|
|
35423
|
-
env[
|
|
35429
|
+
const path4 = pathKey({ env });
|
|
35430
|
+
options.path = env[path4];
|
|
35431
|
+
env[path4] = module2.exports(options);
|
|
35424
35432
|
return env;
|
|
35425
35433
|
};
|
|
35426
35434
|
}
|
|
@@ -36196,7 +36204,7 @@ var require_signal_exit = __commonJS({
|
|
|
36196
36204
|
var require_kill = __commonJS({
|
|
36197
36205
|
"../../node_modules/execa/lib/kill.js"(exports2, module2) {
|
|
36198
36206
|
"use strict";
|
|
36199
|
-
var
|
|
36207
|
+
var os4 = require("os");
|
|
36200
36208
|
var onExit = require_signal_exit();
|
|
36201
36209
|
var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
|
|
36202
36210
|
var spawnedKill = (kill, signal = "SIGTERM", options = {}) => {
|
|
@@ -36220,7 +36228,7 @@ var require_kill = __commonJS({
|
|
|
36220
36228
|
return isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
|
|
36221
36229
|
};
|
|
36222
36230
|
var isSigterm = (signal) => {
|
|
36223
|
-
return signal ===
|
|
36231
|
+
return signal === os4.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
|
|
36224
36232
|
};
|
|
36225
36233
|
var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
|
|
36226
36234
|
if (forceKillAfterTimeout === true) {
|
|
@@ -36602,7 +36610,7 @@ var require_command = __commonJS({
|
|
|
36602
36610
|
var require_execa = __commonJS({
|
|
36603
36611
|
"../../node_modules/execa/index.js"(exports2, module2) {
|
|
36604
36612
|
"use strict";
|
|
36605
|
-
var
|
|
36613
|
+
var path3 = require("path");
|
|
36606
36614
|
var childProcess = require("child_process");
|
|
36607
36615
|
var crossSpawn = require_cross_spawn();
|
|
36608
36616
|
var stripFinalNewline = require_strip_final_newline();
|
|
@@ -36644,7 +36652,7 @@ var require_execa = __commonJS({
|
|
|
36644
36652
|
};
|
|
36645
36653
|
options.env = getEnv(options);
|
|
36646
36654
|
options.stdio = normalizeStdio(options);
|
|
36647
|
-
if (process.platform === "win32" &&
|
|
36655
|
+
if (process.platform === "win32" && path3.basename(file, ".exe") === "cmd") {
|
|
36648
36656
|
args.unshift("/q");
|
|
36649
36657
|
}
|
|
36650
36658
|
return { file, args, options, parsed };
|
|
@@ -38090,10 +38098,10 @@ var require_util = __commonJS({
|
|
|
38090
38098
|
function cloneDef(schema) {
|
|
38091
38099
|
return mergeDefs(schema._zod.def);
|
|
38092
38100
|
}
|
|
38093
|
-
function getElementAtPath(obj,
|
|
38094
|
-
if (!
|
|
38101
|
+
function getElementAtPath(obj, path3) {
|
|
38102
|
+
if (!path3)
|
|
38095
38103
|
return obj;
|
|
38096
|
-
return
|
|
38104
|
+
return path3.reduce((acc, key) => acc?.[key], obj);
|
|
38097
38105
|
}
|
|
38098
38106
|
function promiseAllObject(promisesObj) {
|
|
38099
38107
|
const keys = Object.keys(promisesObj);
|
|
@@ -38455,11 +38463,11 @@ var require_util = __commonJS({
|
|
|
38455
38463
|
}
|
|
38456
38464
|
return false;
|
|
38457
38465
|
}
|
|
38458
|
-
function prefixIssues(
|
|
38466
|
+
function prefixIssues(path3, issues) {
|
|
38459
38467
|
return issues.map((iss) => {
|
|
38460
38468
|
var _a;
|
|
38461
38469
|
(_a = iss).path ?? (_a.path = []);
|
|
38462
|
-
iss.path.unshift(
|
|
38470
|
+
iss.path.unshift(path3);
|
|
38463
38471
|
return iss;
|
|
38464
38472
|
});
|
|
38465
38473
|
}
|
|
@@ -38669,7 +38677,7 @@ var require_errors2 = __commonJS({
|
|
|
38669
38677
|
return issue.message;
|
|
38670
38678
|
};
|
|
38671
38679
|
const result = { errors: [] };
|
|
38672
|
-
const processError = (error2,
|
|
38680
|
+
const processError = (error2, path3 = []) => {
|
|
38673
38681
|
var _a, _b;
|
|
38674
38682
|
for (const issue of error2.issues) {
|
|
38675
38683
|
if (issue.code === "invalid_union" && issue.errors.length) {
|
|
@@ -38679,7 +38687,7 @@ var require_errors2 = __commonJS({
|
|
|
38679
38687
|
} else if (issue.code === "invalid_element") {
|
|
38680
38688
|
processError({ issues: issue.issues }, issue.path);
|
|
38681
38689
|
} else {
|
|
38682
|
-
const fullpath = [...
|
|
38690
|
+
const fullpath = [...path3, ...issue.path];
|
|
38683
38691
|
if (fullpath.length === 0) {
|
|
38684
38692
|
result.errors.push(mapper(issue));
|
|
38685
38693
|
continue;
|
|
@@ -38711,8 +38719,8 @@ var require_errors2 = __commonJS({
|
|
|
38711
38719
|
}
|
|
38712
38720
|
function toDotPath(_path) {
|
|
38713
38721
|
const segs = [];
|
|
38714
|
-
const
|
|
38715
|
-
for (const seg of
|
|
38722
|
+
const path3 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
38723
|
+
for (const seg of path3) {
|
|
38716
38724
|
if (typeof seg === "number")
|
|
38717
38725
|
segs.push(`[${seg}]`);
|
|
38718
38726
|
else if (typeof seg === "symbol")
|
|
@@ -52556,27 +52564,27 @@ var require_schema = __commonJS({
|
|
|
52556
52564
|
var require_lib5 = __commonJS({
|
|
52557
52565
|
"../../node_modules/os-paths/src/lib/index.js"(exports2, module2) {
|
|
52558
52566
|
"use strict";
|
|
52559
|
-
var
|
|
52567
|
+
var os4 = require("os");
|
|
52560
52568
|
var paths = require("path");
|
|
52561
52569
|
var isWinOS = /^win/i.test(process.platform);
|
|
52562
|
-
function normalize_path(
|
|
52563
|
-
return paths.normalize(paths.join(
|
|
52570
|
+
function normalize_path(path3) {
|
|
52571
|
+
return paths.normalize(paths.join(path3, "."));
|
|
52564
52572
|
}
|
|
52565
52573
|
var base = () => {
|
|
52566
52574
|
const { env } = process;
|
|
52567
52575
|
const object = {};
|
|
52568
|
-
object.home = () => normalize_path(
|
|
52569
|
-
object.temp = () => normalize_path(
|
|
52576
|
+
object.home = () => normalize_path(os4.homedir ? os4.homedir() : env.HOME);
|
|
52577
|
+
object.temp = () => normalize_path(os4.tmpdir ? os4.tmpdir() : env.TMPDIR || env.TEMP || env.TMP);
|
|
52570
52578
|
return object;
|
|
52571
52579
|
};
|
|
52572
52580
|
var windows = () => {
|
|
52573
52581
|
const { env } = process;
|
|
52574
52582
|
const object = {};
|
|
52575
52583
|
object.home = () => normalize_path(
|
|
52576
|
-
|
|
52584
|
+
os4.homedir ? os4.homedir() : env.USERPROFILE || paths.join(env.HOMEDRIVE, env.HOMEPATH) || env.HOME
|
|
52577
52585
|
);
|
|
52578
52586
|
object.temp = () => normalize_path(
|
|
52579
|
-
|
|
52587
|
+
os4.tmpdir ? os4.tmpdir() : env.TEMP || env.TMP || paths.join(env.LOCALAPPDATA || env.SystemRoot || env.windir, "Temp")
|
|
52580
52588
|
);
|
|
52581
52589
|
return object;
|
|
52582
52590
|
};
|
|
@@ -52601,44 +52609,44 @@ var require_lib5 = __commonJS({
|
|
|
52601
52609
|
var require_lib6 = __commonJS({
|
|
52602
52610
|
"../../node_modules/xdg-portable/src/lib/index.js"(exports2, module2) {
|
|
52603
52611
|
"use strict";
|
|
52604
|
-
var
|
|
52612
|
+
var path3 = require("path");
|
|
52605
52613
|
var osPaths = require_lib5();
|
|
52606
52614
|
var linux = () => {
|
|
52607
52615
|
const object = {};
|
|
52608
|
-
object.cache = () => process.env.XDG_CACHE_HOME ||
|
|
52609
|
-
object.config = () => process.env.XDG_CONFIG_HOME ||
|
|
52610
|
-
object.data = () => process.env.XDG_DATA_HOME ||
|
|
52616
|
+
object.cache = () => process.env.XDG_CACHE_HOME || path3.join(osPaths.home() || osPaths.temp(), ".cache");
|
|
52617
|
+
object.config = () => process.env.XDG_CONFIG_HOME || path3.join(osPaths.home() || osPaths.temp(), ".config");
|
|
52618
|
+
object.data = () => process.env.XDG_DATA_HOME || path3.join(osPaths.home() || osPaths.temp(), ".local", "share");
|
|
52611
52619
|
object.runtime = () => process.env.XDG_RUNTIME_DIR || void 0;
|
|
52612
|
-
object.state = () => process.env.XDG_STATE_HOME ||
|
|
52620
|
+
object.state = () => process.env.XDG_STATE_HOME || path3.join(osPaths.home() || osPaths.temp(), ".local", "state");
|
|
52613
52621
|
return object;
|
|
52614
52622
|
};
|
|
52615
52623
|
var macos = () => {
|
|
52616
52624
|
const object = {};
|
|
52617
|
-
object.cache = () => process.env.XDG_CACHE_HOME ||
|
|
52618
|
-
object.config = () => process.env.XDG_CONFIG_HOME ||
|
|
52619
|
-
object.data = () => process.env.XDG_DATA_HOME ||
|
|
52625
|
+
object.cache = () => process.env.XDG_CACHE_HOME || path3.join(path3.join(osPaths.home() || osPaths.temp(), "Library"), "Caches");
|
|
52626
|
+
object.config = () => process.env.XDG_CONFIG_HOME || path3.join(path3.join(osPaths.home() || osPaths.temp(), "Library"), "Preferences");
|
|
52627
|
+
object.data = () => process.env.XDG_DATA_HOME || path3.join(path3.join(osPaths.home() || osPaths.temp(), "Library"), "Application Support");
|
|
52620
52628
|
object.runtime = () => process.env.XDG_RUNTIME_DIR || void 0;
|
|
52621
|
-
object.state = () => process.env.XDG_STATE_HOME ||
|
|
52629
|
+
object.state = () => process.env.XDG_STATE_HOME || path3.join(path3.join(osPaths.home() || osPaths.temp(), "Library"), "State");
|
|
52622
52630
|
return object;
|
|
52623
52631
|
};
|
|
52624
52632
|
var windows = () => {
|
|
52625
52633
|
const object = {};
|
|
52626
52634
|
object.cache = () => {
|
|
52627
|
-
const localAppData = process.env.LOCALAPPDATA ||
|
|
52628
|
-
return process.env.XDG_CACHE_HOME ||
|
|
52635
|
+
const localAppData = process.env.LOCALAPPDATA || path3.join(osPaths.home() || osPaths.temp(), "AppData", "Local");
|
|
52636
|
+
return process.env.XDG_CACHE_HOME || path3.join(localAppData, "xdg.cache");
|
|
52629
52637
|
};
|
|
52630
52638
|
object.config = () => {
|
|
52631
|
-
const appData = process.env.APPDATA ||
|
|
52632
|
-
return process.env.XDG_CONFIG_HOME ||
|
|
52639
|
+
const appData = process.env.APPDATA || path3.join(osPaths.home() || osPaths.temp(), "AppData", "Roaming");
|
|
52640
|
+
return process.env.XDG_CONFIG_HOME || path3.join(appData, "xdg.config");
|
|
52633
52641
|
};
|
|
52634
52642
|
object.data = () => {
|
|
52635
|
-
const appData = process.env.APPDATA ||
|
|
52636
|
-
return process.env.XDG_DATA_HOME ||
|
|
52643
|
+
const appData = process.env.APPDATA || path3.join(osPaths.home() || osPaths.temp(), "AppData", "Roaming");
|
|
52644
|
+
return process.env.XDG_DATA_HOME || path3.join(appData, "xdg.data");
|
|
52637
52645
|
};
|
|
52638
52646
|
object.runtime = () => process.env.XDG_RUNTIME_DIR || void 0;
|
|
52639
52647
|
object.state = () => {
|
|
52640
|
-
const localAppData = process.env.LOCALAPPDATA ||
|
|
52641
|
-
return process.env.XDG_STATE_HOME ||
|
|
52648
|
+
const localAppData = process.env.LOCALAPPDATA || path3.join(osPaths.home() || osPaths.temp(), "AppData", "Local");
|
|
52649
|
+
return process.env.XDG_STATE_HOME || path3.join(localAppData, "xdg.state");
|
|
52642
52650
|
};
|
|
52643
52651
|
return object;
|
|
52644
52652
|
};
|
|
@@ -52658,7 +52666,7 @@ var require_lib6 = __commonJS({
|
|
|
52658
52666
|
const dirs = [];
|
|
52659
52667
|
dirs.push(extension.config());
|
|
52660
52668
|
if (process.env.XDG_CONFIG_DIRS) {
|
|
52661
|
-
dirs.push(...process.env.XDG_CONFIG_DIRS.split(
|
|
52669
|
+
dirs.push(...process.env.XDG_CONFIG_DIRS.split(path3.delimiter));
|
|
52662
52670
|
}
|
|
52663
52671
|
return dirs;
|
|
52664
52672
|
};
|
|
@@ -52666,7 +52674,7 @@ var require_lib6 = __commonJS({
|
|
|
52666
52674
|
const dirs = [];
|
|
52667
52675
|
dirs.push(extension.data());
|
|
52668
52676
|
if (process.env.XDG_DATA_DIRS) {
|
|
52669
|
-
dirs.push(...process.env.XDG_DATA_DIRS.split(
|
|
52677
|
+
dirs.push(...process.env.XDG_DATA_DIRS.split(path3.delimiter));
|
|
52670
52678
|
}
|
|
52671
52679
|
return dirs;
|
|
52672
52680
|
};
|
|
@@ -52683,7 +52691,7 @@ var require_lib6 = __commonJS({
|
|
|
52683
52691
|
var require_lib7 = __commonJS({
|
|
52684
52692
|
"../../node_modules/xdg-app-paths/src/lib/index.js"(exports2, module2) {
|
|
52685
52693
|
"use strict";
|
|
52686
|
-
var
|
|
52694
|
+
var path3 = require("path");
|
|
52687
52695
|
var xdg = require_lib6();
|
|
52688
52696
|
function normalizeOptions_(options, isolated) {
|
|
52689
52697
|
if (!isObject(options)) {
|
|
@@ -52735,38 +52743,38 @@ var require_lib7 = __commonJS({
|
|
|
52735
52743
|
throw new TypeError(`Expected string for "name" argument, got ${typeOf(name_)}`);
|
|
52736
52744
|
}
|
|
52737
52745
|
if (!name_) {
|
|
52738
|
-
name_ =
|
|
52746
|
+
name_ = path3.parse(require.main && require.main.filename || process.execPath).name;
|
|
52739
52747
|
}
|
|
52740
52748
|
name_ += suffix_ || "";
|
|
52741
52749
|
XDGAppPaths.$name = () => name_;
|
|
52742
52750
|
XDGAppPaths.$isolated = () => isolated_;
|
|
52743
52751
|
XDGAppPaths.cache = (dirOptions = null) => {
|
|
52744
52752
|
dirOptions = normalizeOptions_(dirOptions, isolated_);
|
|
52745
|
-
return
|
|
52753
|
+
return path3.join(xdg.cache(), dirOptions.isolated ? name_ : "");
|
|
52746
52754
|
};
|
|
52747
52755
|
XDGAppPaths.config = function(dirOptions = null) {
|
|
52748
52756
|
dirOptions = normalizeOptions_(dirOptions, isolated_);
|
|
52749
|
-
return
|
|
52757
|
+
return path3.join(xdg.config(), dirOptions.isolated ? name_ : "");
|
|
52750
52758
|
};
|
|
52751
52759
|
XDGAppPaths.data = function(dirOptions = null) {
|
|
52752
52760
|
dirOptions = normalizeOptions_(dirOptions, isolated_);
|
|
52753
|
-
return
|
|
52761
|
+
return path3.join(xdg.data(), dirOptions.isolated ? name_ : "");
|
|
52754
52762
|
};
|
|
52755
52763
|
XDGAppPaths.runtime = function(dirOptions = null) {
|
|
52756
52764
|
dirOptions = normalizeOptions_(dirOptions, isolated_);
|
|
52757
|
-
return xdg.runtime() ?
|
|
52765
|
+
return xdg.runtime() ? path3.join(xdg.runtime(), dirOptions.isolated ? name_ : "") : void 0;
|
|
52758
52766
|
};
|
|
52759
52767
|
XDGAppPaths.state = function(dirOptions = null) {
|
|
52760
52768
|
dirOptions = normalizeOptions_(dirOptions, isolated_);
|
|
52761
|
-
return
|
|
52769
|
+
return path3.join(xdg.state(), dirOptions.isolated ? name_ : "");
|
|
52762
52770
|
};
|
|
52763
52771
|
XDGAppPaths.configDirs = function(dirOptions = null) {
|
|
52764
52772
|
dirOptions = normalizeOptions_(dirOptions, isolated_);
|
|
52765
|
-
return xdg.configDirs().map((s) =>
|
|
52773
|
+
return xdg.configDirs().map((s) => path3.join(s, dirOptions.isolated ? name_ : ""));
|
|
52766
52774
|
};
|
|
52767
52775
|
XDGAppPaths.dataDirs = function(dirOptions = null) {
|
|
52768
52776
|
dirOptions = normalizeOptions_(dirOptions, isolated_);
|
|
52769
|
-
return xdg.dataDirs().map((s) =>
|
|
52777
|
+
return xdg.dataDirs().map((s) => path3.join(s, dirOptions.isolated ? name_ : ""));
|
|
52770
52778
|
};
|
|
52771
52779
|
this.fn = XDGAppPaths;
|
|
52772
52780
|
}
|
|
@@ -53087,19 +53095,19 @@ var require_token_io = __commonJS({
|
|
|
53087
53095
|
getUserDataDir: () => getUserDataDir
|
|
53088
53096
|
});
|
|
53089
53097
|
module2.exports = __toCommonJS(token_io_exports);
|
|
53090
|
-
var
|
|
53091
|
-
var
|
|
53092
|
-
var
|
|
53098
|
+
var import_path3 = __toESM2(require("path"));
|
|
53099
|
+
var import_fs3 = __toESM2(require("fs"));
|
|
53100
|
+
var import_os4 = __toESM2(require("os"));
|
|
53093
53101
|
var import_token_error = require_token_error();
|
|
53094
53102
|
function findRootDir() {
|
|
53095
53103
|
try {
|
|
53096
53104
|
let dir = process.cwd();
|
|
53097
|
-
while (dir !==
|
|
53098
|
-
const pkgPath =
|
|
53099
|
-
if (
|
|
53105
|
+
while (dir !== import_path3.default.dirname(dir)) {
|
|
53106
|
+
const pkgPath = import_path3.default.join(dir, ".vercel");
|
|
53107
|
+
if (import_fs3.default.existsSync(pkgPath)) {
|
|
53100
53108
|
return dir;
|
|
53101
53109
|
}
|
|
53102
|
-
dir =
|
|
53110
|
+
dir = import_path3.default.dirname(dir);
|
|
53103
53111
|
}
|
|
53104
53112
|
} catch (_e) {
|
|
53105
53113
|
throw new import_token_error.VercelOidcTokenError(
|
|
@@ -53112,11 +53120,11 @@ var require_token_io = __commonJS({
|
|
|
53112
53120
|
if (process.env.XDG_DATA_HOME) {
|
|
53113
53121
|
return process.env.XDG_DATA_HOME;
|
|
53114
53122
|
}
|
|
53115
|
-
switch (
|
|
53123
|
+
switch (import_os4.default.platform()) {
|
|
53116
53124
|
case "darwin":
|
|
53117
|
-
return
|
|
53125
|
+
return import_path3.default.join(import_os4.default.homedir(), "Library/Application Support");
|
|
53118
53126
|
case "linux":
|
|
53119
|
-
return
|
|
53127
|
+
return import_path3.default.join(import_os4.default.homedir(), ".local/share");
|
|
53120
53128
|
case "win32":
|
|
53121
53129
|
if (process.env.LOCALAPPDATA) {
|
|
53122
53130
|
return process.env.LOCALAPPDATA;
|
|
@@ -53156,10 +53164,10 @@ var require_oauth = __commonJS({
|
|
|
53156
53164
|
refreshTokenRequest: () => refreshTokenRequest
|
|
53157
53165
|
});
|
|
53158
53166
|
module2.exports = __toCommonJS(oauth_exports);
|
|
53159
|
-
var
|
|
53167
|
+
var import_os4 = require("os");
|
|
53160
53168
|
var VERCEL_ISSUER = "https://vercel.com";
|
|
53161
53169
|
var VERCEL_CLI_CLIENT_ID = "cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp";
|
|
53162
|
-
var userAgent = `@vercel/oidc node-${process.version} ${(0,
|
|
53170
|
+
var userAgent = `@vercel/oidc node-${process.version} ${(0, import_os4.platform)()} (${(0, import_os4.arch)()}) ${(0, import_os4.hostname)()}`;
|
|
53163
53171
|
var _tokenEndpoint = null;
|
|
53164
53172
|
async function getTokenEndpoint() {
|
|
53165
53173
|
if (_tokenEndpoint) {
|
|
@@ -53309,8 +53317,8 @@ var require_token_util = __commonJS({
|
|
|
53309
53317
|
saveToken: () => saveToken
|
|
53310
53318
|
});
|
|
53311
53319
|
module2.exports = __toCommonJS(token_util_exports);
|
|
53312
|
-
var
|
|
53313
|
-
var
|
|
53320
|
+
var path3 = __toESM2(require("path"));
|
|
53321
|
+
var fs3 = __toESM2(require("fs"));
|
|
53314
53322
|
var import_cli_exec = require_dist2();
|
|
53315
53323
|
var import_cli_config = require_dist3();
|
|
53316
53324
|
var import_token_error = require_token_error();
|
|
@@ -53434,13 +53442,13 @@ ${stderr}`.trim();
|
|
|
53434
53442
|
"Unable to find project root directory. Have you linked your project with `vc link?`"
|
|
53435
53443
|
);
|
|
53436
53444
|
}
|
|
53437
|
-
const prjPath =
|
|
53438
|
-
if (!
|
|
53445
|
+
const prjPath = path3.join(dir, ".vercel", "project.json");
|
|
53446
|
+
if (!fs3.existsSync(prjPath)) {
|
|
53439
53447
|
throw new import_token_error.VercelOidcTokenError(
|
|
53440
53448
|
"project.json not found, have you linked your project with `vc link?`"
|
|
53441
53449
|
);
|
|
53442
53450
|
}
|
|
53443
|
-
const prj = JSON.parse(
|
|
53451
|
+
const prj = JSON.parse(fs3.readFileSync(prjPath, "utf8"));
|
|
53444
53452
|
if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
|
|
53445
53453
|
throw new TypeError(
|
|
53446
53454
|
"Expected a string-valued projectId property. Try running `vc link` to re-link your project."
|
|
@@ -53455,11 +53463,11 @@ ${stderr}`.trim();
|
|
|
53455
53463
|
"Unable to find user data directory. Please reach out to Vercel support."
|
|
53456
53464
|
);
|
|
53457
53465
|
}
|
|
53458
|
-
const tokenPath =
|
|
53466
|
+
const tokenPath = path3.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
53459
53467
|
const tokenJson = JSON.stringify(token);
|
|
53460
|
-
|
|
53461
|
-
|
|
53462
|
-
|
|
53468
|
+
fs3.mkdirSync(path3.dirname(tokenPath), { mode: 504, recursive: true });
|
|
53469
|
+
fs3.writeFileSync(tokenPath, tokenJson);
|
|
53470
|
+
fs3.chmodSync(tokenPath, 432);
|
|
53463
53471
|
return;
|
|
53464
53472
|
}
|
|
53465
53473
|
function loadToken(projectId) {
|
|
@@ -53469,11 +53477,11 @@ ${stderr}`.trim();
|
|
|
53469
53477
|
"Unable to find user data directory. Please reach out to Vercel support."
|
|
53470
53478
|
);
|
|
53471
53479
|
}
|
|
53472
|
-
const tokenPath =
|
|
53473
|
-
if (!
|
|
53480
|
+
const tokenPath = path3.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
53481
|
+
if (!fs3.existsSync(tokenPath)) {
|
|
53474
53482
|
return null;
|
|
53475
53483
|
}
|
|
53476
|
-
const token = JSON.parse(
|
|
53484
|
+
const token = JSON.parse(fs3.readFileSync(tokenPath, "utf8"));
|
|
53477
53485
|
assertVercelOidcTokenResponse(token);
|
|
53478
53486
|
return token;
|
|
53479
53487
|
}
|
|
@@ -59293,14 +59301,14 @@ var require_util2 = __commonJS({
|
|
|
59293
59301
|
}
|
|
59294
59302
|
const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
|
|
59295
59303
|
let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
|
|
59296
|
-
let
|
|
59304
|
+
let path3 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
|
|
59297
59305
|
if (origin[origin.length - 1] === "/") {
|
|
59298
59306
|
origin = origin.slice(0, origin.length - 1);
|
|
59299
59307
|
}
|
|
59300
|
-
if (
|
|
59301
|
-
|
|
59308
|
+
if (path3 && path3[0] !== "/") {
|
|
59309
|
+
path3 = `/${path3}`;
|
|
59302
59310
|
}
|
|
59303
|
-
return new URL(`${origin}${
|
|
59311
|
+
return new URL(`${origin}${path3}`);
|
|
59304
59312
|
}
|
|
59305
59313
|
if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
|
|
59306
59314
|
throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -59751,39 +59759,39 @@ var require_diagnostics = __commonJS({
|
|
|
59751
59759
|
});
|
|
59752
59760
|
diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
|
|
59753
59761
|
const {
|
|
59754
|
-
request: { method, path:
|
|
59762
|
+
request: { method, path: path3, origin }
|
|
59755
59763
|
} = evt;
|
|
59756
|
-
debuglog("sending request to %s %s/%s", method, origin,
|
|
59764
|
+
debuglog("sending request to %s %s/%s", method, origin, path3);
|
|
59757
59765
|
});
|
|
59758
59766
|
diagnosticsChannel.channel("undici:request:headers").subscribe((evt) => {
|
|
59759
59767
|
const {
|
|
59760
|
-
request: { method, path:
|
|
59768
|
+
request: { method, path: path3, origin },
|
|
59761
59769
|
response: { statusCode }
|
|
59762
59770
|
} = evt;
|
|
59763
59771
|
debuglog(
|
|
59764
59772
|
"received response to %s %s/%s - HTTP %d",
|
|
59765
59773
|
method,
|
|
59766
59774
|
origin,
|
|
59767
|
-
|
|
59775
|
+
path3,
|
|
59768
59776
|
statusCode
|
|
59769
59777
|
);
|
|
59770
59778
|
});
|
|
59771
59779
|
diagnosticsChannel.channel("undici:request:trailers").subscribe((evt) => {
|
|
59772
59780
|
const {
|
|
59773
|
-
request: { method, path:
|
|
59781
|
+
request: { method, path: path3, origin }
|
|
59774
59782
|
} = evt;
|
|
59775
|
-
debuglog("trailers received from %s %s/%s", method, origin,
|
|
59783
|
+
debuglog("trailers received from %s %s/%s", method, origin, path3);
|
|
59776
59784
|
});
|
|
59777
59785
|
diagnosticsChannel.channel("undici:request:error").subscribe((evt) => {
|
|
59778
59786
|
const {
|
|
59779
|
-
request: { method, path:
|
|
59787
|
+
request: { method, path: path3, origin },
|
|
59780
59788
|
error
|
|
59781
59789
|
} = evt;
|
|
59782
59790
|
debuglog(
|
|
59783
59791
|
"request to %s %s/%s errored - %s",
|
|
59784
59792
|
method,
|
|
59785
59793
|
origin,
|
|
59786
|
-
|
|
59794
|
+
path3,
|
|
59787
59795
|
error.message
|
|
59788
59796
|
);
|
|
59789
59797
|
});
|
|
@@ -59832,9 +59840,9 @@ var require_diagnostics = __commonJS({
|
|
|
59832
59840
|
});
|
|
59833
59841
|
diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
|
|
59834
59842
|
const {
|
|
59835
|
-
request: { method, path:
|
|
59843
|
+
request: { method, path: path3, origin }
|
|
59836
59844
|
} = evt;
|
|
59837
|
-
debuglog("sending request to %s %s/%s", method, origin,
|
|
59845
|
+
debuglog("sending request to %s %s/%s", method, origin, path3);
|
|
59838
59846
|
});
|
|
59839
59847
|
}
|
|
59840
59848
|
diagnosticsChannel.channel("undici:websocket:open").subscribe((evt) => {
|
|
@@ -59897,7 +59905,7 @@ var require_request = __commonJS({
|
|
|
59897
59905
|
var kHandler = Symbol("handler");
|
|
59898
59906
|
var Request2 = class {
|
|
59899
59907
|
constructor(origin, {
|
|
59900
|
-
path:
|
|
59908
|
+
path: path3,
|
|
59901
59909
|
method,
|
|
59902
59910
|
body,
|
|
59903
59911
|
headers,
|
|
@@ -59912,11 +59920,11 @@ var require_request = __commonJS({
|
|
|
59912
59920
|
expectContinue,
|
|
59913
59921
|
servername
|
|
59914
59922
|
}, handler) {
|
|
59915
|
-
if (typeof
|
|
59923
|
+
if (typeof path3 !== "string") {
|
|
59916
59924
|
throw new InvalidArgumentError("path must be a string");
|
|
59917
|
-
} else if (
|
|
59925
|
+
} else if (path3[0] !== "/" && !(path3.startsWith("http://") || path3.startsWith("https://")) && method !== "CONNECT") {
|
|
59918
59926
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
|
59919
|
-
} else if (invalidPathRegex.test(
|
|
59927
|
+
} else if (invalidPathRegex.test(path3)) {
|
|
59920
59928
|
throw new InvalidArgumentError("invalid request path");
|
|
59921
59929
|
}
|
|
59922
59930
|
if (typeof method !== "string") {
|
|
@@ -59982,7 +59990,7 @@ var require_request = __commonJS({
|
|
|
59982
59990
|
this.completed = false;
|
|
59983
59991
|
this.aborted = false;
|
|
59984
59992
|
this.upgrade = upgrade || null;
|
|
59985
|
-
this.path = query ? buildURL(
|
|
59993
|
+
this.path = query ? buildURL(path3, query) : path3;
|
|
59986
59994
|
this.origin = origin;
|
|
59987
59995
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
59988
59996
|
this.blocking = blocking == null ? false : blocking;
|
|
@@ -64604,7 +64612,7 @@ var require_client_h1 = __commonJS({
|
|
|
64604
64612
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
64605
64613
|
}
|
|
64606
64614
|
function writeH1(client, request) {
|
|
64607
|
-
const { method, path:
|
|
64615
|
+
const { method, path: path3, host, upgrade, blocking, reset } = request;
|
|
64608
64616
|
let { body, headers, contentLength } = request;
|
|
64609
64617
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
64610
64618
|
if (util.isFormDataLike(body)) {
|
|
@@ -64671,7 +64679,7 @@ var require_client_h1 = __commonJS({
|
|
|
64671
64679
|
if (blocking) {
|
|
64672
64680
|
socket[kBlocking] = true;
|
|
64673
64681
|
}
|
|
64674
|
-
let header = `${method} ${
|
|
64682
|
+
let header = `${method} ${path3} HTTP/1.1\r
|
|
64675
64683
|
`;
|
|
64676
64684
|
if (typeof host === "string") {
|
|
64677
64685
|
header += `host: ${host}\r
|
|
@@ -65197,7 +65205,7 @@ var require_client_h2 = __commonJS({
|
|
|
65197
65205
|
}
|
|
65198
65206
|
function writeH2(client, request) {
|
|
65199
65207
|
const session = client[kHTTP2Session];
|
|
65200
|
-
const { method, path:
|
|
65208
|
+
const { method, path: path3, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
|
|
65201
65209
|
let { body } = request;
|
|
65202
65210
|
if (upgrade) {
|
|
65203
65211
|
util.errorRequest(client, request, new Error("Upgrade not supported for H2"));
|
|
@@ -65264,7 +65272,7 @@ var require_client_h2 = __commonJS({
|
|
|
65264
65272
|
});
|
|
65265
65273
|
return true;
|
|
65266
65274
|
}
|
|
65267
|
-
headers[HTTP2_HEADER_PATH] =
|
|
65275
|
+
headers[HTTP2_HEADER_PATH] = path3;
|
|
65268
65276
|
headers[HTTP2_HEADER_SCHEME] = "https";
|
|
65269
65277
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
65270
65278
|
if (body && typeof body.read === "function") {
|
|
@@ -65617,9 +65625,9 @@ var require_redirect_handler = __commonJS({
|
|
|
65617
65625
|
return this.handler.onHeaders(statusCode, headers, resume, statusText);
|
|
65618
65626
|
}
|
|
65619
65627
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
65620
|
-
const
|
|
65628
|
+
const path3 = search ? `${pathname}${search}` : pathname;
|
|
65621
65629
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
65622
|
-
this.opts.path =
|
|
65630
|
+
this.opts.path = path3;
|
|
65623
65631
|
this.opts.origin = origin;
|
|
65624
65632
|
this.opts.maxRedirections = 0;
|
|
65625
65633
|
this.opts.query = null;
|
|
@@ -66854,10 +66862,10 @@ var require_proxy_agent = __commonJS({
|
|
|
66854
66862
|
};
|
|
66855
66863
|
const {
|
|
66856
66864
|
origin,
|
|
66857
|
-
path:
|
|
66865
|
+
path: path3 = "/",
|
|
66858
66866
|
headers = {}
|
|
66859
66867
|
} = opts;
|
|
66860
|
-
opts.path = origin +
|
|
66868
|
+
opts.path = origin + path3;
|
|
66861
66869
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
66862
66870
|
const { host } = new URL2(origin);
|
|
66863
66871
|
headers.host = host;
|
|
@@ -68778,20 +68786,20 @@ var require_mock_utils = __commonJS({
|
|
|
68778
68786
|
}
|
|
68779
68787
|
return true;
|
|
68780
68788
|
}
|
|
68781
|
-
function safeUrl(
|
|
68782
|
-
if (typeof
|
|
68783
|
-
return
|
|
68789
|
+
function safeUrl(path3) {
|
|
68790
|
+
if (typeof path3 !== "string") {
|
|
68791
|
+
return path3;
|
|
68784
68792
|
}
|
|
68785
|
-
const pathSegments =
|
|
68793
|
+
const pathSegments = path3.split("?");
|
|
68786
68794
|
if (pathSegments.length !== 2) {
|
|
68787
|
-
return
|
|
68795
|
+
return path3;
|
|
68788
68796
|
}
|
|
68789
68797
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
68790
68798
|
qp.sort();
|
|
68791
68799
|
return [...pathSegments, qp.toString()].join("?");
|
|
68792
68800
|
}
|
|
68793
|
-
function matchKey(mockDispatch2, { path:
|
|
68794
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
68801
|
+
function matchKey(mockDispatch2, { path: path3, method, body, headers }) {
|
|
68802
|
+
const pathMatch = matchValue(mockDispatch2.path, path3);
|
|
68795
68803
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
68796
68804
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
68797
68805
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -68813,7 +68821,7 @@ var require_mock_utils = __commonJS({
|
|
|
68813
68821
|
function getMockDispatch(mockDispatches, key) {
|
|
68814
68822
|
const basePath = key.query ? buildURL(key.path, key.query) : key.path;
|
|
68815
68823
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
68816
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
68824
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path3 }) => matchValue(safeUrl(path3), resolvedPath));
|
|
68817
68825
|
if (matchedMockDispatches.length === 0) {
|
|
68818
68826
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
68819
68827
|
}
|
|
@@ -68851,9 +68859,9 @@ var require_mock_utils = __commonJS({
|
|
|
68851
68859
|
}
|
|
68852
68860
|
}
|
|
68853
68861
|
function buildKey(opts) {
|
|
68854
|
-
const { path:
|
|
68862
|
+
const { path: path3, method, body, headers, query } = opts;
|
|
68855
68863
|
return {
|
|
68856
|
-
path:
|
|
68864
|
+
path: path3,
|
|
68857
68865
|
method,
|
|
68858
68866
|
body,
|
|
68859
68867
|
headers,
|
|
@@ -69316,10 +69324,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
69316
69324
|
}
|
|
69317
69325
|
format(pendingInterceptors) {
|
|
69318
69326
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
69319
|
-
({ method, path:
|
|
69327
|
+
({ method, path: path3, data: { statusCode }, persist: persist2, times, timesInvoked, origin }) => ({
|
|
69320
69328
|
Method: method,
|
|
69321
69329
|
Origin: origin,
|
|
69322
|
-
Path:
|
|
69330
|
+
Path: path3,
|
|
69323
69331
|
"Status code": statusCode,
|
|
69324
69332
|
Persistent: persist2 ? PERSISTENT : NOT_PERSISTENT,
|
|
69325
69333
|
Invocations: timesInvoked,
|
|
@@ -74200,9 +74208,9 @@ var require_util7 = __commonJS({
|
|
|
74200
74208
|
}
|
|
74201
74209
|
}
|
|
74202
74210
|
}
|
|
74203
|
-
function validateCookiePath(
|
|
74204
|
-
for (let i = 0; i <
|
|
74205
|
-
const code =
|
|
74211
|
+
function validateCookiePath(path3) {
|
|
74212
|
+
for (let i = 0; i < path3.length; ++i) {
|
|
74213
|
+
const code = path3.charCodeAt(i);
|
|
74206
74214
|
if (code < 32 || // exclude CTLs (0-31)
|
|
74207
74215
|
code === 127 || // DEL
|
|
74208
74216
|
code === 59) {
|
|
@@ -76895,11 +76903,11 @@ var require_undici = __commonJS({
|
|
|
76895
76903
|
if (typeof opts.path !== "string") {
|
|
76896
76904
|
throw new InvalidArgumentError("invalid opts.path");
|
|
76897
76905
|
}
|
|
76898
|
-
let
|
|
76906
|
+
let path3 = opts.path;
|
|
76899
76907
|
if (!opts.path.startsWith("/")) {
|
|
76900
|
-
|
|
76908
|
+
path3 = `/${path3}`;
|
|
76901
76909
|
}
|
|
76902
|
-
url = new URL(util.parseOrigin(url).origin +
|
|
76910
|
+
url = new URL(util.parseOrigin(url).origin + path3);
|
|
76903
76911
|
} else {
|
|
76904
76912
|
if (!opts) {
|
|
76905
76913
|
opts = typeof url === "object" ? url : {};
|
|
@@ -79478,8 +79486,8 @@ var require_builder = __commonJS({
|
|
|
79478
79486
|
var axios_1 = __importDefault(require_axios());
|
|
79479
79487
|
var runtime_1 = require_runtime();
|
|
79480
79488
|
var llm_1 = require_llm();
|
|
79481
|
-
var
|
|
79482
|
-
var
|
|
79489
|
+
var fs3 = __importStar(require("fs"));
|
|
79490
|
+
var path3 = __importStar(require("path"));
|
|
79483
79491
|
var models_1 = require_models();
|
|
79484
79492
|
var cms_template_1 = require_cms_template();
|
|
79485
79493
|
var cms_runtime_1 = require_cms_runtime();
|
|
@@ -79548,44 +79556,44 @@ var require_builder = __commonJS({
|
|
|
79548
79556
|
return code.replace(pattern, "");
|
|
79549
79557
|
}
|
|
79550
79558
|
function snapshotDir(leadId) {
|
|
79551
|
-
return
|
|
79559
|
+
return path3.join((0, runtime_1.userDataDir)(), "data", "sites", String(leadId));
|
|
79552
79560
|
}
|
|
79553
79561
|
function saveSnapshot(leadId, files) {
|
|
79554
79562
|
const dir = snapshotDir(leadId);
|
|
79555
79563
|
try {
|
|
79556
|
-
|
|
79564
|
+
fs3.mkdirSync(dir, { recursive: true });
|
|
79557
79565
|
for (const f of files) {
|
|
79558
|
-
const target =
|
|
79559
|
-
|
|
79566
|
+
const target = path3.join(dir, f.file);
|
|
79567
|
+
fs3.mkdirSync(path3.dirname(target), { recursive: true });
|
|
79560
79568
|
if (f.encoding === "base64") {
|
|
79561
|
-
|
|
79569
|
+
fs3.writeFileSync(target, Buffer.from(f.data, "base64"));
|
|
79562
79570
|
} else {
|
|
79563
|
-
|
|
79571
|
+
fs3.writeFileSync(target, f.data, "utf-8");
|
|
79564
79572
|
}
|
|
79565
79573
|
}
|
|
79566
|
-
|
|
79574
|
+
fs3.writeFileSync(path3.join(dir, ".snapshot.json"), JSON.stringify({ savedAt: Date.now() }));
|
|
79567
79575
|
} catch {
|
|
79568
79576
|
}
|
|
79569
79577
|
}
|
|
79570
79578
|
function loadSnapshot(leadId) {
|
|
79571
79579
|
const dir = snapshotDir(leadId);
|
|
79572
|
-
if (!
|
|
79580
|
+
if (!fs3.existsSync(dir))
|
|
79573
79581
|
return null;
|
|
79574
79582
|
const out = [];
|
|
79575
79583
|
function walk(rel) {
|
|
79576
|
-
const abs =
|
|
79577
|
-
const stat =
|
|
79584
|
+
const abs = path3.join(dir, rel);
|
|
79585
|
+
const stat = fs3.statSync(abs);
|
|
79578
79586
|
if (stat.isDirectory()) {
|
|
79579
|
-
for (const child of
|
|
79587
|
+
for (const child of fs3.readdirSync(abs)) {
|
|
79580
79588
|
if (child.startsWith("."))
|
|
79581
79589
|
continue;
|
|
79582
79590
|
walk(rel ? `${rel}/${child}` : child);
|
|
79583
79591
|
}
|
|
79584
79592
|
} else if (stat.isFile()) {
|
|
79585
79593
|
if (/\.(jpg|jpeg|png|gif|webp|avif)$/i.test(rel)) {
|
|
79586
|
-
out.push({ file: rel, data:
|
|
79594
|
+
out.push({ file: rel, data: fs3.readFileSync(abs).toString("base64"), encoding: "base64" });
|
|
79587
79595
|
} else {
|
|
79588
|
-
out.push({ file: rel, data:
|
|
79596
|
+
out.push({ file: rel, data: fs3.readFileSync(abs, "utf-8"), encoding: "utf-8" });
|
|
79589
79597
|
}
|
|
79590
79598
|
}
|
|
79591
79599
|
}
|
|
@@ -80721,6 +80729,39 @@ var require_lead_search = __commonJS({
|
|
|
80721
80729
|
exports2.searchAndSaveLeads = searchAndSaveLeads;
|
|
80722
80730
|
var db_1 = require_db();
|
|
80723
80731
|
var places_1 = require_places();
|
|
80732
|
+
var llm_1 = require_llm();
|
|
80733
|
+
async function hasRealWebsite(cand, anthropicKey) {
|
|
80734
|
+
const prompt = `Search the web to determine whether this specific local business has its OWN real, live website (a site they control \u2014 e.g. a .com/.co.uk, Wix, Squarespace, or self-hosted site).
|
|
80735
|
+
|
|
80736
|
+
Business: "${cand.name}"
|
|
80737
|
+
Address: ${cand.address}${cand.city ? `, ${cand.city}` : ""}
|
|
80738
|
+
|
|
80739
|
+
Rules for your judgement:
|
|
80740
|
+
- A Facebook, Instagram, or other social-media page is NOT a website.
|
|
80741
|
+
- A directory listing (Yelp, Yell, TripAdvisor, Google profile, JustEat, Deliveroo, Treatwell, Fresha, etc.) is NOT their own website.
|
|
80742
|
+
- A parked, for-sale, or dead domain with no real content is NOT a live website.
|
|
80743
|
+
- Only answer true if you find a genuine website that clearly belongs to THIS business.
|
|
80744
|
+
- If you are unsure, or can't confirm, answer false.
|
|
80745
|
+
|
|
80746
|
+
Respond with ONLY compact JSON, no prose: {"hasWebsite": boolean, "url": string|null}`;
|
|
80747
|
+
try {
|
|
80748
|
+
const res = await (0, llm_1.generateText)({
|
|
80749
|
+
apiKey: anthropicKey,
|
|
80750
|
+
prompt,
|
|
80751
|
+
allowWebSearch: true,
|
|
80752
|
+
maxTokens: 1024,
|
|
80753
|
+
timeoutMs: 9e4
|
|
80754
|
+
});
|
|
80755
|
+
const raw = res.text.replace(/^```(?:json)?\s*/i, "").replace(/\s*```\s*$/, "").trim();
|
|
80756
|
+
const match = raw.match(/\{[\s\S]*\}/);
|
|
80757
|
+
if (!match)
|
|
80758
|
+
return false;
|
|
80759
|
+
const parsed = JSON.parse(match[0]);
|
|
80760
|
+
return parsed.hasWebsite === true;
|
|
80761
|
+
} catch {
|
|
80762
|
+
return false;
|
|
80763
|
+
}
|
|
80764
|
+
}
|
|
80724
80765
|
async function searchAndSaveLeads(args) {
|
|
80725
80766
|
const db2 = (0, db_1.getDb)();
|
|
80726
80767
|
const results = await (0, places_1.searchPlaces)({
|
|
@@ -80732,10 +80773,20 @@ var require_lead_search = __commonJS({
|
|
|
80732
80773
|
radiusMeters: args.radiusMeters
|
|
80733
80774
|
});
|
|
80734
80775
|
let saved = 0;
|
|
80776
|
+
let verifiedOut = 0;
|
|
80735
80777
|
for (const r of results) {
|
|
80736
80778
|
const before = db2.all("SELECT id FROM leads WHERE place_id = ?", [r.place_id]);
|
|
80737
80779
|
if (before.length > 0)
|
|
80738
80780
|
continue;
|
|
80781
|
+
if (args.verifyNoWebsite) {
|
|
80782
|
+
args.onProgress?.(`Checking ${r.name} has no website\u2026`);
|
|
80783
|
+
const real = await hasRealWebsite({ name: r.name, address: r.address, city: args.city }, args.anthropicKey);
|
|
80784
|
+
if (real) {
|
|
80785
|
+
verifiedOut++;
|
|
80786
|
+
args.onProgress?.(`${r.name} already has a website \u2014 skipping.`);
|
|
80787
|
+
continue;
|
|
80788
|
+
}
|
|
80789
|
+
}
|
|
80739
80790
|
db2.run(`INSERT INTO leads
|
|
80740
80791
|
(place_id, name, type, city, address, phone, website, rating, review_count, lat, lng, score, price_level, business_status, status)
|
|
80741
80792
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'discovered')`, [
|
|
@@ -80756,7 +80807,7 @@ var require_lead_search = __commonJS({
|
|
|
80756
80807
|
]);
|
|
80757
80808
|
saved++;
|
|
80758
80809
|
}
|
|
80759
|
-
return { found: results.length, saved };
|
|
80810
|
+
return { found: results.length, saved, verifiedOut };
|
|
80760
80811
|
}
|
|
80761
80812
|
}
|
|
80762
80813
|
});
|
|
@@ -80767,7 +80818,7 @@ var require_chat_tools = __commonJS({
|
|
|
80767
80818
|
"use strict";
|
|
80768
80819
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
80769
80820
|
exports2.TOOLS = void 0;
|
|
80770
|
-
exports2.runTool =
|
|
80821
|
+
exports2.runTool = runTool2;
|
|
80771
80822
|
var db_1 = require_db();
|
|
80772
80823
|
var runtime_1 = require_runtime();
|
|
80773
80824
|
var builder_1 = require_builder();
|
|
@@ -81067,7 +81118,7 @@ Interested?`;
|
|
|
81067
81118
|
}
|
|
81068
81119
|
return `sms:${e164}?&body=${encodeURIComponent(message)}`;
|
|
81069
81120
|
}
|
|
81070
|
-
async function
|
|
81121
|
+
async function runTool2(name, input, ctx) {
|
|
81071
81122
|
const db2 = (0, db_1.getDb)();
|
|
81072
81123
|
switch (name) {
|
|
81073
81124
|
case "find_leads": {
|
|
@@ -81095,7 +81146,12 @@ Interested?`;
|
|
|
81095
81146
|
types: categories,
|
|
81096
81147
|
maxResults: Math.min(Number(input.maxResults ?? 25), 100),
|
|
81097
81148
|
center: place ? { lat: place.lat, lng: place.lng } : void 0,
|
|
81098
|
-
radiusMeters: Number(input.radiusMeters ?? 3e3)
|
|
81149
|
+
radiusMeters: Number(input.radiusMeters ?? 3e3),
|
|
81150
|
+
// Web-search each candidate to confirm no real website exists before
|
|
81151
|
+
// saving. Skippable via verify:false. Fails open on any error.
|
|
81152
|
+
verifyNoWebsite: input.verify !== false,
|
|
81153
|
+
anthropicKey: getDecryptedSetting("anthropic_key"),
|
|
81154
|
+
onProgress: (msg) => ctx.emitProgress?.({ channel: "leads:searching", payload: { msg } })
|
|
81099
81155
|
});
|
|
81100
81156
|
ctx.emitProgress?.({
|
|
81101
81157
|
channel: "leads:changed",
|
|
@@ -82264,7 +82320,7 @@ var require_package = __commonJS({
|
|
|
82264
82320
|
"package.json"(exports2, module2) {
|
|
82265
82321
|
module2.exports = {
|
|
82266
82322
|
name: "sproutkit-code",
|
|
82267
|
-
version: "0.
|
|
82323
|
+
version: "0.4.0",
|
|
82268
82324
|
description: "Sproutkit in your terminal \u2014 find leads, build sites, run outreach, all via chat.",
|
|
82269
82325
|
bin: {
|
|
82270
82326
|
sproutkit: "./dist/index.js"
|
|
@@ -82306,6 +82362,7 @@ var require_package = __commonJS({
|
|
|
82306
82362
|
// src/engine.ts
|
|
82307
82363
|
var db = require_db();
|
|
82308
82364
|
var chat = require_chat();
|
|
82365
|
+
var chatTools = require_chat_tools();
|
|
82309
82366
|
var autoMode = require_auto_mode();
|
|
82310
82367
|
var cms = require_cms_provision();
|
|
82311
82368
|
var bookingPreset = require_booking_preset();
|
|
@@ -82315,6 +82372,7 @@ var llm = require_llm();
|
|
|
82315
82372
|
var initDatabase = db.initDatabase;
|
|
82316
82373
|
var getDb = db.getDb;
|
|
82317
82374
|
var chatWithTools = chat.chatWithTools;
|
|
82375
|
+
var runTool = chatTools.runTool;
|
|
82318
82376
|
var startAutoJob = autoMode.startAutoJob;
|
|
82319
82377
|
var provisionCmsForLead = cms.provisionCmsForLead;
|
|
82320
82378
|
var generatePreset = bookingPreset.generatePreset;
|
|
@@ -82519,6 +82577,44 @@ var Status = class {
|
|
|
82519
82577
|
}
|
|
82520
82578
|
};
|
|
82521
82579
|
|
|
82580
|
+
// src/skill-install.ts
|
|
82581
|
+
var import_fs = __toESM(require("fs"));
|
|
82582
|
+
var import_path = __toESM(require("path"));
|
|
82583
|
+
var import_os2 = __toESM(require("os"));
|
|
82584
|
+
function bundledSkillDir() {
|
|
82585
|
+
const candidates = [
|
|
82586
|
+
import_path.default.join(__dirname, "skill"),
|
|
82587
|
+
import_path.default.join(__dirname, "..", "dist", "skill"),
|
|
82588
|
+
import_path.default.join(__dirname, "..", "skill")
|
|
82589
|
+
];
|
|
82590
|
+
for (const c2 of candidates) {
|
|
82591
|
+
if (import_fs.default.existsSync(import_path.default.join(c2, "SKILL.md"))) return c2;
|
|
82592
|
+
}
|
|
82593
|
+
return candidates[0];
|
|
82594
|
+
}
|
|
82595
|
+
function skillTargetDir() {
|
|
82596
|
+
return import_path.default.join(import_os2.default.homedir(), ".claude", "skills", "sproutkit");
|
|
82597
|
+
}
|
|
82598
|
+
function skillInstalled() {
|
|
82599
|
+
return import_fs.default.existsSync(import_path.default.join(skillTargetDir(), "SKILL.md"));
|
|
82600
|
+
}
|
|
82601
|
+
function installSkill() {
|
|
82602
|
+
try {
|
|
82603
|
+
const src = bundledSkillDir();
|
|
82604
|
+
if (!import_fs.default.existsSync(import_path.default.join(src, "SKILL.md"))) {
|
|
82605
|
+
return { ok: false, error: `Skill source not found (looked in ${src}).` };
|
|
82606
|
+
}
|
|
82607
|
+
const dest = skillTargetDir();
|
|
82608
|
+
import_fs.default.mkdirSync(dest, { recursive: true });
|
|
82609
|
+
for (const f of import_fs.default.readdirSync(src)) {
|
|
82610
|
+
import_fs.default.copyFileSync(import_path.default.join(src, f), import_path.default.join(dest, f));
|
|
82611
|
+
}
|
|
82612
|
+
return { ok: true, path: dest };
|
|
82613
|
+
} catch (e) {
|
|
82614
|
+
return { ok: false, error: e.message };
|
|
82615
|
+
}
|
|
82616
|
+
}
|
|
82617
|
+
|
|
82522
82618
|
// src/onboarding.ts
|
|
82523
82619
|
var import_child_process = require("child_process");
|
|
82524
82620
|
function claudeCliPresent() {
|
|
@@ -82571,8 +82667,35 @@ async function chooseBackend(force) {
|
|
|
82571
82667
|
setBackend("claude_code");
|
|
82572
82668
|
say(c.green(" \u2713 Using your Claude subscription \u2014 no API key needed for generation."));
|
|
82573
82669
|
say();
|
|
82670
|
+
await offerSkillInstall(force);
|
|
82574
82671
|
return "claude_code";
|
|
82575
82672
|
}
|
|
82673
|
+
async function offerSkillInstall(force) {
|
|
82674
|
+
const already = skillInstalled();
|
|
82675
|
+
say(` ${c.bold("Conversational mode (optional)")}`);
|
|
82676
|
+
say(
|
|
82677
|
+
c.dim(
|
|
82678
|
+
" Install a Claude Code skill so you can just talk to `claude` \u2014 \u201Cfind barbers"
|
|
82679
|
+
)
|
|
82680
|
+
);
|
|
82681
|
+
say(c.dim(" in Leeds and build the best two\u201D \u2014 and it drives Sproutkit for you."));
|
|
82682
|
+
const prompt = already ? c.green(" Skill already installed \u2014 reinstall/update it? [y/N] ") : c.green(" Install it now? [Y/n] ");
|
|
82683
|
+
const ans = (await ask(prompt)).trim().toLowerCase();
|
|
82684
|
+
const wants = already ? ans === "y" || ans === "yes" : ans !== "n" && ans !== "no";
|
|
82685
|
+
if (!wants) {
|
|
82686
|
+
say(c.dim(" Skipped \u2014 you can add it later by re-running 'sproutkit setup'."));
|
|
82687
|
+
say();
|
|
82688
|
+
return;
|
|
82689
|
+
}
|
|
82690
|
+
const res = installSkill();
|
|
82691
|
+
if (res.ok) {
|
|
82692
|
+
say(c.green(` \u2713 Skill installed to ${res.path}`));
|
|
82693
|
+
say(c.dim(" Now run `claude` in any terminal and ask it to find or build leads."));
|
|
82694
|
+
} else {
|
|
82695
|
+
say(c.amber(` Couldn't install the skill: ${res.error}`));
|
|
82696
|
+
}
|
|
82697
|
+
say();
|
|
82698
|
+
}
|
|
82576
82699
|
async function onboardLicense(force) {
|
|
82577
82700
|
if (!force) {
|
|
82578
82701
|
const state = await check();
|
|
@@ -82735,9 +82858,9 @@ function makeInvokeIpc(emit) {
|
|
|
82735
82858
|
}
|
|
82736
82859
|
|
|
82737
82860
|
// src/sync.ts
|
|
82738
|
-
var
|
|
82739
|
-
var
|
|
82740
|
-
var
|
|
82861
|
+
var import_os3 = __toESM(require("os"));
|
|
82862
|
+
var import_path2 = __toESM(require("path"));
|
|
82863
|
+
var import_fs2 = __toESM(require("fs"));
|
|
82741
82864
|
var COLS = [
|
|
82742
82865
|
"place_id",
|
|
82743
82866
|
"name",
|
|
@@ -82760,18 +82883,18 @@ var COLS = [
|
|
|
82760
82883
|
"business_status"
|
|
82761
82884
|
];
|
|
82762
82885
|
function desktopDbPath() {
|
|
82763
|
-
const home =
|
|
82886
|
+
const home = import_os3.default.homedir();
|
|
82764
82887
|
const candidates = [];
|
|
82765
82888
|
if (process.platform === "darwin") {
|
|
82766
|
-
candidates.push(
|
|
82889
|
+
candidates.push(import_path2.default.join(home, "Library", "Application Support", "Sproutkit", "data", "sproutio.db"));
|
|
82767
82890
|
} else if (process.platform === "win32") {
|
|
82768
|
-
const appData = process.env.APPDATA ||
|
|
82769
|
-
candidates.push(
|
|
82891
|
+
const appData = process.env.APPDATA || import_path2.default.join(home, "AppData", "Roaming");
|
|
82892
|
+
candidates.push(import_path2.default.join(appData, "Sproutkit", "data", "sproutio.db"));
|
|
82770
82893
|
} else {
|
|
82771
|
-
const cfg = process.env.XDG_CONFIG_HOME ||
|
|
82772
|
-
candidates.push(
|
|
82894
|
+
const cfg = process.env.XDG_CONFIG_HOME || import_path2.default.join(home, ".config");
|
|
82895
|
+
candidates.push(import_path2.default.join(cfg, "Sproutkit", "data", "sproutio.db"));
|
|
82773
82896
|
}
|
|
82774
|
-
return candidates.find((p) =>
|
|
82897
|
+
return candidates.find((p) => import_fs2.default.existsSync(p)) ?? null;
|
|
82775
82898
|
}
|
|
82776
82899
|
function syncToDesktop(opts = {}) {
|
|
82777
82900
|
const dest = desktopDbPath();
|
|
@@ -83085,6 +83208,169 @@ async function runModels() {
|
|
|
83085
83208
|
say(c.green(` \u2713 Now using ${models2[idx].display_name ?? models2[idx].id}.`));
|
|
83086
83209
|
}
|
|
83087
83210
|
|
|
83211
|
+
// src/commands.ts
|
|
83212
|
+
function makeCtx(opts) {
|
|
83213
|
+
const emit = (channel, payload) => {
|
|
83214
|
+
if (opts.json) return;
|
|
83215
|
+
const p = payload;
|
|
83216
|
+
if (p?.msg && opts.status) opts.status.update(p.msg);
|
|
83217
|
+
};
|
|
83218
|
+
return {
|
|
83219
|
+
invokeIpc: makeInvokeIpc(emit),
|
|
83220
|
+
emitProgress: (e) => emit(e.channel, e.payload)
|
|
83221
|
+
};
|
|
83222
|
+
}
|
|
83223
|
+
function parseArgs(argv) {
|
|
83224
|
+
const flags = {};
|
|
83225
|
+
const rest = [];
|
|
83226
|
+
for (let i = 0; i < argv.length; i++) {
|
|
83227
|
+
const a = argv[i];
|
|
83228
|
+
if (a.startsWith("--")) {
|
|
83229
|
+
const body = a.slice(2);
|
|
83230
|
+
const eq = body.indexOf("=");
|
|
83231
|
+
if (eq >= 0) {
|
|
83232
|
+
flags[body.slice(0, eq)] = body.slice(eq + 1);
|
|
83233
|
+
} else if (i + 1 < argv.length && !argv[i + 1].startsWith("--")) {
|
|
83234
|
+
flags[body] = argv[++i];
|
|
83235
|
+
} else {
|
|
83236
|
+
flags[body] = true;
|
|
83237
|
+
}
|
|
83238
|
+
} else {
|
|
83239
|
+
rest.push(a);
|
|
83240
|
+
}
|
|
83241
|
+
}
|
|
83242
|
+
return { flags, rest };
|
|
83243
|
+
}
|
|
83244
|
+
function emitJson(v) {
|
|
83245
|
+
process.stdout.write(JSON.stringify(v, null, 2) + "\n");
|
|
83246
|
+
}
|
|
83247
|
+
async function cmdFind(argv) {
|
|
83248
|
+
const { flags, rest } = parseArgs(argv);
|
|
83249
|
+
const json = !!flags.json;
|
|
83250
|
+
const location = String(flags.location ?? rest.join(" ")).trim();
|
|
83251
|
+
if (!location) {
|
|
83252
|
+
const err = 'Usage: sproutkit find "<location>" --categories "barber shop,cafe"';
|
|
83253
|
+
json ? emitJson({ ok: false, error: err }) : say(c.red(" " + err));
|
|
83254
|
+
return;
|
|
83255
|
+
}
|
|
83256
|
+
const categories = String(flags.categories ?? "").split(",").map((s) => s.trim()).filter(Boolean);
|
|
83257
|
+
const status = json ? void 0 : new Status();
|
|
83258
|
+
if (status) status.start(`Finding leads in ${location}`);
|
|
83259
|
+
try {
|
|
83260
|
+
const result = await runTool(
|
|
83261
|
+
"find_leads",
|
|
83262
|
+
{
|
|
83263
|
+
location,
|
|
83264
|
+
categories: categories.length ? categories : [location],
|
|
83265
|
+
maxResults: flags.max ? Number(flags.max) : void 0,
|
|
83266
|
+
radiusMeters: flags.radius ? Number(flags.radius) : void 0
|
|
83267
|
+
},
|
|
83268
|
+
makeCtx({ json, status })
|
|
83269
|
+
);
|
|
83270
|
+
if (status) status.done(true, `Found ${result.found ?? 0}, saved ${result.saved ?? 0} new`);
|
|
83271
|
+
autoSync();
|
|
83272
|
+
if (json) emitJson(result);
|
|
83273
|
+
else if (result.note) say(c.dim(" " + result.note));
|
|
83274
|
+
} catch (e) {
|
|
83275
|
+
if (status) status.done(false, "Find failed");
|
|
83276
|
+
json ? emitJson({ ok: false, error: e.message }) : say(c.red(" " + e.message));
|
|
83277
|
+
process.exitCode = 1;
|
|
83278
|
+
}
|
|
83279
|
+
}
|
|
83280
|
+
async function cmdList(argv) {
|
|
83281
|
+
const { flags } = parseArgs(argv);
|
|
83282
|
+
const json = !!flags.json;
|
|
83283
|
+
const rows = await runTool(
|
|
83284
|
+
"list_leads",
|
|
83285
|
+
{
|
|
83286
|
+
status: flags.status ? String(flags.status) : void 0,
|
|
83287
|
+
city: flags.city ? String(flags.city) : void 0,
|
|
83288
|
+
limit: flags.limit ? Number(flags.limit) : void 0
|
|
83289
|
+
},
|
|
83290
|
+
makeCtx({ json })
|
|
83291
|
+
);
|
|
83292
|
+
if (json) {
|
|
83293
|
+
emitJson(rows);
|
|
83294
|
+
return;
|
|
83295
|
+
}
|
|
83296
|
+
if (rows.length === 0) {
|
|
83297
|
+
say(c.dim(' No leads yet. Try: sproutkit find "barbers in <area>"'));
|
|
83298
|
+
return;
|
|
83299
|
+
}
|
|
83300
|
+
say();
|
|
83301
|
+
for (const r of rows) {
|
|
83302
|
+
const site = r.site_url ? c.dim(` ${r.site_url}`) : "";
|
|
83303
|
+
say(` ${c.greenBold("#" + r.id)} ${c.bold(r.name)} ${c.dim(`\xB7 ${r.status} \xB7 ${r.type}, ${r.city}`)}${site}`);
|
|
83304
|
+
}
|
|
83305
|
+
say();
|
|
83306
|
+
}
|
|
83307
|
+
async function cmdBuild(argv) {
|
|
83308
|
+
const { flags, rest } = parseArgs(argv);
|
|
83309
|
+
const json = !!flags.json;
|
|
83310
|
+
const id = Number(flags.id ?? rest[0]);
|
|
83311
|
+
if (!id || Number.isNaN(id)) {
|
|
83312
|
+
const err = 'Usage: sproutkit build <leadId> [--instructions "..."] [--cms]';
|
|
83313
|
+
json ? emitJson({ ok: false, error: err }) : say(c.red(" " + err));
|
|
83314
|
+
process.exitCode = 1;
|
|
83315
|
+
return;
|
|
83316
|
+
}
|
|
83317
|
+
const status = json ? void 0 : new Status();
|
|
83318
|
+
if (status) status.start(`Building website for lead #${id}`);
|
|
83319
|
+
try {
|
|
83320
|
+
const result = await runTool(
|
|
83321
|
+
"build_site",
|
|
83322
|
+
{
|
|
83323
|
+
id,
|
|
83324
|
+
instructions: flags.instructions ? String(flags.instructions) : void 0,
|
|
83325
|
+
includeCms: !!flags.cms
|
|
83326
|
+
},
|
|
83327
|
+
makeCtx({ json, status })
|
|
83328
|
+
);
|
|
83329
|
+
if (result && result.ok === false) {
|
|
83330
|
+
if (status) status.done(false, result.error ?? "Build failed");
|
|
83331
|
+
if (json) emitJson(result);
|
|
83332
|
+
process.exitCode = 1;
|
|
83333
|
+
return;
|
|
83334
|
+
}
|
|
83335
|
+
if (status) status.done(true, result.url ? `Live at ${result.url}` : `Built lead #${id}`);
|
|
83336
|
+
autoSync();
|
|
83337
|
+
if (json) emitJson(result);
|
|
83338
|
+
} catch (e) {
|
|
83339
|
+
if (status) status.done(false, "Build failed");
|
|
83340
|
+
json ? emitJson({ ok: false, error: e.message }) : say(c.red(" " + e.message));
|
|
83341
|
+
process.exitCode = 1;
|
|
83342
|
+
}
|
|
83343
|
+
}
|
|
83344
|
+
async function cmdOutreach(argv) {
|
|
83345
|
+
const { flags } = parseArgs(argv);
|
|
83346
|
+
const json = !!flags.json;
|
|
83347
|
+
const ids = String(flags.ids ?? "").split(",").map((s) => Number(s.trim())).filter((n) => !Number.isNaN(n) && n > 0);
|
|
83348
|
+
const result = await runTool(
|
|
83349
|
+
"prepare_outreach",
|
|
83350
|
+
{ ids: ids.length ? ids : void 0 },
|
|
83351
|
+
makeCtx({ json })
|
|
83352
|
+
);
|
|
83353
|
+
if (json) {
|
|
83354
|
+
emitJson(result);
|
|
83355
|
+
if (!result.ok) process.exitCode = 1;
|
|
83356
|
+
return;
|
|
83357
|
+
}
|
|
83358
|
+
if (!result.ok) {
|
|
83359
|
+
say(c.red(" " + (result.error ?? "Nothing to send.")));
|
|
83360
|
+
process.exitCode = 1;
|
|
83361
|
+
return;
|
|
83362
|
+
}
|
|
83363
|
+
autoSync();
|
|
83364
|
+
say();
|
|
83365
|
+
say(c.green(` ${result.count} lead${result.count === 1 ? "" : "s"} moved to Contacted (${result.channel}).`));
|
|
83366
|
+
for (const o of result.outreach ?? []) {
|
|
83367
|
+
if (o.url) say(` ${c.greenBold("#" + o.id)} ${c.bold(o.name)} \u2014 open: ${c.dim(o.url)}`);
|
|
83368
|
+
else say(` ${c.greenBold("#" + o.id)} ${c.bold(o.name)} \u2014 ${c.amber("no phone on file")}`);
|
|
83369
|
+
}
|
|
83370
|
+
if (result.noPhone) say(c.dim(` ${result.noPhone} had no phone number and were skipped for messaging.`));
|
|
83371
|
+
say();
|
|
83372
|
+
}
|
|
83373
|
+
|
|
83088
83374
|
// src/index.ts
|
|
83089
83375
|
process.env.SPROUTKIT_HEADLESS = "1";
|
|
83090
83376
|
async function main() {
|
|
@@ -83119,19 +83405,42 @@ async function main() {
|
|
|
83119
83405
|
closeTty();
|
|
83120
83406
|
return;
|
|
83121
83407
|
}
|
|
83408
|
+
if (arg === "find" || arg === "list" || arg === "build" || arg === "outreach") {
|
|
83409
|
+
const subArgs = process.argv.slice(3);
|
|
83410
|
+
const lic2 = await check();
|
|
83411
|
+
if (lic2.status !== "active") {
|
|
83412
|
+
const msg = lic2.status === "offline_grace_expired" ? "Licence check offline and grace expired \u2014 reconnect and retry." : "No active licence. Run 'sproutkit setup' first.";
|
|
83413
|
+
if (subArgs.includes("--json")) process.stdout.write(JSON.stringify({ ok: false, error: msg }) + "\n");
|
|
83414
|
+
else say(c.red(` ${msg}`));
|
|
83415
|
+
closeTty();
|
|
83416
|
+
process.exitCode = 1;
|
|
83417
|
+
return;
|
|
83418
|
+
}
|
|
83419
|
+
if (arg === "find") await cmdFind(subArgs);
|
|
83420
|
+
else if (arg === "list") await cmdList(subArgs);
|
|
83421
|
+
else if (arg === "build") await cmdBuild(subArgs);
|
|
83422
|
+
else await cmdOutreach(subArgs);
|
|
83423
|
+
closeTty();
|
|
83424
|
+
return;
|
|
83425
|
+
}
|
|
83122
83426
|
if (arg === "--help" || arg === "-h") {
|
|
83123
83427
|
say();
|
|
83124
83428
|
say(c.greenBold(" Sproutkit Code"));
|
|
83125
83429
|
say(" Find leads, build sites and run outreach from your terminal.");
|
|
83126
83430
|
say();
|
|
83127
|
-
say(` ${c.bold("sproutkit")}
|
|
83128
|
-
say(` ${c.bold(
|
|
83129
|
-
say(` ${c.bold("sproutkit
|
|
83130
|
-
say(` ${c.bold("sproutkit
|
|
83131
|
-
say(` ${c.bold("sproutkit
|
|
83132
|
-
say(` ${c.bold("sproutkit
|
|
83133
|
-
say(` ${c.bold(
|
|
83431
|
+
say(` ${c.bold("sproutkit")} start the chat`);
|
|
83432
|
+
say(` ${c.bold('sproutkit find "<area>"')} find leads (--categories "barber shop,cafe")`);
|
|
83433
|
+
say(` ${c.bold("sproutkit list")} list leads (--status, --city, --json)`);
|
|
83434
|
+
say(` ${c.bold("sproutkit build <id>")} build a website (--instructions, --cms)`);
|
|
83435
|
+
say(` ${c.bold("sproutkit outreach")} prep outreach links (--ids 3,5)`);
|
|
83436
|
+
say(` ${c.bold("sproutkit setup")} set or update keys, licence, backend`);
|
|
83437
|
+
say(` ${c.bold("sproutkit models")} list Claude models and pick one`);
|
|
83438
|
+
say(` ${c.bold("sproutkit sync")} push your leads into the desktop app`);
|
|
83439
|
+
say(` ${c.bold("sproutkit update")} update to the latest version`);
|
|
83440
|
+
say(` ${c.bold("sproutkit version")} show the installed version`);
|
|
83441
|
+
say(` ${c.bold('sproutkit "..."')} run a single message and exit`);
|
|
83134
83442
|
say();
|
|
83443
|
+
say(c.dim(" Add --json to find/list/build/outreach for machine-readable output."));
|
|
83135
83444
|
say(c.dim(" In chat: type a request, Ctrl+C to quit. Actions that spend money ask y/N first."));
|
|
83136
83445
|
say();
|
|
83137
83446
|
closeTty();
|