@whxway/loom 1.1.0 → 1.2.0
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +3 -3
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/diagnostics/route-bundle-stats.json +35 -35
- package/.next/fallback-build-manifest.json +3 -3
- package/.next/server/app/(auth)/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/logs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/mcp/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/mcp/presets/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/models/[name]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/playground/audio/speech/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/playground/audio/transcription/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/playground/chat/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/playground/embedding/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/playground/image/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/playground/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/playground/video/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/providers/[name]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/providers/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/settings/api-keys/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/settings/users/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +2 -2
- package/.next/server/app/_not-found.rsc +3 -3
- package/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/adapters/route.js.nft.json +1 -1
- package/.next/server/app/api/apikeys/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/apikeys/route.js.nft.json +1 -1
- package/.next/server/app/api/capabilities/route.js.nft.json +1 -1
- package/.next/server/app/api/conversations/[id]/messages/route.js.nft.json +1 -1
- package/.next/server/app/api/conversations/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/conversations/route.js.nft.json +1 -1
- package/.next/server/app/api/health/route.js.nft.json +1 -1
- package/.next/server/app/api/login/route.js.nft.json +1 -1
- package/.next/server/app/api/logout/route.js.nft.json +1 -1
- package/.next/server/app/api/logs/generations/[id]/images/[idx]/route.js.nft.json +1 -1
- package/.next/server/app/api/logs/generations/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/logs/generations/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/presets/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[id]/check/route.js +1 -1
- package/.next/server/app/api/mcp/servers/[id]/check/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[id]/tools/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/route.js.nft.json +1 -1
- package/.next/server/app/api/messages/[id]/rate/route.js.nft.json +1 -1
- package/.next/server/app/api/models/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/models/route.js.nft.json +1 -1
- package/.next/server/app/api/ping/route.js.nft.json +1 -1
- package/.next/server/app/api/playground/chat/route.js +4 -4
- package/.next/server/app/api/playground/chat/route.js.nft.json +1 -1
- package/.next/server/app/api/playground/embedding/route.js +4 -4
- package/.next/server/app/api/playground/embedding/route.js.nft.json +1 -1
- package/.next/server/app/api/providers/[id]/check/route.js.nft.json +1 -1
- package/.next/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
- package/.next/server/app/api/providers/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/providers/probe/route.js.nft.json +1 -1
- package/.next/server/app/api/providers/reload/route.js.nft.json +1 -1
- package/.next/server/app/api/providers/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/models/[name]/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/route.js.nft.json +1 -1
- package/.next/server/app/api/tools/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/tools/route.js.nft.json +1 -1
- package/.next/server/app/api/users/[username]/route.js.nft.json +1 -1
- package/.next/server/app/api/users/me/preferences/route.js +1 -1
- package/.next/server/app/api/users/me/preferences/route.js.nft.json +1 -1
- package/.next/server/app/api/users/me/route.js.nft.json +1 -1
- package/.next/server/app/api/users/route.js.nft.json +1 -1
- package/.next/server/app/api/v1/audio/speech/route.js +1 -1
- package/.next/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
- package/.next/server/app/api/v1/audio/transcriptions/route.js +4 -4
- package/.next/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
- package/.next/server/app/api/v1/chat/completions/route.js +1 -1
- package/.next/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/.next/server/app/api/v1/embeddings/route.js +1 -1
- package/.next/server/app/api/v1/embeddings/route.js.nft.json +1 -1
- package/.next/server/app/api/v1/images/generations/route.js +1 -1
- package/.next/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/.next/server/app/api/v1/models/route.js.nft.json +1 -1
- package/.next/server/app/api/v1/rerank/route.js +1 -1
- package/.next/server/app/api/v1/rerank/route.js.nft.json +1 -1
- package/.next/server/app/api/v1/videos/[id]/content/route.js +4 -4
- package/.next/server/app/api/v1/videos/[id]/content/route.js.nft.json +1 -1
- package/.next/server/app/api/v1/videos/[id]/route.js +4 -4
- package/.next/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/v1/videos/route.js +1 -1
- package/.next/server/app/api/v1/videos/route.js.nft.json +1 -1
- package/.next/server/app/api/variants/route.js.nft.json +1 -1
- package/.next/server/app/index.html +2 -2
- package/.next/server/app/index.rsc +7 -7
- package/.next/server/app/index.segments/!KGRhc2hib2FyZCk/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/!KGRhc2hib2FyZCk.segment.rsc +3 -3
- package/.next/server/app/index.segments/_full.segment.rsc +7 -7
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/login.html +2 -2
- package/.next/server/app/login.rsc +3 -3
- package/.next/server/app/login.segments/!KGF1dGgp/login/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/login.segments/!KGF1dGgp/login.segment.rsc +1 -1
- package/.next/server/app/login.segments/!KGF1dGgp.segment.rsc +1 -1
- package/.next/server/app/login.segments/_full.segment.rsc +3 -3
- package/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/.next/server/app/login.segments/_index.segment.rsc +2 -2
- package/.next/server/app/login.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/logs.html +2 -2
- package/.next/server/app/logs.rsc +7 -7
- package/.next/server/app/logs.segments/!KGRhc2hib2FyZCk/logs/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/logs.segments/!KGRhc2hib2FyZCk/logs.segment.rsc +1 -1
- package/.next/server/app/logs.segments/!KGRhc2hib2FyZCk.segment.rsc +3 -3
- package/.next/server/app/logs.segments/_full.segment.rsc +7 -7
- package/.next/server/app/logs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/logs.segments/_index.segment.rsc +2 -2
- package/.next/server/app/logs.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/mcp/presets.html +2 -2
- package/.next/server/app/mcp/presets.rsc +7 -7
- package/.next/server/app/mcp/presets.segments/!KGRhc2hib2FyZCk/mcp/presets/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/mcp/presets.segments/!KGRhc2hib2FyZCk/mcp/presets.segment.rsc +1 -1
- package/.next/server/app/mcp/presets.segments/!KGRhc2hib2FyZCk/mcp.segment.rsc +1 -1
- package/.next/server/app/mcp/presets.segments/!KGRhc2hib2FyZCk.segment.rsc +3 -3
- package/.next/server/app/mcp/presets.segments/_full.segment.rsc +7 -7
- package/.next/server/app/mcp/presets.segments/_head.segment.rsc +1 -1
- package/.next/server/app/mcp/presets.segments/_index.segment.rsc +2 -2
- package/.next/server/app/mcp/presets.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/mcp.html +2 -2
- package/.next/server/app/mcp.rsc +7 -7
- package/.next/server/app/mcp.segments/!KGRhc2hib2FyZCk/mcp/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/mcp.segments/!KGRhc2hib2FyZCk/mcp.segment.rsc +1 -1
- package/.next/server/app/mcp.segments/!KGRhc2hib2FyZCk.segment.rsc +3 -3
- package/.next/server/app/mcp.segments/_full.segment.rsc +7 -7
- package/.next/server/app/mcp.segments/_head.segment.rsc +1 -1
- package/.next/server/app/mcp.segments/_index.segment.rsc +2 -2
- package/.next/server/app/mcp.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/playground/audio/speech.html +2 -2
- package/.next/server/app/playground/audio/speech.rsc +8 -8
- package/.next/server/app/playground/audio/speech.segments/!KGRhc2hib2FyZCk/playground/audio/speech/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/playground/audio/speech.segments/!KGRhc2hib2FyZCk/playground/audio/speech.segment.rsc +1 -1
- package/.next/server/app/playground/audio/speech.segments/!KGRhc2hib2FyZCk/playground/audio.segment.rsc +1 -1
- package/.next/server/app/playground/audio/speech.segments/!KGRhc2hib2FyZCk/playground.segment.rsc +2 -2
- package/.next/server/app/playground/audio/speech.segments/!KGRhc2hib2FyZCk.segment.rsc +3 -3
- package/.next/server/app/playground/audio/speech.segments/_full.segment.rsc +8 -8
- package/.next/server/app/playground/audio/speech.segments/_head.segment.rsc +1 -1
- package/.next/server/app/playground/audio/speech.segments/_index.segment.rsc +2 -2
- package/.next/server/app/playground/audio/speech.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/playground/audio/transcription.html +2 -2
- package/.next/server/app/playground/audio/transcription.rsc +8 -8
- package/.next/server/app/playground/audio/transcription.segments/!KGRhc2hib2FyZCk/playground/audio/transcription/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/playground/audio/transcription.segments/!KGRhc2hib2FyZCk/playground/audio/transcription.segment.rsc +1 -1
- package/.next/server/app/playground/audio/transcription.segments/!KGRhc2hib2FyZCk/playground/audio.segment.rsc +1 -1
- package/.next/server/app/playground/audio/transcription.segments/!KGRhc2hib2FyZCk/playground.segment.rsc +2 -2
- package/.next/server/app/playground/audio/transcription.segments/!KGRhc2hib2FyZCk.segment.rsc +3 -3
- package/.next/server/app/playground/audio/transcription.segments/_full.segment.rsc +8 -8
- package/.next/server/app/playground/audio/transcription.segments/_head.segment.rsc +1 -1
- package/.next/server/app/playground/audio/transcription.segments/_index.segment.rsc +2 -2
- package/.next/server/app/playground/audio/transcription.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/playground/chat.html +2 -2
- package/.next/server/app/playground/chat.rsc +8 -8
- package/.next/server/app/playground/chat.segments/!KGRhc2hib2FyZCk/playground/chat/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/playground/chat.segments/!KGRhc2hib2FyZCk/playground/chat.segment.rsc +1 -1
- package/.next/server/app/playground/chat.segments/!KGRhc2hib2FyZCk/playground.segment.rsc +2 -2
- package/.next/server/app/playground/chat.segments/!KGRhc2hib2FyZCk.segment.rsc +3 -3
- package/.next/server/app/playground/chat.segments/_full.segment.rsc +8 -8
- package/.next/server/app/playground/chat.segments/_head.segment.rsc +1 -1
- package/.next/server/app/playground/chat.segments/_index.segment.rsc +2 -2
- package/.next/server/app/playground/chat.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/playground/embedding.html +2 -2
- package/.next/server/app/playground/embedding.rsc +8 -8
- package/.next/server/app/playground/embedding.segments/!KGRhc2hib2FyZCk/playground/embedding/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/playground/embedding.segments/!KGRhc2hib2FyZCk/playground/embedding.segment.rsc +1 -1
- package/.next/server/app/playground/embedding.segments/!KGRhc2hib2FyZCk/playground.segment.rsc +2 -2
- package/.next/server/app/playground/embedding.segments/!KGRhc2hib2FyZCk.segment.rsc +3 -3
- package/.next/server/app/playground/embedding.segments/_full.segment.rsc +8 -8
- package/.next/server/app/playground/embedding.segments/_head.segment.rsc +1 -1
- package/.next/server/app/playground/embedding.segments/_index.segment.rsc +2 -2
- package/.next/server/app/playground/embedding.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/playground/image.html +2 -2
- package/.next/server/app/playground/image.rsc +8 -8
- package/.next/server/app/playground/image.segments/!KGRhc2hib2FyZCk/playground/image/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/playground/image.segments/!KGRhc2hib2FyZCk/playground/image.segment.rsc +1 -1
- package/.next/server/app/playground/image.segments/!KGRhc2hib2FyZCk/playground.segment.rsc +2 -2
- package/.next/server/app/playground/image.segments/!KGRhc2hib2FyZCk.segment.rsc +3 -3
- package/.next/server/app/playground/image.segments/_full.segment.rsc +8 -8
- package/.next/server/app/playground/image.segments/_head.segment.rsc +1 -1
- package/.next/server/app/playground/image.segments/_index.segment.rsc +2 -2
- package/.next/server/app/playground/image.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/playground/video.html +2 -2
- package/.next/server/app/playground/video.rsc +8 -8
- package/.next/server/app/playground/video.segments/!KGRhc2hib2FyZCk/playground/video/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/playground/video.segments/!KGRhc2hib2FyZCk/playground/video.segment.rsc +1 -1
- package/.next/server/app/playground/video.segments/!KGRhc2hib2FyZCk/playground.segment.rsc +2 -2
- package/.next/server/app/playground/video.segments/!KGRhc2hib2FyZCk.segment.rsc +3 -3
- package/.next/server/app/playground/video.segments/_full.segment.rsc +8 -8
- package/.next/server/app/playground/video.segments/_head.segment.rsc +1 -1
- package/.next/server/app/playground/video.segments/_index.segment.rsc +2 -2
- package/.next/server/app/playground/video.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/playground.html +2 -2
- package/.next/server/app/playground.rsc +8 -8
- package/.next/server/app/playground.segments/!KGRhc2hib2FyZCk/playground/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/playground.segments/!KGRhc2hib2FyZCk/playground.segment.rsc +2 -2
- package/.next/server/app/playground.segments/!KGRhc2hib2FyZCk.segment.rsc +3 -3
- package/.next/server/app/playground.segments/_full.segment.rsc +8 -8
- package/.next/server/app/playground.segments/_head.segment.rsc +1 -1
- package/.next/server/app/playground.segments/_index.segment.rsc +2 -2
- package/.next/server/app/playground.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/providers.html +2 -2
- package/.next/server/app/providers.rsc +7 -7
- package/.next/server/app/providers.segments/!KGRhc2hib2FyZCk/providers/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/providers.segments/!KGRhc2hib2FyZCk/providers.segment.rsc +1 -1
- package/.next/server/app/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +3 -3
- package/.next/server/app/providers.segments/_full.segment.rsc +7 -7
- package/.next/server/app/providers.segments/_head.segment.rsc +1 -1
- package/.next/server/app/providers.segments/_index.segment.rsc +2 -2
- package/.next/server/app/providers.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings/api-keys.html +2 -2
- package/.next/server/app/settings/api-keys.rsc +7 -7
- package/.next/server/app/settings/api-keys.segments/!KGRhc2hib2FyZCk/settings/api-keys/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/settings/api-keys.segments/!KGRhc2hib2FyZCk/settings/api-keys.segment.rsc +1 -1
- package/.next/server/app/settings/api-keys.segments/!KGRhc2hib2FyZCk/settings.segment.rsc +1 -1
- package/.next/server/app/settings/api-keys.segments/!KGRhc2hib2FyZCk.segment.rsc +3 -3
- package/.next/server/app/settings/api-keys.segments/_full.segment.rsc +7 -7
- package/.next/server/app/settings/api-keys.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings/api-keys.segments/_index.segment.rsc +2 -2
- package/.next/server/app/settings/api-keys.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings/users.html +2 -2
- package/.next/server/app/settings/users.rsc +7 -7
- package/.next/server/app/settings/users.segments/!KGRhc2hib2FyZCk/settings/users/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/settings/users.segments/!KGRhc2hib2FyZCk/settings/users.segment.rsc +1 -1
- package/.next/server/app/settings/users.segments/!KGRhc2hib2FyZCk/settings.segment.rsc +1 -1
- package/.next/server/app/settings/users.segments/!KGRhc2hib2FyZCk.segment.rsc +3 -3
- package/.next/server/app/settings/users.segments/_full.segment.rsc +7 -7
- package/.next/server/app/settings/users.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings/users.segments/_index.segment.rsc +2 -2
- package/.next/server/app/settings/users.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings.html +2 -2
- package/.next/server/app/settings.rsc +8 -8
- package/.next/server/app/settings.segments/!KGRhc2hib2FyZCk/settings/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/settings.segments/!KGRhc2hib2FyZCk/settings.segment.rsc +1 -1
- package/.next/server/app/settings.segments/!KGRhc2hib2FyZCk.segment.rsc +3 -3
- package/.next/server/app/settings.segments/_full.segment.rsc +8 -8
- package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_index.segment.rsc +2 -2
- package/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/.next/server/chunks/[root-of-the-server]__019oqc3._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__019oqc3._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__01ou67p._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__01ou67p._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__02sypva._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__02sypva._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__0myi8j1._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__0myi8j1._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__0wiw6hu._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0wiw6hu._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__0xrm_9r._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0xrm_9r._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__11t79he._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__11t79he._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__1fs5lo-._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1fs5lo-._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__1qg3d87._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__1qg3d87._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__1zgou-a._.js +6 -0
- package/.next/server/chunks/[root-of-the-server]__1zgou-a._.js.map +1 -0
- package/.next/server/chunks/_00k5vl0._.js +3 -0
- package/.next/server/chunks/_00k5vl0._.js.map +1 -0
- package/.next/server/chunks/_06hthvw._.js +3 -0
- package/.next/server/chunks/_06hthvw._.js.map +1 -0
- package/.next/server/chunks/_0c6vpbw._.js +3 -0
- package/.next/server/chunks/_0c6vpbw._.js.map +1 -0
- package/.next/server/chunks/_0hawg18._.js +3 -0
- package/.next/server/chunks/_0hawg18._.js.map +1 -0
- package/.next/server/chunks/_0kr91st._.js +3 -0
- package/.next/server/chunks/_0kr91st._.js.map +1 -0
- package/.next/server/chunks/_1i4x7k4._.js +3 -0
- package/.next/server/chunks/_1i4x7k4._.js.map +1 -0
- package/.next/server/chunks/_1lk_ovb._.js +3 -0
- package/.next/server/chunks/_1lk_ovb._.js.map +1 -0
- package/.next/server/chunks/_1wk63w9._.js +3 -0
- package/.next/server/chunks/_1wk63w9._.js.map +1 -0
- package/.next/server/chunks/_1wl3z8e._.js +3 -0
- package/.next/server/chunks/_1wl3z8e._.js.map +1 -0
- package/.next/server/chunks/lib_server_11s_lvw._.js +1 -1
- package/.next/server/chunks/lib_server_11s_lvw._.js.map +1 -1
- package/.next/server/chunks/lib_server_gateway_index_ts_1nvei3v._.js +2 -2
- package/.next/server/chunks/lib_server_gateway_index_ts_1nvei3v._.js.map +1 -1
- package/.next/server/chunks/ssr/app_(dashboard)_settings_page_tsx_1hwv4x8._.js +2 -2
- package/.next/server/chunks/ssr/app_(dashboard)_settings_page_tsx_1hwv4x8._.js.map +1 -1
- package/.next/server/chunks/ssr/lib_schemas_preferences_ts_1fy1exu._.js +1 -1
- package/.next/server/chunks/ssr/lib_schemas_preferences_ts_1fy1exu._.js.map +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +2 -2
- package/.next/server/pages/500.html +1 -1
- package/.next/static/chunks/{2zeeni2y2fh59.js → 1si1c1m377t3w.js} +1 -1
- package/.next/static/chunks/2yzdc8m536xea.css +1 -0
- package/.next/static/chunks/3oj24pftrz5zy.js +11 -0
- package/.next/trace +2 -2
- package/.next/trace-build +1 -1
- package/bin/loom.mjs +1 -1
- package/drizzle/0019_timeout_default_3600.sql +36 -0
- package/drizzle/meta/0019_snapshot.json +1309 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +1 -1
- package/.next/server/chunks/[root-of-the-server]__00b7x8i._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__00b7x8i._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__022u2d9._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__022u2d9._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__0g3mnim._.js +0 -6
- package/.next/server/chunks/[root-of-the-server]__0g3mnim._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__1gon00b._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1gon00b._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__1xj9qqs._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1xj9qqs._.js.map +0 -1
- package/.next/server/chunks/_028m5t0._.js +0 -3
- package/.next/server/chunks/_028m5t0._.js.map +0 -1
- package/.next/server/chunks/_0eq8a_c._.js +0 -3
- package/.next/server/chunks/_0eq8a_c._.js.map +0 -1
- package/.next/server/chunks/_0n06usu._.js +0 -3
- package/.next/server/chunks/_0n06usu._.js.map +0 -1
- package/.next/server/chunks/_0tcchv1._.js +0 -3
- package/.next/server/chunks/_0tcchv1._.js.map +0 -1
- package/.next/server/chunks/_14120rw._.js +0 -3
- package/.next/server/chunks/_14120rw._.js.map +0 -1
- package/.next/server/chunks/_1633jn_._.js +0 -3
- package/.next/server/chunks/_1633jn_._.js.map +0 -1
- package/.next/server/chunks/_19jpf08._.js +0 -3
- package/.next/server/chunks/_19jpf08._.js.map +0 -1
- package/.next/server/chunks/_1gi5m-_._.js +0 -3
- package/.next/server/chunks/_1gi5m-_._.js.map +0 -1
- package/.next/server/chunks/_1jgm_7u._.js +0 -3
- package/.next/server/chunks/_1jgm_7u._.js.map +0 -1
- package/.next/static/chunks/0cbg1vmtl84ae.css +0 -1
- package/.next/static/chunks/29p-wdja_cbgh.js +0 -11
- /package/.next/static/{wCZkC7ZaYrxG37d-e2tac → TZ8IS4-HWznFu8M4EwNGp}/_buildManifest.js +0 -0
- /package/.next/static/{wCZkC7ZaYrxG37d-e2tac → TZ8IS4-HWznFu8M4EwNGp}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{wCZkC7ZaYrxG37d-e2tac → TZ8IS4-HWznFu8M4EwNGp}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../lib/server/gateway/artifacts.ts","../../../lib/server/preferences/service.ts","../../../lib/schemas/preferences.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../app/api/v1/audio/speech/route.ts"],"sourcesContent":["import \"server-only\";\nimport { promises as fs, mkdirSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\n/**\n * Image artifact persistence for `generation_logs`.\n *\n * Why: image-generation upstreams return either a hosted `url` (which\n * expires) or a base64 `b64_json` blob (~MB per image). Persisting the\n * raw b64 inline in `generation_logs.generation` (JSON column) bloats\n * the DB by a factor of 10–100× and makes the log viewer's JSON tree\n * unusable. Mirroring the existing `sanitizeForJsonView` strategy for\n * large text/JSON, we strip the b64 from the log payload and write\n * each image to a per-log directory on disk; the log keeps a stable\n * `url` reference (and `loom_artifact: true` marker) that the FE log\n * viewer reads to render inline thumbnails.\n *\n * The original (untouched) payload is still served to the API caller\n * — only the *log copy* is rewritten. The image-generation playground\n * therefore continues to receive b64_json verbatim.\n */\n\nconst USER_CWD = process.env.LOOM_USER_CWD || process.cwd();\nconst ARTIFACTS_ROOT = resolve(USER_CWD, \"data\", \"log-artifacts\");\n\nexport interface PersistedArtifact {\n /** Position within the upstream `data[]` array. */\n index: number;\n mime: string;\n bytes: number;\n /** Absolute filesystem path. */\n path: string;\n /** Same-origin URL the FE viewer (and the log JSON) reference. */\n url: string;\n}\n\nfunction extFromMime(mime: string): string {\n switch (mime.toLowerCase()) {\n case \"image/png\": return \"png\";\n case \"image/jpeg\":\n case \"image/jpg\": return \"jpg\";\n case \"image/webp\": return \"webp\";\n case \"image/gif\": return \"gif\";\n default: return \"bin\";\n }\n}\n\nexport function artifactDir(logId: string): string {\n return resolve(ARTIFACTS_ROOT, logId);\n}\n\nexport function artifactPath(logId: string, index: number, ext: string): string {\n return resolve(artifactDir(logId), `${index}.${ext}`);\n}\n\nexport function artifactUrl(logId: string, index: number): string {\n return `/api/logs/generations/${encodeURIComponent(logId)}/images/${index}`;\n}\n\n/**\n * Walk the log copy of `normalized.data[]` and persist every `b64_json`\n * to disk. Mutates the passed object in place — callers MUST clone\n * first if they need to preserve the original (e.g. to forward it to\n * the API caller as-is).\n *\n * Returns the descriptors of every artifact written, ordered by index.\n */\nexport async function persistImageArtifacts(\n logId: string,\n normalized: Record<string, unknown>,\n): Promise<PersistedArtifact[]> {\n const data = (normalized as { data?: unknown }).data;\n if (!Array.isArray(data)) return [];\n\n const artifacts: PersistedArtifact[] = [];\n let dirEnsured = false;\n\n for (let i = 0; i < data.length; i++) {\n const entry = data[i];\n if (!entry || typeof entry !== \"object\") continue;\n const e = entry as Record<string, unknown>;\n const b64 = typeof e.b64_json === \"string\" ? e.b64_json : null;\n if (!b64) continue;\n\n // Decode + write.\n const buf = Buffer.from(b64, \"base64\");\n const mime = typeof e.mime === \"string\"\n ? e.mime\n : typeof e.output_format === \"string\"\n ? `image/${e.output_format}`\n : \"image/png\";\n const ext = extFromMime(mime);\n const path = artifactPath(logId, i, ext);\n\n if (!dirEnsured) {\n mkdirSync(artifactDir(logId), { recursive: true });\n dirEnsured = true;\n }\n await fs.writeFile(path, buf);\n\n // Rewrite the entry: drop the b64 blob, point `url` at our\n // same-origin proxy, and mark it so the FE log viewer knows\n // this URL is a loom-managed artifact (vs an expiring upstream\n // URL). Keeping the rest of the upstream entry intact\n // preserves fields like `revised_prompt`.\n delete e.b64_json;\n e.url = artifactUrl(logId, i);\n e.loom_artifact = true;\n e.bytes = buf.byteLength;\n e.mime = mime;\n\n artifacts.push({\n index: i,\n mime,\n bytes: buf.byteLength,\n path,\n url: artifactUrl(logId, i),\n });\n }\n\n // Top-level convenience array — lets the FE viewer enumerate\n // artifacts without re-walking `data[]`.\n if (artifacts.length > 0) {\n (normalized as Record<string, unknown>).loom_artifacts = artifacts.map((a) => ({\n index: a.index,\n url: a.url,\n mime: a.mime,\n bytes: a.bytes,\n }));\n }\n return artifacts;\n}\n\n/** Filesystem read for the artifact route — performs a path-traversal\n * guard since `index` comes off the URL. */\nexport async function readArtifact(\n logId: string,\n index: number,\n): Promise<{ buf: Buffer; mime: string } | null> {\n // Probe each known extension; cheap (≤4 readFile attempts) and avoids\n // listing the directory just to find the right suffix. The first\n // missing file we hit also implicitly probes the parent dir, so\n // there's no need for a separate existsSync — let ENOENT bubble.\n for (const ext of [\"png\", \"jpg\", \"webp\", \"gif\", \"bin\"]) {\n const path = artifactPath(logId, index, ext);\n try {\n const buf = await fs.readFile(path);\n const mime = ext === \"jpg\" ? \"image/jpeg\" : ext === \"bin\" ? \"application/octet-stream\" : `image/${ext}`;\n return { buf, mime };\n } catch {\n // not this ext (or dir missing); fall through\n }\n }\n return null;\n}\n","import \"server-only\";\nimport { eq } from \"drizzle-orm\";\nimport { db } from \"../db\";\nimport { userPreferences } from \"../db/schema\";\nimport {\n defaultUserPreferences,\n userPreferencesDTOSchema,\n type UserPreferencesDTO,\n type UserPreferencesUpdateInput,\n} from \"@/lib/schemas/preferences\";\n\n/**\n * Read the preferences row for a user, merged over server defaults. Always\n * returns a full DTO — fields the user has never set fall back to the\n * defaults defined in lib/schemas/preferences.ts.\n */\nexport function getPreferences(userId: string): UserPreferencesDTO {\n const row = db\n .select({ preferences: userPreferences.preferences })\n .from(userPreferences)\n .where(eq(userPreferences.userId, userId))\n .get();\n\n const stored = (row?.preferences ?? {}) as Partial<UserPreferencesDTO>;\n // Validate stored shape against the schema, falling back to defaults on\n // missing keys or invalid values. Forward-compatible with new fields.\n const merged = { ...defaultUserPreferences, ...stored };\n return userPreferencesDTOSchema.parse(merged);\n}\n\n/**\n * Patch a user's preferences. Provided fields are merged on top of the\n * existing row (upserted as needed). Returns the post-update full DTO.\n */\nexport function updatePreferences(\n userId: string,\n patch: UserPreferencesUpdateInput,\n): UserPreferencesDTO {\n const current = getPreferences(userId);\n const next: UserPreferencesDTO = { ...current, ...patch };\n const now = new Date().toISOString();\n\n db.insert(userPreferences)\n .values({ userId, preferences: next, updatedAt: now })\n .onConflictDoUpdate({\n target: userPreferences.userId,\n set: { preferences: next, updatedAt: now },\n })\n .run();\n\n return next;\n}\n","import { z } from \"zod\";\n\n/**\n * Cross-device user preferences — stored server-side and fetched per session.\n * Device-only UI preferences (sendOnEnter, showTimestamps, compactMode) live\n * in localStorage via lib/stores/device-settings-store.ts and are NOT here.\n */\n\nexport const userPreferencesDTOSchema = z.object({\n default_model: z.string(),\n default_summary_model: z.string(),\n\n default_system_prompt: z.string(),\n default_history_limit: z.number().int().positive(),\n\n user_name: z.string(),\n user_avatar: z.string(),\n\n // Appearance — drives lib/themes registry + next-themes scheme.\n theme_id: z.string(),\n theme_scheme: z.enum([\"light\", \"dark\", \"system\"]),\n\n // Chat rendering.\n chat_render_mode: z.enum([\"instant\", \"stream\", \"typewriter\"]),\n typewriter_cps: z.number().int().min(20).max(400),\n chat_bubble_style: z.enum([\"plain\", \"bubble\", \"minimal\"]),\n\n // Timeouts (seconds). Global per-user knobs that override the\n // hard-coded gateway and MCP-runtime defaults. Reasoning models\n // and slow upstreams routinely need >60s, and `npx`/`uvx` MCP\n // installs can take minutes on cold networks — so the defaults\n // are generous (1h) and the bounds permit anything up to 24h.\n gateway_timeout_seconds: z.number().int().min(1).max(86_400),\n mcp_connect_timeout_seconds: z.number().int().min(1).max(86_400),\n});\n\n/** All fields optional → PATCH semantics. Sent fields replace; unsent stay. */\nexport const userPreferencesUpdateSchema = userPreferencesDTOSchema.partial();\n\nexport const defaultUserPreferences: UserPreferencesDTO = {\n default_model: \"\",\n default_summary_model: \"\",\n default_system_prompt: \"You are a helpful assistant.\",\n default_history_limit: 10,\n user_name: \"\",\n user_avatar: \"👤\",\n theme_id: \"default\",\n theme_scheme: \"system\",\n chat_render_mode: \"stream\",\n typewriter_cps: 80,\n chat_bubble_style: \"plain\",\n gateway_timeout_seconds: 3600,\n mcp_connect_timeout_seconds: 3600,\n};\n\nexport type UserPreferencesDTO = z.infer<typeof userPreferencesDTOSchema>;\nexport type UserPreferencesUpdateInput = z.infer<typeof userPreferencesUpdateSchema>;\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/v1/audio/speech/route\",\n pathname: \"/api/v1/audio/speech\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/app/api/v1/audio/speech/route.ts\",\n nextConfigOutput,\n // The static import is used for initialization (methods, dynamic, etc.).\n userland: userland,\n // In Turbopack dev mode, also provide a getter that calls require() on every\n // request. This re-reads from devModuleCache so HMR updates are picked up,\n // and the async wrapper unwraps async-module Promises (ESM-only\n // serverExternalPackages) automatically.\n ...process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER ? {\n getUserland: ()=>import(\"INNER_APP_ROUTE\")\n } : {}\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/v1/audio/speech/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId,\n deploymentId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","import \"server-only\";\nimport { z } from \"zod\";\nimport { defineRoute } from \"@/lib/server/route\";\nimport { forwardGeneration } from \"@/lib/server/gateway\";\n\nconst bodySchema = z.looseObject({ model: z.string().min(1) });\n\nexport const POST = defineRoute({\n auth: \"gateway\",\n body: bodySchema,\n handler: async ({ user, body }) => {\n const { response } = await forwardGeneration(user, \"audio.speech\", body);\n return response;\n },\n});\n"],"names":["USER_CWD","process","env","LOOM_USER_CWD","cwd","ARTIFACTS_ROOT","extFromMime","mime","toLowerCase","artifactDir","logId","artifactPath","index","ext","artifactUrl","encodeURIComponent","persistImageArtifacts","normalized","data","Array","isArray","artifacts","dirEnsured","i","length","entry","e","b64","b64_json","buf","Buffer","from","output_format","path","recursive","writeFile","url","loom_artifact","bytes","byteLength","push","loom_artifacts","map","a","readArtifact","readFile","userPreferencesDTOSchema","object","default_model","string","default_summary_model","default_system_prompt","default_history_limit","number","int","positive","user_name","user_avatar","theme_id","theme_scheme","enum","chat_render_mode","typewriter_cps","min","max","chat_bubble_style","gateway_timeout_seconds","mcp_connect_timeout_seconds","userPreferencesUpdateSchema","partial","defaultUserPreferences","bodySchema","looseObject","model","POST","auth","body","handler","user","response"],"mappings":"wCACA,IAAA,EAAA,EAAA,CAAA,CAAA,QACA,EAAA,EAAA,CAAA,CAAA,QAoBA,IAAMA,EAAWC,QAAQC,GAAG,CAACC,aAAa,EAAIF,QAAQG,GAAG,GACnDC,EAAiB,CAAA,EAAA,EAAA,OAAA,AAAO,EAACL,EAAU,OAAQ,iBAwB1C,SAASS,EAAYC,CAAa,EACrC,MAAO,CAAA,EAAA,EAAA,OAAA,AAAO,EAACL,EAAgBK,EACnC,CAEO,SAASC,EAAaD,CAAa,CAAEE,CAAa,CAAEC,CAAW,EAClE,MAAO,CAAA,EAAA,EAAA,OAAA,AAAO,EAACJ,EAAYC,GAAQ,CAAA,EAAGE,EAAM,CAAC,EAAEC,EAAAA,CAAK,CACxD,CAEO,SAASC,EAAYJ,CAAa,CAAEE,CAAa,EACpD,MAAO,CAAC,sBAAsB,EAAEG,mBAAmBL,GAAO,QAAQ,EAAEE,EAAAA,CAAO,AAC/E,CAUO,eAAeI,EAClBN,CAAa,CACbO,CAAmC,EAEnC,IAAMC,EAAQD,EAAkCC,IAAI,CACpD,GAAI,CAACC,MAAMC,OAAO,CAACF,GAAO,MAAO,EAAE,CAEnC,IAAMG,EAAiC,EAAE,CACrCC,GAAa,EAEjB,IAAK,IAAIC,EAAI,EAAGA,EAAIL,EAAKM,MAAM,CAAED,IAAK,CAClC,IAAME,EAAQP,CAAI,CAACK,EAAE,CACrB,GAAI,CAACE,GAAS,AAAiB,iBAAVA,EAAoB,SAEzC,IAAME,EAA4B,UAAtB,O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AC,EAAW,YAAY,GAE9E,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAChC,IAAI,SAAS,EAAW,KAAK,CAAC,IAAI,CAAE,SAChC,EACA,OAAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,CAGI,IAAyB,EACzB,MAAM,EAAe,EADgB,EAGrC,EAAa,EAAO,kBAAkB,GACtC,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,QAAiB,EAAW,CAAC,GAE5C,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,CAClC,0CACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA5TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAA,AAAW,EAAC,kBACf,uBACA,CACJ,EACJ","ignoreList":[3]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[872031,e=>{"use strict";var t=e.i(902157),r=e.i(750227);let n=process.env.LOOM_USER_CWD||process.cwd(),a=(0,r.resolve)(n,"data","log-artifacts");function i(e){return(0,r.resolve)(a,e)}function s(e,t,n){return(0,r.resolve)(i(e),`${t}.${n}`)}function o(e,t){return`/api/logs/generations/${encodeURIComponent(e)}/images/${t}`}async function l(e,r){let n=r.data;if(!Array.isArray(n))return[];let a=[],l=!1;for(let r=0;r<n.length;r++){let u=n[r];if(!u||"object"!=typeof u)continue;let d="string"==typeof u.b64_json?u.b64_json:null;if(!d)continue;let c=Buffer.from(d,"base64"),p="string"==typeof u.mime?u.mime:"string"==typeof u.output_format?`image/${u.output_format}`:"image/png",m=s(e,r,function(e){switch(e.toLowerCase()){case"image/png":return"png";case"image/jpeg":case"image/jpg":return"jpg";case"image/webp":return"webp";case"image/gif":return"gif";default:return"bin"}}(p));l||((0,t.mkdirSync)(i(e),{recursive:!0}),l=!0),await t.promises.writeFile(m,c),delete u.b64_json,u.url=o(e,r),u.loom_artifact=!0,u.bytes=c.byteLength,u.mime=p,a.push({index:r,mime:p,bytes:c.byteLength,path:m,url:o(e,r)})}return a.length>0&&(r.loom_artifacts=a.map(e=>({index:e.index,url:e.url,mime:e.mime,bytes:e.bytes}))),a}async function u(e,r){for(let n of["png","jpg","webp","gif","bin"]){let a=s(e,r,n);try{let e=await t.promises.readFile(a),r="jpg"===n?"image/jpeg":"bin"===n?"application/octet-stream":`image/${n}`;return{buf:e,mime:r}}catch{}}return null}e.s(["persistImageArtifacts",0,l,"readArtifact",0,u])},341703,952908,438107,e=>{"use strict";var t=e.i(875225),r=e.i(846344),n=e.i(401632),a=e.i(469719);let i=a.z.object({default_model:a.z.string(),default_summary_model:a.z.string(),default_system_prompt:a.z.string(),default_history_limit:a.z.number().int().positive(),user_name:a.z.string(),user_avatar:a.z.string(),theme_id:a.z.string(),theme_scheme:a.z.enum(["light","dark","system"]),chat_render_mode:a.z.enum(["instant","stream","typewriter"]),typewriter_cps:a.z.number().int().min(20).max(400),chat_bubble_style:a.z.enum(["plain","bubble","minimal"]),gateway_timeout_seconds:a.z.number().int().min(1).max(86400),mcp_connect_timeout_seconds:a.z.number().int().min(1).max(86400)}),s=i.partial(),o={default_model:"",default_summary_model:"",default_system_prompt:"You are a helpful assistant.",default_history_limit:10,user_name:"",user_avatar:"👤",theme_id:"default",theme_scheme:"system",chat_render_mode:"stream",typewriter_cps:80,chat_bubble_style:"plain",gateway_timeout_seconds:3600,mcp_connect_timeout_seconds:3600};function l(e){let a=r.db.select({preferences:n.userPreferences.preferences}).from(n.userPreferences).where((0,t.eq)(n.userPreferences.userId,e)).get(),s=a?.preferences??{},l={...o,...s};return i.parse(l)}e.s(["defaultUserPreferences",0,o,"userPreferencesDTOSchema",0,i,"userPreferencesUpdateSchema",0,s],952908),e.s(["getPreferences",0,l,"updatePreferences",0,function(e,t){let a={...l(e),...t},i=new Date().toISOString();return r.db.insert(n.userPreferences).values({userId:e,preferences:a,updatedAt:i}).onConflictDoUpdate({target:n.userPreferences.userId,set:{preferences:a,updatedAt:i}}).run(),a}],438107),e.s([],341703)},585371,e=>{"use strict";var t=e.i(747909),r=e.i(174017),n=e.i(996250),a=e.i(759756),i=e.i(561916),s=e.i(174677),o=e.i(869741),l=e.i(316795),u=e.i(487718),d=e.i(995169),c=e.i(47587),p=e.i(666012),m=e.i(570101),f=e.i(626937),h=e.i(10372),g=e.i(193695);e.i(52474);var v=e.i(600220),_=e.i(469719),y=e.i(456315);e.i(681281);var R=e.i(22438);let b=_.z.object({id:_.z.string().min(1)}),w=_.z.object({model:_.z.string().min(1),variant:_.z.enum(["video","thumbnail","spritesheet"]).optional()}),E=(0,y.defineRoute)({auth:"gateway",params:b,query:w,handler:async({user:e,params:t,query:r})=>(0,R.gatewayProxy)({user:e,modelName:r.model,method:"GET",path:`/videos/${encodeURIComponent(t.id)}/content`,query:r.variant?`variant=${encodeURIComponent(r.variant)}`:void 0})});e.s(["GET",0,E],807140);var C=e.i(807140);let x=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/v1/videos/[id]/content/route",pathname:"/api/v1/videos/[id]/content",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/v1/videos/[id]/content/route.ts",nextConfigOutput:"",userland:C,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:P,serverHooks:S}=x;async function T(e,t,n){n.requestMeta&&(0,a.setRequestMeta)(e,n.requestMeta),x.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let _="/api/v1/videos/[id]/content/route";_=_.replace(/\/index$/,"")||"/";let y=await x.prepare(e,t,{srcPage:_,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:R,deploymentId:b,params:w,nextConfig:E,parsedUrl:C,isDraftMode:A,prerenderManifest:P,routerServerContext:S,isOnDemandRevalidate:T,revalidateOnlyGenerated:N,resolvedPathname:O,clientReferenceManifest:I,serverActionsManifest:U}=y,q=(0,o.normalizeAppPath)(_),j=!!(P.dynamicRoutes[q]||P.routes[O]),z=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,C,!1):t.end("This page could not be found"),null);if(j&&!A){let e=!!P.routes[O],t=P.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await z();throw new g.NoFallbackError}}let D=null;!j||x.isDev||A||(D="/index"===(D=O)?"/":D);let H=!0===x.isDev||!j,$=j&&!H;U&&I&&(0,s.setManifestsSingleton)({page:_,clientReferenceManifest:I,serverActionsManifest:U});let M=e.method||"GET",k=(0,i.getTracer)(),F=k.getActiveScopeSpan(),L=!!(null==S?void 0:S.isWrappedByNextServer),K=!!(0,a.getRequestMeta)(e,"minimalMode"),B=(0,a.getRequestMeta)(e,"incrementalCache")||await x.getIncrementalCache(e,E,P,K);null==B||B.resetRequestCache(),globalThis.__incrementalCache=B;let G={params:w,previewProps:P.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:H,incrementalCache:B,cacheLifeProfiles:E.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>x.onRequestError(e,t,n,a,S)},sharedContext:{buildId:R,deploymentId:b}},W=new l.NodeNextRequest(e),V=new l.NodeNextResponse(t),X=u.NextRequestAdapter.fromNodeNextRequest(W,(0,u.signalFromNodeResponse)(t));try{let a,s=async e=>x.handle(X,G).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=k.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${M} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t),a&&a!==e&&(a.setAttribute("http.route",n),a.updateName(t))}else e.updateName(`${M} ${_}`)}),o=async a=>{var i,o;let l=async({previousCacheEntry:r})=>{try{if(!K&&T&&N&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await s(a);e.fetchMetrics=G.renderOpts.fetchMetrics;let o=G.renderOpts.pendingWaitUntil;o&&n.waitUntil&&(n.waitUntil(o),o=void 0);let l=G.renderOpts.collectedTags;if(!j)return await (0,p.sendResponse)(W,V,i,G.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,m.toNodeOutgoingHttpHeaders)(i.headers);l&&(t[h.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,n=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=h.INFINITE_CACHE?void 0:G.renderOpts.collectedExpire;return{value:{kind:v.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await x.onRequestError(e,t,{routerKind:"App Router",routePath:_,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:T})},!1,S),t}},u=await x.handleResponse({req:e,nextConfig:E,cacheKey:D,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:P,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:N,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:K});if(!j)return null;if((null==u||null==(i=u.value)?void 0:i.kind)!==v.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(o=u.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",T?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,m.fromNodeOutgoingHttpHeaders)(u.value.headers);return K&&j||d.delete(h.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,f.getCacheControlHeader)(u.cacheControl)),await (0,p.sendResponse)(W,V,new Response(u.value.body,{headers:d,status:u.value.status||200})),null};L&&F?await o(F):(a=k.getActiveScopeSpan(),await k.withPropagatedContext(e.headers,()=>k.trace(d.BaseServerSpan.handleRequest,{spanName:`${M} ${_}`,kind:i.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},o),void 0,!L))}catch(t){if(t instanceof g.NoFallbackError||await x.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:T})},!1,S),j)throw t;return await (0,p.sendResponse)(W,V,new Response(null,{status:500})),null}}e.s(["handler",0,T,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:P})},"routeModule",0,x,"serverHooks",0,S,"workAsyncStorage",0,A,"workUnitAsyncStorage",0,P],585371)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=_0kr91st._.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../lib/server/gateway/artifacts.ts","../../../lib/server/preferences/service.ts","../../../lib/schemas/preferences.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../app/api/v1/videos/%5Bid%5D/content/route.ts"],"sourcesContent":["import \"server-only\";\nimport { promises as fs, mkdirSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\n/**\n * Image artifact persistence for `generation_logs`.\n *\n * Why: image-generation upstreams return either a hosted `url` (which\n * expires) or a base64 `b64_json` blob (~MB per image). Persisting the\n * raw b64 inline in `generation_logs.generation` (JSON column) bloats\n * the DB by a factor of 10–100× and makes the log viewer's JSON tree\n * unusable. Mirroring the existing `sanitizeForJsonView` strategy for\n * large text/JSON, we strip the b64 from the log payload and write\n * each image to a per-log directory on disk; the log keeps a stable\n * `url` reference (and `loom_artifact: true` marker) that the FE log\n * viewer reads to render inline thumbnails.\n *\n * The original (untouched) payload is still served to the API caller\n * — only the *log copy* is rewritten. The image-generation playground\n * therefore continues to receive b64_json verbatim.\n */\n\nconst USER_CWD = process.env.LOOM_USER_CWD || process.cwd();\nconst ARTIFACTS_ROOT = resolve(USER_CWD, \"data\", \"log-artifacts\");\n\nexport interface PersistedArtifact {\n /** Position within the upstream `data[]` array. */\n index: number;\n mime: string;\n bytes: number;\n /** Absolute filesystem path. */\n path: string;\n /** Same-origin URL the FE viewer (and the log JSON) reference. */\n url: string;\n}\n\nfunction extFromMime(mime: string): string {\n switch (mime.toLowerCase()) {\n case \"image/png\": return \"png\";\n case \"image/jpeg\":\n case \"image/jpg\": return \"jpg\";\n case \"image/webp\": return \"webp\";\n case \"image/gif\": return \"gif\";\n default: return \"bin\";\n }\n}\n\nexport function artifactDir(logId: string): string {\n return resolve(ARTIFACTS_ROOT, logId);\n}\n\nexport function artifactPath(logId: string, index: number, ext: string): string {\n return resolve(artifactDir(logId), `${index}.${ext}`);\n}\n\nexport function artifactUrl(logId: string, index: number): string {\n return `/api/logs/generations/${encodeURIComponent(logId)}/images/${index}`;\n}\n\n/**\n * Walk the log copy of `normalized.data[]` and persist every `b64_json`\n * to disk. Mutates the passed object in place — callers MUST clone\n * first if they need to preserve the original (e.g. to forward it to\n * the API caller as-is).\n *\n * Returns the descriptors of every artifact written, ordered by index.\n */\nexport async function persistImageArtifacts(\n logId: string,\n normalized: Record<string, unknown>,\n): Promise<PersistedArtifact[]> {\n const data = (normalized as { data?: unknown }).data;\n if (!Array.isArray(data)) return [];\n\n const artifacts: PersistedArtifact[] = [];\n let dirEnsured = false;\n\n for (let i = 0; i < data.length; i++) {\n const entry = data[i];\n if (!entry || typeof entry !== \"object\") continue;\n const e = entry as Record<string, unknown>;\n const b64 = typeof e.b64_json === \"string\" ? e.b64_json : null;\n if (!b64) continue;\n\n // Decode + write.\n const buf = Buffer.from(b64, \"base64\");\n const mime = typeof e.mime === \"string\"\n ? e.mime\n : typeof e.output_format === \"string\"\n ? `image/${e.output_format}`\n : \"image/png\";\n const ext = extFromMime(mime);\n const path = artifactPath(logId, i, ext);\n\n if (!dirEnsured) {\n mkdirSync(artifactDir(logId), { recursive: true });\n dirEnsured = true;\n }\n await fs.writeFile(path, buf);\n\n // Rewrite the entry: drop the b64 blob, point `url` at our\n // same-origin proxy, and mark it so the FE log viewer knows\n // this URL is a loom-managed artifact (vs an expiring upstream\n // URL). Keeping the rest of the upstream entry intact\n // preserves fields like `revised_prompt`.\n delete e.b64_json;\n e.url = artifactUrl(logId, i);\n e.loom_artifact = true;\n e.bytes = buf.byteLength;\n e.mime = mime;\n\n artifacts.push({\n index: i,\n mime,\n bytes: buf.byteLength,\n path,\n url: artifactUrl(logId, i),\n });\n }\n\n // Top-level convenience array — lets the FE viewer enumerate\n // artifacts without re-walking `data[]`.\n if (artifacts.length > 0) {\n (normalized as Record<string, unknown>).loom_artifacts = artifacts.map((a) => ({\n index: a.index,\n url: a.url,\n mime: a.mime,\n bytes: a.bytes,\n }));\n }\n return artifacts;\n}\n\n/** Filesystem read for the artifact route — performs a path-traversal\n * guard since `index` comes off the URL. */\nexport async function readArtifact(\n logId: string,\n index: number,\n): Promise<{ buf: Buffer; mime: string } | null> {\n // Probe each known extension; cheap (≤4 readFile attempts) and avoids\n // listing the directory just to find the right suffix. The first\n // missing file we hit also implicitly probes the parent dir, so\n // there's no need for a separate existsSync — let ENOENT bubble.\n for (const ext of [\"png\", \"jpg\", \"webp\", \"gif\", \"bin\"]) {\n const path = artifactPath(logId, index, ext);\n try {\n const buf = await fs.readFile(path);\n const mime = ext === \"jpg\" ? \"image/jpeg\" : ext === \"bin\" ? \"application/octet-stream\" : `image/${ext}`;\n return { buf, mime };\n } catch {\n // not this ext (or dir missing); fall through\n }\n }\n return null;\n}\n","import \"server-only\";\nimport { eq } from \"drizzle-orm\";\nimport { db } from \"../db\";\nimport { userPreferences } from \"../db/schema\";\nimport {\n defaultUserPreferences,\n userPreferencesDTOSchema,\n type UserPreferencesDTO,\n type UserPreferencesUpdateInput,\n} from \"@/lib/schemas/preferences\";\n\n/**\n * Read the preferences row for a user, merged over server defaults. Always\n * returns a full DTO — fields the user has never set fall back to the\n * defaults defined in lib/schemas/preferences.ts.\n */\nexport function getPreferences(userId: string): UserPreferencesDTO {\n const row = db\n .select({ preferences: userPreferences.preferences })\n .from(userPreferences)\n .where(eq(userPreferences.userId, userId))\n .get();\n\n const stored = (row?.preferences ?? {}) as Partial<UserPreferencesDTO>;\n // Validate stored shape against the schema, falling back to defaults on\n // missing keys or invalid values. Forward-compatible with new fields.\n const merged = { ...defaultUserPreferences, ...stored };\n return userPreferencesDTOSchema.parse(merged);\n}\n\n/**\n * Patch a user's preferences. Provided fields are merged on top of the\n * existing row (upserted as needed). Returns the post-update full DTO.\n */\nexport function updatePreferences(\n userId: string,\n patch: UserPreferencesUpdateInput,\n): UserPreferencesDTO {\n const current = getPreferences(userId);\n const next: UserPreferencesDTO = { ...current, ...patch };\n const now = new Date().toISOString();\n\n db.insert(userPreferences)\n .values({ userId, preferences: next, updatedAt: now })\n .onConflictDoUpdate({\n target: userPreferences.userId,\n set: { preferences: next, updatedAt: now },\n })\n .run();\n\n return next;\n}\n","import { z } from \"zod\";\n\n/**\n * Cross-device user preferences — stored server-side and fetched per session.\n * Device-only UI preferences (sendOnEnter, showTimestamps, compactMode) live\n * in localStorage via lib/stores/device-settings-store.ts and are NOT here.\n */\n\nexport const userPreferencesDTOSchema = z.object({\n default_model: z.string(),\n default_summary_model: z.string(),\n\n default_system_prompt: z.string(),\n default_history_limit: z.number().int().positive(),\n\n user_name: z.string(),\n user_avatar: z.string(),\n\n // Appearance — drives lib/themes registry + next-themes scheme.\n theme_id: z.string(),\n theme_scheme: z.enum([\"light\", \"dark\", \"system\"]),\n\n // Chat rendering.\n chat_render_mode: z.enum([\"instant\", \"stream\", \"typewriter\"]),\n typewriter_cps: z.number().int().min(20).max(400),\n chat_bubble_style: z.enum([\"plain\", \"bubble\", \"minimal\"]),\n\n // Timeouts (seconds). Global per-user knobs that override the\n // hard-coded gateway and MCP-runtime defaults. Reasoning models\n // and slow upstreams routinely need >60s, and `npx`/`uvx` MCP\n // installs can take minutes on cold networks — so the defaults\n // are generous (1h) and the bounds permit anything up to 24h.\n gateway_timeout_seconds: z.number().int().min(1).max(86_400),\n mcp_connect_timeout_seconds: z.number().int().min(1).max(86_400),\n});\n\n/** All fields optional → PATCH semantics. Sent fields replace; unsent stay. */\nexport const userPreferencesUpdateSchema = userPreferencesDTOSchema.partial();\n\nexport const defaultUserPreferences: UserPreferencesDTO = {\n default_model: \"\",\n default_summary_model: \"\",\n default_system_prompt: \"You are a helpful assistant.\",\n default_history_limit: 10,\n user_name: \"\",\n user_avatar: \"👤\",\n theme_id: \"default\",\n theme_scheme: \"system\",\n chat_render_mode: \"stream\",\n typewriter_cps: 80,\n chat_bubble_style: \"plain\",\n gateway_timeout_seconds: 3600,\n mcp_connect_timeout_seconds: 3600,\n};\n\nexport type UserPreferencesDTO = z.infer<typeof userPreferencesDTOSchema>;\nexport type UserPreferencesUpdateInput = z.infer<typeof userPreferencesUpdateSchema>;\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/v1/videos/[id]/content/route\",\n pathname: \"/api/v1/videos/[id]/content\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/app/api/v1/videos/[id]/content/route.ts\",\n nextConfigOutput,\n // The static import is used for initialization (methods, dynamic, etc.).\n userland: userland,\n // In Turbopack dev mode, also provide a getter that calls require() on every\n // request. This re-reads from devModuleCache so HMR updates are picked up,\n // and the async wrapper unwraps async-module Promises (ESM-only\n // serverExternalPackages) automatically.\n ...process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER ? {\n getUserland: ()=>import(\"INNER_APP_ROUTE\")\n } : {}\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/v1/videos/[id]/content/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId,\n deploymentId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","import \"server-only\";\nimport { z } from \"zod\";\nimport { defineRoute } from \"@/lib/server/route\";\nimport { gatewayProxy } from \"@/lib/server/gateway\";\n\nconst paramsSchema = z.object({ id: z.string().min(1) });\nconst querySchema = z.object({\n model: z.string().min(1),\n /** OpenAI: \"video\" (default), \"thumbnail\", or \"spritesheet\". Forwarded verbatim. */\n variant: z.enum([\"video\", \"thumbnail\", \"spritesheet\"]).optional(),\n});\n\n/**\n * GET /v1/videos/{id}/content?model={name}&variant=video|thumbnail|spritesheet\n *\n * Binary download for a completed video job. Pass-through; the\n * upstream sets Content-Type appropriately (video/mp4, image/png, …).\n */\nexport const GET = defineRoute({\n auth: \"gateway\",\n params: paramsSchema,\n query: querySchema,\n handler: async ({ user, params, query }) =>\n gatewayProxy({\n user,\n modelName: query.model,\n method: \"GET\",\n path: `/videos/${encodeURIComponent(params.id)}/content`,\n query: query.variant ? `variant=${encodeURIComponent(query.variant)}` : undefined,\n }),\n});\n"],"names":["USER_CWD","process","env","LOOM_USER_CWD","cwd","ARTIFACTS_ROOT","extFromMime","mime","toLowerCase","artifactDir","logId","artifactPath","index","ext","artifactUrl","encodeURIComponent","persistImageArtifacts","normalized","data","Array","isArray","artifacts","dirEnsured","i","length","entry","e","b64","b64_json","buf","Buffer","from","output_format","path","recursive","writeFile","url","loom_artifact","bytes","byteLength","push","loom_artifacts","map","a","readArtifact","readFile","userPreferencesDTOSchema","object","default_model","string","default_summary_model","default_system_prompt","default_history_limit","number","int","positive","user_name","user_avatar","theme_id","theme_scheme","enum","chat_render_mode","typewriter_cps","min","max","chat_bubble_style","gateway_timeout_seconds","mcp_connect_timeout_seconds","userPreferencesUpdateSchema","partial","defaultUserPreferences","paramsSchema","id","querySchema","model","variant","optional","params","GET","auth","query","handler","user","modelName","method","undefined"],"mappings":"wCACA,IAAA,EAAA,EAAA,CAAA,CAAA,QACA,EAAA,EAAA,CAAA,CAAA,QAoBA,IAAMA,EAAWC,QAAQC,GAAG,CAACC,aAAa,EAAIF,QAAQG,GAAG,GACnDC,EAAiB,CAAA,EAAA,EAAA,OAAA,AAAO,EAACL,EAAU,OAAQ,iBAwB1C,SAASS,EAAYC,CAAa,EACrC,MAAO,CAAA,EAAA,EAAA,OAAA,AAAO,EAACL,EAAgBK,EACnC,CAEO,SAASC,EAAaD,CAAa,CAAEE,CAAa,CAAEC,CAAW,EAClE,MAAO,CAAA,EAAA,EAAA,OAAO,AAAP,EAAQJ,EAAYC,GAAQ,CAAA,EAAGE,EAAM,CAAC,EAAEC,EAAAA,CAAK,CACxD,CAEO,SAASC,EAAYJ,CAAa,CAAEE,CAAa,EACpD,MAAO,CAAC,sBAAsB,EAAEG,mBAAmBL,GAAO,QAAQ,EAAE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rB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,QAAiB,EAAW,CAAC,GAE5C,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA5TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAW,AAAX,EAAY,kBACf,uBACA,CACJ,EACJ","ignoreList":[3]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[872031,e=>{"use strict";var t=e.i(902157),r=e.i(750227);let a=process.env.LOOM_USER_CWD||process.cwd(),n=(0,r.resolve)(a,"data","log-artifacts");function i(e){return(0,r.resolve)(n,e)}function s(e,t,a){return(0,r.resolve)(i(e),`${t}.${a}`)}function o(e,t){return`/api/logs/generations/${encodeURIComponent(e)}/images/${t}`}async function l(e,r){let a=r.data;if(!Array.isArray(a))return[];let n=[],l=!1;for(let r=0;r<a.length;r++){let u=a[r];if(!u||"object"!=typeof u)continue;let d="string"==typeof u.b64_json?u.b64_json:null;if(!d)continue;let c=Buffer.from(d,"base64"),p="string"==typeof u.mime?u.mime:"string"==typeof u.output_format?`image/${u.output_format}`:"image/png",m=s(e,r,function(e){switch(e.toLowerCase()){case"image/png":return"png";case"image/jpeg":case"image/jpg":return"jpg";case"image/webp":return"webp";case"image/gif":return"gif";default:return"bin"}}(p));l||((0,t.mkdirSync)(i(e),{recursive:!0}),l=!0),await t.promises.writeFile(m,c),delete u.b64_json,u.url=o(e,r),u.loom_artifact=!0,u.bytes=c.byteLength,u.mime=p,n.push({index:r,mime:p,bytes:c.byteLength,path:m,url:o(e,r)})}return n.length>0&&(r.loom_artifacts=n.map(e=>({index:e.index,url:e.url,mime:e.mime,bytes:e.bytes}))),n}async function u(e,r){for(let a of["png","jpg","webp","gif","bin"]){let n=s(e,r,a);try{let e=await t.promises.readFile(n),r="jpg"===a?"image/jpeg":"bin"===a?"application/octet-stream":`image/${a}`;return{buf:e,mime:r}}catch{}}return null}e.s(["persistImageArtifacts",0,l,"readArtifact",0,u])},341703,952908,438107,e=>{"use strict";var t=e.i(875225),r=e.i(846344),a=e.i(401632),n=e.i(469719);let i=n.z.object({default_model:n.z.string(),default_summary_model:n.z.string(),default_system_prompt:n.z.string(),default_history_limit:n.z.number().int().positive(),user_name:n.z.string(),user_avatar:n.z.string(),theme_id:n.z.string(),theme_scheme:n.z.enum(["light","dark","system"]),chat_render_mode:n.z.enum(["instant","stream","typewriter"]),typewriter_cps:n.z.number().int().min(20).max(400),chat_bubble_style:n.z.enum(["plain","bubble","minimal"]),gateway_timeout_seconds:n.z.number().int().min(1).max(86400),mcp_connect_timeout_seconds:n.z.number().int().min(1).max(86400)}),s=i.partial(),o={default_model:"",default_summary_model:"",default_system_prompt:"You are a helpful assistant.",default_history_limit:10,user_name:"",user_avatar:"👤",theme_id:"default",theme_scheme:"system",chat_render_mode:"stream",typewriter_cps:80,chat_bubble_style:"plain",gateway_timeout_seconds:3600,mcp_connect_timeout_seconds:3600};function l(e){let n=r.db.select({preferences:a.userPreferences.preferences}).from(a.userPreferences).where((0,t.eq)(a.userPreferences.userId,e)).get(),s=n?.preferences??{},l={...o,...s};return i.parse(l)}e.s(["defaultUserPreferences",0,o,"userPreferencesDTOSchema",0,i,"userPreferencesUpdateSchema",0,s],952908),e.s(["getPreferences",0,l,"updatePreferences",0,function(e,t){let n={...l(e),...t},i=new Date().toISOString();return r.db.insert(a.userPreferences).values({userId:e,preferences:n,updatedAt:i}).onConflictDoUpdate({target:a.userPreferences.userId,set:{preferences:n,updatedAt:i}}).run(),n}],438107),e.s([],341703)},384329,e=>{"use strict";var t=e.i(747909),r=e.i(174017),a=e.i(996250),n=e.i(759756),i=e.i(561916),s=e.i(174677),o=e.i(869741),l=e.i(316795),u=e.i(487718),d=e.i(995169),c=e.i(47587),p=e.i(666012),m=e.i(570101),f=e.i(626937),g=e.i(10372),h=e.i(193695);e.i(52474);var _=e.i(600220),v=e.i(469719),R=e.i(456315),y=e.i(681281);let b=v.z.looseObject({model:v.z.string().min(1)}),w=(0,R.defineRoute)({auth:"gateway",body:b,handler:async({user:e,body:t})=>{let{response:r}=await (0,y.forwardGeneration)(e,"image",t);return r}});e.s(["POST",0,w],832729);var E=e.i(832729);let C=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/v1/images/generations/route",pathname:"/api/v1/images/generations",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/v1/images/generations/route.ts",nextConfigOutput:"",userland:E,...{}}),{workAsyncStorage:x,workUnitAsyncStorage:A,serverHooks:P}=C;async function S(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),C.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/v1/images/generations/route";v=v.replace(/\/index$/,"")||"/";let R=await C.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:y,deploymentId:b,params:w,nextConfig:E,parsedUrl:x,isDraftMode:A,prerenderManifest:P,routerServerContext:S,isOnDemandRevalidate:O,revalidateOnlyGenerated:T,resolvedPathname:N,clientReferenceManifest:I,serverActionsManifest:U}=R,j=(0,o.normalizeAppPath)(v),q=!!(P.dynamicRoutes[j]||P.routes[N]),z=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,x,!1):t.end("This page could not be found"),null);if(q&&!A){let e=!!P.routes[N],t=P.dynamicRoutes[j];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await z();throw new h.NoFallbackError}}let D=null;!q||C.isDev||A||(D="/index"===(D=N)?"/":D);let H=!0===C.isDev||!q,M=q&&!H;U&&I&&(0,s.setManifestsSingleton)({page:v,clientReferenceManifest:I,serverActionsManifest:U});let k=e.method||"GET",$=(0,i.getTracer)(),F=$.getActiveScopeSpan(),L=!!(null==S?void 0:S.isWrappedByNextServer),K=!!(0,n.getRequestMeta)(e,"minimalMode"),B=(0,n.getRequestMeta)(e,"incrementalCache")||await C.getIncrementalCache(e,E,P,K);null==B||B.resetRequestCache(),globalThis.__incrementalCache=B;let G={params:w,previewProps:P.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:H,incrementalCache:B,cacheLifeProfiles:E.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>C.onRequestError(e,t,a,n,S)},sharedContext:{buildId:y,deploymentId:b}},W=new l.NodeNextRequest(e),V=new l.NodeNextResponse(t),X=u.NextRequestAdapter.fromNodeNextRequest(W,(0,u.signalFromNodeResponse)(t));try{let n,s=async e=>C.handle(X,G).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${k} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${k} ${v}`)}),o=async n=>{var i,o;let l=async({previousCacheEntry:r})=>{try{if(!K&&O&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await s(n);e.fetchMetrics=G.renderOpts.fetchMetrics;let o=G.renderOpts.pendingWaitUntil;o&&a.waitUntil&&(a.waitUntil(o),o=void 0);let l=G.renderOpts.collectedTags;if(!q)return await (0,p.sendResponse)(W,V,i,G.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,m.toNodeOutgoingHttpHeaders)(i.headers);l&&(t[g.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,a=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=g.INFINITE_CACHE?void 0:G.renderOpts.collectedExpire;return{value:{kind:_.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await C.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:O})},!1,S),t}},u=await C.handleResponse({req:e,nextConfig:E,cacheKey:D,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:P,isRoutePPREnabled:!1,isOnDemandRevalidate:O,revalidateOnlyGenerated:T,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:K});if(!q)return null;if((null==u||null==(i=u.value)?void 0:i.kind)!==_.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(o=u.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",O?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,m.fromNodeOutgoingHttpHeaders)(u.value.headers);return K&&q||d.delete(g.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,f.getCacheControlHeader)(u.cacheControl)),await (0,p.sendResponse)(W,V,new Response(u.value.body,{headers:d,status:u.value.status||200})),null};L&&F?await o(F):(n=$.getActiveScopeSpan(),await $.withPropagatedContext(e.headers,()=>$.trace(d.BaseServerSpan.handleRequest,{spanName:`${k} ${v}`,kind:i.SpanKind.SERVER,attributes:{"http.method":k,"http.target":e.url}},o),void 0,!L))}catch(t){if(t instanceof h.NoFallbackError||await C.onRequestError(e,t,{routerKind:"App Router",routePath:j,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:O})},!1,S),q)throw t;return await (0,p.sendResponse)(W,V,new Response(null,{status:500})),null}}e.s(["handler",0,S,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:x,workUnitAsyncStorage:A})},"routeModule",0,C,"serverHooks",0,P,"workAsyncStorage",0,x,"workUnitAsyncStorage",0,A],384329)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=_1i4x7k4._.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../lib/server/gateway/artifacts.ts","../../../lib/server/preferences/service.ts","../../../lib/schemas/preferences.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../app/api/v1/images/generations/route.ts"],"sourcesContent":["import \"server-only\";\nimport { promises as fs, mkdirSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\n/**\n * Image artifact persistence for `generation_logs`.\n *\n * Why: image-generation upstreams return either a hosted `url` (which\n * expires) or a base64 `b64_json` blob (~MB per image). Persisting the\n * raw b64 inline in `generation_logs.generation` (JSON column) bloats\n * the DB by a factor of 10–100× and makes the log viewer's JSON tree\n * unusable. Mirroring the existing `sanitizeForJsonView` strategy for\n * large text/JSON, we strip the b64 from the log payload and write\n * each image to a per-log directory on disk; the log keeps a stable\n * `url` reference (and `loom_artifact: true` marker) that the FE log\n * viewer reads to render inline thumbnails.\n *\n * The original (untouched) payload is still served to the API caller\n * — only the *log copy* is rewritten. The image-generation playground\n * therefore continues to receive b64_json verbatim.\n */\n\nconst USER_CWD = process.env.LOOM_USER_CWD || process.cwd();\nconst ARTIFACTS_ROOT = resolve(USER_CWD, \"data\", \"log-artifacts\");\n\nexport interface PersistedArtifact {\n /** Position within the upstream `data[]` array. */\n index: number;\n mime: string;\n bytes: number;\n /** Absolute filesystem path. */\n path: string;\n /** Same-origin URL the FE viewer (and the log JSON) reference. */\n url: string;\n}\n\nfunction extFromMime(mime: string): string {\n switch (mime.toLowerCase()) {\n case \"image/png\": return \"png\";\n case \"image/jpeg\":\n case \"image/jpg\": return \"jpg\";\n case \"image/webp\": return \"webp\";\n case \"image/gif\": return \"gif\";\n default: return \"bin\";\n }\n}\n\nexport function artifactDir(logId: string): string {\n return resolve(ARTIFACTS_ROOT, logId);\n}\n\nexport function artifactPath(logId: string, index: number, ext: string): string {\n return resolve(artifactDir(logId), `${index}.${ext}`);\n}\n\nexport function artifactUrl(logId: string, index: number): string {\n return `/api/logs/generations/${encodeURIComponent(logId)}/images/${index}`;\n}\n\n/**\n * Walk the log copy of `normalized.data[]` and persist every `b64_json`\n * to disk. Mutates the passed object in place — callers MUST clone\n * first if they need to preserve the original (e.g. to forward it to\n * the API caller as-is).\n *\n * Returns the descriptors of every artifact written, ordered by index.\n */\nexport async function persistImageArtifacts(\n logId: string,\n normalized: Record<string, unknown>,\n): Promise<PersistedArtifact[]> {\n const data = (normalized as { data?: unknown }).data;\n if (!Array.isArray(data)) return [];\n\n const artifacts: PersistedArtifact[] = [];\n let dirEnsured = false;\n\n for (let i = 0; i < data.length; i++) {\n const entry = data[i];\n if (!entry || typeof entry !== \"object\") continue;\n const e = entry as Record<string, unknown>;\n const b64 = typeof e.b64_json === \"string\" ? e.b64_json : null;\n if (!b64) continue;\n\n // Decode + write.\n const buf = Buffer.from(b64, \"base64\");\n const mime = typeof e.mime === \"string\"\n ? e.mime\n : typeof e.output_format === \"string\"\n ? `image/${e.output_format}`\n : \"image/png\";\n const ext = extFromMime(mime);\n const path = artifactPath(logId, i, ext);\n\n if (!dirEnsured) {\n mkdirSync(artifactDir(logId), { recursive: true });\n dirEnsured = true;\n }\n await fs.writeFile(path, buf);\n\n // Rewrite the entry: drop the b64 blob, point `url` at our\n // same-origin proxy, and mark it so the FE log viewer knows\n // this URL is a loom-managed artifact (vs an expiring upstream\n // URL). Keeping the rest of the upstream entry intact\n // preserves fields like `revised_prompt`.\n delete e.b64_json;\n e.url = artifactUrl(logId, i);\n e.loom_artifact = true;\n e.bytes = buf.byteLength;\n e.mime = mime;\n\n artifacts.push({\n index: i,\n mime,\n bytes: buf.byteLength,\n path,\n url: artifactUrl(logId, i),\n });\n }\n\n // Top-level convenience array — lets the FE viewer enumerate\n // artifacts without re-walking `data[]`.\n if (artifacts.length > 0) {\n (normalized as Record<string, unknown>).loom_artifacts = artifacts.map((a) => ({\n index: a.index,\n url: a.url,\n mime: a.mime,\n bytes: a.bytes,\n }));\n }\n return artifacts;\n}\n\n/** Filesystem read for the artifact route — performs a path-traversal\n * guard since `index` comes off the URL. */\nexport async function readArtifact(\n logId: string,\n index: number,\n): Promise<{ buf: Buffer; mime: string } | null> {\n // Probe each known extension; cheap (≤4 readFile attempts) and avoids\n // listing the directory just to find the right suffix. The first\n // missing file we hit also implicitly probes the parent dir, so\n // there's no need for a separate existsSync — let ENOENT bubble.\n for (const ext of [\"png\", \"jpg\", \"webp\", \"gif\", \"bin\"]) {\n const path = artifactPath(logId, index, ext);\n try {\n const buf = await fs.readFile(path);\n const mime = ext === \"jpg\" ? \"image/jpeg\" : ext === \"bin\" ? \"application/octet-stream\" : `image/${ext}`;\n return { buf, mime };\n } catch {\n // not this ext (or dir missing); fall through\n }\n }\n return null;\n}\n","import \"server-only\";\nimport { eq } from \"drizzle-orm\";\nimport { db } from \"../db\";\nimport { userPreferences } from \"../db/schema\";\nimport {\n defaultUserPreferences,\n userPreferencesDTOSchema,\n type UserPreferencesDTO,\n type UserPreferencesUpdateInput,\n} from \"@/lib/schemas/preferences\";\n\n/**\n * Read the preferences row for a user, merged over server defaults. Always\n * returns a full DTO — fields the user has never set fall back to the\n * defaults defined in lib/schemas/preferences.ts.\n */\nexport function getPreferences(userId: string): UserPreferencesDTO {\n const row = db\n .select({ preferences: userPreferences.preferences })\n .from(userPreferences)\n .where(eq(userPreferences.userId, userId))\n .get();\n\n const stored = (row?.preferences ?? {}) as Partial<UserPreferencesDTO>;\n // Validate stored shape against the schema, falling back to defaults on\n // missing keys or invalid values. Forward-compatible with new fields.\n const merged = { ...defaultUserPreferences, ...stored };\n return userPreferencesDTOSchema.parse(merged);\n}\n\n/**\n * Patch a user's preferences. Provided fields are merged on top of the\n * existing row (upserted as needed). Returns the post-update full DTO.\n */\nexport function updatePreferences(\n userId: string,\n patch: UserPreferencesUpdateInput,\n): UserPreferencesDTO {\n const current = getPreferences(userId);\n const next: UserPreferencesDTO = { ...current, ...patch };\n const now = new Date().toISOString();\n\n db.insert(userPreferences)\n .values({ userId, preferences: next, updatedAt: now })\n .onConflictDoUpdate({\n target: userPreferences.userId,\n set: { preferences: next, updatedAt: now },\n })\n .run();\n\n return next;\n}\n","import { z } from \"zod\";\n\n/**\n * Cross-device user preferences — stored server-side and fetched per session.\n * Device-only UI preferences (sendOnEnter, showTimestamps, compactMode) live\n * in localStorage via lib/stores/device-settings-store.ts and are NOT here.\n */\n\nexport const userPreferencesDTOSchema = z.object({\n default_model: z.string(),\n default_summary_model: z.string(),\n\n default_system_prompt: z.string(),\n default_history_limit: z.number().int().positive(),\n\n user_name: z.string(),\n user_avatar: z.string(),\n\n // Appearance — drives lib/themes registry + next-themes scheme.\n theme_id: z.string(),\n theme_scheme: z.enum([\"light\", \"dark\", \"system\"]),\n\n // Chat rendering.\n chat_render_mode: z.enum([\"instant\", \"stream\", \"typewriter\"]),\n typewriter_cps: z.number().int().min(20).max(400),\n chat_bubble_style: z.enum([\"plain\", \"bubble\", \"minimal\"]),\n\n // Timeouts (seconds). Global per-user knobs that override the\n // hard-coded gateway and MCP-runtime defaults. Reasoning models\n // and slow upstreams routinely need >60s, and `npx`/`uvx` MCP\n // installs can take minutes on cold networks — so the defaults\n // are generous (1h) and the bounds permit anything up to 24h.\n gateway_timeout_seconds: z.number().int().min(1).max(86_400),\n mcp_connect_timeout_seconds: z.number().int().min(1).max(86_400),\n});\n\n/** All fields optional → PATCH semantics. Sent fields replace; unsent stay. */\nexport const userPreferencesUpdateSchema = userPreferencesDTOSchema.partial();\n\nexport const defaultUserPreferences: UserPreferencesDTO = {\n default_model: \"\",\n default_summary_model: \"\",\n default_system_prompt: \"You are a helpful assistant.\",\n default_history_limit: 10,\n user_name: \"\",\n user_avatar: \"👤\",\n theme_id: \"default\",\n theme_scheme: \"system\",\n chat_render_mode: \"stream\",\n typewriter_cps: 80,\n chat_bubble_style: \"plain\",\n gateway_timeout_seconds: 3600,\n mcp_connect_timeout_seconds: 3600,\n};\n\nexport type UserPreferencesDTO = z.infer<typeof userPreferencesDTOSchema>;\nexport type UserPreferencesUpdateInput = z.infer<typeof userPreferencesUpdateSchema>;\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/v1/images/generations/route\",\n pathname: \"/api/v1/images/generations\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/app/api/v1/images/generations/route.ts\",\n nextConfigOutput,\n // The static import is used for initialization (methods, dynamic, etc.).\n userland: userland,\n // In Turbopack dev mode, also provide a getter that calls require() on every\n // request. This re-reads from devModuleCache so HMR updates are picked up,\n // and the async wrapper unwraps async-module Promises (ESM-only\n // serverExternalPackages) automatically.\n ...process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER ? {\n getUserland: ()=>import(\"INNER_APP_ROUTE\")\n } : {}\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/v1/images/generations/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId,\n deploymentId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","import \"server-only\";\nimport { z } from \"zod\";\nimport { defineRoute } from \"@/lib/server/route\";\nimport { forwardGeneration } from \"@/lib/server/gateway\";\n\nconst bodySchema = z.looseObject({ model: z.string().min(1) });\n\nexport const POST = defineRoute({\n auth: \"gateway\",\n body: bodySchema,\n handler: async ({ user, body }) => {\n const { response } = await forwardGeneration(user, \"image\", body);\n return response;\n },\n});\n"],"names":["USER_CWD","process","env","LOOM_USER_CWD","cwd","ARTIFACTS_ROOT","extFromMime","mime","toLowerCase","artifactDir","logId","artifactPath","index","ext","artifactUrl","encodeURIComponent","persistImageArtifacts","normalized","data","Array","isArray","artifacts","dirEnsured","i","length","entry","e","b64","b64_json","buf","Buffer","from","output_format","path","recursive","writeFile","url","loom_artifact","bytes","byteLength","push","loom_artifacts","map","a","readArtifact","readFile","userPreferencesDTOSchema","object","default_model","string","default_summary_model","default_system_prompt","default_history_limit","number","int","positive","user_name","user_avatar","theme_id","theme_scheme","enum","chat_render_mode","typewriter_cps","min","max","chat_bubble_style","gateway_timeout_seconds","mcp_connect_timeout_seconds","userPreferencesUpdateSchema","partial","defaultUserPreferences","bodySchema","looseObject","model","POST","auth","body","handler","user","response"],"mappings":"wCACA,IAAA,EAAA,EAAA,CAAA,CAAA,QACA,EAAA,EAAA,CAAA,CAAA,QAoBA,IAAMA,EAAWC,QAAQC,GAAG,CAACC,aAAa,EAAIF,QAAQG,GAAG,GACnDC,EAAiB,CAAA,EAAA,EAAA,OAAA,AAAO,EAACL,EAAU,OAAQ,iBAwB1C,SAASS,EAAYC,CAAa,EACrC,MAAO,CAAA,EAAA,EAAA,OAAA,AAAO,EAACL,EAAgBK,EACnC,CAEO,SAASC,EAAaD,CAAa,CAAEE,CAAa,CAAEC,CAAW,EA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Y,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,CAClC,0CACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA5TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAA,AAAW,EAAC,kBACf,uBACA,CACJ,EACJ","ignoreList":[3]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[872031,e=>{"use strict";var t=e.i(902157),r=e.i(750227);let a=process.env.LOOM_USER_CWD||process.cwd(),n=(0,r.resolve)(a,"data","log-artifacts");function i(e){return(0,r.resolve)(n,e)}function s(e,t,a){return(0,r.resolve)(i(e),`${t}.${a}`)}function o(e,t){return`/api/logs/generations/${encodeURIComponent(e)}/images/${t}`}async function l(e,r){let a=r.data;if(!Array.isArray(a))return[];let n=[],l=!1;for(let r=0;r<a.length;r++){let u=a[r];if(!u||"object"!=typeof u)continue;let d="string"==typeof u.b64_json?u.b64_json:null;if(!d)continue;let c=Buffer.from(d,"base64"),p="string"==typeof u.mime?u.mime:"string"==typeof u.output_format?`image/${u.output_format}`:"image/png",m=s(e,r,function(e){switch(e.toLowerCase()){case"image/png":return"png";case"image/jpeg":case"image/jpg":return"jpg";case"image/webp":return"webp";case"image/gif":return"gif";default:return"bin"}}(p));l||((0,t.mkdirSync)(i(e),{recursive:!0}),l=!0),await t.promises.writeFile(m,c),delete u.b64_json,u.url=o(e,r),u.loom_artifact=!0,u.bytes=c.byteLength,u.mime=p,n.push({index:r,mime:p,bytes:c.byteLength,path:m,url:o(e,r)})}return n.length>0&&(r.loom_artifacts=n.map(e=>({index:e.index,url:e.url,mime:e.mime,bytes:e.bytes}))),n}async function u(e,r){for(let a of["png","jpg","webp","gif","bin"]){let n=s(e,r,a);try{let e=await t.promises.readFile(n),r="jpg"===a?"image/jpeg":"bin"===a?"application/octet-stream":`image/${a}`;return{buf:e,mime:r}}catch{}}return null}e.s(["persistImageArtifacts",0,l,"readArtifact",0,u])},341703,952908,438107,e=>{"use strict";var t=e.i(875225),r=e.i(846344),a=e.i(401632),n=e.i(469719);let i=n.z.object({default_model:n.z.string(),default_summary_model:n.z.string(),default_system_prompt:n.z.string(),default_history_limit:n.z.number().int().positive(),user_name:n.z.string(),user_avatar:n.z.string(),theme_id:n.z.string(),theme_scheme:n.z.enum(["light","dark","system"]),chat_render_mode:n.z.enum(["instant","stream","typewriter"]),typewriter_cps:n.z.number().int().min(20).max(400),chat_bubble_style:n.z.enum(["plain","bubble","minimal"]),gateway_timeout_seconds:n.z.number().int().min(1).max(86400),mcp_connect_timeout_seconds:n.z.number().int().min(1).max(86400)}),s=i.partial(),o={default_model:"",default_summary_model:"",default_system_prompt:"You are a helpful assistant.",default_history_limit:10,user_name:"",user_avatar:"👤",theme_id:"default",theme_scheme:"system",chat_render_mode:"stream",typewriter_cps:80,chat_bubble_style:"plain",gateway_timeout_seconds:3600,mcp_connect_timeout_seconds:3600};function l(e){let n=r.db.select({preferences:a.userPreferences.preferences}).from(a.userPreferences).where((0,t.eq)(a.userPreferences.userId,e)).get(),s=n?.preferences??{},l={...o,...s};return i.parse(l)}e.s(["defaultUserPreferences",0,o,"userPreferencesDTOSchema",0,i,"userPreferencesUpdateSchema",0,s],952908),e.s(["getPreferences",0,l,"updatePreferences",0,function(e,t){let n={...l(e),...t},i=new Date().toISOString();return r.db.insert(a.userPreferences).values({userId:e,preferences:n,updatedAt:i}).onConflictDoUpdate({target:a.userPreferences.userId,set:{preferences:n,updatedAt:i}}).run(),n}],438107),e.s([],341703)},183334,e=>{"use strict";var t=e.i(747909),r=e.i(174017),a=e.i(996250),n=e.i(759756),i=e.i(561916),s=e.i(174677),o=e.i(869741),l=e.i(316795),u=e.i(487718),d=e.i(995169),c=e.i(47587),p=e.i(666012),m=e.i(570101),f=e.i(626937),h=e.i(10372),g=e.i(193695);e.i(52474);var _=e.i(600220),v=e.i(456315);e.i(681281);var R=e.i(22438),w=e.i(803028);let y=(0,v.defineRoute)({auth:"gateway",handler:async({req:e,user:t})=>{if(!(e.headers.get("Content-Type")??"").toLowerCase().startsWith("multipart/form-data"))throw(0,w.badRequest)("POST /v1/audio/transcriptions expects multipart/form-data");let r=await e.formData(),{response:a}=await (0,R.forwardMultipartGeneration)(t,"audio.transcription",r);return a}});e.s(["POST",0,y],924956);var b=e.i(924956);let C=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/v1/audio/transcriptions/route",pathname:"/api/v1/audio/transcriptions",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/v1/audio/transcriptions/route.ts",nextConfigOutput:"",userland:b,...{}}),{workAsyncStorage:E,workUnitAsyncStorage:x,serverHooks:A}=C;async function P(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),C.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/v1/audio/transcriptions/route";v=v.replace(/\/index$/,"")||"/";let R=await C.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:w,deploymentId:y,params:b,nextConfig:E,parsedUrl:x,isDraftMode:A,prerenderManifest:P,routerServerContext:S,isOnDemandRevalidate:T,revalidateOnlyGenerated:O,resolvedPathname:N,clientReferenceManifest:I,serverActionsManifest:U}=R,q=(0,o.normalizeAppPath)(v),j=!!(P.dynamicRoutes[q]||P.routes[N]),D=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,x,!1):t.end("This page could not be found"),null);if(j&&!A){let e=!!P.routes[N],t=P.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await D();throw new g.NoFallbackError}}let H=null;!j||C.isDev||A||(H="/index"===(H=N)?"/":H);let M=!0===C.isDev||!j,k=j&&!M;U&&I&&(0,s.setManifestsSingleton)({page:v,clientReferenceManifest:I,serverActionsManifest:U});let z=e.method||"GET",$=(0,i.getTracer)(),F=$.getActiveScopeSpan(),L=!!(null==S?void 0:S.isWrappedByNextServer),K=!!(0,n.getRequestMeta)(e,"minimalMode"),B=(0,n.getRequestMeta)(e,"incrementalCache")||await C.getIncrementalCache(e,E,P,K);null==B||B.resetRequestCache(),globalThis.__incrementalCache=B;let W={params:b,previewProps:P.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:M,incrementalCache:B,cacheLifeProfiles:E.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>C.onRequestError(e,t,a,n,S)},sharedContext:{buildId:w,deploymentId:y}},G=new l.NodeNextRequest(e),V=new l.NodeNextResponse(t),X=u.NextRequestAdapter.fromNodeNextRequest(G,(0,u.signalFromNodeResponse)(t));try{let n,s=async e=>C.handle(X,W).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${z} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${z} ${v}`)}),o=async n=>{var i,o;let l=async({previousCacheEntry:r})=>{try{if(!K&&T&&O&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await s(n);e.fetchMetrics=W.renderOpts.fetchMetrics;let o=W.renderOpts.pendingWaitUntil;o&&a.waitUntil&&(a.waitUntil(o),o=void 0);let l=W.renderOpts.collectedTags;if(!j)return await (0,p.sendResponse)(G,V,i,W.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,m.toNodeOutgoingHttpHeaders)(i.headers);l&&(t[h.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==W.renderOpts.collectedRevalidate&&!(W.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&W.renderOpts.collectedRevalidate,a=void 0===W.renderOpts.collectedExpire||W.renderOpts.collectedExpire>=h.INFINITE_CACHE?void 0:W.renderOpts.collectedExpire;return{value:{kind:_.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await C.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:k,isOnDemandRevalidate:T})},!1,S),t}},u=await C.handleResponse({req:e,nextConfig:E,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:P,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:O,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:K});if(!j)return null;if((null==u||null==(i=u.value)?void 0:i.kind)!==_.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(o=u.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",T?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,m.fromNodeOutgoingHttpHeaders)(u.value.headers);return K&&j||d.delete(h.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,f.getCacheControlHeader)(u.cacheControl)),await (0,p.sendResponse)(G,V,new Response(u.value.body,{headers:d,status:u.value.status||200})),null};L&&F?await o(F):(n=$.getActiveScopeSpan(),await $.withPropagatedContext(e.headers,()=>$.trace(d.BaseServerSpan.handleRequest,{spanName:`${z} ${v}`,kind:i.SpanKind.SERVER,attributes:{"http.method":z,"http.target":e.url}},o),void 0,!L))}catch(t){if(t instanceof g.NoFallbackError||await C.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:k,isOnDemandRevalidate:T})},!1,S),j)throw t;return await (0,p.sendResponse)(G,V,new Response(null,{status:500})),null}}e.s(["handler",0,P,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:E,workUnitAsyncStorage:x})},"routeModule",0,C,"serverHooks",0,A,"workAsyncStorage",0,E,"workUnitAsyncStorage",0,x],183334)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=_1lk_ovb._.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../lib/server/gateway/artifacts.ts","../../../lib/server/preferences/service.ts","../../../lib/schemas/preferences.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../app/api/v1/audio/transcriptions/route.ts"],"sourcesContent":["import \"server-only\";\nimport { promises as fs, mkdirSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\n/**\n * Image artifact persistence for `generation_logs`.\n *\n * Why: image-generation upstreams return either a hosted `url` (which\n * expires) or a base64 `b64_json` blob (~MB per image). Persisting the\n * raw b64 inline in `generation_logs.generation` (JSON column) bloats\n * the DB by a factor of 10–100× and makes the log viewer's JSON tree\n * unusable. Mirroring the existing `sanitizeForJsonView` strategy for\n * large text/JSON, we strip the b64 from the log payload and write\n * each image to a per-log directory on disk; the log keeps a stable\n * `url` reference (and `loom_artifact: true` marker) that the FE log\n * viewer reads to render inline thumbnails.\n *\n * The original (untouched) payload is still served to the API caller\n * — only the *log copy* is rewritten. The image-generation playground\n * therefore continues to receive b64_json verbatim.\n */\n\nconst USER_CWD = process.env.LOOM_USER_CWD || process.cwd();\nconst ARTIFACTS_ROOT = resolve(USER_CWD, \"data\", \"log-artifacts\");\n\nexport interface PersistedArtifact {\n /** Position within the upstream `data[]` array. */\n index: number;\n mime: string;\n bytes: number;\n /** Absolute filesystem path. */\n path: string;\n /** Same-origin URL the FE viewer (and the log JSON) reference. */\n url: string;\n}\n\nfunction extFromMime(mime: string): string {\n switch (mime.toLowerCase()) {\n case \"image/png\": return \"png\";\n case \"image/jpeg\":\n case \"image/jpg\": return \"jpg\";\n case \"image/webp\": return \"webp\";\n case \"image/gif\": return \"gif\";\n default: return \"bin\";\n }\n}\n\nexport function artifactDir(logId: string): string {\n return resolve(ARTIFACTS_ROOT, logId);\n}\n\nexport function artifactPath(logId: string, index: number, ext: string): string {\n return resolve(artifactDir(logId), `${index}.${ext}`);\n}\n\nexport function artifactUrl(logId: string, index: number): string {\n return `/api/logs/generations/${encodeURIComponent(logId)}/images/${index}`;\n}\n\n/**\n * Walk the log copy of `normalized.data[]` and persist every `b64_json`\n * to disk. Mutates the passed object in place — callers MUST clone\n * first if they need to preserve the original (e.g. to forward it to\n * the API caller as-is).\n *\n * Returns the descriptors of every artifact written, ordered by index.\n */\nexport async function persistImageArtifacts(\n logId: string,\n normalized: Record<string, unknown>,\n): Promise<PersistedArtifact[]> {\n const data = (normalized as { data?: unknown }).data;\n if (!Array.isArray(data)) return [];\n\n const artifacts: PersistedArtifact[] = [];\n let dirEnsured = false;\n\n for (let i = 0; i < data.length; i++) {\n const entry = data[i];\n if (!entry || typeof entry !== \"object\") continue;\n const e = entry as Record<string, unknown>;\n const b64 = typeof e.b64_json === \"string\" ? e.b64_json : null;\n if (!b64) continue;\n\n // Decode + write.\n const buf = Buffer.from(b64, \"base64\");\n const mime = typeof e.mime === \"string\"\n ? e.mime\n : typeof e.output_format === \"string\"\n ? `image/${e.output_format}`\n : \"image/png\";\n const ext = extFromMime(mime);\n const path = artifactPath(logId, i, ext);\n\n if (!dirEnsured) {\n mkdirSync(artifactDir(logId), { recursive: true });\n dirEnsured = true;\n }\n await fs.writeFile(path, buf);\n\n // Rewrite the entry: drop the b64 blob, point `url` at our\n // same-origin proxy, and mark it so the FE log viewer knows\n // this URL is a loom-managed artifact (vs an expiring upstream\n // URL). Keeping the rest of the upstream entry intact\n // preserves fields like `revised_prompt`.\n delete e.b64_json;\n e.url = artifactUrl(logId, i);\n e.loom_artifact = true;\n e.bytes = buf.byteLength;\n e.mime = mime;\n\n artifacts.push({\n index: i,\n mime,\n bytes: buf.byteLength,\n path,\n url: artifactUrl(logId, i),\n });\n }\n\n // Top-level convenience array — lets the FE viewer enumerate\n // artifacts without re-walking `data[]`.\n if (artifacts.length > 0) {\n (normalized as Record<string, unknown>).loom_artifacts = artifacts.map((a) => ({\n index: a.index,\n url: a.url,\n mime: a.mime,\n bytes: a.bytes,\n }));\n }\n return artifacts;\n}\n\n/** Filesystem read for the artifact route — performs a path-traversal\n * guard since `index` comes off the URL. */\nexport async function readArtifact(\n logId: string,\n index: number,\n): Promise<{ buf: Buffer; mime: string } | null> {\n // Probe each known extension; cheap (≤4 readFile attempts) and avoids\n // listing the directory just to find the right suffix. The first\n // missing file we hit also implicitly probes the parent dir, so\n // there's no need for a separate existsSync — let ENOENT bubble.\n for (const ext of [\"png\", \"jpg\", \"webp\", \"gif\", \"bin\"]) {\n const path = artifactPath(logId, index, ext);\n try {\n const buf = await fs.readFile(path);\n const mime = ext === \"jpg\" ? \"image/jpeg\" : ext === \"bin\" ? \"application/octet-stream\" : `image/${ext}`;\n return { buf, mime };\n } catch {\n // not this ext (or dir missing); fall through\n }\n }\n return null;\n}\n","import \"server-only\";\nimport { eq } from \"drizzle-orm\";\nimport { db } from \"../db\";\nimport { userPreferences } from \"../db/schema\";\nimport {\n defaultUserPreferences,\n userPreferencesDTOSchema,\n type UserPreferencesDTO,\n type UserPreferencesUpdateInput,\n} from \"@/lib/schemas/preferences\";\n\n/**\n * Read the preferences row for a user, merged over server defaults. Always\n * returns a full DTO — fields the user has never set fall back to the\n * defaults defined in lib/schemas/preferences.ts.\n */\nexport function getPreferences(userId: string): UserPreferencesDTO {\n const row = db\n .select({ preferences: userPreferences.preferences })\n .from(userPreferences)\n .where(eq(userPreferences.userId, userId))\n .get();\n\n const stored = (row?.preferences ?? {}) as Partial<UserPreferencesDTO>;\n // Validate stored shape against the schema, falling back to defaults on\n // missing keys or invalid values. Forward-compatible with new fields.\n const merged = { ...defaultUserPreferences, ...stored };\n return userPreferencesDTOSchema.parse(merged);\n}\n\n/**\n * Patch a user's preferences. Provided fields are merged on top of the\n * existing row (upserted as needed). Returns the post-update full DTO.\n */\nexport function updatePreferences(\n userId: string,\n patch: UserPreferencesUpdateInput,\n): UserPreferencesDTO {\n const current = getPreferences(userId);\n const next: UserPreferencesDTO = { ...current, ...patch };\n const now = new Date().toISOString();\n\n db.insert(userPreferences)\n .values({ userId, preferences: next, updatedAt: now })\n .onConflictDoUpdate({\n target: userPreferences.userId,\n set: { preferences: next, updatedAt: now },\n })\n .run();\n\n return next;\n}\n","import { z } from \"zod\";\n\n/**\n * Cross-device user preferences — stored server-side and fetched per session.\n * Device-only UI preferences (sendOnEnter, showTimestamps, compactMode) live\n * in localStorage via lib/stores/device-settings-store.ts and are NOT here.\n */\n\nexport const userPreferencesDTOSchema = z.object({\n default_model: z.string(),\n default_summary_model: z.string(),\n\n default_system_prompt: z.string(),\n default_history_limit: z.number().int().positive(),\n\n user_name: z.string(),\n user_avatar: z.string(),\n\n // Appearance — drives lib/themes registry + next-themes scheme.\n theme_id: z.string(),\n theme_scheme: z.enum([\"light\", \"dark\", \"system\"]),\n\n // Chat rendering.\n chat_render_mode: z.enum([\"instant\", \"stream\", \"typewriter\"]),\n typewriter_cps: z.number().int().min(20).max(400),\n chat_bubble_style: z.enum([\"plain\", \"bubble\", \"minimal\"]),\n\n // Timeouts (seconds). Global per-user knobs that override the\n // hard-coded gateway and MCP-runtime defaults. Reasoning models\n // and slow upstreams routinely need >60s, and `npx`/`uvx` MCP\n // installs can take minutes on cold networks — so the defaults\n // are generous (1h) and the bounds permit anything up to 24h.\n gateway_timeout_seconds: z.number().int().min(1).max(86_400),\n mcp_connect_timeout_seconds: z.number().int().min(1).max(86_400),\n});\n\n/** All fields optional → PATCH semantics. Sent fields replace; unsent stay. */\nexport const userPreferencesUpdateSchema = userPreferencesDTOSchema.partial();\n\nexport const defaultUserPreferences: UserPreferencesDTO = {\n default_model: \"\",\n default_summary_model: \"\",\n default_system_prompt: \"You are a helpful assistant.\",\n default_history_limit: 10,\n user_name: \"\",\n user_avatar: \"👤\",\n theme_id: \"default\",\n theme_scheme: \"system\",\n chat_render_mode: \"stream\",\n typewriter_cps: 80,\n chat_bubble_style: \"plain\",\n gateway_timeout_seconds: 3600,\n mcp_connect_timeout_seconds: 3600,\n};\n\nexport type UserPreferencesDTO = z.infer<typeof userPreferencesDTOSchema>;\nexport type UserPreferencesUpdateInput = z.infer<typeof userPreferencesUpdateSchema>;\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/v1/audio/transcriptions/route\",\n pathname: \"/api/v1/audio/transcriptions\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/app/api/v1/audio/transcriptions/route.ts\",\n nextConfigOutput,\n // The static import is used for initialization (methods, dynamic, etc.).\n userland: userland,\n // In Turbopack dev mode, also provide a getter that calls require() on every\n // request. This re-reads from devModuleCache so HMR updates are picked up,\n // and the async wrapper unwraps async-module Promises (ESM-only\n // serverExternalPackages) automatically.\n ...process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER ? {\n getUserland: ()=>import(\"INNER_APP_ROUTE\")\n } : {}\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/v1/audio/transcriptions/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId,\n deploymentId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","import \"server-only\";\nimport { defineRoute } from \"@/lib/server/route\";\nimport { forwardMultipartGeneration } from \"@/lib/server/gateway\";\nimport { badRequest } from \"@/lib/server/response\";\n\nexport const POST = defineRoute({\n auth: \"gateway\",\n handler: async ({ req, user }) => {\n const ct = req.headers.get(\"Content-Type\") ?? \"\";\n if (!ct.toLowerCase().startsWith(\"multipart/form-data\")) {\n throw badRequest(\"POST /v1/audio/transcriptions expects multipart/form-data\");\n }\n const form = await req.formData();\n const { response } = await forwardMultipartGeneration(user, \"audio.transcription\", form);\n return response;\n },\n});\n\n"],"names":["USER_CWD","process","env","LOOM_USER_CWD","cwd","ARTIFACTS_ROOT","extFromMime","mime","toLowerCase","artifactDir","logId","artifactPath","index","ext","artifactUrl","encodeURIComponent","persistImageArtifacts","normalized","data","Array","isArray","artifacts","dirEnsured","i","length","entry","e","b64","b64_json","buf","Buffer","from","output_format","path","recursive","writeFile","url","loom_artifact","bytes","byteLength","push","loom_artifacts","map","a","readArtifact","readFile","userPreferencesDTOSchema","object","default_model","string","default_summary_model","default_system_prompt","default_history_limit","number","int","positive","user_name","user_avatar","theme_id","theme_scheme","enum","chat_render_mode","typewriter_cps","min","max","chat_bubble_style","gateway_timeout_seconds","mcp_connect_timeout_seconds","userPreferencesUpdateSchema","partial","defaultUserPreferences","POST","auth","handler","req","user","ct","headers","get","startsWith","form","formData","response"],"mappings":"wCACA,IAAA,EAAA,EAAA,CAAA,CAAA,QACA,EAAA,EAAA,CAAA,CAAA,QAoBA,IAAMA,EAAWC,QAAQC,GAAG,CAACC,aAAa,EAAIF,QAAQG,GAAG,GACnDC,EAAiB,CAAA,EAAA,EAAA,OAAA,AAAO,EAACL,EAAU,OAAQ,iBAwB1C,SAASS,EAAYC,CAAa,EACrC,MAAO,CAAA,EAAA,EAAA,OAAA,AAAO,EAACL,EAAgBK,EACnC,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AG,AAC1B,CACJ,EAAG,QAAiB,EAAW,CAAC,GAE5C,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GATmB,AAShB,EAAY,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA5TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAA,AAAW,EAAC,CACf,wCACA,CACJ,EACJ","ignoreList":[3]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[872031,e=>{"use strict";var t=e.i(902157),r=e.i(750227);let n=process.env.LOOM_USER_CWD||process.cwd(),a=(0,r.resolve)(n,"data","log-artifacts");function i(e){return(0,r.resolve)(a,e)}function s(e,t,n){return(0,r.resolve)(i(e),`${t}.${n}`)}function o(e,t){return`/api/logs/generations/${encodeURIComponent(e)}/images/${t}`}async function l(e,r){let n=r.data;if(!Array.isArray(n))return[];let a=[],l=!1;for(let r=0;r<n.length;r++){let u=n[r];if(!u||"object"!=typeof u)continue;let d="string"==typeof u.b64_json?u.b64_json:null;if(!d)continue;let c=Buffer.from(d,"base64"),p="string"==typeof u.mime?u.mime:"string"==typeof u.output_format?`image/${u.output_format}`:"image/png",m=s(e,r,function(e){switch(e.toLowerCase()){case"image/png":return"png";case"image/jpeg":case"image/jpg":return"jpg";case"image/webp":return"webp";case"image/gif":return"gif";default:return"bin"}}(p));l||((0,t.mkdirSync)(i(e),{recursive:!0}),l=!0),await t.promises.writeFile(m,c),delete u.b64_json,u.url=o(e,r),u.loom_artifact=!0,u.bytes=c.byteLength,u.mime=p,a.push({index:r,mime:p,bytes:c.byteLength,path:m,url:o(e,r)})}return a.length>0&&(r.loom_artifacts=a.map(e=>({index:e.index,url:e.url,mime:e.mime,bytes:e.bytes}))),a}async function u(e,r){for(let n of["png","jpg","webp","gif","bin"]){let a=s(e,r,n);try{let e=await t.promises.readFile(a),r="jpg"===n?"image/jpeg":"bin"===n?"application/octet-stream":`image/${n}`;return{buf:e,mime:r}}catch{}}return null}e.s(["persistImageArtifacts",0,l,"readArtifact",0,u])},341703,952908,438107,e=>{"use strict";var t=e.i(875225),r=e.i(846344),n=e.i(401632),a=e.i(469719);let i=a.z.object({default_model:a.z.string(),default_summary_model:a.z.string(),default_system_prompt:a.z.string(),default_history_limit:a.z.number().int().positive(),user_name:a.z.string(),user_avatar:a.z.string(),theme_id:a.z.string(),theme_scheme:a.z.enum(["light","dark","system"]),chat_render_mode:a.z.enum(["instant","stream","typewriter"]),typewriter_cps:a.z.number().int().min(20).max(400),chat_bubble_style:a.z.enum(["plain","bubble","minimal"]),gateway_timeout_seconds:a.z.number().int().min(1).max(86400),mcp_connect_timeout_seconds:a.z.number().int().min(1).max(86400)}),s=i.partial(),o={default_model:"",default_summary_model:"",default_system_prompt:"You are a helpful assistant.",default_history_limit:10,user_name:"",user_avatar:"👤",theme_id:"default",theme_scheme:"system",chat_render_mode:"stream",typewriter_cps:80,chat_bubble_style:"plain",gateway_timeout_seconds:3600,mcp_connect_timeout_seconds:3600};function l(e){let a=r.db.select({preferences:n.userPreferences.preferences}).from(n.userPreferences).where((0,t.eq)(n.userPreferences.userId,e)).get(),s=a?.preferences??{},l={...o,...s};return i.parse(l)}e.s(["defaultUserPreferences",0,o,"userPreferencesDTOSchema",0,i,"userPreferencesUpdateSchema",0,s],952908),e.s(["getPreferences",0,l,"updatePreferences",0,function(e,t){let a={...l(e),...t},i=new Date().toISOString();return r.db.insert(n.userPreferences).values({userId:e,preferences:a,updatedAt:i}).onConflictDoUpdate({target:n.userPreferences.userId,set:{preferences:a,updatedAt:i}}).run(),a}],438107),e.s([],341703)},32705,e=>{"use strict";var t=e.i(747909),r=e.i(174017),n=e.i(996250),a=e.i(759756),i=e.i(561916),s=e.i(174677),o=e.i(869741),l=e.i(316795),u=e.i(487718),d=e.i(995169),c=e.i(47587),p=e.i(666012),m=e.i(570101),f=e.i(626937),g=e.i(10372),h=e.i(193695);e.i(52474);var _=e.i(600220),v=e.i(469719),b=e.i(456315),R=e.i(681281);let y=v.z.looseObject({model:v.z.string().min(1)}),w=(0,b.defineRoute)({auth:"gateway",body:y,handler:async({user:e,body:t})=>{let{response:r}=await (0,R.forwardGeneration)(e,"embedding",t);return r}});e.s(["POST",0,w],664282);var E=e.i(664282);let C=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/v1/embeddings/route",pathname:"/api/v1/embeddings",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/v1/embeddings/route.ts",nextConfigOutput:"",userland:E,...{}}),{workAsyncStorage:x,workUnitAsyncStorage:A,serverHooks:P}=C;async function S(e,t,n){n.requestMeta&&(0,a.setRequestMeta)(e,n.requestMeta),C.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/v1/embeddings/route";v=v.replace(/\/index$/,"")||"/";let b=await C.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!b)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:R,deploymentId:y,params:w,nextConfig:E,parsedUrl:x,isDraftMode:A,prerenderManifest:P,routerServerContext:S,isOnDemandRevalidate:O,revalidateOnlyGenerated:T,resolvedPathname:N,clientReferenceManifest:I,serverActionsManifest:U}=b,j=(0,o.normalizeAppPath)(v),q=!!(P.dynamicRoutes[j]||P.routes[N]),z=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,x,!1):t.end("This page could not be found"),null);if(q&&!A){let e=!!P.routes[N],t=P.dynamicRoutes[j];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await z();throw new h.NoFallbackError}}let D=null;!q||C.isDev||A||(D="/index"===(D=N)?"/":D);let H=!0===C.isDev||!q,M=q&&!H;U&&I&&(0,s.setManifestsSingleton)({page:v,clientReferenceManifest:I,serverActionsManifest:U});let k=e.method||"GET",$=(0,i.getTracer)(),F=$.getActiveScopeSpan(),L=!!(null==S?void 0:S.isWrappedByNextServer),K=!!(0,a.getRequestMeta)(e,"minimalMode"),B=(0,a.getRequestMeta)(e,"incrementalCache")||await C.getIncrementalCache(e,E,P,K);null==B||B.resetRequestCache(),globalThis.__incrementalCache=B;let G={params:w,previewProps:P.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:H,incrementalCache:B,cacheLifeProfiles:E.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>C.onRequestError(e,t,n,a,S)},sharedContext:{buildId:R,deploymentId:y}},W=new l.NodeNextRequest(e),V=new l.NodeNextResponse(t),X=u.NextRequestAdapter.fromNodeNextRequest(W,(0,u.signalFromNodeResponse)(t));try{let a,s=async e=>C.handle(X,G).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${k} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t),a&&a!==e&&(a.setAttribute("http.route",n),a.updateName(t))}else e.updateName(`${k} ${v}`)}),o=async a=>{var i,o;let l=async({previousCacheEntry:r})=>{try{if(!K&&O&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await s(a);e.fetchMetrics=G.renderOpts.fetchMetrics;let o=G.renderOpts.pendingWaitUntil;o&&n.waitUntil&&(n.waitUntil(o),o=void 0);let l=G.renderOpts.collectedTags;if(!q)return await (0,p.sendResponse)(W,V,i,G.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,m.toNodeOutgoingHttpHeaders)(i.headers);l&&(t[g.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,n=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=g.INFINITE_CACHE?void 0:G.renderOpts.collectedExpire;return{value:{kind:_.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await C.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:O})},!1,S),t}},u=await C.handleResponse({req:e,nextConfig:E,cacheKey:D,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:P,isRoutePPREnabled:!1,isOnDemandRevalidate:O,revalidateOnlyGenerated:T,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:K});if(!q)return null;if((null==u||null==(i=u.value)?void 0:i.kind)!==_.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(o=u.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",O?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,m.fromNodeOutgoingHttpHeaders)(u.value.headers);return K&&q||d.delete(g.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,f.getCacheControlHeader)(u.cacheControl)),await (0,p.sendResponse)(W,V,new Response(u.value.body,{headers:d,status:u.value.status||200})),null};L&&F?await o(F):(a=$.getActiveScopeSpan(),await $.withPropagatedContext(e.headers,()=>$.trace(d.BaseServerSpan.handleRequest,{spanName:`${k} ${v}`,kind:i.SpanKind.SERVER,attributes:{"http.method":k,"http.target":e.url}},o),void 0,!L))}catch(t){if(t instanceof h.NoFallbackError||await C.onRequestError(e,t,{routerKind:"App Router",routePath:j,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:O})},!1,S),q)throw t;return await (0,p.sendResponse)(W,V,new Response(null,{status:500})),null}}e.s(["handler",0,S,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:x,workUnitAsyncStorage:A})},"routeModule",0,C,"serverHooks",0,P,"workAsyncStorage",0,x,"workUnitAsyncStorage",0,A],32705)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=_1wk63w9._.js.map
|