verybot 0.1.3
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.
Potentially problematic release.
This version of verybot might be problematic. Click here for more details.
- package/dist/brain/agent-registry.d.ts +75 -0
- package/dist/brain/agent-registry.js +124 -0
- package/dist/brain/agent.d.ts +146 -0
- package/dist/brain/agent.js +680 -0
- package/dist/brain/channel-store.d.ts +27 -0
- package/dist/brain/channel-store.js +78 -0
- package/dist/brain/compaction.d.ts +37 -0
- package/dist/brain/compaction.js +214 -0
- package/dist/brain/context.d.ts +33 -0
- package/dist/brain/context.js +77 -0
- package/dist/brain/delegation-store.d.ts +33 -0
- package/dist/brain/delegation-store.js +106 -0
- package/dist/brain/loop.d.ts +21 -0
- package/dist/brain/loop.js +161 -0
- package/dist/brain/mcp-adapter.d.ts +39 -0
- package/dist/brain/mcp-adapter.js +227 -0
- package/dist/brain/memory-extractor.d.ts +26 -0
- package/dist/brain/memory-extractor.js +82 -0
- package/dist/brain/providers.d.ts +10 -0
- package/dist/brain/providers.js +69 -0
- package/dist/brain/queue.d.ts +18 -0
- package/dist/brain/queue.js +84 -0
- package/dist/brain/run-tools.d.ts +47 -0
- package/dist/brain/run-tools.js +84 -0
- package/dist/brain/session-key.d.ts +23 -0
- package/dist/brain/session-key.js +41 -0
- package/dist/brain/session-state.d.ts +36 -0
- package/dist/brain/session-state.js +51 -0
- package/dist/brain/session-store.d.ts +50 -0
- package/dist/brain/session-store.js +207 -0
- package/dist/brain/session.d.ts +32 -0
- package/dist/brain/session.js +75 -0
- package/dist/brain/utils.d.ts +4 -0
- package/dist/brain/utils.js +26 -0
- package/dist/brain/worker-coordinator.d.ts +25 -0
- package/dist/brain/worker-coordinator.js +83 -0
- package/dist/channels/commands.d.ts +35 -0
- package/dist/channels/commands.js +65 -0
- package/dist/channels/discord/channel.d.ts +18 -0
- package/dist/channels/discord/channel.js +154 -0
- package/dist/channels/discord/markdown.d.ts +19 -0
- package/dist/channels/discord/markdown.js +62 -0
- package/dist/channels/manager.d.ts +29 -0
- package/dist/channels/manager.js +100 -0
- package/dist/channels/slack/channel.d.ts +26 -0
- package/dist/channels/slack/channel.js +207 -0
- package/dist/channels/slack/markdown.d.ts +19 -0
- package/dist/channels/slack/markdown.js +62 -0
- package/dist/channels/specs.d.ts +21 -0
- package/dist/channels/specs.js +96 -0
- package/dist/channels/telegram/channel.d.ts +18 -0
- package/dist/channels/telegram/channel.js +156 -0
- package/dist/channels/telegram/markdown.d.ts +17 -0
- package/dist/channels/telegram/markdown.js +66 -0
- package/dist/channels/types.d.ts +26 -0
- package/dist/channels/types.js +1 -0
- package/dist/channels/whatsapp/channel.d.ts +23 -0
- package/dist/channels/whatsapp/channel.js +242 -0
- package/dist/channels/whatsapp/markdown.d.ts +20 -0
- package/dist/channels/whatsapp/markdown.js +51 -0
- package/dist/cli/config.d.ts +5 -0
- package/dist/cli/config.js +78 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.js +13 -0
- package/dist/computer/browser/actions.d.ts +31 -0
- package/dist/computer/browser/actions.js +148 -0
- package/dist/computer/browser/manager.d.ts +55 -0
- package/dist/computer/browser/manager.js +496 -0
- package/dist/computer/browser/profile-badge.d.ts +13 -0
- package/dist/computer/browser/profile-badge.js +67 -0
- package/dist/computer/browser/screenshot.d.ts +5 -0
- package/dist/computer/browser/screenshot.js +21 -0
- package/dist/computer/browser/snapshot.d.ts +30 -0
- package/dist/computer/browser/snapshot.js +242 -0
- package/dist/computer/browser/tools.d.ts +5 -0
- package/dist/computer/browser/tools.js +167 -0
- package/dist/computer/desktop/adapter.d.ts +25 -0
- package/dist/computer/desktop/adapter.js +11 -0
- package/dist/computer/desktop/macos.d.ts +24 -0
- package/dist/computer/desktop/macos.js +223 -0
- package/dist/computer/desktop/tools.d.ts +25 -0
- package/dist/computer/desktop/tools.js +114 -0
- package/dist/config/agent-config.d.ts +41 -0
- package/dist/config/agent-config.js +14 -0
- package/dist/config/model-catalog.d.ts +22 -0
- package/dist/config/model-catalog.js +99 -0
- package/dist/config/store.d.ts +25 -0
- package/dist/config/store.js +143 -0
- package/dist/config.d.ts +103 -0
- package/dist/config.js +224 -0
- package/dist/control-ui/assets/index-BANXNUyt.js +143 -0
- package/dist/control-ui/assets/index-BSUFrP9R.css +1 -0
- package/dist/control-ui/assets/noto-sans-cyrillic-ext-wght-normal-DSNfmdVt.woff2 +0 -0
- package/dist/control-ui/assets/noto-sans-cyrillic-wght-normal-B2hlT84T.woff2 +0 -0
- package/dist/control-ui/assets/noto-sans-devanagari-wght-normal-Cv-Vwajv.woff2 +0 -0
- package/dist/control-ui/assets/noto-sans-greek-ext-wght-normal-12T8GTDR.woff2 +0 -0
- package/dist/control-ui/assets/noto-sans-greek-wght-normal-Ymb6dZNd.woff2 +0 -0
- package/dist/control-ui/assets/noto-sans-latin-ext-wght-normal-W1qJv59z.woff2 +0 -0
- package/dist/control-ui/assets/noto-sans-latin-wght-normal-BYSzYMf3.woff2 +0 -0
- package/dist/control-ui/assets/noto-sans-vietnamese-wght-normal-DLTJy58D.woff2 +0 -0
- package/dist/control-ui/index.html +14 -0
- package/dist/control-ui/vite.svg +1 -0
- package/dist/events.d.ts +2 -0
- package/dist/events.js +11 -0
- package/dist/gateway/broadcast.d.ts +5 -0
- package/dist/gateway/broadcast.js +33 -0
- package/dist/gateway/methods/chat.d.ts +24 -0
- package/dist/gateway/methods/chat.js +19 -0
- package/dist/gateway/methods/config.d.ts +13 -0
- package/dist/gateway/methods/config.js +14 -0
- package/dist/gateway/methods/models.d.ts +10 -0
- package/dist/gateway/methods/models.js +14 -0
- package/dist/gateway/methods/prompt-templates.d.ts +23 -0
- package/dist/gateway/methods/prompt-templates.js +82 -0
- package/dist/gateway/methods/scheduler.d.ts +62 -0
- package/dist/gateway/methods/scheduler.js +129 -0
- package/dist/gateway/methods/sessions.d.ts +26 -0
- package/dist/gateway/methods/sessions.js +54 -0
- package/dist/gateway/methods/skills.d.ts +35 -0
- package/dist/gateway/methods/skills.js +202 -0
- package/dist/gateway/methods/system.d.ts +12 -0
- package/dist/gateway/methods/system.js +39 -0
- package/dist/gateway/methods/tasks.d.ts +21 -0
- package/dist/gateway/methods/tasks.js +46 -0
- package/dist/gateway/methods/teams.d.ts +70 -0
- package/dist/gateway/methods/teams.js +374 -0
- package/dist/gateway/methods/tools.d.ts +6 -0
- package/dist/gateway/methods/tools.js +7 -0
- package/dist/gateway/methods/whatsapp.d.ts +19 -0
- package/dist/gateway/methods/whatsapp.js +35 -0
- package/dist/gateway/rpc.d.ts +38 -0
- package/dist/gateway/rpc.js +75 -0
- package/dist/gateway/server.d.ts +4 -0
- package/dist/gateway/server.js +133 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +212 -0
- package/dist/integrations/github.d.ts +7 -0
- package/dist/integrations/github.js +133 -0
- package/dist/integrations/mcp.d.ts +7 -0
- package/dist/integrations/mcp.js +106 -0
- package/dist/integrations/registry.d.ts +43 -0
- package/dist/integrations/registry.js +258 -0
- package/dist/integrations/scanner.d.ts +10 -0
- package/dist/integrations/scanner.js +122 -0
- package/dist/integrations/twitter.d.ts +10 -0
- package/dist/integrations/twitter.js +120 -0
- package/dist/integrations/types.d.ts +72 -0
- package/dist/integrations/types.js +1 -0
- package/dist/logger.d.ts +16 -0
- package/dist/logger.js +104 -0
- package/dist/markdown/chunk.d.ts +9 -0
- package/dist/markdown/chunk.js +52 -0
- package/dist/markdown/ir.d.ts +37 -0
- package/dist/markdown/ir.js +529 -0
- package/dist/markdown/render.d.ts +22 -0
- package/dist/markdown/render.js +148 -0
- package/dist/markdown/table-render.d.ts +43 -0
- package/dist/markdown/table-render.js +219 -0
- package/dist/markdown/tables.d.ts +17 -0
- package/dist/markdown/tables.js +27 -0
- package/dist/memory/embedding.d.ts +16 -0
- package/dist/memory/embedding.js +66 -0
- package/dist/memory/extractor.d.ts +6 -0
- package/dist/memory/extractor.js +72 -0
- package/dist/memory/search.d.ts +15 -0
- package/dist/memory/search.js +57 -0
- package/dist/memory/store.d.ts +34 -0
- package/dist/memory/store.js +328 -0
- package/dist/memory/types.d.ts +9 -0
- package/dist/memory/types.js +2 -0
- package/dist/paths.d.ts +20 -0
- package/dist/paths.js +29 -0
- package/dist/prompt-templates/builtins.d.ts +2 -0
- package/dist/prompt-templates/builtins.js +72 -0
- package/dist/prompt-templates/store.d.ts +39 -0
- package/dist/prompt-templates/store.js +174 -0
- package/dist/prompt-templates/types.d.ts +10 -0
- package/dist/prompt-templates/types.js +1 -0
- package/dist/scheduler/connected-channels.d.ts +24 -0
- package/dist/scheduler/connected-channels.js +57 -0
- package/dist/scheduler/scheduler.d.ts +22 -0
- package/dist/scheduler/scheduler.js +132 -0
- package/dist/scheduler/store.d.ts +27 -0
- package/dist/scheduler/store.js +205 -0
- package/dist/scheduler/types.d.ts +29 -0
- package/dist/scheduler/types.js +1 -0
- package/dist/security/command-validator.d.ts +22 -0
- package/dist/security/command-validator.js +160 -0
- package/dist/security/docker-sandbox.d.ts +48 -0
- package/dist/security/docker-sandbox.js +218 -0
- package/dist/security/env-filter.d.ts +8 -0
- package/dist/security/env-filter.js +41 -0
- package/dist/skills/loader.d.ts +33 -0
- package/dist/skills/loader.js +132 -0
- package/dist/skills/prompt.d.ts +6 -0
- package/dist/skills/prompt.js +17 -0
- package/dist/skills/read-tool.d.ts +7 -0
- package/dist/skills/read-tool.js +24 -0
- package/dist/skills/scanner.d.ts +6 -0
- package/dist/skills/scanner.js +73 -0
- package/dist/skills/types.d.ts +15 -0
- package/dist/skills/types.js +1 -0
- package/dist/tasks/store.d.ts +47 -0
- package/dist/tasks/store.js +193 -0
- package/dist/tasks/types.d.ts +75 -0
- package/dist/tasks/types.js +32 -0
- package/dist/teams/store.d.ts +78 -0
- package/dist/teams/store.js +420 -0
- package/dist/teams/types.d.ts +23 -0
- package/dist/teams/types.js +1 -0
- package/dist/tools/bash.d.ts +16 -0
- package/dist/tools/bash.js +62 -0
- package/dist/tools/channel-history.d.ts +10 -0
- package/dist/tools/channel-history.js +43 -0
- package/dist/tools/delegate.d.ts +16 -0
- package/dist/tools/delegate.js +216 -0
- package/dist/tools/fs.d.ts +4 -0
- package/dist/tools/fs.js +335 -0
- package/dist/tools/integration-toggle.d.ts +14 -0
- package/dist/tools/integration-toggle.js +47 -0
- package/dist/tools/memory.d.ts +13 -0
- package/dist/tools/memory.js +65 -0
- package/dist/tools/registry.d.ts +6 -0
- package/dist/tools/registry.js +9 -0
- package/dist/tools/schedule.d.ts +8 -0
- package/dist/tools/schedule.js +219 -0
- package/dist/tools/speak.d.ts +10 -0
- package/dist/tools/speak.js +56 -0
- package/dist/tools/tasks.d.ts +29 -0
- package/dist/tools/tasks.js +92 -0
- package/dist/tools/teams.d.ts +7 -0
- package/dist/tools/teams.js +180 -0
- package/dist/tools/web-fetch.d.ts +3 -0
- package/dist/tools/web-fetch.js +22 -0
- package/dist/tts/edge.d.ts +10 -0
- package/dist/tts/edge.js +60 -0
- package/dist/tts/speak.d.ts +12 -0
- package/dist/tts/speak.js +81 -0
- package/dist/tts/transcribe.d.ts +5 -0
- package/dist/tts/transcribe.js +40 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +22 -0
- package/package.json +90 -0
- package/verybot.js +2 -0
package/dist/logger.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import winston from "winston";
|
|
2
|
+
import Transport from "winston-transport";
|
|
3
|
+
const { combine, timestamp, printf, colorize } = winston.format;
|
|
4
|
+
const ANSI_RE = /\x1b\[[0-9;]*m/g;
|
|
5
|
+
// ANSI escape codes
|
|
6
|
+
const RESET = "\x1b[0m";
|
|
7
|
+
const DIM = "\x1b[2m";
|
|
8
|
+
const RED = "\x1b[31m";
|
|
9
|
+
const YELLOW = "\x1b[33m";
|
|
10
|
+
const GREEN = "\x1b[32m";
|
|
11
|
+
const BOLD = "\x1b[1m";
|
|
12
|
+
// Map raw level names to message colors
|
|
13
|
+
const MESSAGE_COLORS = {
|
|
14
|
+
error: RED,
|
|
15
|
+
warn: YELLOW,
|
|
16
|
+
};
|
|
17
|
+
// Detect user message lines: " [user] ..." (from loop.ts role logging)
|
|
18
|
+
const USER_MSG_RE = /^(.*)\[user\]\s+(.*)$/s;
|
|
19
|
+
const logFormat = printf(({ level, message, timestamp }) => {
|
|
20
|
+
// strip ANSI from level to get raw name for color lookup
|
|
21
|
+
const rawLevel = level.replace(ANSI_RE, "");
|
|
22
|
+
const msg = String(message);
|
|
23
|
+
// Highlight user messages in bold green
|
|
24
|
+
const userMatch = msg.match(USER_MSG_RE);
|
|
25
|
+
if (userMatch) {
|
|
26
|
+
const [, prefix, body] = userMatch;
|
|
27
|
+
return `${DIM}${timestamp}${RESET} [${level}] ${prefix}${BOLD}${GREEN}[user]${RESET} ${GREEN}${body}${RESET}`;
|
|
28
|
+
}
|
|
29
|
+
const msgColor = MESSAGE_COLORS[rawLevel] ?? "";
|
|
30
|
+
const msgReset = msgColor ? RESET : "";
|
|
31
|
+
return `${DIM}${timestamp}${RESET} [${level}] ${msgColor}${msg}${msgReset}`;
|
|
32
|
+
});
|
|
33
|
+
// --------------- Ring buffer for UI log streaming ---------------
|
|
34
|
+
const LOG_BUFFER_SIZE = 500;
|
|
35
|
+
/** Pattern sources for secrets — fresh RegExp per call to avoid /g lastIndex state. */
|
|
36
|
+
const SENSITIVE_PATTERN_SOURCES = [
|
|
37
|
+
{ source: "Bearer\\s+[A-Za-z0-9\\-._~+/]+=*", flags: "g" },
|
|
38
|
+
{ source: "token=[A-Za-z0-9\\-._~+/]+", flags: "gi" },
|
|
39
|
+
{ source: "(?:api[_-]?key|secret|password|credential)[\\s=:]+\\S+", flags: "gi" },
|
|
40
|
+
// Common API key prefixes (OpenAI, Anthropic, GitHub, Stripe, etc.)
|
|
41
|
+
{ source: "(?:sk|pk)[-_][A-Za-z0-9\\-._]{20,}", flags: "g" },
|
|
42
|
+
{ source: "ghp_[A-Za-z0-9]{36}", flags: "g" },
|
|
43
|
+
// Connection strings with embedded passwords
|
|
44
|
+
{ source: "[a-z]+://[^:]+:[^@]+@", flags: "gi" },
|
|
45
|
+
];
|
|
46
|
+
function redactSensitive(msg) {
|
|
47
|
+
let out = msg;
|
|
48
|
+
for (const { source, flags } of SENSITIVE_PATTERN_SOURCES) {
|
|
49
|
+
out = out.replace(new RegExp(source, flags), "[REDACTED]");
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
const logBuffer = new Array(LOG_BUFFER_SIZE);
|
|
54
|
+
let ringHead = 0; // next write index
|
|
55
|
+
let ringCount = 0; // total entries in buffer
|
|
56
|
+
const logSubscribers = new Set();
|
|
57
|
+
/**
|
|
58
|
+
* Register a subscriber for real-time log entries.
|
|
59
|
+
* Returns an unsubscribe function.
|
|
60
|
+
*/
|
|
61
|
+
export function addLogSubscriber(cb) {
|
|
62
|
+
logSubscribers.add(cb);
|
|
63
|
+
return () => { logSubscribers.delete(cb); };
|
|
64
|
+
}
|
|
65
|
+
/** Return a snapshot of the current log buffer in chronological order. */
|
|
66
|
+
export function getLogBuffer() {
|
|
67
|
+
if (ringCount === 0)
|
|
68
|
+
return [];
|
|
69
|
+
if (ringCount < LOG_BUFFER_SIZE)
|
|
70
|
+
return logBuffer.slice(0, ringCount);
|
|
71
|
+
// Buffer is full — oldest entry starts at ringHead
|
|
72
|
+
return [...logBuffer.slice(ringHead), ...logBuffer.slice(0, ringHead)];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Custom Winston transport that feeds the ring buffer and notifies
|
|
76
|
+
* subscribed UI clients only.
|
|
77
|
+
*/
|
|
78
|
+
class UiBroadcastTransport extends Transport {
|
|
79
|
+
log(info, next) {
|
|
80
|
+
const raw = String(info.message).replace(ANSI_RE, "");
|
|
81
|
+
const entry = {
|
|
82
|
+
ts: info.timestamp ?? new Date().toISOString(),
|
|
83
|
+
level: info.level.replace(ANSI_RE, ""),
|
|
84
|
+
message: redactSensitive(raw),
|
|
85
|
+
};
|
|
86
|
+
// Ring buffer: O(1) insert via index wrapping
|
|
87
|
+
logBuffer[ringHead] = entry;
|
|
88
|
+
ringHead = (ringHead + 1) % LOG_BUFFER_SIZE;
|
|
89
|
+
if (ringCount < LOG_BUFFER_SIZE)
|
|
90
|
+
ringCount++;
|
|
91
|
+
for (const cb of logSubscribers)
|
|
92
|
+
cb(entry);
|
|
93
|
+
next();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// ----------------------------------------------------------------
|
|
97
|
+
export const logger = winston.createLogger({
|
|
98
|
+
level: process.env.LOG_LEVEL ?? "info",
|
|
99
|
+
format: combine(timestamp({ format: "HH:mm:ss" }), colorize(), logFormat),
|
|
100
|
+
transports: [
|
|
101
|
+
new winston.transports.Console(),
|
|
102
|
+
new UiBroadcastTransport(),
|
|
103
|
+
],
|
|
104
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple text chunker for splitting outbound messages into platform-sized pieces.
|
|
3
|
+
* Simple text chunker — only the core chunkText function.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Split text into chunks up to `limit` characters.
|
|
7
|
+
* Prefers breaking at newlines, then whitespace, then hard-splits.
|
|
8
|
+
*/
|
|
9
|
+
export declare function chunkText(text: string, limit: number): string[];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple text chunker for splitting outbound messages into platform-sized pieces.
|
|
3
|
+
* Simple text chunker — only the core chunkText function.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Split text into chunks up to `limit` characters.
|
|
7
|
+
* Prefers breaking at newlines, then whitespace, then hard-splits.
|
|
8
|
+
*/
|
|
9
|
+
export function chunkText(text, limit) {
|
|
10
|
+
if (!text) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
if (limit <= 0) {
|
|
14
|
+
return [text];
|
|
15
|
+
}
|
|
16
|
+
if (text.length <= limit) {
|
|
17
|
+
return [text];
|
|
18
|
+
}
|
|
19
|
+
const chunks = [];
|
|
20
|
+
let remaining = text;
|
|
21
|
+
while (remaining.length > limit) {
|
|
22
|
+
const window = remaining.slice(0, limit);
|
|
23
|
+
// 1) Prefer a newline break inside the window.
|
|
24
|
+
let breakIdx = window.lastIndexOf("\n");
|
|
25
|
+
// 2) Otherwise prefer the last whitespace (word boundary).
|
|
26
|
+
if (breakIdx <= 0) {
|
|
27
|
+
for (let i = window.length - 1; i >= 0; i--) {
|
|
28
|
+
if (/\s/.test(window[i])) {
|
|
29
|
+
breakIdx = i;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// 3) Fallback: hard break exactly at the limit.
|
|
35
|
+
if (breakIdx <= 0) {
|
|
36
|
+
breakIdx = limit;
|
|
37
|
+
}
|
|
38
|
+
const rawChunk = remaining.slice(0, breakIdx);
|
|
39
|
+
const chunk = rawChunk.trimEnd();
|
|
40
|
+
if (chunk.length > 0) {
|
|
41
|
+
chunks.push(chunk);
|
|
42
|
+
}
|
|
43
|
+
// If we broke on whitespace/newline, skip that separator.
|
|
44
|
+
const brokeOnSeparator = breakIdx < remaining.length && /\s/.test(remaining[breakIdx]);
|
|
45
|
+
const nextStart = Math.min(remaining.length, breakIdx + (brokeOnSeparator ? 1 : 0));
|
|
46
|
+
remaining = remaining.slice(nextStart).trimStart();
|
|
47
|
+
}
|
|
48
|
+
if (remaining.length) {
|
|
49
|
+
chunks.push(remaining);
|
|
50
|
+
}
|
|
51
|
+
return chunks;
|
|
52
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown Intermediate Representation (IR) parser.
|
|
3
|
+
* Markdown IR parser — standalone with no external deps
|
|
4
|
+
* beyond markdown-it.
|
|
5
|
+
*/
|
|
6
|
+
/** How to render tables: off = ignore, bullets = key/value list, code = ASCII table. */
|
|
7
|
+
export type MarkdownTableMode = "off" | "bullets" | "code";
|
|
8
|
+
export type MarkdownStyle = "bold" | "italic" | "strikethrough" | "code" | "code_block" | "spoiler";
|
|
9
|
+
export type MarkdownStyleSpan = {
|
|
10
|
+
start: number;
|
|
11
|
+
end: number;
|
|
12
|
+
style: MarkdownStyle;
|
|
13
|
+
};
|
|
14
|
+
export type MarkdownLinkSpan = {
|
|
15
|
+
start: number;
|
|
16
|
+
end: number;
|
|
17
|
+
href: string;
|
|
18
|
+
};
|
|
19
|
+
export type MarkdownIR = {
|
|
20
|
+
text: string;
|
|
21
|
+
styles: MarkdownStyleSpan[];
|
|
22
|
+
links: MarkdownLinkSpan[];
|
|
23
|
+
};
|
|
24
|
+
export type MarkdownParseOptions = {
|
|
25
|
+
linkify?: boolean;
|
|
26
|
+
enableSpoilers?: boolean;
|
|
27
|
+
headingStyle?: "none" | "bold";
|
|
28
|
+
blockquotePrefix?: string;
|
|
29
|
+
autolink?: boolean;
|
|
30
|
+
tableMode?: MarkdownTableMode;
|
|
31
|
+
};
|
|
32
|
+
export declare function markdownToIR(markdown: string, options?: MarkdownParseOptions): MarkdownIR;
|
|
33
|
+
export declare function markdownToIRWithMeta(markdown: string, options?: MarkdownParseOptions): {
|
|
34
|
+
ir: MarkdownIR;
|
|
35
|
+
hasTables: boolean;
|
|
36
|
+
};
|
|
37
|
+
export declare function chunkMarkdownIR(ir: MarkdownIR, limit: number): MarkdownIR[];
|