@parall/cli 1.69.0 → 1.71.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/dist/commands/apps-action-local.d.ts +44 -0
- package/dist/commands/apps-action-local.d.ts.map +1 -0
- package/dist/commands/apps-action-local.js +153 -0
- package/dist/commands/apps-action-stack.d.ts +14 -0
- package/dist/commands/apps-action-stack.d.ts.map +1 -0
- package/dist/commands/apps-action-stack.js +63 -0
- package/dist/commands/apps-actions-sdk.generated.d.ts +2 -0
- package/dist/commands/apps-actions-sdk.generated.d.ts.map +1 -0
- package/dist/commands/apps-actions-sdk.generated.js +3 -0
- package/dist/commands/apps-actions.d.ts +20 -0
- package/dist/commands/apps-actions.d.ts.map +1 -0
- package/dist/commands/apps-actions.js +266 -0
- package/dist/commands/apps-check.d.ts +34 -0
- package/dist/commands/apps-check.d.ts.map +1 -0
- package/dist/commands/apps-check.js +155 -0
- package/dist/commands/apps-dev-page.d.ts +26 -0
- package/dist/commands/apps-dev-page.d.ts.map +1 -0
- package/dist/commands/apps-dev-page.js +259 -0
- package/dist/commands/apps-dev-server.d.ts +42 -0
- package/dist/commands/apps-dev-server.d.ts.map +1 -0
- package/dist/commands/apps-dev-server.js +328 -0
- package/dist/commands/apps-dev.d.ts +8 -0
- package/dist/commands/apps-dev.d.ts.map +1 -0
- package/dist/commands/apps-dev.js +126 -0
- package/dist/commands/apps-local-runner.generated.d.ts +3 -0
- package/dist/commands/apps-local-runner.generated.d.ts.map +1 -0
- package/dist/commands/apps-local-runner.generated.js +4 -0
- package/dist/commands/apps-page-sdk.generated.d.ts +2 -0
- package/dist/commands/apps-page-sdk.generated.d.ts.map +1 -0
- package/dist/commands/apps-page-sdk.generated.js +3 -0
- package/dist/commands/apps-publish.d.ts.map +1 -1
- package/dist/commands/apps-publish.js +6 -0
- package/dist/commands/apps-scaffold-actions.d.ts +11 -0
- package/dist/commands/apps-scaffold-actions.d.ts.map +1 -0
- package/dist/commands/apps-scaffold-actions.js +163 -0
- package/dist/commands/apps-scaffold.d.ts +4 -6
- package/dist/commands/apps-scaffold.d.ts.map +1 -1
- package/dist/commands/apps-scaffold.js +22 -222
- package/dist/commands/apps.d.ts +3 -2
- package/dist/commands/apps.d.ts.map +1 -1
- package/dist/commands/apps.js +9 -2
- package/dist/commands/db-plane.d.ts.map +1 -1
- package/dist/commands/db-plane.js +2 -0
- package/dist/commands/dbs.d.ts.map +1 -1
- package/dist/commands/dbs.js +1 -8
- package/dist/commands/messages.d.ts.map +1 -1
- package/dist/commands/messages.js +6 -11
- package/dist/commands/msteams.d.ts +10 -0
- package/dist/commands/msteams.d.ts.map +1 -0
- package/dist/commands/msteams.js +41 -0
- package/dist/commands/wiki.d.ts.map +1 -1
- package/dist/commands/wiki.js +20 -8
- package/dist/index.js +7 -5
- package/dist/lib/client.d.ts +2 -1
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/mini-app-discovery.d.ts +6 -0
- package/dist/lib/mini-app-discovery.d.ts.map +1 -0
- package/dist/lib/mini-app-discovery.js +32 -0
- package/dist/lib/output.d.ts +3 -1
- package/dist/lib/output.d.ts.map +1 -1
- package/dist/lib/output.js +5 -1
- package/dist/lib/wiki-index.d.ts +2 -0
- package/dist/lib/wiki-index.d.ts.map +1 -1
- package/dist/lib/wiki-index.js +28 -73
- package/dist/lib/wiki-search-text.d.ts +37 -0
- package/dist/lib/wiki-search-text.d.ts.map +1 -0
- package/dist/lib/wiki-search-text.js +170 -0
- package/package.json +9 -5
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// Text preparation for local wiki search and query scoring: CommonMark
|
|
2
|
+
// character-reference decoding (the text a Wiki reader sees) and the
|
|
3
|
+
// CJK-aware tokenizer (Latin/digit words plus CJK unigrams and bigrams).
|
|
4
|
+
import { decodeNamedCharacterReference } from 'decode-named-character-reference';
|
|
5
|
+
import { parse, postprocess, preprocess } from 'micromark';
|
|
6
|
+
import { gfmTable } from 'micromark-extension-gfm-table';
|
|
7
|
+
import { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';
|
|
8
|
+
/** Text a reader never sees: link and definition destinations and titles, the
|
|
9
|
+
* labels of definitions and full references, and fenced-code info strings.
|
|
10
|
+
* References there stay literal, like code. */
|
|
11
|
+
const LITERAL_CONSTRUCTS = new Set([
|
|
12
|
+
'resourceDestination',
|
|
13
|
+
'resourceTitle',
|
|
14
|
+
'definitionLabelString',
|
|
15
|
+
'definitionDestination',
|
|
16
|
+
'definitionTitle',
|
|
17
|
+
'referenceString',
|
|
18
|
+
'codeFencedFenceInfo',
|
|
19
|
+
'codeFencedFenceMeta',
|
|
20
|
+
]);
|
|
21
|
+
/** GFM tables, as the server's search projection parses them: a `|` splits a
|
|
22
|
+
* cell even inside backticks. GFM autolink literals stay off there too, so
|
|
23
|
+
* references in a bare URL decode like the rest of the paragraph. */
|
|
24
|
+
const PARSE_OPTIONS = { extensions: [gfmTable()] };
|
|
25
|
+
/** Every character reference micromark can accept has this shape: 1–7
|
|
26
|
+
* decimal or 1–6 hexadecimal digits, or a 2–31 character entity name. Text
|
|
27
|
+
* without one is its own decoding and skips the parser. */
|
|
28
|
+
const REFERENCE_SHAPE = /&(?:#\d{1,7}|#[xX][\dA-Fa-f]{1,6}|[A-Za-z][A-Za-z\d]{1,30});/;
|
|
29
|
+
/**
|
|
30
|
+
* Longer text is returned raw. micromark's inline resolution is quadratic on
|
|
31
|
+
* adversarial input (a 30 KB run of `_a*` takes over a second), and local
|
|
32
|
+
* search decodes every section on every query. Real sections are far smaller:
|
|
33
|
+
* when this cap was set, 1 of the 6,181 sections in the repository's docs/
|
|
34
|
+
* exceeded it.
|
|
35
|
+
*/
|
|
36
|
+
export const MAX_DECODED_LENGTH = 16 * 1024;
|
|
37
|
+
/** Headings are decoded as ATX heading content, never as a block of their own. */
|
|
38
|
+
const HEADING_PREFIX = '# ';
|
|
39
|
+
/**
|
|
40
|
+
* Markdown with every CommonMark character reference in reader text (`&`,
|
|
41
|
+
* `张`, `张`) replaced by the character(s) it denotes. The Web
|
|
42
|
+
* editor writes such references next to emphasis delimiters, e.g.
|
|
43
|
+
* `**负责人:**张三`, and every Wiki reader shows 张三.
|
|
44
|
+
*
|
|
45
|
+
* micromark (the Web reader's parser) recognizes the references, so code,
|
|
46
|
+
* raw HTML, autolinks and backslash-escaped ampersands are never touched; all
|
|
47
|
+
* other Markdown syntax is kept byte-for-byte. Text longer than
|
|
48
|
+
* {@link MAX_DECODED_LENGTH} is returned as is.
|
|
49
|
+
*
|
|
50
|
+
* Section content arrives trimmed by the section parser, so a body that opens
|
|
51
|
+
* with an indented code block parses as a paragraph here and its references
|
|
52
|
+
* decode; headings lose code context too (see
|
|
53
|
+
* {@link decodeHeadingCharacterReferences}).
|
|
54
|
+
*/
|
|
55
|
+
export function decodeCharacterReferences(markdown) {
|
|
56
|
+
if (markdown.length > MAX_DECODED_LENGTH || !REFERENCE_SHAPE.test(markdown)) {
|
|
57
|
+
return markdown;
|
|
58
|
+
}
|
|
59
|
+
const events = postprocess(parse(PARSE_OPTIONS)
|
|
60
|
+
.document()
|
|
61
|
+
.write(preprocess()(markdown, undefined, true)));
|
|
62
|
+
// micromark skips a leading byte order mark, so its offsets start after it.
|
|
63
|
+
// wiki-service keeps a file's BOM in the file's first section.
|
|
64
|
+
const base = markdown.charCodeAt(0) === 0xfeff ? 1 : 0;
|
|
65
|
+
let out = '';
|
|
66
|
+
let copied = 0;
|
|
67
|
+
let literalDepth = 0;
|
|
68
|
+
let reference = { start: 0, end: 0, radix: 0 };
|
|
69
|
+
for (const [kind, token, context] of events) {
|
|
70
|
+
if (LITERAL_CONSTRUCTS.has(token.type)) {
|
|
71
|
+
literalDepth += kind === 'enter' ? 1 : -1;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (literalDepth > 0 || kind !== 'enter') {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
switch (token.type) {
|
|
78
|
+
case 'characterReference':
|
|
79
|
+
reference = { start: base + token.start.offset, end: base + token.end.offset, radix: 0 };
|
|
80
|
+
break;
|
|
81
|
+
case 'characterReferenceMarkerNumeric':
|
|
82
|
+
reference.radix = 10;
|
|
83
|
+
break;
|
|
84
|
+
case 'characterReferenceMarkerHexadecimal':
|
|
85
|
+
reference.radix = 16;
|
|
86
|
+
break;
|
|
87
|
+
case 'characterReferenceValue': {
|
|
88
|
+
const value = context.sliceSerialize(token);
|
|
89
|
+
const decoded = reference.radix === 0
|
|
90
|
+
? decodeNamedCharacterReference(value)
|
|
91
|
+
: decodeNumericCharacterReference(value, reference.radix);
|
|
92
|
+
if (decoded !== false) {
|
|
93
|
+
out += markdown.slice(copied, reference.start) + decoded;
|
|
94
|
+
copied = reference.end;
|
|
95
|
+
}
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return out + markdown.slice(copied);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Decodes one heading title (inline heading content) as {@link decodeCharacterReferences}.
|
|
104
|
+
* The heading parser trims leading and trailing backticks from titles, which
|
|
105
|
+
* loses code context whenever a heading starts or ends with a code span:
|
|
106
|
+
* "`A&B`", "`A&B` notes" and "notes `A&B`" decode the reference
|
|
107
|
+
* inside the code, while "`a` & `b`" now reads as one code span and keeps
|
|
108
|
+
* the text reference literal. Only a reader title computed at parse time can
|
|
109
|
+
* tell these shapes apart.
|
|
110
|
+
*/
|
|
111
|
+
export function decodeHeadingCharacterReferences(title) {
|
|
112
|
+
if (!title.includes('&') || /[\r\n]/.test(title)) {
|
|
113
|
+
return title;
|
|
114
|
+
}
|
|
115
|
+
return decodeCharacterReferences(HEADING_PREFIX + title).slice(HEADING_PREFIX.length);
|
|
116
|
+
}
|
|
117
|
+
export function tokenize(text) {
|
|
118
|
+
const trimmed = text.trim();
|
|
119
|
+
if (!trimmed) {
|
|
120
|
+
return [];
|
|
121
|
+
}
|
|
122
|
+
const tokens = [];
|
|
123
|
+
let word = '';
|
|
124
|
+
let cjkRun = '';
|
|
125
|
+
const flushWord = () => {
|
|
126
|
+
if (!word) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
tokens.push(word.toLowerCase());
|
|
130
|
+
word = '';
|
|
131
|
+
};
|
|
132
|
+
const flushCjk = () => {
|
|
133
|
+
if (!cjkRun) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const chars = Array.from(cjkRun.toLowerCase());
|
|
137
|
+
tokens.push(...chars);
|
|
138
|
+
if (chars.length > 1) {
|
|
139
|
+
for (let i = 0; i < chars.length - 1; i += 1) {
|
|
140
|
+
tokens.push(chars[i] + chars[i + 1]);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
cjkRun = '';
|
|
144
|
+
};
|
|
145
|
+
for (const char of Array.from(trimmed)) {
|
|
146
|
+
if (isCjkChar(char)) {
|
|
147
|
+
flushWord();
|
|
148
|
+
cjkRun += char;
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (/[0-9\p{L}]/u.test(char)) {
|
|
152
|
+
flushCjk();
|
|
153
|
+
word += char.toLowerCase();
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
flushWord();
|
|
157
|
+
flushCjk();
|
|
158
|
+
}
|
|
159
|
+
flushWord();
|
|
160
|
+
flushCjk();
|
|
161
|
+
return tokens;
|
|
162
|
+
}
|
|
163
|
+
function isCjkChar(char) {
|
|
164
|
+
const codePoint = char.codePointAt(0) ?? 0;
|
|
165
|
+
return ((codePoint >= 0x4e00 && codePoint <= 0x9fff) ||
|
|
166
|
+
(codePoint >= 0x3400 && codePoint <= 0x4dbf) ||
|
|
167
|
+
(codePoint >= 0x3040 && codePoint <= 0x309f) ||
|
|
168
|
+
(codePoint >= 0x30a0 && codePoint <= 0x30ff) ||
|
|
169
|
+
(codePoint >= 0xac00 && codePoint <= 0xd7af));
|
|
170
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parall/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.71.0",
|
|
4
4
|
"description": "CLI client for Parall — universal agent & human access to Parall API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,13 +33,17 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@modelcontextprotocol/sdk": "1.27.1",
|
|
35
35
|
"commander": "^13.0.0",
|
|
36
|
+
"decode-named-character-reference": "^1.3.0",
|
|
36
37
|
"diff": "^8.0.3",
|
|
37
38
|
"js-yaml": "^4.1.0",
|
|
39
|
+
"micromark": "^4.0.2",
|
|
40
|
+
"micromark-extension-gfm-table": "^2.1.1",
|
|
41
|
+
"micromark-util-decode-numeric-character-reference": "^2.0.2",
|
|
38
42
|
"node-diff3": "3.2.1",
|
|
39
43
|
"tar-stream": "^3.2.1",
|
|
40
44
|
"zod": "^4.3.6",
|
|
41
|
-
"@parall/agent-core": "1.
|
|
42
|
-
"@parall/sdk": "1.
|
|
45
|
+
"@parall/agent-core": "1.71.0",
|
|
46
|
+
"@parall/sdk": "1.71.0"
|
|
43
47
|
},
|
|
44
48
|
"devDependencies": {
|
|
45
49
|
"@types/js-yaml": "^4.0.9",
|
|
@@ -47,10 +51,10 @@
|
|
|
47
51
|
"@types/tar-stream": "^3.1.4",
|
|
48
52
|
"esbuild": "^0.25.0",
|
|
49
53
|
"typescript": "^5.7.0",
|
|
50
|
-
"@parall/agent-core": "1.
|
|
54
|
+
"@parall/agent-core": "1.71.0"
|
|
51
55
|
},
|
|
52
56
|
"scripts": {
|
|
53
|
-
"build": "tsc",
|
|
57
|
+
"build": "node scripts/generate-miniapp-sdk.mjs --check && node scripts/generate-local-runner.mjs --check && tsc",
|
|
54
58
|
"dev": "tsc --watch",
|
|
55
59
|
"test": "pnpm run build && node --test test/*.test.mjs",
|
|
56
60
|
"bundle": "node scripts/bundle.mjs"
|