refactor(shared): hide parser helper internals · openclaw/openclaw@d192308
vincentkoc
·
2026-06-17
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -30,15 +30,15 @@ const AVATAR_MIME_BY_EXT: Record<string, string> = {
|
30 | 30 | }; |
31 | 31 | |
32 | 32 | /** Detects data URLs before image-specific avatar validation. */ |
33 | | -export const AVATAR_DATA_RE = /^data:/i; |
| 33 | +const AVATAR_DATA_RE = /^data:/i; |
34 | 34 | /** Detects inline image data URLs that can be used as avatar sources. */ |
35 | | -export const AVATAR_IMAGE_DATA_RE = /^data:image\//i; |
| 35 | +const AVATAR_IMAGE_DATA_RE = /^data:image\//i; |
36 | 36 | /** Detects remote avatar URLs served over HTTP(S). */ |
37 | | -export const AVATAR_HTTP_RE = /^https?:\/\//i; |
| 37 | +const AVATAR_HTTP_RE = /^https?:\/\//i; |
38 | 38 | /** Detects URI schemes so non-path avatar values can be rejected or routed. */ |
39 | | -export const AVATAR_SCHEME_RE = /^[a-z][a-z0-9+.-]*:/i; |
| 39 | +const AVATAR_SCHEME_RE = /^[a-z][a-z0-9+.-]*:/i; |
40 | 40 | /** Detects Windows absolute paths before URI-scheme classification. */ |
41 | | -export const WINDOWS_ABS_RE = /^[a-zA-Z]:[\\/]/; |
| 41 | +const WINDOWS_ABS_RE = /^[a-zA-Z]:[\\/]/; |
42 | 42 | |
43 | 43 | const AVATAR_PATH_EXT_RE = /\.(png|jpe?g|gif|webp|svg|ico)$/i; |
44 | 44 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | /** JSON opening delimiters supported by the balanced-fragment scanner. */ |
2 | | -export type JsonOpeningDelimiter = "{" | "["; |
| 2 | +type JsonOpeningDelimiter = "{" | "["; |
3 | 3 | |
4 | 4 | /** One balanced JSON object/array fragment found inside arbitrary text. */ |
5 | | -export type BalancedJsonFragment = { |
| 5 | +type BalancedJsonFragment = { |
6 | 6 | json: string; |
7 | 7 | startIndex: number; |
8 | 8 | endIndex: number; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | // Final tag helpers detect final-answer tag regions in assistant text. |
2 | | -export type FinalTagMatch = { |
| 2 | +type FinalTagMatch = { |
3 | 3 | index: number; |
4 | 4 | text: string; |
5 | 5 | isClose: boolean; |
@@ -78,7 +78,7 @@ function parseAttributeList(text: string): boolean {
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** Parses a candidate `<final>` tag while rejecting lookalike names and malformed attributes. */ |
81 | | -export function parseFinalTag(text: string): Omit<FinalTagMatch, "index" | "text"> | null { |
| 81 | +function parseFinalTag(text: string): Omit<FinalTagMatch, "index" | "text"> | null { |
82 | 82 | if (!text.startsWith("<") || !text.endsWith(">")) { |
83 | 83 | return null; |
84 | 84 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2,7 +2,7 @@
|
2 | 2 | import { asOptionalRecord } from "@openclaw/normalization-core/record-coerce"; |
3 | 3 | import { normalizeOptionalString as readTrimmedString } from "@openclaw/normalization-core/string-coerce"; |
4 | 4 | |
5 | | -export type ToolCallShapedTextDetection = { |
| 5 | +type ToolCallShapedTextDetection = { |
6 | 6 | kind: "json_tool_call" | "xml_tool_call" | "bracketed_tool_call" | "react_action"; |
7 | 7 | toolName?: string; |
8 | 8 | }; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。