@deepcitation/deepcitation-js 1.1.49 → 1.1.50
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/README.md +156 -157
- package/lib/{chunk-D2TKEF6D.cjs → chunk-4ILSZKAP.cjs} +3 -2
- package/lib/chunk-4ILSZKAP.cjs.map +1 -0
- package/lib/chunk-5XGN7UAV.js +2 -0
- package/lib/chunk-5XGN7UAV.js.map +1 -0
- package/lib/{chunk-2PRW5PVT.cjs → chunk-ALJ2ZQ2S.cjs} +2 -1
- package/lib/chunk-ALJ2ZQ2S.cjs.map +1 -0
- package/lib/{chunk-F2MMVEVC.cjs → chunk-BYLIBOAU.cjs} +2 -1
- package/lib/chunk-BYLIBOAU.cjs.map +1 -0
- package/lib/{chunk-ND6LFDGK.js → chunk-KBDVUQEE.js} +2 -1
- package/lib/chunk-KBDVUQEE.js.map +1 -0
- package/lib/{chunk-PKXMJNRX.js → chunk-LLLVZOXB.js} +2 -1
- package/lib/chunk-LLLVZOXB.js.map +1 -0
- package/lib/{chunk-DHVODVIA.cjs → chunk-PJWAX2VG.cjs} +2 -1
- package/lib/chunk-PJWAX2VG.cjs.map +1 -0
- package/lib/{chunk-UUR2SQKU.cjs → chunk-QUW3L3UU.cjs} +2 -1
- package/lib/chunk-QUW3L3UU.cjs.map +1 -0
- package/lib/chunk-R57DQBOT.js +2 -0
- package/lib/chunk-R57DQBOT.js.map +1 -0
- package/lib/{chunk-3XSZLKJW.js → chunk-TDGYSF3B.js} +3 -2
- package/lib/chunk-TDGYSF3B.js.map +1 -0
- package/lib/client/index.cjs +2 -1
- package/lib/client/index.cjs.map +1 -0
- package/lib/client/index.js +2 -1
- package/lib/client/index.js.map +1 -0
- package/lib/index.cjs +2 -1
- package/lib/index.cjs.map +1 -0
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -0
- package/lib/prompts/index.cjs +2 -1
- package/lib/prompts/index.cjs.map +1 -0
- package/lib/prompts/index.js +2 -1
- package/lib/prompts/index.js.map +1 -0
- package/lib/react/index.cjs +4 -3
- package/lib/react/index.cjs.map +1 -0
- package/lib/react/index.js +3 -2
- package/lib/react/index.js.map +1 -0
- package/lib/types/index.cjs +2 -1
- package/lib/types/index.cjs.map +1 -0
- package/lib/types/index.js +2 -1
- package/lib/types/index.js.map +1 -0
- package/package.json +161 -152
- package/src/tailwind.css +5 -5
- package/lib/chunk-HRCAI3NV.js +0 -1
- package/lib/chunk-O2XFH626.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/prompts/citationPrompts.ts","../src/prompts/promptCompression.ts"],"names":["CITATION_MARKDOWN_SYNTAX_PROMPT","AV_CITATION_MARKDOWN_SYNTAX_PROMPT","CITATION_REMINDER","CITATION_AV_REMINDER","wrapSystemCitationPrompt","options","systemPrompt","isAudioVideo","citationPrompt","reminder","wrapCitationPrompt","userPrompt","deepTextPromptPortion","enhancedSystemPrompt","enhancedUserPrompt","fileTexts","text","index","CITATION_JSON_OUTPUT_FORMAT","CITATION_AV_BASED_JSON_OUTPUT_FORMAT","MIN_PREFIX_LENGTH","MIN_CHARACTERS_PER_PREFIX_WITH_AT_LEAST_ONE_DIGIT","MIN_CHARACTERS_PER_PREFIX_WITH_NO_DIGITS","buildSafePrefixMap","ids","prompt","map","id","len","prefix","digitCount","letterCount","other","esc","s","prefixCount","fullCount","compressPromptIds","obj","uniqueIds","prefixMap","prefixes","a","b","compressedText","escFull","decompressPromptIds","compressed","entries","shouldParseBack","originalLength","full","escPrefix","idAttributeKeys","keyPattern","quotePattern","re","newLength","diff"],"mappings":"aAAO,IAAMA,CAAAA,CAAkC;AAAA;AAAA;;AAAA;AAAA;;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;AAAA;;AAAA,CAAA,CAoClCC,CAAAA,CAAqC;AAAA;AAAA;;AAAA;;AAAA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AA,CAA0B,MAAM,CAAA,CAC3DyB,CAAAA,CAAaD,CAAAA,CAAgB,IAAA,CAAK,GAAG,CAAA,CACrCE,CAAAA,CAAe,UAAA,CAIfC,CAAAA,CAAK,IAAI,MAAA,CACb,CAAA,CAAA,EAAIF,CAAU,CAAA,YAAA,EAAeC,CAAY,CAAA,EAAGH,CAAS,CAAA,GAAA,CAAA,CACrD,GACF,CAAA,CACApC,CAAAA,CAAOA,EAAK,OAAA,CAAQwC,CAAAA,CAAI,CAAA,MAAA,EAASL,CAAI,CAAA,EAAA,CAAI,EAC3C,CACA,IAAMM,CAAAA,CAAYzC,CAAAA,EAAM,MAAA,CAElB0C,CAAAA,CAAOR,CAAAA,CAAiBO,CAAAA,CAC9B,GAAIC,CAAAA,CAAO,EACT,MAAM,IAAI,KAAA,CACR,CAAA,6BAAA,EAAgCA,CAAI,CAAA,gBAAA,EAAmBR,CAAc,CAAA,WAAA,EAAcO,CAAS,CAAA,CAC9F,CAAA,CAGF,OAAOR,CAAAA,CAAmB,IAAA,CAAK,KAAA,CAAMjC,CAAI,EAAUA,CACrD","file":"chunk-PJWAX2VG.cjs","sourcesContent":["export const CITATION_MARKDOWN_SYNTAX_PROMPT = `\n<citation-instructions priority=\"critical\">\n## REQUIRED: Citation Format\n\n### Scope (Where to use)\nFor every claim, value, or fact in your chat response; you MUST cite the attachment using this exact syntax:\n\n<cite attachment_id='ID' reasoning='why this supports the claim' full_phrase='verbatim quote' key_span='1-3 key words' start_page_key='page_number_N_index_I' line_ids='X-Y' />\n\n### Syntax Rules (MUST follow)\n\n1. **attachment_id**: Use the exact ID from the source document\n2. **reasoning**: Brief explanation of why this citation supports your claim (think first!)\n3. **full_phrase**: Copy text VERBATIM from source. Escape quotes (\\\\') and newlines (\\\\n).\n4. **key_span**: The 1-3 most important words or value from full_phrase\n5. **start_page_key**: ONLY use format \\`page_number_N_index_I\\` from page tags (e.g., \\`<page_number_1_index_0>\\`). Never extract page numbers from document content.\n6. **line_ids**: Inclusive range (e.g., '2-6' or '4'). Infer intermediate lines since only every 5th line is shown.\n\n### Placement Rules\n\n- Place <cite /> inline, typically at the end of a claim\n- One citation per distinct idea, concept, or value (a sentence citing 3 different values needs 3 citations)\n- Do NOT group citations at the end of the document\n- The <cite /> tag is self-closing - never use <cite>...</cite>\n\n### Example Citation 1\n\nThe company reported strong growth<cite attachment_id='abc123' reasoning='directly states revenue growth percentage' full_phrase='Revenue increased 45% year-over-year to $2.3 billion' key_span='increased 45%' start_page_key='page_number_2_index_1' line_ids='12-14' />\n\n### Example Citation 2\n\nThe total amount is $500 USD <cite attachment_id='abc123' reasoning='directly states the total amount' full_phrase='The total amount is $500 USD' key_span='$500 USD' start_page_key='page_number_2_index_1' line_ids='12-14' />\n</citation-instructions>\n\n`;\n\nexport const AV_CITATION_MARKDOWN_SYNTAX_PROMPT = `\n<citation-instructions priority=\"critical\">\n## REQUIRED: Audio/Video Citation Format\n\nFor every claim, value, or fact; you MUST cite the attachment using this exact syntax:\n\n<cite attachment_id='ID' reasoning='why this supports the claim' full_phrase='verbatim transcript quote' key_span='1-3 key words' timestamps='HH:MM:SS.SSS-HH:MM:SS.SSS' />\n\n### Syntax Rules (MUST follow)\n\n1. **attachment_id**: Use the exact ID from the source\n2. **reasoning**: Brief explanation of why this citation supports your claim (think first!)\n3. **full_phrase**: Copy transcript text VERBATIM. Escape quotes (\\\\') and newlines (\\\\n).\n4. **key_span**: The 1-3 most important words or value from full_phrase\n5. **timestamps**: Start and end time with milliseconds (e.g., '00:01:23.456-00:01:45.789')\n\n### Placement Rules\n\n- Place <cite /> inline, typically at the end of a claim\n- One citation per distinct idea, concept, or value (a sentence citing 3 different values needs 3 citations)\n- Do NOT group citations at the end of the document\n- The <cite /> tag is self-closing - never use <cite>...</cite>\n\n</citation-instructions>\n`;\n\n/**\n * A brief reminder to reinforce citation requirements in user messages.\n * Use this when you want to add emphasis without repeating full instructions.\n */\nexport const CITATION_REMINDER = `<citation-reminder>STOP and CHECK: Did you use <cite /> tags with all required attributes for every claim, value, or fact from attachments?</citation-reminder>`;\n\n/**\n * Audio/video version of the citation reminder.\n */\nexport const CITATION_AV_REMINDER = `<citation-reminder>STOP and CHECK: Did you use <cite /> tags with timestamps for every claim, value, or fact from source media?</citation-reminder>`;\n\nexport interface WrapSystemPromptOptions {\n /** The original system prompt to wrap with citation instructions */\n systemPrompt: string;\n /** Whether to use audio/video citation format (with timestamps) instead of text-based (with line IDs) */\n isAudioVideo?: boolean;\n}\n\nexport interface WrapCitationPromptOptions {\n /** The original system prompt to wrap with citation instructions */\n systemPrompt: string;\n /** The original user prompt */\n userPrompt: string;\n /** The extracted file text with metadata (from uploadFile response). Can be a single string or array for multiple files. */\n deepTextPromptPortion?: string | string[];\n /** Whether to use audio/video citation format (with timestamps) instead of text-based (with line IDs) */\n isAudioVideo?: boolean;\n}\n\nexport interface WrapCitationPromptResult {\n /** Enhanced system prompt with citation instructions */\n enhancedSystemPrompt: string;\n /** Enhanced user prompt (currently passed through unchanged) */\n enhancedUserPrompt: string;\n}\n\n/**\n * Wraps your existing system prompt with DeepCitation's citation syntax instructions.\n * This enables LLMs to output verifiable citations that can be checked against attachments.\n *\n * ## Why We Wrap (Instructions at Start + Reminder at End)\n *\n * This function places full citation instructions at the **start** of your system prompt\n * and a brief reminder at the **end**. This \"wrap\" strategy is intentional and based on\n * two key principles:\n *\n * ### 1. Recency Effect (RE2)\n * LLMs exhibit a \"recency bias\" where instructions closer to the end of the context\n * window have stronger influence on output. The reminder at the end reinforces citation\n * requirements right before generation begins.\n *\n * ### 2. Chain-of-Thought (CoT) Attribute Ordering\n * The citation attributes are ordered to encourage the model to \"think first\":\n * `attachment_id` → `reasoning` → `full_phrase` → `key_span` → `start_page_key` → `line_ids`\n *\n * By placing `reasoning` early, the model must articulate WHY it's citing before\n * specifying WHAT it's citing. Then `full_phrase` comes before `key_span` so the model\n * first produces the complete verbatim quote, then extracts the key span from it,\n * ensuring `key_span` is always a valid substring of `full_phrase`.\n *\n * ### Why Not Just Append?\n * In large system prompts, appended instructions can get \"lost\" in the middle of the\n * effective context. Prepending ensures citation instructions have high priority,\n * while the reminder leverages recency for reinforcement.\n *\n * @example\n * ```typescript\n * import { wrapSystemCitationPrompt } from '@deepcitation/deepcitation-js';\n *\n * const systemPrompt = \"You are a helpful assistant that analyzes documents.\";\n * const enhanced = wrapSystemCitationPrompt({ systemPrompt });\n *\n * // Use enhanced prompt with your LLM\n * const response = await openai.chat.completions.create({\n * messages: [{ role: \"system\", content: enhanced }],\n * // ...\n * });\n * ```\n */\nexport function wrapSystemCitationPrompt(\n options: WrapSystemPromptOptions\n): string {\n const { systemPrompt, isAudioVideo = false } = options;\n\n const citationPrompt = isAudioVideo\n ? AV_CITATION_MARKDOWN_SYNTAX_PROMPT\n : CITATION_MARKDOWN_SYNTAX_PROMPT;\n\n const reminder = isAudioVideo ? CITATION_AV_REMINDER : CITATION_REMINDER;\n\n // Full instructions at start (high priority), brief reminder at end (recency effect)\n return `${citationPrompt.trim()}\\n\\n${systemPrompt.trim()}\\n\\n${reminder}`;\n}\n\n/**\n * Wraps both system and user prompts with DeepCitation's citation syntax instructions.\n * This is the recommended way to prepare prompts for citation verification.\n *\n * @example\n * ```typescript\n * import { wrapCitationPrompt } from '@deepcitation/deepcitation-js';\n *\n * // Single file\n * const { enhancedSystemPrompt, enhancedUserPrompt } = wrapCitationPrompt({\n * systemPrompt: \"You are a helpful assistant.\",\n * userPrompt: \"Analyze this document and summarize it.\",\n * deepTextPromptPortion, // from uploadFile response\n * });\n *\n * // Multiple files\n * const { enhancedSystemPrompt, enhancedUserPrompt } = wrapCitationPrompt({\n * systemPrompt: \"You are a helpful assistant.\",\n * userPrompt: \"Compare these documents.\",\n * deepTextPromptPortion: [deepTextPromptPortion1, deepTextPromptPortion2], // array of file texts\n * });\n *\n * // Use enhanced prompts with your LLM\n * const response = await llm.chat({\n * messages: [\n * { role: \"system\", content: enhancedSystemPrompt },\n * { role: \"user\", content: enhancedUserPrompt },\n * ],\n * });\n * ```\n */\nexport function wrapCitationPrompt(\n options: WrapCitationPromptOptions\n): WrapCitationPromptResult {\n const {\n systemPrompt,\n userPrompt,\n deepTextPromptPortion,\n isAudioVideo = false,\n } = options;\n\n const enhancedSystemPrompt = wrapSystemCitationPrompt({\n systemPrompt,\n isAudioVideo,\n });\n\n // Build enhanced user prompt with file content if provided\n let enhancedUserPrompt = userPrompt;\n\n if (deepTextPromptPortion) {\n const fileTexts = Array.isArray(deepTextPromptPortion)\n ? deepTextPromptPortion\n : [deepTextPromptPortion];\n const fileContent = fileTexts\n .map((text, index) => {\n if (fileTexts.length === 1) {\n return `\\n${text}`;\n }\n return `\\n${text}`;\n })\n .join(\"\\n\\n\");\n\n enhancedUserPrompt = `${fileContent}\\n\\n${CITATION_REMINDER}\\n\\n${userPrompt}`;\n }\n\n\n\n return {\n enhancedSystemPrompt,\n enhancedUserPrompt,\n };\n}\n\nexport const CITATION_JSON_OUTPUT_FORMAT = {\n type: \"object\",\n properties: {\n attachmentId: { type: \"string\" },\n reasoning: {\n type: \"string\",\n description:\n \"The logic connecting the form section requirements to the supporting source citation (think first!)\",\n },\n fullPhrase: {\n type: \"string\",\n description:\n \"The verbatim text of the terse phrase inside <attachment_text /> to support the citation (if there is a detected OCR correction, use the corrected text)\",\n },\n keySpan: {\n type: \"string\",\n description:\n \"The verbatim 1-3 words within fullPhrase that best support the citation\",\n },\n startPageKey: {\n type: \"string\",\n description:\n 'Only return a result like \"page_number_PAGE_index_INDEX\" from the provided page keys (e.g. <page_number_1_index_0>) and never from the contents inside the page.',\n },\n lineIds: {\n type: \"array\",\n items: { type: \"number\" },\n description:\n \"Infer lineIds, as we only provide the first, last, and every 5th line. Provide inclusive lineIds for the fullPhrase.\",\n },\n },\n required: [\n \"attachmentId\",\n \"reasoning\",\n \"fullPhrase\",\n \"keySpan\",\n \"startPageKey\",\n \"lineIds\",\n ],\n};\n\nexport const CITATION_AV_BASED_JSON_OUTPUT_FORMAT = {\n type: \"object\",\n properties: {\n attachmentId: { type: \"string\" },\n startPageKey: {\n type: \"string\",\n description:\n 'Only return a result like \"page_number_PAGE_index_INDEX\" from the provided page keys (e.g. <page_number_1_index_0>) and never from the contents inside the page.',\n },\n fullPhrase: {\n type: \"string\",\n description:\n \"The exact verbatim text of the phrase or paragraph from the source document to support the citation (if there is a detected OCR correction, use the verbatim corrected text)\",\n },\n keySpan: {\n type: \"string\",\n description:\n \"The verbatim 1-3 words within fullPhrase that best support the citation\",\n },\n timestamps: {\n type: \"object\",\n properties: {\n startTime: { type: \"string\" },\n endTime: { type: \"string\" },\n },\n required: [\"startTime\", \"endTime\"],\n description:\n \"The timestamp of the audio or video frame including milliseconds formatted as: HH:MM:SS.SSS\",\n },\n },\n required: [\"attachmentId\", \"startPageKey\", \"fullPhrase\", \"keySpan\", \"timestamps\"],\n};\n","import { CompressedResult } from \"./types.js\";\n\nconst MIN_PREFIX_LENGTH = 4;\nconst MIN_CHARACTERS_PER_PREFIX_WITH_AT_LEAST_ONE_DIGIT = 3;\nconst MIN_CHARACTERS_PER_PREFIX_WITH_NO_DIGITS = 5;\n\n/**\n * Build a map from each ID's minimal unique prefix to the full ID,\n * such that the prefix only ever appears in the prompt where the full ID appears.\n */\nfunction buildSafePrefixMap(\n ids: string[],\n prompt: string\n): Record<string, string> {\n const map: Record<string, string> = {};\n\n for (const id of ids) {\n for (let len = MIN_PREFIX_LENGTH; len <= id.length; len++) {\n const prefix = id.slice(0, len);\n\n // Check minimum requirements\n const digitCount = (prefix.match(/\\d/g) || []).length;\n const letterCount = (prefix.match(/[a-zA-Z]/g) || []).length;\n\n if (\n prefix.length < MIN_PREFIX_LENGTH ||\n (digitCount > 0 &&\n letterCount < MIN_CHARACTERS_PER_PREFIX_WITH_AT_LEAST_ONE_DIGIT) ||\n (digitCount === 0 &&\n letterCount < MIN_CHARACTERS_PER_PREFIX_WITH_NO_DIGITS)\n ) {\n continue;\n }\n\n // 1) Unique among IDs\n if (ids.some((other) => other !== id && other.startsWith(prefix))) {\n continue;\n }\n\n // 2) Only appears in prompt as part of the full ID\n const esc = (s: string) => s.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n const prefixCount = (prompt.match(new RegExp(esc(prefix), \"g\")) || [])\n .length;\n const fullCount = (prompt.match(new RegExp(esc(id), \"g\")) || []).length;\n if (prefixCount !== fullCount) {\n continue;\n }\n\n map[prefix] = id;\n break;\n }\n\n if (!Object.values(map).includes(id)) {\n throw new Error(\n `Cannot find a safe unique prefix for ID \"${id}\" that meets the minimum requirements (length: ${MIN_PREFIX_LENGTH})`\n );\n }\n }\n\n return map;\n}\n\n/**\n * Compress all occurrences of `ids` inside `obj`, returning a new object\n * plus the `prefixMap` needed to decompress.\n */\nexport function compressPromptIds<T>(\n obj: T,\n ids: string[] | undefined\n): CompressedResult<T> {\n if (!ids || ids.length === 0) {\n return { compressed: obj, prefixMap: {} };\n }\n\n const uniqueIds = Array.from(new Set(ids));\n const text = JSON.stringify(obj);\n const prefixMap = buildSafePrefixMap(uniqueIds, text);\n\n // Sort prefixes by descending length to avoid partial matches\n const prefixes = Object.keys(prefixMap).sort((a, b) => b.length - a.length);\n\n let compressedText = text;\n for (const prefix of prefixes) {\n const full = prefixMap[prefix];\n const escFull = full.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n compressedText = compressedText.replace(new RegExp(escFull, \"g\"), prefix);\n }\n\n return {\n compressed: JSON.parse(compressedText) as T,\n prefixMap,\n };\n}\n\n/**\n * Decompress all minimal prefixes back into their full IDs,\n * using the `prefixMap` returned from `compressPromptIds`.\n *\n * If you pass in a string, it will return a string.\n * If you pass in an object, it will JSON‑serialize and parse it back.\n */\nexport function decompressPromptIds<T>(\n compressed: T | string,\n prefixMap: Record<string, string>\n): T | string {\n if (!prefixMap || Object.keys(prefixMap).length === 0) {\n return compressed;\n }\n\n // Prepare sorted [prefix, full] entries (longest prefix first)\n const entries = Object.entries(prefixMap).sort(\n (a, b) => b[0].length - a[0].length\n );\n\n // Decide whether we're working on a string or an object\n let text: string;\n let shouldParseBack = false;\n\n if (typeof compressed === \"string\") {\n text = compressed;\n } else {\n text = JSON.stringify(compressed);\n shouldParseBack = true;\n }\n\n const originalLength = text?.length;\n\n // Perform all prefix → full-ID replacements\n for (const [prefix, full] of entries) {\n const escPrefix = prefix.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n text = text.replace(new RegExp(escPrefix, \"g\"), full);\n }\n\n // Handle cases where the LLM may output ID in a different attribute format\n // We look for common ID attribute patterns and replace compressed prefixes within them\n // Note: fileId variants are supported for backwards compatibility with legacy citations\n const idAttributeKeys = [\n \"attachmentId\",\n \"attachment_id\",\n \"attachment_ID\",\n \"attachmentID\",\n \"fileId\",\n \"file_id\",\n \"file_ID\",\n \"fileID\",\n \"fileid\",\n ];\n\n // For each prefix, look for it within ID attribute values and replace with full ID\n for (const [prefix, full] of entries) {\n const escPrefix = prefix.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n const keyPattern = idAttributeKeys.join(\"|\");\n const quotePattern = \"([\\\"'`])\";\n\n // Match: attributeName = 'prefix' or attributeName=\"prefix\" etc.\n // Only replace the prefix part, preserving the attribute name and quotes\n const re = new RegExp(\n `(${keyPattern})(\\\\s*=\\\\s*)${quotePattern}${escPrefix}\\\\3`,\n \"g\"\n );\n text = text.replace(re, `$1$2$3${full}$3`);\n }\n const newLength = text?.length;\n\n const diff = originalLength - newLength;\n if (diff > 0) {\n throw new Error(\n `[decompressedPromptIds] diff ${diff} originalLength ${originalLength} newLength ${newLength}`\n );\n }\n\n return shouldParseBack ? (JSON.parse(text) as T) : text;\n}\n"]}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
'use strict';var t="avif";var e=-1,n=-2,r={attachmentId:null,verifiedPageNumber:e,verifiedMatchSnippet:null,citation:{pageNumber:e},status:"not_found"};exports.a=t;exports.b=e;exports.c=n;exports.d=r
|
|
1
|
+
'use strict';var t="avif";var e=-1,n=-2,r={attachmentId:null,verifiedPageNumber:e,verifiedMatchSnippet:null,citation:{pageNumber:e},status:"not_found"};exports.a=t;exports.b=e;exports.c=n;exports.d=r;//# sourceMappingURL=chunk-QUW3L3UU.cjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-QUW3L3UU.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/citation.ts","../src/types/verification.ts"],"names":["DEFAULT_OUTPUT_IMAGE_FORMAT","NOT_FOUND_VERIFICATION_INDEX","PENDING_VERIFICATION_INDEX","BLANK_VERIFICATION"],"mappings":"aAKO,IAAMA,CAAAA,CAA8B,OCApC,IAAMC,CAAAA,CAA+B,GAC/BC,CAAAA,CAA6B,EAAA,CAE7BC,EAAmC,CAC9C,YAAA,CAAc,KACd,kBAAA,CAAoBF,CAAAA,CACpB,qBAAsB,IAAA,CACtB,QAAA,CAAU,CACR,UAAA,CAAYA,CACd,CAAA,CACA,MAAA,CAAQ,WACV","file":"chunk-QUW3L3UU.cjs","sourcesContent":["import { type ScreenBox } from \"./boxes.js\";\nimport { type Verification } from \"./verification.js\";\n\nexport type OutputImageFormat = \"jpeg\" | \"png\" | \"avif\" | undefined | null;\n\nexport const DEFAULT_OUTPUT_IMAGE_FORMAT = \"avif\" as const;\nexport interface VerifyCitationResponse {\n verifications: { [key: string]: Verification };\n}\n\nexport interface VerifyCitationRequest {\n attachmentId: string;\n citations: { [key: string]: Citation };\n outputImageFormat?: OutputImageFormat;\n apiKey?: string; // Optional API key for authentication\n}\n\n/**\n * Citation type discriminator.\n * - `\"document\"`: PDF or uploaded document citation (uses attachmentId, pageNumber, lineIds)\n * - `\"url\"`: URL/web citation (uses url, domain, title, etc.)\n */\nexport type CitationType = \"document\" | \"url\";\n\n/**\n * Source/platform type for categorization and display.\n * Used for icon selection and grouping in sources lists.\n */\nexport type SourceType =\n | \"web\" // Generic web page\n | \"pdf\" // PDF document\n | \"document\" // Uploaded document\n | \"social\" // Social media (X/Twitter, Facebook, etc.)\n | \"video\" // Video platforms (YouTube, Twitch, etc.)\n | \"news\" // News articles\n | \"academic\" // Academic papers/journals\n | \"code\" // Code repositories (GitHub, etc.)\n | \"forum\" // Forums/discussion boards (Reddit, etc.)\n | \"commerce\" // E-commerce sites\n | \"reference\" // Reference sites (Wikipedia, etc.)\n | \"unknown\"; // Unknown/other\n\n/**\n * Unified citation interface for both document and URL-based citations.\n *\n * Use `type` to discriminate:\n * - `type: \"document\"` - Uses attachmentId, pageNumber, lineIds for document citations\n * - `type: \"url\"` - Uses url, domain, title, etc. for web citations\n *\n * Common fields (used by both types):\n * - `fullPhrase`: The full context/excerpt containing the cited information\n * - `keySpan`: The specific key phrase being cited (must be substring of fullPhrase)\n * - `citationNumber`: Citation number for display (e.g., [1], [2])\n *\n * @example Document citation\n * ```typescript\n * const docCitation: Citation = {\n * type: \"document\",\n * attachmentId: \"abc123\",\n * pageNumber: 5,\n * lineIds: [12, 13],\n * fullPhrase: \"Revenue increased by 15% in Q4.\",\n * keySpan: \"increased by 15%\",\n * citationNumber: 1,\n * };\n * ```\n *\n * @example URL citation\n * ```typescript\n * const urlCitation: Citation = {\n * type: \"url\",\n * url: \"https://example.com/article\",\n * domain: \"example.com\",\n * title: \"Q4 Financial Report\",\n * fullPhrase: \"The TGU transitions require control, not brute strength.\",\n * keySpan: \"require control, not brute strength\",\n * citationNumber: 1,\n * };\n * ```\n */\nexport interface Citation {\n /**\n * Citation type discriminator.\n * - `\"document\"`: PDF/uploaded document (default if not specified)\n * - `\"url\"`: Web URL citation\n */\n type?: CitationType;\n\n // ==========================================================================\n // Common fields (used by both document and URL citations)\n // ==========================================================================\n\n /** The full context/excerpt containing the cited information */\n fullPhrase?: string | null;\n\n /** The specific key phrase being cited (should be substring of fullPhrase) */\n keySpan?: string | null;\n\n /** Citation number for display (e.g., [1], [2], [3]) */\n citationNumber?: number;\n\n /** Reasoning for why this citation was included */\n reasoning?: string | null;\n\n /** Text that appears before the citation marker */\n beforeCite?: string;\n\n // ==========================================================================\n // Document citation fields (type: \"document\")\n // ==========================================================================\n\n /** Attachment ID for document citations */\n attachmentId?: string;\n\n /** Page number in the document */\n pageNumber?: number | null;\n\n /** Line IDs within the page */\n lineIds?: number[] | null;\n\n /** Start page key for multi-page citations */\n startPageKey?: string | null;\n\n /** Selection box coordinates in the document */\n selection?: ScreenBox | null;\n\n // ==========================================================================\n // URL citation fields (type: \"url\")\n // ==========================================================================\n\n /** The source URL */\n url?: string;\n\n /** Display domain (e.g., \"example.com\", \"fitandwell.com\") */\n domain?: string;\n\n /** Page/article title */\n title?: string;\n\n /** Brief description or snippet from the page */\n description?: string;\n\n /** Favicon URL for the source */\n faviconUrl?: string;\n\n /** Platform/source type for categorization (e.g., \"video\", \"news\", \"social\") */\n sourceType?: SourceType;\n\n /** Platform name (e.g., \"Twitch\", \"YouTube\", \"Reddit\") */\n platform?: string;\n\n /** Site name (e.g., \"Fit&Well\", \"Garage Gym Reviews\") */\n siteName?: string;\n\n /** Author name if available */\n author?: string;\n\n /** Publication date */\n publishedAt?: Date | string;\n\n /** Open Graph or social media image URL */\n imageUrl?: string;\n\n /** When the source was accessed/verified */\n accessedAt?: Date | string;\n\n // ==========================================================================\n // Audio/Video citation fields (can be used with both types)\n // ==========================================================================\n\n /** Timestamps for audio/video citations */\n timestamps?: {\n startTime?: string;\n endTime?: string;\n };\n}\n\nexport interface CitationStatus {\n isVerified: boolean;\n isMiss: boolean;\n isPartialMatch: boolean;\n isPending: boolean;\n}\n\n/**\n * Metadata for a source in an aggregated sources list.\n * Used by SourcesListComponent to display collected citations.\n */\nexport interface SourceMeta {\n /** Unique identifier for this source */\n id: string;\n /** The source URL */\n url: string;\n /** Page/document title */\n title: string;\n /** Display domain without www prefix */\n domain: string;\n /** Platform/source type */\n sourceType?: SourceType;\n /** Favicon URL */\n faviconUrl?: string;\n /** Citation numbers that reference this source */\n citationNumbers?: number[];\n /** Number of times this source is cited */\n citationCount?: number;\n /** Relevant excerpts/quotes from this source */\n excerpts?: string[];\n /** Verification status if verified */\n verificationStatus?: \"verified\" | \"partial\" | \"pending\" | \"failed\" | \"unknown\";\n /** When the source was accessed */\n accessedAt?: Date | string;\n}\n","import { sha1Hash } from \"../utils/sha.js\";\nimport { type Citation } from \"./citation.js\";\nimport { type SearchStatus, type SearchAttempt } from \"./search.js\";\nimport { type DeepTextItem } from \"./boxes.js\";\n\nexport const NOT_FOUND_VERIFICATION_INDEX = -1;\nexport const PENDING_VERIFICATION_INDEX = -2;\n\nexport const BLANK_VERIFICATION: Verification = {\n attachmentId: null,\n verifiedPageNumber: NOT_FOUND_VERIFICATION_INDEX,\n verifiedMatchSnippet: null,\n citation: {\n pageNumber: NOT_FOUND_VERIFICATION_INDEX,\n },\n status: \"not_found\",\n};\n\n/**\n * Content match status for URL/web content verification.\n * Used when verifying that a URL contains what the AI claimed.\n */\nexport type ContentMatchStatus =\n | \"exact\" // Content exactly matches AI's claim\n | \"partial\" // Content partially matches (paraphrase, summary)\n | \"mismatch\" // URL exists but content doesn't match claim\n | \"not_found\" // Claimed content not found on page\n | \"not_checked\" // Content not yet verified (URL inaccessible or pending)\n | \"inconclusive\"; // Could not determine match (e.g., dynamic content)\n\n/**\n * URL access status for web content verification.\n */\nexport type UrlAccessStatus =\n | \"accessible\" // URL returned 200 OK\n | \"redirected\" // URL redirected to different domain\n | \"redirected_same_domain\" // URL redirected within same domain\n | \"not_found\" // 404 error\n | \"forbidden\" // 403 error\n | \"server_error\" // 5xx error\n | \"timeout\" // Request timed out\n | \"blocked\" // Blocked by paywall/login/antibot\n | \"network_error\" // DNS/connection error\n | \"pending\" // Not yet checked\n | \"unknown\"; // Unknown status\n\nexport interface Verification {\n attachmentId?: string | null;\n\n label?: string | null; //e.g. \"Invoice\"\n\n citation?: Citation;\n\n // Search status\n status?: SearchStatus | null;\n\n // Search attempts\n searchAttempts?: SearchAttempt[];\n\n highlightColor?: string | null;\n\n // Verified results (actual values found - expected values are in citation)\n verifiedPageNumber?: number | null;\n\n verifiedLineIds?: number[] | null;\n\n verifiedTimestamps?: { startTime?: string; endTime?: string } | null;\n\n verifiedFullPhrase?: string | null;\n\n verifiedKeySpan?: string | null;\n\n verifiedMatchSnippet?: string | null;\n\n hitIndexWithinPage?: number | null;\n\n phraseMatchDeepItem?: DeepTextItem;\n\n keySpanMatchDeepItem?: DeepTextItem;\n\n verificationImageBase64?: string | null;\n\n verifiedAt?: Date;\n\n // ==========================================================================\n // URL/Web Content Verification Fields\n // Used when verifying AI-generated URL claims (e.g., \"According to example.com...\")\n // ==========================================================================\n\n /** The URL that was verified (from Citation.url when type: \"url\") */\n verifiedUrl?: string | null;\n\n /** The actual URL after following redirects */\n resolvedUrl?: string | null;\n\n /** HTTP status code returned */\n httpStatus?: number | null;\n\n /** URL accessibility status */\n urlAccessStatus?: UrlAccessStatus | null;\n\n /** Whether the page content matches what the AI claimed */\n contentMatchStatus?: ContentMatchStatus | null;\n\n /** Similarity score between expected and actual content (0-1) */\n contentSimilarity?: number | null;\n\n /** The page title found at the URL */\n verifiedTitle?: string | null;\n\n /** Snippet of actual content found on the page */\n actualContentSnippet?: string | null;\n\n /** Screenshot of the web page as verification proof */\n webPageScreenshotBase64?: string | null;\n\n /** When the URL was crawled/fetched */\n crawledAt?: Date | string | null;\n\n /** Error message if URL verification failed */\n urlVerificationError?: string | null;\n\n // ==========================================================================\n // Verified URL metadata (fetched from the actual page)\n // ==========================================================================\n\n /** Verified domain from the URL */\n verifiedDomain?: string | null;\n\n /** Verified description/meta description from the page */\n verifiedDescription?: string | null;\n\n /** Verified favicon URL */\n verifiedFaviconUrl?: string | null;\n\n /** Verified site name (from og:site_name or similar) */\n verifiedSiteName?: string | null;\n\n /** Verified author (from meta tags) */\n verifiedAuthor?: string | null;\n\n /** Verified publication date */\n verifiedPublishedAt?: Date | string | null;\n\n /** Verified OG image URL */\n verifiedImageUrl?: string | null;\n\n /** Content type of the fetched URL (e.g., \"text/html\", \"application/pdf\") */\n contentType?: string | null;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/citation.ts","../src/types/verification.ts"],"names":["DEFAULT_OUTPUT_IMAGE_FORMAT","NOT_FOUND_VERIFICATION_INDEX","PENDING_VERIFICATION_INDEX","BLANK_VERIFICATION"],"mappings":"AAKO,IAAMA,CAAAA,CAA8B,OCApC,IAAMC,CAAAA,CAA+B,GAC/BC,CAAAA,CAA6B,EAAA,CAE7BC,EAAmC,CAC9C,YAAA,CAAc,KACd,kBAAA,CAAoBF,CAAAA,CACpB,qBAAsB,IAAA,CACtB,QAAA,CAAU,CACR,UAAA,CAAYA,CACd,CAAA,CACA,MAAA,CAAQ,WACV","file":"chunk-R57DQBOT.js","sourcesContent":["import { type ScreenBox } from \"./boxes.js\";\nimport { type Verification } from \"./verification.js\";\n\nexport type OutputImageFormat = \"jpeg\" | \"png\" | \"avif\" | undefined | null;\n\nexport const DEFAULT_OUTPUT_IMAGE_FORMAT = \"avif\" as const;\nexport interface VerifyCitationResponse {\n verifications: { [key: string]: Verification };\n}\n\nexport interface VerifyCitationRequest {\n attachmentId: string;\n citations: { [key: string]: Citation };\n outputImageFormat?: OutputImageFormat;\n apiKey?: string; // Optional API key for authentication\n}\n\n/**\n * Citation type discriminator.\n * - `\"document\"`: PDF or uploaded document citation (uses attachmentId, pageNumber, lineIds)\n * - `\"url\"`: URL/web citation (uses url, domain, title, etc.)\n */\nexport type CitationType = \"document\" | \"url\";\n\n/**\n * Source/platform type for categorization and display.\n * Used for icon selection and grouping in sources lists.\n */\nexport type SourceType =\n | \"web\" // Generic web page\n | \"pdf\" // PDF document\n | \"document\" // Uploaded document\n | \"social\" // Social media (X/Twitter, Facebook, etc.)\n | \"video\" // Video platforms (YouTube, Twitch, etc.)\n | \"news\" // News articles\n | \"academic\" // Academic papers/journals\n | \"code\" // Code repositories (GitHub, etc.)\n | \"forum\" // Forums/discussion boards (Reddit, etc.)\n | \"commerce\" // E-commerce sites\n | \"reference\" // Reference sites (Wikipedia, etc.)\n | \"unknown\"; // Unknown/other\n\n/**\n * Unified citation interface for both document and URL-based citations.\n *\n * Use `type` to discriminate:\n * - `type: \"document\"` - Uses attachmentId, pageNumber, lineIds for document citations\n * - `type: \"url\"` - Uses url, domain, title, etc. for web citations\n *\n * Common fields (used by both types):\n * - `fullPhrase`: The full context/excerpt containing the cited information\n * - `keySpan`: The specific key phrase being cited (must be substring of fullPhrase)\n * - `citationNumber`: Citation number for display (e.g., [1], [2])\n *\n * @example Document citation\n * ```typescript\n * const docCitation: Citation = {\n * type: \"document\",\n * attachmentId: \"abc123\",\n * pageNumber: 5,\n * lineIds: [12, 13],\n * fullPhrase: \"Revenue increased by 15% in Q4.\",\n * keySpan: \"increased by 15%\",\n * citationNumber: 1,\n * };\n * ```\n *\n * @example URL citation\n * ```typescript\n * const urlCitation: Citation = {\n * type: \"url\",\n * url: \"https://example.com/article\",\n * domain: \"example.com\",\n * title: \"Q4 Financial Report\",\n * fullPhrase: \"The TGU transitions require control, not brute strength.\",\n * keySpan: \"require control, not brute strength\",\n * citationNumber: 1,\n * };\n * ```\n */\nexport interface Citation {\n /**\n * Citation type discriminator.\n * - `\"document\"`: PDF/uploaded document (default if not specified)\n * - `\"url\"`: Web URL citation\n */\n type?: CitationType;\n\n // ==========================================================================\n // Common fields (used by both document and URL citations)\n // ==========================================================================\n\n /** The full context/excerpt containing the cited information */\n fullPhrase?: string | null;\n\n /** The specific key phrase being cited (should be substring of fullPhrase) */\n keySpan?: string | null;\n\n /** Citation number for display (e.g., [1], [2], [3]) */\n citationNumber?: number;\n\n /** Reasoning for why this citation was included */\n reasoning?: string | null;\n\n /** Text that appears before the citation marker */\n beforeCite?: string;\n\n // ==========================================================================\n // Document citation fields (type: \"document\")\n // ==========================================================================\n\n /** Attachment ID for document citations */\n attachmentId?: string;\n\n /** Page number in the document */\n pageNumber?: number | null;\n\n /** Line IDs within the page */\n lineIds?: number[] | null;\n\n /** Start page key for multi-page citations */\n startPageKey?: string | null;\n\n /** Selection box coordinates in the document */\n selection?: ScreenBox | null;\n\n // ==========================================================================\n // URL citation fields (type: \"url\")\n // ==========================================================================\n\n /** The source URL */\n url?: string;\n\n /** Display domain (e.g., \"example.com\", \"fitandwell.com\") */\n domain?: string;\n\n /** Page/article title */\n title?: string;\n\n /** Brief description or snippet from the page */\n description?: string;\n\n /** Favicon URL for the source */\n faviconUrl?: string;\n\n /** Platform/source type for categorization (e.g., \"video\", \"news\", \"social\") */\n sourceType?: SourceType;\n\n /** Platform name (e.g., \"Twitch\", \"YouTube\", \"Reddit\") */\n platform?: string;\n\n /** Site name (e.g., \"Fit&Well\", \"Garage Gym Reviews\") */\n siteName?: string;\n\n /** Author name if available */\n author?: string;\n\n /** Publication date */\n publishedAt?: Date | string;\n\n /** Open Graph or social media image URL */\n imageUrl?: string;\n\n /** When the source was accessed/verified */\n accessedAt?: Date | string;\n\n // ==========================================================================\n // Audio/Video citation fields (can be used with both types)\n // ==========================================================================\n\n /** Timestamps for audio/video citations */\n timestamps?: {\n startTime?: string;\n endTime?: string;\n };\n}\n\nexport interface CitationStatus {\n isVerified: boolean;\n isMiss: boolean;\n isPartialMatch: boolean;\n isPending: boolean;\n}\n\n/**\n * Metadata for a source in an aggregated sources list.\n * Used by SourcesListComponent to display collected citations.\n */\nexport interface SourceMeta {\n /** Unique identifier for this source */\n id: string;\n /** The source URL */\n url: string;\n /** Page/document title */\n title: string;\n /** Display domain without www prefix */\n domain: string;\n /** Platform/source type */\n sourceType?: SourceType;\n /** Favicon URL */\n faviconUrl?: string;\n /** Citation numbers that reference this source */\n citationNumbers?: number[];\n /** Number of times this source is cited */\n citationCount?: number;\n /** Relevant excerpts/quotes from this source */\n excerpts?: string[];\n /** Verification status if verified */\n verificationStatus?: \"verified\" | \"partial\" | \"pending\" | \"failed\" | \"unknown\";\n /** When the source was accessed */\n accessedAt?: Date | string;\n}\n","import { sha1Hash } from \"../utils/sha.js\";\nimport { type Citation } from \"./citation.js\";\nimport { type SearchStatus, type SearchAttempt } from \"./search.js\";\nimport { type DeepTextItem } from \"./boxes.js\";\n\nexport const NOT_FOUND_VERIFICATION_INDEX = -1;\nexport const PENDING_VERIFICATION_INDEX = -2;\n\nexport const BLANK_VERIFICATION: Verification = {\n attachmentId: null,\n verifiedPageNumber: NOT_FOUND_VERIFICATION_INDEX,\n verifiedMatchSnippet: null,\n citation: {\n pageNumber: NOT_FOUND_VERIFICATION_INDEX,\n },\n status: \"not_found\",\n};\n\n/**\n * Content match status for URL/web content verification.\n * Used when verifying that a URL contains what the AI claimed.\n */\nexport type ContentMatchStatus =\n | \"exact\" // Content exactly matches AI's claim\n | \"partial\" // Content partially matches (paraphrase, summary)\n | \"mismatch\" // URL exists but content doesn't match claim\n | \"not_found\" // Claimed content not found on page\n | \"not_checked\" // Content not yet verified (URL inaccessible or pending)\n | \"inconclusive\"; // Could not determine match (e.g., dynamic content)\n\n/**\n * URL access status for web content verification.\n */\nexport type UrlAccessStatus =\n | \"accessible\" // URL returned 200 OK\n | \"redirected\" // URL redirected to different domain\n | \"redirected_same_domain\" // URL redirected within same domain\n | \"not_found\" // 404 error\n | \"forbidden\" // 403 error\n | \"server_error\" // 5xx error\n | \"timeout\" // Request timed out\n | \"blocked\" // Blocked by paywall/login/antibot\n | \"network_error\" // DNS/connection error\n | \"pending\" // Not yet checked\n | \"unknown\"; // Unknown status\n\nexport interface Verification {\n attachmentId?: string | null;\n\n label?: string | null; //e.g. \"Invoice\"\n\n citation?: Citation;\n\n // Search status\n status?: SearchStatus | null;\n\n // Search attempts\n searchAttempts?: SearchAttempt[];\n\n highlightColor?: string | null;\n\n // Verified results (actual values found - expected values are in citation)\n verifiedPageNumber?: number | null;\n\n verifiedLineIds?: number[] | null;\n\n verifiedTimestamps?: { startTime?: string; endTime?: string } | null;\n\n verifiedFullPhrase?: string | null;\n\n verifiedKeySpan?: string | null;\n\n verifiedMatchSnippet?: string | null;\n\n hitIndexWithinPage?: number | null;\n\n phraseMatchDeepItem?: DeepTextItem;\n\n keySpanMatchDeepItem?: DeepTextItem;\n\n verificationImageBase64?: string | null;\n\n verifiedAt?: Date;\n\n // ==========================================================================\n // URL/Web Content Verification Fields\n // Used when verifying AI-generated URL claims (e.g., \"According to example.com...\")\n // ==========================================================================\n\n /** The URL that was verified (from Citation.url when type: \"url\") */\n verifiedUrl?: string | null;\n\n /** The actual URL after following redirects */\n resolvedUrl?: string | null;\n\n /** HTTP status code returned */\n httpStatus?: number | null;\n\n /** URL accessibility status */\n urlAccessStatus?: UrlAccessStatus | null;\n\n /** Whether the page content matches what the AI claimed */\n contentMatchStatus?: ContentMatchStatus | null;\n\n /** Similarity score between expected and actual content (0-1) */\n contentSimilarity?: number | null;\n\n /** The page title found at the URL */\n verifiedTitle?: string | null;\n\n /** Snippet of actual content found on the page */\n actualContentSnippet?: string | null;\n\n /** Screenshot of the web page as verification proof */\n webPageScreenshotBase64?: string | null;\n\n /** When the URL was crawled/fetched */\n crawledAt?: Date | string | null;\n\n /** Error message if URL verification failed */\n urlVerificationError?: string | null;\n\n // ==========================================================================\n // Verified URL metadata (fetched from the actual page)\n // ==========================================================================\n\n /** Verified domain from the URL */\n verifiedDomain?: string | null;\n\n /** Verified description/meta description from the page */\n verifiedDescription?: string | null;\n\n /** Verified favicon URL */\n verifiedFaviconUrl?: string | null;\n\n /** Verified site name (from og:site_name or similar) */\n verifiedSiteName?: string | null;\n\n /** Verified author (from meta tags) */\n verifiedAuthor?: string | null;\n\n /** Verified publication date */\n verifiedPublishedAt?: Date | string | null;\n\n /** Verified OG image URL */\n verifiedImageUrl?: string | null;\n\n /** Content type of the fetched URL (e.g., \"text/html\", \"application/pdf\") */\n contentType?: string | null;\n}\n"]}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {d as d$1,v}from'./chunk-
|
|
2
|
-
export{h as a}
|
|
1
|
+
import {d as d$1,v}from'./chunk-LLLVZOXB.js';import {a}from'./chunk-5XGN7UAV.js';var P="https://api.deepcitation.com";function F(p,t){if(typeof Buffer<"u"&&Buffer.isBuffer(p)){let e=Uint8Array.from(p);return {blob:new Blob([e]),name:t||"document"}}if(p instanceof Blob)return {blob:p,name:t||(p instanceof File?p.name:"document")};throw new Error("Invalid file type. Expected File, Blob, or Buffer.")}async function d(p,t){return (await p.json().catch(()=>({})))?.error?.message||`${t} failed with status ${p.status}`}var h=class{constructor(t){a(this,"apiKey");a(this,"apiUrl");if(!t.apiKey)throw new Error("DeepCitation API key is required. Get one at https://deepcitation.com/dashboard");this.apiKey=t.apiKey,this.apiUrl=t.apiUrl?.replace(/\/$/,"")||P;}async uploadFile(t,e){let{blob:l,name:r}=F(t,e?.filename),o=new FormData;o.append("file",l,r),e?.attachmentId&&o.append("attachmentId",e.attachmentId),e?.filename&&o.append("filename",e.filename);let i=await fetch(`${this.apiUrl}/prepareFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:o});if(!i.ok)throw new Error(await d(i,"Upload"));return await i.json()}async convertToPdf(t){let e=typeof t=="string"?{url:t}:t,{url:l,file:r,filename:o,attachmentId:i}=e;if(!l&&!r)throw new Error("Either url or file must be provided");let n;if(l)n=await fetch(`${this.apiUrl}/convertFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({url:l,filename:o,attachmentId:i})});else {let{blob:f,name:s}=F(r,o),a=new FormData;a.append("file",f,s),i&&a.append("attachmentId",i),o&&a.append("filename",o),n=await fetch(`${this.apiUrl}/convertFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:a});}if(!n.ok)throw new Error(await d(n,"Conversion"));return await n.json()}async prepareConvertedFile(t){let e=await fetch(`${this.apiUrl}/prepareFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({attachmentId:t.attachmentId})});if(!e.ok)throw new Error(await d(e,"Prepare"));return await e.json()}async prepareFiles(t){if(t.length===0)return {fileDataParts:[],deepTextPromptPortion:[]};let e=t.map(({file:i,filename:n,attachmentId:f})=>this.uploadFile(i,{filename:n,attachmentId:f}).then(s=>({result:s,filename:n}))),r=(await Promise.all(e)).map(({result:i,filename:n})=>({attachmentId:i.attachmentId,deepTextPromptPortion:i.deepTextPromptPortion,filename:n||i.metadata?.filename})),o=r.map(i=>i.deepTextPromptPortion);return {fileDataParts:r,deepTextPromptPortion:o}}async verifyAttachment(t,e,l){let r={};if(Array.isArray(e))for(let s of e){let a=d$1(s);r[a]=s;}else if(typeof e=="object"&&e!==null)if("fullPhrase"in e||"value"in e){let s=d$1(e);r[s]=e;}else Object.assign(r,e);else throw new Error("Invalid citations format");if(Object.keys(r).length===0)return {verifications:{}};let o=`${this.apiUrl}/verifyCitations`,i={data:{attachmentId:t,citations:r,outputImageFormat:l?.outputImageFormat||"avif"}},n=await fetch(o,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok)throw new Error(await d(n,"Verification"));return await n.json()}async verify(t,e){let{llmOutput:l,outputImageFormat:r="avif"}=t;if(e||(e=v(l)),Object.keys(e).length===0)return {verifications:{}};let o=new Map;for(let[a,c]of Object.entries(e)){let m=c.attachmentId||"";o.has(m)||o.set(m,{}),o.get(m)[a]=c;}let i=[],n={};for(let[a,c]of o)a?i.push(this.verifyAttachment(a,c,{outputImageFormat:r})):(Object.assign(n,c),typeof console<"u"&&console.warn&&console.warn(`[DeepCitation] ${Object.keys(c).length} citation(s) skipped: missing attachmentId`));let f=await Promise.all(i),s={};for(let a of f)Object.assign(s,a.verifications);for(let a of Object.keys(n))s[a]={status:"skipped"};return {verifications:s}}};
|
|
2
|
+
export{h as a};//# sourceMappingURL=chunk-TDGYSF3B.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-TDGYSF3B.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/client/DeepCitation.ts"],"names":["DEFAULT_API_URL","toBlob","file","filename","uint8","extractErrorMessage","response","fallbackAction","DeepCitation","config","__publicField","options","blob","name","formData","input","inputObj","url","attachmentId","files","uploadPromises","result","fileDataParts","deepTextPromptPortion","part","citations","citationMap","citation","key","generateCitationKey","requestUrl","requestBody","llmOutput","outputImageFormat","getAllCitationsFromLlmOutput","citationsByAttachment","verificationPromises","skippedCitations","fileCitations","results","allVerifications"],"mappings":"iFAmBA,IAAMA,CAAAA,CAAkB,+BAGxB,SAASC,CAAAA,CACPC,EACAC,CAAAA,CAC8B,CAC9B,GAAI,OAAO,MAAA,CAAW,KAAe,MAAA,CAAO,QAAA,CAASD,CAAI,CAAA,CAAG,CAC1D,IAAME,CAAAA,CAAQ,UAAA,CAAW,KAAKF,CAAI,CAAA,CAClC,OAAO,CAAE,IAAA,CAAM,IAAI,IAAA,CAAK,CAACE,CAAK,CAAC,CAAA,CAAG,KAAMD,CAAAA,EAAY,UAAW,CACjE,CACA,GAAID,aAAgB,IAAA,CAClB,OAAO,CACL,IAAA,CAAMA,CAAAA,CACN,IAAA,CAAMC,CAAAA,GAAaD,CAAAA,YAAgB,IAAA,CAAOA,EAAK,IAAA,CAAO,UAAA,CACxD,EAEF,MAAM,IAAI,MAAM,oDAAoD,CACtE,CAGA,eAAeG,CAAAA,CACbC,EACAC,CAAAA,CACiB,CAEjB,QADc,MAAMD,CAAAA,CAAS,MAAK,CAAE,KAAA,CAAM,KAAO,EAAC,CAAE,IAE3C,KAAA,EAAO,OAAA,EACd,GAAGC,CAAc,CAAA,oBAAA,EAAuBD,EAAS,MAAM,CAAA,CAE3D,CA2BO,IAAME,CAAAA,CAAN,KAAmB,CAUxB,WAAA,CAAYC,EAA4B,CATxCC,CAAAA,CAAA,KAAiB,QAAA,CAAA,CACjBA,CAAAA,CAAA,IAAA,CAAiB,QAAA,CAAA,CASf,GAAI,CAACD,EAAO,MAAA,CACV,MAAM,IAAI,KAAA,CACR,iFACF,EAEF,IAAA,CAAK,MAAA,CAASA,EAAO,MAAA,CACrB,IAAA,CAAK,OAASA,CAAAA,CAAO,MAAA,EAAQ,QAAQ,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IAAWO,KAAO,MAAA,CAAO,IAAA,CAAKS,CAAgB,CAAA,CAC5CG,CAAAA,CAAiBZ,CAAG,CAAA,CAAI,CAAE,OAAQ,SAAU,CAAA,CAG9C,OAAO,CAAE,aAAA,CAAeY,CAAiB,CAC3C,CACF","file":"chunk-TDGYSF3B.js","sourcesContent":["import { getAllCitationsFromLlmOutput } from \"../parsing/parseCitation.js\";\nimport { generateCitationKey } from \"../react/utils.js\";\nimport type { Citation } from \"../types/index.js\";\nimport type {\n CitationInput,\n ConvertFileInput,\n ConvertFileResponse,\n DeepCitationConfig,\n FileDataPart,\n FileInput,\n PrepareConvertedFileOptions,\n PrepareFilesResult,\n UploadFileOptions,\n UploadFileResponse,\n VerifyInput,\n VerifyCitationsOptions,\n VerifyCitationsResponse,\n} from \"./types.js\";\n\nconst DEFAULT_API_URL = \"https://api.deepcitation.com\";\n\n/** Convert File/Blob/Buffer to a Blob suitable for FormData */\nfunction toBlob(\n file: File | Blob | Buffer,\n filename?: string\n): { blob: Blob; name: string } {\n if (typeof Buffer !== \"undefined\" && Buffer.isBuffer(file)) {\n const uint8 = Uint8Array.from(file);\n return { blob: new Blob([uint8]), name: filename || \"document\" };\n }\n if (file instanceof Blob) {\n return {\n blob: file,\n name: filename || (file instanceof File ? file.name : \"document\"),\n };\n }\n throw new Error(\"Invalid file type. Expected File, Blob, or Buffer.\");\n}\n\n/** Extract error message from API response */\nasync function extractErrorMessage(\n response: Response,\n fallbackAction: string\n): Promise<string> {\n const error = await response.json().catch(() => ({}));\n return (\n error?.error?.message ||\n `${fallbackAction} failed with status ${response.status}`\n );\n}\n\n/**\n * DeepCitation client for file upload and citation verification.\n *\n * @example\n * ```typescript\n * import { DeepCitation } from '@deepcitation/deepcitation-js';\n *\n * const dc = new DeepCitation({ apiKey: process.env.DEEPCITATION_API_KEY });\n *\n * // Upload a file\n * const { attachmentId, promptContent } = await deepcitation.uploadFile(file);\n *\n * // Include promptContent in your LLM messages\n * const response = await llm.chat({\n * messages: [\n * { role: \"system\", content: wrapSystemCitationPrompt({ systemPrompt }) },\n * { role: \"user\", content: userMessage + \"\\n\\n\" + promptContent },\n * ]\n * });\n *\n * // Verify citations in the LLM output\n * const citations = getAllCitationsFromLlmOutput(response);\n * const verified = await deepcitation.verifyCitations(attachmentId, citations);\n * ```\n */\nexport class DeepCitation {\n private readonly apiKey: string;\n private readonly apiUrl: string;\n\n /**\n * Create a new DeepCitation client instance.\n *\n * @param config - Configuration options\n * @throws Error if apiKey is not provided\n */\n constructor(config: DeepCitationConfig) {\n if (!config.apiKey) {\n throw new Error(\n \"DeepCitation API key is required. Get one at https://deepcitation.com/dashboard\"\n );\n }\n this.apiKey = config.apiKey;\n this.apiUrl = config.apiUrl?.replace(/\\/$/, \"\") || DEFAULT_API_URL;\n }\n\n /**\n * Upload a file for citation verification.\n *\n * Supported file types:\n * - PDF documents\n * - Images (PNG, JPEG, WebP, AVIF, HEIC)\n * - Coming soon: DOCX, XLSX, plain text\n *\n * @param file - The file to upload (File, Blob, or Buffer)\n * @param options - Optional upload options\n * @returns Upload response with attachmentId and extracted text\n *\n * @example\n * ```typescript\n * // Browser with File object\n * const file = document.querySelector('input[type=\"file\"]').files[0];\n * const result = await deepcitation.uploadFile(file);\n *\n * // Node.js with Buffer\n * const buffer = fs.readFileSync('document.pdf');\n * const result = await deepcitation.uploadFile(buffer, { filename: 'document.pdf' });\n * ```\n */\n async uploadFile(\n file: File | Blob | Buffer,\n options?: UploadFileOptions\n ): Promise<UploadFileResponse> {\n const { blob, name } = toBlob(file, options?.filename);\n const formData = new FormData();\n formData.append(\"file\", blob, name);\n\n if (options?.attachmentId) formData.append(\"attachmentId\", options.attachmentId);\n if (options?.filename) formData.append(\"filename\", options.filename);\n\n const response = await fetch(`${this.apiUrl}/prepareFile`, {\n method: \"POST\",\n headers: { Authorization: `Bearer ${this.apiKey}` },\n body: formData,\n });\n\n if (!response.ok) {\n throw new Error(await extractErrorMessage(response, \"Upload\"));\n }\n\n return (await response.json()) as UploadFileResponse;\n }\n\n /**\n * Convert a URL or Office file to PDF for citation verification.\n * The converted file can then be processed with prepareConvertedFile().\n *\n * Supported Office formats:\n * - Microsoft Word (.doc, .docx)\n * - Microsoft Excel (.xls, .xlsx)\n * - Microsoft PowerPoint (.ppt, .pptx)\n * - OpenDocument (.odt, .ods, .odp)\n * - Rich Text Format (.rtf)\n * - CSV (.csv)\n *\n * @param input - URL string or object with URL/file options\n * @returns Conversion result with attachmentId for prepareConvertedFile\n *\n * @example\n * ```typescript\n * // Convert a URL to PDF\n * const result = await deepcitation.convertToPdf({ url: \"https://example.com/article\" });\n *\n * // Convert an Office document\n * const result = await deepcitation.convertToPdf({\n * file: docxBuffer,\n * filename: \"report.docx\"\n * });\n *\n * // Then prepare the file for verification\n * const { deepTextPromptPortion, attachmentId } = await deepcitation.prepareConvertedFile({\n * attachmentId: result.attachmentId\n * });\n * ```\n */\n async convertToPdf(\n input: ConvertFileInput | string\n ): Promise<ConvertFileResponse> {\n const inputObj: ConvertFileInput =\n typeof input === \"string\" ? { url: input } : input;\n const { url, file, filename, attachmentId } = inputObj;\n\n if (!url && !file) {\n throw new Error(\"Either url or file must be provided\");\n }\n\n let response: Response;\n\n if (url) {\n response = await fetch(`${this.apiUrl}/convertFile`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${this.apiKey}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ url, filename, attachmentId }),\n });\n } else {\n const { blob, name } = toBlob(file!, filename);\n const formData = new FormData();\n formData.append(\"file\", blob, name);\n if (attachmentId) formData.append(\"attachmentId\", attachmentId);\n if (filename) formData.append(\"filename\", filename);\n\n response = await fetch(`${this.apiUrl}/convertFile`, {\n method: \"POST\",\n headers: { Authorization: `Bearer ${this.apiKey}` },\n body: formData,\n });\n }\n\n if (!response.ok) {\n throw new Error(await extractErrorMessage(response, \"Conversion\"));\n }\n\n return (await response.json()) as ConvertFileResponse;\n }\n\n /**\n * Prepare a previously converted file for citation verification.\n * Use this after calling convertToPdf() to extract text and get deepTextPromptPortion.\n *\n * @param options - Options with attachmentId from convertFile\n * @returns Upload response with attachmentId and extracted text\n *\n * @example\n * ```typescript\n * // First convert the file\n * const converted = await deepcitation.convertToPdf({ url: \"https://example.com/article\" });\n *\n * // Then prepare it for verification\n * const { deepTextPromptPortion, attachmentId } = await deepcitation.prepareConvertedFile({\n * attachmentId: converted.attachmentId\n * });\n *\n * // Use deepTextPromptPortion in your LLM prompt...\n * ```\n */\n async prepareConvertedFile(\n options: PrepareConvertedFileOptions\n ): Promise<UploadFileResponse> {\n const response = await fetch(`${this.apiUrl}/prepareFile`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${this.apiKey}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n attachmentId: options.attachmentId,\n }),\n });\n\n if (!response.ok) {\n throw new Error(await extractErrorMessage(response, \"Prepare\"));\n }\n\n return (await response.json()) as UploadFileResponse;\n }\n\n /**\n * Upload multiple files for citation verification and get structured content.\n * This is the recommended way to prepare files for LLM prompts.\n *\n * @param files - Array of files to upload with optional filenames and attachmentIds\n * @returns Object containing fileDataParts for verification and deepTextPromptPortion for LLM\n *\n * @example\n * ```typescript\n * const { fileDataParts, deepTextPromptPortion } = await deepcitation.prepareFiles([\n * { file: pdfBuffer, filename: \"report.pdf\" },\n * { file: invoiceBuffer, filename: \"invoice.pdf\" },\n * ]);\n *\n * // Use deepTextPromptPortion in wrapCitationPrompt\n * const { enhancedSystemPrompt, enhancedUserPrompt } = wrapCitationPrompt({\n * systemPrompt,\n * userPrompt,\n * deepTextPromptPortion\n * });\n *\n * // Use fileDataParts later for verification\n * const result = await deepcitation.verifyAll({ llmOutput, fileDataParts });\n * ```\n */\n async prepareFiles(files: FileInput[]): Promise<PrepareFilesResult> {\n if (files.length === 0) {\n return { fileDataParts: [], deepTextPromptPortion: [] };\n }\n\n // Upload all files in parallel\n const uploadPromises = files.map(({ file, filename, attachmentId }) =>\n this.uploadFile(file, { filename, attachmentId }).then((result) => ({\n result,\n filename,\n }))\n );\n\n const uploadResults = await Promise.all(uploadPromises);\n\n // Extract file data parts with deepTextPromptPortion included (single source of truth)\n const fileDataParts: FileDataPart[] = uploadResults.map(\n ({ result, filename }) => ({\n attachmentId: result.attachmentId,\n deepTextPromptPortion: result.deepTextPromptPortion,\n filename: filename || result.metadata?.filename,\n })\n );\n\n // Also return separate array for backwards compatibility (deprecated)\n const deepTextPromptPortion: string[] = fileDataParts.map(\n (part) => part.deepTextPromptPortion\n );\n\n return { fileDataParts, deepTextPromptPortion };\n }\n\n /**\n * Verify citations against a single attachment/file.\n *\n * For most use cases, prefer `verify()` which automatically parses citations\n * from LLM output and handles multiple attachments. Use this method when you\n * need fine-grained control over per-attachment verification.\n *\n * @param attachmentId - The attachment ID returned from uploadFile\n * @param citations - Citations to verify (from getAllCitationsFromLlmOutput)\n * @param options - Optional verification options\n * @returns Verification results with status and proof images\n *\n * @example\n * ```typescript\n * import { getAllCitationsFromLlmOutput } from '@deepcitation/deepcitation-js';\n *\n * const citations = getAllCitationsFromLlmOutput(llmResponse);\n * const verified = await deepcitation.verifyAttachment(attachmentId, citations);\n *\n * for (const [key, result] of Object.entries(verified.verifications)) {\n * console.log(key, result.status);\n * // \"found\", \"partial_text_found\", \"not_found\", etc.\n * }\n * ```\n */\n async verifyAttachment(\n attachmentId: string,\n citations: CitationInput,\n options?: VerifyCitationsOptions\n ): Promise<VerifyCitationsResponse> {\n // Normalize citations to a map with citation keys\n const citationMap: Record<string, Citation> = {};\n\n if (Array.isArray(citations)) {\n // Array of citations - generate keys\n for (const citation of citations) {\n const key = generateCitationKey(citation);\n citationMap[key] = citation;\n }\n } else if (typeof citations === \"object\" && citations !== null) {\n // Check if it's a single citation or a map\n if (\"fullPhrase\" in citations || \"value\" in citations) {\n // Single citation\n const key = generateCitationKey(citations as Citation);\n citationMap[key] = citations as Citation;\n } else {\n // Already a map\n Object.assign(citationMap, citations);\n }\n } else {\n throw new Error(\"Invalid citations format\");\n }\n\n // If no citations to verify, return empty result\n if (Object.keys(citationMap).length === 0) {\n return { verifications: {} };\n }\n\n const requestUrl = `${this.apiUrl}/verifyCitations`;\n const requestBody = {\n data: {\n attachmentId,\n citations: citationMap,\n outputImageFormat: options?.outputImageFormat || \"avif\",\n },\n };\n\n const response = await fetch(requestUrl, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${this.apiKey}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(requestBody),\n });\n\n if (!response.ok) {\n throw new Error(await extractErrorMessage(response, \"Verification\"));\n }\n\n const result = (await response.json()) as VerifyCitationsResponse;\n return result;\n }\n\n /**\n * Parse and verify all citations from LLM output.\n *\n * This is the recommended method for citation verification. It automatically:\n * 1. Parses citations from LLM output (no raw content sent to our servers)\n * 2. Groups citations by attachment ID\n * 3. Verifies each attachment in parallel\n *\n * For privacy-conscious users: we only receive the parsed citation metadata,\n * not your raw LLM output. This method is a convenience wrapper that parses\n * locally and makes per-attachment verification calls.\n *\n * @param input - Object containing llmOutput and optional outputImageFormat\n * @param citations - Optional pre-parsed citations (skips parsing if provided)\n * @returns Verification results with status and proof images\n *\n * @example\n * ```typescript\n * const result = await deepcitation.verify({\n * llmOutput: response.content,\n * });\n *\n * for (const [key, verification] of Object.entries(result.verifications)) {\n * console.log(key, verification.status);\n * }\n * ```\n */\n async verify(\n input: VerifyInput,\n citations?: { [key: string]: Citation }\n ): Promise<VerifyCitationsResponse> {\n const { llmOutput, outputImageFormat = \"avif\" } = input;\n\n // Parse citations from LLM output\n if (!citations) citations = getAllCitationsFromLlmOutput(llmOutput);\n\n // If no citations found, return empty result\n if (Object.keys(citations).length === 0) {\n return { verifications: {} };\n }\n\n // Group citations by attachmentId\n const citationsByAttachment = new Map<string, Record<string, Citation>>();\n for (const [key, citation] of Object.entries(citations)) {\n const attachmentId = citation.attachmentId || \"\";\n if (!citationsByAttachment.has(attachmentId)) {\n citationsByAttachment.set(attachmentId, {});\n }\n citationsByAttachment.get(attachmentId)![key] = citation;\n }\n\n const verificationPromises: Promise<VerifyCitationsResponse>[] = [];\n const skippedCitations: Record<string, Citation> = {};\n\n for (const [attachmentId, fileCitations] of citationsByAttachment) {\n if (attachmentId) {\n verificationPromises.push(\n this.verifyAttachment(attachmentId, fileCitations, { outputImageFormat })\n );\n } else {\n Object.assign(skippedCitations, fileCitations);\n if (typeof console !== \"undefined\" && console.warn) {\n console.warn(\n `[DeepCitation] ${Object.keys(fileCitations).length} citation(s) skipped: missing attachmentId`\n );\n }\n }\n }\n\n const results = await Promise.all(verificationPromises);\n const allVerifications: VerifyCitationsResponse[\"verifications\"] = {};\n for (const result of results) {\n Object.assign(allVerifications, result.verifications);\n }\n\n for (const key of Object.keys(skippedCitations)) {\n allVerifications[key] = { status: \"skipped\" };\n }\n\n return { verifications: allVerifications };\n }\n}\n"]}
|
package/lib/client/index.cjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk4ILSZKAP_cjs=require('../chunk-4ILSZKAP.cjs');require('../chunk-ALJ2ZQ2S.cjs'),require('../chunk-BYLIBOAU.cjs');Object.defineProperty(exports,"DeepCitation",{enumerable:true,get:function(){return chunk4ILSZKAP_cjs.a}});//# sourceMappingURL=index.cjs.map
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
package/lib/client/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export{a as DeepCitation}from'../chunk-
|
|
1
|
+
export{a as DeepCitation}from'../chunk-TDGYSF3B.js';import'../chunk-LLLVZOXB.js';import'../chunk-5XGN7UAV.js';//# sourceMappingURL=index.js.map
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/lib/index.cjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk4ILSZKAP_cjs=require('./chunk-4ILSZKAP.cjs'),chunkPJWAX2VG_cjs=require('./chunk-PJWAX2VG.cjs'),chunkQUW3L3UU_cjs=require('./chunk-QUW3L3UU.cjs'),chunkALJ2ZQ2S_cjs=require('./chunk-ALJ2ZQ2S.cjs');require('./chunk-BYLIBOAU.cjs');var z=t=>{if(!t)return false;let e=t.trim();if(e.length<64)return false;let a=e?.[0];for(let r=1;r<e.length;r++)if(e[r]!==a)return false;return true};function J(t){t=t.trim();let e=2,a=10,r=/[.?!](?=\s+|$)/g,n=[],c;for(;(c=r.exec(t))!==null;)n.push(c.index);if(n.length<2)return t;let I=n[n.length-1],f=n[n.length-2],o=t.substring(f+1,I+1),p=o.length;if(o.trim().slice(0,-1).length<a||p<=0||t.length<p*e)return t;let m=0,s=I+1;t.endsWith(o)&&(s=t.length);let T=-1;for(;;){let i=s-p;if(i<0)break;if(t.substring(i,s)===o)m++,T=i,s=i;else break}return m>=e?t.substring(0,T)+o:t}Object.defineProperty(exports,"DeepCitation",{enumerable:true,get:function(){return chunk4ILSZKAP_cjs.a}});Object.defineProperty(exports,"AV_CITATION_MARKDOWN_SYNTAX_PROMPT",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.b}});Object.defineProperty(exports,"CITATION_AV_BASED_JSON_OUTPUT_FORMAT",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.h}});Object.defineProperty(exports,"CITATION_AV_REMINDER",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.d}});Object.defineProperty(exports,"CITATION_JSON_OUTPUT_FORMAT",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.g}});Object.defineProperty(exports,"CITATION_MARKDOWN_SYNTAX_PROMPT",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.a}});Object.defineProperty(exports,"CITATION_REMINDER",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.c}});Object.defineProperty(exports,"compressPromptIds",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.i}});Object.defineProperty(exports,"decompressPromptIds",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.j}});Object.defineProperty(exports,"wrapCitationPrompt",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.f}});Object.defineProperty(exports,"wrapSystemCitationPrompt",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.e}});Object.defineProperty(exports,"BLANK_VERIFICATION",{enumerable:true,get:function(){return chunkQUW3L3UU_cjs.d}});Object.defineProperty(exports,"DEFAULT_OUTPUT_IMAGE_FORMAT",{enumerable:true,get:function(){return chunkQUW3L3UU_cjs.a}});Object.defineProperty(exports,"NOT_FOUND_VERIFICATION_INDEX",{enumerable:true,get:function(){return chunkQUW3L3UU_cjs.b}});Object.defineProperty(exports,"PENDING_VERIFICATION_INDEX",{enumerable:true,get:function(){return chunkQUW3L3UU_cjs.c}});Object.defineProperty(exports,"CITATION_X_PADDING",{enumerable:true,get:function(){return chunkALJ2ZQ2S_cjs.k}});Object.defineProperty(exports,"CITATION_Y_PADDING",{enumerable:true,get:function(){return chunkALJ2ZQ2S_cjs.l}});Object.defineProperty(exports,"generateCitationInstanceId",{enumerable:true,get:function(){return chunkALJ2ZQ2S_cjs.f}});Object.defineProperty(exports,"generateCitationKey",{enumerable:true,get:function(){return chunkALJ2ZQ2S_cjs.d}});Object.defineProperty(exports,"generateVerificationKey",{enumerable:true,get:function(){return chunkALJ2ZQ2S_cjs.e}});Object.defineProperty(exports,"getAllCitationsFromLlmOutput",{enumerable:true,get:function(){return chunkALJ2ZQ2S_cjs.v}});Object.defineProperty(exports,"getCitationPageNumber",{enumerable:true,get:function(){return chunkALJ2ZQ2S_cjs.r}});Object.defineProperty(exports,"getCitationStatus",{enumerable:true,get:function(){return chunkALJ2ZQ2S_cjs.t}});Object.defineProperty(exports,"getVerificationTextIndicator",{enumerable:true,get:function(){return chunkALJ2ZQ2S_cjs.m}});Object.defineProperty(exports,"groupCitationsByAttachmentId",{enumerable:true,get:function(){return chunkALJ2ZQ2S_cjs.w}});Object.defineProperty(exports,"groupCitationsByAttachmentIdObject",{enumerable:true,get:function(){return chunkALJ2ZQ2S_cjs.x}});Object.defineProperty(exports,"normalizeCitations",{enumerable:true,get:function(){return chunkALJ2ZQ2S_cjs.s}});Object.defineProperty(exports,"parseCitation",{enumerable:true,get:function(){return chunkALJ2ZQ2S_cjs.u}});Object.defineProperty(exports,"removeCitations",{enumerable:true,get:function(){return chunkALJ2ZQ2S_cjs.o}});Object.defineProperty(exports,"removeLineIdMetadata",{enumerable:true,get:function(){return chunkALJ2ZQ2S_cjs.q}});Object.defineProperty(exports,"removePageNumberMetadata",{enumerable:true,get:function(){return chunkALJ2ZQ2S_cjs.p}});Object.defineProperty(exports,"replaceCitations",{enumerable:true,get:function(){return chunkALJ2ZQ2S_cjs.n}});Object.defineProperty(exports,"sha1Hash",{enumerable:true,get:function(){return chunkALJ2ZQ2S_cjs.a}});exports.cleanRepeatingLastSentence=J;exports.isGeminiGarbage=z;//# sourceMappingURL=index.cjs.map
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/parsing/parseWorkAround.ts"],"names":["isGeminiGarbage","content","trimmedContent","firstCharacter","i","cleanRepeatingLastSentence","text","MIN_REPETITIONS","MIN_SENTENCE_CONTENT_LENGTH","sentenceEndRegex","sentenceEndIndices","match","lastTerminatorIndex","secondLastTerminatorIndex","repeatingUnit","unitLength","repetitionsFound","currentCheckEndIndex","firstRepetitionStartIndex","checkStartIndex"],"mappings":"yPAEO,IAAMA,EAAmBC,CAAAA,EAAoB,CAClD,GAAI,CAACA,EAAS,OAAO,MAAA,CACrB,IAAMC,CAAAA,CAAiBD,EAAQ,IAAA,EAAK,CACpC,GAAIC,CAAAA,CAAe,MAAA,CAAS,GAAuC,OAAO,MAAA,CAE1E,IAAMC,CAAAA,CAAiBD,IAAiB,CAAC,CAAA,CAEz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,CAAAA,CAE/C,GAAII,EAAkB,CAAA,CACpB,MAKF,GAFcb,CAAAA,CAAK,SAAA,CAAUa,CAAAA,CAAiBF,CAAoB,IAEpDH,CAAAA,CACZE,CAAAA,EAAAA,CACAE,EAA4BC,CAAAA,CAC5BF,CAAAA,CAAuBE,OAEvB,KAEJ,CAEA,OAAIH,CAAAA,EAAoBT,EACQD,CAAAA,CAAK,SAAA,CAAU,EAAGY,CAAyB,CAAA,CAClCJ,EAGhCR,CAEX","file":"index.cjs","sourcesContent":["//flash and flash lite get super confused if we ask for a MD table and infinite loop\nconst MIN_CONTENT_LENGTH_FOR_GEMINI_GARBAGE = 64;\nexport const isGeminiGarbage = (content: string) => {\n if (!content) return false;\n const trimmedContent = content.trim();\n if (trimmedContent.length < MIN_CONTENT_LENGTH_FOR_GEMINI_GARBAGE) return false;\n\n const firstCharacter = trimmedContent?.[0];\n\n for (let i = 1; i < trimmedContent.length; i++) {\n if (trimmedContent[i] !== firstCharacter) return false;\n }\n return true;\n};\n\n// helps clean up infinite rambling bug output from gemini\nexport function cleanRepeatingLastSentence(text: string): string {\n text = text.trim();\n const MIN_REPETITIONS = 2;\n const MIN_SENTENCE_CONTENT_LENGTH = 10;\n\n const sentenceEndRegex = /[.?!](?=\\s+|$)/g;\n const sentenceEndIndices: number[] = [];\n let match;\n while ((match = sentenceEndRegex.exec(text)) !== null) {\n sentenceEndIndices.push(match.index);\n }\n\n if (sentenceEndIndices.length < 2) {\n return text;\n }\n\n const lastTerminatorIndex = sentenceEndIndices[sentenceEndIndices.length - 1];\n const secondLastTerminatorIndex = sentenceEndIndices[sentenceEndIndices.length - 2];\n\n const repeatingUnit = text.substring(secondLastTerminatorIndex + 1, lastTerminatorIndex + 1);\n const unitLength = repeatingUnit.length;\n\n const sentenceContent = repeatingUnit.trim().slice(0, -1);\n if (sentenceContent.length < MIN_SENTENCE_CONTENT_LENGTH) {\n return text;\n }\n if (unitLength <= 0) {\n return text;\n }\n\n if (text.length < unitLength * MIN_REPETITIONS) {\n return text;\n }\n\n let repetitionsFound = 0;\n let currentCheckEndIndex = lastTerminatorIndex + 1;\n if (text.endsWith(repeatingUnit)) {\n currentCheckEndIndex = text.length;\n }\n\n let firstRepetitionStartIndex = -1;\n\n while (true) {\n const checkStartIndex = currentCheckEndIndex - unitLength;\n\n if (checkStartIndex < 0) {\n break;\n }\n\n const chunk = text.substring(checkStartIndex, currentCheckEndIndex);\n\n if (chunk === repeatingUnit) {\n repetitionsFound++;\n firstRepetitionStartIndex = checkStartIndex;\n currentCheckEndIndex = checkStartIndex;\n } else {\n break;\n }\n }\n\n if (repetitionsFound >= MIN_REPETITIONS) {\n const textBeforeRepetitions = text.substring(0, firstRepetitionStartIndex);\n const result = textBeforeRepetitions + repeatingUnit;\n return result;\n } else {\n return text;\n }\n}\n"]}
|
package/lib/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export{a as DeepCitation}from'./chunk-
|
|
1
|
+
export{a as DeepCitation}from'./chunk-TDGYSF3B.js';export{b as AV_CITATION_MARKDOWN_SYNTAX_PROMPT,h as CITATION_AV_BASED_JSON_OUTPUT_FORMAT,d as CITATION_AV_REMINDER,g as CITATION_JSON_OUTPUT_FORMAT,a as CITATION_MARKDOWN_SYNTAX_PROMPT,c as CITATION_REMINDER,i as compressPromptIds,j as decompressPromptIds,f as wrapCitationPrompt,e as wrapSystemCitationPrompt}from'./chunk-KBDVUQEE.js';export{d as BLANK_VERIFICATION,a as DEFAULT_OUTPUT_IMAGE_FORMAT,b as NOT_FOUND_VERIFICATION_INDEX,c as PENDING_VERIFICATION_INDEX}from'./chunk-R57DQBOT.js';export{k as CITATION_X_PADDING,l as CITATION_Y_PADDING,f as generateCitationInstanceId,d as generateCitationKey,e as generateVerificationKey,v as getAllCitationsFromLlmOutput,r as getCitationPageNumber,t as getCitationStatus,m as getVerificationTextIndicator,w as groupCitationsByAttachmentId,x as groupCitationsByAttachmentIdObject,s as normalizeCitations,u as parseCitation,o as removeCitations,q as removeLineIdMetadata,p as removePageNumberMetadata,n as replaceCitations,a as sha1Hash}from'./chunk-LLLVZOXB.js';import'./chunk-5XGN7UAV.js';var z=t=>{if(!t)return false;let e=t.trim();if(e.length<64)return false;let a=e?.[0];for(let r=1;r<e.length;r++)if(e[r]!==a)return false;return true};function J(t){t=t.trim();let e=2,a=10,r=/[.?!](?=\s+|$)/g,n=[],c;for(;(c=r.exec(t))!==null;)n.push(c.index);if(n.length<2)return t;let I=n[n.length-1],f=n[n.length-2],o=t.substring(f+1,I+1),p=o.length;if(o.trim().slice(0,-1).length<a||p<=0||t.length<p*e)return t;let m=0,s=I+1;t.endsWith(o)&&(s=t.length);let T=-1;for(;;){let i=s-p;if(i<0)break;if(t.substring(i,s)===o)m++,T=i,s=i;else break}return m>=e?t.substring(0,T)+o:t}export{J as cleanRepeatingLastSentence,z as isGeminiGarbage};//# sourceMappingURL=index.js.map
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/parsing/parseWorkAround.ts"],"names":["isGeminiGarbage","content","trimmedContent","firstCharacter","i","cleanRepeatingLastSentence","text","MIN_REPETITIONS","MIN_SENTENCE_CONTENT_LENGTH","sentenceEndRegex","sentenceEndIndices","match","lastTerminatorIndex","secondLastTerminatorIndex","repeatingUnit","unitLength","repetitionsFound","currentCheckEndIndex","firstRepetitionStartIndex","checkStartIndex"],"mappings":"8jCAEO,IAAMA,EAAmBC,CAAAA,EAAoB,CAClD,GAAI,CAACA,EAAS,OAAO,MAAA,CACrB,IAAMC,CAAAA,CAAiBD,EAAQ,IAAA,EAAK,CACpC,GAAIC,CAAAA,CAAe,MAAA,CAAS,GAAuC,OAAO,MAAA,CAE1E,IAAMC,CAAAA,CAAiBD,IAAiB,CAAC,CAAA,CAEzC,QAASE,CAAAA,CAAI,CAAA,CAAGA,EAAIF,CAAAA,CAAe,MAAA,CAAQE,CAAAA,EAAAA,CACzC,GA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iBF,CAAoB,IAEpDH,CAAAA,CACZE,CAAAA,EAAAA,CACAE,EAA4BC,CAAAA,CAC5BF,CAAAA,CAAuBE,OAEvB,KAEJ,CAEA,OAAIH,CAAAA,EAAoBT,EACQD,CAAAA,CAAK,SAAA,CAAU,EAAGY,CAAyB,CAAA,CAClCJ,EAGhCR,CAEX","file":"index.js","sourcesContent":["//flash and flash lite get super confused if we ask for a MD table and infinite loop\nconst MIN_CONTENT_LENGTH_FOR_GEMINI_GARBAGE = 64;\nexport const isGeminiGarbage = (content: string) => {\n if (!content) return false;\n const trimmedContent = content.trim();\n if (trimmedContent.length < MIN_CONTENT_LENGTH_FOR_GEMINI_GARBAGE) return false;\n\n const firstCharacter = trimmedContent?.[0];\n\n for (let i = 1; i < trimmedContent.length; i++) {\n if (trimmedContent[i] !== firstCharacter) return false;\n }\n return true;\n};\n\n// helps clean up infinite rambling bug output from gemini\nexport function cleanRepeatingLastSentence(text: string): string {\n text = text.trim();\n const MIN_REPETITIONS = 2;\n const MIN_SENTENCE_CONTENT_LENGTH = 10;\n\n const sentenceEndRegex = /[.?!](?=\\s+|$)/g;\n const sentenceEndIndices: number[] = [];\n let match;\n while ((match = sentenceEndRegex.exec(text)) !== null) {\n sentenceEndIndices.push(match.index);\n }\n\n if (sentenceEndIndices.length < 2) {\n return text;\n }\n\n const lastTerminatorIndex = sentenceEndIndices[sentenceEndIndices.length - 1];\n const secondLastTerminatorIndex = sentenceEndIndices[sentenceEndIndices.length - 2];\n\n const repeatingUnit = text.substring(secondLastTerminatorIndex + 1, lastTerminatorIndex + 1);\n const unitLength = repeatingUnit.length;\n\n const sentenceContent = repeatingUnit.trim().slice(0, -1);\n if (sentenceContent.length < MIN_SENTENCE_CONTENT_LENGTH) {\n return text;\n }\n if (unitLength <= 0) {\n return text;\n }\n\n if (text.length < unitLength * MIN_REPETITIONS) {\n return text;\n }\n\n let repetitionsFound = 0;\n let currentCheckEndIndex = lastTerminatorIndex + 1;\n if (text.endsWith(repeatingUnit)) {\n currentCheckEndIndex = text.length;\n }\n\n let firstRepetitionStartIndex = -1;\n\n while (true) {\n const checkStartIndex = currentCheckEndIndex - unitLength;\n\n if (checkStartIndex < 0) {\n break;\n }\n\n const chunk = text.substring(checkStartIndex, currentCheckEndIndex);\n\n if (chunk === repeatingUnit) {\n repetitionsFound++;\n firstRepetitionStartIndex = checkStartIndex;\n currentCheckEndIndex = checkStartIndex;\n } else {\n break;\n }\n }\n\n if (repetitionsFound >= MIN_REPETITIONS) {\n const textBeforeRepetitions = text.substring(0, firstRepetitionStartIndex);\n const result = textBeforeRepetitions + repeatingUnit;\n return result;\n } else {\n return text;\n }\n}\n"]}
|
package/lib/prompts/index.cjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkPJWAX2VG_cjs=require('../chunk-PJWAX2VG.cjs');require('../chunk-BYLIBOAU.cjs');Object.defineProperty(exports,"AV_CITATION_MARKDOWN_SYNTAX_PROMPT",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.b}});Object.defineProperty(exports,"CITATION_AV_BASED_JSON_OUTPUT_FORMAT",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.h}});Object.defineProperty(exports,"CITATION_AV_REMINDER",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.d}});Object.defineProperty(exports,"CITATION_JSON_OUTPUT_FORMAT",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.g}});Object.defineProperty(exports,"CITATION_MARKDOWN_SYNTAX_PROMPT",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.a}});Object.defineProperty(exports,"CITATION_REMINDER",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.c}});Object.defineProperty(exports,"compressPromptIds",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.i}});Object.defineProperty(exports,"decompressPromptIds",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.j}});Object.defineProperty(exports,"wrapCitationPrompt",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.f}});Object.defineProperty(exports,"wrapSystemCitationPrompt",{enumerable:true,get:function(){return chunkPJWAX2VG_cjs.e}});//# sourceMappingURL=index.cjs.map
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
package/lib/prompts/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export{b as AV_CITATION_MARKDOWN_SYNTAX_PROMPT,h as CITATION_AV_BASED_JSON_OUTPUT_FORMAT,d as CITATION_AV_REMINDER,g as CITATION_JSON_OUTPUT_FORMAT,a as CITATION_MARKDOWN_SYNTAX_PROMPT,c as CITATION_REMINDER,i as compressPromptIds,j as decompressPromptIds,f as wrapCitationPrompt,e as wrapSystemCitationPrompt}from'../chunk-
|
|
1
|
+
export{b as AV_CITATION_MARKDOWN_SYNTAX_PROMPT,h as CITATION_AV_BASED_JSON_OUTPUT_FORMAT,d as CITATION_AV_REMINDER,g as CITATION_JSON_OUTPUT_FORMAT,a as CITATION_MARKDOWN_SYNTAX_PROMPT,c as CITATION_REMINDER,i as compressPromptIds,j as decompressPromptIds,f as wrapCitationPrompt,e as wrapSystemCitationPrompt}from'../chunk-KBDVUQEE.js';import'../chunk-5XGN7UAV.js';//# sourceMappingURL=index.js.map
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|