@ridit/lens 0.1.8 → 0.1.9
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.mjs +90 -1001
- package/package.json +1 -1
- package/src/components/chat/ChatMessage.tsx +72 -574
- package/src/utils/chat.ts +10 -0
package/dist/index.mjs
CHANGED
|
@@ -44359,14 +44359,6 @@ var build_default = Spinner;
|
|
|
44359
44359
|
|
|
44360
44360
|
// src/colors.ts
|
|
44361
44361
|
var ACCENT = "#DA7758";
|
|
44362
|
-
var TOKEN_KEYWORD = "#B385C9";
|
|
44363
|
-
var TOKEN_STRING = "#85C98A";
|
|
44364
|
-
var TOKEN_NUMBER = "#E8C170";
|
|
44365
|
-
var TOKEN_PROPERTY = "#79C5D4";
|
|
44366
|
-
var TOKEN_ENTITY = "#7AABDB";
|
|
44367
|
-
var TOKEN_TEXT = "#E8E8E8";
|
|
44368
|
-
var TOKEN_MUTED = "#888888";
|
|
44369
|
-
var TOKEN_COMMENT = "#777777";
|
|
44370
44362
|
|
|
44371
44363
|
// src/utils/thinking.tsx
|
|
44372
44364
|
var import_react30 = __toESM(require_react(), 1);
|
|
@@ -48750,6 +48742,7 @@ More content."}
|
|
|
48750
48742
|
23. When explaining how to use a tool in text, use [tag] bracket notation or a fenced code block — NEVER emit a real XML tool tag as part of an explanation or example
|
|
48751
48743
|
24. NEVER chain tool calls unless the user's request explicitly requires multiple steps
|
|
48752
48744
|
25. NEVER read files, list folders, or run tools that were not asked for in the current user message
|
|
48745
|
+
26. NEVER use markdown formatting in plain text responses — no **bold**, no *italics*, no # headings, no bullet points with -, *, or +, no numbered lists, no backtick inline code. Write in plain prose. Only use fenced \`\`\` code blocks when showing actual code.
|
|
48753
48746
|
|
|
48754
48747
|
## CRITICAL: READ BEFORE YOU WRITE
|
|
48755
48748
|
|
|
@@ -49318,6 +49311,14 @@ Please continue your response based on this output.`
|
|
|
49318
49311
|
{
|
|
49319
49312
|
role: "assistant",
|
|
49320
49313
|
content: "The `??` operator is the nullish coalescing operator. It returns the right side only when the left side is `null` or `undefined`."
|
|
49314
|
+
},
|
|
49315
|
+
{
|
|
49316
|
+
role: "user",
|
|
49317
|
+
content: "what does this project do?"
|
|
49318
|
+
},
|
|
49319
|
+
{
|
|
49320
|
+
role: "assistant",
|
|
49321
|
+
content: "This project is a CLI coding assistant that lets you chat with an AI model about your codebase. It can read and write files, run shell commands, search the web, and propose diffs for your approval."
|
|
49321
49322
|
}
|
|
49322
49323
|
];
|
|
49323
49324
|
function parseResponse(text) {
|
|
@@ -50079,1014 +50080,105 @@ print("OK")
|
|
|
50079
50080
|
}
|
|
50080
50081
|
}
|
|
50081
50082
|
|
|
50082
|
-
// node_modules/sugar-high/lib/index.js
|
|
50083
|
-
var JSXBrackets = new Set(["<", ">", "{", "}", "[", "]"]);
|
|
50084
|
-
var Keywords_Js = new Set([
|
|
50085
|
-
"for",
|
|
50086
|
-
"do",
|
|
50087
|
-
"while",
|
|
50088
|
-
"if",
|
|
50089
|
-
"else",
|
|
50090
|
-
"return",
|
|
50091
|
-
"function",
|
|
50092
|
-
"var",
|
|
50093
|
-
"let",
|
|
50094
|
-
"const",
|
|
50095
|
-
"true",
|
|
50096
|
-
"false",
|
|
50097
|
-
"undefined",
|
|
50098
|
-
"this",
|
|
50099
|
-
"new",
|
|
50100
|
-
"delete",
|
|
50101
|
-
"typeof",
|
|
50102
|
-
"in",
|
|
50103
|
-
"instanceof",
|
|
50104
|
-
"void",
|
|
50105
|
-
"break",
|
|
50106
|
-
"continue",
|
|
50107
|
-
"switch",
|
|
50108
|
-
"case",
|
|
50109
|
-
"default",
|
|
50110
|
-
"throw",
|
|
50111
|
-
"try",
|
|
50112
|
-
"catch",
|
|
50113
|
-
"finally",
|
|
50114
|
-
"debugger",
|
|
50115
|
-
"with",
|
|
50116
|
-
"yield",
|
|
50117
|
-
"async",
|
|
50118
|
-
"await",
|
|
50119
|
-
"class",
|
|
50120
|
-
"extends",
|
|
50121
|
-
"super",
|
|
50122
|
-
"import",
|
|
50123
|
-
"export",
|
|
50124
|
-
"from",
|
|
50125
|
-
"static"
|
|
50126
|
-
]);
|
|
50127
|
-
var Signs = new Set([
|
|
50128
|
-
"+",
|
|
50129
|
-
"-",
|
|
50130
|
-
"*",
|
|
50131
|
-
"/",
|
|
50132
|
-
"%",
|
|
50133
|
-
"=",
|
|
50134
|
-
"!",
|
|
50135
|
-
"&",
|
|
50136
|
-
"|",
|
|
50137
|
-
"^",
|
|
50138
|
-
"~",
|
|
50139
|
-
"!",
|
|
50140
|
-
"?",
|
|
50141
|
-
":",
|
|
50142
|
-
".",
|
|
50143
|
-
",",
|
|
50144
|
-
";",
|
|
50145
|
-
`'`,
|
|
50146
|
-
'"',
|
|
50147
|
-
".",
|
|
50148
|
-
"(",
|
|
50149
|
-
")",
|
|
50150
|
-
"[",
|
|
50151
|
-
"]",
|
|
50152
|
-
"#",
|
|
50153
|
-
"@",
|
|
50154
|
-
"\\",
|
|
50155
|
-
...JSXBrackets
|
|
50156
|
-
]);
|
|
50157
|
-
var DefaultOptions = {
|
|
50158
|
-
keywords: Keywords_Js,
|
|
50159
|
-
onCommentStart: isCommentStart_Js,
|
|
50160
|
-
onCommentEnd: isCommentEnd_Js
|
|
50161
|
-
};
|
|
50162
|
-
var TokenTypes = [
|
|
50163
|
-
"identifier",
|
|
50164
|
-
"keyword",
|
|
50165
|
-
"string",
|
|
50166
|
-
"class",
|
|
50167
|
-
"property",
|
|
50168
|
-
"entity",
|
|
50169
|
-
"jsxliterals",
|
|
50170
|
-
"sign",
|
|
50171
|
-
"comment",
|
|
50172
|
-
"break",
|
|
50173
|
-
"space"
|
|
50174
|
-
];
|
|
50175
|
-
var [
|
|
50176
|
-
T_IDENTIFIER,
|
|
50177
|
-
T_KEYWORD,
|
|
50178
|
-
T_STRING,
|
|
50179
|
-
T_CLS_NUMBER,
|
|
50180
|
-
T_PROPERTY,
|
|
50181
|
-
T_ENTITY,
|
|
50182
|
-
T_JSX_LITERALS,
|
|
50183
|
-
T_SIGN,
|
|
50184
|
-
T_COMMENT,
|
|
50185
|
-
T_BREAK,
|
|
50186
|
-
T_SPACE
|
|
50187
|
-
] = TokenTypes.map((_, i) => i);
|
|
50188
|
-
function isSpaces(str) {
|
|
50189
|
-
return /^[^\S\r\n]+$/g.test(str);
|
|
50190
|
-
}
|
|
50191
|
-
function isSign(ch) {
|
|
50192
|
-
return Signs.has(ch);
|
|
50193
|
-
}
|
|
50194
|
-
function isWord(chr) {
|
|
50195
|
-
return /^[\w_]+$/.test(chr) || hasUnicode(chr);
|
|
50196
|
-
}
|
|
50197
|
-
function isCls(str) {
|
|
50198
|
-
const chr0 = str[0];
|
|
50199
|
-
return isWord(chr0) && chr0 === chr0.toUpperCase() || str === "null";
|
|
50200
|
-
}
|
|
50201
|
-
function hasUnicode(s) {
|
|
50202
|
-
return /[^\u0000-\u007f]/.test(s);
|
|
50203
|
-
}
|
|
50204
|
-
function isAlpha(chr) {
|
|
50205
|
-
return /^[a-zA-Z]$/.test(chr);
|
|
50206
|
-
}
|
|
50207
|
-
function isIdentifierChar(chr) {
|
|
50208
|
-
return isAlpha(chr) || hasUnicode(chr);
|
|
50209
|
-
}
|
|
50210
|
-
function isIdentifier(str) {
|
|
50211
|
-
return isIdentifierChar(str[0]) && (str.length === 1 || isWord(str.slice(1)));
|
|
50212
|
-
}
|
|
50213
|
-
function isStrTemplateChr(chr) {
|
|
50214
|
-
return chr === "`";
|
|
50215
|
-
}
|
|
50216
|
-
function isSingleQuotes(chr) {
|
|
50217
|
-
return chr === '"' || chr === "'";
|
|
50218
|
-
}
|
|
50219
|
-
function isStringQuotation(chr) {
|
|
50220
|
-
return isSingleQuotes(chr) || isStrTemplateChr(chr);
|
|
50221
|
-
}
|
|
50222
|
-
function isCommentStart_Js(curr, next) {
|
|
50223
|
-
const str = curr + next;
|
|
50224
|
-
if (str === "/*")
|
|
50225
|
-
return 2;
|
|
50226
|
-
return str === "//" ? 1 : 0;
|
|
50227
|
-
}
|
|
50228
|
-
function isCommentEnd_Js(prev, curr) {
|
|
50229
|
-
return prev + curr === "*/" ? 2 : curr === `
|
|
50230
|
-
` ? 1 : 0;
|
|
50231
|
-
}
|
|
50232
|
-
function isRegexStart(str) {
|
|
50233
|
-
return str[0] === "/" && !isCommentStart_Js(str[0], str[1]);
|
|
50234
|
-
}
|
|
50235
|
-
function tokenize3(code, options) {
|
|
50236
|
-
const {
|
|
50237
|
-
keywords,
|
|
50238
|
-
onCommentStart,
|
|
50239
|
-
onCommentEnd
|
|
50240
|
-
} = { ...DefaultOptions, ...options };
|
|
50241
|
-
let current = "";
|
|
50242
|
-
let type = -1;
|
|
50243
|
-
let last2 = [-1, ""];
|
|
50244
|
-
let beforeLast = [-2, ""];
|
|
50245
|
-
const tokens = [];
|
|
50246
|
-
let __jsxEnter = false;
|
|
50247
|
-
let __jsxTag = 0;
|
|
50248
|
-
let __jsxExpr = false;
|
|
50249
|
-
let __jsxStack = 0;
|
|
50250
|
-
const __jsxChild = () => __jsxEnter && !__jsxExpr && !__jsxTag;
|
|
50251
|
-
const inJsxTag = () => __jsxTag && !__jsxChild();
|
|
50252
|
-
const inJsxLiterals = () => !__jsxTag && __jsxChild() && !__jsxExpr && __jsxStack > 0;
|
|
50253
|
-
let __strQuote = null;
|
|
50254
|
-
let __regexQuoteStart = false;
|
|
50255
|
-
let __strTemplateExprStack = 0;
|
|
50256
|
-
let __strTemplateQuoteStack = 0;
|
|
50257
|
-
const inStringQuotes = () => __strQuote !== null;
|
|
50258
|
-
const inRegexQuotes = () => __regexQuoteStart;
|
|
50259
|
-
const inStrTemplateLiterals = () => __strTemplateQuoteStack > __strTemplateExprStack;
|
|
50260
|
-
const inStrTemplateExpr = () => __strTemplateQuoteStack > 0 && __strTemplateQuoteStack === __strTemplateExprStack;
|
|
50261
|
-
const inStringContent = () => inStringQuotes() || inStrTemplateLiterals();
|
|
50262
|
-
function classify(token) {
|
|
50263
|
-
const isLineBreak = token === `
|
|
50264
|
-
`;
|
|
50265
|
-
if (inJsxTag()) {
|
|
50266
|
-
if (inStringQuotes()) {
|
|
50267
|
-
return T_STRING;
|
|
50268
|
-
}
|
|
50269
|
-
const [, lastToken] = last2;
|
|
50270
|
-
if (isIdentifier(token)) {
|
|
50271
|
-
if (lastToken === "<" || lastToken === "</")
|
|
50272
|
-
return T_ENTITY;
|
|
50273
|
-
}
|
|
50274
|
-
}
|
|
50275
|
-
const isJsxLiterals = inJsxLiterals();
|
|
50276
|
-
if (isJsxLiterals)
|
|
50277
|
-
return T_JSX_LITERALS;
|
|
50278
|
-
if (inStringQuotes() || inStrTemplateLiterals()) {
|
|
50279
|
-
return T_STRING;
|
|
50280
|
-
} else if (keywords.has(token)) {
|
|
50281
|
-
return last2[1] === "." ? T_IDENTIFIER : T_KEYWORD;
|
|
50282
|
-
} else if (isLineBreak) {
|
|
50283
|
-
return T_BREAK;
|
|
50284
|
-
} else if (isSpaces(token)) {
|
|
50285
|
-
return T_SPACE;
|
|
50286
|
-
} else if (token.split("").every(isSign)) {
|
|
50287
|
-
return T_SIGN;
|
|
50288
|
-
} else if (isCls(token)) {
|
|
50289
|
-
return inJsxTag() ? T_IDENTIFIER : T_CLS_NUMBER;
|
|
50290
|
-
} else {
|
|
50291
|
-
if (isIdentifier(token)) {
|
|
50292
|
-
const isLastPropDot = last2[1] === "." && isIdentifier(beforeLast[1]);
|
|
50293
|
-
if (!inStringContent() && !isLastPropDot)
|
|
50294
|
-
return T_IDENTIFIER;
|
|
50295
|
-
if (isLastPropDot)
|
|
50296
|
-
return T_PROPERTY;
|
|
50297
|
-
}
|
|
50298
|
-
return T_STRING;
|
|
50299
|
-
}
|
|
50300
|
-
}
|
|
50301
|
-
const append = (type_, token_) => {
|
|
50302
|
-
if (token_) {
|
|
50303
|
-
current = token_;
|
|
50304
|
-
}
|
|
50305
|
-
if (current) {
|
|
50306
|
-
type = type_ || classify(current);
|
|
50307
|
-
const pair = [type, current];
|
|
50308
|
-
if (type !== T_SPACE && type !== T_BREAK) {
|
|
50309
|
-
beforeLast = last2;
|
|
50310
|
-
last2 = pair;
|
|
50311
|
-
}
|
|
50312
|
-
tokens.push(pair);
|
|
50313
|
-
}
|
|
50314
|
-
current = "";
|
|
50315
|
-
};
|
|
50316
|
-
for (let i = 0;i < code.length; i++) {
|
|
50317
|
-
const curr = code[i];
|
|
50318
|
-
const prev = code[i - 1];
|
|
50319
|
-
const next = code[i + 1];
|
|
50320
|
-
const p_c = prev + curr;
|
|
50321
|
-
const c_n = curr + next;
|
|
50322
|
-
if (isSingleQuotes(curr) && !inJsxLiterals() && !inStrTemplateLiterals()) {
|
|
50323
|
-
append();
|
|
50324
|
-
if (prev !== `\\`) {
|
|
50325
|
-
if (__strQuote && curr === __strQuote) {
|
|
50326
|
-
__strQuote = null;
|
|
50327
|
-
} else if (!__strQuote) {
|
|
50328
|
-
__strQuote = curr;
|
|
50329
|
-
}
|
|
50330
|
-
}
|
|
50331
|
-
append(T_STRING, curr);
|
|
50332
|
-
continue;
|
|
50333
|
-
}
|
|
50334
|
-
if (!inStrTemplateLiterals()) {
|
|
50335
|
-
if (prev !== "\\n" && isStrTemplateChr(curr)) {
|
|
50336
|
-
append();
|
|
50337
|
-
append(T_STRING, curr);
|
|
50338
|
-
__strTemplateQuoteStack++;
|
|
50339
|
-
continue;
|
|
50340
|
-
}
|
|
50341
|
-
}
|
|
50342
|
-
if (inStrTemplateLiterals()) {
|
|
50343
|
-
if (prev !== "\\n" && isStrTemplateChr(curr)) {
|
|
50344
|
-
if (__strTemplateQuoteStack > 0) {
|
|
50345
|
-
append();
|
|
50346
|
-
__strTemplateQuoteStack--;
|
|
50347
|
-
append(T_STRING, curr);
|
|
50348
|
-
continue;
|
|
50349
|
-
}
|
|
50350
|
-
}
|
|
50351
|
-
if (c_n === "${") {
|
|
50352
|
-
__strTemplateExprStack++;
|
|
50353
|
-
append(T_STRING);
|
|
50354
|
-
append(T_SIGN, c_n);
|
|
50355
|
-
i++;
|
|
50356
|
-
continue;
|
|
50357
|
-
}
|
|
50358
|
-
}
|
|
50359
|
-
if (inStrTemplateExpr() && curr === "}") {
|
|
50360
|
-
append();
|
|
50361
|
-
__strTemplateExprStack--;
|
|
50362
|
-
append(T_SIGN, curr);
|
|
50363
|
-
continue;
|
|
50364
|
-
}
|
|
50365
|
-
if (__jsxChild()) {
|
|
50366
|
-
if (curr === "{") {
|
|
50367
|
-
append();
|
|
50368
|
-
append(T_SIGN, curr);
|
|
50369
|
-
__jsxExpr = true;
|
|
50370
|
-
continue;
|
|
50371
|
-
}
|
|
50372
|
-
}
|
|
50373
|
-
if (__jsxEnter) {
|
|
50374
|
-
if (!__jsxTag && curr === "<") {
|
|
50375
|
-
append();
|
|
50376
|
-
if (next === "/") {
|
|
50377
|
-
__jsxTag = 2;
|
|
50378
|
-
current = c_n;
|
|
50379
|
-
i++;
|
|
50380
|
-
} else {
|
|
50381
|
-
__jsxTag = 1;
|
|
50382
|
-
current = curr;
|
|
50383
|
-
}
|
|
50384
|
-
append(T_SIGN);
|
|
50385
|
-
continue;
|
|
50386
|
-
}
|
|
50387
|
-
if (__jsxTag) {
|
|
50388
|
-
if (curr === ">" && !"/=".includes(prev)) {
|
|
50389
|
-
append();
|
|
50390
|
-
if (__jsxTag === 1) {
|
|
50391
|
-
__jsxTag = 0;
|
|
50392
|
-
__jsxStack++;
|
|
50393
|
-
} else {
|
|
50394
|
-
__jsxTag = 0;
|
|
50395
|
-
__jsxEnter = false;
|
|
50396
|
-
}
|
|
50397
|
-
append(T_SIGN, curr);
|
|
50398
|
-
continue;
|
|
50399
|
-
}
|
|
50400
|
-
if (c_n === "/>" || c_n === "</") {
|
|
50401
|
-
if (current !== "<" && current !== "/") {
|
|
50402
|
-
append();
|
|
50403
|
-
}
|
|
50404
|
-
if (c_n === "/>") {
|
|
50405
|
-
__jsxTag = 0;
|
|
50406
|
-
} else {
|
|
50407
|
-
__jsxStack--;
|
|
50408
|
-
}
|
|
50409
|
-
if (!__jsxStack)
|
|
50410
|
-
__jsxEnter = false;
|
|
50411
|
-
current = c_n;
|
|
50412
|
-
i++;
|
|
50413
|
-
append(T_SIGN);
|
|
50414
|
-
continue;
|
|
50415
|
-
}
|
|
50416
|
-
if (curr === "<") {
|
|
50417
|
-
append();
|
|
50418
|
-
current = curr;
|
|
50419
|
-
append(T_SIGN);
|
|
50420
|
-
continue;
|
|
50421
|
-
}
|
|
50422
|
-
if (next === "-" && !inStringContent() && !inJsxLiterals()) {
|
|
50423
|
-
if (current) {
|
|
50424
|
-
append(T_PROPERTY, current + curr + next);
|
|
50425
|
-
i++;
|
|
50426
|
-
continue;
|
|
50427
|
-
}
|
|
50428
|
-
}
|
|
50429
|
-
if (next === "=" && !inStringContent()) {
|
|
50430
|
-
if (!isSpaces(curr)) {
|
|
50431
|
-
if (isSpaces(current)) {
|
|
50432
|
-
append();
|
|
50433
|
-
}
|
|
50434
|
-
const prop = current + curr;
|
|
50435
|
-
if (isIdentifier(prop)) {
|
|
50436
|
-
append(T_PROPERTY, prop);
|
|
50437
|
-
continue;
|
|
50438
|
-
}
|
|
50439
|
-
}
|
|
50440
|
-
}
|
|
50441
|
-
}
|
|
50442
|
-
}
|
|
50443
|
-
if (!__jsxTag && (curr === "<" && isIdentifierChar(next) || c_n === "</")) {
|
|
50444
|
-
__jsxTag = next === "/" ? 2 : 1;
|
|
50445
|
-
if (curr === "<" && (next === "/" || isAlpha(next))) {
|
|
50446
|
-
if (!inStringContent() && !inJsxLiterals() && !inRegexQuotes()) {
|
|
50447
|
-
__jsxEnter = true;
|
|
50448
|
-
}
|
|
50449
|
-
}
|
|
50450
|
-
}
|
|
50451
|
-
const isQuotationChar = isStringQuotation(curr);
|
|
50452
|
-
const isStringTemplateLiterals = inStrTemplateLiterals();
|
|
50453
|
-
const isRegexChar = !__jsxEnter && isRegexStart(c_n);
|
|
50454
|
-
const isJsxLiterals = inJsxLiterals();
|
|
50455
|
-
if (isQuotationChar || isStringTemplateLiterals || isSingleQuotes(__strQuote)) {
|
|
50456
|
-
current += curr;
|
|
50457
|
-
} else if (isRegexChar) {
|
|
50458
|
-
append();
|
|
50459
|
-
const [lastType, lastToken] = last2;
|
|
50460
|
-
if (isRegexChar && lastType !== -1 && !(lastType === T_SIGN && lastToken !== ")" || lastType === T_COMMENT)) {
|
|
50461
|
-
current = curr;
|
|
50462
|
-
append();
|
|
50463
|
-
continue;
|
|
50464
|
-
}
|
|
50465
|
-
__regexQuoteStart = true;
|
|
50466
|
-
const start = i++;
|
|
50467
|
-
const isEof = () => i >= code.length;
|
|
50468
|
-
const isEol = () => isEof() || code[i] === `
|
|
50469
|
-
`;
|
|
50470
|
-
let foundClose = false;
|
|
50471
|
-
for (;!isEol(); i++) {
|
|
50472
|
-
if (code[i] === "/" && code[i - 1] !== "\\") {
|
|
50473
|
-
foundClose = true;
|
|
50474
|
-
while (start !== i && /^[a-z]$/.test(code[i + 1]) && !isEol()) {
|
|
50475
|
-
i++;
|
|
50476
|
-
}
|
|
50477
|
-
break;
|
|
50478
|
-
}
|
|
50479
|
-
}
|
|
50480
|
-
__regexQuoteStart = false;
|
|
50481
|
-
if (start !== i && foundClose) {
|
|
50482
|
-
current = code.slice(start, i + 1);
|
|
50483
|
-
append(T_STRING);
|
|
50484
|
-
} else {
|
|
50485
|
-
current = curr;
|
|
50486
|
-
append();
|
|
50487
|
-
i = start;
|
|
50488
|
-
}
|
|
50489
|
-
} else if (onCommentStart(curr, next)) {
|
|
50490
|
-
append();
|
|
50491
|
-
const start = i;
|
|
50492
|
-
const startCommentType = onCommentStart(curr, next);
|
|
50493
|
-
if (startCommentType) {
|
|
50494
|
-
for (;i < code.length; i++) {
|
|
50495
|
-
const endCommentType = onCommentEnd(code[i - 1], code[i]);
|
|
50496
|
-
if (endCommentType == startCommentType)
|
|
50497
|
-
break;
|
|
50498
|
-
}
|
|
50499
|
-
}
|
|
50500
|
-
current = code.slice(start, i + 1);
|
|
50501
|
-
append(T_COMMENT);
|
|
50502
|
-
} else if (curr === " " || curr === `
|
|
50503
|
-
`) {
|
|
50504
|
-
if (curr === " " && (isSpaces(current) || !current || isJsxLiterals)) {
|
|
50505
|
-
current += curr;
|
|
50506
|
-
if (next === "<") {
|
|
50507
|
-
append();
|
|
50508
|
-
}
|
|
50509
|
-
} else {
|
|
50510
|
-
append();
|
|
50511
|
-
current = curr;
|
|
50512
|
-
append();
|
|
50513
|
-
}
|
|
50514
|
-
} else {
|
|
50515
|
-
if (__jsxExpr && curr === "}") {
|
|
50516
|
-
append();
|
|
50517
|
-
current = curr;
|
|
50518
|
-
append();
|
|
50519
|
-
__jsxExpr = false;
|
|
50520
|
-
} else if (isJsxLiterals && !JSXBrackets.has(curr) || inStrTemplateLiterals() || (isWord(curr) === isWord(current[current.length - 1]) || __jsxChild()) && !Signs.has(curr)) {
|
|
50521
|
-
current += curr;
|
|
50522
|
-
} else {
|
|
50523
|
-
if (p_c === "</") {
|
|
50524
|
-
current = p_c;
|
|
50525
|
-
}
|
|
50526
|
-
append();
|
|
50527
|
-
if (p_c !== "</") {
|
|
50528
|
-
current = curr;
|
|
50529
|
-
}
|
|
50530
|
-
if (c_n === "</" || c_n === "/>") {
|
|
50531
|
-
current = c_n;
|
|
50532
|
-
append();
|
|
50533
|
-
i++;
|
|
50534
|
-
} else if (JSXBrackets.has(curr))
|
|
50535
|
-
append();
|
|
50536
|
-
}
|
|
50537
|
-
}
|
|
50538
|
-
}
|
|
50539
|
-
append();
|
|
50540
|
-
return tokens;
|
|
50541
|
-
}
|
|
50542
|
-
var SugarHigh = {
|
|
50543
|
-
TokenTypes,
|
|
50544
|
-
TokenMap: new Map(TokenTypes.map((type, i) => [type, i]))
|
|
50545
|
-
};
|
|
50546
|
-
|
|
50547
50083
|
// src/components/chat/ChatMessage.tsx
|
|
50548
50084
|
var jsx_dev_runtime19 = __toESM(require_jsx_dev_runtime(), 1);
|
|
50549
|
-
var T_IDENTIFIER2 = 0;
|
|
50550
|
-
var T_KEYWORD2 = 1;
|
|
50551
|
-
var T_STRING2 = 2;
|
|
50552
|
-
var T_CLS_NUMBER2 = 3;
|
|
50553
|
-
var T_PROPERTY2 = 4;
|
|
50554
|
-
var T_ENTITY2 = 5;
|
|
50555
|
-
var T_JSX_LITERAL = 6;
|
|
50556
|
-
var T_SIGN2 = 7;
|
|
50557
|
-
var T_COMMENT2 = 8;
|
|
50558
|
-
var T_BREAK2 = 9;
|
|
50559
|
-
var T_SPACE2 = 10;
|
|
50560
|
-
var JS_LANGS = new Set([
|
|
50561
|
-
"js",
|
|
50562
|
-
"javascript",
|
|
50563
|
-
"jsx",
|
|
50564
|
-
"ts",
|
|
50565
|
-
"typescript",
|
|
50566
|
-
"tsx",
|
|
50567
|
-
"mjs",
|
|
50568
|
-
"cjs"
|
|
50569
|
-
]);
|
|
50570
|
-
function tokenColor(type) {
|
|
50571
|
-
switch (type) {
|
|
50572
|
-
case T_KEYWORD2:
|
|
50573
|
-
return TOKEN_KEYWORD;
|
|
50574
|
-
case T_STRING2:
|
|
50575
|
-
return TOKEN_STRING;
|
|
50576
|
-
case T_CLS_NUMBER2:
|
|
50577
|
-
return TOKEN_NUMBER;
|
|
50578
|
-
case T_PROPERTY2:
|
|
50579
|
-
return TOKEN_PROPERTY;
|
|
50580
|
-
case T_ENTITY2:
|
|
50581
|
-
return TOKEN_ENTITY;
|
|
50582
|
-
case T_JSX_LITERAL:
|
|
50583
|
-
return TOKEN_TEXT;
|
|
50584
|
-
case T_SIGN2:
|
|
50585
|
-
return TOKEN_MUTED;
|
|
50586
|
-
case T_COMMENT2:
|
|
50587
|
-
return TOKEN_COMMENT;
|
|
50588
|
-
case T_IDENTIFIER2:
|
|
50589
|
-
return TOKEN_TEXT;
|
|
50590
|
-
default:
|
|
50591
|
-
return TOKEN_TEXT;
|
|
50592
|
-
}
|
|
50593
|
-
}
|
|
50594
|
-
var PYTHON_KW = new Set([
|
|
50595
|
-
"def",
|
|
50596
|
-
"class",
|
|
50597
|
-
"import",
|
|
50598
|
-
"from",
|
|
50599
|
-
"return",
|
|
50600
|
-
"if",
|
|
50601
|
-
"elif",
|
|
50602
|
-
"else",
|
|
50603
|
-
"for",
|
|
50604
|
-
"while",
|
|
50605
|
-
"in",
|
|
50606
|
-
"not",
|
|
50607
|
-
"and",
|
|
50608
|
-
"or",
|
|
50609
|
-
"is",
|
|
50610
|
-
"None",
|
|
50611
|
-
"True",
|
|
50612
|
-
"False",
|
|
50613
|
-
"try",
|
|
50614
|
-
"except",
|
|
50615
|
-
"finally",
|
|
50616
|
-
"with",
|
|
50617
|
-
"as",
|
|
50618
|
-
"pass",
|
|
50619
|
-
"break",
|
|
50620
|
-
"continue",
|
|
50621
|
-
"raise",
|
|
50622
|
-
"yield",
|
|
50623
|
-
"lambda",
|
|
50624
|
-
"async",
|
|
50625
|
-
"await",
|
|
50626
|
-
"del",
|
|
50627
|
-
"global",
|
|
50628
|
-
"nonlocal",
|
|
50629
|
-
"assert"
|
|
50630
|
-
]);
|
|
50631
|
-
var RUST_KW = new Set([
|
|
50632
|
-
"fn",
|
|
50633
|
-
"let",
|
|
50634
|
-
"mut",
|
|
50635
|
-
"const",
|
|
50636
|
-
"struct",
|
|
50637
|
-
"enum",
|
|
50638
|
-
"impl",
|
|
50639
|
-
"trait",
|
|
50640
|
-
"pub",
|
|
50641
|
-
"use",
|
|
50642
|
-
"mod",
|
|
50643
|
-
"match",
|
|
50644
|
-
"if",
|
|
50645
|
-
"else",
|
|
50646
|
-
"loop",
|
|
50647
|
-
"while",
|
|
50648
|
-
"for",
|
|
50649
|
-
"in",
|
|
50650
|
-
"return",
|
|
50651
|
-
"self",
|
|
50652
|
-
"Self",
|
|
50653
|
-
"super",
|
|
50654
|
-
"where",
|
|
50655
|
-
"type",
|
|
50656
|
-
"as",
|
|
50657
|
-
"ref",
|
|
50658
|
-
"move",
|
|
50659
|
-
"unsafe",
|
|
50660
|
-
"extern",
|
|
50661
|
-
"dyn",
|
|
50662
|
-
"async",
|
|
50663
|
-
"await",
|
|
50664
|
-
"true",
|
|
50665
|
-
"false",
|
|
50666
|
-
"Some",
|
|
50667
|
-
"None",
|
|
50668
|
-
"Ok",
|
|
50669
|
-
"Err"
|
|
50670
|
-
]);
|
|
50671
|
-
var GO_KW = new Set([
|
|
50672
|
-
"func",
|
|
50673
|
-
"var",
|
|
50674
|
-
"const",
|
|
50675
|
-
"type",
|
|
50676
|
-
"struct",
|
|
50677
|
-
"interface",
|
|
50678
|
-
"package",
|
|
50679
|
-
"import",
|
|
50680
|
-
"return",
|
|
50681
|
-
"if",
|
|
50682
|
-
"else",
|
|
50683
|
-
"for",
|
|
50684
|
-
"range",
|
|
50685
|
-
"switch",
|
|
50686
|
-
"case",
|
|
50687
|
-
"default",
|
|
50688
|
-
"break",
|
|
50689
|
-
"continue",
|
|
50690
|
-
"goto",
|
|
50691
|
-
"defer",
|
|
50692
|
-
"go",
|
|
50693
|
-
"chan",
|
|
50694
|
-
"map",
|
|
50695
|
-
"make",
|
|
50696
|
-
"new",
|
|
50697
|
-
"nil",
|
|
50698
|
-
"true",
|
|
50699
|
-
"false",
|
|
50700
|
-
"error"
|
|
50701
|
-
]);
|
|
50702
|
-
var SHELL_KW = new Set([
|
|
50703
|
-
"if",
|
|
50704
|
-
"then",
|
|
50705
|
-
"else",
|
|
50706
|
-
"elif",
|
|
50707
|
-
"fi",
|
|
50708
|
-
"for",
|
|
50709
|
-
"do",
|
|
50710
|
-
"done",
|
|
50711
|
-
"while",
|
|
50712
|
-
"case",
|
|
50713
|
-
"esac",
|
|
50714
|
-
"in",
|
|
50715
|
-
"function",
|
|
50716
|
-
"return",
|
|
50717
|
-
"echo",
|
|
50718
|
-
"export",
|
|
50719
|
-
"local",
|
|
50720
|
-
"source",
|
|
50721
|
-
"exit"
|
|
50722
|
-
]);
|
|
50723
|
-
var CSS_AT = /^@[\w-]+/;
|
|
50724
|
-
var CSS_PROP = /^[\w-]+(?=\s*:)/;
|
|
50725
|
-
function tokenizeGeneric(code, lang) {
|
|
50726
|
-
const keywords = lang === "python" || lang === "py" ? PYTHON_KW : lang === "rust" || lang === "rs" ? RUST_KW : lang === "go" ? GO_KW : lang === "bash" || lang === "sh" || lang === "shell" || lang === "zsh" ? SHELL_KW : new Set;
|
|
50727
|
-
const lines = code.split(`
|
|
50728
|
-
`);
|
|
50729
|
-
return lines.map((line) => {
|
|
50730
|
-
const tokens = [];
|
|
50731
|
-
let i = 0;
|
|
50732
|
-
const push = (color, text) => {
|
|
50733
|
-
if (text)
|
|
50734
|
-
tokens.push({ color, text });
|
|
50735
|
-
};
|
|
50736
|
-
while (i < line.length) {
|
|
50737
|
-
const rest2 = line.slice(i);
|
|
50738
|
-
const commentPrefixes = lang === "python" || lang === "py" ? ["#"] : lang === "bash" || lang === "sh" || lang === "shell" || lang === "zsh" ? ["#"] : lang === "css" || lang === "scss" ? ["//", "/*"] : lang === "html" || lang === "xml" ? ["<!--"] : lang === "sql" ? ["--", "#"] : ["//", "#"];
|
|
50739
|
-
let matchedComment = false;
|
|
50740
|
-
for (const prefix of commentPrefixes) {
|
|
50741
|
-
if (rest2.startsWith(prefix)) {
|
|
50742
|
-
push(TOKEN_COMMENT, line.slice(i));
|
|
50743
|
-
i = line.length;
|
|
50744
|
-
matchedComment = true;
|
|
50745
|
-
break;
|
|
50746
|
-
}
|
|
50747
|
-
}
|
|
50748
|
-
if (matchedComment)
|
|
50749
|
-
continue;
|
|
50750
|
-
if (line[i] === '"' || line[i] === "'" || line[i] === "`") {
|
|
50751
|
-
const quote = line[i];
|
|
50752
|
-
let j = i + 1;
|
|
50753
|
-
while (j < line.length) {
|
|
50754
|
-
if (line[j] === "\\") {
|
|
50755
|
-
j += 2;
|
|
50756
|
-
continue;
|
|
50757
|
-
}
|
|
50758
|
-
if (line[j] === quote) {
|
|
50759
|
-
j++;
|
|
50760
|
-
break;
|
|
50761
|
-
}
|
|
50762
|
-
j++;
|
|
50763
|
-
}
|
|
50764
|
-
push(TOKEN_STRING, line.slice(i, j));
|
|
50765
|
-
i = j;
|
|
50766
|
-
continue;
|
|
50767
|
-
}
|
|
50768
|
-
const numMatch = rest2.match(/^-?\d+\.?\d*/);
|
|
50769
|
-
if (numMatch && (i === 0 || !/\w/.test(line[i - 1] ?? ""))) {
|
|
50770
|
-
push(TOKEN_NUMBER, numMatch[0]);
|
|
50771
|
-
i += numMatch[0].length;
|
|
50772
|
-
continue;
|
|
50773
|
-
}
|
|
50774
|
-
if (lang === "css" || lang === "scss") {
|
|
50775
|
-
const atMatch = rest2.match(CSS_AT);
|
|
50776
|
-
if (atMatch) {
|
|
50777
|
-
push(TOKEN_KEYWORD, atMatch[0]);
|
|
50778
|
-
i += atMatch[0].length;
|
|
50779
|
-
continue;
|
|
50780
|
-
}
|
|
50781
|
-
const propMatch = rest2.match(CSS_PROP);
|
|
50782
|
-
if (propMatch) {
|
|
50783
|
-
push(TOKEN_PROPERTY, propMatch[0]);
|
|
50784
|
-
i += propMatch[0].length;
|
|
50785
|
-
continue;
|
|
50786
|
-
}
|
|
50787
|
-
}
|
|
50788
|
-
if ((lang === "html" || lang === "xml") && line[i] === "<") {
|
|
50789
|
-
const tagMatch = rest2.match(/^<\/?[\w:-]+/);
|
|
50790
|
-
if (tagMatch) {
|
|
50791
|
-
push(TOKEN_ENTITY, tagMatch[0]);
|
|
50792
|
-
i += tagMatch[0].length;
|
|
50793
|
-
continue;
|
|
50794
|
-
}
|
|
50795
|
-
}
|
|
50796
|
-
const wordMatch = rest2.match(/^[a-zA-Z_$][\w$]*/);
|
|
50797
|
-
if (wordMatch) {
|
|
50798
|
-
const word = wordMatch[0];
|
|
50799
|
-
push(keywords.has(word) ? TOKEN_KEYWORD : TOKEN_TEXT, word);
|
|
50800
|
-
i += word.length;
|
|
50801
|
-
continue;
|
|
50802
|
-
}
|
|
50803
|
-
const opMatch = rest2.match(/^[^\w\s"'`]+/);
|
|
50804
|
-
if (opMatch) {
|
|
50805
|
-
push(TOKEN_MUTED, opMatch[0]);
|
|
50806
|
-
i += opMatch[0].length;
|
|
50807
|
-
continue;
|
|
50808
|
-
}
|
|
50809
|
-
push(TOKEN_TEXT, line[i]);
|
|
50810
|
-
i++;
|
|
50811
|
-
}
|
|
50812
|
-
return tokens;
|
|
50813
|
-
});
|
|
50814
|
-
}
|
|
50815
|
-
function HighlightedLine({ tokens }) {
|
|
50816
|
-
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
50817
|
-
children: [
|
|
50818
|
-
" ",
|
|
50819
|
-
tokens.map((t, i) => /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
50820
|
-
color: t.color,
|
|
50821
|
-
children: t.text
|
|
50822
|
-
}, i, false, undefined, this))
|
|
50823
|
-
]
|
|
50824
|
-
}, undefined, true, undefined, this);
|
|
50825
|
-
}
|
|
50826
|
-
function CodeBlock({ lang, code }) {
|
|
50827
|
-
const normalizedLang = lang.toLowerCase().trim();
|
|
50828
|
-
let lines;
|
|
50829
|
-
if (JS_LANGS.has(normalizedLang)) {
|
|
50830
|
-
const tokens = tokenize3(code);
|
|
50831
|
-
const lineAccum = [[]];
|
|
50832
|
-
for (const [type, value] of tokens) {
|
|
50833
|
-
if (type === T_BREAK2) {
|
|
50834
|
-
lineAccum.push([]);
|
|
50835
|
-
} else if (type !== T_SPACE2) {
|
|
50836
|
-
lineAccum[lineAccum.length - 1].push({
|
|
50837
|
-
color: tokenColor(type),
|
|
50838
|
-
text: value
|
|
50839
|
-
});
|
|
50840
|
-
} else {
|
|
50841
|
-
lineAccum[lineAccum.length - 1].push({
|
|
50842
|
-
color: TOKEN_TEXT,
|
|
50843
|
-
text: value
|
|
50844
|
-
});
|
|
50845
|
-
}
|
|
50846
|
-
}
|
|
50847
|
-
lines = lineAccum;
|
|
50848
|
-
} else if (normalizedLang) {
|
|
50849
|
-
lines = tokenizeGeneric(code, normalizedLang);
|
|
50850
|
-
} else {
|
|
50851
|
-
lines = code.split(`
|
|
50852
|
-
`).map((l) => [{ color: TOKEN_TEXT, text: l }]);
|
|
50853
|
-
}
|
|
50854
|
-
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Box_default, {
|
|
50855
|
-
flexDirection: "column",
|
|
50856
|
-
marginY: 1,
|
|
50857
|
-
marginLeft: 2,
|
|
50858
|
-
children: [
|
|
50859
|
-
normalizedLang ? /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
50860
|
-
color: TOKEN_MUTED,
|
|
50861
|
-
dimColor: true,
|
|
50862
|
-
children: normalizedLang
|
|
50863
|
-
}, undefined, false, undefined, this) : null,
|
|
50864
|
-
lines.map((lineTokens, i) => /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(HighlightedLine, {
|
|
50865
|
-
tokens: lineTokens
|
|
50866
|
-
}, i, false, undefined, this))
|
|
50867
|
-
]
|
|
50868
|
-
}, undefined, true, undefined, this);
|
|
50869
|
-
}
|
|
50870
50085
|
function InlineText({ text }) {
|
|
50871
|
-
const parts = text.split(/(
|
|
50086
|
+
const parts = text.split(/(`[^`]+`|\*\*[^*]+\*\*)/g);
|
|
50872
50087
|
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(jsx_dev_runtime19.Fragment, {
|
|
50873
50088
|
children: parts.map((part, i) => {
|
|
50874
|
-
if (part.startsWith("
|
|
50875
|
-
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
50876
|
-
bold: true,
|
|
50877
|
-
color: TOKEN_TEXT,
|
|
50878
|
-
children: part.slice(2, -2)
|
|
50879
|
-
}, i, false, undefined, this);
|
|
50880
|
-
}
|
|
50881
|
-
if (part.startsWith("*") && part.endsWith("*") && part.length > 2) {
|
|
50089
|
+
if (part.startsWith("`") && part.endsWith("`")) {
|
|
50882
50090
|
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
50883
|
-
|
|
50884
|
-
color: TOKEN_TEXT,
|
|
50091
|
+
color: ACCENT,
|
|
50885
50092
|
children: part.slice(1, -1)
|
|
50886
50093
|
}, i, false, undefined, this);
|
|
50887
50094
|
}
|
|
50888
|
-
if (part.startsWith("
|
|
50095
|
+
if (part.startsWith("**") && part.endsWith("**")) {
|
|
50889
50096
|
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
50890
|
-
|
|
50891
|
-
|
|
50097
|
+
bold: true,
|
|
50098
|
+
color: "white",
|
|
50099
|
+
children: part.slice(2, -2)
|
|
50892
50100
|
}, i, false, undefined, this);
|
|
50893
50101
|
}
|
|
50894
50102
|
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
50895
|
-
color:
|
|
50103
|
+
color: "white",
|
|
50896
50104
|
children: part
|
|
50897
50105
|
}, i, false, undefined, this);
|
|
50898
50106
|
})
|
|
50899
50107
|
}, undefined, false, undefined, this);
|
|
50900
50108
|
}
|
|
50901
|
-
function
|
|
50902
|
-
if (level === 1) {
|
|
50903
|
-
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Box_default, {
|
|
50904
|
-
marginTop: 1,
|
|
50905
|
-
children: /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
50906
|
-
color: ACCENT,
|
|
50907
|
-
bold: true,
|
|
50908
|
-
underline: true,
|
|
50909
|
-
children: text
|
|
50910
|
-
}, undefined, false, undefined, this)
|
|
50911
|
-
}, undefined, false, undefined, this);
|
|
50912
|
-
}
|
|
50913
|
-
if (level === 2) {
|
|
50914
|
-
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Box_default, {
|
|
50915
|
-
marginTop: 1,
|
|
50916
|
-
children: /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
50917
|
-
color: ACCENT,
|
|
50918
|
-
bold: true,
|
|
50919
|
-
children: text
|
|
50920
|
-
}, undefined, false, undefined, this)
|
|
50921
|
-
}, undefined, false, undefined, this);
|
|
50922
|
-
}
|
|
50109
|
+
function CodeBlock({ lang, code }) {
|
|
50923
50110
|
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Box_default, {
|
|
50924
|
-
|
|
50925
|
-
children:
|
|
50926
|
-
|
|
50927
|
-
|
|
50928
|
-
children:
|
|
50929
|
-
|
|
50111
|
+
flexDirection: "column",
|
|
50112
|
+
children: code.split(`
|
|
50113
|
+
`).map((line, i) => /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
50114
|
+
color: ACCENT,
|
|
50115
|
+
children: [
|
|
50116
|
+
" ",
|
|
50117
|
+
line
|
|
50118
|
+
]
|
|
50119
|
+
}, i, true, undefined, this))
|
|
50930
50120
|
}, undefined, false, undefined, this);
|
|
50931
50121
|
}
|
|
50932
|
-
function BulletItem({ text }) {
|
|
50933
|
-
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Box_default, {
|
|
50934
|
-
gap: 1,
|
|
50935
|
-
children: [
|
|
50936
|
-
/* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
50937
|
-
color: ACCENT,
|
|
50938
|
-
children: "*"
|
|
50939
|
-
}, undefined, false, undefined, this),
|
|
50940
|
-
/* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Box_default, {
|
|
50941
|
-
flexShrink: 1,
|
|
50942
|
-
children: /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(InlineText, {
|
|
50943
|
-
text
|
|
50944
|
-
}, undefined, false, undefined, this)
|
|
50945
|
-
}, undefined, false, undefined, this)
|
|
50946
|
-
]
|
|
50947
|
-
}, undefined, true, undefined, this);
|
|
50948
|
-
}
|
|
50949
|
-
function NumberedItem({ num, text }) {
|
|
50950
|
-
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Box_default, {
|
|
50951
|
-
gap: 1,
|
|
50952
|
-
children: [
|
|
50953
|
-
/* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
50954
|
-
color: TOKEN_MUTED,
|
|
50955
|
-
children: [
|
|
50956
|
-
num,
|
|
50957
|
-
"."
|
|
50958
|
-
]
|
|
50959
|
-
}, undefined, true, undefined, this),
|
|
50960
|
-
/* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Box_default, {
|
|
50961
|
-
flexShrink: 1,
|
|
50962
|
-
children: /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(InlineText, {
|
|
50963
|
-
text
|
|
50964
|
-
}, undefined, false, undefined, this)
|
|
50965
|
-
}, undefined, false, undefined, this)
|
|
50966
|
-
]
|
|
50967
|
-
}, undefined, true, undefined, this);
|
|
50968
|
-
}
|
|
50969
|
-
function BlockQuote({ text }) {
|
|
50970
|
-
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Box_default, {
|
|
50971
|
-
gap: 1,
|
|
50972
|
-
marginLeft: 1,
|
|
50973
|
-
children: [
|
|
50974
|
-
/* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
50975
|
-
color: TOKEN_MUTED,
|
|
50976
|
-
children: "│"
|
|
50977
|
-
}, undefined, false, undefined, this),
|
|
50978
|
-
/* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
50979
|
-
color: TOKEN_MUTED,
|
|
50980
|
-
dimColor: true,
|
|
50981
|
-
children: text
|
|
50982
|
-
}, undefined, false, undefined, this)
|
|
50983
|
-
]
|
|
50984
|
-
}, undefined, true, undefined, this);
|
|
50985
|
-
}
|
|
50986
|
-
function parseBlocks(content) {
|
|
50987
|
-
const blocks = [];
|
|
50988
|
-
const segments = content.split(/(```[\s\S]*?```)/g);
|
|
50989
|
-
for (const seg of segments) {
|
|
50990
|
-
if (seg.startsWith("```")) {
|
|
50991
|
-
const lines = seg.slice(3).split(`
|
|
50992
|
-
`);
|
|
50993
|
-
const lang = lines[0]?.trim() ?? "";
|
|
50994
|
-
const code = lines.slice(1).join(`
|
|
50995
|
-
`).replace(/```\s*$/, "").trimEnd();
|
|
50996
|
-
blocks.push({ type: "code", lang, code });
|
|
50997
|
-
continue;
|
|
50998
|
-
}
|
|
50999
|
-
for (const line of seg.split(`
|
|
51000
|
-
`)) {
|
|
51001
|
-
const trimmed = line.trim();
|
|
51002
|
-
if (!trimmed)
|
|
51003
|
-
continue;
|
|
51004
|
-
const h3 = trimmed.match(/^### (.+)$/);
|
|
51005
|
-
const h2 = trimmed.match(/^## (.+)$/);
|
|
51006
|
-
const h1 = trimmed.match(/^# (.+)$/);
|
|
51007
|
-
if (h3) {
|
|
51008
|
-
blocks.push({ type: "heading", level: 3, text: h3[1] });
|
|
51009
|
-
continue;
|
|
51010
|
-
}
|
|
51011
|
-
if (h2) {
|
|
51012
|
-
blocks.push({ type: "heading", level: 2, text: h2[1] });
|
|
51013
|
-
continue;
|
|
51014
|
-
}
|
|
51015
|
-
if (h1) {
|
|
51016
|
-
blocks.push({ type: "heading", level: 1, text: h1[1] });
|
|
51017
|
-
continue;
|
|
51018
|
-
}
|
|
51019
|
-
if (/^[-*_]{3,}$/.test(trimmed)) {
|
|
51020
|
-
blocks.push({ type: "hr" });
|
|
51021
|
-
continue;
|
|
51022
|
-
}
|
|
51023
|
-
if (trimmed.startsWith("> ")) {
|
|
51024
|
-
blocks.push({ type: "blockquote", text: trimmed.slice(2).trim() });
|
|
51025
|
-
continue;
|
|
51026
|
-
}
|
|
51027
|
-
if (/^[-*•]\s/.test(trimmed)) {
|
|
51028
|
-
blocks.push({ type: "bullet", text: trimmed.slice(2).trim() });
|
|
51029
|
-
continue;
|
|
51030
|
-
}
|
|
51031
|
-
const numMatch = trimmed.match(/^(\d+)\.\s(.+)/);
|
|
51032
|
-
if (numMatch) {
|
|
51033
|
-
blocks.push({
|
|
51034
|
-
type: "numbered",
|
|
51035
|
-
num: numMatch[1],
|
|
51036
|
-
text: numMatch[2]
|
|
51037
|
-
});
|
|
51038
|
-
continue;
|
|
51039
|
-
}
|
|
51040
|
-
blocks.push({ type: "paragraph", text: trimmed });
|
|
51041
|
-
}
|
|
51042
|
-
}
|
|
51043
|
-
return blocks;
|
|
51044
|
-
}
|
|
51045
50122
|
function MessageBody({ content }) {
|
|
51046
|
-
const
|
|
50123
|
+
const segments = content.split(/(```[\s\S]*?```)/g);
|
|
51047
50124
|
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Box_default, {
|
|
51048
50125
|
flexDirection: "column",
|
|
51049
|
-
children:
|
|
51050
|
-
|
|
51051
|
-
|
|
51052
|
-
|
|
51053
|
-
|
|
51054
|
-
|
|
51055
|
-
|
|
51056
|
-
|
|
51057
|
-
|
|
51058
|
-
|
|
51059
|
-
|
|
51060
|
-
|
|
51061
|
-
|
|
51062
|
-
|
|
51063
|
-
|
|
51064
|
-
|
|
51065
|
-
|
|
51066
|
-
|
|
51067
|
-
|
|
51068
|
-
|
|
51069
|
-
|
|
51070
|
-
|
|
51071
|
-
|
|
51072
|
-
|
|
51073
|
-
|
|
51074
|
-
|
|
51075
|
-
|
|
51076
|
-
|
|
51077
|
-
|
|
51078
|
-
|
|
51079
|
-
|
|
51080
|
-
|
|
51081
|
-
|
|
51082
|
-
|
|
51083
|
-
|
|
50126
|
+
children: segments.map((seg, si) => {
|
|
50127
|
+
if (seg.startsWith("```")) {
|
|
50128
|
+
const lines2 = seg.slice(3).split(`
|
|
50129
|
+
`);
|
|
50130
|
+
const lang = lines2[0]?.trim() ?? "";
|
|
50131
|
+
const code = lines2.slice(1).join(`
|
|
50132
|
+
`).replace(/```\s*$/, "").trimEnd();
|
|
50133
|
+
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(CodeBlock, {
|
|
50134
|
+
lang,
|
|
50135
|
+
code
|
|
50136
|
+
}, si, false, undefined, this);
|
|
50137
|
+
}
|
|
50138
|
+
const lines = seg.split(`
|
|
50139
|
+
`).filter((l) => l.trim() !== "");
|
|
50140
|
+
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Box_default, {
|
|
50141
|
+
flexDirection: "column",
|
|
50142
|
+
children: lines.map((line, li) => {
|
|
50143
|
+
if (line.match(/^[-*•]\s/)) {
|
|
50144
|
+
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Box_default, {
|
|
50145
|
+
gap: 1,
|
|
50146
|
+
children: [
|
|
50147
|
+
/* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
50148
|
+
color: ACCENT,
|
|
50149
|
+
children: "*"
|
|
50150
|
+
}, undefined, false, undefined, this),
|
|
50151
|
+
/* @__PURE__ */ jsx_dev_runtime19.jsxDEV(InlineText, {
|
|
50152
|
+
text: line.slice(2).trim()
|
|
50153
|
+
}, undefined, false, undefined, this)
|
|
50154
|
+
]
|
|
50155
|
+
}, li, true, undefined, this);
|
|
50156
|
+
}
|
|
50157
|
+
if (line.match(/^\d+\.\s/)) {
|
|
50158
|
+
const num = line.match(/^(\d+)\.\s/)[1];
|
|
50159
|
+
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Box_default, {
|
|
50160
|
+
gap: 1,
|
|
50161
|
+
children: [
|
|
50162
|
+
/* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
50163
|
+
color: "gray",
|
|
50164
|
+
children: [
|
|
50165
|
+
num,
|
|
50166
|
+
"."
|
|
50167
|
+
]
|
|
50168
|
+
}, undefined, true, undefined, this),
|
|
50169
|
+
/* @__PURE__ */ jsx_dev_runtime19.jsxDEV(InlineText, {
|
|
50170
|
+
text: line.replace(/^\d+\.\s/, "").trim()
|
|
50171
|
+
}, undefined, false, undefined, this)
|
|
50172
|
+
]
|
|
50173
|
+
}, li, true, undefined, this);
|
|
50174
|
+
}
|
|
51084
50175
|
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Box_default, {
|
|
51085
50176
|
children: /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(InlineText, {
|
|
51086
|
-
text:
|
|
50177
|
+
text: line
|
|
51087
50178
|
}, undefined, false, undefined, this)
|
|
51088
|
-
},
|
|
51089
|
-
|
|
50179
|
+
}, li, false, undefined, this);
|
|
50180
|
+
})
|
|
50181
|
+
}, si, false, undefined, this);
|
|
51090
50182
|
})
|
|
51091
50183
|
}, undefined, false, undefined, this);
|
|
51092
50184
|
}
|
|
@@ -51095,13 +50187,16 @@ function StaticMessage({ msg }) {
|
|
|
51095
50187
|
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Box_default, {
|
|
51096
50188
|
marginBottom: 1,
|
|
51097
50189
|
gap: 1,
|
|
50190
|
+
backgroundColor: "#1a1a1a",
|
|
50191
|
+
paddingLeft: 1,
|
|
50192
|
+
paddingRight: 2,
|
|
51098
50193
|
children: [
|
|
51099
50194
|
/* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
51100
|
-
color:
|
|
50195
|
+
color: "gray",
|
|
51101
50196
|
children: ">"
|
|
51102
50197
|
}, undefined, false, undefined, this),
|
|
51103
50198
|
/* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
51104
|
-
color:
|
|
50199
|
+
color: "white",
|
|
51105
50200
|
bold: true,
|
|
51106
50201
|
children: msg.content
|
|
51107
50202
|
}, undefined, false, undefined, this)
|
|
@@ -51113,12 +50208,6 @@ function StaticMessage({ msg }) {
|
|
|
51113
50208
|
shell: "$",
|
|
51114
50209
|
fetch: "~>",
|
|
51115
50210
|
"read-file": "r",
|
|
51116
|
-
"read-folder": "d",
|
|
51117
|
-
grep: "/",
|
|
51118
|
-
"delete-file": "x",
|
|
51119
|
-
"delete-folder": "X",
|
|
51120
|
-
"open-url": "↗",
|
|
51121
|
-
"generate-pdf": "P",
|
|
51122
50211
|
"write-file": "w",
|
|
51123
50212
|
search: "?"
|
|
51124
50213
|
};
|
|
@@ -51136,7 +50225,7 @@ function StaticMessage({ msg }) {
|
|
|
51136
50225
|
children: icon
|
|
51137
50226
|
}, undefined, false, undefined, this),
|
|
51138
50227
|
/* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
51139
|
-
color: msg.approved ?
|
|
50228
|
+
color: msg.approved ? "gray" : "red",
|
|
51140
50229
|
dimColor: !msg.approved,
|
|
51141
50230
|
children: label
|
|
51142
50231
|
}, undefined, false, undefined, this),
|
|
@@ -51149,7 +50238,7 @@ function StaticMessage({ msg }) {
|
|
|
51149
50238
|
msg.approved && msg.result && /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Box_default, {
|
|
51150
50239
|
marginLeft: 2,
|
|
51151
50240
|
children: /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
51152
|
-
color:
|
|
50241
|
+
color: "gray",
|
|
51153
50242
|
children: [
|
|
51154
50243
|
msg.result.split(`
|
|
51155
50244
|
`)[0]?.slice(0, 120),
|
|
@@ -51183,11 +50272,11 @@ function StaticMessage({ msg }) {
|
|
|
51183
50272
|
gap: 1,
|
|
51184
50273
|
children: [
|
|
51185
50274
|
/* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
51186
|
-
color: msg.applied ? "green" :
|
|
50275
|
+
color: msg.applied ? "green" : "gray",
|
|
51187
50276
|
children: msg.applied ? "✓" : "·"
|
|
51188
50277
|
}, undefined, false, undefined, this),
|
|
51189
50278
|
/* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
51190
|
-
color: msg.applied ? "green" :
|
|
50279
|
+
color: msg.applied ? "green" : "gray",
|
|
51191
50280
|
dimColor: !msg.applied,
|
|
51192
50281
|
children: msg.applied ? "changes applied" : "changes skipped"
|
|
51193
50282
|
}, undefined, false, undefined, this)
|