@celljs/ta-workspace 4.13.0 → 4.14.0
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/package.json +6 -6
- package/web/index.js +210 -139
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-workspace",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.14.0",
|
|
4
4
|
"description": "A pi package for Ta: the workspace beside the conversation, with an explorer, open files, search, source control, terminals and a browser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
7
7
|
],
|
|
8
|
-
"homepage": "https://github.com/cellbang/
|
|
8
|
+
"homepage": "https://github.com/cellbang/ta",
|
|
9
9
|
"bugs": {
|
|
10
|
-
"url": "https://github.com/cellbang/
|
|
10
|
+
"url": "https://github.com/cellbang/ta/issues"
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@celljs/ta-protocol": "4.
|
|
29
|
-
"@celljs/ta-web": "4.
|
|
28
|
+
"@celljs/ta-protocol": "4.14.0",
|
|
29
|
+
"@celljs/ta-web": "4.14.0",
|
|
30
30
|
"@types/react": "^19.3.0",
|
|
31
|
-
"marked": "^14.
|
|
31
|
+
"marked": "^14.1.4"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
package/web/index.js
CHANGED
|
@@ -3505,7 +3505,7 @@ class _Tokenizer {
|
|
|
3505
3505
|
code(src) {
|
|
3506
3506
|
const cap = this.rules.block.code.exec(src);
|
|
3507
3507
|
if (cap) {
|
|
3508
|
-
const text2 = cap[0].replace(/^ {1,4}/gm, "");
|
|
3508
|
+
const text2 = cap[0].replace(/^(?: {1,4}| {0,3}\t)/gm, "");
|
|
3509
3509
|
return {
|
|
3510
3510
|
type: "code",
|
|
3511
3511
|
raw: cap[0],
|
|
@@ -3681,7 +3681,7 @@ ${currentText}` : currentText;
|
|
|
3681
3681
|
itemContents = line.slice(indent);
|
|
3682
3682
|
indent += cap[1].length;
|
|
3683
3683
|
}
|
|
3684
|
-
if (blankLine && /^ *$/.test(nextLine)) {
|
|
3684
|
+
if (blankLine && /^[ \t]*$/.test(nextLine)) {
|
|
3685
3685
|
raw += nextLine + `
|
|
3686
3686
|
`;
|
|
3687
3687
|
src = src.substring(nextLine.length + 1);
|
|
@@ -3692,12 +3692,17 @@ ${currentText}` : currentText;
|
|
|
3692
3692
|
const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
|
|
3693
3693
|
const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`);
|
|
3694
3694
|
const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`);
|
|
3695
|
+
const htmlBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}<(?:[a-z].*>|!--)`, "i");
|
|
3695
3696
|
while (src) {
|
|
3696
3697
|
const rawLine = src.split(`
|
|
3697
3698
|
`, 1)[0];
|
|
3699
|
+
let nextLineWithoutTabs;
|
|
3698
3700
|
nextLine = rawLine;
|
|
3699
3701
|
if (this.options.pedantic) {
|
|
3700
3702
|
nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ");
|
|
3703
|
+
nextLineWithoutTabs = nextLine;
|
|
3704
|
+
} else {
|
|
3705
|
+
nextLineWithoutTabs = nextLine.replace(/\t/g, " ");
|
|
3701
3706
|
}
|
|
3702
3707
|
if (fencesBeginRegex.test(nextLine)) {
|
|
3703
3708
|
break;
|
|
@@ -3705,20 +3710,23 @@ ${currentText}` : currentText;
|
|
|
3705
3710
|
if (headingBeginRegex.test(nextLine)) {
|
|
3706
3711
|
break;
|
|
3707
3712
|
}
|
|
3713
|
+
if (htmlBeginRegex.test(nextLine)) {
|
|
3714
|
+
break;
|
|
3715
|
+
}
|
|
3708
3716
|
if (nextBulletRegex.test(nextLine)) {
|
|
3709
3717
|
break;
|
|
3710
3718
|
}
|
|
3711
|
-
if (hrRegex.test(
|
|
3719
|
+
if (hrRegex.test(nextLine)) {
|
|
3712
3720
|
break;
|
|
3713
3721
|
}
|
|
3714
|
-
if (
|
|
3722
|
+
if (nextLineWithoutTabs.search(/[^ ]/) >= indent || !nextLine.trim()) {
|
|
3715
3723
|
itemContents += `
|
|
3716
|
-
` +
|
|
3724
|
+
` + nextLineWithoutTabs.slice(indent);
|
|
3717
3725
|
} else {
|
|
3718
3726
|
if (blankLine) {
|
|
3719
3727
|
break;
|
|
3720
3728
|
}
|
|
3721
|
-
if (line.search(/[^ ]/) >= 4) {
|
|
3729
|
+
if (line.replace(/\t/g, " ").search(/[^ ]/) >= 4) {
|
|
3722
3730
|
break;
|
|
3723
3731
|
}
|
|
3724
3732
|
if (fencesBeginRegex.test(line)) {
|
|
@@ -3739,13 +3747,13 @@ ${currentText}` : currentText;
|
|
|
3739
3747
|
raw += rawLine + `
|
|
3740
3748
|
`;
|
|
3741
3749
|
src = src.substring(rawLine.length + 1);
|
|
3742
|
-
line =
|
|
3750
|
+
line = nextLineWithoutTabs.slice(indent);
|
|
3743
3751
|
}
|
|
3744
3752
|
}
|
|
3745
3753
|
if (!list.loose) {
|
|
3746
3754
|
if (endsWithBlankLine) {
|
|
3747
3755
|
list.loose = true;
|
|
3748
|
-
} else if (/\n *\n *$/.test(raw)) {
|
|
3756
|
+
} else if (/\n[ \t]*\n[ \t]*$/.test(raw)) {
|
|
3749
3757
|
endsWithBlankLine = true;
|
|
3750
3758
|
}
|
|
3751
3759
|
}
|
|
@@ -4169,21 +4177,21 @@ ${currentText}` : currentText;
|
|
|
4169
4177
|
}
|
|
4170
4178
|
}
|
|
4171
4179
|
}
|
|
4172
|
-
var newline = /^(?: *(?:\n|$))+/;
|
|
4173
|
-
var blockCode = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/;
|
|
4180
|
+
var newline = /^(?:[ \t]*(?:\n|$))+/;
|
|
4181
|
+
var blockCode = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
|
|
4174
4182
|
var fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
|
|
4175
4183
|
var hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
4176
4184
|
var heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
4177
4185
|
var bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
|
4178
|
-
var lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, bullet).replace(/blockCode/g, / {4}/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).getRegex();
|
|
4186
|
+
var lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, bullet).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).getRegex();
|
|
4179
4187
|
var _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
|
|
4180
4188
|
var blockText = /^[^\n]+/;
|
|
4181
4189
|
var _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
|
|
4182
|
-
var def = edit(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
|
4190
|
+
var def = edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
|
4183
4191
|
var list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex();
|
|
4184
4192
|
var _tag = "address|article|aside|base|basefont|blockquote|body|caption" + "|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption" + "|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe" + "|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option" + "|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title" + "|tr|track|ul";
|
|
4185
4193
|
var _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
4186
|
-
var html = edit("^ {0,3}(?:" + "<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)" + "|comment[^\\n]*(\\n+|$)" + "|<\\?[\\s\\S]*?(?:\\?>\\n*|$)" + "|<![A-Z][\\s\\S]*?(?:>\\n*|$)" + "|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)" + "|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)" + "|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)" + "|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)" + ")", "i").replace("comment", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
4194
|
+
var html = edit("^ {0,3}(?:" + "<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)" + "|comment[^\\n]*(\\n+|$)" + "|<\\?[\\s\\S]*?(?:\\?>\\n*|$)" + "|<![A-Z][\\s\\S]*?(?:>\\n*|$)" + "|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)" + "|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)" + "|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)" + "|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)" + ")", "i").replace("comment", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
4187
4195
|
var paragraph = edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
|
|
4188
4196
|
var blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex();
|
|
4189
4197
|
var blockNormal = {
|
|
@@ -4201,7 +4209,7 @@ var blockNormal = {
|
|
|
4201
4209
|
table: noopTest,
|
|
4202
4210
|
text: blockText
|
|
4203
4211
|
};
|
|
4204
|
-
var gfmTable = edit("^ *([^\\n ].*)\\n" + " {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)" + "(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
|
|
4212
|
+
var gfmTable = edit("^ *([^\\n ].*)\\n" + " {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)" + "(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3}\t)[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
|
|
4205
4213
|
var blockGfm = {
|
|
4206
4214
|
...blockNormal,
|
|
4207
4215
|
table: gfmTable,
|
|
@@ -4223,7 +4231,7 @@ var br = /^( {2,}|\\)\n(?!\s*$)/;
|
|
|
4223
4231
|
var inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
4224
4232
|
var _punctuation = "\\p{P}\\p{S}";
|
|
4225
4233
|
var punctuation = edit(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, _punctuation).getRegex();
|
|
4226
|
-
var blockSkip = /\[[^[\]]*?\]\([
|
|
4234
|
+
var blockSkip = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
|
|
4227
4235
|
var emStrongLDelim = edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, _punctuation).getRegex();
|
|
4228
4236
|
var emStrongRDelimAst = edit("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)" + "|[^*]+(?=[^*])" + "|(?!\\*)[punct](\\*+)(?=[\\s]|$)" + "|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)" + "|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])" + "|[\\s](\\*+)(?!\\*)(?=[punct])" + "|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])" + "|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, _punctuation).getRegex();
|
|
4229
4237
|
var emStrongRDelimUnd = edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)" + "|[^_]+(?=[^_])" + "|(?!_)[punct](_+)(?=[\\s]|$)" + "|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)" + "|(?!_)[punct\\s](_+)(?=[^punct\\s])" + "|[\\s](_+)(?!_)(?=[punct])" + "|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, _punctuation).getRegex();
|
|
@@ -4267,7 +4275,7 @@ var inlineGfm = {
|
|
|
4267
4275
|
escape: edit(escape).replace("])", "~|])").getRegex(),
|
|
4268
4276
|
url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
4269
4277
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
4270
|
-
del: /^(~~?)(?=[^\s~])([
|
|
4278
|
+
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
|
4271
4279
|
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
4272
4280
|
};
|
|
4273
4281
|
var inlineBreaks = {
|
|
@@ -4352,10 +4360,6 @@ class _Lexer {
|
|
|
4352
4360
|
blockTokens(src, tokens = [], lastParagraphClipped = false) {
|
|
4353
4361
|
if (this.options.pedantic) {
|
|
4354
4362
|
src = src.replace(/\t/g, " ").replace(/^ +$/gm, "");
|
|
4355
|
-
} else {
|
|
4356
|
-
src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
|
|
4357
|
-
return leading + " ".repeat(tabs.length);
|
|
4358
|
-
});
|
|
4359
4363
|
}
|
|
4360
4364
|
let token;
|
|
4361
4365
|
let lastToken;
|
|
@@ -5027,6 +5031,7 @@ class _Parser {
|
|
|
5027
5031
|
|
|
5028
5032
|
class _Hooks {
|
|
5029
5033
|
options;
|
|
5034
|
+
block;
|
|
5030
5035
|
constructor(options) {
|
|
5031
5036
|
this.options = options || _defaults;
|
|
5032
5037
|
}
|
|
@@ -5044,13 +5049,19 @@ class _Hooks {
|
|
|
5044
5049
|
processAllTokens(tokens) {
|
|
5045
5050
|
return tokens;
|
|
5046
5051
|
}
|
|
5052
|
+
provideLexer() {
|
|
5053
|
+
return this.block ? _Lexer.lex : _Lexer.lexInline;
|
|
5054
|
+
}
|
|
5055
|
+
provideParser() {
|
|
5056
|
+
return this.block ? _Parser.parse : _Parser.parseInline;
|
|
5057
|
+
}
|
|
5047
5058
|
}
|
|
5048
5059
|
|
|
5049
5060
|
class Marked {
|
|
5050
5061
|
defaults = _getDefaults();
|
|
5051
5062
|
options = this.setOptions;
|
|
5052
|
-
parse = this.parseMarkdown(
|
|
5053
|
-
parseInline = this.parseMarkdown(
|
|
5063
|
+
parse = this.parseMarkdown(true);
|
|
5064
|
+
parseInline = this.parseMarkdown(false);
|
|
5054
5065
|
Parser = _Parser;
|
|
5055
5066
|
Renderer = _Renderer;
|
|
5056
5067
|
TextRenderer = _TextRenderer;
|
|
@@ -5203,7 +5214,7 @@ class Marked {
|
|
|
5203
5214
|
if (!(prop in hooks)) {
|
|
5204
5215
|
throw new Error(`hook '${prop}' does not exist`);
|
|
5205
5216
|
}
|
|
5206
|
-
if (
|
|
5217
|
+
if (["options", "block"].includes(prop)) {
|
|
5207
5218
|
continue;
|
|
5208
5219
|
}
|
|
5209
5220
|
const hooksProp = prop;
|
|
@@ -5257,7 +5268,7 @@ class Marked {
|
|
|
5257
5268
|
parser(tokens, options) {
|
|
5258
5269
|
return _Parser.parse(tokens, options ?? this.defaults);
|
|
5259
5270
|
}
|
|
5260
|
-
parseMarkdown(
|
|
5271
|
+
parseMarkdown(blockType) {
|
|
5261
5272
|
const parse = (src, options) => {
|
|
5262
5273
|
const origOpt = { ...options };
|
|
5263
5274
|
const opt = { ...this.defaults, ...origOpt };
|
|
@@ -5273,7 +5284,10 @@ class Marked {
|
|
|
5273
5284
|
}
|
|
5274
5285
|
if (opt.hooks) {
|
|
5275
5286
|
opt.hooks.options = opt;
|
|
5287
|
+
opt.hooks.block = blockType;
|
|
5276
5288
|
}
|
|
5289
|
+
const lexer = opt.hooks ? opt.hooks.provideLexer() : blockType ? _Lexer.lex : _Lexer.lexInline;
|
|
5290
|
+
const parser = opt.hooks ? opt.hooks.provideParser() : blockType ? _Parser.parse : _Parser.parseInline;
|
|
5277
5291
|
if (opt.async) {
|
|
5278
5292
|
return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer(src2, opt)).then((tokens) => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser(tokens, opt)).then((html2) => opt.hooks ? opt.hooks.postprocess(html2) : html2).catch(throwError);
|
|
5279
5293
|
}
|
|
@@ -5928,119 +5942,6 @@ var TaPackageTextUtil;
|
|
|
5928
5942
|
}
|
|
5929
5943
|
TaPackageTextUtil2.pick = pick;
|
|
5930
5944
|
})(TaPackageTextUtil || (TaPackageTextUtil = {}));
|
|
5931
|
-
// ../ta-protocol/esm/common/relay-protocol.js
|
|
5932
|
-
var TaRelayServer = Symbol("TaRelayServer");
|
|
5933
|
-
// ../ta-protocol/esm/common/remote-protocol.js
|
|
5934
|
-
var TaRemoteServer = Symbol("TaRemoteServer");
|
|
5935
|
-
// ../ta-protocol/esm/common/room-protocol.js
|
|
5936
|
-
var TaRoomServer = Symbol("TaRoomServer");
|
|
5937
|
-
var TaRoomWatchUtil;
|
|
5938
|
-
(function(TaRoomWatchUtil2) {
|
|
5939
|
-
function of(messages, state) {
|
|
5940
|
-
const prefixes = Array.isArray(state) ? state.filter((prefix) => typeof prefix === "string" && prefix.length > 0) : [];
|
|
5941
|
-
return { messages: messages !== false, state: [...new Set(prefixes)].sort() };
|
|
5942
|
-
}
|
|
5943
|
-
TaRoomWatchUtil2.of = of;
|
|
5944
|
-
function union(watches) {
|
|
5945
|
-
let messages = false;
|
|
5946
|
-
const state = [];
|
|
5947
|
-
for (const watch of watches) {
|
|
5948
|
-
messages || (messages = watch.messages);
|
|
5949
|
-
state.push(...watch.state);
|
|
5950
|
-
}
|
|
5951
|
-
return of(messages, messages ? [] : state);
|
|
5952
|
-
}
|
|
5953
|
-
TaRoomWatchUtil2.union = union;
|
|
5954
|
-
function same(a, b) {
|
|
5955
|
-
return a === b || !!a && !!b && a.messages === b.messages && a.state.join(`
|
|
5956
|
-
`) === b.state.join(`
|
|
5957
|
-
`);
|
|
5958
|
-
}
|
|
5959
|
-
TaRoomWatchUtil2.same = same;
|
|
5960
|
-
function hears(watch, event) {
|
|
5961
|
-
if (event.type === "message") {
|
|
5962
|
-
return watch.messages;
|
|
5963
|
-
}
|
|
5964
|
-
if (event.type === "state") {
|
|
5965
|
-
return watch.messages || watch.state.some((prefix) => event.key.startsWith(prefix));
|
|
5966
|
-
}
|
|
5967
|
-
return true;
|
|
5968
|
-
}
|
|
5969
|
-
TaRoomWatchUtil2.hears = hears;
|
|
5970
|
-
})(TaRoomWatchUtil || (TaRoomWatchUtil = {}));
|
|
5971
|
-
// ../ta-protocol/esm/common/settings-protocol.js
|
|
5972
|
-
var TaSettingsServer = Symbol("TaSettingsServer");
|
|
5973
|
-
// ../ta-protocol/esm/common/ta-extension-host.js
|
|
5974
|
-
var TA_HOST_EVENT = "ta:host";
|
|
5975
|
-
var TaHostUtil;
|
|
5976
|
-
(function(TaHostUtil2) {
|
|
5977
|
-
TaHostUtil2.WAIT_MS = 1000;
|
|
5978
|
-
function reach(events, name, waitMs = TaHostUtil2.WAIT_MS) {
|
|
5979
|
-
return new Promise((resolve) => {
|
|
5980
|
-
let heard = false;
|
|
5981
|
-
let answered = false;
|
|
5982
|
-
const timer = setTimeout(() => resolve(undefined), waitMs);
|
|
5983
|
-
const request = {
|
|
5984
|
-
name,
|
|
5985
|
-
heard: () => {
|
|
5986
|
-
heard = true;
|
|
5987
|
-
},
|
|
5988
|
-
resolve: (answer) => {
|
|
5989
|
-
answered = true;
|
|
5990
|
-
clearTimeout(timer);
|
|
5991
|
-
resolve(answer);
|
|
5992
|
-
}
|
|
5993
|
-
};
|
|
5994
|
-
events.emit(TA_HOST_EVENT, request);
|
|
5995
|
-
if (!heard && !answered) {
|
|
5996
|
-
clearTimeout(timer);
|
|
5997
|
-
resolve(undefined);
|
|
5998
|
-
}
|
|
5999
|
-
});
|
|
6000
|
-
}
|
|
6001
|
-
TaHostUtil2.reach = reach;
|
|
6002
|
-
})(TaHostUtil || (TaHostUtil = {}));
|
|
6003
|
-
var TA_ASK_ENTRY = "ta-ask";
|
|
6004
|
-
var TaAskUtil;
|
|
6005
|
-
(function(TaAskUtil2) {
|
|
6006
|
-
const LENGTH = 120;
|
|
6007
|
-
function entry(question) {
|
|
6008
|
-
const line = question.replace(/\s+/g, " ").trim();
|
|
6009
|
-
return { question: line.length > LENGTH ? `${line.slice(0, LENGTH - 1)}…` : line };
|
|
6010
|
-
}
|
|
6011
|
-
TaAskUtil2.entry = entry;
|
|
6012
|
-
function asking(entries) {
|
|
6013
|
-
var _a;
|
|
6014
|
-
for (let i = entries.length - 1;i >= 0; i--) {
|
|
6015
|
-
const entry2 = entries[i];
|
|
6016
|
-
if (entry2.type === "message" && ((_a = entry2.message) === null || _a === undefined ? undefined : _a.role) === "user") {
|
|
6017
|
-
return;
|
|
6018
|
-
}
|
|
6019
|
-
if (entry2.type === "custom" && entry2.customType === TA_ASK_ENTRY) {
|
|
6020
|
-
return read(entry2);
|
|
6021
|
-
}
|
|
6022
|
-
}
|
|
6023
|
-
return;
|
|
6024
|
-
}
|
|
6025
|
-
TaAskUtil2.asking = asking;
|
|
6026
|
-
function next(asked, entry2) {
|
|
6027
|
-
var _a;
|
|
6028
|
-
if (entry2.type === "message" && ((_a = entry2.message) === null || _a === undefined ? undefined : _a.role) === "user") {
|
|
6029
|
-
return;
|
|
6030
|
-
}
|
|
6031
|
-
return entry2.type === "custom" && entry2.customType === TA_ASK_ENTRY ? read(entry2) : asked;
|
|
6032
|
-
}
|
|
6033
|
-
TaAskUtil2.next = next;
|
|
6034
|
-
function read(found) {
|
|
6035
|
-
var _a;
|
|
6036
|
-
const question = (_a = found.data) === null || _a === undefined ? undefined : _a.question;
|
|
6037
|
-
if (typeof question !== "string" || !question.trim()) {
|
|
6038
|
-
return;
|
|
6039
|
-
}
|
|
6040
|
-
const at2 = found.timestamp ? Date.parse(found.timestamp) : Number.NaN;
|
|
6041
|
-
return { question: entry(question).question, at: Number.isNaN(at2) ? 0 : at2 };
|
|
6042
|
-
}
|
|
6043
|
-
})(TaAskUtil || (TaAskUtil = {}));
|
|
6044
5945
|
// ../ta-protocol/esm/common/ta-protocol.js
|
|
6045
5946
|
var TaServer = Symbol("TaServer");
|
|
6046
5947
|
var TaClient = Symbol("TaClient");
|
|
@@ -6226,6 +6127,176 @@ var TaSkillUse;
|
|
|
6226
6127
|
}
|
|
6227
6128
|
TaSkillUse2.command = command;
|
|
6228
6129
|
})(TaSkillUse || (TaSkillUse = {}));
|
|
6130
|
+
|
|
6131
|
+
// ../ta-protocol/esm/common/presence-protocol.js
|
|
6132
|
+
var TaPresenceServer = Symbol("TaPresenceServer");
|
|
6133
|
+
var TaMessageAuthor;
|
|
6134
|
+
(function(TaMessageAuthor2) {
|
|
6135
|
+
const LINE = /^\[ta:by ([^\s\]]+)(?: ([^\]\n]+))?\]$/m;
|
|
6136
|
+
const LINES = /^\[ta:by [^\]\n]*\]$\n?/gm;
|
|
6137
|
+
function strip(message) {
|
|
6138
|
+
const context = TaMessageContext.read(message);
|
|
6139
|
+
if (context === undefined || !LINE.test(context)) {
|
|
6140
|
+
return message;
|
|
6141
|
+
}
|
|
6142
|
+
const kept = context.replace(LINES, "").replace(/\n+$/, "");
|
|
6143
|
+
const body = TaMessageContext.strip(message);
|
|
6144
|
+
return kept.trim() ? TaMessageContext.wrap(kept, body) : body;
|
|
6145
|
+
}
|
|
6146
|
+
TaMessageAuthor2.strip = strip;
|
|
6147
|
+
function mark(message, id, name) {
|
|
6148
|
+
const plain = strip(message);
|
|
6149
|
+
if (/^[/!]/.test(plain)) {
|
|
6150
|
+
return plain;
|
|
6151
|
+
}
|
|
6152
|
+
const line = `[ta:by ${id.replace(/[\s\]]/g, "")} ${name.replace(/[\]\n]/g, " ").trim() || id}]`;
|
|
6153
|
+
const context = TaMessageContext.read(plain);
|
|
6154
|
+
return TaMessageContext.wrap(context === undefined ? line : `${context}
|
|
6155
|
+
${line}`, TaMessageContext.strip(plain));
|
|
6156
|
+
}
|
|
6157
|
+
TaMessageAuthor2.mark = mark;
|
|
6158
|
+
function of(message) {
|
|
6159
|
+
var _a;
|
|
6160
|
+
const context = TaMessageContext.read(message);
|
|
6161
|
+
const match = context === undefined ? null : LINE.exec(context);
|
|
6162
|
+
return match ? { id: match[1], name: ((_a = match[2]) !== null && _a !== undefined ? _a : match[1]).trim() } : undefined;
|
|
6163
|
+
}
|
|
6164
|
+
TaMessageAuthor2.of = of;
|
|
6165
|
+
})(TaMessageAuthor || (TaMessageAuthor = {}));
|
|
6166
|
+
// ../ta-protocol/esm/common/relay-protocol.js
|
|
6167
|
+
var TaRelayServer = Symbol("TaRelayServer");
|
|
6168
|
+
// ../ta-protocol/esm/common/remote-protocol.js
|
|
6169
|
+
var TaRemoteServer = Symbol("TaRemoteServer");
|
|
6170
|
+
// ../ta-protocol/esm/common/room-protocol.js
|
|
6171
|
+
var TaRoomServer = Symbol("TaRoomServer");
|
|
6172
|
+
var TaRoomWatchUtil;
|
|
6173
|
+
(function(TaRoomWatchUtil2) {
|
|
6174
|
+
function of(messages, state) {
|
|
6175
|
+
const prefixes = Array.isArray(state) ? state.filter((prefix) => typeof prefix === "string" && prefix.length > 0) : [];
|
|
6176
|
+
return { messages: messages !== false, state: [...new Set(prefixes)].sort() };
|
|
6177
|
+
}
|
|
6178
|
+
TaRoomWatchUtil2.of = of;
|
|
6179
|
+
function union(watches) {
|
|
6180
|
+
let messages = false;
|
|
6181
|
+
const state = [];
|
|
6182
|
+
for (const watch of watches) {
|
|
6183
|
+
messages || (messages = watch.messages);
|
|
6184
|
+
state.push(...watch.state);
|
|
6185
|
+
}
|
|
6186
|
+
return of(messages, messages ? [] : state);
|
|
6187
|
+
}
|
|
6188
|
+
TaRoomWatchUtil2.union = union;
|
|
6189
|
+
function same(a, b) {
|
|
6190
|
+
return a === b || !!a && !!b && a.messages === b.messages && a.state.join(`
|
|
6191
|
+
`) === b.state.join(`
|
|
6192
|
+
`);
|
|
6193
|
+
}
|
|
6194
|
+
TaRoomWatchUtil2.same = same;
|
|
6195
|
+
function hears(watch, event) {
|
|
6196
|
+
if (event.type === "message") {
|
|
6197
|
+
return watch.messages;
|
|
6198
|
+
}
|
|
6199
|
+
if (event.type === "state") {
|
|
6200
|
+
return watch.messages || watch.state.some((prefix) => event.key.startsWith(prefix));
|
|
6201
|
+
}
|
|
6202
|
+
return true;
|
|
6203
|
+
}
|
|
6204
|
+
TaRoomWatchUtil2.hears = hears;
|
|
6205
|
+
})(TaRoomWatchUtil || (TaRoomWatchUtil = {}));
|
|
6206
|
+
// ../ta-protocol/esm/common/settings-protocol.js
|
|
6207
|
+
var TaSettingsServer = Symbol("TaSettingsServer");
|
|
6208
|
+
// ../ta-protocol/esm/common/ta-extension-host.js
|
|
6209
|
+
var TA_HOST_EVENT = "ta:host";
|
|
6210
|
+
var TaHostUtil;
|
|
6211
|
+
(function(TaHostUtil2) {
|
|
6212
|
+
TaHostUtil2.WAIT_MS = 1000;
|
|
6213
|
+
function reach(events, name, waitMs = TaHostUtil2.WAIT_MS) {
|
|
6214
|
+
return new Promise((resolve) => {
|
|
6215
|
+
let heard = false;
|
|
6216
|
+
let answered = false;
|
|
6217
|
+
const timer = setTimeout(() => resolve(undefined), waitMs);
|
|
6218
|
+
const request = {
|
|
6219
|
+
name,
|
|
6220
|
+
heard: () => {
|
|
6221
|
+
heard = true;
|
|
6222
|
+
},
|
|
6223
|
+
resolve: (answer) => {
|
|
6224
|
+
answered = true;
|
|
6225
|
+
clearTimeout(timer);
|
|
6226
|
+
resolve(answer);
|
|
6227
|
+
}
|
|
6228
|
+
};
|
|
6229
|
+
events.emit(TA_HOST_EVENT, request);
|
|
6230
|
+
if (!heard && !answered) {
|
|
6231
|
+
clearTimeout(timer);
|
|
6232
|
+
resolve(undefined);
|
|
6233
|
+
}
|
|
6234
|
+
});
|
|
6235
|
+
}
|
|
6236
|
+
TaHostUtil2.reach = reach;
|
|
6237
|
+
function marked2(systemPrompt, mark) {
|
|
6238
|
+
return role(systemPrompt).includes(mark);
|
|
6239
|
+
}
|
|
6240
|
+
TaHostUtil2.marked = marked2;
|
|
6241
|
+
function role(systemPrompt) {
|
|
6242
|
+
if (!systemPrompt) {
|
|
6243
|
+
return "";
|
|
6244
|
+
}
|
|
6245
|
+
const open = `<addendum>
|
|
6246
|
+
`;
|
|
6247
|
+
const start = systemPrompt.indexOf(open);
|
|
6248
|
+
const context = systemPrompt.indexOf(`<project_context>
|
|
6249
|
+
`);
|
|
6250
|
+
if (start < 0 || context >= 0 && context < start) {
|
|
6251
|
+
return "";
|
|
6252
|
+
}
|
|
6253
|
+
const end = systemPrompt.indexOf(`
|
|
6254
|
+
</addendum>`, start);
|
|
6255
|
+
return systemPrompt.slice(start + open.length, end < 0 ? undefined : end);
|
|
6256
|
+
}
|
|
6257
|
+
TaHostUtil2.role = role;
|
|
6258
|
+
})(TaHostUtil || (TaHostUtil = {}));
|
|
6259
|
+
var TA_ASK_ENTRY = "ta-ask";
|
|
6260
|
+
var TaAskUtil;
|
|
6261
|
+
(function(TaAskUtil2) {
|
|
6262
|
+
const LENGTH = 120;
|
|
6263
|
+
function entry(question) {
|
|
6264
|
+
const line = question.replace(/\s+/g, " ").trim();
|
|
6265
|
+
return { question: line.length > LENGTH ? `${line.slice(0, LENGTH - 1)}…` : line };
|
|
6266
|
+
}
|
|
6267
|
+
TaAskUtil2.entry = entry;
|
|
6268
|
+
function asking(entries) {
|
|
6269
|
+
var _a;
|
|
6270
|
+
for (let i = entries.length - 1;i >= 0; i--) {
|
|
6271
|
+
const entry2 = entries[i];
|
|
6272
|
+
if (entry2.type === "message" && ((_a = entry2.message) === null || _a === undefined ? undefined : _a.role) === "user") {
|
|
6273
|
+
return;
|
|
6274
|
+
}
|
|
6275
|
+
if (entry2.type === "custom" && entry2.customType === TA_ASK_ENTRY) {
|
|
6276
|
+
return read(entry2);
|
|
6277
|
+
}
|
|
6278
|
+
}
|
|
6279
|
+
return;
|
|
6280
|
+
}
|
|
6281
|
+
TaAskUtil2.asking = asking;
|
|
6282
|
+
function next(asked, entry2) {
|
|
6283
|
+
var _a;
|
|
6284
|
+
if (entry2.type === "message" && ((_a = entry2.message) === null || _a === undefined ? undefined : _a.role) === "user") {
|
|
6285
|
+
return;
|
|
6286
|
+
}
|
|
6287
|
+
return entry2.type === "custom" && entry2.customType === TA_ASK_ENTRY ? read(entry2) : asked;
|
|
6288
|
+
}
|
|
6289
|
+
TaAskUtil2.next = next;
|
|
6290
|
+
function read(found) {
|
|
6291
|
+
var _a;
|
|
6292
|
+
const question = (_a = found.data) === null || _a === undefined ? undefined : _a.question;
|
|
6293
|
+
if (typeof question !== "string" || !question.trim()) {
|
|
6294
|
+
return;
|
|
6295
|
+
}
|
|
6296
|
+
const at2 = found.timestamp ? Date.parse(found.timestamp) : Number.NaN;
|
|
6297
|
+
return { question: entry(question).question, at: Number.isNaN(at2) ? 0 : at2 };
|
|
6298
|
+
}
|
|
6299
|
+
})(TaAskUtil || (TaAskUtil = {}));
|
|
6229
6300
|
// ../ta-protocol/esm/common/team-protocol.js
|
|
6230
6301
|
var TA_UNDECLARED = "extensions.install";
|
|
6231
6302
|
var TaPermissionUtil;
|
|
@@ -9113,10 +9184,10 @@ var STYLE = `
|
|
|
9113
9184
|
.taw-button.taw-small { height: 24px; padding: 0 8px; font-size: calc(12px * var(--ta-font-scale)); flex: none; }
|
|
9114
9185
|
.taw-button:disabled { opacity: 0.6; cursor: default; }
|
|
9115
9186
|
.taw-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ta-text); }
|
|
9116
|
-
.taw-segmented { display: inline-flex; flex: none; min-inline-size: 0; margin: 0; border: 0; padding: 2px; border-radius: 7px; background: var(--ta-
|
|
9187
|
+
.taw-segmented { display: inline-flex; flex: none; min-inline-size: 0; margin: 0; border: 0; padding: 2px; border-radius: 7px; background: var(--ta-raised); }
|
|
9117
9188
|
.taw-segmented > button { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border: 0; border-radius: 5px; background: none; color: var(--ta-secondary); font: inherit; font-size: calc(12px * var(--ta-font-scale)); cursor: pointer; }
|
|
9118
9189
|
.taw-segmented > button:hover { color: var(--ta-text); }
|
|
9119
|
-
.taw-segmented > button.taw-on { background: var(--ta-
|
|
9190
|
+
.taw-segmented > button.taw-on { background: var(--ta-segment); color: var(--ta-text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
|
|
9120
9191
|
.taw-segmented > button:focus-visible { outline: 1px solid var(--ta-border-focus); outline-offset: -1px; }
|
|
9121
9192
|
.taw-preview-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: var(--ta-main); }
|
|
9122
9193
|
.taw-preview-page { background: #fff; }
|