@aeye/cletus 0.1.0 → 0.1.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/README.md +2 -2
- package/dist/index.js +257 -93
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @aeye/cletus
|
|
2
2
|
|
|
3
|
-
> **Interactive CLI demo showcasing
|
|
3
|
+
> **Interactive CLI demo showcasing @aeye capabilities - an AI-powered assistant with file management, data operations, and autonomous task execution.**
|
|
4
4
|
|
|
5
5
|
Cletus is a terminal-based AI assistant built with the @aeye library that demonstrates the power of multi-provider AI integration, tool calling, and context management. It features a beautiful TUI (Terminal User Interface) powered by React/Ink and provides specialized AI agents for different domains like file operations, data management, image generation, and web searching.
|
|
6
6
|
|
|
@@ -601,7 +601,7 @@ npm run typecheck
|
|
|
601
601
|
|
|
602
602
|
## Contributing
|
|
603
603
|
|
|
604
|
-
Contributions are welcome! Please see the main [
|
|
604
|
+
Contributions are welcome! Please see the main [@aeye repository](https://github.com/ClickerMonkey/aeye) for contribution guidelines.
|
|
605
605
|
|
|
606
606
|
## License
|
|
607
607
|
|
package/dist/index.js
CHANGED
|
@@ -22935,9 +22935,9 @@ var COLORS = {
|
|
|
22935
22935
|
{ color: "rgb(0,95,95)", bold: true },
|
|
22936
22936
|
{ color: "rgb(0,60,60)", bold: false }
|
|
22937
22937
|
],
|
|
22938
|
-
MARKDOWN_CODE_BACKGROUND: "rgb(
|
|
22939
|
-
MARKDOWN_LINK: "rgb(15,
|
|
22940
|
-
MARKDOWN_BLOCKQUOTE: "rgb(
|
|
22938
|
+
MARKDOWN_CODE_BACKGROUND: "rgb(25,25,25)",
|
|
22939
|
+
MARKDOWN_LINK: "rgb(15,101,187)",
|
|
22940
|
+
MARKDOWN_BLOCKQUOTE: "rgb(30,30,30)",
|
|
22941
22941
|
// Other UI elements
|
|
22942
22942
|
DIM_TEXT: "gray"
|
|
22943
22943
|
};
|
|
@@ -24011,13 +24011,14 @@ var Link = ({ url, children }) => {
|
|
|
24011
24011
|
var parseInlineFormatting = (text) => {
|
|
24012
24012
|
if (!text) return [];
|
|
24013
24013
|
const codeSegments = [];
|
|
24014
|
-
const codeRegex = /`([^`]+)`/g;
|
|
24014
|
+
const codeRegex = /`(([^`]|\\`)+)`/g;
|
|
24015
24015
|
let match;
|
|
24016
24016
|
while ((match = codeRegex.exec(text)) !== null) {
|
|
24017
24017
|
codeSegments.push({
|
|
24018
24018
|
start: match.index,
|
|
24019
24019
|
end: match.index + match[0].length,
|
|
24020
|
-
content: match[1]
|
|
24020
|
+
content: match[1].replace(/\\`/g, "`")
|
|
24021
|
+
// Unescape backticks
|
|
24021
24022
|
});
|
|
24022
24023
|
}
|
|
24023
24024
|
const linkSegments = [];
|
|
@@ -24035,14 +24036,14 @@ var parseInlineFormatting = (text) => {
|
|
|
24035
24036
|
protectedRanges.push({
|
|
24036
24037
|
start: code.start,
|
|
24037
24038
|
end: code.end,
|
|
24038
|
-
segment: { text: code.content, backgroundColor: COLORS.MARKDOWN_CODE_BACKGROUND }
|
|
24039
|
+
segment: { text: code.content, styles: { backgroundColor: COLORS.MARKDOWN_CODE_BACKGROUND } }
|
|
24039
24040
|
});
|
|
24040
24041
|
}
|
|
24041
24042
|
for (const link of linkSegments) {
|
|
24042
24043
|
protectedRanges.push({
|
|
24043
24044
|
start: link.start,
|
|
24044
24045
|
end: link.end,
|
|
24045
|
-
segment: { text: link.text, url: link.url
|
|
24046
|
+
segment: { text: link.text, url: link.url }
|
|
24046
24047
|
});
|
|
24047
24048
|
}
|
|
24048
24049
|
protectedRanges.sort((a, b) => a.start - b.start);
|
|
@@ -24080,10 +24081,12 @@ var applyFormatting = (text) => {
|
|
|
24080
24081
|
markers.push({ index: match.index, type: "bold", isStart: true, length: 2 });
|
|
24081
24082
|
markers.push({ index: match.index + match[0].length - 2, type: "bold", isStart: false, length: 2 });
|
|
24082
24083
|
}
|
|
24083
|
-
const italicRegex = /(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)/g;
|
|
24084
|
+
const italicRegex = /(?<!\*)(\*)(?!\*)(.+?)(?<!\*)(\*)(?!\*)|(?<!_)(_)(?!_)(.+?)(?<!_)(_)(?!_)/g;
|
|
24084
24085
|
while ((match = italicRegex.exec(text)) !== null) {
|
|
24085
|
-
|
|
24086
|
-
|
|
24086
|
+
const startIndex = match[1] ? match.index : match.index;
|
|
24087
|
+
const content = match[2] || match[5];
|
|
24088
|
+
markers.push({ index: startIndex, type: "italic", isStart: true, length: 1 });
|
|
24089
|
+
markers.push({ index: startIndex + content.length + 1, type: "italic", isStart: false, length: 1 });
|
|
24087
24090
|
}
|
|
24088
24091
|
const underlineRegex = /__(.+?)__/g;
|
|
24089
24092
|
while ((match = underlineRegex.exec(text)) !== null) {
|
|
@@ -24099,108 +24102,228 @@ var applyFormatting = (text) => {
|
|
|
24099
24102
|
return [{ text }];
|
|
24100
24103
|
}
|
|
24101
24104
|
markers.sort((a, b) => a.index - b.index);
|
|
24102
|
-
const
|
|
24105
|
+
const activeStyles = { bold: false, italic: false, underline: false, strikethrough: false };
|
|
24103
24106
|
let lastPos = 0;
|
|
24104
24107
|
markers.forEach((marker) => {
|
|
24105
24108
|
if (marker.index > lastPos) {
|
|
24106
24109
|
const segment = text.substring(lastPos, marker.index);
|
|
24107
24110
|
if (segment) {
|
|
24108
|
-
segments.push({ text: segment, ...
|
|
24111
|
+
segments.push({ text: segment, styles: { ...activeStyles } });
|
|
24109
24112
|
}
|
|
24110
24113
|
}
|
|
24111
|
-
|
|
24112
|
-
activeFormats[marker.type] = true;
|
|
24113
|
-
} else {
|
|
24114
|
-
activeFormats[marker.type] = false;
|
|
24115
|
-
}
|
|
24114
|
+
activeStyles[marker.type] = marker.isStart;
|
|
24116
24115
|
lastPos = marker.index + marker.length;
|
|
24117
24116
|
});
|
|
24118
24117
|
if (lastPos < text.length) {
|
|
24119
24118
|
const segment = text.substring(lastPos);
|
|
24120
24119
|
if (segment) {
|
|
24121
|
-
segments.push({ text: segment, ...
|
|
24120
|
+
segments.push({ text: segment, styles: { ...activeStyles } });
|
|
24122
24121
|
}
|
|
24123
24122
|
}
|
|
24124
24123
|
return segments;
|
|
24125
24124
|
};
|
|
24126
|
-
var
|
|
24127
|
-
const lines =
|
|
24128
|
-
const
|
|
24129
|
-
let
|
|
24130
|
-
|
|
24131
|
-
|
|
24125
|
+
var renderMarkdownContent = (content, nestingLevel = 0) => {
|
|
24126
|
+
const lines = content.split("\n");
|
|
24127
|
+
const result = [];
|
|
24128
|
+
let i = 0;
|
|
24129
|
+
while (i < lines.length) {
|
|
24130
|
+
const line = lines[i];
|
|
24132
24131
|
if (line.trim().startsWith("```")) {
|
|
24133
|
-
|
|
24134
|
-
|
|
24135
|
-
|
|
24136
|
-
|
|
24137
|
-
|
|
24138
|
-
|
|
24139
|
-
|
|
24140
|
-
|
|
24141
|
-
|
|
24142
|
-
|
|
24143
|
-
|
|
24144
|
-
|
|
24145
|
-
|
|
24146
|
-
|
|
24132
|
+
const language = line.trim().substring(3).trim() || void 0;
|
|
24133
|
+
const codeLines = [];
|
|
24134
|
+
let j = i + 1;
|
|
24135
|
+
while (j < lines.length && !lines[j].trim().startsWith("```")) {
|
|
24136
|
+
codeLines.push(lines[j]);
|
|
24137
|
+
j++;
|
|
24138
|
+
}
|
|
24139
|
+
result.push(
|
|
24140
|
+
/* @__PURE__ */ React2.createElement(Box, { key: `codeblock-${i}`, flexGrow: 1, backgroundColor: COLORS.MARKDOWN_CODE_BACKGROUND, paddingX: 1 }, /* @__PURE__ */ React2.createElement(SyntaxHighlight, { key: `code-${i}`, code: codeLines.join("\n"), language }))
|
|
24141
|
+
);
|
|
24142
|
+
i = j + 1;
|
|
24143
|
+
continue;
|
|
24144
|
+
}
|
|
24145
|
+
const blockquoteMatch = line.match(/^((?:>\s?)+)(.*)$/);
|
|
24146
|
+
if (blockquoteMatch) {
|
|
24147
|
+
const [, quoteMarkers, quoteText] = blockquoteMatch;
|
|
24148
|
+
const quoteLevel = (quoteMarkers.match(/>/g) || []).length;
|
|
24149
|
+
const blockLines = [quoteText];
|
|
24150
|
+
let j = i + 1;
|
|
24151
|
+
while (j < lines.length) {
|
|
24152
|
+
const nextLine = lines[j];
|
|
24153
|
+
const nextMatch = nextLine.match(/^((?:>\s?)+)(.*)$/);
|
|
24154
|
+
if (nextMatch) {
|
|
24155
|
+
const nextQuoteLevel = (nextMatch[1].match(/>/g) || []).length;
|
|
24156
|
+
if (nextQuoteLevel >= quoteLevel) {
|
|
24157
|
+
const remainingMarkers = "> ".repeat(nextQuoteLevel - quoteLevel);
|
|
24158
|
+
blockLines.push(remainingMarkers + nextMatch[2]);
|
|
24159
|
+
j++;
|
|
24160
|
+
} else {
|
|
24161
|
+
break;
|
|
24162
|
+
}
|
|
24147
24163
|
} else {
|
|
24148
|
-
|
|
24149
|
-
groups.push(currentGroup);
|
|
24164
|
+
break;
|
|
24150
24165
|
}
|
|
24151
24166
|
}
|
|
24167
|
+
result.push(
|
|
24168
|
+
/* @__PURE__ */ React2.createElement(
|
|
24169
|
+
Box,
|
|
24170
|
+
{
|
|
24171
|
+
key: `blockquote-${i}`,
|
|
24172
|
+
marginLeft: nestingLevel,
|
|
24173
|
+
paddingLeft: 1,
|
|
24174
|
+
paddingRight: 1,
|
|
24175
|
+
backgroundColor: COLORS.MARKDOWN_BLOCKQUOTE,
|
|
24176
|
+
borderStyle: "bold",
|
|
24177
|
+
borderLeft: true,
|
|
24178
|
+
borderTop: false,
|
|
24179
|
+
borderBottom: false,
|
|
24180
|
+
borderRight: false,
|
|
24181
|
+
flexGrow: 1,
|
|
24182
|
+
flexDirection: "column"
|
|
24183
|
+
},
|
|
24184
|
+
renderMarkdownContent(blockLines.join("\n"), nestingLevel + 1)
|
|
24185
|
+
)
|
|
24186
|
+
);
|
|
24187
|
+
i = j;
|
|
24188
|
+
continue;
|
|
24189
|
+
}
|
|
24190
|
+
const isTableRow = line.trim().match(/^\|(.+)\|$/);
|
|
24191
|
+
if (isTableRow) {
|
|
24192
|
+
const tableLines = [line];
|
|
24193
|
+
let j = i + 1;
|
|
24194
|
+
while (j < lines.length && lines[j].trim().match(/^\|(.+)\|$/)) {
|
|
24195
|
+
tableLines.push(lines[j]);
|
|
24196
|
+
j++;
|
|
24197
|
+
}
|
|
24198
|
+
result.push(renderTable(tableLines, i));
|
|
24199
|
+
i = j;
|
|
24200
|
+
continue;
|
|
24201
|
+
}
|
|
24202
|
+
if (line.trim().match(/^(-{3,}|\*{3,}|_{3,})$/)) {
|
|
24203
|
+
result.push(
|
|
24204
|
+
/* @__PURE__ */ React2.createElement(Box, { key: `hr-${i}`, width: "100%", borderStyle: "bold", borderBottom: true, borderTop: false, borderLeft: false, borderRight: false, borderBottomDimColor: true })
|
|
24205
|
+
);
|
|
24206
|
+
i++;
|
|
24207
|
+
continue;
|
|
24208
|
+
}
|
|
24209
|
+
result.push(renderLine(line, i, nestingLevel));
|
|
24210
|
+
i++;
|
|
24211
|
+
}
|
|
24212
|
+
return result;
|
|
24213
|
+
};
|
|
24214
|
+
var splitTableCells = (line) => {
|
|
24215
|
+
const cells = [];
|
|
24216
|
+
let currentCell = "";
|
|
24217
|
+
let i = 0;
|
|
24218
|
+
while (i < line.length) {
|
|
24219
|
+
if (line[i] === "\\" && i + 1 < line.length && line[i + 1] === "|") {
|
|
24220
|
+
currentCell += "|";
|
|
24221
|
+
i += 2;
|
|
24222
|
+
} else if (line[i] === "|") {
|
|
24223
|
+
cells.push(currentCell.trim());
|
|
24224
|
+
currentCell = "";
|
|
24225
|
+
i++;
|
|
24226
|
+
} else {
|
|
24227
|
+
currentCell += line[i];
|
|
24228
|
+
i++;
|
|
24152
24229
|
}
|
|
24230
|
+
}
|
|
24231
|
+
if (currentCell || cells.length > 0) {
|
|
24232
|
+
cells.push(currentCell.trim());
|
|
24233
|
+
}
|
|
24234
|
+
return cells.filter((cell, idx) => cell !== "" || idx !== 0 && idx !== cells.length - 1);
|
|
24235
|
+
};
|
|
24236
|
+
var renderTable = (tableLines, key) => {
|
|
24237
|
+
if (tableLines.length < 2) return null;
|
|
24238
|
+
const headerCells = splitTableCells(tableLines[0]);
|
|
24239
|
+
const separatorCells = splitTableCells(tableLines[1]);
|
|
24240
|
+
const alignments = separatorCells.map((sep) => {
|
|
24241
|
+
if (sep.startsWith(":") && sep.endsWith(":")) return "center";
|
|
24242
|
+
if (sep.endsWith(":")) return "right";
|
|
24243
|
+
return "left";
|
|
24153
24244
|
});
|
|
24154
|
-
|
|
24155
|
-
|
|
24156
|
-
|
|
24245
|
+
const dataRows = tableLines.slice(2).map((line) => splitTableCells(line));
|
|
24246
|
+
const columnWidths = headerCells.map((header, colIdx) => {
|
|
24247
|
+
const headerWidth = header.length;
|
|
24248
|
+
const dataWidths = dataRows.map((row) => (row[colIdx] || "").length);
|
|
24249
|
+
const dataWidth = dataWidths.length > 0 ? Math.max(...dataWidths) : 0;
|
|
24250
|
+
return Math.max(headerWidth, dataWidth, 3);
|
|
24251
|
+
});
|
|
24252
|
+
const minWidth = Math.min(...columnWidths);
|
|
24253
|
+
const maxAllowedWidth = minWidth * 3;
|
|
24254
|
+
const constrainedWidths = columnWidths.map((x) => Math.min(x, maxAllowedWidth));
|
|
24255
|
+
const totalWidth = constrainedWidths.reduce((sum, w) => sum + w, 0);
|
|
24256
|
+
const percentages = constrainedWidths.map((w) => w / totalWidth * 100);
|
|
24257
|
+
const getStyles = (firstX, firstY, lastX, lastY) => {
|
|
24258
|
+
return {
|
|
24259
|
+
topLeft: firstX && firstY ? "\u250C" : firstY ? "\u252C" : firstX ? "\u251C" : "\u253C",
|
|
24260
|
+
top: "\u2500",
|
|
24261
|
+
topRight: lastX && firstY ? "\u2510" : firstY ? "\u252C" : lastX ? "\u2524" : "\u253C",
|
|
24262
|
+
right: "\u2502",
|
|
24263
|
+
bottomRight: lastX && lastY ? "\u2518" : lastY ? "\u2534" : lastX ? "\u2524" : "\u253C",
|
|
24264
|
+
bottom: "\u2500",
|
|
24265
|
+
bottomLeft: firstX && lastY ? "\u2514" : lastY ? "\u2534" : firstX ? "\u251C" : "\u253C",
|
|
24266
|
+
left: "\u2502"
|
|
24267
|
+
};
|
|
24268
|
+
};
|
|
24269
|
+
return /* @__PURE__ */ React2.createElement(Box, { flexDirection: "column", width: "100%", key: `table-${key}` }, /* @__PURE__ */ React2.createElement(Box, { width: "100%", key: "header" }, headerCells.map((header, i) => /* @__PURE__ */ React2.createElement(
|
|
24270
|
+
Box,
|
|
24271
|
+
{
|
|
24272
|
+
key: i,
|
|
24273
|
+
width: `${percentages[i]}%`,
|
|
24274
|
+
borderStyle: getStyles(i === 0, true, i === headerCells.length - 1, false),
|
|
24275
|
+
borderLeft: i === 0,
|
|
24276
|
+
borderRight: true,
|
|
24277
|
+
borderTop: true,
|
|
24278
|
+
borderBottom: true,
|
|
24279
|
+
paddingX: 1
|
|
24280
|
+
},
|
|
24281
|
+
/* @__PURE__ */ React2.createElement(Text2, { bold: true, wrap: "wrap" }, renderInline(header))
|
|
24282
|
+
))), dataRows.map((row, rowIndex) => /* @__PURE__ */ React2.createElement(Box, { key: rowIndex, width: "100%" }, row.map((col, i) => /* @__PURE__ */ React2.createElement(
|
|
24283
|
+
Box,
|
|
24284
|
+
{
|
|
24285
|
+
key: i,
|
|
24286
|
+
width: `${percentages[i]}%`,
|
|
24287
|
+
borderStyle: getStyles(i === 0, false, i === row.length - 1, rowIndex === dataRows.length - 1),
|
|
24288
|
+
borderLeft: i === 0,
|
|
24289
|
+
borderRight: true,
|
|
24290
|
+
borderBottom: true,
|
|
24291
|
+
borderTop: false,
|
|
24292
|
+
paddingX: 1,
|
|
24293
|
+
justifyContent: alignments[i] === "center" ? "center" : alignments[i] === "right" ? "flex-end" : "flex-start"
|
|
24294
|
+
},
|
|
24295
|
+
/* @__PURE__ */ React2.createElement(Text2, { wrap: "wrap" }, renderInline(col))
|
|
24296
|
+
)))));
|
|
24297
|
+
};
|
|
24298
|
+
var renderLine = (line, key, nestingLevel = 0) => {
|
|
24299
|
+
const headingMatch = line.match(/^(\s*)([#]+)\s+(.*)/);
|
|
24300
|
+
if (headingMatch) {
|
|
24301
|
+
const [, leadingSpaces, hashes, headingText] = headingMatch;
|
|
24302
|
+
const level = Math.min(hashes.length - 1, COLORS.MAKRDOWN_HEADINGS.length - 1);
|
|
24303
|
+
const style = COLORS.MAKRDOWN_HEADINGS[level];
|
|
24304
|
+
if (leadingSpaces) {
|
|
24305
|
+
return /* @__PURE__ */ React2.createElement(Box, { key, marginLeft: leadingSpaces.length }, /* @__PURE__ */ React2.createElement(Text2, { ...style }, headingText));
|
|
24157
24306
|
} else {
|
|
24158
|
-
return /* @__PURE__ */ React2.createElement(
|
|
24159
|
-
const blockquoteMatch = line.match(/^(\s*)>\s+(.*)$/);
|
|
24160
|
-
if (blockquoteMatch) {
|
|
24161
|
-
const [, leadingSpaces, quoteText] = blockquoteMatch;
|
|
24162
|
-
const segments2 = parseInlineFormatting(quoteText);
|
|
24163
|
-
const segmentsGrouped2 = chunk(segments2, (a, b) => !a.url !== !b.url);
|
|
24164
|
-
return /* @__PURE__ */ React2.createElement(Box, { key: i, marginLeft: (leadingSpaces?.length || 0) + 2, borderStyle: "single", borderLeft: true, borderColor: COLORS.MARKDOWN_BLOCKQUOTE, paddingLeft: 1 }, /* @__PURE__ */ React2.createElement(Text2, { color: COLORS.MARKDOWN_BLOCKQUOTE }, segmentsGrouped2.map((segGroup, j) => {
|
|
24165
|
-
if (segGroup[0].url) {
|
|
24166
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, { key: j }, segGroup.map((seg, k) => /* @__PURE__ */ React2.createElement(Link, { key: k, url: seg.url }, seg.text)));
|
|
24167
|
-
} else {
|
|
24168
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, { key: j }, segGroup.map((seg, k) => /* @__PURE__ */ React2.createElement(Text2, { key: k, bold: seg.bold, italic: seg.italic, underline: seg.underline, strikethrough: seg.strikethrough, backgroundColor: seg.backgroundColor }, seg.text)));
|
|
24169
|
-
}
|
|
24170
|
-
})));
|
|
24171
|
-
}
|
|
24172
|
-
const headingMatch = line.match(/^(\s*)([#]+)\s+(.*)/);
|
|
24173
|
-
if (headingMatch) {
|
|
24174
|
-
const [, leadingSpaces, hashes, headingText] = headingMatch;
|
|
24175
|
-
const level = Math.min(hashes.length - 1, COLORS.MAKRDOWN_HEADINGS.length - 1);
|
|
24176
|
-
const style = COLORS.MAKRDOWN_HEADINGS[level];
|
|
24177
|
-
if (leadingSpaces) {
|
|
24178
|
-
return /* @__PURE__ */ React2.createElement(Box, { key: i, marginLeft: leadingSpaces.length }, /* @__PURE__ */ React2.createElement(Text2, { ...style }, headingText));
|
|
24179
|
-
} else {
|
|
24180
|
-
return /* @__PURE__ */ React2.createElement(Text2, { key: i, ...style }, headingText);
|
|
24181
|
-
}
|
|
24182
|
-
}
|
|
24183
|
-
if (line.startsWith("```")) {
|
|
24184
|
-
return null;
|
|
24185
|
-
}
|
|
24186
|
-
if (line.trim().startsWith("- ") || line.trim().startsWith("* ")) {
|
|
24187
|
-
line = line.replace(/^(\s*)([-*])(\s+)/, "$1\u2022$3");
|
|
24188
|
-
}
|
|
24189
|
-
if (line.trim() === "") {
|
|
24190
|
-
return /* @__PURE__ */ React2.createElement(Text2, { key: i }, " ");
|
|
24191
|
-
}
|
|
24192
|
-
const segments = parseInlineFormatting(line);
|
|
24193
|
-
const segmentsGrouped = chunk(segments, (a, b) => !a.url !== !b.url);
|
|
24194
|
-
return /* @__PURE__ */ React2.createElement(Box, { key: i, flexWrap: "wrap" }, segmentsGrouped.map((segGroup, j) => {
|
|
24195
|
-
if (segGroup[0].url) {
|
|
24196
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, { key: j }, segGroup.map((seg, k) => /* @__PURE__ */ React2.createElement(Link, { key: k, url: seg.url }, seg.text)));
|
|
24197
|
-
} else {
|
|
24198
|
-
return /* @__PURE__ */ React2.createElement(Text2, { key: j }, segGroup.map((seg, k) => /* @__PURE__ */ React2.createElement(Text2, { key: k, bold: seg.bold, italic: seg.italic, underline: seg.underline, strikethrough: seg.strikethrough, backgroundColor: seg.backgroundColor, color: seg.color }, seg.text)));
|
|
24199
|
-
}
|
|
24200
|
-
}));
|
|
24201
|
-
}));
|
|
24307
|
+
return /* @__PURE__ */ React2.createElement(Text2, { key, ...style }, headingText);
|
|
24202
24308
|
}
|
|
24203
|
-
}
|
|
24309
|
+
}
|
|
24310
|
+
if (line.startsWith("```")) {
|
|
24311
|
+
return null;
|
|
24312
|
+
}
|
|
24313
|
+
if (line.trim().startsWith("- ") || line.trim().startsWith("* ")) {
|
|
24314
|
+
line = line.replace(/^(\s*)([-*])(\s+)/, "$1\u2022$3");
|
|
24315
|
+
}
|
|
24316
|
+
if (line.trim() === "") {
|
|
24317
|
+
return /* @__PURE__ */ React2.createElement(Text2, { key }, " ");
|
|
24318
|
+
}
|
|
24319
|
+
return /* @__PURE__ */ React2.createElement(Box, { key, flexWrap: "wrap" }, renderInline(line));
|
|
24320
|
+
};
|
|
24321
|
+
var renderInline = (line, props) => {
|
|
24322
|
+
const segments = parseInlineFormatting(line);
|
|
24323
|
+
return /* @__PURE__ */ React2.createElement(Text2, { ...props }, segments.map((seg, j) => seg.url ? /* @__PURE__ */ React2.createElement(Link, { key: j, url: seg.url }, seg.text) : /* @__PURE__ */ React2.createElement(Text2, { key: j, ...seg.styles }, seg.text)));
|
|
24324
|
+
};
|
|
24325
|
+
var Markdown = ({ children }) => {
|
|
24326
|
+
return /* @__PURE__ */ React2.createElement(Box, { flexDirection: "column" }, renderMarkdownContent(children));
|
|
24204
24327
|
};
|
|
24205
24328
|
|
|
24206
24329
|
// src/helpers/render.tsx
|
|
@@ -24350,6 +24473,14 @@ async function getImagePath(createIfNotExists = false) {
|
|
|
24350
24473
|
}
|
|
24351
24474
|
return fullPath;
|
|
24352
24475
|
}
|
|
24476
|
+
async function configExists() {
|
|
24477
|
+
try {
|
|
24478
|
+
await fs5.access(getConfigPath());
|
|
24479
|
+
return true;
|
|
24480
|
+
} catch {
|
|
24481
|
+
return false;
|
|
24482
|
+
}
|
|
24483
|
+
}
|
|
24353
24484
|
|
|
24354
24485
|
// src/operations/architect.tsx
|
|
24355
24486
|
function validateTemplate(template, fields) {
|
|
@@ -30573,7 +30704,18 @@ var OperationApprovalMenu = ({
|
|
|
30573
30704
|
try {
|
|
30574
30705
|
const sessionSignal = onStart?.() || void 0;
|
|
30575
30706
|
const operations = message.operations || [];
|
|
30576
|
-
const manager = new OperationManager(
|
|
30707
|
+
const manager = new OperationManager(
|
|
30708
|
+
"none",
|
|
30709
|
+
operations,
|
|
30710
|
+
void 0,
|
|
30711
|
+
(op, operationIndex) => {
|
|
30712
|
+
const content = message.content.find((c) => c.operationIndex === operationIndex);
|
|
30713
|
+
if (content) {
|
|
30714
|
+
content.content = op.message || "";
|
|
30715
|
+
onMessageUpdate?.(message);
|
|
30716
|
+
}
|
|
30717
|
+
}
|
|
30718
|
+
);
|
|
30577
30719
|
const ctx = await getContext(sessionSignal);
|
|
30578
30720
|
let success = 0;
|
|
30579
30721
|
let failed = 0;
|
|
@@ -30633,6 +30775,11 @@ var OperationApprovalMenu = ({
|
|
|
30633
30775
|
for (const idx of indices) {
|
|
30634
30776
|
operations[idx].status = "rejected";
|
|
30635
30777
|
operations[idx].message = `Operation ${operations[idx].type} rejected by user`;
|
|
30778
|
+
const content = message.content.find((c) => c.operationIndex === idx);
|
|
30779
|
+
if (content) {
|
|
30780
|
+
content.content = operations[idx].message || "";
|
|
30781
|
+
onMessageUpdate?.(message);
|
|
30782
|
+
}
|
|
30636
30783
|
}
|
|
30637
30784
|
const summaryText = indices.length === 1 ? "Operation rejected" : `${indices.length} operations rejected`;
|
|
30638
30785
|
message.content.push({
|
|
@@ -30702,7 +30849,18 @@ var OperationApprovalMenu = ({
|
|
|
30702
30849
|
try {
|
|
30703
30850
|
const sessionSignal = onStart?.() || void 0;
|
|
30704
30851
|
const operations = message.operations || [];
|
|
30705
|
-
const manager = new OperationManager(
|
|
30852
|
+
const manager = new OperationManager(
|
|
30853
|
+
"none",
|
|
30854
|
+
operations,
|
|
30855
|
+
void 0,
|
|
30856
|
+
(op, operationIndex) => {
|
|
30857
|
+
const content = message.content.find((c) => c.operationIndex === operationIndex);
|
|
30858
|
+
if (content) {
|
|
30859
|
+
content.content = op.message || "";
|
|
30860
|
+
onMessageUpdate?.(message);
|
|
30861
|
+
}
|
|
30862
|
+
}
|
|
30863
|
+
);
|
|
30706
30864
|
const ctx = await getContext(sessionSignal);
|
|
30707
30865
|
let success = 0;
|
|
30708
30866
|
let failed = 0;
|
|
@@ -30718,6 +30876,11 @@ var OperationApprovalMenu = ({
|
|
|
30718
30876
|
for (const idx of rejected) {
|
|
30719
30877
|
operations[idx].status = "rejected";
|
|
30720
30878
|
operations[idx].message = `Operation ${operations[idx].type} rejected by user`;
|
|
30879
|
+
const content = message.content.find((c) => c.operationIndex === idx);
|
|
30880
|
+
if (content) {
|
|
30881
|
+
content.content = operations[idx].message || "";
|
|
30882
|
+
onMessageUpdate?.(message);
|
|
30883
|
+
}
|
|
30721
30884
|
}
|
|
30722
30885
|
const elapsed = performance.now() - startTime;
|
|
30723
30886
|
const parts = [];
|
|
@@ -35326,12 +35489,13 @@ var App = () => {
|
|
|
35326
35489
|
const [selectedChatId, setSelectedChatId] = useState10(null);
|
|
35327
35490
|
React14.useEffect(() => {
|
|
35328
35491
|
async function checkConfig() {
|
|
35329
|
-
const
|
|
35330
|
-
|
|
35492
|
+
const exists = await configExists();
|
|
35493
|
+
if (exists) {
|
|
35494
|
+
const cfg = new ConfigFile();
|
|
35331
35495
|
await cfg.load();
|
|
35332
35496
|
setConfig(cfg);
|
|
35333
35497
|
setView("main");
|
|
35334
|
-
}
|
|
35498
|
+
} else {
|
|
35335
35499
|
setView("init");
|
|
35336
35500
|
}
|
|
35337
35501
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeye/cletus",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Interactive CLI demo showcasing
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Interactive CLI demo showcasing @aeye capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|