@oh-my-pi/pi-utils 17.2.8 → 17.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/dist/types/acp/connection.d.ts +118 -0
- package/dist/types/acp/protocol.d.ts +526 -0
- package/dist/types/acp/schema.d.ts +41 -0
- package/dist/types/acp/stream.d.ts +8 -0
- package/dist/types/acp/transport.d.ts +81 -0
- package/dist/types/acp.d.ts +6 -0
- package/dist/types/browsers.d.ts +68 -0
- package/dist/types/chalk.d.ts +125 -0
- package/dist/types/dates.d.ts +7 -0
- package/dist/types/docx/converter.d.ts +46 -0
- package/dist/types/docx/xml.d.ts +26 -0
- package/dist/types/docx/zip.d.ts +6 -0
- package/dist/types/docx.d.ts +11 -0
- package/dist/types/dom/core.d.ts +431 -0
- package/dist/types/dom/parser.d.ts +7 -0
- package/dist/types/dom/selector.d.ts +5 -0
- package/dist/types/dom.d.ts +5 -0
- package/dist/types/headers.d.ts +34 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/logger/rotating-file.d.ts +18 -0
- package/dist/types/lru.d.ts +46 -0
- package/dist/types/marked/core.d.ts +445 -0
- package/dist/types/marked.d.ts +2 -0
- package/dist/types/postmortem.d.ts +14 -0
- package/dist/types/procmgr.d.ts +16 -0
- package/dist/types/prompt.d.ts +2 -2
- package/dist/types/readability/readability.d.ts +9 -0
- package/dist/types/readability/readerable.d.ts +10 -0
- package/dist/types/readability/types.d.ts +70 -0
- package/dist/types/readability.d.ts +4 -0
- package/dist/types/template.d.ts +62 -0
- package/dist/types/turndown/gfm.d.ts +11 -0
- package/dist/types/turndown/html.d.ts +5 -0
- package/dist/types/turndown/service.d.ts +21 -0
- package/dist/types/turndown/types.d.ts +70 -0
- package/dist/types/turndown.d.ts +4 -0
- package/dist/types/version.d.ts +18 -0
- package/dist/types/vterm/buffer.d.ts +99 -0
- package/dist/types/vterm/terminal.d.ts +44 -0
- package/dist/types/vterm.d.ts +8 -0
- package/dist/types/xml.d.ts +31 -0
- package/package.json +2 -5
- package/src/acp/connection.ts +344 -0
- package/src/acp/protocol.ts +466 -0
- package/src/acp/schema.ts +160 -0
- package/src/acp/stream.ts +82 -0
- package/src/acp/transport.ts +213 -0
- package/src/acp.ts +6 -0
- package/src/browsers.ts +501 -0
- package/src/chalk.ts +312 -0
- package/src/dates.ts +194 -0
- package/src/docx/converter.ts +681 -0
- package/src/docx/xml.ts +166 -0
- package/src/docx/zip.ts +87 -0
- package/src/docx.ts +20 -0
- package/src/dom/core.ts +1254 -0
- package/src/dom/parser.ts +370 -0
- package/src/dom/selector.ts +290 -0
- package/src/dom.ts +33 -0
- package/src/fetch-retry.ts +7 -1
- package/src/frontmatter.ts +1 -1
- package/src/headers.ts +167 -0
- package/src/index.ts +1 -0
- package/src/logger/rotating-file.ts +149 -0
- package/src/logger.ts +12 -28
- package/src/lru.ts +185 -0
- package/src/marked/core.ts +1576 -0
- package/src/marked.ts +2 -0
- package/src/postmortem.ts +44 -1
- package/src/procmgr.ts +21 -4
- package/src/prompt.ts +5 -22
- package/src/readability/readability.ts +533 -0
- package/src/readability/readerable.ts +51 -0
- package/src/readability/types.ts +72 -0
- package/src/readability.ts +11 -0
- package/src/template.ts +586 -0
- package/src/turndown/gfm.ts +106 -0
- package/src/turndown/html.ts +257 -0
- package/src/turndown/service.ts +334 -0
- package/src/turndown/types.ts +81 -0
- package/src/turndown.ts +5 -0
- package/src/version.ts +99 -0
- package/src/vterm/buffer.ts +218 -0
- package/src/vterm/terminal.ts +773 -0
- package/src/vterm.ts +8 -0
- package/src/which.ts +6 -4
- package/src/xml.ts +313 -0
- package/src/winston-daily-rotate-file.d.ts +0 -6
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
/** Token shapes emitted by the Markdown lexer. */
|
|
2
|
+
export declare namespace Tokens {
|
|
3
|
+
/** A block quote. */
|
|
4
|
+
interface Blockquote {
|
|
5
|
+
type: "blockquote";
|
|
6
|
+
raw: string;
|
|
7
|
+
text: string;
|
|
8
|
+
tokens: Token[];
|
|
9
|
+
}
|
|
10
|
+
/** A hard line break. */
|
|
11
|
+
interface Br {
|
|
12
|
+
type: "br";
|
|
13
|
+
raw: string;
|
|
14
|
+
}
|
|
15
|
+
/** A task-list checkbox. */
|
|
16
|
+
interface Checkbox {
|
|
17
|
+
type: "checkbox";
|
|
18
|
+
raw: string;
|
|
19
|
+
checked: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** A code block. */
|
|
22
|
+
interface Code {
|
|
23
|
+
type: "code";
|
|
24
|
+
raw: string;
|
|
25
|
+
codeBlockStyle?: "indented";
|
|
26
|
+
lang?: string;
|
|
27
|
+
text: string;
|
|
28
|
+
escaped?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** An inline code span. */
|
|
31
|
+
interface Codespan {
|
|
32
|
+
type: "codespan";
|
|
33
|
+
raw: string;
|
|
34
|
+
text: string;
|
|
35
|
+
}
|
|
36
|
+
/** A reference-link definition. */
|
|
37
|
+
interface Def {
|
|
38
|
+
type: "def";
|
|
39
|
+
raw: string;
|
|
40
|
+
tag: string;
|
|
41
|
+
href: string;
|
|
42
|
+
title?: string;
|
|
43
|
+
}
|
|
44
|
+
/** Deleted text. */
|
|
45
|
+
interface Del {
|
|
46
|
+
type: "del";
|
|
47
|
+
raw: string;
|
|
48
|
+
text: string;
|
|
49
|
+
tokens: Token[];
|
|
50
|
+
}
|
|
51
|
+
/** Emphasized text. */
|
|
52
|
+
interface Em {
|
|
53
|
+
type: "em";
|
|
54
|
+
raw: string;
|
|
55
|
+
text: string;
|
|
56
|
+
tokens: Token[];
|
|
57
|
+
}
|
|
58
|
+
/** An escaped punctuation character. */
|
|
59
|
+
interface Escape {
|
|
60
|
+
type: "escape";
|
|
61
|
+
raw: string;
|
|
62
|
+
text: string;
|
|
63
|
+
}
|
|
64
|
+
/** A custom extension token. */
|
|
65
|
+
interface Generic {
|
|
66
|
+
[key: string]: any;
|
|
67
|
+
type: string;
|
|
68
|
+
raw: string;
|
|
69
|
+
tokens?: Token[];
|
|
70
|
+
}
|
|
71
|
+
/** A heading. */
|
|
72
|
+
interface Heading {
|
|
73
|
+
type: "heading";
|
|
74
|
+
raw: string;
|
|
75
|
+
depth: number;
|
|
76
|
+
text: string;
|
|
77
|
+
tokens: Token[];
|
|
78
|
+
}
|
|
79
|
+
/** A horizontal rule. */
|
|
80
|
+
interface Hr {
|
|
81
|
+
type: "hr";
|
|
82
|
+
raw: string;
|
|
83
|
+
}
|
|
84
|
+
/** Raw block or inline HTML. */
|
|
85
|
+
interface HTML {
|
|
86
|
+
type: "html";
|
|
87
|
+
raw: string;
|
|
88
|
+
pre?: boolean;
|
|
89
|
+
text: string;
|
|
90
|
+
block: boolean;
|
|
91
|
+
inLink?: boolean;
|
|
92
|
+
inRawBlock?: boolean;
|
|
93
|
+
}
|
|
94
|
+
/** An image. */
|
|
95
|
+
interface Image {
|
|
96
|
+
type: "image";
|
|
97
|
+
raw: string;
|
|
98
|
+
href: string;
|
|
99
|
+
title: string | null;
|
|
100
|
+
text: string;
|
|
101
|
+
tokens: Token[];
|
|
102
|
+
}
|
|
103
|
+
/** A hyperlink. */
|
|
104
|
+
interface Link {
|
|
105
|
+
type: "link";
|
|
106
|
+
raw: string;
|
|
107
|
+
href: string;
|
|
108
|
+
title?: string | null;
|
|
109
|
+
text: string;
|
|
110
|
+
tokens: Token[];
|
|
111
|
+
}
|
|
112
|
+
/** A list. */
|
|
113
|
+
interface List {
|
|
114
|
+
type: "list";
|
|
115
|
+
raw: string;
|
|
116
|
+
ordered: boolean;
|
|
117
|
+
start: number | "";
|
|
118
|
+
loose: boolean;
|
|
119
|
+
items: ListItem[];
|
|
120
|
+
}
|
|
121
|
+
/** A list item. */
|
|
122
|
+
interface ListItem {
|
|
123
|
+
type: "list_item";
|
|
124
|
+
raw: string;
|
|
125
|
+
task: boolean;
|
|
126
|
+
checked?: boolean;
|
|
127
|
+
loose: boolean;
|
|
128
|
+
text: string;
|
|
129
|
+
tokens: Token[];
|
|
130
|
+
}
|
|
131
|
+
/** A paragraph. */
|
|
132
|
+
interface Paragraph {
|
|
133
|
+
type: "paragraph";
|
|
134
|
+
raw: string;
|
|
135
|
+
pre?: boolean;
|
|
136
|
+
text: string;
|
|
137
|
+
tokens: Token[];
|
|
138
|
+
}
|
|
139
|
+
/** Blank block space. */
|
|
140
|
+
interface Space {
|
|
141
|
+
type: "space";
|
|
142
|
+
raw: string;
|
|
143
|
+
}
|
|
144
|
+
/** Strongly emphasized text. */
|
|
145
|
+
interface Strong {
|
|
146
|
+
type: "strong";
|
|
147
|
+
raw: string;
|
|
148
|
+
text: string;
|
|
149
|
+
tokens: Token[];
|
|
150
|
+
}
|
|
151
|
+
/** A GFM table cell. */
|
|
152
|
+
interface TableCell {
|
|
153
|
+
text: string;
|
|
154
|
+
tokens: Token[];
|
|
155
|
+
header: boolean;
|
|
156
|
+
align: "center" | "left" | "right" | null;
|
|
157
|
+
}
|
|
158
|
+
/** A GFM table. */
|
|
159
|
+
interface Table {
|
|
160
|
+
type: "table";
|
|
161
|
+
raw: string;
|
|
162
|
+
align: Array<"center" | "left" | "right" | null>;
|
|
163
|
+
header: TableCell[];
|
|
164
|
+
rows: TableCell[][];
|
|
165
|
+
}
|
|
166
|
+
/** Plain text. */
|
|
167
|
+
interface Text {
|
|
168
|
+
type: "text";
|
|
169
|
+
raw: string;
|
|
170
|
+
text: string;
|
|
171
|
+
tokens?: Token[];
|
|
172
|
+
escaped?: boolean;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
type KnownToken = Tokens.Blockquote | Tokens.Br | Tokens.Checkbox | Tokens.Code | Tokens.Codespan | Tokens.Def | Tokens.Del | Tokens.Em | Tokens.Escape | Tokens.Heading | Tokens.Hr | Tokens.HTML | Tokens.Image | Tokens.Link | Tokens.List | Tokens.ListItem | Tokens.Paragraph | Tokens.Space | Tokens.Strong | Tokens.Table | Tokens.Text;
|
|
176
|
+
/** A built-in or extension Markdown token. */
|
|
177
|
+
export type Token = KnownToken | Tokens.Generic;
|
|
178
|
+
/** Reference definitions collected while lexing. */
|
|
179
|
+
export type Links = Record<string, Pick<Tokens.Link | Tokens.Image, "href" | "title">>;
|
|
180
|
+
/** A token array carrying its reference-definition map. */
|
|
181
|
+
export type TokensList = Token[] & {
|
|
182
|
+
links: Links;
|
|
183
|
+
};
|
|
184
|
+
/** Context supplied to extension tokenizers. */
|
|
185
|
+
export interface TokenizerThis {
|
|
186
|
+
lexer: Lexer;
|
|
187
|
+
}
|
|
188
|
+
/** A tokenizer extension callback. */
|
|
189
|
+
export type TokenizerExtensionFunction = (this: TokenizerThis, src: string, tokens: Token[] | TokensList) => Tokens.Generic | undefined;
|
|
190
|
+
/** A tokenizer extension start hint. */
|
|
191
|
+
export type TokenizerStartFunction = (this: TokenizerThis, src: string) => number | void;
|
|
192
|
+
/** An inline or block tokenizer extension. */
|
|
193
|
+
export interface TokenizerExtension {
|
|
194
|
+
name: string;
|
|
195
|
+
level: "block" | "inline";
|
|
196
|
+
start?: TokenizerStartFunction;
|
|
197
|
+
tokenizer: TokenizerExtensionFunction;
|
|
198
|
+
childTokens?: string[];
|
|
199
|
+
}
|
|
200
|
+
/** Context supplied to extension renderers. */
|
|
201
|
+
export interface RendererThis {
|
|
202
|
+
parser: Parser;
|
|
203
|
+
}
|
|
204
|
+
/** A custom renderer extension callback. */
|
|
205
|
+
export type RendererExtensionFunction = (this: RendererThis, token: Tokens.Generic) => string | false | undefined;
|
|
206
|
+
/** A named renderer extension. */
|
|
207
|
+
export interface RendererExtension {
|
|
208
|
+
name: string;
|
|
209
|
+
renderer: RendererExtensionFunction;
|
|
210
|
+
}
|
|
211
|
+
/** A combined tokenizer/renderer extension. */
|
|
212
|
+
export type TokenizerAndRendererExtension = TokenizerExtension | RendererExtension | (TokenizerExtension & RendererExtension);
|
|
213
|
+
/** Overrides for built-in tokenizer methods. */
|
|
214
|
+
export interface TokenizerObject {
|
|
215
|
+
url?(this: Tokenizer, src: string): Tokens.Link | undefined | false;
|
|
216
|
+
lheading?(this: Tokenizer, src: string): Tokens.Heading | undefined | false;
|
|
217
|
+
del?(this: Tokenizer, src: string, maskedSrc?: string, prevChar?: string): Tokens.Del | undefined | false;
|
|
218
|
+
}
|
|
219
|
+
interface RendererTokenMap {
|
|
220
|
+
space: Tokens.Space;
|
|
221
|
+
html: Tokens.HTML;
|
|
222
|
+
link: Tokens.Link;
|
|
223
|
+
image: Tokens.Image;
|
|
224
|
+
text: Tokens.Text | Tokens.Escape;
|
|
225
|
+
code: Tokens.Code;
|
|
226
|
+
blockquote: Tokens.Blockquote;
|
|
227
|
+
heading: Tokens.Heading;
|
|
228
|
+
hr: Tokens.Hr;
|
|
229
|
+
list: Tokens.List;
|
|
230
|
+
listitem: Tokens.ListItem;
|
|
231
|
+
paragraph: Tokens.Paragraph;
|
|
232
|
+
strong: Tokens.Strong;
|
|
233
|
+
em: Tokens.Em;
|
|
234
|
+
codespan: Tokens.Codespan;
|
|
235
|
+
br: Tokens.Br;
|
|
236
|
+
del: Tokens.Del;
|
|
237
|
+
}
|
|
238
|
+
/** Overrides for built-in HTML renderer methods. */
|
|
239
|
+
export type RendererObject = {
|
|
240
|
+
[K in keyof RendererTokenMap]?: (this: Renderer, token: RendererTokenMap[K]) => string | false;
|
|
241
|
+
};
|
|
242
|
+
/** Options supported by the in-house Markdown implementation. */
|
|
243
|
+
export interface MarkedOptions {
|
|
244
|
+
async?: boolean;
|
|
245
|
+
breaks?: boolean;
|
|
246
|
+
gfm?: boolean;
|
|
247
|
+
pedantic?: boolean;
|
|
248
|
+
silent?: boolean;
|
|
249
|
+
tokenizer?: Tokenizer | TokenizerObject | null;
|
|
250
|
+
/** Built-in tokenizer overrides composed by Marked.use(). */
|
|
251
|
+
tokenizerOverrides?: TokenizerObject;
|
|
252
|
+
renderer?: Renderer | RendererObject | null;
|
|
253
|
+
walkTokens?: ((token: Token) => void | Promise<void>) | null;
|
|
254
|
+
extensions?: ExtensionRegistry | null;
|
|
255
|
+
}
|
|
256
|
+
interface ExtensionRegistry {
|
|
257
|
+
block: TokenizerExtension[];
|
|
258
|
+
inline: TokenizerExtension[];
|
|
259
|
+
renderers: Record<string, RendererExtensionFunction>;
|
|
260
|
+
childTokens: Record<string, string[]>;
|
|
261
|
+
}
|
|
262
|
+
/** Options accepted by Marked.use(). */
|
|
263
|
+
export interface MarkedExtension extends Omit<MarkedOptions, "extensions"> {
|
|
264
|
+
extensions?: TokenizerAndRendererExtension[] | null;
|
|
265
|
+
}
|
|
266
|
+
/** Tokenizes the built-in inline Markdown surface. */
|
|
267
|
+
export declare class Tokenizer {
|
|
268
|
+
options: MarkedOptions;
|
|
269
|
+
lexer: Lexer;
|
|
270
|
+
/** Creates a tokenizer with the supplied options. */
|
|
271
|
+
constructor(options?: MarkedOptions);
|
|
272
|
+
/** Tokenizes GFM deletion. */
|
|
273
|
+
del(src: string): Tokens.Del | undefined;
|
|
274
|
+
}
|
|
275
|
+
/** Stateful block and inline Markdown lexer. */
|
|
276
|
+
export declare class Lexer {
|
|
277
|
+
tokens: TokensList;
|
|
278
|
+
options: MarkedOptions;
|
|
279
|
+
state: {
|
|
280
|
+
inLink: boolean;
|
|
281
|
+
inRawBlock: boolean;
|
|
282
|
+
top: boolean;
|
|
283
|
+
};
|
|
284
|
+
inlineQueue: Array<{
|
|
285
|
+
src: string;
|
|
286
|
+
tokens: Token[];
|
|
287
|
+
}>;
|
|
288
|
+
tokenizer: Tokenizer;
|
|
289
|
+
tokenizerOverrides: TokenizerObject;
|
|
290
|
+
extensions: ExtensionRegistry;
|
|
291
|
+
/** Creates a lexer. */
|
|
292
|
+
constructor(options?: MarkedOptions);
|
|
293
|
+
/** Exposes rule objects for callers that optimize regular expressions. */
|
|
294
|
+
static get rules(): {
|
|
295
|
+
block: {
|
|
296
|
+
normal: {
|
|
297
|
+
blockquote: RegExp;
|
|
298
|
+
code: RegExp;
|
|
299
|
+
def: RegExp;
|
|
300
|
+
fences: RegExp;
|
|
301
|
+
heading: RegExp;
|
|
302
|
+
hr: RegExp;
|
|
303
|
+
html: RegExp;
|
|
304
|
+
lheading: RegExp;
|
|
305
|
+
list: RegExp;
|
|
306
|
+
newline: RegExp;
|
|
307
|
+
paragraph: RegExp;
|
|
308
|
+
table: RegExp;
|
|
309
|
+
text: RegExp;
|
|
310
|
+
};
|
|
311
|
+
gfm: Record<string, RegExp>;
|
|
312
|
+
pedantic: Record<string, RegExp>;
|
|
313
|
+
};
|
|
314
|
+
inline: {
|
|
315
|
+
normal: {
|
|
316
|
+
_backpedal: RegExp;
|
|
317
|
+
anyPunctuation: RegExp;
|
|
318
|
+
autolink: RegExp;
|
|
319
|
+
blockSkip: RegExp;
|
|
320
|
+
br: RegExp;
|
|
321
|
+
code: RegExp;
|
|
322
|
+
del: RegExp;
|
|
323
|
+
delLDelim: RegExp;
|
|
324
|
+
delRDelim: RegExp;
|
|
325
|
+
emStrongLDelim: RegExp;
|
|
326
|
+
emStrongRDelimAst: RegExp;
|
|
327
|
+
emStrongRDelimUnd: RegExp;
|
|
328
|
+
escape: RegExp;
|
|
329
|
+
link: RegExp;
|
|
330
|
+
nolink: RegExp;
|
|
331
|
+
punctuation: RegExp;
|
|
332
|
+
reflink: RegExp;
|
|
333
|
+
reflinkSearch: RegExp;
|
|
334
|
+
tag: RegExp;
|
|
335
|
+
text: RegExp;
|
|
336
|
+
url: RegExp;
|
|
337
|
+
};
|
|
338
|
+
gfm: Record<string, RegExp>;
|
|
339
|
+
breaks: Record<string, RegExp>;
|
|
340
|
+
pedantic: Record<string, RegExp>;
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
/** Lexes a complete document. */
|
|
344
|
+
static lex(src: string, options?: MarkedOptions): TokensList;
|
|
345
|
+
/** Lexes inline Markdown. */
|
|
346
|
+
static lexInline(src: string, options?: MarkedOptions): Token[];
|
|
347
|
+
/** Lexes and resolves a complete document. */
|
|
348
|
+
lex(src: string): TokensList;
|
|
349
|
+
/** Appends block tokens to an output array. */
|
|
350
|
+
blockTokens(src: string, tokens?: Token[] | TokensList): Token[] | TokensList;
|
|
351
|
+
/** Queues inline tokenization compatibly with marked. */
|
|
352
|
+
inline(src: string, tokens?: Token[]): Token[];
|
|
353
|
+
/** Tokenizes inline Markdown immediately. */
|
|
354
|
+
inlineTokens(src: string, tokens?: Token[]): Token[];
|
|
355
|
+
}
|
|
356
|
+
/** Default HTML renderer. */
|
|
357
|
+
export declare class Renderer {
|
|
358
|
+
options: MarkedOptions;
|
|
359
|
+
parser: Parser;
|
|
360
|
+
overrides: RendererObject;
|
|
361
|
+
/** Creates an HTML renderer. */
|
|
362
|
+
constructor(options?: MarkedOptions, overrides?: RendererObject);
|
|
363
|
+
/** Renders blank space. */ space(_token: Tokens.Space): string;
|
|
364
|
+
/** Renders a code block. */ code({ text, lang, escaped }: Tokens.Code): string;
|
|
365
|
+
/** Renders a block quote. */ blockquote({ tokens }: Tokens.Blockquote): string;
|
|
366
|
+
/** Passes raw HTML through. */ html({ text }: Tokens.HTML): string;
|
|
367
|
+
/** Renders a definition as no output. */ def(_token: Tokens.Def): string;
|
|
368
|
+
/** Renders a heading. */ heading({ tokens, depth }: Tokens.Heading): string;
|
|
369
|
+
/** Renders a horizontal rule. */ hr(_token: Tokens.Hr): string;
|
|
370
|
+
/** Renders a list. */ list(token: Tokens.List): string;
|
|
371
|
+
/** Renders a list item. */ listitem(item: Tokens.ListItem): string;
|
|
372
|
+
/** Renders a checkbox. */ checkbox({ checked }: Tokens.Checkbox): string;
|
|
373
|
+
/** Renders a paragraph. */ paragraph({ tokens }: Tokens.Paragraph): string;
|
|
374
|
+
/** Renders a table. */ table(token: Tokens.Table): string;
|
|
375
|
+
/** Renders a table row. */ tablerow(text: string): string;
|
|
376
|
+
/** Renders a table cell. */ tablecell(token: Tokens.TableCell): string;
|
|
377
|
+
/** Renders strong text. */ strong({ tokens }: Tokens.Strong): string;
|
|
378
|
+
/** Renders emphasized text. */ em({ tokens }: Tokens.Em): string;
|
|
379
|
+
/** Renders inline code. */ codespan({ text }: Tokens.Codespan): string;
|
|
380
|
+
/** Renders a line break. */ br(_token: Tokens.Br): string;
|
|
381
|
+
/** Renders deleted text. */ del({ tokens }: Tokens.Del): string;
|
|
382
|
+
/** Renders a link. */ link({ href, title, tokens }: Tokens.Link): string;
|
|
383
|
+
/** Renders an image. */ image({ href, title, text }: Tokens.Image): string;
|
|
384
|
+
/** Renders plain text. */ text({ text }: Tokens.Text | Tokens.Escape): string;
|
|
385
|
+
}
|
|
386
|
+
/** Converts token streams into HTML. */
|
|
387
|
+
export declare class Parser {
|
|
388
|
+
options: MarkedOptions;
|
|
389
|
+
renderer: Renderer;
|
|
390
|
+
extensions: ExtensionRegistry;
|
|
391
|
+
/** Creates a parser. */
|
|
392
|
+
constructor(options?: MarkedOptions);
|
|
393
|
+
/** Parses block tokens. */ static parse(tokens: Token[], options?: MarkedOptions): string;
|
|
394
|
+
/** Parses inline tokens. */ static parseInline(tokens: Token[], options?: MarkedOptions): string;
|
|
395
|
+
/** Parses block tokens with the configured renderer. */
|
|
396
|
+
parse(tokens: Token[]): string;
|
|
397
|
+
/** Parses inline tokens with the configured renderer. */
|
|
398
|
+
parseInline(tokens: Token[]): string;
|
|
399
|
+
/** Renders a list item, including custom renderer overrides. */
|
|
400
|
+
renderListItem(item: Tokens.ListItem): string;
|
|
401
|
+
call<K extends keyof RendererTokenMap>(name: K, token: RendererTokenMap[K], fallback: () => string): string;
|
|
402
|
+
}
|
|
403
|
+
/** Configurable Markdown lexer and HTML parser. */
|
|
404
|
+
export declare class Marked {
|
|
405
|
+
defaults: MarkedOptions;
|
|
406
|
+
/** Creates an isolated Marked instance. */
|
|
407
|
+
constructor(...extensions: MarkedExtension[]);
|
|
408
|
+
/** Merges default options. */ options(options: MarkedOptions): this;
|
|
409
|
+
/** Merges default options. */ setOptions(options: MarkedOptions): this;
|
|
410
|
+
/** Adds tokenizer, renderer, and walk-token extensions. */
|
|
411
|
+
use(...extensions: MarkedExtension[]): this;
|
|
412
|
+
/** Lexes Markdown into tokens. */ lexer(src: string, options?: MarkedOptions): TokensList;
|
|
413
|
+
/** Parses a token stream to HTML. */ parser(tokens: Token[], options?: MarkedOptions): string;
|
|
414
|
+
/** Walks a token tree depth first. */ walkTokens(tokens: Token[] | TokensList, callback: (token: Token) => void | Promise<void>): Array<void | Promise<void>>;
|
|
415
|
+
/** Parses Markdown to HTML, synchronously unless async mode is requested. */
|
|
416
|
+
parse(src: string, options: MarkedOptions & {
|
|
417
|
+
async: true;
|
|
418
|
+
}): Promise<string>;
|
|
419
|
+
parse(src: string, options: MarkedOptions & {
|
|
420
|
+
async: false;
|
|
421
|
+
}): string;
|
|
422
|
+
parse(src: string, options?: MarkedOptions | null): string | Promise<string>;
|
|
423
|
+
/** Parses inline Markdown to HTML. */ parseInline(src: string, options?: MarkedOptions): string;
|
|
424
|
+
}
|
|
425
|
+
/** Parses Markdown with a shared default instance. */
|
|
426
|
+
export declare function marked(src: string, options: MarkedOptions & {
|
|
427
|
+
async: true;
|
|
428
|
+
}): Promise<string>;
|
|
429
|
+
export declare function marked(src: string, options: MarkedOptions & {
|
|
430
|
+
async: false;
|
|
431
|
+
}): string;
|
|
432
|
+
export declare function marked(src: string, options?: MarkedOptions | null): string | Promise<string>;
|
|
433
|
+
/** Parses Markdown with a shared default instance. */
|
|
434
|
+
export declare const parse: typeof marked;
|
|
435
|
+
/** Lexes Markdown with default options. */
|
|
436
|
+
export declare const lexer: typeof Lexer.lex;
|
|
437
|
+
/** Parses inline Markdown with default options. */
|
|
438
|
+
export declare const parseInline: (src: string, options?: MarkedOptions) => string;
|
|
439
|
+
/** Parses a token stream with default options. */
|
|
440
|
+
export declare const parser: typeof Parser.parse;
|
|
441
|
+
/** The default option object. */
|
|
442
|
+
export declare const defaults: MarkedOptions;
|
|
443
|
+
/** Returns a fresh copy of the default options. */
|
|
444
|
+
export declare function getDefaults(): MarkedOptions;
|
|
445
|
+
export {};
|
|
@@ -27,6 +27,14 @@ export declare enum Reason {
|
|
|
27
27
|
* instances across bundles/realms.
|
|
28
28
|
*/
|
|
29
29
|
export declare const NATIVE_PROCESS_EXIT: unique symbol;
|
|
30
|
+
/** User-facing command printed before fatal cleanup so interrupted work can be resumed. */
|
|
31
|
+
export interface FatalRecoveryHint {
|
|
32
|
+
/** Stable label identifying the recoverable session or process. */
|
|
33
|
+
label: string;
|
|
34
|
+
/** Complete shell command the user can execute to resume the interrupted work. */
|
|
35
|
+
command: string;
|
|
36
|
+
}
|
|
37
|
+
type FatalRecoveryHintProvider = () => FatalRecoveryHint | undefined;
|
|
30
38
|
/** Origin of an EPIPE raised by a process communication channel. */
|
|
31
39
|
export type BrokenPipeSource = "ipc-send" | "stdio-write";
|
|
32
40
|
/**
|
|
@@ -64,6 +72,11 @@ export declare function isExpectedCleanupError(reason: unknown): boolean;
|
|
|
64
72
|
* process down. A consuming interceptor owns reporting and keeps the process alive.
|
|
65
73
|
*/
|
|
66
74
|
export declare function interceptUnhandledRejections(interceptor: (reason: unknown) => boolean): () => void;
|
|
75
|
+
/**
|
|
76
|
+
* Register a synchronous recovery command to print when the process exits
|
|
77
|
+
* through an uncaught exception or unhandled rejection.
|
|
78
|
+
*/
|
|
79
|
+
export declare function registerFatalRecoveryHint(provider: FatalRecoveryHintProvider): () => void;
|
|
67
80
|
/**
|
|
68
81
|
* Register a process cleanup callback, to be run on shutdown, signal, or fatal error.
|
|
69
82
|
*
|
|
@@ -88,3 +101,4 @@ export interface QuitOptions {
|
|
|
88
101
|
* In workers: runs cleanup only (process.exit would kill entire process).
|
|
89
102
|
*/
|
|
90
103
|
export declare function quit(code?: number, options?: QuitOptions): Promise<void>;
|
|
104
|
+
export {};
|
package/dist/types/procmgr.d.ts
CHANGED
|
@@ -14,8 +14,24 @@ export interface ShellConfigOptions {
|
|
|
14
14
|
* Check if a shell binary is executable.
|
|
15
15
|
*/
|
|
16
16
|
export declare function isExecutable(path: string): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Get shell args for the resolved shell.
|
|
19
|
+
* cmd.exe takes `/c`; PowerShell (powershell.exe / pwsh) takes
|
|
20
|
+
* `-NoLogo -Command`, with `-NoProfile` when PI_BASH_NO_LOGIN /
|
|
21
|
+
* CLAUDE_BASH_NO_LOGIN is set (profile scripts are PowerShell's login-shell
|
|
22
|
+
* analog); POSIX shells take `-c`, with `-l` unless the same env is set.
|
|
23
|
+
*
|
|
24
|
+
* Exported for tests; `env` overrides the process env gate.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getShellArgs(shell: string, env?: Record<string, string | undefined>): string[];
|
|
17
27
|
/** Whether the shell is Windows cmd.exe (spawn paths must use `/c`, not `-c`). */
|
|
18
28
|
export declare function isCmdShell(shell: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the shell is Windows PowerShell or PowerShell Core (pwsh). Spawn
|
|
31
|
+
* paths must use `-Command`: passing the POSIX `-l -c` pair makes PowerShell
|
|
32
|
+
* parse `-l` as the command and fail with `The term '-l' is not recognized`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function isPowerShell(shell: string): boolean;
|
|
19
35
|
/**
|
|
20
36
|
* Resolve a basic shell (bash or sh) as fallback.
|
|
21
37
|
*/
|
package/dist/types/prompt.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HelperDelegate,
|
|
2
|
-
export type { HelperDelegate, HelperOptions, Template, TemplateDelegate };
|
|
1
|
+
import type { HelperDelegate, Template } from "./template.js";
|
|
2
|
+
export type { HelperDelegate, HelperOptions, Template, TemplateDelegate } from "./template.js";
|
|
3
3
|
export type PromptRenderPhase = "pre-render" | "post-render";
|
|
4
4
|
export interface PromptFormatOptions {
|
|
5
5
|
renderPhase?: PromptRenderPhase;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Behavior-compatible reimplementation of @mozilla/readability's used surface. */
|
|
2
|
+
import type { ReadabilityArticle, ReadabilityDocument, ReadabilityOptions } from "./types.js";
|
|
3
|
+
/** Extracts the article body and metadata from a standards-shaped document. */
|
|
4
|
+
export declare class Readability<T = string> {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(document: ReadabilityDocument, options?: ReadabilityOptions<T>);
|
|
7
|
+
/** Runs extraction once; the supplied document is consumed and should not be reused. */
|
|
8
|
+
parse(): ReadabilityArticle<T> | null;
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Behavior-compatible reimplementation of @mozilla/readability's used surface. */
|
|
2
|
+
import type { ReadabilityDocument, ReadabilityNode } from "./types.js";
|
|
3
|
+
/** Options for the inexpensive readerability estimate. */
|
|
4
|
+
export interface ReaderableOptions {
|
|
5
|
+
minContentLength?: number;
|
|
6
|
+
minScore?: number;
|
|
7
|
+
visibilityChecker?: (node: ReadabilityNode) => boolean;
|
|
8
|
+
}
|
|
9
|
+
/** Estimates whether a document contains enough prose for article extraction. */
|
|
10
|
+
export declare function isProbablyReaderable(document: ReadabilityDocument, options?: ReaderableOptions | ((node: ReadabilityNode) => boolean)): boolean;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/** Behavior-compatible reimplementation of @mozilla/readability's used surface. */
|
|
2
|
+
/** Minimal standards-shaped DOM node accepted by the readability extractor. */
|
|
3
|
+
export interface ReadabilityNode {
|
|
4
|
+
readonly nodeType: number;
|
|
5
|
+
readonly nodeName: string;
|
|
6
|
+
readonly tagName?: string;
|
|
7
|
+
readonly ownerDocument?: ReadabilityDocument | null;
|
|
8
|
+
parentNode: ReadabilityNode | null;
|
|
9
|
+
readonly children?: ArrayLike<ReadabilityElement>;
|
|
10
|
+
readonly childNodes: ArrayLike<ReadabilityNode>;
|
|
11
|
+
readonly firstChild: ReadabilityNode | null;
|
|
12
|
+
readonly textContent: string | null;
|
|
13
|
+
appendChild(node: ReadabilityNode): ReadabilityNode;
|
|
14
|
+
cloneNode(deep?: boolean): ReadabilityNode;
|
|
15
|
+
remove(): void;
|
|
16
|
+
}
|
|
17
|
+
/** Minimal standards-shaped DOM element accepted by the readability extractor. */
|
|
18
|
+
export interface ReadabilityElement extends ReadabilityNode {
|
|
19
|
+
readonly children: ArrayLike<ReadabilityElement>;
|
|
20
|
+
readonly tagName: string;
|
|
21
|
+
id: string;
|
|
22
|
+
className: string;
|
|
23
|
+
innerHTML: string;
|
|
24
|
+
readonly attributes: ArrayLike<{
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly value: string;
|
|
27
|
+
}>;
|
|
28
|
+
getAttribute(name: string): string | null;
|
|
29
|
+
hasAttribute(name: string): boolean;
|
|
30
|
+
setAttribute(name: string, value: string): void;
|
|
31
|
+
removeAttribute(name: string): void;
|
|
32
|
+
getElementsByTagName(name: string): ArrayLike<ReadabilityElement>;
|
|
33
|
+
querySelector(selector: string): ReadabilityElement | null;
|
|
34
|
+
querySelectorAll(selector: string): ArrayLike<ReadabilityElement>;
|
|
35
|
+
}
|
|
36
|
+
/** Minimal standards-shaped document accepted by the readability extractor. */
|
|
37
|
+
export interface ReadabilityDocument extends ReadabilityNode {
|
|
38
|
+
title: string;
|
|
39
|
+
readonly body: ReadabilityElement | null;
|
|
40
|
+
readonly documentElement: ReadabilityElement | null;
|
|
41
|
+
createElement(name: string): ReadabilityElement;
|
|
42
|
+
getElementsByTagName(name: string): ArrayLike<ReadabilityElement>;
|
|
43
|
+
querySelector(selector: string): ReadabilityElement | null;
|
|
44
|
+
querySelectorAll(selector: string): ArrayLike<ReadabilityElement>;
|
|
45
|
+
}
|
|
46
|
+
/** Configuration for article extraction. */
|
|
47
|
+
export interface ReadabilityOptions<T = string> {
|
|
48
|
+
debug?: boolean;
|
|
49
|
+
maxElemsToParse?: number;
|
|
50
|
+
nbTopCandidates?: number;
|
|
51
|
+
charThreshold?: number;
|
|
52
|
+
classesToPreserve?: string[];
|
|
53
|
+
keepClasses?: boolean;
|
|
54
|
+
serializer?: (node: ReadabilityNode) => T;
|
|
55
|
+
disableJSONLD?: boolean;
|
|
56
|
+
allowedVideoRegex?: RegExp;
|
|
57
|
+
}
|
|
58
|
+
/** Extracted article and metadata. */
|
|
59
|
+
export interface ReadabilityArticle<T = string> {
|
|
60
|
+
title: string | null | undefined;
|
|
61
|
+
content: T | null | undefined;
|
|
62
|
+
textContent: string | null | undefined;
|
|
63
|
+
length: number | null | undefined;
|
|
64
|
+
excerpt: string | null | undefined;
|
|
65
|
+
byline: string | null | undefined;
|
|
66
|
+
dir: string | null | undefined;
|
|
67
|
+
siteName: string | null | undefined;
|
|
68
|
+
lang: string | null | undefined;
|
|
69
|
+
publishedTime: string | null | undefined;
|
|
70
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Behavior-compatible reimplementation of @mozilla/readability's used surface. */
|
|
2
|
+
export { Readability } from "./readability/readability.js";
|
|
3
|
+
export { isProbablyReaderable, type ReaderableOptions } from "./readability/readerable.js";
|
|
4
|
+
export type { ReadabilityArticle, ReadabilityDocument, ReadabilityElement, ReadabilityNode, ReadabilityOptions, } from "./readability/types.js";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** Behavior-compatible reimplementation of handlebars' used surface. */
|
|
2
|
+
/** Values accepted as registered partial templates. */
|
|
3
|
+
export type Template = string | TemplateDelegate;
|
|
4
|
+
/** A compiled template function. */
|
|
5
|
+
export type TemplateDelegate<T = unknown> = (context?: T, options?: RuntimeOptions) => string;
|
|
6
|
+
/** Runtime options accepted by compiled templates. */
|
|
7
|
+
export interface RuntimeOptions {
|
|
8
|
+
data?: Record<string, unknown>;
|
|
9
|
+
helpers?: Record<string, HelperDelegate>;
|
|
10
|
+
partials?: Record<string, Template>;
|
|
11
|
+
}
|
|
12
|
+
/** Options passed as the final argument to helpers. */
|
|
13
|
+
export interface HelperOptions {
|
|
14
|
+
name: string;
|
|
15
|
+
hash: Record<string, unknown>;
|
|
16
|
+
data: Record<string, unknown>;
|
|
17
|
+
fn: (context?: unknown, options?: {
|
|
18
|
+
data?: Record<string, unknown>;
|
|
19
|
+
}) => string;
|
|
20
|
+
inverse: (context?: unknown, options?: {
|
|
21
|
+
data?: Record<string, unknown>;
|
|
22
|
+
}) => string;
|
|
23
|
+
lookupProperty: (parent: unknown, propertyName: string) => unknown;
|
|
24
|
+
}
|
|
25
|
+
/** A template helper function. */
|
|
26
|
+
export type HelperDelegate = {
|
|
27
|
+
bivarianceHack(this: unknown, ...args: unknown[]): unknown;
|
|
28
|
+
}["bivarianceHack"];
|
|
29
|
+
/** Template compilation behavior. */
|
|
30
|
+
export interface CompileOptions {
|
|
31
|
+
noEscape?: boolean;
|
|
32
|
+
strict?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** A string that bypasses HTML escaping when interpolated. */
|
|
35
|
+
export declare class SafeString {
|
|
36
|
+
#private;
|
|
37
|
+
constructor(value: unknown);
|
|
38
|
+
/** Return the unescaped string value. */
|
|
39
|
+
toString(): string;
|
|
40
|
+
/** Return the unescaped primitive value. */
|
|
41
|
+
toHTML(): string;
|
|
42
|
+
}
|
|
43
|
+
/** Escape a value with Handlebars' HTML entity set. */
|
|
44
|
+
export declare function escapeExpression(value: unknown): string;
|
|
45
|
+
/** Register a helper for subsequently compiled templates. */
|
|
46
|
+
export declare function registerHelper(name: string, helper: HelperDelegate): void;
|
|
47
|
+
/** Register a partial for subsequently rendered templates. */
|
|
48
|
+
export declare function registerPartial(name: string, partial: Template): void;
|
|
49
|
+
/** Compile a template into a reusable rendering function. */
|
|
50
|
+
export declare function compile<T = unknown>(source: string, options?: CompileOptions): TemplateDelegate<T>;
|
|
51
|
+
/** Create an isolated template engine with its own helper and partial registries. */
|
|
52
|
+
export declare function create(): TemplateEngine;
|
|
53
|
+
/** Isolated template compiler and registry. */
|
|
54
|
+
export declare class TemplateEngine {
|
|
55
|
+
#private;
|
|
56
|
+
/** Register a helper in this engine. */
|
|
57
|
+
registerHelper(name: string, helper: HelperDelegate): void;
|
|
58
|
+
/** Register a partial in this engine. */
|
|
59
|
+
registerPartial(name: string, partial: Template): void;
|
|
60
|
+
/** Compile a template using this engine's registries. */
|
|
61
|
+
compile<T = unknown>(source: string, options?: CompileOptions): TemplateDelegate<T>;
|
|
62
|
+
}
|