@shepai/cli 1.149.0 → 1.149.1
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/dist/packages/core/src/application/use-cases/features/get-branch-sync-status.use-case.d.ts.map +1 -1
- package/dist/packages/core/src/application/use-cases/features/get-branch-sync-status.use-case.js +4 -0
- package/dist/src/presentation/web/components/common/control-center-drawer/feature-drawer-client.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/control-center-drawer/feature-drawer-client.js +6 -3
- package/dist/src/presentation/web/next.config.d.ts.map +1 -1
- package/dist/src/presentation/web/next.config.js +0 -3
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/fallback-build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +3 -3
- package/web/.next/required-server-files.js +2 -3
- package/web/.next/required-server-files.json +2 -3
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/_not-found/page/server-reference-manifest.json +3 -3
- package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/settings/page/server-reference-manifest.json +8 -8
- package/web/.next/server/app/settings/page.js.nft.json +1 -1
- package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/skills/page/server-reference-manifest.json +8 -8
- package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/tools/page/server-reference-manifest.json +8 -8
- package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/version/page/server-reference-manifest.json +3 -3
- package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
- package/web/.next/server/chunks/403f9_next_dist_esm_build_templates_app-route_370c43b1.js +1 -1
- package/web/.next/server/chunks/403f9_next_dist_esm_build_templates_app-route_370c43b1.js.map +1 -1
- package/web/.next/server/chunks/403f9_next_dist_esm_build_templates_app-route_4d623b8e.js +1 -1
- package/web/.next/server/chunks/403f9_next_dist_esm_build_templates_app-route_4d623b8e.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__0866d2b5._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__0866d2b5._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__0d33c29e._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__0d33c29e._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__25f23d5d._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__25f23d5d._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__26565141._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__26565141._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__2b1074db._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__2b1074db._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__2f61738a._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__2f61738a._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__332c8d91._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__332c8d91._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__3b72e8b0._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__3b72e8b0._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__9191749c._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__9191749c._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__9a136c79._.js +3 -3
- package/web/.next/server/chunks/[root-of-the-server]__9a136c79._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__a5879003._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__a5879003._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__b2f9a412._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__b2f9a412._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__b4102cc7._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__b4102cc7._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__d2c18946._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__d2c18946._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__d9d410a8._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__d9d410a8._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__e247a485._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__e247a485._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__fc6fd958._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__fc6fd958._.js.map +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__2138fa7e._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__29580090._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__29580090._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__357d99f9._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__3ef34e4c._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__43f51aa6._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__43f51aa6._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__815546bd._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__815546bd._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js +3 -3
- package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__c094882b._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__c094882b._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__d48c5b11._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__d48c5b11._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__dac5dbf1._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__dac5dbf1._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__fae8b355._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__fae8b355._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_05c23ad9._.js +1 -1
- package/web/.next/server/chunks/ssr/_05c23ad9._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_0c5f56e3._.js +2 -2
- package/web/.next/server/chunks/ssr/_0c5f56e3._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_16eb4fec._.js +1 -1
- package/web/.next/server/chunks/ssr/_16eb4fec._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_1b719e7f._.js +1 -1
- package/web/.next/server/chunks/ssr/_1b719e7f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_5022e2b1._.js → _2b873e3b._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_5022e2b1._.js.map → _2b873e3b._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_37e8548b._.js +1 -1
- package/web/.next/server/chunks/ssr/_37e8548b._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_55d763e2._.js +1 -1
- package/web/.next/server/chunks/ssr/_55d763e2._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_6256a985._.js +1 -1
- package/web/.next/server/chunks/ssr/_6256a985._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_64bdfc6f._.js +2 -2
- package/web/.next/server/chunks/ssr/_64bdfc6f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_8fcc39d4._.js +1 -1
- package/web/.next/server/chunks/ssr/_b71645b4._.js +1 -1
- package/web/.next/server/chunks/ssr/_b71645b4._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_d8575088._.js +1 -1
- package/web/.next/server/chunks/ssr/_d8575088._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_ee80b25c._.js +3 -0
- package/web/.next/server/chunks/ssr/{_458e9a64._.js.map → _ee80b25c._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{src_presentation_web_35159458._.js → src_presentation_web_91545e86._.js} +2 -2
- package/web/.next/server/chunks/ssr/{src_presentation_web_35159458._.js.map → src_presentation_web_91545e86._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1b176e3c.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1b176e3c.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_bd9f0dda.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_bd9f0dda.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
- package/web/.next/server/pages/500.html +2 -2
- package/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/server/server-reference-manifest.json +44 -44
- package/web/.next/static/chunks/{d3df6e6434e16519.js → 213bc4d2c2c7885a.js} +1 -1
- package/web/.next/static/chunks/42a1e8928c2a8b1e.js +1 -0
- package/web/.next/static/chunks/{75834e430247b325.js → 6b7b66ce14353296.js} +1 -1
- package/web/.next/static/chunks/70917246e2079de0.js +1 -0
- package/web/.next/static/chunks/{fe5d48f8ca483935.js → 932fdc72f19fba16.js} +1 -1
- package/web/.next/static/chunks/{3e7a130816229439.js → 9522b3e38757bf73.js} +1 -1
- package/web/.next/static/chunks/{a6363f73e05ccf47.js → c8c503403d49f600.js} +1 -1
- package/web/.next/static/chunks/{3f1b33498b472b00.js → d3e9784c18cc85e9.js} +1 -1
- package/web/.next/static/chunks/{4ef564fb1174e497.js → e23f0c8da44fe4ca.js} +1 -1
- package/web/.next/static/chunks/{eaca60cc3ab0bf9f.js → ee210d2383098e91.js} +1 -1
- package/web/.next/static/chunks/faf6b0ec1cf9125c.js +5 -0
- package/web/.next/static/chunks/{b7126c0b3a97e77e.js → fbf933fea8dd21f4.js} +1 -1
- package/web/.next/server/chunks/ssr/_458e9a64._.js +0 -3
- package/web/.next/static/chunks/24b1c1e60fd3b7b5.js +0 -5
- package/web/.next/static/chunks/79dc2e2f1c2ff519.js +0 -1
- package/web/.next/static/chunks/a086f8dfef2c3325.js +0 -1
- /package/web/.next/static/{1CQHYZVn3VajyhdvnsCaw → 0-b0NgavBiu5Fo1rzdeX2}/_buildManifest.js +0 -0
- /package/web/.next/static/{1CQHYZVn3VajyhdvnsCaw → 0-b0NgavBiu5Fo1rzdeX2}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{1CQHYZVn3VajyhdvnsCaw → 0-b0NgavBiu5Fo1rzdeX2}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/core/src/infrastructure/services/filesystem/shep-directory.service.ts","../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/dist/esm/build/templates/app-route.js","../../../../../../src/presentation/web/app/api/attachments/preview/route.ts"],"sourcesContent":["/**\n * Shep Directory Service\n *\n * Manages the ~/.shep/ directory for global settings and data storage.\n * Ensures directory exists with correct permissions before database operations.\n *\n * Supports SHEP_HOME env var for test isolation (overrides default ~/.shep/).\n */\n\nimport { mkdir } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport { existsSync } from 'node:fs';\n\n/**\n * Resolves the Shep home directory.\n * Respects SHEP_HOME env var for test isolation, falls back to ~/.shep/\n */\nfunction resolveShepHomeDir(): string {\n return process.env.SHEP_HOME ?? join(homedir(), '.shep');\n}\n\n/**\n * Gets the path to the Shep home directory.\n * Uses SHEP_HOME env var if set, otherwise ~/.shep/\n *\n * @returns Path to shep home directory\n */\nexport function getShepHomeDir(): string {\n return resolveShepHomeDir();\n}\n\n/**\n * Gets the path to the SQLite database file.\n *\n * @returns Path to the database file\n */\nexport function getShepDbPath(): string {\n return join(resolveShepHomeDir(), 'data');\n}\n\n/**\n * Gets the path to the daemon state file.\n * Uses SHEP_HOME env var if set (for test isolation), otherwise ~/.shep/daemon.json\n *\n * @returns Path to daemon.json\n */\nexport function getDaemonStatePath(): string {\n return join(resolveShepHomeDir(), 'daemon.json');\n}\n\n/**\n * Gets the path to the daemon log file.\n * Uses SHEP_HOME env var if set (for test isolation), otherwise ~/.shep/daemon.log\n *\n * @returns Path to daemon.log\n */\nexport function getDaemonLogPath(): string {\n return join(resolveShepHomeDir(), 'daemon.log');\n}\n\n/**\n * Ensures the shep home directory exists with correct permissions.\n * Creates the directory if it doesn't exist.\n * Safe to call multiple times (idempotent).\n *\n * Permissions: 700 (rwx------) - only owner can read/write/execute\n *\n * @throws Error if directory cannot be created (permissions, disk space, etc.)\n */\nexport async function ensureShepDirectory(): Promise<void> {\n const shepDir = resolveShepHomeDir();\n\n if (existsSync(shepDir)) {\n return;\n }\n\n try {\n await mkdir(shepDir, {\n recursive: true,\n mode: 0o700,\n });\n } catch (error) {\n throw new Error(\n `Failed to create Shep directory at ${shepDir}: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n}\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 } 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 = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/attachments/preview/route\",\n pathname: \"/api/attachments/preview\",\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]/src/presentation/web/app/api/attachments/preview/route.ts\",\n nextConfigOutput,\n userland\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 (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/attachments/preview/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, 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.experimental.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 context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, '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 }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\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 } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\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 (activeSpan) {\n await handleResponse(activeSpan);\n } else {\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));\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 type { NextRequest } from 'next/server';\nimport { NextResponse } from 'next/server';\nimport { readFile, stat, readdir } from 'fs/promises';\nimport { basename, extname, join, resolve } from 'path';\nimport { getShepHomeDir } from '@shepai/core/infrastructure/services/filesystem/shep-directory.service';\n\nconst MIME_MAP: Record<string, string> = {\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.gif': 'image/gif',\n '.webp': 'image/webp',\n '.svg': 'image/svg+xml',\n '.bmp': 'image/bmp',\n '.ico': 'image/x-icon',\n '.pdf': 'application/pdf',\n '.txt': 'text/plain',\n '.md': 'text/markdown',\n '.json': 'application/json',\n '.yaml': 'text/yaml',\n '.yml': 'text/yaml',\n};\n\n/**\n * When the exact path doesn't exist (e.g. pending-<id> was renamed to <slug>),\n * search all sibling attachment directories for the same filename.\n */\nasync function findAttachmentFallback(\n requestedPath: string,\n attachmentsRoot: string\n): Promise<string | null> {\n const filename = basename(requestedPath);\n try {\n const dirs = await readdir(attachmentsRoot, { withFileTypes: true });\n for (const entry of dirs) {\n if (!entry.isDirectory()) continue;\n const candidate = join(attachmentsRoot, entry.name, filename);\n try {\n await stat(candidate);\n return candidate;\n } catch {\n // not in this directory\n }\n }\n } catch {\n // attachments root doesn't exist\n }\n return null;\n}\n\nfunction serveFile(filePath: string, mimeTypeHint: string | null) {\n return readFile(filePath).then((buffer) => {\n const ext = extname(filePath).toLowerCase();\n const contentType = MIME_MAP[ext] ?? mimeTypeHint ?? 'application/octet-stream';\n return new NextResponse(buffer, {\n headers: {\n 'Content-Type': contentType,\n 'Cache-Control': 'private, max-age=3600',\n },\n });\n });\n}\n\nexport async function GET(request: NextRequest): Promise<NextResponse> {\n const path = request.nextUrl.searchParams.get('path');\n const mimeTypeHint = request.nextUrl.searchParams.get('mimeType');\n\n if (!path) {\n return NextResponse.json({ error: 'Missing path parameter' }, { status: 400 });\n }\n\n // Security: only allow paths within SHEP_HOME/attachments\n const attachmentsRoot = resolve(getShepHomeDir(), 'attachments');\n if (!resolve(path).startsWith(attachmentsRoot)) {\n return NextResponse.json({ error: 'Access denied' }, { status: 403 });\n }\n\n try {\n await stat(path);\n return await serveFile(path, mimeTypeHint);\n } catch {\n // File not found at exact path — try fallback search\n // This handles the case where pending-<sessionId>/ was renamed to <featureSlug>/\n const fallbackPath = await findAttachmentFallback(path, attachmentsRoot);\n if (fallbackPath) {\n return await serveFile(fallbackPath, mimeTypeHint);\n }\n return NextResponse.json({ error: 'File not found' }, { status: 404 });\n }\n}\n"],"names":[],"mappings":"g5CASA,EAAA,CAAA,CAAA,OACA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAiBO,SAAS,IACd,OAVO,AAUA,QAVQ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AC,kBAAkB,AAC7F,EAAQ,GAAG,CAAC,gBAAiB,CAAA,EAAA,EAAA,qBAAA,AAAqB,EAAC,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,EAGI,EACA,MAAM,EAAe,EADT,CAGZ,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,GAEf,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,EACA,sBACJ,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,EAEA,qCAAqC","ignoreList":[1]}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/core/src/infrastructure/services/filesystem/shep-directory.service.ts","../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/dist/esm/build/templates/app-route.js","../../../../../../src/presentation/web/app/api/attachments/preview/route.ts"],"sourcesContent":["/**\n * Shep Directory Service\n *\n * Manages the ~/.shep/ directory for global settings and data storage.\n * Ensures directory exists with correct permissions before database operations.\n *\n * Supports SHEP_HOME env var for test isolation (overrides default ~/.shep/).\n */\n\nimport { mkdir } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport { existsSync } from 'node:fs';\n\n/**\n * Resolves the Shep home directory.\n * Respects SHEP_HOME env var for test isolation, falls back to ~/.shep/\n */\nfunction resolveShepHomeDir(): string {\n return process.env.SHEP_HOME ?? join(homedir(), '.shep');\n}\n\n/**\n * Gets the path to the Shep home directory.\n * Uses SHEP_HOME env var if set, otherwise ~/.shep/\n *\n * @returns Path to shep home directory\n */\nexport function getShepHomeDir(): string {\n return resolveShepHomeDir();\n}\n\n/**\n * Gets the path to the SQLite database file.\n *\n * @returns Path to the database file\n */\nexport function getShepDbPath(): string {\n return join(resolveShepHomeDir(), 'data');\n}\n\n/**\n * Gets the path to the daemon state file.\n * Uses SHEP_HOME env var if set (for test isolation), otherwise ~/.shep/daemon.json\n *\n * @returns Path to daemon.json\n */\nexport function getDaemonStatePath(): string {\n return join(resolveShepHomeDir(), 'daemon.json');\n}\n\n/**\n * Gets the path to the daemon log file.\n * Uses SHEP_HOME env var if set (for test isolation), otherwise ~/.shep/daemon.log\n *\n * @returns Path to daemon.log\n */\nexport function getDaemonLogPath(): string {\n return join(resolveShepHomeDir(), 'daemon.log');\n}\n\n/**\n * Ensures the shep home directory exists with correct permissions.\n * Creates the directory if it doesn't exist.\n * Safe to call multiple times (idempotent).\n *\n * Permissions: 700 (rwx------) - only owner can read/write/execute\n *\n * @throws Error if directory cannot be created (permissions, disk space, etc.)\n */\nexport async function ensureShepDirectory(): Promise<void> {\n const shepDir = resolveShepHomeDir();\n\n if (existsSync(shepDir)) {\n return;\n }\n\n try {\n await mkdir(shepDir, {\n recursive: true,\n mode: 0o700,\n });\n } catch (error) {\n throw new Error(\n `Failed to create Shep directory at ${shepDir}: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n}\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 } 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/attachments/preview/route\",\n pathname: \"/api/attachments/preview\",\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]/src/presentation/web/app/api/attachments/preview/route.ts\",\n nextConfigOutput,\n userland\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 (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/attachments/preview/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, 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.experimental.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 context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, '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 }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\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 } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\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 (activeSpan) {\n await handleResponse(activeSpan);\n } else {\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));\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 type { NextRequest } from 'next/server';\nimport { NextResponse } from 'next/server';\nimport { readFile, stat, readdir } from 'fs/promises';\nimport { basename, extname, join, resolve } from 'path';\nimport { getShepHomeDir } from '@shepai/core/infrastructure/services/filesystem/shep-directory.service';\n\nconst MIME_MAP: Record<string, string> = {\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.gif': 'image/gif',\n '.webp': 'image/webp',\n '.svg': 'image/svg+xml',\n '.bmp': 'image/bmp',\n '.ico': 'image/x-icon',\n '.pdf': 'application/pdf',\n '.txt': 'text/plain',\n '.md': 'text/markdown',\n '.json': 'application/json',\n '.yaml': 'text/yaml',\n '.yml': 'text/yaml',\n};\n\n/**\n * When the exact path doesn't exist (e.g. pending-<id> was renamed to <slug>),\n * search all sibling attachment directories for the same filename.\n */\nasync function findAttachmentFallback(\n requestedPath: string,\n attachmentsRoot: string\n): Promise<string | null> {\n const filename = basename(requestedPath);\n try {\n const dirs = await readdir(attachmentsRoot, { withFileTypes: true });\n for (const entry of dirs) {\n if (!entry.isDirectory()) continue;\n const candidate = join(attachmentsRoot, entry.name, filename);\n try {\n await stat(candidate);\n return candidate;\n } catch {\n // not in this directory\n }\n }\n } catch {\n // attachments root doesn't exist\n }\n return null;\n}\n\nfunction serveFile(filePath: string, mimeTypeHint: string | null) {\n return readFile(filePath).then((buffer) => {\n const ext = extname(filePath).toLowerCase();\n const contentType = MIME_MAP[ext] ?? mimeTypeHint ?? 'application/octet-stream';\n return new NextResponse(buffer, {\n headers: {\n 'Content-Type': contentType,\n 'Cache-Control': 'private, max-age=3600',\n },\n });\n });\n}\n\nexport async function GET(request: NextRequest): Promise<NextResponse> {\n const path = request.nextUrl.searchParams.get('path');\n const mimeTypeHint = request.nextUrl.searchParams.get('mimeType');\n\n if (!path) {\n return NextResponse.json({ error: 'Missing path parameter' }, { status: 400 });\n }\n\n // Security: only allow paths within SHEP_HOME/attachments\n const attachmentsRoot = resolve(getShepHomeDir(), 'attachments');\n if (!resolve(path).startsWith(attachmentsRoot)) {\n return NextResponse.json({ error: 'Access denied' }, { status: 403 });\n }\n\n try {\n await stat(path);\n return await serveFile(path, mimeTypeHint);\n } catch {\n // File not found at exact path — try fallback search\n // This handles the case where pending-<sessionId>/ was renamed to <featureSlug>/\n const fallbackPath = await findAttachmentFallback(path, attachmentsRoot);\n if (fallbackPath) {\n return await serveFile(fallbackPath, mimeTypeHint);\n }\n return NextResponse.json({ error: 'File not found' }, { status: 404 });\n }\n}\n"],"names":[],"mappings":"g5CASA,EAAA,CAAA,CAAA,OACA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAiBO,SAAS,IACd,OAVO,AAUA,QAVQ,GAAG,CAAC,SAAS,EAAI,CAAA,EAAA,EAAA,IAAI,AAAJ,EAAK,CAAA,EAAA,EAAA,OAAA,AAAO,IAAI,QAWlD,CAlBA,EAAA,CAAA,CAAA,4DCZA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,MACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,KACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,CAAA,CAAA,OAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OCfA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAEA,IAAM,EAAmC,CACvC,OAAQ,YACR,OAAQ,aACR,QAAS,a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EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[1]}
|
|
@@ -7,6 +7,6 @@ data: ${JSON.stringify({content:e})}
|
|
|
7
7
|
`)}catch{}}(async()=>{try{let e=await u();if(e&&l(`event: initial
|
|
8
8
|
data: ${JSON.stringify({content:e})}
|
|
9
9
|
|
|
10
|
-
`),n)return;try{(i=(0,E.watch)(a,{persistent:!1},()=>{d()})).on("error",()=>{})}catch{}s=setInterval(()=>{d()},2e3)}catch{}})();let c=setInterval(()=>{l(": heartbeat\n\n")},3e4);e.signal.addEventListener("abort",()=>{n=!0,i&&(i.close(),i=null),s&&(clearInterval(s),s=null),clearInterval(c);try{t.close()}catch{}},{once:!0})}});return new Response(o,{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}})}catch(e){return console.error("[SSE route] GET /api/feature-logs error:",e),new Response(JSON.stringify({error:String(e)}),{status:500,headers:{"Content-Type":"application/json"}})}}e.s(["GET",()=>b,"dynamic",0,"force-dynamic"],91095);var T=e.i(91095);let A=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/feature-logs/route",pathname:"/api/feature-logs",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/presentation/web/app/api/feature-logs/route.ts",nextConfigOutput:"
|
|
10
|
+
`),n)return;try{(i=(0,E.watch)(a,{persistent:!1},()=>{d()})).on("error",()=>{})}catch{}s=setInterval(()=>{d()},2e3)}catch{}})();let c=setInterval(()=>{l(": heartbeat\n\n")},3e4);e.signal.addEventListener("abort",()=>{n=!0,i&&(i.close(),i=null),s&&(clearInterval(s),s=null),clearInterval(c);try{t.close()}catch{}},{once:!0})}});return new Response(o,{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}})}catch(e){return console.error("[SSE route] GET /api/feature-logs error:",e),new Response(JSON.stringify({error:String(e)}),{status:500,headers:{"Content-Type":"application/json"}})}}e.s(["GET",()=>b,"dynamic",0,"force-dynamic"],91095);var T=e.i(91095);let A=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/feature-logs/route",pathname:"/api/feature-logs",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/presentation/web/app/api/feature-logs/route.ts",nextConfigOutput:"",userland:T}),{workAsyncStorage:S,workUnitAsyncStorage:I,serverHooks:N}=A;function q(){return(0,n.patchFetch)({workAsyncStorage:S,workUnitAsyncStorage:I})}async function O(e,t,n){A.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/feature-logs/route";g=g.replace(/\/index$/,"")||"/";let w=await A.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!w)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:m,params:y,nextConfig:E,parsedUrl:C,isDraftMode:b,prerenderManifest:T,routerServerContext:S,isOnDemandRevalidate:I,revalidateOnlyGenerated:N,resolvedPathname:q,clientReferenceManifest:O,serverActionsManifest:P}=w,k=(0,s.normalizeAppPath)(g),_=!!(T.dynamicRoutes[k]||T.routes[q]),j=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,C,!1):t.end("This page could not be found"),null);if(_&&!b){let e=!!T.routes[q],t=T.dynamicRoutes[k];if(t&&!1===t.fallback&&!e){if(E.experimental.adapterPath)return await j();throw new v.NoFallbackError}}let H=null;!_||A.isDev||b||(H="/index"===(H=q)?"/":H);let U=!0===A.isDev||!_,$=_&&!U;P&&O&&(0,i.setManifestsSingleton)({page:g,clientReferenceManifest:O,serverActionsManifest:P});let D=e.method||"GET",F=(0,o.getTracer)(),M=F.getActiveScopeSpan(),K={params:y,prerenderManifest:T,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:U,incrementalCache:(0,a.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:E.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>A.onRequestError(e,t,n,a,S)},sharedContext:{buildId:m}},L=new l.NodeNextRequest(e),B=new l.NodeNextResponse(t),G=u.NextRequestAdapter.fromNodeNextRequest(L,(0,u.signalFromNodeResponse)(t));try{let i=async e=>A.handle(G,K).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=F.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=`${D} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${D} ${g}`)}),s=!!(0,a.getRequestMeta)(e,"minimalMode"),l=async a=>{var o,l;let u=async({previousCacheEntry:r})=>{try{if(!s&&I&&N&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await i(a);e.fetchMetrics=K.renderOpts.fetchMetrics;let l=K.renderOpts.pendingWaitUntil;l&&n.waitUntil&&(n.waitUntil(l),l=void 0);let u=K.renderOpts.collectedTags;if(!_)return await (0,p.sendResponse)(L,B,o,K.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(o.headers);u&&(t[x.NEXT_CACHE_TAGS_HEADER]=u),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==K.renderOpts.collectedRevalidate&&!(K.renderOpts.collectedRevalidate>=x.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,n=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=x.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await A.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:I})},!1,S),t}},d=await A.handleResponse({req:e,nextConfig:E,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:T,isRoutePPREnabled:!1,isOnDemandRevalidate:I,revalidateOnlyGenerated:N,responseGenerator:u,waitUntil:n.waitUntil,isMinimalMode:s});if(!_)return null;if((null==d||null==(o=d.value)?void 0:o.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(l=d.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});s||t.setHeader("x-nextjs-cache",I?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),b&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let v=(0,h.fromNodeOutgoingHttpHeaders)(d.value.headers);return s&&_||v.delete(x.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||v.get("Cache-Control")||v.set("Cache-Control",(0,f.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(L,B,new Response(d.value.body,{headers:v,status:d.value.status||200})),null};M?await l(M):await F.withPropagatedContext(e.headers,()=>F.trace(d.BaseServerSpan.handleRequest,{spanName:`${D} ${g}`,kind:o.SpanKind.SERVER,attributes:{"http.method":D,"http.target":e.url}},l))}catch(t){if(t instanceof v.NoFallbackError||await A.onRequestError(e,t,{routerKind:"App Router",routePath:k,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:I})},!1,S),_)throw t;return await (0,p.sendResponse)(L,B,new Response(null,{status:500})),null}}e.s(["handler",()=>O,"patchFetch",()=>q,"routeModule",()=>A,"serverHooks",()=>N,"workAsyncStorage",()=>S,"workUnitAsyncStorage",()=>I],81280)}];
|
|
11
11
|
|
|
12
12
|
//# sourceMappingURL=%5Broot-of-the-server%5D__2b1074db._.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/presentation/web/lib/server-container.ts","../../../../../../src/presentation/web/app/api/feature-logs/route.ts","../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["/**\n * Server Container Accessor\n *\n * Provides a `resolve()` helper for server components and API routes to\n * obtain DI-managed instances. The tsyringe container is placed on globalThis\n * by the CLI bootstrap (`shep ui`) or the dev-server (`pnpm dev:web`).\n */\n\nimport type { DependencyContainer, InjectionToken } from 'tsyringe';\n\nconst CONTAINER_KEY = '__shepContainer';\n\n/**\n * Resolve a dependency from the DI container.\n *\n * Usage in server components / API routes:\n * ```ts\n * import { resolve } from '@/lib/server-container';\n * import { ListFeaturesUseCase } from '@shepai/core/application/use-cases/features/list-features.use-case';\n *\n * const features = await resolve(ListFeaturesUseCase).execute();\n * ```\n */\nexport function resolve<T>(token: InjectionToken<T>): T {\n const container = (globalThis as Record<string, unknown>)[CONTAINER_KEY] as\n | DependencyContainer\n | undefined;\n\n if (!container) {\n throw new Error(\n 'DI container not available. Ensure the CLI bootstrap or dev-server has initialized it.'\n );\n }\n\n return container.resolve(token);\n}\n","/**\n * SSE API Route: GET /api/feature-logs\n *\n * Streams feature agent log output to the client via Server-Sent Events.\n * Resolves the feature to find its agentRunId, reads the corresponding\n * worker log file, and watches for new content.\n *\n * - Accepts ?featureId query parameter (required)\n * - Sends existing log content as SSE \"initial\" event\n * - Sends new log content as SSE \"log\" events\n * - Sends heartbeat comments every 30 seconds to keep connection alive\n * - Cleans up watchers/intervals on client disconnect\n */\n\nimport { resolve } from '@/lib/server-container';\nimport type { IFeatureRepository } from '@shepai/core/application/ports/output/repositories/feature-repository.interface';\nimport { join } from 'node:path';\nimport { homedir } from 'node:os';\nimport { readFile, stat } from 'node:fs/promises';\nimport { watch, type FSWatcher } from 'node:fs';\n\n// Force dynamic — SSE streams must never be statically optimized or cached\nexport const dynamic = 'force-dynamic';\n\nconst HEARTBEAT_INTERVAL_MS = 30_000;\nconst POLL_INTERVAL_MS = 2_000;\n\n/**\n * Create a short-lived SSE error response.\n */\nfunction sseError(error: string): Response {\n const stream = new ReadableStream<Uint8Array>({\n start(controller) {\n const encoder = new TextEncoder();\n controller.enqueue(encoder.encode(`event: error\\ndata: ${JSON.stringify({ error })}\\n\\n`));\n controller.close();\n },\n });\n\n return new Response(stream, {\n headers: {\n 'Content-Type': 'text/event-stream',\n 'Cache-Control': 'no-cache',\n Connection: 'keep-alive',\n },\n });\n}\n\nexport async function GET(request: Request): Promise<Response> {\n try {\n const url = new URL(request.url);\n const featureId = url.searchParams.get('featureId');\n\n if (!featureId?.trim()) {\n return sseError('featureId is required');\n }\n\n const featureRepo = resolve<IFeatureRepository>('IFeatureRepository');\n const feature = await featureRepo.findById(featureId);\n\n if (!feature) {\n return sseError(`Feature not found: ${featureId}`);\n }\n\n if (!feature.agentRunId) {\n return sseError(`Feature \"${feature.name}\" has no agent run`);\n }\n\n const logPath = join(homedir(), '.shep', 'logs', `worker-${feature.agentRunId}.log`);\n\n const stream = new ReadableStream<Uint8Array>({\n start(controller) {\n const encoder = new TextEncoder();\n let stopped = false;\n let bytesRead = 0;\n let watcher: FSWatcher | null = null;\n let pollInterval: ReturnType<typeof setInterval> | null = null;\n\n function enqueue(text: string) {\n if (stopped) return;\n try {\n controller.enqueue(encoder.encode(text));\n } catch {\n // Stream may be closed\n }\n }\n\n /**\n * Read any new content from the log file starting at `bytesRead`.\n * Returns the content read, or null if the file doesn't exist yet.\n */\n async function readNewContent(): Promise<string | null> {\n try {\n const fileStat = await stat(logPath);\n if (fileStat.size <= bytesRead) return null;\n\n const content = await readFile(logPath, 'utf-8');\n const newContent = content.slice(bytesRead);\n bytesRead = content.length;\n return newContent || null;\n } catch {\n // File doesn't exist yet — agent may have just started\n return null;\n }\n }\n\n /**\n * Check for new content and send it as a log event.\n */\n async function checkForUpdates() {\n if (stopped) return;\n try {\n const content = await readNewContent();\n if (content) {\n enqueue(`event: log\\ndata: ${JSON.stringify({ content })}\\n\\n`);\n }\n } catch {\n // Ignore read errors during polling\n }\n }\n\n // Initialize: read existing content and set up watchers\n (async () => {\n try {\n // Send existing content as initial event\n const initialContent = await readNewContent();\n if (initialContent) {\n enqueue(`event: initial\\ndata: ${JSON.stringify({ content: initialContent })}\\n\\n`);\n }\n\n if (stopped) return;\n\n // Watch for file changes with fs.watch\n try {\n watcher = watch(logPath, { persistent: false }, () => {\n void checkForUpdates();\n });\n\n watcher.on('error', () => {\n // Watcher error — fallback poll will handle it\n });\n } catch {\n // File may not exist yet — poll will handle it\n }\n\n // Fallback poll every 2s (handles cases where fs.watch misses events\n // or the file doesn't exist yet)\n pollInterval = setInterval(() => {\n void checkForUpdates();\n }, POLL_INTERVAL_MS);\n } catch {\n // Initialization error — stream will still stay open for heartbeats\n }\n })();\n\n // Heartbeat to keep connection alive\n const heartbeatInterval = setInterval(() => {\n enqueue(': heartbeat\\n\\n');\n }, HEARTBEAT_INTERVAL_MS);\n\n // Cleanup on client disconnect\n const cleanup = () => {\n stopped = true;\n if (watcher) {\n watcher.close();\n watcher = null;\n }\n if (pollInterval) {\n clearInterval(pollInterval);\n pollInterval = null;\n }\n clearInterval(heartbeatInterval);\n try {\n controller.close();\n } catch {\n // Stream may already be closed\n }\n };\n\n request.signal.addEventListener('abort', cleanup, { once: true });\n },\n });\n\n return new Response(stream, {\n headers: {\n 'Content-Type': 'text/event-stream',\n 'Cache-Control': 'no-cache',\n Connection: 'keep-alive',\n },\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('[SSE route] GET /api/feature-logs error:', error);\n return new Response(JSON.stringify({ error: String(error) }), {\n status: 500,\n headers: { 'Content-Type': 'application/json' },\n });\n }\n}\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 } 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 = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/feature-logs/route\",\n pathname: \"/api/feature-logs\",\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]/src/presentation/web/app/api/feature-logs/route.ts\",\n nextConfigOutput,\n userland\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 (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/feature-logs/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, 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.experimental.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 context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, '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 }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\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 } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\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 (activeSpan) {\n await handleResponse(activeSpan);\n } else {\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));\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,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AC,IAAI,CAAE,SAChC,EACA,OAAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,EAGI,EACA,MAAM,EAAe,EADT,CAGZ,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,GAEf,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,EAEA,qCAAqC","ignoreList":[2]}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/presentation/web/lib/server-container.ts","../../../../../../src/presentation/web/app/api/feature-logs/route.ts","../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["/**\n * Server Container Accessor\n *\n * Provides a `resolve()` helper for server components and API routes to\n * obtain DI-managed instances. The tsyringe container is placed on globalThis\n * by the CLI bootstrap (`shep ui`) or the dev-server (`pnpm dev:web`).\n */\n\nimport type { DependencyContainer, InjectionToken } from 'tsyringe';\n\nconst CONTAINER_KEY = '__shepContainer';\n\n/**\n * Resolve a dependency from the DI container.\n *\n * Usage in server components / API routes:\n * ```ts\n * import { resolve } from '@/lib/server-container';\n * import { ListFeaturesUseCase } from '@shepai/core/application/use-cases/features/list-features.use-case';\n *\n * const features = await resolve(ListFeaturesUseCase).execute();\n * ```\n */\nexport function resolve<T>(token: InjectionToken<T>): T {\n const container = (globalThis as Record<string, unknown>)[CONTAINER_KEY] as\n | DependencyContainer\n | undefined;\n\n if (!container) {\n throw new Error(\n 'DI container not available. Ensure the CLI bootstrap or dev-server has initialized it.'\n );\n }\n\n return container.resolve(token);\n}\n","/**\n * SSE API Route: GET /api/feature-logs\n *\n * Streams feature agent log output to the client via Server-Sent Events.\n * Resolves the feature to find its agentRunId, reads the corresponding\n * worker log file, and watches for new content.\n *\n * - Accepts ?featureId query parameter (required)\n * - Sends existing log content as SSE \"initial\" event\n * - Sends new log content as SSE \"log\" events\n * - Sends heartbeat comments every 30 seconds to keep connection alive\n * - Cleans up watchers/intervals on client disconnect\n */\n\nimport { resolve } from '@/lib/server-container';\nimport type { IFeatureRepository } from '@shepai/core/application/ports/output/repositories/feature-repository.interface';\nimport { join } from 'node:path';\nimport { homedir } from 'node:os';\nimport { readFile, stat } from 'node:fs/promises';\nimport { watch, type FSWatcher } from 'node:fs';\n\n// Force dynamic — SSE streams must never be statically optimized or cached\nexport const dynamic = 'force-dynamic';\n\nconst HEARTBEAT_INTERVAL_MS = 30_000;\nconst POLL_INTERVAL_MS = 2_000;\n\n/**\n * Create a short-lived SSE error response.\n */\nfunction sseError(error: string): Response {\n const stream = new ReadableStream<Uint8Array>({\n start(controller) {\n const encoder = new TextEncoder();\n controller.enqueue(encoder.encode(`event: error\\ndata: ${JSON.stringify({ error })}\\n\\n`));\n controller.close();\n },\n });\n\n return new Response(stream, {\n headers: {\n 'Content-Type': 'text/event-stream',\n 'Cache-Control': 'no-cache',\n Connection: 'keep-alive',\n },\n });\n}\n\nexport async function GET(request: Request): Promise<Response> {\n try {\n const url = new URL(request.url);\n const featureId = url.searchParams.get('featureId');\n\n if (!featureId?.trim()) {\n return sseError('featureId is required');\n }\n\n const featureRepo = resolve<IFeatureRepository>('IFeatureRepository');\n const feature = await featureRepo.findById(featureId);\n\n if (!feature) {\n return sseError(`Feature not found: ${featureId}`);\n }\n\n if (!feature.agentRunId) {\n return sseError(`Feature \"${feature.name}\" has no agent run`);\n }\n\n const logPath = join(homedir(), '.shep', 'logs', `worker-${feature.agentRunId}.log`);\n\n const stream = new ReadableStream<Uint8Array>({\n start(controller) {\n const encoder = new TextEncoder();\n let stopped = false;\n let bytesRead = 0;\n let watcher: FSWatcher | null = null;\n let pollInterval: ReturnType<typeof setInterval> | null = null;\n\n function enqueue(text: string) {\n if (stopped) return;\n try {\n controller.enqueue(encoder.encode(text));\n } catch {\n // Stream may be closed\n }\n }\n\n /**\n * Read any new content from the log file starting at `bytesRead`.\n * Returns the content read, or null if the file doesn't exist yet.\n */\n async function readNewContent(): Promise<string | null> {\n try {\n const fileStat = await stat(logPath);\n if (fileStat.size <= bytesRead) return null;\n\n const content = await readFile(logPath, 'utf-8');\n const newContent = content.slice(bytesRead);\n bytesRead = content.length;\n return newContent || null;\n } catch {\n // File doesn't exist yet — agent may have just started\n return null;\n }\n }\n\n /**\n * Check for new content and send it as a log event.\n */\n async function checkForUpdates() {\n if (stopped) return;\n try {\n const content = await readNewContent();\n if (content) {\n enqueue(`event: log\\ndata: ${JSON.stringify({ content })}\\n\\n`);\n }\n } catch {\n // Ignore read errors during polling\n }\n }\n\n // Initialize: read existing content and set up watchers\n (async () => {\n try {\n // Send existing content as initial event\n const initialContent = await readNewContent();\n if (initialContent) {\n enqueue(`event: initial\\ndata: ${JSON.stringify({ content: initialContent })}\\n\\n`);\n }\n\n if (stopped) return;\n\n // Watch for file changes with fs.watch\n try {\n watcher = watch(logPath, { persistent: false }, () => {\n void checkForUpdates();\n });\n\n watcher.on('error', () => {\n // Watcher error — fallback poll will handle it\n });\n } catch {\n // File may not exist yet — poll will handle it\n }\n\n // Fallback poll every 2s (handles cases where fs.watch misses events\n // or the file doesn't exist yet)\n pollInterval = setInterval(() => {\n void checkForUpdates();\n }, POLL_INTERVAL_MS);\n } catch {\n // Initialization error — stream will still stay open for heartbeats\n }\n })();\n\n // Heartbeat to keep connection alive\n const heartbeatInterval = setInterval(() => {\n enqueue(': heartbeat\\n\\n');\n }, HEARTBEAT_INTERVAL_MS);\n\n // Cleanup on client disconnect\n const cleanup = () => {\n stopped = true;\n if (watcher) {\n watcher.close();\n watcher = null;\n }\n if (pollInterval) {\n clearInterval(pollInterval);\n pollInterval = null;\n }\n clearInterval(heartbeatInterval);\n try {\n controller.close();\n } catch {\n // Stream may already be closed\n }\n };\n\n request.signal.addEventListener('abort', cleanup, { once: true });\n },\n });\n\n return new Response(stream, {\n headers: {\n 'Content-Type': 'text/event-stream',\n 'Cache-Control': 'no-cache',\n Connection: 'keep-alive',\n },\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('[SSE route] GET /api/feature-logs error:', error);\n return new Response(JSON.stringify({ error: String(error) }), {\n status: 500,\n headers: { 'Content-Type': 'application/json' },\n });\n }\n}\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 } 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/feature-logs/route\",\n pathname: \"/api/feature-logs\",\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]/src/presentation/web/app/api/feature-logs/route.ts\",\n nextConfigOutput,\n userland\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 (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/feature-logs/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, 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.experimental.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 context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, '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 }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\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 } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\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 (activeSpan) {\n await handleResponse(activeSpan);\n } else {\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));\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"],"names":[],"mappings":"ylCAuBO,SAAS,EAAW,CAAwB,EACjD,IAAM,EAAa,UAAsC,CAAC,AAdtC,eAcoD,CAIxE,GAAI,CAAC,EACH,MAAM,AAAI,GADI,GAEZ,0FAIJ,OAAO,EAAU,OAAO,CAAC,EAC3B,gDEnCA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,MACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,KACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAA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EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[2]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},12714,(e,t,r)=>{t.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},66680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},55042,e=>{"use strict";var t=e.i(66680),r=e.i(60526),a=e.i(50227),n=e.i(12714);function s(e){return e.replace(/[/\\.]/g,"-")}function i(e){if("string"==typeof e)return e;if(Array.isArray(e)){for(let t of e)if("object"==typeof t&&null!==t&&"text"===t.type&&"string"==typeof t.text)return t.text}return null}async function o(e){let t;try{t=await (0,n.readdir)(e)}catch{return[]}let r=t.filter(e=>e.endsWith(".jsonl"));return(await Promise.allSettled(r.map(async t=>{let r=(0,a.join)(e,t),s=await (0,n.stat)(r);return{name:t,filePath:r,mtime:s.mtime.getTime()}}))).filter(e=>"fulfilled"===e.status).map(e=>e.value)}async function l(t,r,a,n){let{createReadStream:s}=await e.A(6714),o=r.replace(".jsonl",""),l=null,u=null,d=0,c=await new Promise(e=>{let r=[],a=0,n=s(t,{end:8191});n.on("data",e=>{r.push(e),a+=e.length}),n.on("end",()=>e(Buffer.concat(r,a).toString("utf-8"))),n.on("error",()=>e(""))});if(!c)return null;for(let e of c.split("\n").filter(e=>e.trim()))try{let t=JSON.parse(e);if("user"===t.type||"assistant"===t.type){let e=t.message?.role;("user"===e||"assistant"===e)&&(d++,t.timestamp&&(u??=t.timestamp),"user"===e&&null===l&&(l=i(t.message?.content)))}}catch{break}if(0===d)return null;let p=new Date(a).toISOString();return{id:o,agentType:"claude-code",preview:l,messageCount:d,firstMessageAt:u,lastMessageAt:p,createdAt:u??p,projectPath:n,filePath:t,_mtime:a}}async function u(e,i,d=!1){let c=s(e),p=(0,a.join)((0,r.homedir)(),".claude","projects"),m=(0,a.join)(p,c),f=await o(m);if(d)try{let i=await (0,n.readdir)(p),l=i.filter(e=>e!==c&&e.startsWith(c)),u=e.replace(/\\/g,"/"),d=(0,t.createHash)("sha256").update(u).digest("hex").slice(0,16),m=(0,a.join)((0,r.homedir)(),".shep").replace(/\\/g,"/"),h=s((0,a.join)(m,"repos",d)),x=i.filter(e=>e.startsWith(h)&&!l.includes(e)&&e!==c),g=[...l,...x];for(let e of(await Promise.all(g.map(e=>o((0,a.join)(p,e))))))f=f.concat(e)}catch{}let h=f.sort((e,t)=>t.mtime-e.mtime).slice(0,i);return(await Promise.allSettled(h.map(async t=>l(t.filePath,t.name,t.mtime,e)))).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e)}async function d(t,r,a,n){let{createReadStream:s}=await e.A(6714),o=r.replace(".jsonl",""),l=await new Promise(e=>{let r=[],a=0,n=s(t,{end:8191});n.on("data",e=>{r.push(e),a+=e.length}),n.on("end",()=>e(Buffer.concat(r,a).toString("utf-8"))),n.on("error",()=>e(""))});if(!l)return null;let u=null,d=0;for(let e of l.split("\n").filter(e=>e.trim()))try{let t=JSON.parse(e);("user"===t.role||"assistant"===t.role)&&(d++,"user"===t.role&&null===u&&(u=i(t.message?.content)))}catch{break}if(0===d)return null;let c=new Date(a).toISOString();return{id:o,agentType:"cursor",preview:u,messageCount:d,firstMessageAt:c,lastMessageAt:c,createdAt:c,projectPath:n,filePath:t,_mtime:a}}async function c(e,t){let s,i=e.replace(/^\//,"").replace(/\./g,"").replace(/[/\\]/g,"-"),o=(0,a.join)((0,r.homedir)(),".cursor","projects",i,"agent-transcripts");try{s=await (0,n.readdir)(o)}catch{return[]}let l=(await Promise.allSettled(s.map(async e=>{let t=(0,a.join)(o,e),r=await (0,n.stat)(t);if(r.isFile()&&e.endsWith(".jsonl"))return{name:e,filePath:t,mtime:r.mtime.getTime()};if(r.isDirectory()){let r=(0,a.join)(t,`${e}.jsonl`);try{let t=await (0,n.stat)(r);return{name:`${e}.jsonl`,filePath:r,mtime:t.mtime.getTime()}}catch{}}return null}))).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e).sort((e,t)=>t.mtime-e.mtime).slice(0,t);return(await Promise.allSettled(l.map(async t=>d(t.filePath,t.name,t.mtime,e)))).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e)}async function p(e,t,r=!1){let[a,n]=await Promise.all([u(e,t,r),c(e,t)]);return[...a,...n].sort((e,t)=>t._mtime-e._mtime).slice(0,Math.min(t,50))}e.s(["scanSessionsForPath",()=>p])},87913,e=>{"use strict";var t=e.i(22925),r=e.i(62995),a=e.i(14112),n=e.i(31716),s=e.i(16340),i=e.i(40522),o=e.i(21994),l=e.i(5802),u=e.i(17171),d=e.i(177),c=e.i(43685),p=e.i(84832),m=e.i(92435),f=e.i(41260),h=e.i(80556),x=e.i(93695);e.i(97230);var g=e.i(35162),y=e.i(27980),w=e.i(55042);async function R(e){let t=new URL(e.url),r=t.searchParams.get("repositoryPath"),a=parseInt(t.searchParams.get("limit")??"10",10),n="true"===t.searchParams.get("includeWorktrees");if(!r?.trim())return y.NextResponse.json({error:"repositoryPath is required"},{status:400});try{let e=await (0,w.scanSessionsForPath)(r,a,n);return y.NextResponse.json({sessions:e.map(({_mtime:e,...t})=>t)})}catch(e){return console.error("[API] GET /api/sessions error:",e),y.NextResponse.json({error:String(e)},{status:500})}}e.s(["GET",()=>R,"dynamic",0,"force-dynamic"],17276);var v=e.i(17276);let P=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/sessions/route",pathname:"/api/sessions",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/presentation/web/app/api/sessions/route.ts",nextConfigOutput:"standalone",userland:v}),{workAsyncStorage:E,workUnitAsyncStorage:j,serverHooks:A}=P;function C(){return(0,a.patchFetch)({workAsyncStorage:E,workUnitAsyncStorage:j})}async function S(e,t,a){P.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let y="/api/sessions/route";y=y.replace(/\/index$/,"")||"/";let w=await P.prepare(e,t,{srcPage:y,multiZoneDraftMode:!1});if(!w)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:R,params:v,nextConfig:E,parsedUrl:j,isDraftMode:A,prerenderManifest:C,routerServerContext:S,isOnDemandRevalidate:b,revalidateOnlyGenerated:T,resolvedPathname:N,clientReferenceManifest:_,serverActionsManifest:k}=w,q=(0,o.normalizeAppPath)(y),O=!!(C.dynamicRoutes[q]||C.routes[N]),I=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,j,!1):t.end("This page could not be found"),null);if(O&&!A){let e=!!C.routes[N],t=C.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(E.experimental.adapterPath)return await I();throw new x.NoFallbackError}}let H=null;!O||P.isDev||A||(H="/index"===(H=N)?"/":H);let M=!0===P.isDev||!O,U=O&&!M;k&&_&&(0,i.setManifestsSingleton)({page:y,clientReferenceManifest:_,serverActionsManifest:k});let D=e.method||"GET",F=(0,s.getTracer)(),$=F.getActiveScopeSpan(),K={params:v,prerenderManifest:C,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:M,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:E.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>P.onRequestError(e,t,a,n,S)},sharedContext:{buildId:R}},B=new l.NodeNextRequest(e),W=new l.NodeNextResponse(t),L=u.NextRequestAdapter.fromNodeNextRequest(B,(0,u.signalFromNodeResponse)(t));try{let i=async e=>P.handle(L,K).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=F.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=`${D} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${D} ${y}`)}),o=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var s,l;let u=async({previousCacheEntry:r})=>{try{if(!o&&b&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(n);e.fetchMetrics=K.renderOpts.fetchMetrics;let l=K.renderOpts.pendingWaitUntil;l&&a.waitUntil&&(a.waitUntil(l),l=void 0);let u=K.renderOpts.collectedTags;if(!O)return await (0,p.sendResponse)(B,W,s,K.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,m.toNodeOutgoingHttpHeaders)(s.headers);u&&(t[h.NEXT_CACHE_TAGS_HEADER]=u),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==K.renderOpts.collectedRevalidate&&!(K.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,a=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=h.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await P.onRequestError(e,t,{routerKind:"App Router",routePath:y,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:b})},!1,S),t}},d=await P.handleResponse({req:e,nextConfig:E,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:b,revalidateOnlyGenerated:T,responseGenerator:u,waitUntil:a.waitUntil,isMinimalMode:o});if(!O)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(l=d.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});o||t.setHeader("x-nextjs-cache",b?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let x=(0,m.fromNodeOutgoingHttpHeaders)(d.value.headers);return o&&O||x.delete(h.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||x.get("Cache-Control")||x.set("Cache-Control",(0,f.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(B,W,new Response(d.value.body,{headers:x,status:d.value.status||200})),null};$?await l($):await F.withPropagatedContext(e.headers,()=>F.trace(d.BaseServerSpan.handleRequest,{spanName:`${D} ${y}`,kind:s.SpanKind.SERVER,attributes:{"http.method":D,"http.target":e.url}},l))}catch(t){if(t instanceof x.NoFallbackError||await P.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:b})},!1,S),O)throw t;return await (0,p.sendResponse)(B,W,new Response(null,{status:500})),null}}e.s(["handler",()=>S,"patchFetch",()=>C,"routeModule",()=>P,"serverHooks",()=>A,"workAsyncStorage",()=>E,"workUnitAsyncStorage",()=>j],87913)},6714,e=>{e.v(t=>Promise.all(["server/chunks/[externals]_node:fs_ddf6f167._.js"].map(t=>e.l(t))).then(()=>t(2157)))}];
|
|
1
|
+
module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},12714,(e,t,r)=>{t.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},66680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},55042,e=>{"use strict";var t=e.i(66680),r=e.i(60526),a=e.i(50227),n=e.i(12714);function s(e){return e.replace(/[/\\.]/g,"-")}function i(e){if("string"==typeof e)return e;if(Array.isArray(e)){for(let t of e)if("object"==typeof t&&null!==t&&"text"===t.type&&"string"==typeof t.text)return t.text}return null}async function o(e){let t;try{t=await (0,n.readdir)(e)}catch{return[]}let r=t.filter(e=>e.endsWith(".jsonl"));return(await Promise.allSettled(r.map(async t=>{let r=(0,a.join)(e,t),s=await (0,n.stat)(r);return{name:t,filePath:r,mtime:s.mtime.getTime()}}))).filter(e=>"fulfilled"===e.status).map(e=>e.value)}async function l(t,r,a,n){let{createReadStream:s}=await e.A(6714),o=r.replace(".jsonl",""),l=null,u=null,d=0,c=await new Promise(e=>{let r=[],a=0,n=s(t,{end:8191});n.on("data",e=>{r.push(e),a+=e.length}),n.on("end",()=>e(Buffer.concat(r,a).toString("utf-8"))),n.on("error",()=>e(""))});if(!c)return null;for(let e of c.split("\n").filter(e=>e.trim()))try{let t=JSON.parse(e);if("user"===t.type||"assistant"===t.type){let e=t.message?.role;("user"===e||"assistant"===e)&&(d++,t.timestamp&&(u??=t.timestamp),"user"===e&&null===l&&(l=i(t.message?.content)))}}catch{break}if(0===d)return null;let p=new Date(a).toISOString();return{id:o,agentType:"claude-code",preview:l,messageCount:d,firstMessageAt:u,lastMessageAt:p,createdAt:u??p,projectPath:n,filePath:t,_mtime:a}}async function u(e,i,d=!1){let c=s(e),p=(0,a.join)((0,r.homedir)(),".claude","projects"),m=(0,a.join)(p,c),f=await o(m);if(d)try{let i=await (0,n.readdir)(p),l=i.filter(e=>e!==c&&e.startsWith(c)),u=e.replace(/\\/g,"/"),d=(0,t.createHash)("sha256").update(u).digest("hex").slice(0,16),m=(0,a.join)((0,r.homedir)(),".shep").replace(/\\/g,"/"),h=s((0,a.join)(m,"repos",d)),x=i.filter(e=>e.startsWith(h)&&!l.includes(e)&&e!==c),g=[...l,...x];for(let e of(await Promise.all(g.map(e=>o((0,a.join)(p,e))))))f=f.concat(e)}catch{}let h=f.sort((e,t)=>t.mtime-e.mtime).slice(0,i);return(await Promise.allSettled(h.map(async t=>l(t.filePath,t.name,t.mtime,e)))).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e)}async function d(t,r,a,n){let{createReadStream:s}=await e.A(6714),o=r.replace(".jsonl",""),l=await new Promise(e=>{let r=[],a=0,n=s(t,{end:8191});n.on("data",e=>{r.push(e),a+=e.length}),n.on("end",()=>e(Buffer.concat(r,a).toString("utf-8"))),n.on("error",()=>e(""))});if(!l)return null;let u=null,d=0;for(let e of l.split("\n").filter(e=>e.trim()))try{let t=JSON.parse(e);("user"===t.role||"assistant"===t.role)&&(d++,"user"===t.role&&null===u&&(u=i(t.message?.content)))}catch{break}if(0===d)return null;let c=new Date(a).toISOString();return{id:o,agentType:"cursor",preview:u,messageCount:d,firstMessageAt:c,lastMessageAt:c,createdAt:c,projectPath:n,filePath:t,_mtime:a}}async function c(e,t){let s,i=e.replace(/^\//,"").replace(/\./g,"").replace(/[/\\]/g,"-"),o=(0,a.join)((0,r.homedir)(),".cursor","projects",i,"agent-transcripts");try{s=await (0,n.readdir)(o)}catch{return[]}let l=(await Promise.allSettled(s.map(async e=>{let t=(0,a.join)(o,e),r=await (0,n.stat)(t);if(r.isFile()&&e.endsWith(".jsonl"))return{name:e,filePath:t,mtime:r.mtime.getTime()};if(r.isDirectory()){let r=(0,a.join)(t,`${e}.jsonl`);try{let t=await (0,n.stat)(r);return{name:`${e}.jsonl`,filePath:r,mtime:t.mtime.getTime()}}catch{}}return null}))).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e).sort((e,t)=>t.mtime-e.mtime).slice(0,t);return(await Promise.allSettled(l.map(async t=>d(t.filePath,t.name,t.mtime,e)))).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e)}async function p(e,t,r=!1){let[a,n]=await Promise.all([u(e,t,r),c(e,t)]);return[...a,...n].sort((e,t)=>t._mtime-e._mtime).slice(0,Math.min(t,50))}e.s(["scanSessionsForPath",()=>p])},87913,e=>{"use strict";var t=e.i(22925),r=e.i(62995),a=e.i(14112),n=e.i(31716),s=e.i(16340),i=e.i(40522),o=e.i(21994),l=e.i(5802),u=e.i(17171),d=e.i(177),c=e.i(43685),p=e.i(84832),m=e.i(92435),f=e.i(41260),h=e.i(80556),x=e.i(93695);e.i(97230);var g=e.i(35162),y=e.i(27980),w=e.i(55042);async function R(e){let t=new URL(e.url),r=t.searchParams.get("repositoryPath"),a=parseInt(t.searchParams.get("limit")??"10",10),n="true"===t.searchParams.get("includeWorktrees");if(!r?.trim())return y.NextResponse.json({error:"repositoryPath is required"},{status:400});try{let e=await (0,w.scanSessionsForPath)(r,a,n);return y.NextResponse.json({sessions:e.map(({_mtime:e,...t})=>t)})}catch(e){return console.error("[API] GET /api/sessions error:",e),y.NextResponse.json({error:String(e)},{status:500})}}e.s(["GET",()=>R,"dynamic",0,"force-dynamic"],17276);var v=e.i(17276);let P=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/sessions/route",pathname:"/api/sessions",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/presentation/web/app/api/sessions/route.ts",nextConfigOutput:"",userland:v}),{workAsyncStorage:E,workUnitAsyncStorage:j,serverHooks:A}=P;function C(){return(0,a.patchFetch)({workAsyncStorage:E,workUnitAsyncStorage:j})}async function S(e,t,a){P.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let y="/api/sessions/route";y=y.replace(/\/index$/,"")||"/";let w=await P.prepare(e,t,{srcPage:y,multiZoneDraftMode:!1});if(!w)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:R,params:v,nextConfig:E,parsedUrl:j,isDraftMode:A,prerenderManifest:C,routerServerContext:S,isOnDemandRevalidate:b,revalidateOnlyGenerated:T,resolvedPathname:N,clientReferenceManifest:_,serverActionsManifest:k}=w,q=(0,o.normalizeAppPath)(y),O=!!(C.dynamicRoutes[q]||C.routes[N]),I=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,j,!1):t.end("This page could not be found"),null);if(O&&!A){let e=!!C.routes[N],t=C.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(E.experimental.adapterPath)return await I();throw new x.NoFallbackError}}let H=null;!O||P.isDev||A||(H="/index"===(H=N)?"/":H);let M=!0===P.isDev||!O,U=O&&!M;k&&_&&(0,i.setManifestsSingleton)({page:y,clientReferenceManifest:_,serverActionsManifest:k});let D=e.method||"GET",F=(0,s.getTracer)(),$=F.getActiveScopeSpan(),K={params:v,prerenderManifest:C,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:M,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:E.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>P.onRequestError(e,t,a,n,S)},sharedContext:{buildId:R}},B=new l.NodeNextRequest(e),W=new l.NodeNextResponse(t),L=u.NextRequestAdapter.fromNodeNextRequest(B,(0,u.signalFromNodeResponse)(t));try{let i=async e=>P.handle(L,K).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=F.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=`${D} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${D} ${y}`)}),o=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var s,l;let u=async({previousCacheEntry:r})=>{try{if(!o&&b&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(n);e.fetchMetrics=K.renderOpts.fetchMetrics;let l=K.renderOpts.pendingWaitUntil;l&&a.waitUntil&&(a.waitUntil(l),l=void 0);let u=K.renderOpts.collectedTags;if(!O)return await (0,p.sendResponse)(B,W,s,K.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,m.toNodeOutgoingHttpHeaders)(s.headers);u&&(t[h.NEXT_CACHE_TAGS_HEADER]=u),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==K.renderOpts.collectedRevalidate&&!(K.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,a=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=h.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await P.onRequestError(e,t,{routerKind:"App Router",routePath:y,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:b})},!1,S),t}},d=await P.handleResponse({req:e,nextConfig:E,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:b,revalidateOnlyGenerated:T,responseGenerator:u,waitUntil:a.waitUntil,isMinimalMode:o});if(!O)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(l=d.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});o||t.setHeader("x-nextjs-cache",b?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let x=(0,m.fromNodeOutgoingHttpHeaders)(d.value.headers);return o&&O||x.delete(h.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||x.get("Cache-Control")||x.set("Cache-Control",(0,f.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(B,W,new Response(d.value.body,{headers:x,status:d.value.status||200})),null};$?await l($):await F.withPropagatedContext(e.headers,()=>F.trace(d.BaseServerSpan.handleRequest,{spanName:`${D} ${y}`,kind:s.SpanKind.SERVER,attributes:{"http.method":D,"http.target":e.url}},l))}catch(t){if(t instanceof x.NoFallbackError||await P.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:b})},!1,S),O)throw t;return await (0,p.sendResponse)(B,W,new Response(null,{status:500})),null}}e.s(["handler",()=>S,"patchFetch",()=>C,"routeModule",()=>P,"serverHooks",()=>A,"workAsyncStorage",()=>E,"workUnitAsyncStorage",()=>j],87913)},6714,e=>{e.v(t=>Promise.all(["server/chunks/[externals]_node:fs_ddf6f167._.js"].map(t=>e.l(t))).then(()=>t(2157)))}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=%5Broot-of-the-server%5D__2f61738a._.js.map
|