vapi-network 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +74 -34
- package/dist/cli.js.map +1 -1
- package/dist/index.js +74 -34
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -46670,7 +46670,7 @@ function csvCell(value) {
|
|
|
46670
46670
|
import { mkdir as mkdir6, writeFile as writeFile4 } from "node:fs/promises";
|
|
46671
46671
|
import { arch, platform, release } from "node:os";
|
|
46672
46672
|
import { join as join2 } from "node:path";
|
|
46673
|
-
var VAPI_CLIENT_VERSION = "0.2.
|
|
46673
|
+
var VAPI_CLIENT_VERSION = "0.2.1";
|
|
46674
46674
|
async function createSupportReport(options) {
|
|
46675
46675
|
const message = options.message.trim();
|
|
46676
46676
|
if (!message) throw new Error("Support report message must not be empty.");
|
|
@@ -48802,22 +48802,32 @@ function asRecord(value) {
|
|
|
48802
48802
|
|
|
48803
48803
|
// ../cli/src/brand.ts
|
|
48804
48804
|
var MARK_SOURCE_WIDTH = 743;
|
|
48805
|
-
var
|
|
48806
|
-
var
|
|
48807
|
-
var
|
|
48805
|
+
var MARK_SOURCE_HEIGHT = 659;
|
|
48806
|
+
var MARK_SOURCE_ROW_HEIGHT = 217;
|
|
48807
|
+
var MARK_COLUMNS = 28;
|
|
48808
|
+
var MARK_ROWS = 12;
|
|
48809
|
+
var PLAIN_BLOCK = "\u2588";
|
|
48808
48810
|
var MARK_STEP_MS = 70;
|
|
48809
48811
|
var WORDMARK = "vAPI Network";
|
|
48810
|
-
var
|
|
48811
|
-
var
|
|
48812
|
-
|
|
48813
|
-
|
|
48812
|
+
var WELCOME = "Welcome to the vAPI Network";
|
|
48813
|
+
var TAGLINE = [
|
|
48814
|
+
"The trusted network where agents and humans do business.",
|
|
48815
|
+
"Search APIs, pay per call, keep receipts. More coming soon."
|
|
48816
|
+
];
|
|
48817
|
+
var ESC = "\x1B";
|
|
48818
|
+
var RESET = `${ESC}[0m`;
|
|
48819
|
+
var REVERSE = `${ESC}[7m`;
|
|
48820
|
+
var BOLD = `${ESC}[1m`;
|
|
48821
|
+
var DIM = `${ESC}[2m`;
|
|
48822
|
+
var HIDE_CURSOR = `${ESC}[?25l`;
|
|
48823
|
+
var SHOW_CURSOR = `${ESC}[?25h`;
|
|
48814
48824
|
var MARK_PALETTE = {
|
|
48815
|
-
orange: "#
|
|
48816
|
-
pink: "#
|
|
48817
|
-
lime: "#
|
|
48818
|
-
cyan: "#
|
|
48819
|
-
blue: "#
|
|
48820
|
-
purple: "#
|
|
48825
|
+
orange: "#ff7300",
|
|
48826
|
+
pink: "#ff337c",
|
|
48827
|
+
lime: "#c3ff3d",
|
|
48828
|
+
cyan: "#97efff",
|
|
48829
|
+
blue: "#0041eb",
|
|
48830
|
+
purple: "#8a37fb",
|
|
48821
48831
|
ink: null
|
|
48822
48832
|
};
|
|
48823
48833
|
var MARK_BLOCKS = [
|
|
@@ -48855,36 +48865,64 @@ function renderMarkFrames(options = {}) {
|
|
|
48855
48865
|
}
|
|
48856
48866
|
function renderBanner(options) {
|
|
48857
48867
|
const frames = renderMarkFrames(options);
|
|
48858
|
-
return
|
|
48868
|
+
return renderBox(frames[frames.length - 1], options).join("\n");
|
|
48859
48869
|
}
|
|
48860
48870
|
async function animateBanner(options) {
|
|
48861
48871
|
const frames = renderMarkFrames({ color: options.color !== false });
|
|
48862
48872
|
const sleep = options.sleep ?? defaultSleep;
|
|
48863
48873
|
const stepMs = options.stepMs ?? MARK_STEP_MS;
|
|
48874
|
+
const boxes = frames.map((frame) => renderBox(frame, options));
|
|
48875
|
+
const height = boxes[0].length;
|
|
48864
48876
|
options.write(HIDE_CURSOR);
|
|
48865
48877
|
try {
|
|
48866
|
-
for (const [index2,
|
|
48867
|
-
if (index2 > 0) options.write(
|
|
48868
|
-
options.write(
|
|
48869
|
-
|
|
48870
|
-
|
|
48871
|
-
);
|
|
48872
|
-
if (index2 < frames.length - 1) await sleep(stepMs);
|
|
48878
|
+
for (const [index2, box] of boxes.entries()) {
|
|
48879
|
+
if (index2 > 0) options.write(`${ESC}[${height}A`);
|
|
48880
|
+
options.write(box.map((line) => `\r${ESC}[2K${line}
|
|
48881
|
+
`).join(""));
|
|
48882
|
+
if (index2 < boxes.length - 1) await sleep(stepMs);
|
|
48873
48883
|
}
|
|
48874
48884
|
} finally {
|
|
48875
48885
|
options.write(SHOW_CURSOR);
|
|
48876
48886
|
}
|
|
48877
|
-
|
|
48878
|
-
|
|
48879
|
-
options.
|
|
48880
|
-
|
|
48887
|
+
}
|
|
48888
|
+
function renderBox(frame, options) {
|
|
48889
|
+
const color = options.color === true;
|
|
48890
|
+
const text = [
|
|
48891
|
+
{ value: WELCOME, style: BOLD },
|
|
48892
|
+
{ value: "", style: "" },
|
|
48893
|
+
...TAGLINE.map((line) => ({ value: line, style: "" })),
|
|
48894
|
+
{ value: "", style: "" },
|
|
48895
|
+
{ value: `${WORDMARK} v${options.version}`, style: DIM }
|
|
48896
|
+
];
|
|
48897
|
+
const textWidth = Math.max(...text.map((line) => line.value.length));
|
|
48898
|
+
const gap = 3;
|
|
48899
|
+
const inner = 2 + MARK_COLUMNS + gap + textWidth + 2;
|
|
48900
|
+
const markLines = frame.split("\n");
|
|
48901
|
+
const textTop = Math.floor((MARK_ROWS - text.length) / 2);
|
|
48902
|
+
const lines = [];
|
|
48903
|
+
lines.push(`\u256D${"\u2500".repeat(inner)}\u256E`);
|
|
48904
|
+
lines.push(`\u2502${" ".repeat(inner)}\u2502`);
|
|
48905
|
+
for (let row = 0; row < MARK_ROWS; row += 1) {
|
|
48906
|
+
const mark = markLines[row] ?? "";
|
|
48907
|
+
const markPad = " ".repeat(Math.max(0, MARK_COLUMNS - visibleLength(mark)));
|
|
48908
|
+
const entry = text[row - textTop];
|
|
48909
|
+
const raw = entry?.value ?? "";
|
|
48910
|
+
const styled = color && entry && entry.style && raw ? `${entry.style}${raw}${RESET}` : raw;
|
|
48911
|
+
const textPad = " ".repeat(textWidth - raw.length);
|
|
48912
|
+
lines.push(`\u2502 ${mark}${markPad}${" ".repeat(gap)}${styled}${textPad} \u2502`);
|
|
48913
|
+
}
|
|
48914
|
+
lines.push(`\u2502${" ".repeat(inner)}\u2502`);
|
|
48915
|
+
lines.push(`\u2570${"\u2500".repeat(inner)}\u256F`);
|
|
48916
|
+
return lines;
|
|
48881
48917
|
}
|
|
48882
48918
|
function renderFrame(blocks, color) {
|
|
48883
48919
|
const rows = [];
|
|
48884
48920
|
for (let row = 0; row < MARK_ROWS; row += 1) {
|
|
48921
|
+
const sourceY = row * MARK_SOURCE_HEIGHT / MARK_ROWS;
|
|
48922
|
+
const band = Math.min(2, Math.floor(sourceY / MARK_SOURCE_ROW_HEIGHT));
|
|
48885
48923
|
rows.push(
|
|
48886
48924
|
renderRow(
|
|
48887
|
-
blocks.filter((block) => block.row ===
|
|
48925
|
+
blocks.filter((block) => block.row === band),
|
|
48888
48926
|
color
|
|
48889
48927
|
)
|
|
48890
48928
|
);
|
|
@@ -48902,11 +48940,10 @@ function renderRow(blocks, color) {
|
|
|
48902
48940
|
column = start;
|
|
48903
48941
|
}
|
|
48904
48942
|
const width = scaleWidth(block.width);
|
|
48905
|
-
|
|
48906
|
-
line += color ? `${ansiPrefix(block.color)}${glyphs}${RESET}` : glyphs;
|
|
48943
|
+
line += color ? `${cellPrefix(block.color)}${" ".repeat(width)}${RESET}` : PLAIN_BLOCK.repeat(width);
|
|
48907
48944
|
column += width;
|
|
48908
48945
|
}
|
|
48909
|
-
return line;
|
|
48946
|
+
return line + " ".repeat(Math.max(0, MARK_COLUMNS - column));
|
|
48910
48947
|
}
|
|
48911
48948
|
function scaleColumn(x) {
|
|
48912
48949
|
return Math.round(x * MARK_COLUMNS / MARK_SOURCE_WIDTH);
|
|
@@ -48914,11 +48951,14 @@ function scaleColumn(x) {
|
|
|
48914
48951
|
function scaleWidth(width) {
|
|
48915
48952
|
return Math.max(1, Math.round(width * MARK_COLUMNS / MARK_SOURCE_WIDTH));
|
|
48916
48953
|
}
|
|
48917
|
-
function
|
|
48954
|
+
function cellPrefix(color) {
|
|
48918
48955
|
const hex3 = MARK_PALETTE[color];
|
|
48919
|
-
if (hex3 === null) return
|
|
48956
|
+
if (hex3 === null) return REVERSE;
|
|
48920
48957
|
const value = Number.parseInt(hex3.slice(1), 16);
|
|
48921
|
-
return
|
|
48958
|
+
return `${ESC}[48;2;${value >> 16 & 255};${value >> 8 & 255};${value & 255}m`;
|
|
48959
|
+
}
|
|
48960
|
+
function visibleLength(line) {
|
|
48961
|
+
return line.replace(new RegExp(`${ESC}\\[[0-9;?]*[A-Za-z]`, "g"), "").length;
|
|
48922
48962
|
}
|
|
48923
48963
|
function defaultSleep(milliseconds) {
|
|
48924
48964
|
return new Promise((resolve) => {
|
|
@@ -48927,7 +48967,7 @@ function defaultSleep(milliseconds) {
|
|
|
48927
48967
|
}
|
|
48928
48968
|
|
|
48929
48969
|
// ../cli/src/version.ts
|
|
48930
|
-
var CLI_VERSION = "0.2.
|
|
48970
|
+
var CLI_VERSION = "0.2.1";
|
|
48931
48971
|
|
|
48932
48972
|
// ../cli/src/cli.ts
|
|
48933
48973
|
var HELP_HEADING = "vAPI Network";
|