@oh-my-pi/pi-utils 17.2.9 → 17.2.11

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.
Files changed (84) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/types/acp/connection.d.ts +118 -0
  3. package/dist/types/acp/protocol.d.ts +526 -0
  4. package/dist/types/acp/schema.d.ts +41 -0
  5. package/dist/types/acp/stream.d.ts +8 -0
  6. package/dist/types/acp/transport.d.ts +81 -0
  7. package/dist/types/acp.d.ts +6 -0
  8. package/dist/types/browsers.d.ts +68 -0
  9. package/dist/types/chalk.d.ts +125 -0
  10. package/dist/types/dates.d.ts +7 -0
  11. package/dist/types/docx/converter.d.ts +46 -0
  12. package/dist/types/docx/xml.d.ts +26 -0
  13. package/dist/types/docx/zip.d.ts +6 -0
  14. package/dist/types/docx.d.ts +11 -0
  15. package/dist/types/dom/core.d.ts +431 -0
  16. package/dist/types/dom/parser.d.ts +7 -0
  17. package/dist/types/dom/selector.d.ts +5 -0
  18. package/dist/types/dom.d.ts +5 -0
  19. package/dist/types/frontmatter.d.ts +21 -0
  20. package/dist/types/headers.d.ts +34 -0
  21. package/dist/types/logger/rotating-file.d.ts +18 -0
  22. package/dist/types/lru.d.ts +46 -0
  23. package/dist/types/marked/core.d.ts +445 -0
  24. package/dist/types/marked.d.ts +2 -0
  25. package/dist/types/postmortem.d.ts +14 -0
  26. package/dist/types/procmgr.d.ts +16 -0
  27. package/dist/types/prompt.d.ts +2 -2
  28. package/dist/types/readability/readability.d.ts +9 -0
  29. package/dist/types/readability/readerable.d.ts +10 -0
  30. package/dist/types/readability/types.d.ts +70 -0
  31. package/dist/types/readability.d.ts +4 -0
  32. package/dist/types/template.d.ts +62 -0
  33. package/dist/types/turndown/gfm.d.ts +11 -0
  34. package/dist/types/turndown/html.d.ts +5 -0
  35. package/dist/types/turndown/service.d.ts +21 -0
  36. package/dist/types/turndown/types.d.ts +70 -0
  37. package/dist/types/turndown.d.ts +4 -0
  38. package/dist/types/vterm/buffer.d.ts +99 -0
  39. package/dist/types/vterm/terminal.d.ts +44 -0
  40. package/dist/types/vterm.d.ts +8 -0
  41. package/dist/types/xml.d.ts +31 -0
  42. package/package.json +2 -5
  43. package/src/acp/connection.ts +344 -0
  44. package/src/acp/protocol.ts +466 -0
  45. package/src/acp/schema.ts +160 -0
  46. package/src/acp/stream.ts +82 -0
  47. package/src/acp/transport.ts +213 -0
  48. package/src/acp.ts +6 -0
  49. package/src/browsers.ts +501 -0
  50. package/src/chalk.ts +312 -0
  51. package/src/dates.ts +194 -0
  52. package/src/docx/converter.ts +681 -0
  53. package/src/docx/xml.ts +166 -0
  54. package/src/docx/zip.ts +87 -0
  55. package/src/docx.ts +20 -0
  56. package/src/dom/core.ts +1254 -0
  57. package/src/dom/parser.ts +370 -0
  58. package/src/dom/selector.ts +290 -0
  59. package/src/dom.ts +33 -0
  60. package/src/frontmatter.ts +44 -14
  61. package/src/headers.ts +167 -0
  62. package/src/logger/rotating-file.ts +149 -0
  63. package/src/logger.ts +12 -28
  64. package/src/lru.ts +185 -0
  65. package/src/marked/core.ts +1576 -0
  66. package/src/marked.ts +2 -0
  67. package/src/postmortem.ts +44 -1
  68. package/src/procmgr.ts +21 -4
  69. package/src/prompt.ts +5 -22
  70. package/src/readability/readability.ts +533 -0
  71. package/src/readability/readerable.ts +51 -0
  72. package/src/readability/types.ts +72 -0
  73. package/src/readability.ts +11 -0
  74. package/src/template.ts +586 -0
  75. package/src/turndown/gfm.ts +106 -0
  76. package/src/turndown/html.ts +257 -0
  77. package/src/turndown/service.ts +334 -0
  78. package/src/turndown/types.ts +81 -0
  79. package/src/turndown.ts +5 -0
  80. package/src/vterm/buffer.ts +218 -0
  81. package/src/vterm/terminal.ts +773 -0
  82. package/src/vterm.ts +8 -0
  83. package/src/xml.ts +313 -0
  84. package/src/winston-daily-rotate-file.d.ts +0 -6
