@iqai/adk 0.3.2 → 0.3.3
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/CHANGELOG.md +6 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +39 -16
- package/dist/index.mjs +39 -16
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -82,7 +82,8 @@ var init_logger = __esm({
|
|
|
82
82
|
title: `${icon} ${this.capitalize(level)} @ ${time} (${this.name})`,
|
|
83
83
|
description: message,
|
|
84
84
|
lines,
|
|
85
|
-
color
|
|
85
|
+
color,
|
|
86
|
+
wrap: true
|
|
86
87
|
});
|
|
87
88
|
method(box);
|
|
88
89
|
} else {
|
|
@@ -109,7 +110,7 @@ var init_logger = __esm({
|
|
|
109
110
|
}
|
|
110
111
|
formatArgs(args, includeStack = false) {
|
|
111
112
|
const lines = [];
|
|
112
|
-
const maxFrames = Number(process.env.ADK_ERROR_STACK_FRAMES
|
|
113
|
+
const maxFrames = process.env.ADK_ERROR_STACK_FRAMES !== void 0 ? Number(process.env.ADK_ERROR_STACK_FRAMES) : Number.POSITIVE_INFINITY;
|
|
113
114
|
for (const arg of args) {
|
|
114
115
|
if (!arg) continue;
|
|
115
116
|
if (arg instanceof Error) {
|
|
@@ -161,7 +162,8 @@ var init_logger = __esm({
|
|
|
161
162
|
maxWidthPct = 0.9,
|
|
162
163
|
color = _chalk2.default.yellow,
|
|
163
164
|
pad = 1,
|
|
164
|
-
borderChar = "\u2500"
|
|
165
|
+
borderChar = "\u2500",
|
|
166
|
+
wrap = false
|
|
165
167
|
} = params;
|
|
166
168
|
const isProd = process.env.NODE_ENV === "production";
|
|
167
169
|
const forceBoxes = process.env.ADK_FORCE_BOXES === "true";
|
|
@@ -181,20 +183,41 @@ var init_logger = __esm({
|
|
|
181
183
|
const top = `\u250C${horizontal}\u2510`;
|
|
182
184
|
const separator = `\u251C${horizontal}\u2524`;
|
|
183
185
|
const bottom = `\u2514${horizontal}\u2518`;
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
const maxContent = innerWidth - pad * 2;
|
|
187
|
+
const wrapText = (text) => {
|
|
188
|
+
if (!wrap) {
|
|
189
|
+
const truncated = text.length > maxContent ? `${text.slice(0, maxContent - 1)}\u2026` : text;
|
|
190
|
+
const padded = " ".repeat(pad) + truncated;
|
|
191
|
+
return [padded + " ".repeat(innerWidth - padded.length)];
|
|
192
|
+
}
|
|
193
|
+
const out = [];
|
|
194
|
+
let remaining = text;
|
|
195
|
+
while (remaining.length > 0) {
|
|
196
|
+
if (remaining.length <= maxContent) {
|
|
197
|
+
const padded2 = " ".repeat(pad) + remaining;
|
|
198
|
+
out.push(padded2 + " ".repeat(innerWidth - padded2.length));
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
let sliceEnd = maxContent;
|
|
202
|
+
const slice = remaining.slice(0, maxContent + 1);
|
|
203
|
+
const lastSpace = slice.lastIndexOf(" ");
|
|
204
|
+
if (lastSpace > -1 && lastSpace >= Math.floor(maxContent * 0.6)) {
|
|
205
|
+
sliceEnd = lastSpace;
|
|
206
|
+
}
|
|
207
|
+
const chunk = remaining.slice(0, sliceEnd).trimEnd();
|
|
208
|
+
const padded = " ".repeat(pad) + chunk;
|
|
209
|
+
out.push(padded + " ".repeat(innerWidth - padded.length));
|
|
210
|
+
remaining = remaining.slice(sliceEnd).trimStart();
|
|
211
|
+
}
|
|
212
|
+
return out;
|
|
189
213
|
};
|
|
190
|
-
const content = [
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
];
|
|
214
|
+
const content = [top];
|
|
215
|
+
for (const l of wrapText(title)) content.push(`\u2502 ${l} \u2502`);
|
|
216
|
+
content.push(separator);
|
|
217
|
+
for (const l of wrapText(description)) content.push(`\u2502 ${l} \u2502`);
|
|
218
|
+
for (const line of lines)
|
|
219
|
+
for (const l of wrapText(line)) content.push(`\u2502 ${l} \u2502`);
|
|
220
|
+
content.push(bottom);
|
|
198
221
|
return `
|
|
199
222
|
${content.map((line) => color(line)).join("\n")}`;
|
|
200
223
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -82,7 +82,8 @@ var init_logger = __esm({
|
|
|
82
82
|
title: `${icon} ${this.capitalize(level)} @ ${time} (${this.name})`,
|
|
83
83
|
description: message,
|
|
84
84
|
lines,
|
|
85
|
-
color
|
|
85
|
+
color,
|
|
86
|
+
wrap: true
|
|
86
87
|
});
|
|
87
88
|
method(box);
|
|
88
89
|
} else {
|
|
@@ -109,7 +110,7 @@ var init_logger = __esm({
|
|
|
109
110
|
}
|
|
110
111
|
formatArgs(args, includeStack = false) {
|
|
111
112
|
const lines = [];
|
|
112
|
-
const maxFrames = Number(process.env.ADK_ERROR_STACK_FRAMES
|
|
113
|
+
const maxFrames = process.env.ADK_ERROR_STACK_FRAMES !== void 0 ? Number(process.env.ADK_ERROR_STACK_FRAMES) : Number.POSITIVE_INFINITY;
|
|
113
114
|
for (const arg of args) {
|
|
114
115
|
if (!arg) continue;
|
|
115
116
|
if (arg instanceof Error) {
|
|
@@ -161,7 +162,8 @@ var init_logger = __esm({
|
|
|
161
162
|
maxWidthPct = 0.9,
|
|
162
163
|
color = chalk.yellow,
|
|
163
164
|
pad = 1,
|
|
164
|
-
borderChar = "\u2500"
|
|
165
|
+
borderChar = "\u2500",
|
|
166
|
+
wrap = false
|
|
165
167
|
} = params;
|
|
166
168
|
const isProd = process.env.NODE_ENV === "production";
|
|
167
169
|
const forceBoxes = process.env.ADK_FORCE_BOXES === "true";
|
|
@@ -181,20 +183,41 @@ var init_logger = __esm({
|
|
|
181
183
|
const top = `\u250C${horizontal}\u2510`;
|
|
182
184
|
const separator = `\u251C${horizontal}\u2524`;
|
|
183
185
|
const bottom = `\u2514${horizontal}\u2518`;
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
const maxContent = innerWidth - pad * 2;
|
|
187
|
+
const wrapText = (text) => {
|
|
188
|
+
if (!wrap) {
|
|
189
|
+
const truncated = text.length > maxContent ? `${text.slice(0, maxContent - 1)}\u2026` : text;
|
|
190
|
+
const padded = " ".repeat(pad) + truncated;
|
|
191
|
+
return [padded + " ".repeat(innerWidth - padded.length)];
|
|
192
|
+
}
|
|
193
|
+
const out = [];
|
|
194
|
+
let remaining = text;
|
|
195
|
+
while (remaining.length > 0) {
|
|
196
|
+
if (remaining.length <= maxContent) {
|
|
197
|
+
const padded2 = " ".repeat(pad) + remaining;
|
|
198
|
+
out.push(padded2 + " ".repeat(innerWidth - padded2.length));
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
let sliceEnd = maxContent;
|
|
202
|
+
const slice = remaining.slice(0, maxContent + 1);
|
|
203
|
+
const lastSpace = slice.lastIndexOf(" ");
|
|
204
|
+
if (lastSpace > -1 && lastSpace >= Math.floor(maxContent * 0.6)) {
|
|
205
|
+
sliceEnd = lastSpace;
|
|
206
|
+
}
|
|
207
|
+
const chunk = remaining.slice(0, sliceEnd).trimEnd();
|
|
208
|
+
const padded = " ".repeat(pad) + chunk;
|
|
209
|
+
out.push(padded + " ".repeat(innerWidth - padded.length));
|
|
210
|
+
remaining = remaining.slice(sliceEnd).trimStart();
|
|
211
|
+
}
|
|
212
|
+
return out;
|
|
189
213
|
};
|
|
190
|
-
const content = [
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
];
|
|
214
|
+
const content = [top];
|
|
215
|
+
for (const l of wrapText(title)) content.push(`\u2502 ${l} \u2502`);
|
|
216
|
+
content.push(separator);
|
|
217
|
+
for (const l of wrapText(description)) content.push(`\u2502 ${l} \u2502`);
|
|
218
|
+
for (const line of lines)
|
|
219
|
+
for (const l of wrapText(line)) content.push(`\u2502 ${l} \u2502`);
|
|
220
|
+
content.push(bottom);
|
|
198
221
|
return `
|
|
199
222
|
${content.map((line) => color(line)).join("\n")}`;
|
|
200
223
|
}
|