@polka-codes/runner 0.9.39 → 0.9.40
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 +561 -635
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
31
31
|
var require_package = __commonJS((exports, module) => {
|
|
32
32
|
module.exports = {
|
|
33
33
|
name: "dotenv",
|
|
34
|
-
version: "17.2.
|
|
34
|
+
version: "17.2.3",
|
|
35
35
|
description: "Loads environment variables from .env file",
|
|
36
36
|
main: "lib/main.js",
|
|
37
37
|
types: "lib/main.d.ts",
|
|
@@ -53,8 +53,8 @@ var require_package = __commonJS((exports, module) => {
|
|
|
53
53
|
"dts-check": "tsc --project tests/types/tsconfig.json",
|
|
54
54
|
lint: "standard",
|
|
55
55
|
pretest: "npm run lint && npm run dts-check",
|
|
56
|
-
test: "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
|
|
57
|
-
"test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
|
|
56
|
+
test: "tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000",
|
|
57
|
+
"test:coverage": "tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
|
|
58
58
|
prerelease: "npm test",
|
|
59
59
|
release: "standard-version"
|
|
60
60
|
},
|
|
@@ -105,9 +105,12 @@ var require_main = __commonJS((exports, module) => {
|
|
|
105
105
|
"\uD83D\uDD10 encrypt with Dotenvx: https://dotenvx.com",
|
|
106
106
|
"\uD83D\uDD10 prevent committing .env to code: https://dotenvx.com/precommit",
|
|
107
107
|
"\uD83D\uDD10 prevent building .env in docker: https://dotenvx.com/prebuild",
|
|
108
|
-
"\uD83D\uDCE1
|
|
109
|
-
"\uD83D\
|
|
110
|
-
"\uD83D\
|
|
108
|
+
"\uD83D\uDCE1 add observability to secrets: https://dotenvx.com/ops",
|
|
109
|
+
"\uD83D\uDC65 sync secrets across teammates & machines: https://dotenvx.com/ops",
|
|
110
|
+
"\uD83D\uDDC2️ backup and recover secrets: https://dotenvx.com/ops",
|
|
111
|
+
"✅ audit secrets and track compliance: https://dotenvx.com/ops",
|
|
112
|
+
"\uD83D\uDD04 add secrets lifecycle management: https://dotenvx.com/ops",
|
|
113
|
+
"\uD83D\uDD11 add access controls to secrets: https://dotenvx.com/ops",
|
|
111
114
|
"\uD83D\uDEE0️ run anywhere with `dotenvx run -- yourcommand`",
|
|
112
115
|
"⚙️ specify custom .env file path with { path: '/custom/path/.env' }",
|
|
113
116
|
"⚙️ enable debug logging with { debug: true }",
|
|
@@ -7508,7 +7511,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
7508
7511
|
}
|
|
7509
7512
|
return func(collection, getIteratee(predicate, 3));
|
|
7510
7513
|
}
|
|
7511
|
-
function
|
|
7514
|
+
function filter3(collection, predicate) {
|
|
7512
7515
|
var func = isArray(collection) ? arrayFilter : baseFilter;
|
|
7513
7516
|
return func(collection, getIteratee(predicate, 3));
|
|
7514
7517
|
}
|
|
@@ -8924,7 +8927,7 @@ __p += '`;
|
|
|
8924
8927
|
lodash.dropRightWhile = dropRightWhile;
|
|
8925
8928
|
lodash.dropWhile = dropWhile;
|
|
8926
8929
|
lodash.fill = fill;
|
|
8927
|
-
lodash.filter =
|
|
8930
|
+
lodash.filter = filter3;
|
|
8928
8931
|
lodash.flatMap = flatMap;
|
|
8929
8932
|
lodash.flatMapDeep = flatMapDeep;
|
|
8930
8933
|
lodash.flatMapDepth = flatMapDepth;
|
|
@@ -17800,124 +17803,6 @@ var require_lib = __commonJS((exports, module) => {
|
|
|
17800
17803
|
module.exports = MuteStream;
|
|
17801
17804
|
});
|
|
17802
17805
|
|
|
17803
|
-
// ../../node_modules/ansi-escapes/index.js
|
|
17804
|
-
var require_ansi_escapes = __commonJS((exports, module) => {
|
|
17805
|
-
var ansiEscapes = exports;
|
|
17806
|
-
exports.default = ansiEscapes;
|
|
17807
|
-
var ESC = "\x1B[";
|
|
17808
|
-
var OSC = "\x1B]";
|
|
17809
|
-
var BEL = "\x07";
|
|
17810
|
-
var SEP = ";";
|
|
17811
|
-
var isTerminalApp = process.env.TERM_PROGRAM === "Apple_Terminal";
|
|
17812
|
-
ansiEscapes.cursorTo = (x, y) => {
|
|
17813
|
-
if (typeof x !== "number") {
|
|
17814
|
-
throw new TypeError("The `x` argument is required");
|
|
17815
|
-
}
|
|
17816
|
-
if (typeof y !== "number") {
|
|
17817
|
-
return ESC + (x + 1) + "G";
|
|
17818
|
-
}
|
|
17819
|
-
return ESC + (y + 1) + ";" + (x + 1) + "H";
|
|
17820
|
-
};
|
|
17821
|
-
ansiEscapes.cursorMove = (x, y) => {
|
|
17822
|
-
if (typeof x !== "number") {
|
|
17823
|
-
throw new TypeError("The `x` argument is required");
|
|
17824
|
-
}
|
|
17825
|
-
let ret = "";
|
|
17826
|
-
if (x < 0) {
|
|
17827
|
-
ret += ESC + -x + "D";
|
|
17828
|
-
} else if (x > 0) {
|
|
17829
|
-
ret += ESC + x + "C";
|
|
17830
|
-
}
|
|
17831
|
-
if (y < 0) {
|
|
17832
|
-
ret += ESC + -y + "A";
|
|
17833
|
-
} else if (y > 0) {
|
|
17834
|
-
ret += ESC + y + "B";
|
|
17835
|
-
}
|
|
17836
|
-
return ret;
|
|
17837
|
-
};
|
|
17838
|
-
ansiEscapes.cursorUp = (count = 1) => ESC + count + "A";
|
|
17839
|
-
ansiEscapes.cursorDown = (count = 1) => ESC + count + "B";
|
|
17840
|
-
ansiEscapes.cursorForward = (count = 1) => ESC + count + "C";
|
|
17841
|
-
ansiEscapes.cursorBackward = (count = 1) => ESC + count + "D";
|
|
17842
|
-
ansiEscapes.cursorLeft = ESC + "G";
|
|
17843
|
-
ansiEscapes.cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
|
|
17844
|
-
ansiEscapes.cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
|
|
17845
|
-
ansiEscapes.cursorGetPosition = ESC + "6n";
|
|
17846
|
-
ansiEscapes.cursorNextLine = ESC + "E";
|
|
17847
|
-
ansiEscapes.cursorPrevLine = ESC + "F";
|
|
17848
|
-
ansiEscapes.cursorHide = ESC + "?25l";
|
|
17849
|
-
ansiEscapes.cursorShow = ESC + "?25h";
|
|
17850
|
-
ansiEscapes.eraseLines = (count) => {
|
|
17851
|
-
let clear = "";
|
|
17852
|
-
for (let i = 0;i < count; i++) {
|
|
17853
|
-
clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : "");
|
|
17854
|
-
}
|
|
17855
|
-
if (count) {
|
|
17856
|
-
clear += ansiEscapes.cursorLeft;
|
|
17857
|
-
}
|
|
17858
|
-
return clear;
|
|
17859
|
-
};
|
|
17860
|
-
ansiEscapes.eraseEndLine = ESC + "K";
|
|
17861
|
-
ansiEscapes.eraseStartLine = ESC + "1K";
|
|
17862
|
-
ansiEscapes.eraseLine = ESC + "2K";
|
|
17863
|
-
ansiEscapes.eraseDown = ESC + "J";
|
|
17864
|
-
ansiEscapes.eraseUp = ESC + "1J";
|
|
17865
|
-
ansiEscapes.eraseScreen = ESC + "2J";
|
|
17866
|
-
ansiEscapes.scrollUp = ESC + "S";
|
|
17867
|
-
ansiEscapes.scrollDown = ESC + "T";
|
|
17868
|
-
ansiEscapes.clearScreen = "\x1Bc";
|
|
17869
|
-
ansiEscapes.clearTerminal = process.platform === "win32" ? `${ansiEscapes.eraseScreen}${ESC}0f` : `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`;
|
|
17870
|
-
ansiEscapes.beep = BEL;
|
|
17871
|
-
ansiEscapes.link = (text2, url2) => {
|
|
17872
|
-
return [
|
|
17873
|
-
OSC,
|
|
17874
|
-
"8",
|
|
17875
|
-
SEP,
|
|
17876
|
-
SEP,
|
|
17877
|
-
url2,
|
|
17878
|
-
BEL,
|
|
17879
|
-
text2,
|
|
17880
|
-
OSC,
|
|
17881
|
-
"8",
|
|
17882
|
-
SEP,
|
|
17883
|
-
SEP,
|
|
17884
|
-
BEL
|
|
17885
|
-
].join("");
|
|
17886
|
-
};
|
|
17887
|
-
ansiEscapes.image = (buffer, options = {}) => {
|
|
17888
|
-
let ret = `${OSC}1337;File=inline=1`;
|
|
17889
|
-
if (options.width) {
|
|
17890
|
-
ret += `;width=${options.width}`;
|
|
17891
|
-
}
|
|
17892
|
-
if (options.height) {
|
|
17893
|
-
ret += `;height=${options.height}`;
|
|
17894
|
-
}
|
|
17895
|
-
if (options.preserveAspectRatio === false) {
|
|
17896
|
-
ret += ";preserveAspectRatio=0";
|
|
17897
|
-
}
|
|
17898
|
-
return ret + ":" + buffer.toString("base64") + BEL;
|
|
17899
|
-
};
|
|
17900
|
-
ansiEscapes.iTerm = {
|
|
17901
|
-
setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
|
|
17902
|
-
annotation: (message, options = {}) => {
|
|
17903
|
-
let ret = `${OSC}1337;`;
|
|
17904
|
-
const hasX = typeof options.x !== "undefined";
|
|
17905
|
-
const hasY = typeof options.y !== "undefined";
|
|
17906
|
-
if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== "undefined")) {
|
|
17907
|
-
throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");
|
|
17908
|
-
}
|
|
17909
|
-
message = message.replace(/\|/g, "");
|
|
17910
|
-
ret += options.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
|
|
17911
|
-
if (options.length > 0) {
|
|
17912
|
-
ret += (hasX ? [message, options.length, options.x, options.y] : [options.length, message]).join("|");
|
|
17913
|
-
} else {
|
|
17914
|
-
ret += message;
|
|
17915
|
-
}
|
|
17916
|
-
return ret + BEL;
|
|
17917
|
-
}
|
|
17918
|
-
};
|
|
17919
|
-
});
|
|
17920
|
-
|
|
17921
17806
|
// ../../node_modules/ignore/index.js
|
|
17922
17807
|
var require_ignore = __commonJS((exports, module) => {
|
|
17923
17808
|
function makeArray(subject) {
|
|
@@ -29926,7 +29811,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
29926
29811
|
if (websocket._socket[kWebSocket] === undefined)
|
|
29927
29812
|
return;
|
|
29928
29813
|
websocket._socket.removeListener("data", socketOnData);
|
|
29929
|
-
process.nextTick(
|
|
29814
|
+
process.nextTick(resume, websocket._socket);
|
|
29930
29815
|
if (code === 1005)
|
|
29931
29816
|
websocket.close();
|
|
29932
29817
|
else
|
|
@@ -29941,7 +29826,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
29941
29826
|
const websocket = this[kWebSocket];
|
|
29942
29827
|
if (websocket._socket[kWebSocket] !== undefined) {
|
|
29943
29828
|
websocket._socket.removeListener("data", socketOnData);
|
|
29944
|
-
process.nextTick(
|
|
29829
|
+
process.nextTick(resume, websocket._socket);
|
|
29945
29830
|
websocket.close(err[kStatusCode]);
|
|
29946
29831
|
}
|
|
29947
29832
|
if (!websocket._errorEmitted) {
|
|
@@ -29964,7 +29849,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
29964
29849
|
function receiverOnPong(data) {
|
|
29965
29850
|
this[kWebSocket].emit("pong", data);
|
|
29966
29851
|
}
|
|
29967
|
-
function
|
|
29852
|
+
function resume(stream) {
|
|
29968
29853
|
stream.resume();
|
|
29969
29854
|
}
|
|
29970
29855
|
function senderOnError(err) {
|
|
@@ -30494,7 +30379,7 @@ var {
|
|
|
30494
30379
|
Help
|
|
30495
30380
|
} = import__.default;
|
|
30496
30381
|
// package.json
|
|
30497
|
-
var version = "0.9.
|
|
30382
|
+
var version = "0.9.40";
|
|
30498
30383
|
|
|
30499
30384
|
// src/runner.ts
|
|
30500
30385
|
import { execSync } from "node:child_process";
|
|
@@ -42428,16 +42313,18 @@ var toolInfo = {
|
|
|
42428
42313
|
{
|
|
42429
42314
|
description: "Single clarifying question (no options)",
|
|
42430
42315
|
input: {
|
|
42431
|
-
questions: { prompt: "What is the target deployment environment?" }
|
|
42316
|
+
questions: [{ prompt: "What is the target deployment environment?" }]
|
|
42432
42317
|
}
|
|
42433
42318
|
},
|
|
42434
42319
|
{
|
|
42435
42320
|
description: "Single question with multiple-choice options",
|
|
42436
42321
|
input: {
|
|
42437
|
-
questions:
|
|
42438
|
-
|
|
42439
|
-
|
|
42440
|
-
|
|
42322
|
+
questions: [
|
|
42323
|
+
{
|
|
42324
|
+
prompt: "Which frontend framework are you using?",
|
|
42325
|
+
options: ["React", "Angular", "Vue", "Svelte"]
|
|
42326
|
+
}
|
|
42327
|
+
]
|
|
42441
42328
|
}
|
|
42442
42329
|
},
|
|
42443
42330
|
{
|
|
@@ -42455,10 +42342,12 @@ var toolInfo = {
|
|
|
42455
42342
|
{
|
|
42456
42343
|
description: "Binary (yes/no) confirmation",
|
|
42457
42344
|
input: {
|
|
42458
|
-
questions:
|
|
42459
|
-
|
|
42460
|
-
|
|
42461
|
-
|
|
42345
|
+
questions: [
|
|
42346
|
+
{
|
|
42347
|
+
prompt: "Is it acceptable to refactor existing tests to improve performance?",
|
|
42348
|
+
options: ["Yes", "No"]
|
|
42349
|
+
}
|
|
42350
|
+
]
|
|
42462
42351
|
}
|
|
42463
42352
|
}
|
|
42464
42353
|
]
|
|
@@ -47880,13 +47769,7 @@ var optionalType = ZodOptional2.create;
|
|
|
47880
47769
|
var nullableType = ZodNullable2.create;
|
|
47881
47770
|
var preprocessType = ZodEffects.createWithPreprocess;
|
|
47882
47771
|
var pipelineType = ZodPipeline.create;
|
|
47883
|
-
// ../../node_modules/@ai-sdk/provider-utils/dist/index.mjs
|
|
47884
|
-
function combineHeaders(...headers) {
|
|
47885
|
-
return headers.reduce((combinedHeaders, currentHeaders) => ({
|
|
47886
|
-
...combinedHeaders,
|
|
47887
|
-
...currentHeaders != null ? currentHeaders : {}
|
|
47888
|
-
}), {});
|
|
47889
|
-
}
|
|
47772
|
+
// ../../node_modules/ai/node_modules/@ai-sdk/provider-utils/dist/index.mjs
|
|
47890
47773
|
async function delay(delayInMs, options) {
|
|
47891
47774
|
if (delayInMs == null) {
|
|
47892
47775
|
return Promise.resolve();
|
|
@@ -47915,9 +47798,6 @@ async function delay(delayInMs, options) {
|
|
|
47915
47798
|
function createAbortError() {
|
|
47916
47799
|
return new DOMException("Delay was aborted", "AbortError");
|
|
47917
47800
|
}
|
|
47918
|
-
function extractResponseHeaders(response) {
|
|
47919
|
-
return Object.fromEntries([...response.headers]);
|
|
47920
|
-
}
|
|
47921
47801
|
var createIdGenerator = ({
|
|
47922
47802
|
prefix,
|
|
47923
47803
|
size = 16,
|
|
@@ -47959,96 +47839,6 @@ function getErrorMessage2(error43) {
|
|
|
47959
47839
|
function isAbortError(error43) {
|
|
47960
47840
|
return (error43 instanceof Error || error43 instanceof DOMException) && (error43.name === "AbortError" || error43.name === "ResponseAborted" || error43.name === "TimeoutError");
|
|
47961
47841
|
}
|
|
47962
|
-
var FETCH_FAILED_ERROR_MESSAGES = ["fetch failed", "failed to fetch"];
|
|
47963
|
-
function handleFetchError({
|
|
47964
|
-
error: error43,
|
|
47965
|
-
url: url2,
|
|
47966
|
-
requestBodyValues
|
|
47967
|
-
}) {
|
|
47968
|
-
if (isAbortError(error43)) {
|
|
47969
|
-
return error43;
|
|
47970
|
-
}
|
|
47971
|
-
if (error43 instanceof TypeError && FETCH_FAILED_ERROR_MESSAGES.includes(error43.message.toLowerCase())) {
|
|
47972
|
-
const cause = error43.cause;
|
|
47973
|
-
if (cause != null) {
|
|
47974
|
-
return new APICallError({
|
|
47975
|
-
message: `Cannot connect to API: ${cause.message}`,
|
|
47976
|
-
cause,
|
|
47977
|
-
url: url2,
|
|
47978
|
-
requestBodyValues,
|
|
47979
|
-
isRetryable: true
|
|
47980
|
-
});
|
|
47981
|
-
}
|
|
47982
|
-
}
|
|
47983
|
-
return error43;
|
|
47984
|
-
}
|
|
47985
|
-
function removeUndefinedEntries(record2) {
|
|
47986
|
-
return Object.fromEntries(Object.entries(record2).filter(([_key, value]) => value != null));
|
|
47987
|
-
}
|
|
47988
|
-
var getOriginalFetch = () => globalThis.fetch;
|
|
47989
|
-
var getFromApi = async ({
|
|
47990
|
-
url: url2,
|
|
47991
|
-
headers = {},
|
|
47992
|
-
successfulResponseHandler,
|
|
47993
|
-
failedResponseHandler,
|
|
47994
|
-
abortSignal,
|
|
47995
|
-
fetch: fetch2 = getOriginalFetch()
|
|
47996
|
-
}) => {
|
|
47997
|
-
try {
|
|
47998
|
-
const response = await fetch2(url2, {
|
|
47999
|
-
method: "GET",
|
|
48000
|
-
headers: removeUndefinedEntries(headers),
|
|
48001
|
-
signal: abortSignal
|
|
48002
|
-
});
|
|
48003
|
-
const responseHeaders = extractResponseHeaders(response);
|
|
48004
|
-
if (!response.ok) {
|
|
48005
|
-
let errorInformation;
|
|
48006
|
-
try {
|
|
48007
|
-
errorInformation = await failedResponseHandler({
|
|
48008
|
-
response,
|
|
48009
|
-
url: url2,
|
|
48010
|
-
requestBodyValues: {}
|
|
48011
|
-
});
|
|
48012
|
-
} catch (error43) {
|
|
48013
|
-
if (isAbortError(error43) || APICallError.isInstance(error43)) {
|
|
48014
|
-
throw error43;
|
|
48015
|
-
}
|
|
48016
|
-
throw new APICallError({
|
|
48017
|
-
message: "Failed to process error response",
|
|
48018
|
-
cause: error43,
|
|
48019
|
-
statusCode: response.status,
|
|
48020
|
-
url: url2,
|
|
48021
|
-
responseHeaders,
|
|
48022
|
-
requestBodyValues: {}
|
|
48023
|
-
});
|
|
48024
|
-
}
|
|
48025
|
-
throw errorInformation.value;
|
|
48026
|
-
}
|
|
48027
|
-
try {
|
|
48028
|
-
return await successfulResponseHandler({
|
|
48029
|
-
response,
|
|
48030
|
-
url: url2,
|
|
48031
|
-
requestBodyValues: {}
|
|
48032
|
-
});
|
|
48033
|
-
} catch (error43) {
|
|
48034
|
-
if (error43 instanceof Error) {
|
|
48035
|
-
if (isAbortError(error43) || APICallError.isInstance(error43)) {
|
|
48036
|
-
throw error43;
|
|
48037
|
-
}
|
|
48038
|
-
}
|
|
48039
|
-
throw new APICallError({
|
|
48040
|
-
message: "Failed to process successful response",
|
|
48041
|
-
cause: error43,
|
|
48042
|
-
statusCode: response.status,
|
|
48043
|
-
url: url2,
|
|
48044
|
-
responseHeaders,
|
|
48045
|
-
requestBodyValues: {}
|
|
48046
|
-
});
|
|
48047
|
-
}
|
|
48048
|
-
} catch (error43) {
|
|
48049
|
-
throw handleFetchError({ error: error43, url: url2, requestBodyValues: {} });
|
|
48050
|
-
}
|
|
48051
|
-
};
|
|
48052
47842
|
function isUrlSupported({
|
|
48053
47843
|
mediaType,
|
|
48054
47844
|
url: url2,
|
|
@@ -48061,22 +47851,6 @@ function isUrlSupported({
|
|
|
48061
47851
|
return mediaType2 === "*" || mediaType2 === "*/*" ? { mediaTypePrefix: "", regexes: value } : { mediaTypePrefix: mediaType2.replace(/\*/, ""), regexes: value };
|
|
48062
47852
|
}).filter(({ mediaTypePrefix }) => mediaType.startsWith(mediaTypePrefix)).flatMap(({ regexes }) => regexes).some((pattern) => pattern.test(url2));
|
|
48063
47853
|
}
|
|
48064
|
-
function loadOptionalSetting({
|
|
48065
|
-
settingValue,
|
|
48066
|
-
environmentVariableName
|
|
48067
|
-
}) {
|
|
48068
|
-
if (typeof settingValue === "string") {
|
|
48069
|
-
return settingValue;
|
|
48070
|
-
}
|
|
48071
|
-
if (settingValue != null || typeof process === "undefined") {
|
|
48072
|
-
return;
|
|
48073
|
-
}
|
|
48074
|
-
settingValue = process.env[environmentVariableName];
|
|
48075
|
-
if (settingValue == null || typeof settingValue !== "string") {
|
|
48076
|
-
return;
|
|
48077
|
-
}
|
|
48078
|
-
return settingValue;
|
|
48079
|
-
}
|
|
48080
47854
|
var suspectProtoRx = /"__proto__"\s*:/;
|
|
48081
47855
|
var suspectConstructorRx = /"constructor"\s*:/;
|
|
48082
47856
|
function _parse2(text) {
|
|
@@ -48178,23 +47952,6 @@ async function safeValidateTypes({
|
|
|
48178
47952
|
};
|
|
48179
47953
|
}
|
|
48180
47954
|
}
|
|
48181
|
-
async function parseJSON({
|
|
48182
|
-
text,
|
|
48183
|
-
schema
|
|
48184
|
-
}) {
|
|
48185
|
-
try {
|
|
48186
|
-
const value = secureJsonParse(text);
|
|
48187
|
-
if (schema == null) {
|
|
48188
|
-
return value;
|
|
48189
|
-
}
|
|
48190
|
-
return validateTypes({ value, schema });
|
|
48191
|
-
} catch (error43) {
|
|
48192
|
-
if (JSONParseError.isInstance(error43) || TypeValidationError.isInstance(error43)) {
|
|
48193
|
-
throw error43;
|
|
48194
|
-
}
|
|
48195
|
-
throw new JSONParseError({ text, cause: error43 });
|
|
48196
|
-
}
|
|
48197
|
-
}
|
|
48198
47955
|
async function safeParseJSON({
|
|
48199
47956
|
text,
|
|
48200
47957
|
schema
|
|
@@ -48213,205 +47970,6 @@ async function safeParseJSON({
|
|
|
48213
47970
|
};
|
|
48214
47971
|
}
|
|
48215
47972
|
}
|
|
48216
|
-
function parseJsonEventStream({
|
|
48217
|
-
stream,
|
|
48218
|
-
schema
|
|
48219
|
-
}) {
|
|
48220
|
-
return stream.pipeThrough(new TextDecoderStream).pipeThrough(new EventSourceParserStream).pipeThrough(new TransformStream({
|
|
48221
|
-
async transform({ data }, controller) {
|
|
48222
|
-
if (data === "[DONE]") {
|
|
48223
|
-
return;
|
|
48224
|
-
}
|
|
48225
|
-
controller.enqueue(await safeParseJSON({ text: data, schema }));
|
|
48226
|
-
}
|
|
48227
|
-
}));
|
|
48228
|
-
}
|
|
48229
|
-
var getOriginalFetch2 = () => globalThis.fetch;
|
|
48230
|
-
var postJsonToApi = async ({
|
|
48231
|
-
url: url2,
|
|
48232
|
-
headers,
|
|
48233
|
-
body,
|
|
48234
|
-
failedResponseHandler,
|
|
48235
|
-
successfulResponseHandler,
|
|
48236
|
-
abortSignal,
|
|
48237
|
-
fetch: fetch2
|
|
48238
|
-
}) => postToApi({
|
|
48239
|
-
url: url2,
|
|
48240
|
-
headers: {
|
|
48241
|
-
"Content-Type": "application/json",
|
|
48242
|
-
...headers
|
|
48243
|
-
},
|
|
48244
|
-
body: {
|
|
48245
|
-
content: JSON.stringify(body),
|
|
48246
|
-
values: body
|
|
48247
|
-
},
|
|
48248
|
-
failedResponseHandler,
|
|
48249
|
-
successfulResponseHandler,
|
|
48250
|
-
abortSignal,
|
|
48251
|
-
fetch: fetch2
|
|
48252
|
-
});
|
|
48253
|
-
var postToApi = async ({
|
|
48254
|
-
url: url2,
|
|
48255
|
-
headers = {},
|
|
48256
|
-
body,
|
|
48257
|
-
successfulResponseHandler,
|
|
48258
|
-
failedResponseHandler,
|
|
48259
|
-
abortSignal,
|
|
48260
|
-
fetch: fetch2 = getOriginalFetch2()
|
|
48261
|
-
}) => {
|
|
48262
|
-
try {
|
|
48263
|
-
const response = await fetch2(url2, {
|
|
48264
|
-
method: "POST",
|
|
48265
|
-
headers: removeUndefinedEntries(headers),
|
|
48266
|
-
body: body.content,
|
|
48267
|
-
signal: abortSignal
|
|
48268
|
-
});
|
|
48269
|
-
const responseHeaders = extractResponseHeaders(response);
|
|
48270
|
-
if (!response.ok) {
|
|
48271
|
-
let errorInformation;
|
|
48272
|
-
try {
|
|
48273
|
-
errorInformation = await failedResponseHandler({
|
|
48274
|
-
response,
|
|
48275
|
-
url: url2,
|
|
48276
|
-
requestBodyValues: body.values
|
|
48277
|
-
});
|
|
48278
|
-
} catch (error43) {
|
|
48279
|
-
if (isAbortError(error43) || APICallError.isInstance(error43)) {
|
|
48280
|
-
throw error43;
|
|
48281
|
-
}
|
|
48282
|
-
throw new APICallError({
|
|
48283
|
-
message: "Failed to process error response",
|
|
48284
|
-
cause: error43,
|
|
48285
|
-
statusCode: response.status,
|
|
48286
|
-
url: url2,
|
|
48287
|
-
responseHeaders,
|
|
48288
|
-
requestBodyValues: body.values
|
|
48289
|
-
});
|
|
48290
|
-
}
|
|
48291
|
-
throw errorInformation.value;
|
|
48292
|
-
}
|
|
48293
|
-
try {
|
|
48294
|
-
return await successfulResponseHandler({
|
|
48295
|
-
response,
|
|
48296
|
-
url: url2,
|
|
48297
|
-
requestBodyValues: body.values
|
|
48298
|
-
});
|
|
48299
|
-
} catch (error43) {
|
|
48300
|
-
if (error43 instanceof Error) {
|
|
48301
|
-
if (isAbortError(error43) || APICallError.isInstance(error43)) {
|
|
48302
|
-
throw error43;
|
|
48303
|
-
}
|
|
48304
|
-
}
|
|
48305
|
-
throw new APICallError({
|
|
48306
|
-
message: "Failed to process successful response",
|
|
48307
|
-
cause: error43,
|
|
48308
|
-
statusCode: response.status,
|
|
48309
|
-
url: url2,
|
|
48310
|
-
responseHeaders,
|
|
48311
|
-
requestBodyValues: body.values
|
|
48312
|
-
});
|
|
48313
|
-
}
|
|
48314
|
-
} catch (error43) {
|
|
48315
|
-
throw handleFetchError({ error: error43, url: url2, requestBodyValues: body.values });
|
|
48316
|
-
}
|
|
48317
|
-
};
|
|
48318
|
-
async function resolve(value) {
|
|
48319
|
-
if (typeof value === "function") {
|
|
48320
|
-
value = value();
|
|
48321
|
-
}
|
|
48322
|
-
return Promise.resolve(value);
|
|
48323
|
-
}
|
|
48324
|
-
var createJsonErrorResponseHandler = ({
|
|
48325
|
-
errorSchema,
|
|
48326
|
-
errorToMessage,
|
|
48327
|
-
isRetryable
|
|
48328
|
-
}) => async ({ response, url: url2, requestBodyValues }) => {
|
|
48329
|
-
const responseBody = await response.text();
|
|
48330
|
-
const responseHeaders = extractResponseHeaders(response);
|
|
48331
|
-
if (responseBody.trim() === "") {
|
|
48332
|
-
return {
|
|
48333
|
-
responseHeaders,
|
|
48334
|
-
value: new APICallError({
|
|
48335
|
-
message: response.statusText,
|
|
48336
|
-
url: url2,
|
|
48337
|
-
requestBodyValues,
|
|
48338
|
-
statusCode: response.status,
|
|
48339
|
-
responseHeaders,
|
|
48340
|
-
responseBody,
|
|
48341
|
-
isRetryable: isRetryable == null ? undefined : isRetryable(response)
|
|
48342
|
-
})
|
|
48343
|
-
};
|
|
48344
|
-
}
|
|
48345
|
-
try {
|
|
48346
|
-
const parsedError = await parseJSON({
|
|
48347
|
-
text: responseBody,
|
|
48348
|
-
schema: errorSchema
|
|
48349
|
-
});
|
|
48350
|
-
return {
|
|
48351
|
-
responseHeaders,
|
|
48352
|
-
value: new APICallError({
|
|
48353
|
-
message: errorToMessage(parsedError),
|
|
48354
|
-
url: url2,
|
|
48355
|
-
requestBodyValues,
|
|
48356
|
-
statusCode: response.status,
|
|
48357
|
-
responseHeaders,
|
|
48358
|
-
responseBody,
|
|
48359
|
-
data: parsedError,
|
|
48360
|
-
isRetryable: isRetryable == null ? undefined : isRetryable(response, parsedError)
|
|
48361
|
-
})
|
|
48362
|
-
};
|
|
48363
|
-
} catch (parseError) {
|
|
48364
|
-
return {
|
|
48365
|
-
responseHeaders,
|
|
48366
|
-
value: new APICallError({
|
|
48367
|
-
message: response.statusText,
|
|
48368
|
-
url: url2,
|
|
48369
|
-
requestBodyValues,
|
|
48370
|
-
statusCode: response.status,
|
|
48371
|
-
responseHeaders,
|
|
48372
|
-
responseBody,
|
|
48373
|
-
isRetryable: isRetryable == null ? undefined : isRetryable(response)
|
|
48374
|
-
})
|
|
48375
|
-
};
|
|
48376
|
-
}
|
|
48377
|
-
};
|
|
48378
|
-
var createEventSourceResponseHandler = (chunkSchema) => async ({ response }) => {
|
|
48379
|
-
const responseHeaders = extractResponseHeaders(response);
|
|
48380
|
-
if (response.body == null) {
|
|
48381
|
-
throw new EmptyResponseBodyError({});
|
|
48382
|
-
}
|
|
48383
|
-
return {
|
|
48384
|
-
responseHeaders,
|
|
48385
|
-
value: parseJsonEventStream({
|
|
48386
|
-
stream: response.body,
|
|
48387
|
-
schema: chunkSchema
|
|
48388
|
-
})
|
|
48389
|
-
};
|
|
48390
|
-
};
|
|
48391
|
-
var createJsonResponseHandler = (responseSchema) => async ({ response, url: url2, requestBodyValues }) => {
|
|
48392
|
-
const responseBody = await response.text();
|
|
48393
|
-
const parsedResult = await safeParseJSON({
|
|
48394
|
-
text: responseBody,
|
|
48395
|
-
schema: responseSchema
|
|
48396
|
-
});
|
|
48397
|
-
const responseHeaders = extractResponseHeaders(response);
|
|
48398
|
-
if (!parsedResult.success) {
|
|
48399
|
-
throw new APICallError({
|
|
48400
|
-
message: "Invalid JSON response",
|
|
48401
|
-
cause: parsedResult.error,
|
|
48402
|
-
statusCode: response.status,
|
|
48403
|
-
responseHeaders,
|
|
48404
|
-
responseBody,
|
|
48405
|
-
url: url2,
|
|
48406
|
-
requestBodyValues
|
|
48407
|
-
});
|
|
48408
|
-
}
|
|
48409
|
-
return {
|
|
48410
|
-
responseHeaders,
|
|
48411
|
-
value: parsedResult.value,
|
|
48412
|
-
rawValue: parsedResult.rawValue
|
|
48413
|
-
};
|
|
48414
|
-
};
|
|
48415
47973
|
var getRelativePath = (pathA, pathB) => {
|
|
48416
47974
|
let i = 0;
|
|
48417
47975
|
for (;i < pathA.length && i < pathB.length; i++) {
|
|
@@ -49477,9 +49035,6 @@ function convertUint8ArrayToBase64(array2) {
|
|
|
49477
49035
|
}
|
|
49478
49036
|
return btoa2(latin1string);
|
|
49479
49037
|
}
|
|
49480
|
-
function withoutTrailingSlash(url2) {
|
|
49481
|
-
return url2 == null ? undefined : url2.replace(/\/$/, "");
|
|
49482
|
-
}
|
|
49483
49038
|
function isAsyncIterable(obj) {
|
|
49484
49039
|
return obj != null && typeof obj[Symbol.asyncIterator] === "function";
|
|
49485
49040
|
}
|
|
@@ -49500,6 +49055,492 @@ async function* executeTool({
|
|
|
49500
49055
|
yield { type: "final", output: await result };
|
|
49501
49056
|
}
|
|
49502
49057
|
}
|
|
49058
|
+
// ../../node_modules/@ai-sdk/gateway/node_modules/@ai-sdk/provider-utils/dist/index.mjs
|
|
49059
|
+
function combineHeaders(...headers) {
|
|
49060
|
+
return headers.reduce((combinedHeaders, currentHeaders) => ({
|
|
49061
|
+
...combinedHeaders,
|
|
49062
|
+
...currentHeaders != null ? currentHeaders : {}
|
|
49063
|
+
}), {});
|
|
49064
|
+
}
|
|
49065
|
+
function extractResponseHeaders(response) {
|
|
49066
|
+
return Object.fromEntries([...response.headers]);
|
|
49067
|
+
}
|
|
49068
|
+
var createIdGenerator2 = ({
|
|
49069
|
+
prefix,
|
|
49070
|
+
size = 16,
|
|
49071
|
+
alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
49072
|
+
separator = "-"
|
|
49073
|
+
} = {}) => {
|
|
49074
|
+
const generator = () => {
|
|
49075
|
+
const alphabetLength = alphabet.length;
|
|
49076
|
+
const chars = new Array(size);
|
|
49077
|
+
for (let i = 0;i < size; i++) {
|
|
49078
|
+
chars[i] = alphabet[Math.random() * alphabetLength | 0];
|
|
49079
|
+
}
|
|
49080
|
+
return chars.join("");
|
|
49081
|
+
};
|
|
49082
|
+
if (prefix == null) {
|
|
49083
|
+
return generator;
|
|
49084
|
+
}
|
|
49085
|
+
if (alphabet.includes(separator)) {
|
|
49086
|
+
throw new InvalidArgumentError2({
|
|
49087
|
+
argument: "separator",
|
|
49088
|
+
message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`
|
|
49089
|
+
});
|
|
49090
|
+
}
|
|
49091
|
+
return () => `${prefix}${separator}${generator()}`;
|
|
49092
|
+
};
|
|
49093
|
+
var generateId2 = createIdGenerator2();
|
|
49094
|
+
function isAbortError2(error43) {
|
|
49095
|
+
return (error43 instanceof Error || error43 instanceof DOMException) && (error43.name === "AbortError" || error43.name === "ResponseAborted" || error43.name === "TimeoutError");
|
|
49096
|
+
}
|
|
49097
|
+
var FETCH_FAILED_ERROR_MESSAGES = ["fetch failed", "failed to fetch"];
|
|
49098
|
+
function handleFetchError({
|
|
49099
|
+
error: error43,
|
|
49100
|
+
url: url2,
|
|
49101
|
+
requestBodyValues
|
|
49102
|
+
}) {
|
|
49103
|
+
if (isAbortError2(error43)) {
|
|
49104
|
+
return error43;
|
|
49105
|
+
}
|
|
49106
|
+
if (error43 instanceof TypeError && FETCH_FAILED_ERROR_MESSAGES.includes(error43.message.toLowerCase())) {
|
|
49107
|
+
const cause = error43.cause;
|
|
49108
|
+
if (cause != null) {
|
|
49109
|
+
return new APICallError({
|
|
49110
|
+
message: `Cannot connect to API: ${cause.message}`,
|
|
49111
|
+
cause,
|
|
49112
|
+
url: url2,
|
|
49113
|
+
requestBodyValues,
|
|
49114
|
+
isRetryable: true
|
|
49115
|
+
});
|
|
49116
|
+
}
|
|
49117
|
+
}
|
|
49118
|
+
return error43;
|
|
49119
|
+
}
|
|
49120
|
+
function removeUndefinedEntries(record2) {
|
|
49121
|
+
return Object.fromEntries(Object.entries(record2).filter(([_key, value]) => value != null));
|
|
49122
|
+
}
|
|
49123
|
+
var getOriginalFetch = () => globalThis.fetch;
|
|
49124
|
+
var getFromApi = async ({
|
|
49125
|
+
url: url2,
|
|
49126
|
+
headers = {},
|
|
49127
|
+
successfulResponseHandler,
|
|
49128
|
+
failedResponseHandler,
|
|
49129
|
+
abortSignal,
|
|
49130
|
+
fetch: fetch2 = getOriginalFetch()
|
|
49131
|
+
}) => {
|
|
49132
|
+
try {
|
|
49133
|
+
const response = await fetch2(url2, {
|
|
49134
|
+
method: "GET",
|
|
49135
|
+
headers: removeUndefinedEntries(headers),
|
|
49136
|
+
signal: abortSignal
|
|
49137
|
+
});
|
|
49138
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
49139
|
+
if (!response.ok) {
|
|
49140
|
+
let errorInformation;
|
|
49141
|
+
try {
|
|
49142
|
+
errorInformation = await failedResponseHandler({
|
|
49143
|
+
response,
|
|
49144
|
+
url: url2,
|
|
49145
|
+
requestBodyValues: {}
|
|
49146
|
+
});
|
|
49147
|
+
} catch (error43) {
|
|
49148
|
+
if (isAbortError2(error43) || APICallError.isInstance(error43)) {
|
|
49149
|
+
throw error43;
|
|
49150
|
+
}
|
|
49151
|
+
throw new APICallError({
|
|
49152
|
+
message: "Failed to process error response",
|
|
49153
|
+
cause: error43,
|
|
49154
|
+
statusCode: response.status,
|
|
49155
|
+
url: url2,
|
|
49156
|
+
responseHeaders,
|
|
49157
|
+
requestBodyValues: {}
|
|
49158
|
+
});
|
|
49159
|
+
}
|
|
49160
|
+
throw errorInformation.value;
|
|
49161
|
+
}
|
|
49162
|
+
try {
|
|
49163
|
+
return await successfulResponseHandler({
|
|
49164
|
+
response,
|
|
49165
|
+
url: url2,
|
|
49166
|
+
requestBodyValues: {}
|
|
49167
|
+
});
|
|
49168
|
+
} catch (error43) {
|
|
49169
|
+
if (error43 instanceof Error) {
|
|
49170
|
+
if (isAbortError2(error43) || APICallError.isInstance(error43)) {
|
|
49171
|
+
throw error43;
|
|
49172
|
+
}
|
|
49173
|
+
}
|
|
49174
|
+
throw new APICallError({
|
|
49175
|
+
message: "Failed to process successful response",
|
|
49176
|
+
cause: error43,
|
|
49177
|
+
statusCode: response.status,
|
|
49178
|
+
url: url2,
|
|
49179
|
+
responseHeaders,
|
|
49180
|
+
requestBodyValues: {}
|
|
49181
|
+
});
|
|
49182
|
+
}
|
|
49183
|
+
} catch (error43) {
|
|
49184
|
+
throw handleFetchError({ error: error43, url: url2, requestBodyValues: {} });
|
|
49185
|
+
}
|
|
49186
|
+
};
|
|
49187
|
+
function loadOptionalSetting({
|
|
49188
|
+
settingValue,
|
|
49189
|
+
environmentVariableName
|
|
49190
|
+
}) {
|
|
49191
|
+
if (typeof settingValue === "string") {
|
|
49192
|
+
return settingValue;
|
|
49193
|
+
}
|
|
49194
|
+
if (settingValue != null || typeof process === "undefined") {
|
|
49195
|
+
return;
|
|
49196
|
+
}
|
|
49197
|
+
settingValue = process.env[environmentVariableName];
|
|
49198
|
+
if (settingValue == null || typeof settingValue !== "string") {
|
|
49199
|
+
return;
|
|
49200
|
+
}
|
|
49201
|
+
return settingValue;
|
|
49202
|
+
}
|
|
49203
|
+
var suspectProtoRx2 = /"__proto__"\s*:/;
|
|
49204
|
+
var suspectConstructorRx2 = /"constructor"\s*:/;
|
|
49205
|
+
function _parse3(text) {
|
|
49206
|
+
const obj = JSON.parse(text);
|
|
49207
|
+
if (obj === null || typeof obj !== "object") {
|
|
49208
|
+
return obj;
|
|
49209
|
+
}
|
|
49210
|
+
if (suspectProtoRx2.test(text) === false && suspectConstructorRx2.test(text) === false) {
|
|
49211
|
+
return obj;
|
|
49212
|
+
}
|
|
49213
|
+
return filter2(obj);
|
|
49214
|
+
}
|
|
49215
|
+
function filter2(obj) {
|
|
49216
|
+
let next = [obj];
|
|
49217
|
+
while (next.length) {
|
|
49218
|
+
const nodes = next;
|
|
49219
|
+
next = [];
|
|
49220
|
+
for (const node of nodes) {
|
|
49221
|
+
if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {
|
|
49222
|
+
throw new SyntaxError("Object contains forbidden prototype property");
|
|
49223
|
+
}
|
|
49224
|
+
if (Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
|
|
49225
|
+
throw new SyntaxError("Object contains forbidden prototype property");
|
|
49226
|
+
}
|
|
49227
|
+
for (const key in node) {
|
|
49228
|
+
const value = node[key];
|
|
49229
|
+
if (value && typeof value === "object") {
|
|
49230
|
+
next.push(value);
|
|
49231
|
+
}
|
|
49232
|
+
}
|
|
49233
|
+
}
|
|
49234
|
+
}
|
|
49235
|
+
return obj;
|
|
49236
|
+
}
|
|
49237
|
+
function secureJsonParse2(text) {
|
|
49238
|
+
const { stackTraceLimit } = Error;
|
|
49239
|
+
Error.stackTraceLimit = 0;
|
|
49240
|
+
try {
|
|
49241
|
+
return _parse3(text);
|
|
49242
|
+
} finally {
|
|
49243
|
+
Error.stackTraceLimit = stackTraceLimit;
|
|
49244
|
+
}
|
|
49245
|
+
}
|
|
49246
|
+
var validatorSymbol2 = Symbol.for("vercel.ai.validator");
|
|
49247
|
+
function validator2(validate) {
|
|
49248
|
+
return { [validatorSymbol2]: true, validate };
|
|
49249
|
+
}
|
|
49250
|
+
function isValidator2(value) {
|
|
49251
|
+
return typeof value === "object" && value !== null && validatorSymbol2 in value && value[validatorSymbol2] === true && "validate" in value;
|
|
49252
|
+
}
|
|
49253
|
+
function asValidator2(value) {
|
|
49254
|
+
return isValidator2(value) ? value : standardSchemaValidator2(value);
|
|
49255
|
+
}
|
|
49256
|
+
function standardSchemaValidator2(standardSchema) {
|
|
49257
|
+
return validator2(async (value) => {
|
|
49258
|
+
const result = await standardSchema["~standard"].validate(value);
|
|
49259
|
+
return result.issues == null ? { success: true, value: result.value } : {
|
|
49260
|
+
success: false,
|
|
49261
|
+
error: new TypeValidationError({
|
|
49262
|
+
value,
|
|
49263
|
+
cause: result.issues
|
|
49264
|
+
})
|
|
49265
|
+
};
|
|
49266
|
+
});
|
|
49267
|
+
}
|
|
49268
|
+
async function validateTypes2({
|
|
49269
|
+
value,
|
|
49270
|
+
schema
|
|
49271
|
+
}) {
|
|
49272
|
+
const result = await safeValidateTypes2({ value, schema });
|
|
49273
|
+
if (!result.success) {
|
|
49274
|
+
throw TypeValidationError.wrap({ value, cause: result.error });
|
|
49275
|
+
}
|
|
49276
|
+
return result.value;
|
|
49277
|
+
}
|
|
49278
|
+
async function safeValidateTypes2({
|
|
49279
|
+
value,
|
|
49280
|
+
schema
|
|
49281
|
+
}) {
|
|
49282
|
+
const validator22 = asValidator2(schema);
|
|
49283
|
+
try {
|
|
49284
|
+
if (validator22.validate == null) {
|
|
49285
|
+
return { success: true, value, rawValue: value };
|
|
49286
|
+
}
|
|
49287
|
+
const result = await validator22.validate(value);
|
|
49288
|
+
if (result.success) {
|
|
49289
|
+
return { success: true, value: result.value, rawValue: value };
|
|
49290
|
+
}
|
|
49291
|
+
return {
|
|
49292
|
+
success: false,
|
|
49293
|
+
error: TypeValidationError.wrap({ value, cause: result.error }),
|
|
49294
|
+
rawValue: value
|
|
49295
|
+
};
|
|
49296
|
+
} catch (error43) {
|
|
49297
|
+
return {
|
|
49298
|
+
success: false,
|
|
49299
|
+
error: TypeValidationError.wrap({ value, cause: error43 }),
|
|
49300
|
+
rawValue: value
|
|
49301
|
+
};
|
|
49302
|
+
}
|
|
49303
|
+
}
|
|
49304
|
+
async function parseJSON({
|
|
49305
|
+
text,
|
|
49306
|
+
schema
|
|
49307
|
+
}) {
|
|
49308
|
+
try {
|
|
49309
|
+
const value = secureJsonParse2(text);
|
|
49310
|
+
if (schema == null) {
|
|
49311
|
+
return value;
|
|
49312
|
+
}
|
|
49313
|
+
return validateTypes2({ value, schema });
|
|
49314
|
+
} catch (error43) {
|
|
49315
|
+
if (JSONParseError.isInstance(error43) || TypeValidationError.isInstance(error43)) {
|
|
49316
|
+
throw error43;
|
|
49317
|
+
}
|
|
49318
|
+
throw new JSONParseError({ text, cause: error43 });
|
|
49319
|
+
}
|
|
49320
|
+
}
|
|
49321
|
+
async function safeParseJSON2({
|
|
49322
|
+
text,
|
|
49323
|
+
schema
|
|
49324
|
+
}) {
|
|
49325
|
+
try {
|
|
49326
|
+
const value = secureJsonParse2(text);
|
|
49327
|
+
if (schema == null) {
|
|
49328
|
+
return { success: true, value, rawValue: value };
|
|
49329
|
+
}
|
|
49330
|
+
return await safeValidateTypes2({ value, schema });
|
|
49331
|
+
} catch (error43) {
|
|
49332
|
+
return {
|
|
49333
|
+
success: false,
|
|
49334
|
+
error: JSONParseError.isInstance(error43) ? error43 : new JSONParseError({ text, cause: error43 }),
|
|
49335
|
+
rawValue: undefined
|
|
49336
|
+
};
|
|
49337
|
+
}
|
|
49338
|
+
}
|
|
49339
|
+
function parseJsonEventStream({
|
|
49340
|
+
stream,
|
|
49341
|
+
schema
|
|
49342
|
+
}) {
|
|
49343
|
+
return stream.pipeThrough(new TextDecoderStream).pipeThrough(new EventSourceParserStream).pipeThrough(new TransformStream({
|
|
49344
|
+
async transform({ data }, controller) {
|
|
49345
|
+
if (data === "[DONE]") {
|
|
49346
|
+
return;
|
|
49347
|
+
}
|
|
49348
|
+
controller.enqueue(await safeParseJSON2({ text: data, schema }));
|
|
49349
|
+
}
|
|
49350
|
+
}));
|
|
49351
|
+
}
|
|
49352
|
+
var getOriginalFetch2 = () => globalThis.fetch;
|
|
49353
|
+
var postJsonToApi = async ({
|
|
49354
|
+
url: url2,
|
|
49355
|
+
headers,
|
|
49356
|
+
body,
|
|
49357
|
+
failedResponseHandler,
|
|
49358
|
+
successfulResponseHandler,
|
|
49359
|
+
abortSignal,
|
|
49360
|
+
fetch: fetch2
|
|
49361
|
+
}) => postToApi({
|
|
49362
|
+
url: url2,
|
|
49363
|
+
headers: {
|
|
49364
|
+
"Content-Type": "application/json",
|
|
49365
|
+
...headers
|
|
49366
|
+
},
|
|
49367
|
+
body: {
|
|
49368
|
+
content: JSON.stringify(body),
|
|
49369
|
+
values: body
|
|
49370
|
+
},
|
|
49371
|
+
failedResponseHandler,
|
|
49372
|
+
successfulResponseHandler,
|
|
49373
|
+
abortSignal,
|
|
49374
|
+
fetch: fetch2
|
|
49375
|
+
});
|
|
49376
|
+
var postToApi = async ({
|
|
49377
|
+
url: url2,
|
|
49378
|
+
headers = {},
|
|
49379
|
+
body,
|
|
49380
|
+
successfulResponseHandler,
|
|
49381
|
+
failedResponseHandler,
|
|
49382
|
+
abortSignal,
|
|
49383
|
+
fetch: fetch2 = getOriginalFetch2()
|
|
49384
|
+
}) => {
|
|
49385
|
+
try {
|
|
49386
|
+
const response = await fetch2(url2, {
|
|
49387
|
+
method: "POST",
|
|
49388
|
+
headers: removeUndefinedEntries(headers),
|
|
49389
|
+
body: body.content,
|
|
49390
|
+
signal: abortSignal
|
|
49391
|
+
});
|
|
49392
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
49393
|
+
if (!response.ok) {
|
|
49394
|
+
let errorInformation;
|
|
49395
|
+
try {
|
|
49396
|
+
errorInformation = await failedResponseHandler({
|
|
49397
|
+
response,
|
|
49398
|
+
url: url2,
|
|
49399
|
+
requestBodyValues: body.values
|
|
49400
|
+
});
|
|
49401
|
+
} catch (error43) {
|
|
49402
|
+
if (isAbortError2(error43) || APICallError.isInstance(error43)) {
|
|
49403
|
+
throw error43;
|
|
49404
|
+
}
|
|
49405
|
+
throw new APICallError({
|
|
49406
|
+
message: "Failed to process error response",
|
|
49407
|
+
cause: error43,
|
|
49408
|
+
statusCode: response.status,
|
|
49409
|
+
url: url2,
|
|
49410
|
+
responseHeaders,
|
|
49411
|
+
requestBodyValues: body.values
|
|
49412
|
+
});
|
|
49413
|
+
}
|
|
49414
|
+
throw errorInformation.value;
|
|
49415
|
+
}
|
|
49416
|
+
try {
|
|
49417
|
+
return await successfulResponseHandler({
|
|
49418
|
+
response,
|
|
49419
|
+
url: url2,
|
|
49420
|
+
requestBodyValues: body.values
|
|
49421
|
+
});
|
|
49422
|
+
} catch (error43) {
|
|
49423
|
+
if (error43 instanceof Error) {
|
|
49424
|
+
if (isAbortError2(error43) || APICallError.isInstance(error43)) {
|
|
49425
|
+
throw error43;
|
|
49426
|
+
}
|
|
49427
|
+
}
|
|
49428
|
+
throw new APICallError({
|
|
49429
|
+
message: "Failed to process successful response",
|
|
49430
|
+
cause: error43,
|
|
49431
|
+
statusCode: response.status,
|
|
49432
|
+
url: url2,
|
|
49433
|
+
responseHeaders,
|
|
49434
|
+
requestBodyValues: body.values
|
|
49435
|
+
});
|
|
49436
|
+
}
|
|
49437
|
+
} catch (error43) {
|
|
49438
|
+
throw handleFetchError({ error: error43, url: url2, requestBodyValues: body.values });
|
|
49439
|
+
}
|
|
49440
|
+
};
|
|
49441
|
+
async function resolve(value) {
|
|
49442
|
+
if (typeof value === "function") {
|
|
49443
|
+
value = value();
|
|
49444
|
+
}
|
|
49445
|
+
return Promise.resolve(value);
|
|
49446
|
+
}
|
|
49447
|
+
var createJsonErrorResponseHandler = ({
|
|
49448
|
+
errorSchema,
|
|
49449
|
+
errorToMessage,
|
|
49450
|
+
isRetryable
|
|
49451
|
+
}) => async ({ response, url: url2, requestBodyValues }) => {
|
|
49452
|
+
const responseBody = await response.text();
|
|
49453
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
49454
|
+
if (responseBody.trim() === "") {
|
|
49455
|
+
return {
|
|
49456
|
+
responseHeaders,
|
|
49457
|
+
value: new APICallError({
|
|
49458
|
+
message: response.statusText,
|
|
49459
|
+
url: url2,
|
|
49460
|
+
requestBodyValues,
|
|
49461
|
+
statusCode: response.status,
|
|
49462
|
+
responseHeaders,
|
|
49463
|
+
responseBody,
|
|
49464
|
+
isRetryable: isRetryable == null ? undefined : isRetryable(response)
|
|
49465
|
+
})
|
|
49466
|
+
};
|
|
49467
|
+
}
|
|
49468
|
+
try {
|
|
49469
|
+
const parsedError = await parseJSON({
|
|
49470
|
+
text: responseBody,
|
|
49471
|
+
schema: errorSchema
|
|
49472
|
+
});
|
|
49473
|
+
return {
|
|
49474
|
+
responseHeaders,
|
|
49475
|
+
value: new APICallError({
|
|
49476
|
+
message: errorToMessage(parsedError),
|
|
49477
|
+
url: url2,
|
|
49478
|
+
requestBodyValues,
|
|
49479
|
+
statusCode: response.status,
|
|
49480
|
+
responseHeaders,
|
|
49481
|
+
responseBody,
|
|
49482
|
+
data: parsedError,
|
|
49483
|
+
isRetryable: isRetryable == null ? undefined : isRetryable(response, parsedError)
|
|
49484
|
+
})
|
|
49485
|
+
};
|
|
49486
|
+
} catch (parseError) {
|
|
49487
|
+
return {
|
|
49488
|
+
responseHeaders,
|
|
49489
|
+
value: new APICallError({
|
|
49490
|
+
message: response.statusText,
|
|
49491
|
+
url: url2,
|
|
49492
|
+
requestBodyValues,
|
|
49493
|
+
statusCode: response.status,
|
|
49494
|
+
responseHeaders,
|
|
49495
|
+
responseBody,
|
|
49496
|
+
isRetryable: isRetryable == null ? undefined : isRetryable(response)
|
|
49497
|
+
})
|
|
49498
|
+
};
|
|
49499
|
+
}
|
|
49500
|
+
};
|
|
49501
|
+
var createEventSourceResponseHandler = (chunkSchema) => async ({ response }) => {
|
|
49502
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
49503
|
+
if (response.body == null) {
|
|
49504
|
+
throw new EmptyResponseBodyError({});
|
|
49505
|
+
}
|
|
49506
|
+
return {
|
|
49507
|
+
responseHeaders,
|
|
49508
|
+
value: parseJsonEventStream({
|
|
49509
|
+
stream: response.body,
|
|
49510
|
+
schema: chunkSchema
|
|
49511
|
+
})
|
|
49512
|
+
};
|
|
49513
|
+
};
|
|
49514
|
+
var createJsonResponseHandler = (responseSchema) => async ({ response, url: url2, requestBodyValues }) => {
|
|
49515
|
+
const responseBody = await response.text();
|
|
49516
|
+
const parsedResult = await safeParseJSON2({
|
|
49517
|
+
text: responseBody,
|
|
49518
|
+
schema: responseSchema
|
|
49519
|
+
});
|
|
49520
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
49521
|
+
if (!parsedResult.success) {
|
|
49522
|
+
throw new APICallError({
|
|
49523
|
+
message: "Invalid JSON response",
|
|
49524
|
+
cause: parsedResult.error,
|
|
49525
|
+
statusCode: response.status,
|
|
49526
|
+
responseHeaders,
|
|
49527
|
+
responseBody,
|
|
49528
|
+
url: url2,
|
|
49529
|
+
requestBodyValues
|
|
49530
|
+
});
|
|
49531
|
+
}
|
|
49532
|
+
return {
|
|
49533
|
+
responseHeaders,
|
|
49534
|
+
value: parsedResult.value,
|
|
49535
|
+
rawValue: parsedResult.rawValue
|
|
49536
|
+
};
|
|
49537
|
+
};
|
|
49538
|
+
var ignoreOverride2 = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
49539
|
+
var ALPHA_NUMERIC2 = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
49540
|
+
var schemaSymbol2 = Symbol.for("vercel.ai.schema");
|
|
49541
|
+
function withoutTrailingSlash(url2) {
|
|
49542
|
+
return url2 == null ? undefined : url2.replace(/\/$/, "");
|
|
49543
|
+
}
|
|
49503
49544
|
|
|
49504
49545
|
// ../../node_modules/@ai-sdk/gateway/dist/index.mjs
|
|
49505
49546
|
var marker15 = "vercel.ai.gateway.error";
|
|
@@ -56571,64 +56612,6 @@ var createNewProject_default = {
|
|
|
56571
56612
|
agent: "architect"
|
|
56572
56613
|
};
|
|
56573
56614
|
|
|
56574
|
-
// ../core/src/AiTool/generateProjectConfig.ts
|
|
56575
|
-
var prompt2 = `
|
|
56576
|
-
Role: Analyzer agent
|
|
56577
|
-
Goal: Produce a valid polkacodes YAML configuration for the project.
|
|
56578
|
-
|
|
56579
|
-
Workflow
|
|
56580
|
-
1. Scan project files with tool_read_file and identify:
|
|
56581
|
-
- Package/build tool (npm, bun, pnpm, etc.)
|
|
56582
|
-
- Test framework and patterns (snapshot tests, coverage, etc.)
|
|
56583
|
-
- Formatter / linter and their rules
|
|
56584
|
-
- Folder structure and naming conventions
|
|
56585
|
-
- CI / development workflows
|
|
56586
|
-
|
|
56587
|
-
2. Build a YAML config with three root keys:
|
|
56588
|
-
|
|
56589
|
-
\`\`\`yaml
|
|
56590
|
-
scripts: # derive from package.json and CI
|
|
56591
|
-
format: # code formatter
|
|
56592
|
-
command: "<formatter cmd>"
|
|
56593
|
-
description: "Format code"
|
|
56594
|
-
check: # linter / type checker
|
|
56595
|
-
command: "<linter cmd>"
|
|
56596
|
-
description: "Static checks"
|
|
56597
|
-
test: # test runner
|
|
56598
|
-
command: "<test cmd>"
|
|
56599
|
-
description: "Run tests"
|
|
56600
|
-
# add any other meaningful project scripts
|
|
56601
|
-
|
|
56602
|
-
rules: # bullet list of key conventions/tools
|
|
56603
|
-
|
|
56604
|
-
excludeFiles: # only files likely to hold secrets
|
|
56605
|
-
- ".env"
|
|
56606
|
-
- ".env.*"
|
|
56607
|
-
- ".npmrc"
|
|
56608
|
-
# do NOT list build artifacts, lockfiles, or paths already in .gitignore
|
|
56609
|
-
\`\`\`
|
|
56610
|
-
|
|
56611
|
-
3. Return the YAML exactly once, wrapped like:
|
|
56612
|
-
|
|
56613
|
-
<tool_attempt_completion>
|
|
56614
|
-
<tool_parameter_result>
|
|
56615
|
-
# YAML (2-space indents, double-quoted commands)
|
|
56616
|
-
</tool_parameter_result>
|
|
56617
|
-
</tool_attempt_completion>
|
|
56618
|
-
`;
|
|
56619
|
-
var generateProjectConfig_default = {
|
|
56620
|
-
name: "generateProjectConfig",
|
|
56621
|
-
description: "Analyzes project files to generate polkacodes config sections",
|
|
56622
|
-
prompt: prompt2,
|
|
56623
|
-
formatInput: () => {
|
|
56624
|
-
return "";
|
|
56625
|
-
},
|
|
56626
|
-
parseOutput: (output) => {
|
|
56627
|
-
return output;
|
|
56628
|
-
},
|
|
56629
|
-
agent: "analyzer"
|
|
56630
|
-
};
|
|
56631
|
-
|
|
56632
56615
|
// ../core/src/AiTool/index.ts
|
|
56633
56616
|
var executeMultiAgentTool = async (definition, agent, params) => {
|
|
56634
56617
|
const exitReason = await agent.startTask({
|
|
@@ -56646,79 +56629,9 @@ var makeMultiAgentTool = (definition) => {
|
|
|
56646
56629
|
return executeMultiAgentTool(definition, agent, params);
|
|
56647
56630
|
};
|
|
56648
56631
|
};
|
|
56649
|
-
var generateProjectConfig = makeMultiAgentTool(generateProjectConfig_default);
|
|
56650
56632
|
var createNewProject = makeMultiAgentTool(createNewProject_default);
|
|
56651
|
-
// ../core/src/workflow/utils.ts
|
|
56652
|
-
var import_lodash2 = __toESM(require_lodash(), 1);
|
|
56653
|
-
// ../core/src/workflow/builder.ts
|
|
56654
|
-
class StepsBuilder {
|
|
56655
|
-
#steps = [];
|
|
56656
|
-
build() {
|
|
56657
|
-
if (this.#steps.length === 0) {
|
|
56658
|
-
throw new Error("A workflow must have at least one step.");
|
|
56659
|
-
}
|
|
56660
|
-
const rootStep = this.#steps.length > 1 ? {
|
|
56661
|
-
id: "root",
|
|
56662
|
-
type: "sequential",
|
|
56663
|
-
steps: this.#steps
|
|
56664
|
-
} : this.#steps[0];
|
|
56665
|
-
return rootStep;
|
|
56666
|
-
}
|
|
56667
|
-
step(step) {
|
|
56668
|
-
this.#steps.push(step);
|
|
56669
|
-
return this;
|
|
56670
|
-
}
|
|
56671
|
-
parallel(id, step) {
|
|
56672
|
-
return this.step({
|
|
56673
|
-
id,
|
|
56674
|
-
type: "parallel",
|
|
56675
|
-
step
|
|
56676
|
-
});
|
|
56677
|
-
}
|
|
56678
|
-
loop(id, config2) {
|
|
56679
|
-
return this.step({
|
|
56680
|
-
...config2,
|
|
56681
|
-
id,
|
|
56682
|
-
type: "loop"
|
|
56683
|
-
});
|
|
56684
|
-
}
|
|
56685
|
-
custom(idOrSpec, run) {
|
|
56686
|
-
if (typeof idOrSpec === "string") {
|
|
56687
|
-
if (!run) {
|
|
56688
|
-
throw new Error('Custom step "run" function must be provided.');
|
|
56689
|
-
}
|
|
56690
|
-
return this.step({
|
|
56691
|
-
id: idOrSpec,
|
|
56692
|
-
type: "custom",
|
|
56693
|
-
run
|
|
56694
|
-
});
|
|
56695
|
-
}
|
|
56696
|
-
return this.step(idOrSpec);
|
|
56697
|
-
}
|
|
56698
|
-
workflow(id, config2) {
|
|
56699
|
-
return this.step({
|
|
56700
|
-
...config2,
|
|
56701
|
-
id,
|
|
56702
|
-
type: "workflow"
|
|
56703
|
-
});
|
|
56704
|
-
}
|
|
56705
|
-
agent(id, spec2) {
|
|
56706
|
-
return this.step({
|
|
56707
|
-
...spec2,
|
|
56708
|
-
id,
|
|
56709
|
-
type: "agent"
|
|
56710
|
-
});
|
|
56711
|
-
}
|
|
56712
|
-
branch(id, config2) {
|
|
56713
|
-
return this.step({
|
|
56714
|
-
...config2,
|
|
56715
|
-
id,
|
|
56716
|
-
type: "branch"
|
|
56717
|
-
});
|
|
56718
|
-
}
|
|
56719
|
-
}
|
|
56720
56633
|
// ../cli-shared/src/config.ts
|
|
56721
|
-
var
|
|
56634
|
+
var import_lodash2 = __toESM(require_lodash(), 1);
|
|
56722
56635
|
|
|
56723
56636
|
// ../cli-shared/node_modules/yaml/dist/index.js
|
|
56724
56637
|
var composer = require_composer();
|
|
@@ -59363,9 +59276,9 @@ class ZodUnion3 extends ZodType3 {
|
|
|
59363
59276
|
return this._def.options;
|
|
59364
59277
|
}
|
|
59365
59278
|
}
|
|
59366
|
-
ZodUnion3.create = (
|
|
59279
|
+
ZodUnion3.create = (types, params) => {
|
|
59367
59280
|
return new ZodUnion3({
|
|
59368
|
-
options:
|
|
59281
|
+
options: types,
|
|
59369
59282
|
typeName: ZodFirstPartyTypeKind3.ZodUnion,
|
|
59370
59283
|
...processCreateParams2(params)
|
|
59371
59284
|
});
|
|
@@ -60622,7 +60535,7 @@ function mergeConfigs(configs) {
|
|
|
60622
60535
|
return {};
|
|
60623
60536
|
}
|
|
60624
60537
|
const mergedConfig = configs.reduce((acc, config3) => {
|
|
60625
|
-
const merged =
|
|
60538
|
+
const merged = import_lodash2.merge({}, acc, config3);
|
|
60626
60539
|
let accRules = acc.rules ?? [];
|
|
60627
60540
|
if (typeof accRules === "string") {
|
|
60628
60541
|
accRules = [accRules];
|
|
@@ -61552,15 +61465,29 @@ var {
|
|
|
61552
61465
|
} = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback);
|
|
61553
61466
|
|
|
61554
61467
|
// ../../node_modules/@inquirer/core/dist/esm/lib/screen-manager.js
|
|
61555
|
-
var import_ansi_escapes = __toESM(require_ansi_escapes(), 1);
|
|
61556
61468
|
import { stripVTControlCharacters } from "node:util";
|
|
61469
|
+
|
|
61470
|
+
// ../../node_modules/@inquirer/ansi/dist/esm/index.js
|
|
61471
|
+
var ESC = "\x1B[";
|
|
61472
|
+
var cursorLeft = ESC + "G";
|
|
61473
|
+
var cursorHide = ESC + "?25l";
|
|
61474
|
+
var cursorShow = ESC + "?25h";
|
|
61475
|
+
var cursorUp = (rows = 1) => rows > 0 ? `${ESC}${rows}A` : "";
|
|
61476
|
+
var cursorDown = (rows = 1) => rows > 0 ? `${ESC}${rows}B` : "";
|
|
61477
|
+
var cursorTo = (x, y) => {
|
|
61478
|
+
if (typeof y === "number" && !Number.isNaN(y)) {
|
|
61479
|
+
return `${ESC}${y + 1};${x + 1}H`;
|
|
61480
|
+
}
|
|
61481
|
+
return `${ESC}${x + 1}G`;
|
|
61482
|
+
};
|
|
61483
|
+
var eraseLine = ESC + "2K";
|
|
61484
|
+
var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
|
|
61485
|
+
|
|
61486
|
+
// ../../node_modules/@inquirer/core/dist/esm/lib/screen-manager.js
|
|
61557
61487
|
var height = (content) => content.split(`
|
|
61558
61488
|
`).length;
|
|
61559
61489
|
var lastLine = (content) => content.split(`
|
|
61560
61490
|
`).pop() ?? "";
|
|
61561
|
-
function cursorDown(n) {
|
|
61562
|
-
return n > 0 ? import_ansi_escapes.default.cursorDown(n) : "";
|
|
61563
|
-
}
|
|
61564
61491
|
|
|
61565
61492
|
class ScreenManager {
|
|
61566
61493
|
height = 0;
|
|
@@ -61579,11 +61506,11 @@ class ScreenManager {
|
|
|
61579
61506
|
render(content, bottomContent = "") {
|
|
61580
61507
|
const promptLine = lastLine(content);
|
|
61581
61508
|
const rawPromptLine = stripVTControlCharacters(promptLine);
|
|
61582
|
-
let
|
|
61509
|
+
let prompt2 = rawPromptLine;
|
|
61583
61510
|
if (this.rl.line.length > 0) {
|
|
61584
|
-
|
|
61511
|
+
prompt2 = prompt2.slice(0, -this.rl.line.length);
|
|
61585
61512
|
}
|
|
61586
|
-
this.rl.setPrompt(
|
|
61513
|
+
this.rl.setPrompt(prompt2);
|
|
61587
61514
|
this.cursorPos = this.rl.getCursorPos();
|
|
61588
61515
|
const width = readlineWidth();
|
|
61589
61516
|
content = breakLines(content, width);
|
|
@@ -61597,25 +61524,25 @@ class ScreenManager {
|
|
|
61597
61524
|
const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
|
|
61598
61525
|
const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);
|
|
61599
61526
|
if (bottomContentHeight > 0)
|
|
61600
|
-
output +=
|
|
61601
|
-
output +=
|
|
61602
|
-
this.write(cursorDown(this.extraLinesUnderPrompt) +
|
|
61527
|
+
output += cursorUp(bottomContentHeight);
|
|
61528
|
+
output += cursorTo(this.cursorPos.cols);
|
|
61529
|
+
this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);
|
|
61603
61530
|
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
61604
61531
|
this.height = height(output);
|
|
61605
61532
|
}
|
|
61606
61533
|
checkCursorPos() {
|
|
61607
61534
|
const cursorPos = this.rl.getCursorPos();
|
|
61608
61535
|
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
61609
|
-
this.write(
|
|
61536
|
+
this.write(cursorTo(cursorPos.cols));
|
|
61610
61537
|
this.cursorPos = cursorPos;
|
|
61611
61538
|
}
|
|
61612
61539
|
}
|
|
61613
61540
|
done({ clearContent }) {
|
|
61614
61541
|
this.rl.setPrompt("");
|
|
61615
61542
|
let output = cursorDown(this.extraLinesUnderPrompt);
|
|
61616
|
-
output += clearContent ?
|
|
61543
|
+
output += clearContent ? eraseLines(this.height) : `
|
|
61617
61544
|
`;
|
|
61618
|
-
output +=
|
|
61545
|
+
output += cursorShow;
|
|
61619
61546
|
this.write(output);
|
|
61620
61547
|
this.rl.close();
|
|
61621
61548
|
}
|
|
@@ -61653,7 +61580,7 @@ function getCallSites() {
|
|
|
61653
61580
|
}
|
|
61654
61581
|
function createPrompt(view) {
|
|
61655
61582
|
const callSites = getCallSites();
|
|
61656
|
-
const
|
|
61583
|
+
const prompt2 = (config3, context = {}) => {
|
|
61657
61584
|
const { input = process.stdin, signal } = context;
|
|
61658
61585
|
const cleanups = new Set;
|
|
61659
61586
|
const output = new import_mute_stream.default;
|
|
@@ -61718,7 +61645,7 @@ function createPrompt(view) {
|
|
|
61718
61645
|
}).then(() => promise2), { cancel });
|
|
61719
61646
|
});
|
|
61720
61647
|
};
|
|
61721
|
-
return
|
|
61648
|
+
return prompt2;
|
|
61722
61649
|
}
|
|
61723
61650
|
// ../../node_modules/@inquirer/core/dist/esm/lib/Separator.js
|
|
61724
61651
|
var import_yoctocolors_cjs2 = __toESM(require_yoctocolors_cjs(), 1);
|
|
@@ -61807,7 +61734,6 @@ var esm_default2 = createPrompt((config3, done) => {
|
|
|
61807
61734
|
});
|
|
61808
61735
|
// ../../node_modules/@inquirer/select/dist/esm/index.js
|
|
61809
61736
|
var import_yoctocolors_cjs3 = __toESM(require_yoctocolors_cjs(), 1);
|
|
61810
|
-
var import_ansi_escapes2 = __toESM(require_ansi_escapes(), 1);
|
|
61811
61737
|
var selectTheme = {
|
|
61812
61738
|
icon: { cursor: esm_default.pointer },
|
|
61813
61739
|
style: {
|
|
@@ -61958,7 +61884,7 @@ ${theme.style.help(`(${config3.instructions?.pager ?? "Use arrow keys to reveal
|
|
|
61958
61884
|
const choiceDescription = selectedChoice.description ? `
|
|
61959
61885
|
${theme.style.description(selectedChoice.description)}` : ``;
|
|
61960
61886
|
return `${[prefix, message, helpTipTop].filter(Boolean).join(" ")}
|
|
61961
|
-
${page}${helpTipBottom}${choiceDescription}${
|
|
61887
|
+
${page}${helpTipBottom}${choiceDescription}${cursorHide}`;
|
|
61962
61888
|
});
|
|
61963
61889
|
// ../cli-shared/src/provider.ts
|
|
61964
61890
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
@@ -62000,7 +61926,7 @@ function lookup(path) {
|
|
|
62000
61926
|
}
|
|
62001
61927
|
return $types[extension2] || false;
|
|
62002
61928
|
}
|
|
62003
|
-
function populateMaps(extensions,
|
|
61929
|
+
function populateMaps(extensions, types) {
|
|
62004
61930
|
Object.keys(db).forEach(function forEachMimeType(type) {
|
|
62005
61931
|
var mime = db[type];
|
|
62006
61932
|
var exts = mime.extensions;
|
|
@@ -62010,10 +61936,10 @@ function populateMaps(extensions, types2) {
|
|
|
62010
61936
|
extensions[type] = exts;
|
|
62011
61937
|
for (var i = 0;i < exts.length; i++) {
|
|
62012
61938
|
var extension2 = exts[i];
|
|
62013
|
-
|
|
62014
|
-
const legacyType = _preferredTypeLegacy(extension2,
|
|
62015
|
-
if (legacyType !==
|
|
62016
|
-
$_extensionConflicts.push([extension2, legacyType,
|
|
61939
|
+
types[extension2] = _preferredType(extension2, types[extension2], type);
|
|
61940
|
+
const legacyType = _preferredTypeLegacy(extension2, types[extension2], type);
|
|
61941
|
+
if (legacyType !== types[extension2]) {
|
|
61942
|
+
$_extensionConflicts.push([extension2, legacyType, types[extension2]]);
|
|
62017
61943
|
}
|
|
62018
61944
|
}
|
|
62019
61945
|
});
|
|
@@ -62258,10 +62184,10 @@ var getProvider = (options = {}) => {
|
|
|
62258
62184
|
mediaType
|
|
62259
62185
|
};
|
|
62260
62186
|
},
|
|
62261
|
-
executeCommand: (
|
|
62187
|
+
executeCommand: (command, _needApprove) => {
|
|
62262
62188
|
return new Promise((resolve4, reject) => {
|
|
62263
|
-
options.command?.onStarted(
|
|
62264
|
-
const child = spawn2(
|
|
62189
|
+
options.command?.onStarted(command);
|
|
62190
|
+
const child = spawn2(command, [], {
|
|
62265
62191
|
shell: true,
|
|
62266
62192
|
stdio: "pipe"
|
|
62267
62193
|
});
|
|
@@ -64966,9 +64892,9 @@ class ZodUnion4 extends ZodType4 {
|
|
|
64966
64892
|
return this._def.options;
|
|
64967
64893
|
}
|
|
64968
64894
|
}
|
|
64969
|
-
ZodUnion4.create = (
|
|
64895
|
+
ZodUnion4.create = (types, params) => {
|
|
64970
64896
|
return new ZodUnion4({
|
|
64971
|
-
options:
|
|
64897
|
+
options: types,
|
|
64972
64898
|
typeName: ZodFirstPartyTypeKind4.ZodUnion,
|
|
64973
64899
|
...processCreateParams3(params)
|
|
64974
64900
|
});
|
|
@@ -66577,8 +66503,8 @@ class Runner {
|
|
|
66577
66503
|
const config4 = loadConfig() ?? {};
|
|
66578
66504
|
this.provider = getProvider({
|
|
66579
66505
|
command: {
|
|
66580
|
-
onStarted(
|
|
66581
|
-
console.log(`$ >>>> $ ${
|
|
66506
|
+
onStarted(command) {
|
|
66507
|
+
console.log(`$ >>>> $ ${command}`);
|
|
66582
66508
|
},
|
|
66583
66509
|
onStdout(data) {
|
|
66584
66510
|
process.stdout.write(data);
|