@@ -0,0 +1,431 @@
1
+ /** Behavior-compatible reimplementation of linkedom's used surface. */
2
+ /** DOM node type constants. */
3
+ export declare const enum NodeType {
4
+ ELEMENT = 1,
5
+ ATTRIBUTE = 2,
6
+ TEXT = 3,
7
+ COMMENT = 8,
8
+ DOCUMENT = 9,
9
+ DOCUMENT_FRAGMENT = 11
10
+ }
11
+ interface EventInit {
12
+ bubbles?: boolean;
13
+ cancelable?: boolean;
14
+ composed?: boolean;
15
+ }
16
+ interface CustomEventInit<T> extends EventInit {
17
+ detail?: T;
18
+ }
19
+ interface ElementCreationOptions {
20
+ is?: string;
21
+ }
22
+ type FrameRequestCallback = (time: number) => void;
23
+ /** Minimal browser event implementation. */
24
+ export declare class Event {
25
+ #private;
26
+ type: string;
27
+ bubbles: boolean;
28
+ cancelable: boolean;
29
+ target: EventTarget | null;
30
+ currentTarget: EventTarget | null;
31
+ defaultPrevented: boolean;
32
+ constructor(type: string, init?: EventInit);
33
+ /** Initialize an event created through Document.createEvent. */
34
+ initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
35
+ /** Cancel this event when it is cancelable. */
36
+ preventDefault(): void;
37
+ /** Stop bubbling this event. */
38
+ stopPropagation(): void;
39
+ /** Whether propagation has been stopped. */
40
+ get propagationStopped(): boolean;
41
+ }
42
+ /** Browser custom event carrying a detail value. */
43
+ export declare class CustomEvent<T = unknown> extends Event {
44
+ readonly detail: T | undefined;
45
+ constructor(type: string, init?: CustomEventInit<T>);
46
+ }
47
+ type EventListener = ((event: Event) => void) | {
48
+ handleEvent(event: Event): void;
49
+ };
50
+ /** Minimal event-target implementation used by DOM nodes and window. */
51
+ export declare class EventTarget {
52
+ #private;
53
+ /** Register an event listener. */
54
+ addEventListener(type: string, listener: EventListener | null): void;
55
+ /** Remove an event listener. */
56
+ removeEventListener(type: string, listener: EventListener | null): void;
57
+ /** Dispatch an event to listeners and optionally through node ancestors. */
58
+ dispatchEvent(event: Event): boolean;
59
+ }
60
+ /** Base class for the implemented DOM tree. */
61
+ export declare class Node extends EventTarget {
62
+ static readonly ELEMENT_NODE = NodeType.ELEMENT;
63
+ static readonly ATTRIBUTE_NODE = NodeType.ATTRIBUTE;
64
+ static readonly TEXT_NODE = NodeType.TEXT;
65
+ static readonly COMMENT_NODE = NodeType.COMMENT;
66
+ static readonly DOCUMENT_NODE = NodeType.DOCUMENT;
67
+ static readonly DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT;
68
+ readonly nodeType: number;
69
+ readonly nodeName: string;
70
+ parentNode: Node | null;
71
+ ownerDocument: Document | null;
72
+ childNodes: Node[];
73
+ constructor(nodeType: number, nodeName: string, ownerDocument?: Document | null);
74
+ /** First child node, if present. */
75
+ get firstChild(): Node | null;
76
+ /** Last child node, if present. */
77
+ get lastChild(): Node | null;
78
+ /** Previous node with the same parent. */
79
+ get previousSibling(): Node | null;
80
+ /** Next node with the same parent. */
81
+ get nextSibling(): Node | null;
82
+ /** Connectedness to a document. */
83
+ get isConnected(): boolean;
84
+ /** Node value for character-data nodes. */
85
+ get nodeValue(): string | null;
86
+ set nodeValue(_value: string | null);
87
+ /** Text contained by this node. */
88
+ get textContent(): string | null;
89
+ set textContent(value: string | null);
90
+ /** Parent element, excluding document and fragments. */
91
+ get parentElement(): Element | null;
92
+ /** Append a node, moving it from its old parent. */
93
+ appendChild<T extends Node>(child: T): T;
94
+ /** Insert a node before a current child, or append for null. */
95
+ insertBefore<T extends Node>(child: T, reference: Node | null): T;
96
+ /** Replace a current child with another node. */
97
+ replaceChild<T extends Node>(child: Node, previous: T): T;
98
+ /** Remove a current child. */
99
+ removeChild<T extends Node>(child: T): T;
100
+ /** Replace all children with nodes or strings. */
101
+ replaceChildren(...children: Array<Node | string>): void;
102
+ /** Append nodes or strings. */
103
+ append(...children: Array<Node | string>): void;
104
+ /** Prepend nodes or strings. */
105
+ prepend(...children: Array<Node | string>): void;
106
+ /** Remove this node from its parent. */
107
+ remove(): void;
108
+ /** Replace this node in its parent. */
109
+ replaceWith(...nodes: Array<Node | string>): void;
110
+ /** Whether this node contains another node. */
111
+ contains(other: Node | null): boolean;
112
+ /** Clone this node, optionally including descendants. */
113
+ cloneNode(deep?: boolean): Node;
114
+ /** Compare tree position sufficiently for document-order consumers. */
115
+ compareDocumentPosition(other: Node): number;
116
+ setOwnerDocument(document: Document): void;
117
+ documentForCreation(): Document;
118
+ }
119
+ /** Text node. */
120
+ export declare class Text extends Node {
121
+ data: string;
122
+ serializeRaw: boolean;
123
+ constructor(data: string, ownerDocument?: Document | null, serializeRaw?: boolean);
124
+ /** Number of UTF-16 code units. */
125
+ get length(): number;
126
+ get nodeValue(): string;
127
+ set nodeValue(value: string | null);
128
+ get textContent(): string;
129
+ set textContent(value: string | null);
130
+ /** Split this text node at an offset. */
131
+ splitText(offset: number): Text;
132
+ cloneNode(): Text;
133
+ }
134
+ /** Comment node. */
135
+ export declare class Comment extends Text {
136
+ constructor(data: string, ownerDocument?: Document | null);
137
+ cloneNode(): Comment;
138
+ }
139
+ /** DOM attribute value object. */
140
+ export declare class Attr extends Node {
141
+ readonly name: string;
142
+ value: string;
143
+ readonly namespaceURI: string | null;
144
+ constructor(name: string, value: string, ownerDocument?: Document | null, namespaceURI?: string | null);
145
+ get nodeValue(): string;
146
+ set nodeValue(value: string | null);
147
+ get textContent(): string;
148
+ set textContent(value: string | null);
149
+ cloneNode(): Attr;
150
+ }
151
+ /** Array-like attribute collection. */
152
+ export declare class NamedNodeMap extends Array<Attr> {
153
+ /** Find an attribute case-insensitively. */
154
+ getNamedItem(name: string): Attr | null;
155
+ /** Set an attribute object and return the prior one. */
156
+ setNamedItem(attr: Attr): Attr | null;
157
+ /** Remove and return a named attribute. */
158
+ removeNamedItem(name: string): Attr;
159
+ }
160
+ /** Token-list view over an element class attribute. */
161
+ export declare class DOMTokenList implements Iterable<string> {
162
+ #private;
163
+ constructor(element: Element);
164
+ /** Token count. */
165
+ get length(): number;
166
+ /** String representation. */
167
+ get value(): string;
168
+ set value(value: string);
169
+ /** Add class tokens. */
170
+ add(...tokens: string[]): void;
171
+ /** Remove class tokens. */
172
+ remove(...tokens: string[]): void;
173
+ /** Whether a class token exists. */
174
+ contains(token: string): boolean;
175
+ /** Toggle a class token. */
176
+ toggle(token: string, force?: boolean): boolean;
177
+ /** Replace one class token with another. */
178
+ replace(previous: string, next: string): boolean;
179
+ /** Token at an index. */
180
+ item(index: number): string | null;
181
+ [Symbol.iterator](): Iterator<string>;
182
+ toString(): string;
183
+ }
184
+ /** Mutable inline style declaration. */
185
+ export declare class CSSStyleDeclaration {
186
+ #private;
187
+ /** Serialized declarations. */
188
+ get cssText(): string;
189
+ set cssText(value: string);
190
+ /** Read a CSS property. */
191
+ getPropertyValue(name: string): string;
192
+ /** Set a CSS property. */
193
+ setProperty(name: string, value: string | null, _priority?: string): void;
194
+ /** Remove and return a CSS property. */
195
+ removeProperty(name: string): string;
196
+ }
197
+ /** DOM element with attributes, selectors, and HTML serialization. */
198
+ export declare class Element extends Node {
199
+ readonly localName: string;
200
+ readonly tagName: string;
201
+ readonly namespaceURI: string | null;
202
+ readonly qualifiedName: string;
203
+ readonly attributes: NamedNodeMap;
204
+ readonly classList: DOMTokenList;
205
+ readonly style: CSSStyleDeclaration;
206
+ constructor(tagName: string, ownerDocument?: Document | null, namespaceURI?: string | null);
207
+ /** Element children. */
208
+ get children(): Element[];
209
+ /** First element child. */
210
+ get firstElementChild(): Element | null;
211
+ /** Last element child. */
212
+ get lastElementChild(): Element | null;
213
+ /** Previous sibling that is an element. */
214
+ get previousElementSibling(): Element | null;
215
+ /** Next sibling that is an element. */
216
+ get nextElementSibling(): Element | null;
217
+ /** Attribute-backed element id. */
218
+ get id(): string;
219
+ set id(value: string);
220
+ /** Attribute-backed class string. */
221
+ get className(): string;
222
+ set className(value: string);
223
+ /** Data attributes exposed as camel-cased properties. */
224
+ get dataset(): Record<string, string>;
225
+ /** Linkedom-compatible legacy text property (only specialized elements define a value). */
226
+ get text(): string | undefined;
227
+ /** HTML contained inside this element. */
228
+ get innerHTML(): string;
229
+ set innerHTML(value: string);
230
+ /** Serialized element and descendants. */
231
+ get outerHTML(): string;
232
+ set outerHTML(value: string);
233
+ /** Read an attribute. */
234
+ getAttribute(name: string): string | null;
235
+ /** Read an attribute object. */
236
+ getAttributeNode(name: string): Attr | null;
237
+ /** Whether an attribute exists. */
238
+ hasAttribute(name: string): boolean;
239
+ /** Set an attribute. */
240
+ setAttribute(name: string, value: string): void;
241
+ /** Set a namespaced attribute. */
242
+ setAttributeNS(_namespace: string | null, name: string, value: string): void;
243
+ /** Remove an attribute. */
244
+ removeAttribute(name: string): void;
245
+ /** Find the first descendant matching a selector. */
246
+ querySelector(selector: string): Element | null;
247
+ /** Find all descendants matching a selector. */
248
+ querySelectorAll(selector: string): Element[];
249
+ /** Whether this element matches a selector. */
250
+ matches(selector: string): boolean;
251
+ /** Find the nearest matching ancestor including this element. */
252
+ closest(selector: string): Element | null;
253
+ /** Descendant elements with a tag name. */
254
+ getElementsByTagName(tagName: string): Element[];
255
+ /** Descendant elements containing all requested class tokens. */
256
+ getElementsByClassName(classNames: string): Element[];
257
+ /**
258
+ * Return a zero-sized rectangle because this parser DOM has no layout.
259
+ * Browser-side scripts only use this method's standard shape.
260
+ */
261
+ getBoundingClientRect(): {
262
+ x: number;
263
+ y: number;
264
+ bottom: number;
265
+ height: number;
266
+ left: number;
267
+ right: number;
268
+ top: number;
269
+ width: number;
270
+ };
271
+ /** Focus this element in its owner document. */
272
+ focus(): void;
273
+ /** Clear focus from this element. */
274
+ blur(): void;
275
+ /** Trigger a synthetic click event. */
276
+ click(): void;
277
+ cloneNode(deep?: boolean): Element;
278
+ }
279
+ /** HTML element implementation. */
280
+ export declare class HTMLElement extends Element {
281
+ value: string;
282
+ checked: boolean;
283
+ selected: boolean;
284
+ disabled: boolean;
285
+ multiple: boolean;
286
+ defaultValue: string;
287
+ defaultChecked: boolean;
288
+ /** Reflected title attribute. */
289
+ get title(): string;
290
+ set title(value: string);
291
+ /** Reflected href attribute. */
292
+ get href(): string;
293
+ set href(value: string);
294
+ /** Reflected input type. */
295
+ get type(): string;
296
+ set type(value: string);
297
+ /** Reflected name. */
298
+ get name(): string;
299
+ set name(value: string);
300
+ }
301
+ /** HTML meta element with a reflected content attribute. */
302
+ export declare class HTMLMetaElement extends HTMLElement {
303
+ /** Reflected metadata content. */
304
+ get content(): string;
305
+ set content(value: string);
306
+ }
307
+ /** SVG element marker used by React feature checks. */
308
+ export declare class SVGElement extends Element {
309
+ }
310
+ /** Iframe element marker used by React selection restoration. */
311
+ export declare class HTMLIFrameElement extends HTMLElement {
312
+ }
313
+ /** Document fragment. */
314
+ export declare class DocumentFragment extends Node {
315
+ constructor(ownerDocument?: Document | null);
316
+ /** Element children. */
317
+ get children(): Element[];
318
+ /** First element child. */
319
+ get firstElementChild(): Element | null;
320
+ /** Last element child. */
321
+ get lastElementChild(): Element | null;
322
+ /** First matching descendant. */
323
+ querySelector(selector: string): Element | null;
324
+ /** All matching descendants. */
325
+ querySelectorAll(selector: string): Element[];
326
+ cloneNode(deep?: boolean): DocumentFragment;
327
+ }
328
+ /** HTML template whose parsed descendants live in a document fragment. */
329
+ export declare class HTMLTemplateElement extends HTMLElement {
330
+ readonly content: DocumentFragment;
331
+ constructor(tagName: string, ownerDocument?: Document | null, namespaceURI?: string | null);
332
+ get innerHTML(): string;
333
+ set innerHTML(value: string);
334
+ get textContent(): string;
335
+ set textContent(value: string | null);
336
+ appendChild<T extends Node>(child: T): T;
337
+ insertBefore<T extends Node>(child: T, reference: Node | null): T;
338
+ replaceChild<T extends Node>(child: Node, previous: T): T;
339
+ removeChild<T extends Node>(child: T): T;
340
+ cloneNode(deep?: boolean): HTMLTemplateElement;
341
+ }
342
+ /** Minimal HTML document. */
343
+ export declare class Document extends Node {
344
+ defaultView: DOMWindow | null;
345
+ URL: string;
346
+ activeElement: Element | null;
347
+ constructor();
348
+ /** Root element of the document. */
349
+ get documentElement(): Element | null;
350
+ /** Element children. */
351
+ get children(): Element[];
352
+ /** HTML body, or a detached empty body when absent like linkedom. */
353
+ get body(): HTMLElement;
354
+ /** HTML head, or a detached empty head when absent. */
355
+ get head(): HTMLElement;
356
+ /** Document title text. */
357
+ get title(): string;
358
+ set title(value: string);
359
+ get textContent(): null;
360
+ set textContent(_value: string | null);
361
+ /** Create an HTML element. */
362
+ createElement(tagName: string, _options?: ElementCreationOptions): HTMLElement;
363
+ /** Create a namespaced element. */
364
+ createElementNS(namespace: string | null, tagName: string): Element;
365
+ /** Create a text node. */
366
+ createTextNode(data: string): Text;
367
+ /** Create a comment. */
368
+ createComment(data: string): Comment;
369
+ /** Create an attribute. */
370
+ createAttribute(name: string): Attr;
371
+ /** Create a document fragment. */
372
+ createDocumentFragment(): DocumentFragment;
373
+ /** Find the first element by id. */
374
+ getElementById(id: string): HTMLElement | null;
375
+ /** Find the first matching descendant. */
376
+ querySelector(selector: string): Element | null;
377
+ /** Find all matching descendants. */
378
+ querySelectorAll(selector: string): Element[];
379
+ /** Descendant elements with a tag name. */
380
+ getElementsByTagName(tagName: string): Element[];
381
+ /** Descendant elements containing all class tokens. */
382
+ getElementsByClassName(classNames: string): Element[];
383
+ /** Adopt a node into this document. */
384
+ adoptNode<T extends Node>(node: T): T;
385
+ /** Import a cloned node into this document. */
386
+ importNode<T extends Node>(node: T, deep?: boolean): T;
387
+ /** Legacy event factory used by libraries. */
388
+ createEvent(_kind: string): Event;
389
+ cloneNode(deep?: boolean): Document;
390
+ }
391
+ /** Window shape returned by parseHTML. */
392
+ export declare class DOMWindow extends EventTarget {
393
+ readonly document: Document;
394
+ readonly Node: typeof Node;
395
+ readonly Element: typeof Element;
396
+ readonly HTMLElement: typeof HTMLElement;
397
+ readonly HTMLIFrameElement: typeof HTMLIFrameElement;
398
+ readonly SVGElement: typeof SVGElement;
399
+ readonly Text: typeof Text;
400
+ readonly Comment: typeof Comment;
401
+ readonly Document: typeof Document;
402
+ readonly DocumentFragment: typeof DocumentFragment;
403
+ readonly Event: typeof Event;
404
+ readonly CustomEvent: typeof CustomEvent;
405
+ readonly navigator: {
406
+ userAgent: string;
407
+ platform: string;
408
+ };
409
+ readonly location: {
410
+ href: string;
411
+ };
412
+ readonly window: DOMWindow;
413
+ readonly self: DOMWindow;
414
+ readonly top: DOMWindow;
415
+ readonly parent: DOMWindow;
416
+ constructor(document: Document);
417
+ /** Browser-compatible computed style placeholder. */
418
+ getComputedStyle(element: Element): CSSStyleDeclaration;
419
+ /** Schedule an animation callback. */
420
+ requestAnimationFrame(callback: FrameRequestCallback): number;
421
+ /** Cancel an animation callback. */
422
+ cancelAnimationFrame(handle: number): void;
423
+ /** Empty selection object. */
424
+ getSelection(): {
425
+ rangeCount: number;
426
+ removeAllRanges(): void;
427
+ };
428
+ }
429
+ /** Serialize a DOM node as HTML. */
430
+ export declare function serializeNode(node: Node): string;
431
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Document, type DocumentFragment } from "./core.js";
2
+ /** Decode common named entities and all valid numeric character references. */
3
+ export declare function decodeEntities(value: string): string;
4
+ /** Parse markup into a document fragment. */
5
+ export declare function parseFragment(html: string, document: Document, contextTag?: string): DocumentFragment;
6
+ /** Parse markup directly into a document. */
7
+ export declare function parseDocument(html: string): Document;
@@ -0,0 +1,5 @@
1
+ import { type Document, type DocumentFragment, Element } from "./core.js";
2
+ /** Whether an element matches a CSS selector list. */
3
+ export declare function matchesSelector(element: Element, selector: string): boolean;
4
+ /** Query descendants of a node in document order. */
5
+ export declare function querySelectorAllFrom(root: Document | DocumentFragment | Element, selector: string, includeRoot: boolean): Element[];
@@ -0,0 +1,5 @@
1
+ /** Behavior-compatible reimplementation of linkedom's used surface. */
2
+ import { DOMWindow } from "./dom/core.js";
3
+ export { Attr, Comment, CSSStyleDeclaration, CustomEvent, DOMTokenList, DOMWindow, Document, DocumentFragment, Element, Event, EventTarget, HTMLElement, HTMLIFrameElement, HTMLMetaElement, HTMLTemplateElement, NamedNodeMap, Node, NodeType, SVGElement, serializeNode, Text, } from "./dom/core.js";
4
+ /** Parse HTML or XML-like markup into a lightweight window and document. */
5
+ export declare function parseHTML(html: string): DOMWindow;
@@ -1,3 +1,10 @@
1
+ /**
2
+ * Recursively normalize object keys from kebab-case to camelCase — the
3
+ * representation convention for frontmatter consumed inside this codebase.
4
+ * Exported for loaders that parse with `rawKeys: true` to validate exact
5
+ * spec-defined keys, then normalize for storage.
6
+ */
7
+ export declare function normalizeFrontmatterKeys<T>(obj: T): T;
1
8
  export declare class FrontmatterError extends Error {
2
9
  readonly source?: unknown;
3
10
  constructor(error: Error, source?: unknown);
@@ -14,6 +21,20 @@ export interface FrontmatterOptions {
14
21
  normalize?: boolean;
15
22
  /** Level of error handling */
16
23
  level?: "off" | "warn" | "fatal";
24
+ /**
25
+ * Attempt lenient recovery of near-miss input before failing: quote
26
+ * ambiguous plain scalars, replace tabs with spaces, and strip leading HTML
27
+ * comments ahead of the opening delimiter. Default `true`. Spec-conformant
28
+ * loaders set `false` so malformed input is rejected instead of silently
29
+ * repaired (CRLF newline normalization still applies).
30
+ */
31
+ repair?: boolean;
32
+ /**
33
+ * Preserve frontmatter keys verbatim instead of normalizing kebab-case to
34
+ * camelCase. Default `false`. Strict spec loaders use this so a standard
35
+ * key (e.g. `allowed-tools`) is never aliased with its camelCase form.
36
+ */
37
+ rawKeys?: boolean;
17
38
  }
18
39
  /**
19
40
  * Parse YAML frontmatter from markdown content
@@ -0,0 +1,34 @@
1
+ /** Behavior-compatible reimplementation of header-generator's used surface. */
2
+ /** A browser family supported by the curated header profiles. */
3
+ export type BrowserName = "chrome" | "firefox" | "safari";
4
+ /** A desktop operating system supported by the curated header profiles. */
5
+ export type OperatingSystem = "windows" | "macos" | "linux";
6
+ /** Constructor and per-call constraints for header generation. */
7
+ export interface HeaderGeneratorOptions {
8
+ /** Browser families eligible for a draw. */
9
+ browsers: BrowserName[];
10
+ /** Browser selection query; the supported `last 3 versions` query uses the curated versions. */
11
+ browserListQuery: string;
12
+ /** Desktop operating systems eligible for a draw. */
13
+ operatingSystems: OperatingSystem[];
14
+ /** Device classes eligible for a draw. */
15
+ devices: "desktop"[];
16
+ /** Ordered locales for the Accept-Language value. */
17
+ locales: string[];
18
+ /** HTTP protocol generation mode. */
19
+ httpVersion: "1" | "2";
20
+ /** Whether impossible constraints throw instead of relaxing to a coherent profile. */
21
+ strict: boolean;
22
+ /** Random source returning a value in the range from zero (inclusive) to one (exclusive). */
23
+ rng: () => number;
24
+ }
25
+ /** A generated HTTP request header map. */
26
+ export type Headers = Record<string, string>;
27
+ /** Generates coherent modern desktop browser navigation headers. */
28
+ export declare class HeaderGenerator {
29
+ #private;
30
+ /** Creates a generator with reusable constraints and an optionally injectable RNG. */
31
+ constructor(options?: Partial<HeaderGeneratorOptions>);
32
+ /** Generates one header set, applying per-call constraints and request overrides. */
33
+ getHeaders(options?: Partial<HeaderGeneratorOptions>, overrides?: Headers): Headers;
34
+ }
@@ -0,0 +1,18 @@
1
+ /** Configuration for a process-local rotating file sink. */
2
+ export interface RotatingFileOptions {
3
+ readonly directory: string;
4
+ readonly filenamePrefix: string;
5
+ readonly filenameSuffix: string;
6
+ readonly auditFile: string;
7
+ readonly maxBytes: number;
8
+ readonly maxFiles: number;
9
+ }
10
+ /** Synchronous append sink with local-day and size rotation plus bounded retention. */
11
+ export declare class RotatingFileSink {
12
+ #private;
13
+ constructor(options: RotatingFileOptions);
14
+ /** Append one already-formatted log record. */
15
+ write(line: string): void;
16
+ /** Stop accepting records. Synchronous writes require no drain phase. */
17
+ close(): void;
18
+ }
@@ -0,0 +1,46 @@
1
+ /** Behavior-compatible reimplementation of lru-cache's used surface. */
2
+ /** Why an entry left the cache. */
3
+ export type DisposeReason = "evict" | "set" | "delete" | "expire";
4
+ /** Options supported by {@link LRUCache}. */
5
+ export interface LRUCacheOptions<K, V> {
6
+ /** Maximum number of retained entries. */
7
+ max?: number;
8
+ /** Maximum aggregate calculated size. */
9
+ maxSize?: number;
10
+ /** Maximum calculated size of one entry. */
11
+ maxEntrySize?: number;
12
+ /** Calculates an entry's size. */
13
+ sizeCalculation?: (value: V, key: K) => number;
14
+ /** Entry lifetime in milliseconds; zero disables expiry. */
15
+ ttl?: number;
16
+ /** Refreshes an entry's lifetime when it is read. */
17
+ updateAgeOnGet?: boolean;
18
+ /** Called synchronously before an entry is removed. */
19
+ dispose?: (value: V, key: K, reason: DisposeReason) => void;
20
+ }
21
+ /** A bounded least-recently-used cache with optional size and lifetime limits. */
22
+ export declare class LRUCache<K, V> {
23
+ #private;
24
+ /** Creates an empty cache. */
25
+ constructor(options: LRUCacheOptions<K, V>);
26
+ /** Number of entries, including stale entries not yet removed by `get`. */
27
+ get size(): number;
28
+ /** Aggregate calculated size of retained entries. */
29
+ get calculatedSize(): number;
30
+ /** Stores a value and makes it most recently used. */
31
+ set(key: K, value: V | undefined): this;
32
+ /** Returns a value and makes a fresh entry most recently used. */
33
+ get(key: K): V | undefined;
34
+ /** Reports whether a fresh value is present without changing recency. */
35
+ has(key: K): boolean;
36
+ /** Returns a fresh value without changing recency or removing stale data. */
37
+ peek(key: K): V | undefined;
38
+ /** Removes a value, returning whether one was present. */
39
+ delete(key: K): boolean;
40
+ /** Removes every value from least to most recently used. */
41
+ clear(): void;
42
+ /** Iterates fresh keys from most to least recently used. */
43
+ keys(): Generator<K, void, unknown>;
44
+ /** Iterates fresh values from most to least recently used. */
45
+ values(): Generator<V, void, unknown>;
46
+ }