@entelligentsia/forgecli 0.9.2 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/CHANGELOG-pi.md +14 -19
- package/dist/bin/forge.js +81 -68
- package/dist/bin/forge.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +6 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +2 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +15 -0
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +15 -0
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +80 -0
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +20 -0
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/CHANGELOG.md +14 -19
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli.js +3 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/config.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/config.js +35 -27
- package/node_modules/@earendil-works/pi-coding-agent/dist/config.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/template.js +17 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +4 -8
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js +3 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/main.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +5 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/main.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-editor.js +14 -6
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +13 -6
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/dark.json +5 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/light.json +5 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +21 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js +82 -40
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js +22 -5
- package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/child-process.d.ts +5 -8
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/child-process.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/child-process.js +8 -59
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/child-process.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/shell.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/shell.js +6 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/shell.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/windows-self-update.d.ts +3 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/windows-self-update.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/windows-self-update.js +77 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/windows-self-update.js.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/docs/index.md +8 -0
- package/node_modules/@earendil-works/pi-coding-agent/docs/packages.md +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/docs/quickstart.md +20 -0
- package/node_modules/@earendil-works/pi-coding-agent/docs/usage.md +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/README.md +3 -0
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/index.ts +41 -19
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/package.json +6 -4
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +3 -4
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/node_modules/cross-spawn/LICENSE +21 -0
- package/node_modules/cross-spawn/README.md +89 -0
- package/node_modules/cross-spawn/index.js +39 -0
- package/node_modules/cross-spawn/lib/enoent.js +59 -0
- package/node_modules/cross-spawn/lib/parse.js +91 -0
- package/node_modules/cross-spawn/lib/util/escape.js +47 -0
- package/node_modules/cross-spawn/lib/util/readShebang.js +23 -0
- package/node_modules/cross-spawn/lib/util/resolveCommand.js +52 -0
- package/node_modules/cross-spawn/package.json +73 -0
- package/node_modules/isexe/.npmignore +2 -0
- package/node_modules/isexe/LICENSE +15 -0
- package/node_modules/isexe/README.md +51 -0
- package/node_modules/isexe/index.js +57 -0
- package/node_modules/isexe/mode.js +41 -0
- package/node_modules/isexe/package.json +31 -0
- package/node_modules/isexe/test/basic.js +221 -0
- package/node_modules/isexe/windows.js +42 -0
- package/node_modules/path-key/index.d.ts +40 -0
- package/node_modules/path-key/index.js +16 -0
- package/node_modules/path-key/license +9 -0
- package/node_modules/path-key/package.json +39 -0
- package/node_modules/path-key/readme.md +61 -0
- package/node_modules/shebang-command/index.js +19 -0
- package/node_modules/shebang-command/license +9 -0
- package/node_modules/shebang-command/package.json +34 -0
- package/node_modules/shebang-command/readme.md +34 -0
- package/node_modules/shebang-regex/index.d.ts +22 -0
- package/node_modules/shebang-regex/index.js +2 -0
- package/node_modules/shebang-regex/license +9 -0
- package/node_modules/shebang-regex/package.json +35 -0
- package/node_modules/shebang-regex/readme.md +33 -0
- package/node_modules/which/LICENSE +15 -0
- package/node_modules/which/README.md +54 -0
- package/node_modules/which/bin/node-which +52 -0
- package/node_modules/which/package.json +43 -0
- package/node_modules/which/which.js +125 -0
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"truncate.d.ts","sourceRoot":"","sources":["../../../src/harness/utils/truncate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,iBAAiB,OAAO,CAAC;AACtC,eAAO,MAAM,iBAAiB,QAAY,CAAC;AAC3C,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,MAAM,WAAW,gBAAgB;IAChC,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,sEAAsE;IACtE,WAAW,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAAC;IACtC,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,yFAAyF;IACzF,eAAe,EAAE,OAAO,CAAC;IACzB,2EAA2E;IAC3E,qBAAqB,EAAE,OAAO,CAAC;IAC/B,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IACjC,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AA4DD;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQhD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,gBAAgB,CAkF/F;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,gBAAgB,CAyE/F;AA2CD;;;GAGG;AACH,wBAAgB,YAAY,CAC3B,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,MAA6B,GACrC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAE,CAKzC","sourcesContent":["/**\n * Shared truncation utilities for tool outputs.\n *\n * Truncation is based on two independent limits - whichever is hit first wins:\n * - Line limit (default: 2000 lines)\n * - Byte limit (default: 50KB)\n *\n * Never returns partial lines (except bash tail truncation edge case).\n */\n\nexport const DEFAULT_MAX_LINES = 2000;\nexport const DEFAULT_MAX_BYTES = 50 * 1024; // 50KB\nexport const GREP_MAX_LINE_LENGTH = 500; // Max chars per grep match line\n\nexport interface TruncationResult {\n\t/** The truncated content */\n\tcontent: string;\n\t/** Whether truncation occurred */\n\ttruncated: boolean;\n\t/** Which limit was hit: \"lines\", \"bytes\", or null if not truncated */\n\ttruncatedBy: \"lines\" | \"bytes\" | null;\n\t/** Total number of lines in the original content */\n\ttotalLines: number;\n\t/** Total number of bytes in the original content */\n\ttotalBytes: number;\n\t/** Number of complete lines in the truncated output */\n\toutputLines: number;\n\t/** Number of bytes in the truncated output */\n\toutputBytes: number;\n\t/** Whether the last line was partially truncated (only for tail truncation edge case) */\n\tlastLinePartial: boolean;\n\t/** Whether the first line exceeded the byte limit (for head truncation) */\n\tfirstLineExceedsLimit: boolean;\n\t/** The max lines limit that was applied */\n\tmaxLines: number;\n\t/** The max bytes limit that was applied */\n\tmaxBytes: number;\n}\n\nexport interface TruncationOptions {\n\t/** Maximum number of lines (default: 2000) */\n\tmaxLines?: number;\n\t/** Maximum number of bytes (default: 50KB) */\n\tmaxBytes?: number;\n}\n\ninterface RuntimeBuffer {\n\tbyteLength(content: string, encoding: \"utf8\"): number;\n}\n\nconst runtimeBuffer = (globalThis as { Buffer?: RuntimeBuffer }).Buffer;\nconst nonAsciiPattern = /[^\\x00-\\x7f]/;\n\nfunction utf8ByteLength(content: string): number {\n\tif (runtimeBuffer) return runtimeBuffer.byteLength(content, \"utf8\");\n\n\tconst firstNonAscii = content.search(nonAsciiPattern);\n\tif (firstNonAscii === -1) return content.length;\n\n\tlet bytes = firstNonAscii;\n\tfor (let i = firstNonAscii; i < content.length; i++) {\n\t\tconst code = content.charCodeAt(i);\n\t\tif (code <= 0x7f) {\n\t\t\tbytes += 1;\n\t\t} else if (code <= 0x7ff) {\n\t\t\tbytes += 2;\n\t\t} else if (code >= 0xd800 && code <= 0xdbff && i + 1 < content.length) {\n\t\t\tconst next = content.charCodeAt(i + 1);\n\t\t\tif (next >= 0xdc00 && next <= 0xdfff) {\n\t\t\t\tbytes += 4;\n\t\t\t\ti++;\n\t\t\t} else {\n\t\t\t\tbytes += 3;\n\t\t\t}\n\t\t} else {\n\t\t\tbytes += 3;\n\t\t}\n\t}\n\treturn bytes;\n}\n\nfunction replaceUnpairedSurrogates(content: string): string {\n\tlet output = \"\";\n\tfor (let i = 0; i < content.length; i++) {\n\t\tconst code = content.charCodeAt(i);\n\t\tif (code >= 0xd800 && code <= 0xdbff) {\n\t\t\tif (i + 1 < content.length) {\n\t\t\t\tconst next = content.charCodeAt(i + 1);\n\t\t\t\tif (next >= 0xdc00 && next <= 0xdfff) {\n\t\t\t\t\toutput += content[i] + content[i + 1];\n\t\t\t\t\ti++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\toutput += \"�\";\n\t\t} else if (code >= 0xdc00 && code <= 0xdfff) {\n\t\t\toutput += \"�\";\n\t\t} else {\n\t\t\toutput += content[i];\n\t\t}\n\t}\n\treturn output;\n}\n\n/**\n * Format bytes as human-readable size.\n */\nexport function formatSize(bytes: number): string {\n\tif (bytes < 1024) {\n\t\treturn `${bytes}B`;\n\t} else if (bytes < 1024 * 1024) {\n\t\treturn `${(bytes / 1024).toFixed(1)}KB`;\n\t} else {\n\t\treturn `${(bytes / (1024 * 1024)).toFixed(1)}MB`;\n\t}\n}\n\n/**\n * Truncate content from the head (keep first N lines/bytes).\n * Suitable for file reads where you want to see the beginning.\n *\n * Never returns partial lines. If first line exceeds byte limit,\n * returns empty content with firstLineExceedsLimit=true.\n */\nexport function truncateHead(content: string, options: TruncationOptions = {}): TruncationResult {\n\tconst maxLines = options.maxLines ?? DEFAULT_MAX_LINES;\n\tconst maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;\n\n\tconst totalBytes = utf8ByteLength(content);\n\tconst lines = content.split(\"\\n\");\n\tconst totalLines = lines.length;\n\n\t// Check if no truncation needed\n\tif (totalLines <= maxLines && totalBytes <= maxBytes) {\n\t\treturn {\n\t\t\tcontent,\n\t\t\ttruncated: false,\n\t\t\ttruncatedBy: null,\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: totalLines,\n\t\t\toutputBytes: totalBytes,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: false,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Check if first line alone exceeds byte limit\n\tconst firstLineBytes = utf8ByteLength(lines[0]);\n\tif (firstLineBytes > maxBytes) {\n\t\treturn {\n\t\t\tcontent: \"\",\n\t\t\ttruncated: true,\n\t\t\ttruncatedBy: \"bytes\",\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: 0,\n\t\t\toutputBytes: 0,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: true,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Collect complete lines that fit\n\tconst outputLinesArr: string[] = [];\n\tlet outputBytesCount = 0;\n\tlet truncatedBy: \"lines\" | \"bytes\" = \"lines\";\n\n\tfor (let i = 0; i < lines.length && i < maxLines; i++) {\n\t\tconst line = lines[i];\n\t\tconst lineBytes = utf8ByteLength(line) + (i > 0 ? 1 : 0); // +1 for newline\n\n\t\tif (outputBytesCount + lineBytes > maxBytes) {\n\t\t\ttruncatedBy = \"bytes\";\n\t\t\tbreak;\n\t\t}\n\n\t\toutputLinesArr.push(line);\n\t\toutputBytesCount += lineBytes;\n\t}\n\n\t// If we exited due to line limit\n\tif (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {\n\t\ttruncatedBy = \"lines\";\n\t}\n\n\tconst outputContent = outputLinesArr.join(\"\\n\");\n\tconst finalOutputBytes = utf8ByteLength(outputContent);\n\n\treturn {\n\t\tcontent: outputContent,\n\t\ttruncated: true,\n\t\ttruncatedBy,\n\t\ttotalLines,\n\t\ttotalBytes,\n\t\toutputLines: outputLinesArr.length,\n\t\toutputBytes: finalOutputBytes,\n\t\tlastLinePartial: false,\n\t\tfirstLineExceedsLimit: false,\n\t\tmaxLines,\n\t\tmaxBytes,\n\t};\n}\n\n/**\n * Truncate content from the tail (keep last N lines/bytes).\n * Suitable for bash output where you want to see the end (errors, final results).\n *\n * May return partial first line if the last line of original content exceeds byte limit.\n */\nexport function truncateTail(content: string, options: TruncationOptions = {}): TruncationResult {\n\tconst maxLines = options.maxLines ?? DEFAULT_MAX_LINES;\n\tconst maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;\n\n\tconst totalBytes = utf8ByteLength(content);\n\tconst lines = content.split(\"\\n\");\n\tconst totalLines = lines.length;\n\n\t// Check if no truncation needed\n\tif (totalLines <= maxLines && totalBytes <= maxBytes) {\n\t\treturn {\n\t\t\tcontent,\n\t\t\ttruncated: false,\n\t\t\ttruncatedBy: null,\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: totalLines,\n\t\t\toutputBytes: totalBytes,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: false,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Work backwards from the end\n\tconst outputLinesArr: string[] = [];\n\tlet outputBytesCount = 0;\n\tlet truncatedBy: \"lines\" | \"bytes\" = \"lines\";\n\tlet lastLinePartial = false;\n\n\tfor (let i = lines.length - 1; i >= 0 && outputLinesArr.length < maxLines; i--) {\n\t\tconst line = lines[i];\n\t\tconst lineBytes = utf8ByteLength(line) + (outputLinesArr.length > 0 ? 1 : 0); // +1 for newline\n\n\t\tif (outputBytesCount + lineBytes > maxBytes) {\n\t\t\ttruncatedBy = \"bytes\";\n\t\t\t// Edge case: if we haven't added ANY lines yet and this line exceeds maxBytes,\n\t\t\t// take the end of the line (partial)\n\t\t\tif (outputLinesArr.length === 0) {\n\t\t\t\tconst truncatedLine = truncateStringToBytesFromEnd(line, maxBytes);\n\t\t\t\toutputLinesArr.unshift(truncatedLine);\n\t\t\t\toutputBytesCount = utf8ByteLength(truncatedLine);\n\t\t\t\tlastLinePartial = true;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\toutputLinesArr.unshift(line);\n\t\toutputBytesCount += lineBytes;\n\t}\n\n\t// If we exited due to line limit\n\tif (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {\n\t\ttruncatedBy = \"lines\";\n\t}\n\n\tconst outputContent = outputLinesArr.join(\"\\n\");\n\tconst finalOutputBytes = utf8ByteLength(outputContent);\n\n\treturn {\n\t\tcontent: outputContent,\n\t\ttruncated: true,\n\t\ttruncatedBy,\n\t\ttotalLines,\n\t\ttotalBytes,\n\t\toutputLines: outputLinesArr.length,\n\t\toutputBytes: finalOutputBytes,\n\t\tlastLinePartial,\n\t\tfirstLineExceedsLimit: false,\n\t\tmaxLines,\n\t\tmaxBytes,\n\t};\n}\n\n/**\n * Truncate a string to fit within a byte limit (from the end).\n * Handles multi-byte UTF-8 characters correctly.\n */\nfunction truncateStringToBytesFromEnd(str: string, maxBytes: number): string {\n\tif (maxBytes <= 0) return \"\";\n\n\tlet outputBytes = 0;\n\tlet start = str.length;\n\tlet needsReplacement = false;\n\tfor (let i = str.length; i > 0; ) {\n\t\tlet characterStart = i - 1;\n\t\tconst code = str.charCodeAt(characterStart);\n\t\tlet characterBytes: number;\n\t\tlet unpairedSurrogate = false;\n\t\tif (code >= 0xdc00 && code <= 0xdfff && characterStart > 0) {\n\t\t\tconst previous = str.charCodeAt(characterStart - 1);\n\t\t\tif (previous >= 0xd800 && previous <= 0xdbff) {\n\t\t\t\tcharacterStart--;\n\t\t\t\tcharacterBytes = 4;\n\t\t\t} else {\n\t\t\t\tcharacterBytes = 3;\n\t\t\t\tunpairedSurrogate = true;\n\t\t\t}\n\t\t} else if (code >= 0xd800 && code <= 0xdfff) {\n\t\t\tcharacterBytes = 3;\n\t\t\tunpairedSurrogate = true;\n\t\t} else {\n\t\t\tcharacterBytes = code <= 0x7f ? 1 : code <= 0x7ff ? 2 : 3;\n\t\t}\n\t\tif (outputBytes + characterBytes > maxBytes) break;\n\t\toutputBytes += characterBytes;\n\t\tstart = characterStart;\n\t\tneedsReplacement ||= unpairedSurrogate;\n\t\ti = characterStart;\n\t}\n\n\tconst output = str.slice(start);\n\treturn needsReplacement ? replaceUnpairedSurrogates(output) : output;\n}\n\n/**\n * Truncate a single line to max characters, adding [truncated] suffix.\n * Used for grep match lines.\n */\nexport function truncateLine(\n\tline: string,\n\tmaxChars: number = GREP_MAX_LINE_LENGTH,\n): { text: string; wasTruncated: boolean } {\n\tif (line.length <= maxChars) {\n\t\treturn { text: line, wasTruncated: false };\n\t}\n\treturn { text: `${line.slice(0, maxChars)}... [truncated]`, wasTruncated: true };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"truncate.d.ts","sourceRoot":"","sources":["../../../src/harness/utils/truncate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,iBAAiB,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;CAAE,CAKzC","sourcesContent":["/**\n * Shared truncation utilities for tool outputs.\n *\n * Truncation is based on two independent limits - whichever is hit first wins:\n * - Line limit (default: 2000 lines)\n * - Byte limit (default: 50KB)\n *\n * Never returns partial lines (except bash tail truncation edge case).\n */\n\nexport const DEFAULT_MAX_LINES = 2000;\nexport const DEFAULT_MAX_BYTES = 50 * 1024; // 50KB\nexport const GREP_MAX_LINE_LENGTH = 500; // Max chars per grep match line\n\nexport interface TruncationResult {\n\t/** The truncated content */\n\tcontent: string;\n\t/** Whether truncation occurred */\n\ttruncated: boolean;\n\t/** Which limit was hit: \"lines\", \"bytes\", or null if not truncated */\n\ttruncatedBy: \"lines\" | \"bytes\" | null;\n\t/** Total number of lines in the original content */\n\ttotalLines: number;\n\t/** Total number of bytes in the original content */\n\ttotalBytes: number;\n\t/** Number of complete lines in the truncated output */\n\toutputLines: number;\n\t/** Number of bytes in the truncated output */\n\toutputBytes: number;\n\t/** Whether the last line was partially truncated (only for tail truncation edge case) */\n\tlastLinePartial: boolean;\n\t/** Whether the first line exceeded the byte limit (for head truncation) */\n\tfirstLineExceedsLimit: boolean;\n\t/** The max lines limit that was applied */\n\tmaxLines: number;\n\t/** The max bytes limit that was applied */\n\tmaxBytes: number;\n}\n\nexport interface TruncationOptions {\n\t/** Maximum number of lines (default: 2000) */\n\tmaxLines?: number;\n\t/** Maximum number of bytes (default: 50KB) */\n\tmaxBytes?: number;\n}\n\ninterface RuntimeBuffer {\n\tbyteLength(content: string, encoding: \"utf8\"): number;\n}\n\nconst runtimeBuffer = (globalThis as { Buffer?: RuntimeBuffer }).Buffer;\nconst nonAsciiPattern = /[^\\x00-\\x7f]/;\n\nfunction utf8ByteLength(content: string): number {\n\tif (runtimeBuffer) return runtimeBuffer.byteLength(content, \"utf8\");\n\n\tconst firstNonAscii = content.search(nonAsciiPattern);\n\tif (firstNonAscii === -1) return content.length;\n\n\tlet bytes = firstNonAscii;\n\tfor (let i = firstNonAscii; i < content.length; i++) {\n\t\tconst code = content.charCodeAt(i);\n\t\tif (code <= 0x7f) {\n\t\t\tbytes += 1;\n\t\t} else if (code <= 0x7ff) {\n\t\t\tbytes += 2;\n\t\t} else if (code >= 0xd800 && code <= 0xdbff && i + 1 < content.length) {\n\t\t\tconst next = content.charCodeAt(i + 1);\n\t\t\tif (next >= 0xdc00 && next <= 0xdfff) {\n\t\t\t\tbytes += 4;\n\t\t\t\ti++;\n\t\t\t} else {\n\t\t\t\tbytes += 3;\n\t\t\t}\n\t\t} else {\n\t\t\tbytes += 3;\n\t\t}\n\t}\n\treturn bytes;\n}\n\nfunction replaceUnpairedSurrogates(content: string): string {\n\tlet output = \"\";\n\tfor (let i = 0; i < content.length; i++) {\n\t\tconst code = content.charCodeAt(i);\n\t\tif (code >= 0xd800 && code <= 0xdbff) {\n\t\t\tif (i + 1 < content.length) {\n\t\t\t\tconst next = content.charCodeAt(i + 1);\n\t\t\t\tif (next >= 0xdc00 && next <= 0xdfff) {\n\t\t\t\t\toutput += content[i] + content[i + 1];\n\t\t\t\t\ti++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\toutput += \"�\";\n\t\t} else if (code >= 0xdc00 && code <= 0xdfff) {\n\t\t\toutput += \"�\";\n\t\t} else {\n\t\t\toutput += content[i];\n\t\t}\n\t}\n\treturn output;\n}\n\n/**\n * Format bytes as human-readable size.\n */\nexport function formatSize(bytes: number): string {\n\tif (bytes < 1024) {\n\t\treturn `${bytes}B`;\n\t} else if (bytes < 1024 * 1024) {\n\t\treturn `${(bytes / 1024).toFixed(1)}KB`;\n\t} else {\n\t\treturn `${(bytes / (1024 * 1024)).toFixed(1)}MB`;\n\t}\n}\n\n/**\n * Truncate content from the head (keep first N lines/bytes).\n * Suitable for file reads where you want to see the beginning.\n *\n * Never returns partial lines. If first line exceeds byte limit,\n * returns empty content with firstLineExceedsLimit=true.\n */\nexport function truncateHead(content: string, options: TruncationOptions = {}): TruncationResult {\n\tconst maxLines = options.maxLines ?? DEFAULT_MAX_LINES;\n\tconst maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;\n\n\tconst totalBytes = utf8ByteLength(content);\n\tconst lines = content.split(\"\\n\");\n\tconst totalLines = lines.length;\n\n\t// Check if no truncation needed\n\tif (totalLines <= maxLines && totalBytes <= maxBytes) {\n\t\treturn {\n\t\t\tcontent,\n\t\t\ttruncated: false,\n\t\t\ttruncatedBy: null,\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: totalLines,\n\t\t\toutputBytes: totalBytes,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: false,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Check if first line alone exceeds byte limit\n\tconst firstLineBytes = utf8ByteLength(lines[0]);\n\tif (firstLineBytes > maxBytes) {\n\t\treturn {\n\t\t\tcontent: \"\",\n\t\t\ttruncated: true,\n\t\t\ttruncatedBy: \"bytes\",\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: 0,\n\t\t\toutputBytes: 0,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: true,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Collect complete lines that fit\n\tconst outputLinesArr: string[] = [];\n\tlet outputBytesCount = 0;\n\tlet truncatedBy: \"lines\" | \"bytes\" = \"lines\";\n\n\tfor (let i = 0; i < lines.length && i < maxLines; i++) {\n\t\tconst line = lines[i];\n\t\tconst lineBytes = utf8ByteLength(line) + (i > 0 ? 1 : 0); // +1 for newline\n\n\t\tif (outputBytesCount + lineBytes > maxBytes) {\n\t\t\ttruncatedBy = \"bytes\";\n\t\t\tbreak;\n\t\t}\n\n\t\toutputLinesArr.push(line);\n\t\toutputBytesCount += lineBytes;\n\t}\n\n\t// If we exited due to line limit\n\tif (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {\n\t\ttruncatedBy = \"lines\";\n\t}\n\n\tconst outputContent = outputLinesArr.join(\"\\n\");\n\tconst finalOutputBytes = utf8ByteLength(outputContent);\n\n\treturn {\n\t\tcontent: outputContent,\n\t\ttruncated: true,\n\t\ttruncatedBy,\n\t\ttotalLines,\n\t\ttotalBytes,\n\t\toutputLines: outputLinesArr.length,\n\t\toutputBytes: finalOutputBytes,\n\t\tlastLinePartial: false,\n\t\tfirstLineExceedsLimit: false,\n\t\tmaxLines,\n\t\tmaxBytes,\n\t};\n}\n\n/**\n * Truncate content from the tail (keep last N lines/bytes).\n * Suitable for bash output where you want to see the end (errors, final results).\n *\n * May return partial first line if the last line of original content exceeds byte limit.\n */\nexport function truncateTail(content: string, options: TruncationOptions = {}): TruncationResult {\n\tconst maxLines = options.maxLines ?? DEFAULT_MAX_LINES;\n\tconst maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;\n\n\tconst totalBytes = utf8ByteLength(content);\n\tconst lines = content.split(\"\\n\");\n\tif (lines.length > 1 && lines[lines.length - 1] === \"\") lines.pop();\n\tconst totalLines = lines.length;\n\n\t// Check if no truncation needed\n\tif (totalLines <= maxLines && totalBytes <= maxBytes) {\n\t\treturn {\n\t\t\tcontent,\n\t\t\ttruncated: false,\n\t\t\ttruncatedBy: null,\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: totalLines,\n\t\t\toutputBytes: totalBytes,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: false,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Work backwards from the end\n\tconst outputLinesArr: string[] = [];\n\tlet outputBytesCount = 0;\n\tlet truncatedBy: \"lines\" | \"bytes\" = \"lines\";\n\tlet lastLinePartial = false;\n\n\tfor (let i = lines.length - 1; i >= 0 && outputLinesArr.length < maxLines; i--) {\n\t\tconst line = lines[i];\n\t\tconst lineBytes = utf8ByteLength(line) + (outputLinesArr.length > 0 ? 1 : 0); // +1 for newline\n\n\t\tif (outputBytesCount + lineBytes > maxBytes) {\n\t\t\ttruncatedBy = \"bytes\";\n\t\t\t// Edge case: if we haven't added ANY lines yet and this line exceeds maxBytes,\n\t\t\t// take the end of the line (partial)\n\t\t\tif (outputLinesArr.length === 0) {\n\t\t\t\tconst truncatedLine = truncateStringToBytesFromEnd(line, maxBytes);\n\t\t\t\toutputLinesArr.unshift(truncatedLine);\n\t\t\t\toutputBytesCount = utf8ByteLength(truncatedLine);\n\t\t\t\tlastLinePartial = true;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\toutputLinesArr.unshift(line);\n\t\toutputBytesCount += lineBytes;\n\t}\n\n\t// If we exited due to line limit\n\tif (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {\n\t\ttruncatedBy = \"lines\";\n\t}\n\n\tconst outputContent = outputLinesArr.join(\"\\n\");\n\tconst finalOutputBytes = utf8ByteLength(outputContent);\n\n\treturn {\n\t\tcontent: outputContent,\n\t\ttruncated: true,\n\t\ttruncatedBy,\n\t\ttotalLines,\n\t\ttotalBytes,\n\t\toutputLines: outputLinesArr.length,\n\t\toutputBytes: finalOutputBytes,\n\t\tlastLinePartial,\n\t\tfirstLineExceedsLimit: false,\n\t\tmaxLines,\n\t\tmaxBytes,\n\t};\n}\n\n/**\n * Truncate a string to fit within a byte limit (from the end).\n * Handles multi-byte UTF-8 characters correctly.\n */\nfunction truncateStringToBytesFromEnd(str: string, maxBytes: number): string {\n\tif (maxBytes <= 0) return \"\";\n\n\tlet outputBytes = 0;\n\tlet start = str.length;\n\tlet needsReplacement = false;\n\tfor (let i = str.length; i > 0; ) {\n\t\tlet characterStart = i - 1;\n\t\tconst code = str.charCodeAt(characterStart);\n\t\tlet characterBytes: number;\n\t\tlet unpairedSurrogate = false;\n\t\tif (code >= 0xdc00 && code <= 0xdfff && characterStart > 0) {\n\t\t\tconst previous = str.charCodeAt(characterStart - 1);\n\t\t\tif (previous >= 0xd800 && previous <= 0xdbff) {\n\t\t\t\tcharacterStart--;\n\t\t\t\tcharacterBytes = 4;\n\t\t\t} else {\n\t\t\t\tcharacterBytes = 3;\n\t\t\t\tunpairedSurrogate = true;\n\t\t\t}\n\t\t} else if (code >= 0xd800 && code <= 0xdfff) {\n\t\t\tcharacterBytes = 3;\n\t\t\tunpairedSurrogate = true;\n\t\t} else {\n\t\t\tcharacterBytes = code <= 0x7f ? 1 : code <= 0x7ff ? 2 : 3;\n\t\t}\n\t\tif (outputBytes + characterBytes > maxBytes) break;\n\t\toutputBytes += characterBytes;\n\t\tstart = characterStart;\n\t\tneedsReplacement ||= unpairedSurrogate;\n\t\ti = characterStart;\n\t}\n\n\tconst output = str.slice(start);\n\treturn needsReplacement ? replaceUnpairedSurrogates(output) : output;\n}\n\n/**\n * Truncate a single line to max characters, adding [truncated] suffix.\n * Used for grep match lines.\n */\nexport function truncateLine(\n\tline: string,\n\tmaxChars: number = GREP_MAX_LINE_LENGTH,\n): { text: string; wasTruncated: boolean } {\n\tif (line.length <= maxChars) {\n\t\treturn { text: line, wasTruncated: false };\n\t}\n\treturn { text: `${line.slice(0, maxChars)}... [truncated]`, wasTruncated: true };\n}\n"]}
|
|
@@ -172,6 +172,8 @@ export function truncateTail(content, options = {}) {
|
|
|
172
172
|
const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
|
|
173
173
|
const totalBytes = utf8ByteLength(content);
|
|
174
174
|
const lines = content.split("\n");
|
|
175
|
+
if (lines.length > 1 && lines[lines.length - 1] === "")
|
|
176
|
+
lines.pop();
|
|
175
177
|
const totalLines = lines.length;
|
|
176
178
|
// Check if no truncation needed
|
|
177
179
|
if (totalLines <= maxLines && totalBytes <= maxBytes) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"truncate.js","sourceRoot":"","sources":["../../../src/harness/utils/truncate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AACtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EA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AAc,CAAC;IACpB,CAAC;IAED,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO,gBAAgB,CAAC,CAAC,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AAAA,CACrE;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC3B,IAAY,EACZ,QAAQ,GAAW,oBAAoB,EACG;IAC1C,IAAI,IAAI,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC7B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IAC5C,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,iBAAiB,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;AAAA,CACjF","sourcesContent":["/**\n * Shared truncation utilities for tool outputs.\n *\n * Truncation is based on two independent limits - whichever is hit first wins:\n * - Line limit (default: 2000 lines)\n * - Byte limit (default: 50KB)\n *\n * Never returns partial lines (except bash tail truncation edge case).\n */\n\nexport const DEFAULT_MAX_LINES = 2000;\nexport const DEFAULT_MAX_BYTES = 50 * 1024; // 50KB\nexport const GREP_MAX_LINE_LENGTH = 500; // Max chars per grep match line\n\nexport interface TruncationResult {\n\t/** The truncated content */\n\tcontent: string;\n\t/** Whether truncation occurred */\n\ttruncated: boolean;\n\t/** Which limit was hit: \"lines\", \"bytes\", or null if not truncated */\n\ttruncatedBy: \"lines\" | \"bytes\" | null;\n\t/** Total number of lines in the original content */\n\ttotalLines: number;\n\t/** Total number of bytes in the original content */\n\ttotalBytes: number;\n\t/** Number of complete lines in the truncated output */\n\toutputLines: number;\n\t/** Number of bytes in the truncated output */\n\toutputBytes: number;\n\t/** Whether the last line was partially truncated (only for tail truncation edge case) */\n\tlastLinePartial: boolean;\n\t/** Whether the first line exceeded the byte limit (for head truncation) */\n\tfirstLineExceedsLimit: boolean;\n\t/** The max lines limit that was applied */\n\tmaxLines: number;\n\t/** The max bytes limit that was applied */\n\tmaxBytes: number;\n}\n\nexport interface TruncationOptions {\n\t/** Maximum number of lines (default: 2000) */\n\tmaxLines?: number;\n\t/** Maximum number of bytes (default: 50KB) */\n\tmaxBytes?: number;\n}\n\ninterface RuntimeBuffer {\n\tbyteLength(content: string, encoding: \"utf8\"): number;\n}\n\nconst runtimeBuffer = (globalThis as { Buffer?: RuntimeBuffer }).Buffer;\nconst nonAsciiPattern = /[^\\x00-\\x7f]/;\n\nfunction utf8ByteLength(content: string): number {\n\tif (runtimeBuffer) return runtimeBuffer.byteLength(content, \"utf8\");\n\n\tconst firstNonAscii = content.search(nonAsciiPattern);\n\tif (firstNonAscii === -1) return content.length;\n\n\tlet bytes = firstNonAscii;\n\tfor (let i = firstNonAscii; i < content.length; i++) {\n\t\tconst code = content.charCodeAt(i);\n\t\tif (code <= 0x7f) {\n\t\t\tbytes += 1;\n\t\t} else if (code <= 0x7ff) {\n\t\t\tbytes += 2;\n\t\t} else if (code >= 0xd800 && code <= 0xdbff && i + 1 < content.length) {\n\t\t\tconst next = content.charCodeAt(i + 1);\n\t\t\tif (next >= 0xdc00 && next <= 0xdfff) {\n\t\t\t\tbytes += 4;\n\t\t\t\ti++;\n\t\t\t} else {\n\t\t\t\tbytes += 3;\n\t\t\t}\n\t\t} else {\n\t\t\tbytes += 3;\n\t\t}\n\t}\n\treturn bytes;\n}\n\nfunction replaceUnpairedSurrogates(content: string): string {\n\tlet output = \"\";\n\tfor (let i = 0; i < content.length; i++) {\n\t\tconst code = content.charCodeAt(i);\n\t\tif (code >= 0xd800 && code <= 0xdbff) {\n\t\t\tif (i + 1 < content.length) {\n\t\t\t\tconst next = content.charCodeAt(i + 1);\n\t\t\t\tif (next >= 0xdc00 && next <= 0xdfff) {\n\t\t\t\t\toutput += content[i] + content[i + 1];\n\t\t\t\t\ti++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\toutput += \"�\";\n\t\t} else if (code >= 0xdc00 && code <= 0xdfff) {\n\t\t\toutput += \"�\";\n\t\t} else {\n\t\t\toutput += content[i];\n\t\t}\n\t}\n\treturn output;\n}\n\n/**\n * Format bytes as human-readable size.\n */\nexport function formatSize(bytes: number): string {\n\tif (bytes < 1024) {\n\t\treturn `${bytes}B`;\n\t} else if (bytes < 1024 * 1024) {\n\t\treturn `${(bytes / 1024).toFixed(1)}KB`;\n\t} else {\n\t\treturn `${(bytes / (1024 * 1024)).toFixed(1)}MB`;\n\t}\n}\n\n/**\n * Truncate content from the head (keep first N lines/bytes).\n * Suitable for file reads where you want to see the beginning.\n *\n * Never returns partial lines. If first line exceeds byte limit,\n * returns empty content with firstLineExceedsLimit=true.\n */\nexport function truncateHead(content: string, options: TruncationOptions = {}): TruncationResult {\n\tconst maxLines = options.maxLines ?? DEFAULT_MAX_LINES;\n\tconst maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;\n\n\tconst totalBytes = utf8ByteLength(content);\n\tconst lines = content.split(\"\\n\");\n\tconst totalLines = lines.length;\n\n\t// Check if no truncation needed\n\tif (totalLines <= maxLines && totalBytes <= maxBytes) {\n\t\treturn {\n\t\t\tcontent,\n\t\t\ttruncated: false,\n\t\t\ttruncatedBy: null,\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: totalLines,\n\t\t\toutputBytes: totalBytes,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: false,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Check if first line alone exceeds byte limit\n\tconst firstLineBytes = utf8ByteLength(lines[0]);\n\tif (firstLineBytes > maxBytes) {\n\t\treturn {\n\t\t\tcontent: \"\",\n\t\t\ttruncated: true,\n\t\t\ttruncatedBy: \"bytes\",\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: 0,\n\t\t\toutputBytes: 0,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: true,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Collect complete lines that fit\n\tconst outputLinesArr: string[] = [];\n\tlet outputBytesCount = 0;\n\tlet truncatedBy: \"lines\" | \"bytes\" = \"lines\";\n\n\tfor (let i = 0; i < lines.length && i < maxLines; i++) {\n\t\tconst line = lines[i];\n\t\tconst lineBytes = utf8ByteLength(line) + (i > 0 ? 1 : 0); // +1 for newline\n\n\t\tif (outputBytesCount + lineBytes > maxBytes) {\n\t\t\ttruncatedBy = \"bytes\";\n\t\t\tbreak;\n\t\t}\n\n\t\toutputLinesArr.push(line);\n\t\toutputBytesCount += lineBytes;\n\t}\n\n\t// If we exited due to line limit\n\tif (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {\n\t\ttruncatedBy = \"lines\";\n\t}\n\n\tconst outputContent = outputLinesArr.join(\"\\n\");\n\tconst finalOutputBytes = utf8ByteLength(outputContent);\n\n\treturn {\n\t\tcontent: outputContent,\n\t\ttruncated: true,\n\t\ttruncatedBy,\n\t\ttotalLines,\n\t\ttotalBytes,\n\t\toutputLines: outputLinesArr.length,\n\t\toutputBytes: finalOutputBytes,\n\t\tlastLinePartial: false,\n\t\tfirstLineExceedsLimit: false,\n\t\tmaxLines,\n\t\tmaxBytes,\n\t};\n}\n\n/**\n * Truncate content from the tail (keep last N lines/bytes).\n * Suitable for bash output where you want to see the end (errors, final results).\n *\n * May return partial first line if the last line of original content exceeds byte limit.\n */\nexport function truncateTail(content: string, options: TruncationOptions = {}): TruncationResult {\n\tconst maxLines = options.maxLines ?? DEFAULT_MAX_LINES;\n\tconst maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;\n\n\tconst totalBytes = utf8ByteLength(content);\n\tconst lines = content.split(\"\\n\");\n\tconst totalLines = lines.length;\n\n\t// Check if no truncation needed\n\tif (totalLines <= maxLines && totalBytes <= maxBytes) {\n\t\treturn {\n\t\t\tcontent,\n\t\t\ttruncated: false,\n\t\t\ttruncatedBy: null,\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: totalLines,\n\t\t\toutputBytes: totalBytes,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: false,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Work backwards from the end\n\tconst outputLinesArr: string[] = [];\n\tlet outputBytesCount = 0;\n\tlet truncatedBy: \"lines\" | \"bytes\" = \"lines\";\n\tlet lastLinePartial = false;\n\n\tfor (let i = lines.length - 1; i >= 0 && outputLinesArr.length < maxLines; i--) {\n\t\tconst line = lines[i];\n\t\tconst lineBytes = utf8ByteLength(line) + (outputLinesArr.length > 0 ? 1 : 0); // +1 for newline\n\n\t\tif (outputBytesCount + lineBytes > maxBytes) {\n\t\t\ttruncatedBy = \"bytes\";\n\t\t\t// Edge case: if we haven't added ANY lines yet and this line exceeds maxBytes,\n\t\t\t// take the end of the line (partial)\n\t\t\tif (outputLinesArr.length === 0) {\n\t\t\t\tconst truncatedLine = truncateStringToBytesFromEnd(line, maxBytes);\n\t\t\t\toutputLinesArr.unshift(truncatedLine);\n\t\t\t\toutputBytesCount = utf8ByteLength(truncatedLine);\n\t\t\t\tlastLinePartial = true;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\toutputLinesArr.unshift(line);\n\t\toutputBytesCount += lineBytes;\n\t}\n\n\t// If we exited due to line limit\n\tif (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {\n\t\ttruncatedBy = \"lines\";\n\t}\n\n\tconst outputContent = outputLinesArr.join(\"\\n\");\n\tconst finalOutputBytes = utf8ByteLength(outputContent);\n\n\treturn {\n\t\tcontent: outputContent,\n\t\ttruncated: true,\n\t\ttruncatedBy,\n\t\ttotalLines,\n\t\ttotalBytes,\n\t\toutputLines: outputLinesArr.length,\n\t\toutputBytes: finalOutputBytes,\n\t\tlastLinePartial,\n\t\tfirstLineExceedsLimit: false,\n\t\tmaxLines,\n\t\tmaxBytes,\n\t};\n}\n\n/**\n * Truncate a string to fit within a byte limit (from the end).\n * Handles multi-byte UTF-8 characters correctly.\n */\nfunction truncateStringToBytesFromEnd(str: string, maxBytes: number): string {\n\tif (maxBytes <= 0) return \"\";\n\n\tlet outputBytes = 0;\n\tlet start = str.length;\n\tlet needsReplacement = false;\n\tfor (let i = str.length; i > 0; ) {\n\t\tlet characterStart = i - 1;\n\t\tconst code = str.charCodeAt(characterStart);\n\t\tlet characterBytes: number;\n\t\tlet unpairedSurrogate = false;\n\t\tif (code >= 0xdc00 && code <= 0xdfff && characterStart > 0) {\n\t\t\tconst previous = str.charCodeAt(characterStart - 1);\n\t\t\tif (previous >= 0xd800 && previous <= 0xdbff) {\n\t\t\t\tcharacterStart--;\n\t\t\t\tcharacterBytes = 4;\n\t\t\t} else {\n\t\t\t\tcharacterBytes = 3;\n\t\t\t\tunpairedSurrogate = true;\n\t\t\t}\n\t\t} else if (code >= 0xd800 && code <= 0xdfff) {\n\t\t\tcharacterBytes = 3;\n\t\t\tunpairedSurrogate = true;\n\t\t} else {\n\t\t\tcharacterBytes = code <= 0x7f ? 1 : code <= 0x7ff ? 2 : 3;\n\t\t}\n\t\tif (outputBytes + characterBytes > maxBytes) break;\n\t\toutputBytes += characterBytes;\n\t\tstart = characterStart;\n\t\tneedsReplacement ||= unpairedSurrogate;\n\t\ti = characterStart;\n\t}\n\n\tconst output = str.slice(start);\n\treturn needsReplacement ? replaceUnpairedSurrogates(output) : output;\n}\n\n/**\n * Truncate a single line to max characters, adding [truncated] suffix.\n * Used for grep match lines.\n */\nexport function truncateLine(\n\tline: string,\n\tmaxChars: number = GREP_MAX_LINE_LENGTH,\n): { text: string; wasTruncated: boolean } {\n\tif (line.length <= maxChars) {\n\t\treturn { text: line, wasTruncated: false };\n\t}\n\treturn { text: `${line.slice(0, maxChars)}... [truncated]`, wasTruncated: true };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"truncate.js","sourceRo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AAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,CAAC;QACD,IAAI,WAAW,GAAG,cAAc,GAAG,QAAQ;YAAE,MAAM;QACnD,WAAW,IAAI,cAAc,CAAC;QAC9B,KAAK,GAAG,cAAc,CAAC;QACvB,gBAAgB,KAAK,iBAAiB,CAAC;QACvC,CAAC,GAAG,cAAc,CAAC;IACpB,CAAC;IAED,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO,gBAAgB,CAAC,CAAC,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AAAA,CACrE;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC3B,IAAY,EACZ,QAAQ,GAAW,oBAAoB,EACG;IAC1C,IAAI,IAAI,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC7B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IAC5C,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,iBAAiB,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;AAAA,CACjF","sourcesContent":["/**\n * Shared truncation utilities for tool outputs.\n *\n * Truncation is based on two independent limits - whichever is hit first wins:\n * - Line limit (default: 2000 lines)\n * - Byte limit (default: 50KB)\n *\n * Never returns partial lines (except bash tail truncation edge case).\n */\n\nexport const DEFAULT_MAX_LINES = 2000;\nexport const DEFAULT_MAX_BYTES = 50 * 1024; // 50KB\nexport const GREP_MAX_LINE_LENGTH = 500; // Max chars per grep match line\n\nexport interface TruncationResult {\n\t/** The truncated content */\n\tcontent: string;\n\t/** Whether truncation occurred */\n\ttruncated: boolean;\n\t/** Which limit was hit: \"lines\", \"bytes\", or null if not truncated */\n\ttruncatedBy: \"lines\" | \"bytes\" | null;\n\t/** Total number of lines in the original content */\n\ttotalLines: number;\n\t/** Total number of bytes in the original content */\n\ttotalBytes: number;\n\t/** Number of complete lines in the truncated output */\n\toutputLines: number;\n\t/** Number of bytes in the truncated output */\n\toutputBytes: number;\n\t/** Whether the last line was partially truncated (only for tail truncation edge case) */\n\tlastLinePartial: boolean;\n\t/** Whether the first line exceeded the byte limit (for head truncation) */\n\tfirstLineExceedsLimit: boolean;\n\t/** The max lines limit that was applied */\n\tmaxLines: number;\n\t/** The max bytes limit that was applied */\n\tmaxBytes: number;\n}\n\nexport interface TruncationOptions {\n\t/** Maximum number of lines (default: 2000) */\n\tmaxLines?: number;\n\t/** Maximum number of bytes (default: 50KB) */\n\tmaxBytes?: number;\n}\n\ninterface RuntimeBuffer {\n\tbyteLength(content: string, encoding: \"utf8\"): number;\n}\n\nconst runtimeBuffer = (globalThis as { Buffer?: RuntimeBuffer }).Buffer;\nconst nonAsciiPattern = /[^\\x00-\\x7f]/;\n\nfunction utf8ByteLength(content: string): number {\n\tif (runtimeBuffer) return runtimeBuffer.byteLength(content, \"utf8\");\n\n\tconst firstNonAscii = content.search(nonAsciiPattern);\n\tif (firstNonAscii === -1) return content.length;\n\n\tlet bytes = firstNonAscii;\n\tfor (let i = firstNonAscii; i < content.length; i++) {\n\t\tconst code = content.charCodeAt(i);\n\t\tif (code <= 0x7f) {\n\t\t\tbytes += 1;\n\t\t} else if (code <= 0x7ff) {\n\t\t\tbytes += 2;\n\t\t} else if (code >= 0xd800 && code <= 0xdbff && i + 1 < content.length) {\n\t\t\tconst next = content.charCodeAt(i + 1);\n\t\t\tif (next >= 0xdc00 && next <= 0xdfff) {\n\t\t\t\tbytes += 4;\n\t\t\t\ti++;\n\t\t\t} else {\n\t\t\t\tbytes += 3;\n\t\t\t}\n\t\t} else {\n\t\t\tbytes += 3;\n\t\t}\n\t}\n\treturn bytes;\n}\n\nfunction replaceUnpairedSurrogates(content: string): string {\n\tlet output = \"\";\n\tfor (let i = 0; i < content.length; i++) {\n\t\tconst code = content.charCodeAt(i);\n\t\tif (code >= 0xd800 && code <= 0xdbff) {\n\t\t\tif (i + 1 < content.length) {\n\t\t\t\tconst next = content.charCodeAt(i + 1);\n\t\t\t\tif (next >= 0xdc00 && next <= 0xdfff) {\n\t\t\t\t\toutput += content[i] + content[i + 1];\n\t\t\t\t\ti++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\toutput += \"�\";\n\t\t} else if (code >= 0xdc00 && code <= 0xdfff) {\n\t\t\toutput += \"�\";\n\t\t} else {\n\t\t\toutput += content[i];\n\t\t}\n\t}\n\treturn output;\n}\n\n/**\n * Format bytes as human-readable size.\n */\nexport function formatSize(bytes: number): string {\n\tif (bytes < 1024) {\n\t\treturn `${bytes}B`;\n\t} else if (bytes < 1024 * 1024) {\n\t\treturn `${(bytes / 1024).toFixed(1)}KB`;\n\t} else {\n\t\treturn `${(bytes / (1024 * 1024)).toFixed(1)}MB`;\n\t}\n}\n\n/**\n * Truncate content from the head (keep first N lines/bytes).\n * Suitable for file reads where you want to see the beginning.\n *\n * Never returns partial lines. If first line exceeds byte limit,\n * returns empty content with firstLineExceedsLimit=true.\n */\nexport function truncateHead(content: string, options: TruncationOptions = {}): TruncationResult {\n\tconst maxLines = options.maxLines ?? DEFAULT_MAX_LINES;\n\tconst maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;\n\n\tconst totalBytes = utf8ByteLength(content);\n\tconst lines = content.split(\"\\n\");\n\tconst totalLines = lines.length;\n\n\t// Check if no truncation needed\n\tif (totalLines <= maxLines && totalBytes <= maxBytes) {\n\t\treturn {\n\t\t\tcontent,\n\t\t\ttruncated: false,\n\t\t\ttruncatedBy: null,\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: totalLines,\n\t\t\toutputBytes: totalBytes,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: false,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Check if first line alone exceeds byte limit\n\tconst firstLineBytes = utf8ByteLength(lines[0]);\n\tif (firstLineBytes > maxBytes) {\n\t\treturn {\n\t\t\tcontent: \"\",\n\t\t\ttruncated: true,\n\t\t\ttruncatedBy: \"bytes\",\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: 0,\n\t\t\toutputBytes: 0,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: true,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Collect complete lines that fit\n\tconst outputLinesArr: string[] = [];\n\tlet outputBytesCount = 0;\n\tlet truncatedBy: \"lines\" | \"bytes\" = \"lines\";\n\n\tfor (let i = 0; i < lines.length && i < maxLines; i++) {\n\t\tconst line = lines[i];\n\t\tconst lineBytes = utf8ByteLength(line) + (i > 0 ? 1 : 0); // +1 for newline\n\n\t\tif (outputBytesCount + lineBytes > maxBytes) {\n\t\t\ttruncatedBy = \"bytes\";\n\t\t\tbreak;\n\t\t}\n\n\t\toutputLinesArr.push(line);\n\t\toutputBytesCount += lineBytes;\n\t}\n\n\t// If we exited due to line limit\n\tif (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {\n\t\ttruncatedBy = \"lines\";\n\t}\n\n\tconst outputContent = outputLinesArr.join(\"\\n\");\n\tconst finalOutputBytes = utf8ByteLength(outputContent);\n\n\treturn {\n\t\tcontent: outputContent,\n\t\ttruncated: true,\n\t\ttruncatedBy,\n\t\ttotalLines,\n\t\ttotalBytes,\n\t\toutputLines: outputLinesArr.length,\n\t\toutputBytes: finalOutputBytes,\n\t\tlastLinePartial: false,\n\t\tfirstLineExceedsLimit: false,\n\t\tmaxLines,\n\t\tmaxBytes,\n\t};\n}\n\n/**\n * Truncate content from the tail (keep last N lines/bytes).\n * Suitable for bash output where you want to see the end (errors, final results).\n *\n * May return partial first line if the last line of original content exceeds byte limit.\n */\nexport function truncateTail(content: string, options: TruncationOptions = {}): TruncationResult {\n\tconst maxLines = options.maxLines ?? DEFAULT_MAX_LINES;\n\tconst maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;\n\n\tconst totalBytes = utf8ByteLength(content);\n\tconst lines = content.split(\"\\n\");\n\tif (lines.length > 1 && lines[lines.length - 1] === \"\") lines.pop();\n\tconst totalLines = lines.length;\n\n\t// Check if no truncation needed\n\tif (totalLines <= maxLines && totalBytes <= maxBytes) {\n\t\treturn {\n\t\t\tcontent,\n\t\t\ttruncated: false,\n\t\t\ttruncatedBy: null,\n\t\t\ttotalLines,\n\t\t\ttotalBytes,\n\t\t\toutputLines: totalLines,\n\t\t\toutputBytes: totalBytes,\n\t\t\tlastLinePartial: false,\n\t\t\tfirstLineExceedsLimit: false,\n\t\t\tmaxLines,\n\t\t\tmaxBytes,\n\t\t};\n\t}\n\n\t// Work backwards from the end\n\tconst outputLinesArr: string[] = [];\n\tlet outputBytesCount = 0;\n\tlet truncatedBy: \"lines\" | \"bytes\" = \"lines\";\n\tlet lastLinePartial = false;\n\n\tfor (let i = lines.length - 1; i >= 0 && outputLinesArr.length < maxLines; i--) {\n\t\tconst line = lines[i];\n\t\tconst lineBytes = utf8ByteLength(line) + (outputLinesArr.length > 0 ? 1 : 0); // +1 for newline\n\n\t\tif (outputBytesCount + lineBytes > maxBytes) {\n\t\t\ttruncatedBy = \"bytes\";\n\t\t\t// Edge case: if we haven't added ANY lines yet and this line exceeds maxBytes,\n\t\t\t// take the end of the line (partial)\n\t\t\tif (outputLinesArr.length === 0) {\n\t\t\t\tconst truncatedLine = truncateStringToBytesFromEnd(line, maxBytes);\n\t\t\t\toutputLinesArr.unshift(truncatedLine);\n\t\t\t\toutputBytesCount = utf8ByteLength(truncatedLine);\n\t\t\t\tlastLinePartial = true;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\toutputLinesArr.unshift(line);\n\t\toutputBytesCount += lineBytes;\n\t}\n\n\t// If we exited due to line limit\n\tif (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {\n\t\ttruncatedBy = \"lines\";\n\t}\n\n\tconst outputContent = outputLinesArr.join(\"\\n\");\n\tconst finalOutputBytes = utf8ByteLength(outputContent);\n\n\treturn {\n\t\tcontent: outputContent,\n\t\ttruncated: true,\n\t\ttruncatedBy,\n\t\ttotalLines,\n\t\ttotalBytes,\n\t\toutputLines: outputLinesArr.length,\n\t\toutputBytes: finalOutputBytes,\n\t\tlastLinePartial,\n\t\tfirstLineExceedsLimit: false,\n\t\tmaxLines,\n\t\tmaxBytes,\n\t};\n}\n\n/**\n * Truncate a string to fit within a byte limit (from the end).\n * Handles multi-byte UTF-8 characters correctly.\n */\nfunction truncateStringToBytesFromEnd(str: string, maxBytes: number): string {\n\tif (maxBytes <= 0) return \"\";\n\n\tlet outputBytes = 0;\n\tlet start = str.length;\n\tlet needsReplacement = false;\n\tfor (let i = str.length; i > 0; ) {\n\t\tlet characterStart = i - 1;\n\t\tconst code = str.charCodeAt(characterStart);\n\t\tlet characterBytes: number;\n\t\tlet unpairedSurrogate = false;\n\t\tif (code >= 0xdc00 && code <= 0xdfff && characterStart > 0) {\n\t\t\tconst previous = str.charCodeAt(characterStart - 1);\n\t\t\tif (previous >= 0xd800 && previous <= 0xdbff) {\n\t\t\t\tcharacterStart--;\n\t\t\t\tcharacterBytes = 4;\n\t\t\t} else {\n\t\t\t\tcharacterBytes = 3;\n\t\t\t\tunpairedSurrogate = true;\n\t\t\t}\n\t\t} else if (code >= 0xd800 && code <= 0xdfff) {\n\t\t\tcharacterBytes = 3;\n\t\t\tunpairedSurrogate = true;\n\t\t} else {\n\t\t\tcharacterBytes = code <= 0x7f ? 1 : code <= 0x7ff ? 2 : 3;\n\t\t}\n\t\tif (outputBytes + characterBytes > maxBytes) break;\n\t\toutputBytes += characterBytes;\n\t\tstart = characterStart;\n\t\tneedsReplacement ||= unpairedSurrogate;\n\t\ti = characterStart;\n\t}\n\n\tconst output = str.slice(start);\n\treturn needsReplacement ? replaceUnpairedSurrogates(output) : output;\n}\n\n/**\n * Truncate a single line to max characters, adding [truncated] suffix.\n * Used for grep match lines.\n */\nexport function truncateLine(\n\tline: string,\n\tmaxChars: number = GREP_MAX_LINE_LENGTH,\n): { text: string; wasTruncated: boolean } {\n\tif (line.length <= maxChars) {\n\t\treturn { text: line, wasTruncated: false };\n\t}\n\treturn { text: `${line.slice(0, maxChars)}... [truncated]`, wasTruncated: true };\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@earendil-works/pi-agent-core",
|
|
3
|
-
"version": "0.75.
|
|
3
|
+
"version": "0.75.3",
|
|
4
4
|
"description": "General-purpose agent with transport abstraction, state management, and attachment support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"prepublishOnly": "npm run clean && npm run build"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@earendil-works/pi-ai": "^0.75.
|
|
33
|
+
"@earendil-works/pi-ai": "^0.75.3",
|
|
34
34
|
"ignore": "^7.0.5",
|
|
35
35
|
"typebox": "^1.1.24",
|
|
36
36
|
"yaml": "^2.8.2"
|
|
@@ -420,6 +420,21 @@ export declare const IMAGE_MODELS: {
|
|
|
420
420
|
cacheWrite: number;
|
|
421
421
|
};
|
|
422
422
|
};
|
|
423
|
+
readonly "x-ai/grok-imagine-image-quality": {
|
|
424
|
+
id: string;
|
|
425
|
+
name: string;
|
|
426
|
+
api: "openrouter-images";
|
|
427
|
+
provider: string;
|
|
428
|
+
baseUrl: string;
|
|
429
|
+
input: ("image" | "text")[];
|
|
430
|
+
output: "image"[];
|
|
431
|
+
cost: {
|
|
432
|
+
input: number;
|
|
433
|
+
output: number;
|
|
434
|
+
cacheRead: number;
|
|
435
|
+
cacheWrite: number;
|
|
436
|
+
};
|
|
437
|
+
};
|
|
423
438
|
};
|
|
424
439
|
};
|
|
425
440
|
//# sourceMappingURL=image-models.generated.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-models.generated.d.ts","sourceRoot":"","sources":["../src/image-models.generated.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuakD,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-image-models.ts\n// Do not edit manually - run 'npm run generate-image-models' to update\n\nimport type { ImagesApi, ImagesModel } from \"./types.js\";\n\nexport const IMAGE_MODELS = {\n\t\"openrouter\": {\n\t\t\"black-forest-labs/flux.2-flex\": {\n\t\t\tid: \"black-forest-labs/flux.2-flex\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Flex\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"black-forest-labs/flux.2-klein-4b\": {\n\t\t\tid: \"black-forest-labs/flux.2-klein-4b\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Klein 4B\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"black-forest-labs/flux.2-max\": {\n\t\t\tid: \"black-forest-labs/flux.2-max\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Max\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"black-forest-labs/flux.2-pro\": {\n\t\t\tid: \"black-forest-labs/flux.2-pro\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"bytedance-seed/seedream-4.5\": {\n\t\t\tid: \"bytedance-seed/seedream-4.5\",\n\t\t\tname: \"ByteDance Seed: Seedream 4.5\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-2.5-flash-image\": {\n\t\t\tid: \"google/gemini-2.5-flash-image\",\n\t\t\tname: \"Google: Nano Banana (Gemini 2.5 Flash Image)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 0.3,\n\t \"output\": 2.5,\n\t \"cacheRead\": 0.03,\n\t \"cacheWrite\": 0.08333333333333334\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-3-pro-image-preview\": {\n\t\t\tid: \"google/gemini-3-pro-image-preview\",\n\t\t\tname: \"Google: Nano Banana Pro (Gemini 3 Pro Image Preview)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 2,\n\t \"output\": 12,\n\t \"cacheRead\": 0.19999999999999998,\n\t \"cacheWrite\": 0.375\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-3.1-flash-image-preview\": {\n\t\t\tid: \"google/gemini-3.1-flash-image-preview\",\n\t\t\tname: \"Google: Nano Banana 2 (Gemini 3.1 Flash Image Preview)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 0.5,\n\t \"output\": 3,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-5-image\": {\n\t\t\tid: \"openai/gpt-5-image\",\n\t\t\tname: \"OpenAI: GPT-5 Image\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 10,\n\t \"output\": 10,\n\t \"cacheRead\": 1.25,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-5-image-mini\": {\n\t\t\tid: \"openai/gpt-5-image-mini\",\n\t\t\tname: \"OpenAI: GPT-5 Image Mini\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 2.5,\n\t \"output\": 2,\n\t \"cacheRead\": 0.25,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-5.4-image-2\": {\n\t\t\tid: \"openai/gpt-5.4-image-2\",\n\t\t\tname: \"OpenAI: GPT-5.4 Image 2\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 8,\n\t \"output\": 15,\n\t \"cacheRead\": 2,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openrouter/auto\": {\n\t\t\tid: \"openrouter/auto\",\n\t\t\tname: \"Auto Router\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"text\",\"image\"],\n\t\t\tcost: \t{\n\t \"input\": -1000000,\n\t \"output\": -1000000,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v3\": {\n\t\t\tid: \"recraft/recraft-v3\",\n\t\t\tname: \"Recraft: Recraft V3\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4\": {\n\t\t\tid: \"recraft/recraft-v4\",\n\t\t\tname: \"Recraft: Recraft V4\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4-pro\": {\n\t\t\tid: \"recraft/recraft-v4-pro\",\n\t\t\tname: \"Recraft: Recraft V4 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4-pro-vector\": {\n\t\t\tid: \"recraft/recraft-v4-pro-vector\",\n\t\t\tname: \"Recraft: Recraft V4 Pro Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4-vector\": {\n\t\t\tid: \"recraft/recraft-v4-vector\",\n\t\t\tname: \"Recraft: Recraft V4 Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1\": {\n\t\t\tid: \"recraft/recraft-v4.1\",\n\t\t\tname: \"Recraft: Recraft V4.1\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-pro\": {\n\t\t\tid: \"recraft/recraft-v4.1-pro\",\n\t\t\tname: \"Recraft: Recraft V4.1 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-pro-vector\": {\n\t\t\tid: \"recraft/recraft-v4.1-pro-vector\",\n\t\t\tname: \"Recraft: Recraft V4.1 Pro Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-utility\": {\n\t\t\tid: \"recraft/recraft-v4.1-utility\",\n\t\t\tname: \"Recraft: Recraft V4.1 Utility\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-utility-pro\": {\n\t\t\tid: \"recraft/recraft-v4.1-utility-pro\",\n\t\t\tname: \"Recraft: Recraft V4.1 Utility Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-vector\": {\n\t\t\tid: \"recraft/recraft-v4.1-vector\",\n\t\t\tname: \"Recraft: Recraft V4.1 Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-fast\": {\n\t\t\tid: \"sourceful/riverflow-v2-fast\",\n\t\t\tname: \"Sourceful: Riverflow V2 Fast\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-fast-preview\": {\n\t\t\tid: \"sourceful/riverflow-v2-fast-preview\",\n\t\t\tname: \"Sourceful: Riverflow V2 Fast Preview\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-max-preview\": {\n\t\t\tid: \"sourceful/riverflow-v2-max-preview\",\n\t\t\tname: \"Sourceful: Riverflow V2 Max Preview\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-pro\": {\n\t\t\tid: \"sourceful/riverflow-v2-pro\",\n\t\t\tname: \"Sourceful: Riverflow V2 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-standard-preview\": {\n\t\t\tid: \"sourceful/riverflow-v2-standard-preview\",\n\t\t\tname: \"Sourceful: Riverflow V2 Standard Preview\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t},\n} as const satisfies Record<string, Record<string, ImagesModel<ImagesApi>>>;\n"]}
|
|
1
|
+
{"version":3,"file":"image-models.generated.d.ts","sourceRoot":"","sources":["../src/image-models.generated.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsbkD,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-image-models.ts\n// Do not edit manually - run 'npm run generate-image-models' to update\n\nimport type { ImagesApi, ImagesModel } from \"./types.js\";\n\nexport const IMAGE_MODELS = {\n\t\"openrouter\": {\n\t\t\"black-forest-labs/flux.2-flex\": {\n\t\t\tid: \"black-forest-labs/flux.2-flex\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Flex\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"black-forest-labs/flux.2-klein-4b\": {\n\t\t\tid: \"black-forest-labs/flux.2-klein-4b\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Klein 4B\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"black-forest-labs/flux.2-max\": {\n\t\t\tid: \"black-forest-labs/flux.2-max\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Max\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"black-forest-labs/flux.2-pro\": {\n\t\t\tid: \"black-forest-labs/flux.2-pro\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"bytedance-seed/seedream-4.5\": {\n\t\t\tid: \"bytedance-seed/seedream-4.5\",\n\t\t\tname: \"ByteDance Seed: Seedream 4.5\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-2.5-flash-image\": {\n\t\t\tid: \"google/gemini-2.5-flash-image\",\n\t\t\tname: \"Google: Nano Banana (Gemini 2.5 Flash Image)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 0.3,\n\t \"output\": 2.5,\n\t \"cacheRead\": 0.03,\n\t \"cacheWrite\": 0.08333333333333334\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-3-pro-image-preview\": {\n\t\t\tid: \"google/gemini-3-pro-image-preview\",\n\t\t\tname: \"Google: Nano Banana Pro (Gemini 3 Pro Image Preview)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 2,\n\t \"output\": 12,\n\t \"cacheRead\": 0.19999999999999998,\n\t \"cacheWrite\": 0.375\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-3.1-flash-image-preview\": {\n\t\t\tid: \"google/gemini-3.1-flash-image-preview\",\n\t\t\tname: \"Google: Nano Banana 2 (Gemini 3.1 Flash Image Preview)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 0.5,\n\t \"output\": 3,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-5-image\": {\n\t\t\tid: \"openai/gpt-5-image\",\n\t\t\tname: \"OpenAI: GPT-5 Image\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 10,\n\t \"output\": 10,\n\t \"cacheRead\": 1.25,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-5-image-mini\": {\n\t\t\tid: \"openai/gpt-5-image-mini\",\n\t\t\tname: \"OpenAI: GPT-5 Image Mini\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 2.5,\n\t \"output\": 2,\n\t \"cacheRead\": 0.25,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-5.4-image-2\": {\n\t\t\tid: \"openai/gpt-5.4-image-2\",\n\t\t\tname: \"OpenAI: GPT-5.4 Image 2\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 8,\n\t \"output\": 15,\n\t \"cacheRead\": 2,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openrouter/auto\": {\n\t\t\tid: \"openrouter/auto\",\n\t\t\tname: \"Auto Router\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"text\",\"image\"],\n\t\t\tcost: \t{\n\t \"input\": -1000000,\n\t \"output\": -1000000,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v3\": {\n\t\t\tid: \"recraft/recraft-v3\",\n\t\t\tname: \"Recraft: Recraft V3\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4\": {\n\t\t\tid: \"recraft/recraft-v4\",\n\t\t\tname: \"Recraft: Recraft V4\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4-pro\": {\n\t\t\tid: \"recraft/recraft-v4-pro\",\n\t\t\tname: \"Recraft: Recraft V4 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4-pro-vector\": {\n\t\t\tid: \"recraft/recraft-v4-pro-vector\",\n\t\t\tname: \"Recraft: Recraft V4 Pro Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4-vector\": {\n\t\t\tid: \"recraft/recraft-v4-vector\",\n\t\t\tname: \"Recraft: Recraft V4 Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1\": {\n\t\t\tid: \"recraft/recraft-v4.1\",\n\t\t\tname: \"Recraft: Recraft V4.1\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-pro\": {\n\t\t\tid: \"recraft/recraft-v4.1-pro\",\n\t\t\tname: \"Recraft: Recraft V4.1 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-pro-vector\": {\n\t\t\tid: \"recraft/recraft-v4.1-pro-vector\",\n\t\t\tname: \"Recraft: Recraft V4.1 Pro Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-utility\": {\n\t\t\tid: \"recraft/recraft-v4.1-utility\",\n\t\t\tname: \"Recraft: Recraft V4.1 Utility\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-utility-pro\": {\n\t\t\tid: \"recraft/recraft-v4.1-utility-pro\",\n\t\t\tname: \"Recraft: Recraft V4.1 Utility Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-vector\": {\n\t\t\tid: \"recraft/recraft-v4.1-vector\",\n\t\t\tname: \"Recraft: Recraft V4.1 Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-fast\": {\n\t\t\tid: \"sourceful/riverflow-v2-fast\",\n\t\t\tname: \"Sourceful: Riverflow V2 Fast\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-fast-preview\": {\n\t\t\tid: \"sourceful/riverflow-v2-fast-preview\",\n\t\t\tname: \"Sourceful: Riverflow V2 Fast Preview\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-max-preview\": {\n\t\t\tid: \"sourceful/riverflow-v2-max-preview\",\n\t\t\tname: \"Sourceful: Riverflow V2 Max Preview\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-pro\": {\n\t\t\tid: \"sourceful/riverflow-v2-pro\",\n\t\t\tname: \"Sourceful: Riverflow V2 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-standard-preview\": {\n\t\t\tid: \"sourceful/riverflow-v2-standard-preview\",\n\t\t\tname: \"Sourceful: Riverflow V2 Standard Preview\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"x-ai/grok-imagine-image-quality\": {\n\t\t\tid: \"x-ai/grok-imagine-image-quality\",\n\t\t\tname: \"xAI: Grok Imagine Image Quality\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t},\n} as const satisfies Record<string, Record<string, ImagesModel<ImagesApi>>>;\n"]}
|
|
@@ -422,6 +422,21 @@ export const IMAGE_MODELS = {
|
|
|
422
422
|
"cacheWrite": 0
|
|
423
423
|
}
|
|
424
424
|
},
|
|
425
|
+
"x-ai/grok-imagine-image-quality": {
|
|
426
|
+
id: "x-ai/grok-imagine-image-quality",
|
|
427
|
+
name: "xAI: Grok Imagine Image Quality",
|
|
428
|
+
api: "openrouter-images",
|
|
429
|
+
provider: "openrouter",
|
|
430
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
431
|
+
input: ["text", "image"],
|
|
432
|
+
output: ["image"],
|
|
433
|
+
cost: {
|
|
434
|
+
"input": 0,
|
|
435
|
+
"output": 0,
|
|
436
|
+
"cacheRead": 0,
|
|
437
|
+
"cacheWrite": 0
|
|
438
|
+
}
|
|
439
|
+
},
|
|
425
440
|
},
|
|
426
441
|
};
|
|
427
442
|
//# sourceMappingURL=image-models.generated.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-models.generated.js","sourceRoot":"","sources":["../src/image-models.generated.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,uEAAuE;AAIvE,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B,YAAY,EAAE;QACb,+BAA+B,EAAE;YAChC,EAAE,EAAE,+BAA+B;YACnC,IAAI,EAAE,gCAAgC;YACtC,GAAG,EAAE,mBAAmB;YACxB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,8BAA8B;YACvC,KAAK,EAAE,CAAC,MAAM,EAAC,OAAO,CAAC;YACvB,MAAM,EAAE,CAAC,OAAO,CAAC;YACjB,IAAI,EAAG;gBACP,OAAO,EAAE,CAAC;gBACV,QAAQ,EAAE,CAAC;gBACX,WAAW,EAAE,CAAC;gBACd,YAAY,EAAE,CAAC;aAChB;SAC4C;QAC5C,mCAAmC,EAAE;YACpC,EAAE,EAAE,mCAAmC;YACvC,IAAI,EAAE,oCAAoC;YAC1C,GAAG,EAAE,mBAAmB;YACxB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,8BAA8B;YACvC,KAAK,EAAE,CAAC,MAAM,EAAC,OAAO,CAAC;YACvB,MAAM,EAAE,CAAC,OAAO,CAAC;YACjB,IAAI,EAAG;gBACP,OAAO,EAAE,CAAC;gBACV,QAAQ,EAAE,CAAC;gBACX,WAAW,EAAE,CAAC;gBACd,YAAY,EAAE,CAAC;aAChB;SAC4C;QAC5C,8BAA8B,EAAE;YAC/B,EAAE,EAAE,8BAA8B;YAClC,IAAI,EAAE,+BAA+B;YACrC,GAAG,EAAE,mBAAmB;YACxB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,8BAA8B;YACvC,KAAK,EAAE,CAAC,MAAM,EAAC,OAAO,CAAC;YACvB,MAAM,EAAE,CAAC,OAAO,CAAC;YACjB,IAAI,EAAG;gBACP,OAAO,EAAE,CAAC;gBACV,QAAQ,EAAE,CAAC;gBACX,WAAW,EAAE,CAAC;gBACd,YAAY,E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A4B;YAChC,IAAI,EAAE,6BAA6B;YACnC,GAAG,EAAE,mBAAmB;YACxB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,8BAA8B;YACvC,KAAK,EAAE,CAAC,MAAM,EAAC,OAAO,CAAC;YACvB,MAAM,EAAE,CAAC,OAAO,CAAC;YACjB,IAAI,EAAG;gBACP,OAAO,EAAE,CAAC;gBACV,QAAQ,EAAE,CAAC;gBACX,WAAW,EAAE,CAAC;gBACd,YAAY,EAAE,CAAC;aAChB;SAC4C;QAC5C,yCAAyC,EAAE;YAC1C,EAAE,EAAE,yCAAyC;YAC7C,IAAI,EAAE,0CAA0C;YAChD,GAAG,EAAE,mBAAmB;YACxB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,8BAA8B;YACvC,KAAK,EAAE,CAAC,MAAM,EAAC,OAAO,CAAC;YACvB,MAAM,EAAE,CAAC,OAAO,CAAC;YACjB,IAAI,EAAG;gBACP,OAAO,EAAE,CAAC;gBACV,QAAQ,EAAE,CAAC;gBACX,WAAW,EAAE,CAAC;gBACd,YAAY,EAAE,CAAC;aAChB;SAC4C;KAC5C;CACyE,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-image-models.ts\n// Do not edit manually - run 'npm run generate-image-models' to update\n\nimport type { ImagesApi, ImagesModel } from \"./types.js\";\n\nexport const IMAGE_MODELS = {\n\t\"openrouter\": {\n\t\t\"black-forest-labs/flux.2-flex\": {\n\t\t\tid: \"black-forest-labs/flux.2-flex\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Flex\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"black-forest-labs/flux.2-klein-4b\": {\n\t\t\tid: \"black-forest-labs/flux.2-klein-4b\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Klein 4B\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"black-forest-labs/flux.2-max\": {\n\t\t\tid: \"black-forest-labs/flux.2-max\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Max\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"black-forest-labs/flux.2-pro\": {\n\t\t\tid: \"black-forest-labs/flux.2-pro\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"bytedance-seed/seedream-4.5\": {\n\t\t\tid: \"bytedance-seed/seedream-4.5\",\n\t\t\tname: \"ByteDance Seed: Seedream 4.5\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-2.5-flash-image\": {\n\t\t\tid: \"google/gemini-2.5-flash-image\",\n\t\t\tname: \"Google: Nano Banana (Gemini 2.5 Flash Image)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 0.3,\n\t \"output\": 2.5,\n\t \"cacheRead\": 0.03,\n\t \"cacheWrite\": 0.08333333333333334\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-3-pro-image-preview\": {\n\t\t\tid: \"google/gemini-3-pro-image-preview\",\n\t\t\tname: \"Google: Nano Banana Pro (Gemini 3 Pro Image Preview)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 2,\n\t \"output\": 12,\n\t \"cacheRead\": 0.19999999999999998,\n\t \"cacheWrite\": 0.375\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-3.1-flash-image-preview\": {\n\t\t\tid: \"google/gemini-3.1-flash-image-preview\",\n\t\t\tname: \"Google: Nano Banana 2 (Gemini 3.1 Flash Image Preview)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 0.5,\n\t \"output\": 3,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-5-image\": {\n\t\t\tid: \"openai/gpt-5-image\",\n\t\t\tname: \"OpenAI: GPT-5 Image\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 10,\n\t \"output\": 10,\n\t \"cacheRead\": 1.25,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-5-image-mini\": {\n\t\t\tid: \"openai/gpt-5-image-mini\",\n\t\t\tname: \"OpenAI: GPT-5 Image Mini\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 2.5,\n\t \"output\": 2,\n\t \"cacheRead\": 0.25,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-5.4-image-2\": {\n\t\t\tid: \"openai/gpt-5.4-image-2\",\n\t\t\tname: \"OpenAI: GPT-5.4 Image 2\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 8,\n\t \"output\": 15,\n\t \"cacheRead\": 2,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openrouter/auto\": {\n\t\t\tid: \"openrouter/auto\",\n\t\t\tname: \"Auto Router\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"text\",\"image\"],\n\t\t\tcost: \t{\n\t \"input\": -1000000,\n\t \"output\": -1000000,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v3\": {\n\t\t\tid: \"recraft/recraft-v3\",\n\t\t\tname: \"Recraft: Recraft V3\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4\": {\n\t\t\tid: \"recraft/recraft-v4\",\n\t\t\tname: \"Recraft: Recraft V4\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4-pro\": {\n\t\t\tid: \"recraft/recraft-v4-pro\",\n\t\t\tname: \"Recraft: Recraft V4 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4-pro-vector\": {\n\t\t\tid: \"recraft/recraft-v4-pro-vector\",\n\t\t\tname: \"Recraft: Recraft V4 Pro Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4-vector\": {\n\t\t\tid: \"recraft/recraft-v4-vector\",\n\t\t\tname: \"Recraft: Recraft V4 Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1\": {\n\t\t\tid: \"recraft/recraft-v4.1\",\n\t\t\tname: \"Recraft: Recraft V4.1\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-pro\": {\n\t\t\tid: \"recraft/recraft-v4.1-pro\",\n\t\t\tname: \"Recraft: Recraft V4.1 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-pro-vector\": {\n\t\t\tid: \"recraft/recraft-v4.1-pro-vector\",\n\t\t\tname: \"Recraft: Recraft V4.1 Pro Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-utility\": {\n\t\t\tid: \"recraft/recraft-v4.1-utility\",\n\t\t\tname: \"Recraft: Recraft V4.1 Utility\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-utility-pro\": {\n\t\t\tid: \"recraft/recraft-v4.1-utility-pro\",\n\t\t\tname: \"Recraft: Recraft V4.1 Utility Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-vector\": {\n\t\t\tid: \"recraft/recraft-v4.1-vector\",\n\t\t\tname: \"Recraft: Recraft V4.1 Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-fast\": {\n\t\t\tid: \"sourceful/riverflow-v2-fast\",\n\t\t\tname: \"Sourceful: Riverflow V2 Fast\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-fast-preview\": {\n\t\t\tid: \"sourceful/riverflow-v2-fast-preview\",\n\t\t\tname: \"Sourceful: Riverflow V2 Fast Preview\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-max-preview\": {\n\t\t\tid: \"sourceful/riverflow-v2-max-preview\",\n\t\t\tname: \"Sourceful: Riverflow V2 Max Preview\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-pro\": {\n\t\t\tid: \"sourceful/riverflow-v2-pro\",\n\t\t\tname: \"Sourceful: Riverflow V2 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-standard-preview\": {\n\t\t\tid: \"sourceful/riverflow-v2-standard-preview\",\n\t\t\tname: \"Sourceful: Riverflow V2 Standard Preview\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t},\n} as const satisfies Record<string, Record<string, ImagesModel<ImagesApi>>>;\n"]}
|
|
1
|
+
{"version":3,"file":"image-models.generated.js","sourceRoot":"","sources":["../src/image-models.generated.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,uEAAuE;AAIvE,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B,YAAY,EAAE;QACb,+BAA+B,EAAE;YAChC,EAAE,EAAE,+BAA+B;YACnC,IAAI,EAAE,gCAAgC;YACtC,GAAG,EAAE,mBAAmB;YACxB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,8BAA8B;YACvC,KAAK,EAAE,CAAC,MAAM,EAAC,OAAO,CAAC;YACvB,MAAM,EAAE,CAAC,OAAO,CAAC;YACjB,IAAI,EAAG;gBACP,OAAO,EAAE,CAAC;gBACV,QAAQ,EAAE,CAAC;gBACX,WAAW,EAAE,CAAC;gBACd,YAAY,EAAE,CAAC;aAChB;SAC4C;QAC5C,mCAAmC,EAAE;YACpC,EAAE,EAAE,mCAAmC;YACvC,IAAI,EAAE,oCAAoC;YAC1C,GAAG,EAAE,mBAAmB;YACxB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,8BAA8B;YACvC,KAAK,EAAE,CAAC,MAAM,EAAC,OAAO,CAAC;YACvB,MAAM,EAAE,CAAC,OAAO,CAAC;YACjB,IAAI,EAAG;gBACP,OAAO,EAAE,CAAC;gBACV,QAAQ,EAAE,CAAC;gBACX,WAAW,EAAE,CAAC;gBACd,YAAY,EAAE,CAAC;aAChB;SAC4C;QAC5C,8BAA8B,EAAE;YAC/B,EAAE,EAAE,8BAA8B;YAClC,IAAI,EAAE,+BAA+B;YACrC,GAAG,EAAE,mBAAmB;YACxB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,8BAA8B;YACvC,K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AC4C;KAC5C;CACyE,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-image-models.ts\n// Do not edit manually - run 'npm run generate-image-models' to update\n\nimport type { ImagesApi, ImagesModel } from \"./types.js\";\n\nexport const IMAGE_MODELS = {\n\t\"openrouter\": {\n\t\t\"black-forest-labs/flux.2-flex\": {\n\t\t\tid: \"black-forest-labs/flux.2-flex\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Flex\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"black-forest-labs/flux.2-klein-4b\": {\n\t\t\tid: \"black-forest-labs/flux.2-klein-4b\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Klein 4B\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"black-forest-labs/flux.2-max\": {\n\t\t\tid: \"black-forest-labs/flux.2-max\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Max\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"black-forest-labs/flux.2-pro\": {\n\t\t\tid: \"black-forest-labs/flux.2-pro\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"bytedance-seed/seedream-4.5\": {\n\t\t\tid: \"bytedance-seed/seedream-4.5\",\n\t\t\tname: \"ByteDance Seed: Seedream 4.5\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-2.5-flash-image\": {\n\t\t\tid: \"google/gemini-2.5-flash-image\",\n\t\t\tname: \"Google: Nano Banana (Gemini 2.5 Flash Image)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 0.3,\n\t \"output\": 2.5,\n\t \"cacheRead\": 0.03,\n\t \"cacheWrite\": 0.08333333333333334\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-3-pro-image-preview\": {\n\t\t\tid: \"google/gemini-3-pro-image-preview\",\n\t\t\tname: \"Google: Nano Banana Pro (Gemini 3 Pro Image Preview)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 2,\n\t \"output\": 12,\n\t \"cacheRead\": 0.19999999999999998,\n\t \"cacheWrite\": 0.375\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-3.1-flash-image-preview\": {\n\t\t\tid: \"google/gemini-3.1-flash-image-preview\",\n\t\t\tname: \"Google: Nano Banana 2 (Gemini 3.1 Flash Image Preview)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 0.5,\n\t \"output\": 3,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-5-image\": {\n\t\t\tid: \"openai/gpt-5-image\",\n\t\t\tname: \"OpenAI: GPT-5 Image\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 10,\n\t \"output\": 10,\n\t \"cacheRead\": 1.25,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-5-image-mini\": {\n\t\t\tid: \"openai/gpt-5-image-mini\",\n\t\t\tname: \"OpenAI: GPT-5 Image Mini\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 2.5,\n\t \"output\": 2,\n\t \"cacheRead\": 0.25,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-5.4-image-2\": {\n\t\t\tid: \"openai/gpt-5.4-image-2\",\n\t\t\tname: \"OpenAI: GPT-5.4 Image 2\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\",\"text\"],\n\t\t\toutput: [\"image\",\"text\"],\n\t\t\tcost: \t{\n\t \"input\": 8,\n\t \"output\": 15,\n\t \"cacheRead\": 2,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openrouter/auto\": {\n\t\t\tid: \"openrouter/auto\",\n\t\t\tname: \"Auto Router\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"text\",\"image\"],\n\t\t\tcost: \t{\n\t \"input\": -1000000,\n\t \"output\": -1000000,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v3\": {\n\t\t\tid: \"recraft/recraft-v3\",\n\t\t\tname: \"Recraft: Recraft V3\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4\": {\n\t\t\tid: \"recraft/recraft-v4\",\n\t\t\tname: \"Recraft: Recraft V4\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4-pro\": {\n\t\t\tid: \"recraft/recraft-v4-pro\",\n\t\t\tname: \"Recraft: Recraft V4 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4-pro-vector\": {\n\t\t\tid: \"recraft/recraft-v4-pro-vector\",\n\t\t\tname: \"Recraft: Recraft V4 Pro Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4-vector\": {\n\t\t\tid: \"recraft/recraft-v4-vector\",\n\t\t\tname: \"Recraft: Recraft V4 Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1\": {\n\t\t\tid: \"recraft/recraft-v4.1\",\n\t\t\tname: \"Recraft: Recraft V4.1\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-pro\": {\n\t\t\tid: \"recraft/recraft-v4.1-pro\",\n\t\t\tname: \"Recraft: Recraft V4.1 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-pro-vector\": {\n\t\t\tid: \"recraft/recraft-v4.1-pro-vector\",\n\t\t\tname: \"Recraft: Recraft V4.1 Pro Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-utility\": {\n\t\t\tid: \"recraft/recraft-v4.1-utility\",\n\t\t\tname: \"Recraft: Recraft V4.1 Utility\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-utility-pro\": {\n\t\t\tid: \"recraft/recraft-v4.1-utility-pro\",\n\t\t\tname: \"Recraft: Recraft V4.1 Utility Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-vector\": {\n\t\t\tid: \"recraft/recraft-v4.1-vector\",\n\t\t\tname: \"Recraft: Recraft V4.1 Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-fast\": {\n\t\t\tid: \"sourceful/riverflow-v2-fast\",\n\t\t\tname: \"Sourceful: Riverflow V2 Fast\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-fast-preview\": {\n\t\t\tid: \"sourceful/riverflow-v2-fast-preview\",\n\t\t\tname: \"Sourceful: Riverflow V2 Fast Preview\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-max-preview\": {\n\t\t\tid: \"sourceful/riverflow-v2-max-preview\",\n\t\t\tname: \"Sourceful: Riverflow V2 Max Preview\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-pro\": {\n\t\t\tid: \"sourceful/riverflow-v2-pro\",\n\t\t\tname: \"Sourceful: Riverflow V2 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-standard-preview\": {\n\t\t\tid: \"sourceful/riverflow-v2-standard-preview\",\n\t\t\tname: \"Sourceful: Riverflow V2 Standard Preview\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"x-ai/grok-imagine-image-quality\": {\n\t\t\tid: \"x-ai/grok-imagine-image-quality\",\n\t\t\tname: \"xAI: Grok Imagine Image Quality\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\",\"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: \t{\n\t \"input\": 0,\n\t \"output\": 0,\n\t \"cacheRead\": 0,\n\t \"cacheWrite\": 0\n\t}\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t},\n} as const satisfies Record<string, Record<string, ImagesModel<ImagesApi>>>;\n"]}
|