heartbeads 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +2 -2
- package/.next/required-server-files.json +1 -1
- package/.next/server/app/_global-error.html +2 -2
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/beads/route.js.nft.json +1 -1
- package/.next/server/app/api/beads/stream/route.js.nft.json +1 -1
- package/.next/server/app/api/config/route.js.nft.json +1 -1
- package/.next/server/app/api/docs.html +2 -2
- package/.next/server/app/api/docs.rsc +1 -1
- package/.next/server/app/api/docs.segments/_full.segment.rsc +1 -1
- package/.next/server/app/api/docs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/api/docs.segments/_index.segment.rsc +1 -1
- package/.next/server/app/api/docs.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/docs.segments/api/docs/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/api/docs.segments/api/docs.segment.rsc +1 -1
- package/.next/server/app/api/docs.segments/api.segment.rsc +1 -1
- package/.next/server/app/api/v1/graph/route.js.nft.json +1 -1
- package/.next/server/app/api/v1/issues/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/v1/ready/route.js.nft.json +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +2 -2
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +1 -1
- package/.next/server/app/login.segments/_full.segment.rsc +1 -1
- package/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/.next/server/app/login.segments/_index.segment.rsc +1 -1
- package/.next/server/app/login.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/48cc8_next_dist_esm_build_templates_app-route_1d3b72ae.js +1 -1
- package/.next/server/chunks/48cc8_next_dist_esm_build_templates_app-route_1d3b72ae.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__2d60806f._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__2d60806f._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__3cb3ed30._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__3cb3ed30._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__6125c4e2._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__6125c4e2._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__67c802f8._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__67c802f8._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__77e35ba8._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__77e35ba8._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__8261fec1._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__8261fec1._.js.map +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__04e6e565._.js +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__04e6e565._.js.map +1 -1
- package/.next/server/edge/chunks/48cc8_next_dist_5a0b8a90._.js +1 -1
- package/.next/server/edge/chunks/48cc8_next_dist_5a0b8a90._.js.map +1 -1
- package/.next/server/middleware/middleware-manifest.json +3 -3
- package/.next/server/middleware-manifest.json +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +2 -2
- package/.next/static/chunks/7e4fcecd4ca504d5.js +24 -0
- package/.next/static/zq8Ew2hci2YIJ61-i832n/_clientMiddlewareManifest.json +6 -0
- package/app/api/login/route.ts +15 -0
- package/app/page.tsx +46 -35
- package/components/BeadsGraph.tsx +15 -1
- package/components/NodeDetail.tsx +15 -7
- package/lib/activity.ts +22 -2
- package/lib/parse-beads.ts +24 -10
- package/lib/types.ts +82 -1
- package/package.json +1 -1
- package/.next/static/bc2EgBqgYtYOdWusC2URO/_clientMiddlewareManifest.json +0 -6
- package/.next/static/chunks/6cdcba7fb18f6f79.js +0 -24
- /package/.next/static/{bc2EgBqgYtYOdWusC2URO → zq8Ew2hci2YIJ61-i832n}/_buildManifest.js +0 -0
- /package/.next/static/{bc2EgBqgYtYOdWusC2URO → zq8Ew2hci2YIJ61-i832n}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../app/api/v1/graph/route.ts","../../../node_modules/.pnpm/next%4016.1.6_react-dom%4018.3.1_react%4018.3.1__react%4018.3.1/node_modules/next/dist/esm/build/templates/app-route.js","../../../lib/activity.ts"],"sourcesContent":["/**\n * GET /api/v1/graph — Full project snapshot for AI agents.\n *\n * Returns the entire beads graph with issues, dependencies, comments,\n * claims, and activity in a single JSON response. No auth required.\n *\n * Query params:\n * ?status=open,in_progress Filter issues by status (comma-separated)\n * ?priority=0,1 Filter by priority (comma-separated)\n * ?prefix=beads-map Filter by repo prefix\n * ?include=comments,activity Opt-in fields (default: all)\n * ?limit=50 Activity feed cap (default 50, max 200)\n */\n\nimport { loadBeadsData } from \"@/lib/parse-beads\";\nimport { discoverBeadsDir, getRepoUrls } from \"@/lib/discover\";\nimport { fetchBeadsComments, getClaimedNodes } from \"@/lib/comments\";\nimport type { BeadsComment, ClaimInfo } from \"@/lib/comments\";\nimport { buildHistoricalFeed } from \"@/lib/activity\";\nimport type { GraphNode } from \"@/lib/types\";\nimport { jsonResponse, errorResponse, OPTIONS } from \"@/lib/api-helpers\";\nimport { readFileSync, existsSync } from \"fs\";\nimport { join } from \"path\";\nimport { parse as parseYaml } from \"yaml\";\n\nexport const dynamic = \"force-dynamic\";\nexport { OPTIONS };\n\n// Read version from package.json at module load time\nlet heartbeadsVersion = \"0.0.0\";\ntry {\n const pkg = JSON.parse(\n readFileSync(join(process.cwd(), \"package.json\"), \"utf-8\")\n );\n heartbeadsVersion = pkg.version || heartbeadsVersion;\n} catch {\n // ignore\n}\n\n/** Serialize a BeadsComment tree for API output */\nfunction serializeComment(c: BeadsComment): Record<string, unknown> {\n return {\n author: {\n handle: c.handle,\n did: c.did,\n ...(c.displayName ? { displayName: c.displayName } : {}),\n },\n text: c.text,\n createdAt: c.createdAt,\n likes: c.likes.length,\n replies: c.replies.map(serializeComment),\n };\n}\n\n/** Serialize a claim for API output */\nfunction serializeClaim(claim: ClaimInfo) {\n return {\n handle: claim.handle,\n did: claim.did,\n ...(claim.displayName ? { displayName: claim.displayName } : {}),\n claimed_at: claim.claimedAt,\n };\n}\n\nexport async function GET(request: Request) {\n try {\n const discovery = discoverBeadsDir();\n const url = new URL(request.url);\n const params = url.searchParams;\n\n // Parse query params\n const statusFilter = params.get(\"status\")?.split(\",\").filter(Boolean);\n const priorityFilter = params\n .get(\"priority\")\n ?.split(\",\")\n .map(Number)\n .filter((n) => !isNaN(n));\n const prefixFilter = params.get(\"prefix\") || null;\n const includeParam = params.get(\"include\");\n const limit = Math.min(\n Math.max(parseInt(params.get(\"limit\") || \"50\") || 50, 1),\n 200\n );\n\n // Determine what to include (default: everything)\n let includeComments = true;\n let includeActivity = true;\n if (includeParam !== null) {\n const includes = includeParam.split(\",\").filter(Boolean);\n includeComments = includes.includes(\"comments\");\n includeActivity = includes.includes(\"activity\");\n }\n\n // Load beads data + config in parallel with optional comments\n const beadsPromise = Promise.resolve(loadBeadsData(discovery.beadsDir));\n const commentsPromise = includeComments\n ? fetchBeadsComments().catch((err) => {\n console.error(\"[api/v1/graph] Failed to fetch comments:\", err);\n return null;\n })\n : Promise.resolve(null);\n\n const [beadsData, commentsResult] = await Promise.all([\n beadsPromise,\n commentsPromise,\n ]);\n\n // Build project metadata\n let repos: string[] = [\".\"];\n const configPath = join(discovery.beadsDir, \"config.yaml\");\n try {\n if (existsSync(configPath)) {\n const content = readFileSync(configPath, \"utf-8\");\n const config = parseYaml(content);\n const additional = config?.repos?.additional;\n if (Array.isArray(additional)) {\n repos = [config?.repos?.primary || \".\", ...additional];\n }\n }\n } catch {\n // ignore\n }\n\n const repoUrls = getRepoUrls(discovery.beadsDir);\n const claims = commentsResult\n ? getClaimedNodes(commentsResult.allComments)\n : new Map<string, ClaimInfo>();\n\n // Build node map for enrichment\n const nodeMap = new Map<string, GraphNode>(\n beadsData.graphData.nodes.map((n) => [n.id, n])\n );\n\n // Filter and enrich issues\n let issues = beadsData.graphData.nodes;\n\n if (statusFilter) {\n issues = issues.filter((n) => statusFilter.includes(n.status));\n }\n if (priorityFilter) {\n issues = issues.filter((n) => priorityFilter.includes(n.priority));\n }\n if (prefixFilter) {\n issues = issues.filter((n) => n.prefix === prefixFilter);\n }\n\n const enrichedIssues = issues.map((node) => {\n const nodeComments =\n commentsResult?.commentsByNode.get(node.id) || [];\n const claim = claims.get(node.id) || null;\n\n return {\n id: node.id,\n title: node.title,\n description: node.description || null,\n status: node.status,\n priority: node.priority,\n issue_type: node.issueType,\n owner: node.owner || null,\n assignee: node.assignee || null,\n labels: node.labels,\n created_at: node.createdAt,\n updated_at: node.updatedAt,\n closed_at: node.closedAt || null,\n close_reason: node.closeReason || null,\n prefix: node.prefix,\n blockers: node.dependentIds, // issues that block this one (upstream)\n dependents: node.blockerIds, // issues this one blocks (downstream)\n ...(includeComments\n ? { comments: nodeComments.map(serializeComment) }\n : {}),\n claimed_by: claim ? serializeClaim(claim) : null,\n };\n });\n\n // Build dependencies\n const dependencies = beadsData.graphData.links.map((link) => {\n const src =\n typeof link.source === \"object\"\n ? (link.source as { id: string }).id\n : link.source;\n const tgt =\n typeof link.target === \"object\"\n ? (link.target as { id: string }).id\n : link.target;\n return { from: src, to: tgt, type: link.type };\n });\n\n // Build activity feed\n let activity: Record<string, unknown>[] = [];\n if (includeActivity) {\n const feed = buildHistoricalFeed(\n beadsData.graphData.nodes,\n beadsData.graphData.links,\n commentsResult?.allComments || null\n );\n activity = feed.slice(0, limit).map((event) => ({\n type: event.type,\n time: new Date(event.time).toISOString(),\n issue_id: event.nodeId,\n ...(event.nodeTitle ? { issue_title: event.nodeTitle } : {}),\n ...(event.actor ? { actor: { handle: event.actor.handle } } : {}),\n ...(event.detail ? { detail: event.detail } : {}),\n }));\n }\n\n // Warnings for partial data\n const warnings: string[] = [];\n if (includeComments && !commentsResult) {\n warnings.push(\"Failed to fetch comments from indexer\");\n }\n\n return jsonResponse({\n project: {\n name: discovery.issuePrefix || discovery.repoName,\n prefix: discovery.issuePrefix || null,\n repos,\n repoUrls,\n },\n issues: enrichedIssues,\n dependencies,\n stats: {\n total: beadsData.stats.total,\n open: beadsData.stats.open,\n in_progress: beadsData.stats.inProgress,\n blocked: beadsData.stats.blocked,\n closed: beadsData.stats.closed,\n actionable: beadsData.stats.actionable,\n },\n ...(includeActivity ? { activity } : {}),\n _meta: {\n generated_at: new Date().toISOString(),\n api_version: \"v1\" as const,\n heartbeads_version: heartbeadsVersion,\n ...(warnings.length ? { warnings } : {}),\n },\n });\n } catch (error: unknown) {\n const message =\n error instanceof Error ? error.message : \"Unknown error\";\n if (message.includes(\"No .beads/ directory found\")) {\n return errorResponse(\n \"No .beads directory found\",\n 404,\n \"Run bd init in your project first, or set BEADS_DIR.\"\n );\n }\n console.error(\"[api/v1/graph] Error:\", error);\n return errorResponse(\"Internal server error\", 500);\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/v1/graph/route\",\n pathname: \"/api/v1/graph\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/app/api/v1/graph/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/v1/graph/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","/**\n * Activity feed: unified event type and builders for historical + real-time events.\n *\n * Data sources:\n * 1. Issue JSONL timestamps (created_at, closed_at, updated_at)\n * 2. Dependency timestamps (link created_at)\n * 3. ATProto comments, claims, likes (from useBeadsComments)\n * 4. Real-time SSE diffs (BeadsDiff from diffBeadsData)\n */\n\nimport type { GraphNode, GraphLink } from \"./types\";\nimport type { BeadsDiff, NodeChange } from \"./diff-beads\";\nimport type { BeadsComment } from \"@/lib/comments\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type ActivityEventType =\n | \"node-created\"\n | \"node-closed\"\n | \"node-status-changed\"\n | \"node-priority-changed\"\n | \"node-title-changed\"\n | \"node-owner-changed\"\n | \"node-assignee-changed\"\n | \"link-added\"\n | \"link-removed\"\n | \"comment-added\"\n | \"reply-added\"\n | \"task-claimed\"\n | \"task-unclaimed\"\n | \"like-added\";\n\nexport interface ActivityActor {\n handle: string;\n avatar?: string;\n did?: string;\n}\n\nexport interface ActivityEvent {\n /** Unique key for React rendering and deduplication: `${type}:${nodeId}:${time}` */\n id: string;\n type: ActivityEventType;\n /** Unix milliseconds, for sorting */\n time: number;\n /** Which issue this event relates to */\n nodeId: string;\n /** Issue title for display (may be undefined for deleted nodes) */\n nodeTitle?: string;\n /** Who performed the action (for comments, claims, likes) */\n actor?: ActivityActor;\n /** Human-readable detail: e.g. \"open -> in_progress\", comment text preview, link target */\n detail?: string;\n /** Extra structured context */\n meta?: Record<string, string>;\n}\n\n/** Filter category for the UI */\nexport type ActivityFilterCategory =\n | \"issues\"\n | \"deps\"\n | \"comments\"\n | \"claims\"\n | \"likes\";\n\n/** Map event types to filter categories */\nexport function getEventCategory(type: ActivityEventType): ActivityFilterCategory {\n switch (type) {\n case \"node-created\":\n case \"node-closed\":\n case \"node-status-changed\":\n case \"node-priority-changed\":\n case \"node-title-changed\":\n case \"node-owner-changed\":\n case \"node-assignee-changed\":\n return \"issues\";\n case \"link-added\":\n case \"link-removed\":\n return \"deps\";\n case \"comment-added\":\n case \"reply-added\":\n return \"comments\";\n case \"task-claimed\":\n case \"task-unclaimed\":\n return \"claims\";\n case \"like-added\":\n return \"likes\";\n }\n}\n\n// ============================================================================\n// Historical feed builder\n// ============================================================================\n\n/**\n * Build the full historical activity feed from existing data.\n * Called once on load and when allComments changes.\n */\nexport function buildHistoricalFeed(\n nodes: GraphNode[],\n links: GraphLink[],\n allComments: BeadsComment[] | null\n): ActivityEvent[] {\n const events: ActivityEvent[] = [];\n const seen = new Set<string>();\n\n function add(event: ActivityEvent) {\n if (seen.has(event.id)) return;\n seen.add(event.id);\n events.push(event);\n }\n\n // --- Issue lifecycle events ---\n for (const node of nodes) {\n // Created\n if (node.createdAt) {\n const time = new Date(node.createdAt).getTime();\n if (!isNaN(time)) {\n add({\n id: `node-created:${node.id}:${time}`,\n type: \"node-created\",\n time,\n nodeId: node.id,\n nodeTitle: node.title,\n actor: node.createdBy ? { handle: node.createdBy } : node.owner ? { handle: node.owner } : undefined,\n detail: node.issueType,\n meta: { issueType: node.issueType, prefix: node.prefix },\n });\n }\n }\n\n // Closed\n if (node.closedAt) {\n const time = new Date(node.closedAt).getTime();\n if (!isNaN(time)) {\n add({\n id: `node-closed:${node.id}:${time}`,\n type: \"node-closed\",\n time,\n nodeId: node.id,\n nodeTitle: node.title,\n actor: node.owner ? { handle: node.owner } : node.createdBy ? { handle: node.createdBy } : undefined,\n detail: node.closeReason || \"Closed\",\n meta: { prefix: node.prefix },\n });\n }\n }\n }\n\n // --- Dependency events ---\n for (const link of links) {\n if (link.createdAt) {\n const time = new Date(link.createdAt).getTime();\n if (!isNaN(time)) {\n const src = typeof link.source === \"object\" ? (link.source as { id: string }).id : link.source;\n const tgt = typeof link.target === \"object\" ? (link.target as { id: string }).id : link.target;\n add({\n id: `link-added:${src}->${tgt}:${time}`,\n type: \"link-added\",\n time,\n nodeId: src,\n detail: `${link.type} ${tgt}`,\n meta: { linkType: link.type, target: tgt },\n });\n }\n }\n }\n\n // --- Comment, claim, and like events ---\n if (allComments) {\n for (const comment of allComments) {\n const time = new Date(comment.createdAt).getTime();\n if (isNaN(time)) continue;\n\n const actor: ActivityActor = {\n handle: comment.handle,\n avatar: comment.avatar,\n did: comment.did,\n };\n\n const isClaim =\n comment.text.startsWith(\"@\") &&\n comment.text.trim().indexOf(\" \") === -1;\n\n if (isClaim) {\n add({\n id: `task-claimed:${comment.nodeId}:${time}`,\n type: \"task-claimed\",\n time,\n nodeId: comment.nodeId,\n actor,\n detail: comment.text,\n });\n } else if (comment.replyTo) {\n add({\n id: `reply-added:${comment.nodeId}:${comment.rkey}`,\n type: \"reply-added\",\n time,\n nodeId: comment.nodeId,\n actor,\n detail:\n comment.text.length > 80\n ? comment.text.slice(0, 80) + \"...\"\n : comment.text,\n });\n } else {\n add({\n id: `comment-added:${comment.nodeId}:${comment.rkey}`,\n type: \"comment-added\",\n time,\n nodeId: comment.nodeId,\n actor,\n detail:\n comment.text.length > 80\n ? comment.text.slice(0, 80) + \"...\"\n : comment.text,\n });\n }\n\n // Likes on this comment\n for (const like of comment.likes) {\n const likeTime = new Date(like.createdAt).getTime();\n if (isNaN(likeTime)) continue;\n add({\n id: `like-added:${comment.nodeId}:${like.rkey}`,\n type: \"like-added\",\n time: likeTime,\n nodeId: comment.nodeId,\n actor: {\n handle: like.handle,\n avatar: like.avatar,\n did: like.did,\n },\n detail: `Liked comment by ${comment.handle}`,\n });\n }\n }\n }\n\n // Sort newest-first\n events.sort((a, b) => b.time - a.time);\n return events;\n}\n\n// ============================================================================\n// Real-time diff -> events converter\n// ============================================================================\n\n/**\n * Convert a BeadsDiff into ActivityEvent items.\n * Called on each SSE message after diffBeadsData().\n */\nexport function diffToActivityEvents(\n diff: BeadsDiff,\n nodes: GraphNode[]\n): ActivityEvent[] {\n const events: ActivityEvent[] = [];\n const now = Date.now();\n const nodeMap = new Map(nodes.map((n) => [n.id, n]));\n\n // Added nodes\n for (const id of diff.addedNodeIds) {\n const node = nodeMap.get(id);\n events.push({\n id: `node-created:${id}:${now}`,\n type: \"node-created\",\n time: now,\n nodeId: id,\n nodeTitle: node?.title,\n detail: node?.issueType || \"task\",\n meta: node ? { issueType: node.issueType, prefix: node.prefix } : undefined,\n });\n }\n\n // Removed nodes\n for (const id of diff.removedNodeIds) {\n events.push({\n id: `node-closed:${id}:${now}`,\n type: \"node-closed\",\n time: now,\n nodeId: id,\n detail: \"Removed\",\n });\n }\n\n // Changed nodes\n for (const [id, changes] of diff.changedNodes) {\n const node = nodeMap.get(id);\n for (const change of changes) {\n let type: ActivityEventType;\n switch (change.field) {\n case \"status\":\n type = \"node-status-changed\";\n break;\n case \"priority\":\n type = \"node-priority-changed\";\n break;\n case \"title\":\n type = \"node-title-changed\";\n break;\n case \"owner\":\n type = \"node-owner-changed\";\n break;\n case \"assignee\":\n type = \"node-assignee-changed\";\n break;\n default:\n type = \"node-status-changed\"; // fallback\n }\n events.push({\n id: `${type}:${id}:${now}:${change.field}`,\n type,\n time: now,\n nodeId: id,\n nodeTitle: node?.title,\n detail: `${change.from} \\u2192 ${change.to}`,\n meta: { field: change.field, from: change.from, to: change.to },\n });\n }\n }\n\n // Added links\n for (const key of diff.addedLinkKeys) {\n // key format: \"source->target:type\"\n const match = key.match(/^(.+)->(.+):(.+)$/);\n if (match) {\n const [, src, tgt, linkType] = match;\n events.push({\n id: `link-added:${key}:${now}`,\n type: \"link-added\",\n time: now,\n nodeId: src,\n detail: `${linkType} ${tgt}`,\n meta: { linkType, target: tgt },\n });\n }\n }\n\n // Removed links\n for (const key of diff.removedLinkKeys) {\n const match = key.match(/^(.+)->(.+):(.+)$/);\n if (match) {\n const [, src, tgt, linkType] = match;\n events.push({\n id: `link-removed:${key}:${now}`,\n type: \"link-removed\",\n time: now,\n nodeId: src,\n detail: `${linkType} ${tgt}`,\n meta: { linkType, target: tgt },\n });\n }\n }\n\n return events;\n}\n\n// ============================================================================\n// Feed management helpers\n// ============================================================================\n\n/** Number of events to show per page in the ActivityPanel UI */\nexport const ACTIVITY_PAGE_SIZE = 50;\n\n/**\n * Merge new events into an existing feed, deduplicating by event ID.\n * Returns a new array sorted newest-first.\n */\nexport function mergeFeedEvents(\n existing: ActivityEvent[],\n incoming: ActivityEvent[]\n): ActivityEvent[] {\n const seen = new Set(existing.map((e) => e.id));\n const merged = [...existing];\n for (const event of incoming) {\n if (!seen.has(event.id)) {\n seen.add(event.id);\n merged.push(event);\n }\n }\n merged.sort((a, b) => b.time - a.time);\n return merged;\n}\n"],"names":[],"mappings":"uCCAA,IAAA,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,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,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,ODFA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAIA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAEO,IAAM,EAAU,gBAInB,EAAoB,QACxB,GAAI,CAIF,EAHY,AAGQ,KAHH,KAAK,CACpB,CAAA,EAA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AqB,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":[1]}
|
|
1
|
+
{"version":3,"sources":["../../../app/api/v1/graph/route.ts","../../../node_modules/.pnpm/next%4016.1.6_react-dom%4018.3.1_react%4018.3.1__react%4018.3.1/node_modules/next/dist/esm/build/templates/app-route.js","../../../lib/activity.ts"],"sourcesContent":["/**\n * GET /api/v1/graph — Full project snapshot for AI agents.\n *\n * Returns the entire beads graph with issues, dependencies, comments,\n * claims, and activity in a single JSON response. No auth required.\n *\n * Query params:\n * ?status=open,in_progress Filter issues by status (comma-separated)\n * ?priority=0,1 Filter by priority (comma-separated)\n * ?prefix=beads-map Filter by repo prefix\n * ?include=comments,activity Opt-in fields (default: all)\n * ?limit=50 Activity feed cap (default 50, max 200)\n */\n\nimport { loadBeadsData } from \"@/lib/parse-beads\";\nimport { discoverBeadsDir, getRepoUrls } from \"@/lib/discover\";\nimport { fetchBeadsComments, getClaimedNodes } from \"@/lib/comments\";\nimport type { BeadsComment, ClaimInfo } from \"@/lib/comments\";\nimport { buildHistoricalFeed } from \"@/lib/activity\";\nimport type { GraphNode } from \"@/lib/types\";\nimport { jsonResponse, errorResponse, OPTIONS } from \"@/lib/api-helpers\";\nimport { readFileSync, existsSync } from \"fs\";\nimport { join } from \"path\";\nimport { parse as parseYaml } from \"yaml\";\n\nexport const dynamic = \"force-dynamic\";\nexport { OPTIONS };\n\n// Read version from package.json at module load time\nlet heartbeadsVersion = \"0.0.0\";\ntry {\n const pkg = JSON.parse(\n readFileSync(join(process.cwd(), \"package.json\"), \"utf-8\")\n );\n heartbeadsVersion = pkg.version || heartbeadsVersion;\n} catch {\n // ignore\n}\n\n/** Serialize a BeadsComment tree for API output */\nfunction serializeComment(c: BeadsComment): Record<string, unknown> {\n return {\n author: {\n handle: c.handle,\n did: c.did,\n ...(c.displayName ? { displayName: c.displayName } : {}),\n },\n text: c.text,\n createdAt: c.createdAt,\n likes: c.likes.length,\n replies: c.replies.map(serializeComment),\n };\n}\n\n/** Serialize a claim for API output */\nfunction serializeClaim(claim: ClaimInfo) {\n return {\n handle: claim.handle,\n did: claim.did,\n ...(claim.displayName ? { displayName: claim.displayName } : {}),\n claimed_at: claim.claimedAt,\n };\n}\n\nexport async function GET(request: Request) {\n try {\n const discovery = discoverBeadsDir();\n const url = new URL(request.url);\n const params = url.searchParams;\n\n // Parse query params\n const statusFilter = params.get(\"status\")?.split(\",\").filter(Boolean);\n const priorityFilter = params\n .get(\"priority\")\n ?.split(\",\")\n .map(Number)\n .filter((n) => !isNaN(n));\n const prefixFilter = params.get(\"prefix\") || null;\n const includeParam = params.get(\"include\");\n const limit = Math.min(\n Math.max(parseInt(params.get(\"limit\") || \"50\") || 50, 1),\n 200\n );\n\n // Determine what to include (default: everything)\n let includeComments = true;\n let includeActivity = true;\n if (includeParam !== null) {\n const includes = includeParam.split(\",\").filter(Boolean);\n includeComments = includes.includes(\"comments\");\n includeActivity = includes.includes(\"activity\");\n }\n\n // Load beads data + config in parallel with optional comments\n const beadsPromise = Promise.resolve(loadBeadsData(discovery.beadsDir));\n const commentsPromise = includeComments\n ? fetchBeadsComments().catch((err) => {\n console.error(\"[api/v1/graph] Failed to fetch comments:\", err);\n return null;\n })\n : Promise.resolve(null);\n\n const [beadsData, commentsResult] = await Promise.all([\n beadsPromise,\n commentsPromise,\n ]);\n\n // Build project metadata\n let repos: string[] = [\".\"];\n const configPath = join(discovery.beadsDir, \"config.yaml\");\n try {\n if (existsSync(configPath)) {\n const content = readFileSync(configPath, \"utf-8\");\n const config = parseYaml(content);\n const additional = config?.repos?.additional;\n if (Array.isArray(additional)) {\n repos = [config?.repos?.primary || \".\", ...additional];\n }\n }\n } catch {\n // ignore\n }\n\n const repoUrls = getRepoUrls(discovery.beadsDir);\n const claims = commentsResult\n ? getClaimedNodes(commentsResult.allComments)\n : new Map<string, ClaimInfo>();\n\n // Build node map for enrichment\n const nodeMap = new Map<string, GraphNode>(\n beadsData.graphData.nodes.map((n) => [n.id, n])\n );\n\n // Filter and enrich issues\n let issues = beadsData.graphData.nodes;\n\n if (statusFilter) {\n issues = issues.filter((n) => statusFilter.includes(n.status));\n }\n if (priorityFilter) {\n issues = issues.filter((n) => priorityFilter.includes(n.priority));\n }\n if (prefixFilter) {\n issues = issues.filter((n) => n.prefix === prefixFilter);\n }\n\n const enrichedIssues = issues.map((node) => {\n const nodeComments =\n commentsResult?.commentsByNode.get(node.id) || [];\n const claim = claims.get(node.id) || null;\n\n return {\n id: node.id,\n title: node.title,\n description: node.description || null,\n status: node.status,\n priority: node.priority,\n issue_type: node.issueType,\n owner: node.owner || null,\n assignee: node.assignee || null,\n labels: node.labels,\n created_at: node.createdAt,\n updated_at: node.updatedAt,\n closed_at: node.closedAt || null,\n close_reason: node.closeReason || null,\n prefix: node.prefix,\n blockers: node.dependentIds, // issues that block this one (upstream)\n dependents: node.blockerIds, // issues this one blocks (downstream)\n ...(includeComments\n ? { comments: nodeComments.map(serializeComment) }\n : {}),\n claimed_by: claim ? serializeClaim(claim) : null,\n };\n });\n\n // Build dependencies\n const dependencies = beadsData.graphData.links.map((link) => {\n const src =\n typeof link.source === \"object\"\n ? (link.source as { id: string }).id\n : link.source;\n const tgt =\n typeof link.target === \"object\"\n ? (link.target as { id: string }).id\n : link.target;\n return { from: src, to: tgt, type: link.type };\n });\n\n // Build activity feed\n let activity: Record<string, unknown>[] = [];\n if (includeActivity) {\n const feed = buildHistoricalFeed(\n beadsData.graphData.nodes,\n beadsData.graphData.links,\n commentsResult?.allComments || null\n );\n activity = feed.slice(0, limit).map((event) => ({\n type: event.type,\n time: new Date(event.time).toISOString(),\n issue_id: event.nodeId,\n ...(event.nodeTitle ? { issue_title: event.nodeTitle } : {}),\n ...(event.actor ? { actor: { handle: event.actor.handle } } : {}),\n ...(event.detail ? { detail: event.detail } : {}),\n }));\n }\n\n // Warnings for partial data\n const warnings: string[] = [];\n if (includeComments && !commentsResult) {\n warnings.push(\"Failed to fetch comments from indexer\");\n }\n\n return jsonResponse({\n project: {\n name: discovery.issuePrefix || discovery.repoName,\n prefix: discovery.issuePrefix || null,\n repos,\n repoUrls,\n },\n issues: enrichedIssues,\n dependencies,\n stats: {\n total: beadsData.stats.total,\n open: beadsData.stats.open,\n in_progress: beadsData.stats.inProgress,\n blocked: beadsData.stats.blocked,\n closed: beadsData.stats.closed,\n actionable: beadsData.stats.actionable,\n },\n ...(includeActivity ? { activity } : {}),\n _meta: {\n generated_at: new Date().toISOString(),\n api_version: \"v1\" as const,\n heartbeads_version: heartbeadsVersion,\n ...(warnings.length ? { warnings } : {}),\n },\n });\n } catch (error: unknown) {\n const message =\n error instanceof Error ? error.message : \"Unknown error\";\n if (message.includes(\"No .beads/ directory found\")) {\n return errorResponse(\n \"No .beads directory found\",\n 404,\n \"Run bd init in your project first, or set BEADS_DIR.\"\n );\n }\n console.error(\"[api/v1/graph] Error:\", error);\n return errorResponse(\"Internal server error\", 500);\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/v1/graph/route\",\n pathname: \"/api/v1/graph\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/app/api/v1/graph/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/v1/graph/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","/**\n * Activity feed: unified event type and builders for historical + real-time events.\n *\n * Data sources:\n * 1. Issue JSONL timestamps (created_at, closed_at, updated_at)\n * 2. Dependency timestamps (link created_at)\n * 3. ATProto comments, claims, likes (from useBeadsComments)\n * 4. Real-time SSE diffs (BeadsDiff from diffBeadsData)\n */\n\nimport type { GraphNode, GraphLink } from \"./types\";\nimport type { BeadsDiff, NodeChange } from \"./diff-beads\";\nimport type { BeadsComment } from \"@/lib/comments\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type ActivityEventType =\n | \"node-created\"\n | \"node-closed\"\n | \"node-status-changed\"\n | \"node-priority-changed\"\n | \"node-title-changed\"\n | \"node-owner-changed\"\n | \"node-assignee-changed\"\n | \"link-added\"\n | \"link-removed\"\n | \"comment-added\"\n | \"reply-added\"\n | \"task-claimed\"\n | \"task-unclaimed\"\n | \"like-added\";\n\nexport interface ActivityActor {\n handle: string;\n avatar?: string;\n did?: string;\n}\n\nexport interface ActivityEvent {\n /** Unique key for React rendering and deduplication: `${type}:${nodeId}:${time}` */\n id: string;\n type: ActivityEventType;\n /** Unix milliseconds, for sorting */\n time: number;\n /** Which issue this event relates to */\n nodeId: string;\n /** Issue title for display (may be undefined for deleted nodes) */\n nodeTitle?: string;\n /** Who performed the action (for comments, claims, likes) */\n actor?: ActivityActor;\n /** Human-readable detail: e.g. \"open -> in_progress\", comment text preview, link target */\n detail?: string;\n /** Extra structured context */\n meta?: Record<string, string>;\n}\n\n/** Filter category for the UI */\nexport type ActivityFilterCategory =\n | \"issues\"\n | \"deps\"\n | \"comments\"\n | \"claims\"\n | \"likes\";\n\n/** Map event types to filter categories */\nexport function getEventCategory(type: ActivityEventType): ActivityFilterCategory {\n switch (type) {\n case \"node-created\":\n case \"node-closed\":\n case \"node-status-changed\":\n case \"node-priority-changed\":\n case \"node-title-changed\":\n case \"node-owner-changed\":\n case \"node-assignee-changed\":\n return \"issues\";\n case \"link-added\":\n case \"link-removed\":\n return \"deps\";\n case \"comment-added\":\n case \"reply-added\":\n return \"comments\";\n case \"task-claimed\":\n case \"task-unclaimed\":\n return \"claims\";\n case \"like-added\":\n return \"likes\";\n }\n}\n\n// ============================================================================\n// Historical feed builder\n// ============================================================================\n\n/**\n * Build the full historical activity feed from existing data.\n * Called once on load and when allComments changes.\n */\nexport function buildHistoricalFeed(\n nodes: GraphNode[],\n links: GraphLink[],\n allComments: BeadsComment[] | null\n): ActivityEvent[] {\n const events: ActivityEvent[] = [];\n const seen = new Set<string>();\n\n function add(event: ActivityEvent) {\n if (seen.has(event.id)) return;\n seen.add(event.id);\n events.push(event);\n }\n\n // --- Issue lifecycle events ---\n for (const node of nodes) {\n // Created\n if (node.createdAt) {\n const time = new Date(node.createdAt).getTime();\n if (!isNaN(time)) {\n add({\n id: `node-created:${node.id}:${time}`,\n type: \"node-created\",\n time,\n nodeId: node.id,\n nodeTitle: node.title,\n actor: node.createdBy\n ? { handle: node.createdBy }\n : node.owner\n ? { handle: node.owner }\n : node.assignee\n ? { handle: node.assignee }\n : undefined,\n detail: node.issueType,\n meta: { issueType: node.issueType, prefix: node.prefix },\n });\n }\n }\n\n // Closed\n if (node.closedAt) {\n const time = new Date(node.closedAt).getTime();\n if (!isNaN(time)) {\n add({\n id: `node-closed:${node.id}:${time}`,\n type: \"node-closed\",\n time,\n nodeId: node.id,\n nodeTitle: node.title,\n actor: node.owner\n ? { handle: node.owner }\n : node.createdBy\n ? { handle: node.createdBy }\n : node.assignee\n ? { handle: node.assignee }\n : undefined,\n detail: node.closeReason || \"Closed\",\n meta: { prefix: node.prefix },\n });\n }\n }\n }\n\n // --- Dependency events ---\n for (const link of links) {\n if (link.createdAt) {\n const time = new Date(link.createdAt).getTime();\n if (!isNaN(time)) {\n const src = typeof link.source === \"object\" ? (link.source as { id: string }).id : link.source;\n const tgt = typeof link.target === \"object\" ? (link.target as { id: string }).id : link.target;\n const sourceNode = nodes.find((n) => n.id === src);\n add({\n id: `link-added:${src}->${tgt}:${time}`,\n type: \"link-added\",\n time,\n nodeId: src,\n actor: sourceNode?.assignee ? { handle: sourceNode.assignee } : undefined,\n detail: `${link.type} ${tgt}`,\n meta: { linkType: link.type, target: tgt },\n });\n }\n }\n }\n\n // --- Comment, claim, and like events ---\n if (allComments) {\n for (const comment of allComments) {\n const time = new Date(comment.createdAt).getTime();\n if (isNaN(time)) continue;\n\n const actor: ActivityActor = {\n handle: comment.handle,\n avatar: comment.avatar,\n did: comment.did,\n };\n\n const isClaim =\n comment.text.startsWith(\"@\") &&\n comment.text.trim().indexOf(\" \") === -1;\n\n if (isClaim) {\n add({\n id: `task-claimed:${comment.nodeId}:${time}`,\n type: \"task-claimed\",\n time,\n nodeId: comment.nodeId,\n actor,\n detail: comment.text,\n });\n } else if (comment.replyTo) {\n add({\n id: `reply-added:${comment.nodeId}:${comment.rkey}`,\n type: \"reply-added\",\n time,\n nodeId: comment.nodeId,\n actor,\n detail:\n comment.text.length > 80\n ? comment.text.slice(0, 80) + \"...\"\n : comment.text,\n });\n } else {\n add({\n id: `comment-added:${comment.nodeId}:${comment.rkey}`,\n type: \"comment-added\",\n time,\n nodeId: comment.nodeId,\n actor,\n detail:\n comment.text.length > 80\n ? comment.text.slice(0, 80) + \"...\"\n : comment.text,\n });\n }\n\n // Likes on this comment\n for (const like of comment.likes) {\n const likeTime = new Date(like.createdAt).getTime();\n if (isNaN(likeTime)) continue;\n add({\n id: `like-added:${comment.nodeId}:${like.rkey}`,\n type: \"like-added\",\n time: likeTime,\n nodeId: comment.nodeId,\n actor: {\n handle: like.handle,\n avatar: like.avatar,\n did: like.did,\n },\n detail: `Liked comment by ${comment.handle}`,\n });\n }\n }\n }\n\n // Sort newest-first\n events.sort((a, b) => b.time - a.time);\n return events;\n}\n\n// ============================================================================\n// Real-time diff -> events converter\n// ============================================================================\n\n/**\n * Convert a BeadsDiff into ActivityEvent items.\n * Called on each SSE message after diffBeadsData().\n */\nexport function diffToActivityEvents(\n diff: BeadsDiff,\n nodes: GraphNode[]\n): ActivityEvent[] {\n const events: ActivityEvent[] = [];\n const now = Date.now();\n const nodeMap = new Map(nodes.map((n) => [n.id, n]));\n\n // Added nodes\n for (const id of diff.addedNodeIds) {\n const node = nodeMap.get(id);\n events.push({\n id: `node-created:${id}:${now}`,\n type: \"node-created\",\n time: now,\n nodeId: id,\n nodeTitle: node?.title,\n actor: node?.assignee ? { handle: node.assignee } : undefined,\n detail: node?.issueType || \"task\",\n meta: node ? { issueType: node.issueType, prefix: node.prefix } : undefined,\n });\n }\n\n // Removed nodes\n for (const id of diff.removedNodeIds) {\n const node = nodeMap.get(id);\n events.push({\n id: `node-closed:${id}:${now}`,\n type: \"node-closed\",\n time: now,\n nodeId: id,\n actor: node?.assignee ? { handle: node.assignee } : undefined,\n detail: \"Removed\",\n });\n }\n\n // Changed nodes\n for (const [id, changes] of diff.changedNodes) {\n const node = nodeMap.get(id);\n for (const change of changes) {\n let type: ActivityEventType;\n switch (change.field) {\n case \"status\":\n type = \"node-status-changed\";\n break;\n case \"priority\":\n type = \"node-priority-changed\";\n break;\n case \"title\":\n type = \"node-title-changed\";\n break;\n case \"owner\":\n type = \"node-owner-changed\";\n break;\n case \"assignee\":\n type = \"node-assignee-changed\";\n break;\n default:\n type = \"node-status-changed\"; // fallback\n }\n events.push({\n id: `${type}:${id}:${now}:${change.field}`,\n type,\n time: now,\n nodeId: id,\n nodeTitle: node?.title,\n actor: node?.assignee ? { handle: node.assignee } : undefined,\n detail: `${change.from} \\u2192 ${change.to}`,\n meta: { field: change.field, from: change.from, to: change.to },\n });\n }\n }\n\n // Added links\n for (const key of diff.addedLinkKeys) {\n // key format: \"source->target:type\"\n const match = key.match(/^(.+)->(.+):(.+)$/);\n if (match) {\n const [, src, tgt, linkType] = match;\n const sourceNode = nodeMap.get(src);\n events.push({\n id: `link-added:${key}:${now}`,\n type: \"link-added\",\n time: now,\n nodeId: src,\n actor: sourceNode?.assignee ? { handle: sourceNode.assignee } : undefined,\n detail: `${linkType} ${tgt}`,\n meta: { linkType, target: tgt },\n });\n }\n }\n\n // Removed links\n for (const key of diff.removedLinkKeys) {\n const match = key.match(/^(.+)->(.+):(.+)$/);\n if (match) {\n const [, src, tgt, linkType] = match;\n events.push({\n id: `link-removed:${key}:${now}`,\n type: \"link-removed\",\n time: now,\n nodeId: src,\n detail: `${linkType} ${tgt}`,\n meta: { linkType, target: tgt },\n });\n }\n }\n\n return events;\n}\n\n// ============================================================================\n// Feed management helpers\n// ============================================================================\n\n/** Number of events to show per page in the ActivityPanel UI */\nexport const ACTIVITY_PAGE_SIZE = 50;\n\n/**\n * Merge new events into an existing feed, deduplicating by event ID.\n * Returns a new array sorted newest-first.\n */\nexport function mergeFeedEvents(\n existing: ActivityEvent[],\n incoming: ActivityEvent[]\n): ActivityEvent[] {\n const seen = new Set(existing.map((e) => e.id));\n const merged = [...existing];\n for (const event of incoming) {\n if (!seen.has(event.id)) {\n seen.add(event.id);\n merged.push(event);\n }\n }\n merged.sort((a, b) => b.time - a.time);\n return merged;\n}\n"],"names":[],"mappings":"uCCAA,IAAA,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,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,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,ODFA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAIA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAEO,IAAM,EAAU,gBAInB,EAA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AC,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,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":[1]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module.exports=[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"))},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"))},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"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},48676,e=>{"use strict";var t=e.i(22734),r=e.i(14747),s=e.i(24863),a=e.i(63846);function
|
|
1
|
+
module.exports=[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"))},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"))},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"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},48676,e=>{"use strict";var t=e.i(22734),r=e.i(14747),s=e.i(24863),a=e.i(63846);function n(e){let t=e.lastIndexOf("-");return -1===t?e:e.substring(0,t)}function i(e){let a=(0,r.join)(e,"config.yaml");try{let n=(0,t.readFileSync)(a,"utf-8"),i=(0,s.parse)(n),o=i?.repos?.additional;if(Array.isArray(o))return o.map(t=>(0,r.resolve)(e,"..",t)).filter(e=>(0,t.existsSync)((0,r.join)(e,".beads","issues.jsonl")))}catch(e){console.error("Failed to read config.yaml:",e)}return[]}function o(e){let r;try{r=(0,t.readFileSync)(e,"utf-8")}catch(t){return console.error(`Failed to read ${e}:`,t),[]}let s=r.split("\n").filter(e=>e.trim().length>0),a=[];for(let t=0;t<s.length;t++)try{a.push(JSON.parse(s[t]))}catch(r){console.warn(`Skipping malformed line ${t+1} in ${e}:`,r)}return a}function d(e){let t=function(e){let t=e||(0,a.discoverBeadsDir)().beadsDir,s=o((0,r.join)(t,"issues.jsonl"));for(let e of i(t)){let t=o((0,r.join)(e,".beads","issues.jsonl"));s.push(...t)}let n=new Map,d=[];for(let e of s){if("tombstone"===e.status)continue;let t=n.get(e.id);t?(!t.created_by&&e.created_by&&(t.created_by=e.created_by),!t.owner&&e.owner&&(t.owner=e.owner),!t.assignee&&e.assignee&&(t.assignee=e.assignee),!t.close_reason&&e.close_reason&&(t.close_reason=e.close_reason),!t.acceptance_criteria&&e.acceptance_criteria&&(t.acceptance_criteria=e.acceptance_criteria),null==t.estimated_minutes&&null!=e.estimated_minutes&&(t.estimated_minutes=e.estimated_minutes),(!t.labels||0===t.labels.length)&&e.labels&&e.labels.length>0&&(t.labels=e.labels)):(n.set(e.id,e),d.push(e))}return d}(e),s=function(e){let t=[],r=new Set;for(let s of e)if(s.dependencies)for(let e of s.dependencies){let s=`${e.issue_id}->${e.depends_on_id}:${e.type}`;r.has(s)||(r.add(s),t.push(e))}return t}(t),d=function(e,t){let r=new Map(e.map(e=>[e.id,e])),s=new Map,a=new Map;for(let e of t)("blocks"===e.type||"parent-child"===e.type)&&(s.has(e.depends_on_id)||s.set(e.depends_on_id,[]),s.get(e.depends_on_id).push(e.issue_id),a.has(e.issue_id)||a.set(e.issue_id,[]),a.get(e.issue_id).push(e.depends_on_id));return{nodes:e.map(e=>({id:e.id,title:e.title,description:e.description,status:e.status,priority:e.priority,issueType:e.issue_type,owner:e.owner,assignee:e.assignee,createdBy:e.created_by,createdAt:e.created_at,updatedAt:e.updated_at,closedAt:e.closed_at,closeReason:e.close_reason,acceptanceCriteria:e.acceptance_criteria,estimatedMinutes:e.estimated_minutes,prefix:n(e.id),labels:e.labels||[],blockerCount:s.get(e.id)?.length||0,dependentCount:a.get(e.id)?.length||0,blockerIds:s.get(e.id)||[],dependentIds:a.get(e.id)||[]})),links:t.filter(e=>("blocks"===e.type||"parent-child"===e.type)&&r.has(e.issue_id)&&r.has(e.depends_on_id)).map(e=>({source:e.depends_on_id,target:e.issue_id,type:e.type,createdAt:e.created_at}))}}(t,s),l=function(e,t,r){let s=[...new Set(e.map(e=>n(e.id)))],a=new Set(e.filter(e=>"closed"!==e.status).map(e=>e.id)),i=new Set;for(let e of t)"blocks"===e.type&&a.has(e.depends_on_id)&&i.add(e.issue_id);let o=e.filter(e=>("open"===e.status||"in_progress"===e.status)&&!i.has(e.id)).length;return{total:e.length,open:e.filter(e=>"open"===e.status).length,inProgress:e.filter(e=>"in_progress"===e.status).length,blocked:e.filter(e=>"blocked"===e.status).length,closed:e.filter(e=>"closed"===e.status).length,actionable:o,edges:r.links.length,prefixes:s}}(t,s,d);return{issues:t,dependencies:s,graphData:d,stats:l}}e.s(["getAdditionalRepoPaths",()=>i,"loadBeadsData",()=>d])},83814,93308,e=>{"use strict";let t=new Map,r=new Map;async function s(e){let s=t.get(e);if(s)return s;let a=r.get(e);if(a)return a;let n=(async()=>{try{let r=await fetch(`https://public.api.bsky.app/xrpc/app.bsky.actor.getProfile?actor=${encodeURIComponent(e)}`);if(!r.ok)throw Error(`Profile fetch failed: ${r.status}`);let s=await r.json(),a={did:e,handle:s.handle||e,displayName:s.displayName||void 0,avatar:s.avatar||void 0};return t.set(e,a),a}catch{let r={did:e,handle:e.slice(0,20)+"..."};return t.set(e,r),r}finally{r.delete(e)}})();return r.set(e,n),n}let a=process.env.INDEXER_URL||"https://hypergoat-app-production.up.railway.app/graphql",n=`
|
|
2
2
|
query FetchRecords($collection: String!, $first: Int, $after: String) {
|
|
3
3
|
records(collection: $collection, first: $first, after: $after) {
|
|
4
4
|
edges {
|
|
@@ -17,6 +17,6 @@ module.exports=[32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
`;async function
|
|
20
|
+
`;async function i(e){let t,r=[],s=!0,i=0;for(;s&&i<5;){let o=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:n,variables:{collection:e,first:100,after:t}})});if(!o.ok)throw Error(`Indexer fetch failed: ${o.status}`);let d=await o.json();if(d.errors?.length)throw Error(d.errors[0].message);let l=d.data?.records;if(!l)break;for(let e of l.edges)r.push(e.node);s=l.pageInfo.hasNextPage,t=l.pageInfo.endCursor,i++}return r}async function o(){let[e,t]=await Promise.all([i("org.impactindexer.review.comment"),i("org.impactindexer.review.like")]),r=e.filter(e=>{let t=e.value.subject;return t?.uri&&"string"==typeof t.uri&&t.uri.startsWith("beads:")}),a=new Map;for(let e of t){let t=e.value.subject;if(t?.uri&&"string"==typeof t.uri&&t.uri.startsWith("at://")){let r=a.get(t.uri)||[];r.push(e),a.set(t.uri,r)}}let n=new Set;for(let e of r)n.add(e.did);for(let e of t)n.add(e.did);let o=new Map((await Promise.all([...n].map(e=>s(e)))).map(e=>[e.did,e])),d=[];for(let e of r){let t=e.value,r=t.subject.uri.replace(/^beads:/,""),s=t.text||"",n=t.createdAt||"",i=t.replyTo||void 0,l=o.get(e.did),p=(a.get(e.uri)||[]).map(e=>{let t=o.get(e.did),r=e.value;return{did:e.did,handle:t?.handle||e.did.slice(0,20)+"...",displayName:t?.displayName,avatar:t?.avatar,createdAt:r.createdAt||"",uri:e.uri,rkey:e.rkey}}),c={did:e.did,handle:l?.handle||e.did.slice(0,20)+"...",displayName:l?.displayName,avatar:l?.avatar,text:s,createdAt:n,uri:e.uri,rkey:e.rkey,nodeId:r,replyTo:i,likes:p,replies:[]};d.push(c)}let l=new Map;for(let e of d)l.set(e.uri,e);let p=[];for(let e of d){if(e.replyTo){let t=l.get(e.replyTo);if(t){t.replies.push(e);continue}}p.push(e)}p.sort((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()),!function e(t){for(let r of t)r.replies.sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime()),e(r.replies)}(p);let c=new Map;for(let e of p){let t=c.get(e.nodeId)||[];t.push(e),c.set(e.nodeId,t)}let u=new Map;for(let e of d)u.set(e.nodeId,(u.get(e.nodeId)||0)+1);return{commentsByNode:c,commentedNodeIds:u,allComments:[...d].sort((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime())}}function d(e){let t=new Map;for(let r of[...e].sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime())){if(t.has(r.nodeId))continue;let e=r.text.trim();e.startsWith("@")&&-1===e.indexOf(" ")&&t.set(r.nodeId,{handle:r.handle,did:r.did,displayName:r.displayName,avatar:r.avatar,claimedAt:r.createdAt})}return t}e.s(["fetchBeadsComments",()=>o,"getClaimedNodes",()=>d],83814);var l=e.i(69817);let p={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, OPTIONS","Access-Control-Allow-Headers":"Content-Type"};function c(e,t=200){return l.NextResponse.json(e,{status:t,headers:{...p,"Cache-Control":"public, max-age=30"}})}function u(e,t,r){return l.NextResponse.json({error:e,...r?{hint:r}:{}},{status:t,headers:p})}function f(){return new l.NextResponse(null,{status:204,headers:p})}e.s(["OPTIONS",()=>f,"errorResponse",()=>u,"jsonResponse",()=>c],93308)}];
|
|
21
21
|
|
|
22
22
|
//# sourceMappingURL=%5Broot-of-the-server%5D__2d60806f._.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/parse-beads.ts","../../../lib/comments.ts","../../../lib/api-helpers.ts"],"sourcesContent":["import { readFileSync, existsSync } from \"fs\";\nimport { join, resolve } from \"path\";\nimport { parse as parseYaml } from \"yaml\";\nimport { discoverBeadsDir } from \"./discover\";\nimport type {\n BeadIssue,\n BeadDependency,\n GraphNode,\n GraphLink,\n GraphData,\n BeadsApiResponse,\n} from \"./types\";\n\n/**\n * Extract the prefix from a bead ID (e.g. \"my-app-5gw\" -> \"my-app\")\n */\nexport function extractPrefix(id: string): string {\n const lastDash = id.lastIndexOf(\"-\");\n if (lastDash === -1) return id;\n return id.substring(0, lastDash);\n}\n\n/**\n * Read repos.additional paths from .beads/config.yaml\n */\nexport function getAdditionalRepoPaths(beadsDir: string): string[] {\n const configPath = join(beadsDir, \"config.yaml\");\n try {\n const content = readFileSync(configPath, \"utf-8\");\n const config = parseYaml(content);\n const additional = config?.repos?.additional;\n if (Array.isArray(additional)) {\n return additional\n .map((p: string) => resolve(beadsDir, \"..\", p))\n .filter((p: string) => existsSync(join(p, \".beads\", \"issues.jsonl\")));\n }\n } catch (err) {\n console.error(\"Failed to read config.yaml:\", err);\n }\n return [];\n}\n\n/**\n * Parse a single issues.jsonl file and return issues\n */\nfunction parseJsonlFile(filePath: string): BeadIssue[] {\n let content: string;\n try {\n content = readFileSync(filePath, \"utf-8\");\n } catch (err) {\n console.error(`Failed to read ${filePath}:`, err);\n return [];\n }\n\n const lines = content.split(\"\\n\").filter((line) => line.trim().length > 0);\n const issues: BeadIssue[] = [];\n\n for (let i = 0; i < lines.length; i++) {\n try {\n issues.push(JSON.parse(lines[i]) as BeadIssue);\n } catch (err) {\n console.warn(`Skipping malformed line ${i + 1} in ${filePath}:`, err);\n }\n }\n\n return issues;\n}\n\n/**\n * Parse issues.jsonl from the primary .beads directory and all additional repos\n */\nexport function parseIssuesJsonl(beadsDir?: string): BeadIssue[] {\n const dir = beadsDir || discoverBeadsDir().beadsDir;\n\n // Load primary repo issues\n const primaryPath = join(dir, \"issues.jsonl\");\n const issues = parseJsonlFile(primaryPath);\n\n // Load additional repo issues from config.yaml\n const additionalRepos = getAdditionalRepoPaths(dir);\n for (const repoPath of additionalRepos) {\n const repoJsonl = join(repoPath, \".beads\", \"issues.jsonl\");\n const repoIssues = parseJsonlFile(repoJsonl);\n issues.push(...repoIssues);\n }\n\n // Deduplicate by issue ID (primary repo wins) and filter out tombstones.\n // bd delete marks issues with status \"tombstone\" rather than removing them\n // from the JSONL file — we must exclude these from the graph.\n const seen = new Set<string>();\n return issues.filter((issue) => {\n if (seen.has(issue.id)) return false;\n seen.add(issue.id);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((issue as any).status === \"tombstone\") return false;\n return true;\n });\n}\n\n/**\n * Extract all dependencies from issues (they're embedded in each issue)\n */\nexport function extractDependencies(issues: BeadIssue[]): BeadDependency[] {\n const deps: BeadDependency[] = [];\n const seen = new Set<string>();\n\n for (const issue of issues) {\n if (issue.dependencies) {\n for (const dep of issue.dependencies) {\n const key = `${dep.issue_id}->${dep.depends_on_id}:${dep.type}`;\n if (!seen.has(key)) {\n seen.add(key);\n deps.push(dep);\n }\n }\n }\n }\n\n return deps;\n}\n\n/**\n * Build graph data from issues and dependencies\n */\nexport function buildGraphData(\n issues: BeadIssue[],\n dependencies: BeadDependency[]\n): GraphData {\n const issueMap = new Map(issues.map((i) => [i.id, i]));\n\n // Count blockers and dependents for each issue\n const blockerCounts = new Map<string, string[]>(); // issue -> issues it blocks\n const dependentCounts = new Map<string, string[]>(); // issue -> issues that block it\n\n for (const dep of dependencies) {\n if (dep.type === \"blocks\" || dep.type === \"parent-child\") {\n // For blocks: depends_on_id blocks issue_id\n // For parent-child: depends_on_id is parent of issue_id\n // Both count as connections for node sizing\n if (!blockerCounts.has(dep.depends_on_id)) {\n blockerCounts.set(dep.depends_on_id, []);\n }\n blockerCounts.get(dep.depends_on_id)!.push(dep.issue_id);\n\n if (!dependentCounts.has(dep.issue_id)) {\n dependentCounts.set(dep.issue_id, []);\n }\n dependentCounts.get(dep.issue_id)!.push(dep.depends_on_id);\n }\n }\n\n const nodes: GraphNode[] = issues.map((issue) => ({\n id: issue.id,\n title: issue.title,\n description: issue.description,\n status: issue.status,\n priority: issue.priority,\n issueType: issue.issue_type,\n owner: issue.owner,\n assignee: issue.assignee,\n createdBy: issue.created_by,\n createdAt: issue.created_at,\n updatedAt: issue.updated_at,\n closedAt: issue.closed_at,\n closeReason: issue.close_reason,\n acceptanceCriteria: issue.acceptance_criteria,\n estimatedMinutes: issue.estimated_minutes,\n prefix: extractPrefix(issue.id),\n labels: issue.labels || [],\n\n blockerCount: blockerCounts.get(issue.id)?.length || 0,\n dependentCount: dependentCounts.get(issue.id)?.length || 0,\n blockerIds: blockerCounts.get(issue.id) || [],\n dependentIds: dependentCounts.get(issue.id) || [],\n }));\n\n // Build links: include blocking AND parent-child dependencies where both nodes exist\n const links: GraphLink[] = dependencies\n .filter(\n (d) =>\n (d.type === \"blocks\" || d.type === \"parent-child\") &&\n issueMap.has(d.issue_id) &&\n issueMap.has(d.depends_on_id)\n )\n .map((d) => ({\n // For both types: depends_on_id is the \"upstream\" node (blocker or parent)\n // blocks: blocker -> blocked\n // parent-child: parent -> child\n source: d.depends_on_id,\n target: d.issue_id,\n type: d.type,\n createdAt: d.created_at,\n }));\n\n return { nodes, links };\n}\n\n/**\n * Compute stats from issues and dependencies\n */\nexport function computeStats(\n issues: BeadIssue[],\n dependencies: BeadDependency[],\n graphData: GraphData\n) {\n const prefixes = [...new Set(issues.map((i) => extractPrefix(i.id)))];\n\n // An issue is \"actionable\" if it's open and has no open blockers\n const openIssueIds = new Set(\n issues.filter((i) => i.status !== \"closed\").map((i) => i.id)\n );\n\n const blockedByOpen = new Set<string>();\n for (const dep of dependencies) {\n if (dep.type === \"blocks\" && openIssueIds.has(dep.depends_on_id)) {\n // issue_id is blocked by depends_on_id which is still open\n blockedByOpen.add(dep.issue_id);\n }\n }\n\n const actionable = issues.filter(\n (i) =>\n (i.status === \"open\" || i.status === \"in_progress\") &&\n !blockedByOpen.has(i.id)\n ).length;\n\n return {\n total: issues.length,\n open: issues.filter((i) => i.status === \"open\").length,\n inProgress: issues.filter((i) => i.status === \"in_progress\").length,\n blocked: issues.filter((i) => i.status === \"blocked\").length,\n closed: issues.filter((i) => i.status === \"closed\").length,\n actionable,\n edges: graphData.links.length,\n prefixes,\n };\n}\n\n/**\n * Full pipeline: parse, extract, build, compute\n */\nexport function loadBeadsData(beadsDir?: string): BeadsApiResponse {\n const issues = parseIssuesJsonl(beadsDir);\n const dependencies = extractDependencies(issues);\n const graphData = buildGraphData(issues, dependencies);\n const stats = computeStats(issues, dependencies, graphData);\n\n return { issues, dependencies, graphData, stats };\n}\n","/**\n * Shared comment-fetching logic for beads.\n *\n * Fetches comments and likes from the Hypergoat GraphQL indexer,\n * resolves Bluesky profiles, builds threaded comment trees, and\n * detects claim info. Used by both the React hook (useBeadsComments)\n * and the public API routes (/api/v1/*).\n */\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface BeadsLike {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n createdAt: string;\n uri: string; // AT-URI of the like record\n rkey: string;\n}\n\nexport interface BeadsComment {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n text: string;\n createdAt: string;\n uri: string; // AT-URI of the comment record\n rkey: string;\n nodeId: string; // The beads issue ID this comment targets\n replyTo?: string; // AT-URI of parent comment (for threading)\n likes: BeadsLike[]; // Likes on this comment\n replies: BeadsComment[]; // Nested child comments (built during assembly)\n}\n\nexport interface ClaimInfo {\n handle: string;\n did: string;\n displayName?: string;\n avatar?: string;\n claimedAt: string;\n}\n\nexport interface FetchCommentsResult {\n /** Map from node ID -> threaded comment trees (root comments with nested replies) */\n commentsByNode: Map<string, BeadsComment[]>;\n /** Map from node ID -> total comment count (including replies) */\n commentedNodeIds: Map<string, number>;\n /** Flat list of ALL comments (including replies), newest-first */\n allComments: BeadsComment[];\n}\n\n// ============================================================================\n// Profile resolution (cached, deduplicated)\n// ============================================================================\n\ninterface ResolvedProfile {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n}\n\nconst profileCache = new Map<string, ResolvedProfile>();\nconst profileInflight = new Map<string, Promise<ResolvedProfile>>();\n\nasync function resolveProfile(did: string): Promise<ResolvedProfile> {\n const cached = profileCache.get(did);\n if (cached) return cached;\n\n const inflight = profileInflight.get(did);\n if (inflight) return inflight;\n\n const promise = (async () => {\n try {\n const res = await fetch(\n `https://public.api.bsky.app/xrpc/app.bsky.actor.getProfile?actor=${encodeURIComponent(did)}`\n );\n if (!res.ok) throw new Error(`Profile fetch failed: ${res.status}`);\n const data = await res.json();\n const profile: ResolvedProfile = {\n did,\n handle: data.handle || did,\n displayName: data.displayName || undefined,\n avatar: data.avatar || undefined,\n };\n profileCache.set(did, profile);\n return profile;\n } catch {\n // Fallback: use DID as handle\n const fallback: ResolvedProfile = {\n did,\n handle: did.slice(0, 20) + \"...\",\n };\n profileCache.set(did, fallback);\n return fallback;\n } finally {\n profileInflight.delete(did);\n }\n })();\n\n profileInflight.set(did, promise);\n return promise;\n}\n\n// ============================================================================\n// Hypergoat GraphQL fetching\n// ============================================================================\n\nconst INDEXER_URL =\n process.env.INDEXER_URL ||\n \"https://hypergoat-app-production.up.railway.app/graphql\";\n\nconst FETCH_RECORDS_QUERY = `\n query FetchRecords($collection: String!, $first: Int, $after: String) {\n records(collection: $collection, first: $first, after: $after) {\n edges {\n node {\n cid\n collection\n did\n rkey\n uri\n value\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n`;\n\ninterface IndexerRecord {\n cid: string;\n collection: string;\n did: string;\n rkey: string;\n uri: string;\n value: Record<string, unknown>;\n}\n\ninterface IndexerResponse {\n data?: {\n records?: {\n edges: Array<{ node: IndexerRecord }>;\n pageInfo: { hasNextPage: boolean; endCursor?: string };\n };\n };\n errors?: Array<{ message: string }>;\n}\n\nasync function fetchRecordsByCollection(\n collection: string\n): Promise<IndexerRecord[]> {\n const allRecords: IndexerRecord[] = [];\n let cursor: string | undefined;\n let hasMore = true;\n let pages = 0;\n const MAX_PAGES = 5; // Safety limit\n\n while (hasMore && pages < MAX_PAGES) {\n const res = await fetch(INDEXER_URL, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n query: FETCH_RECORDS_QUERY,\n variables: {\n collection,\n first: 100,\n after: cursor,\n },\n }),\n });\n\n if (!res.ok) {\n throw new Error(`Indexer fetch failed: ${res.status}`);\n }\n\n const json: IndexerResponse = await res.json();\n\n if (json.errors?.length) {\n throw new Error(json.errors[0].message);\n }\n\n const records = json.data?.records;\n if (!records) break;\n\n for (const edge of records.edges) {\n allRecords.push(edge.node);\n }\n\n hasMore = records.pageInfo.hasNextPage;\n cursor = records.pageInfo.endCursor;\n pages++;\n }\n\n return allRecords;\n}\n\n// ============================================================================\n// Core: fetch and process comments\n// ============================================================================\n\n/**\n * Fetch all beads comments and likes from Hypergoat, resolve profiles,\n * build threaded trees, and group by node.\n *\n * This is the pure data-fetching function used by both:\n * - `hooks/useBeadsComments.ts` (client-side React hook)\n * - `app/api/v1/*` routes (server-side API)\n */\nexport async function fetchBeadsComments(): Promise<FetchCommentsResult> {\n // 1. Fetch comments and likes in parallel from Hypergoat\n const [commentRecords, likeRecords] = await Promise.all([\n fetchRecordsByCollection(\"org.impactindexer.review.comment\"),\n fetchRecordsByCollection(\"org.impactindexer.review.like\"),\n ]);\n\n // 2. Filter to only beads-targeted comments\n const beadsCommentRecords = commentRecords.filter((r) => {\n const value = r.value as Record<string, unknown>;\n const subject = value.subject as\n | { uri?: string; type?: string }\n | undefined;\n return (\n subject?.uri &&\n typeof subject.uri === \"string\" &&\n subject.uri.startsWith(\"beads:\")\n );\n });\n\n // 3. Build likes-by-comment-URI map\n const likesByCommentUri = new Map<string, IndexerRecord[]>();\n for (const likeRecord of likeRecords) {\n const value = likeRecord.value as Record<string, unknown>;\n const subject = value.subject as\n | { uri?: string; type?: string }\n | undefined;\n if (\n subject?.uri &&\n typeof subject.uri === \"string\" &&\n subject.uri.startsWith(\"at://\")\n ) {\n const existing = likesByCommentUri.get(subject.uri) || [];\n existing.push(likeRecord);\n likesByCommentUri.set(subject.uri, existing);\n }\n }\n\n // 4. Resolve profiles for all unique DIDs (commenters + likers)\n const allDids = new Set<string>();\n for (const r of beadsCommentRecords) allDids.add(r.did);\n for (const r of likeRecords) allDids.add(r.did);\n\n const profiles = await Promise.all(\n [...allDids].map((did) => resolveProfile(did))\n );\n const profileMap = new Map(profiles.map((p) => [p.did, p]));\n\n // 5. Build flat comment list with likes attached\n const allFlat: BeadsComment[] = [];\n\n for (const record of beadsCommentRecords) {\n const value = record.value as Record<string, unknown>;\n const subject = value.subject as { uri: string };\n const nodeId = subject.uri.replace(/^beads:/, \"\");\n const text = (value.text as string) || \"\";\n const createdAt = (value.createdAt as string) || \"\";\n const replyTo = (value.replyTo as string) || undefined;\n const profile = profileMap.get(record.did);\n\n // Build likes for this comment\n const likeRecordsForComment =\n likesByCommentUri.get(record.uri) || [];\n const likes: BeadsLike[] = likeRecordsForComment.map((lr) => {\n const lp = profileMap.get(lr.did);\n const lv = lr.value as Record<string, unknown>;\n return {\n did: lr.did,\n handle: lp?.handle || lr.did.slice(0, 20) + \"...\",\n displayName: lp?.displayName,\n avatar: lp?.avatar,\n createdAt: (lv.createdAt as string) || \"\",\n uri: lr.uri,\n rkey: lr.rkey,\n };\n });\n\n const comment: BeadsComment = {\n did: record.did,\n handle: profile?.handle || record.did.slice(0, 20) + \"...\",\n displayName: profile?.displayName,\n avatar: profile?.avatar,\n text,\n createdAt,\n uri: record.uri,\n rkey: record.rkey,\n nodeId,\n replyTo,\n likes,\n replies: [], // Will be filled during tree assembly\n };\n\n allFlat.push(comment);\n }\n\n // 6. Build thread trees grouped by node\n\n // Index all comments by URI for tree assembly\n const commentByUri = new Map<string, BeadsComment>();\n for (const comment of allFlat) {\n commentByUri.set(comment.uri, comment);\n }\n\n // Assemble threads: attach replies to parents\n const rootComments: BeadsComment[] = [];\n for (const comment of allFlat) {\n if (comment.replyTo) {\n const parent = commentByUri.get(comment.replyTo);\n if (parent) {\n parent.replies.push(comment);\n continue; // Don't add as root\n }\n // Parent not found — treat as root comment\n }\n rootComments.push(comment);\n }\n\n // Sort: root comments newest-first, replies oldest-first (chronological)\n rootComments.sort(\n (a, b) =>\n new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()\n );\n\n function sortRepliesRecursive(comments: BeadsComment[]) {\n for (const c of comments) {\n c.replies.sort(\n (a, b) =>\n new Date(a.createdAt).getTime() -\n new Date(b.createdAt).getTime()\n );\n sortRepliesRecursive(c.replies);\n }\n }\n sortRepliesRecursive(rootComments);\n\n // Group root comments by nodeId\n const commentsByNode = new Map<string, BeadsComment[]>();\n for (const comment of rootComments) {\n const existing = commentsByNode.get(comment.nodeId) || [];\n existing.push(comment);\n commentsByNode.set(comment.nodeId, existing);\n }\n\n // 7. Build counts (total comments including replies per node)\n const commentedNodeIds = new Map<string, number>();\n for (const comment of allFlat) {\n commentedNodeIds.set(\n comment.nodeId,\n (commentedNodeIds.get(comment.nodeId) || 0) + 1\n );\n }\n\n // 8. Build allComments flat list (newest-first)\n const allComments = [...allFlat].sort(\n (a, b) =>\n new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()\n );\n\n return { commentsByNode, commentedNodeIds, allComments };\n}\n\n// ============================================================================\n// Claim detection\n// ============================================================================\n\n/**\n * Extract claim info from comments.\n * A claim comment has text starting with \"@\" and no spaces (e.g. \"@alice.bsky.social\").\n * First claim per node wins.\n */\nexport function getClaimedNodes(\n allComments: BeadsComment[]\n): Map<string, ClaimInfo> {\n const claims = new Map<string, ClaimInfo>();\n\n // Sort oldest-first so the first claim wins\n const sorted = [...allComments].sort(\n (a, b) =>\n new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()\n );\n\n for (const comment of sorted) {\n if (claims.has(comment.nodeId)) continue;\n\n const text = comment.text.trim();\n if (text.startsWith(\"@\") && text.indexOf(\" \") === -1) {\n claims.set(comment.nodeId, {\n handle: comment.handle,\n did: comment.did,\n displayName: comment.displayName,\n avatar: comment.avatar,\n claimedAt: comment.createdAt,\n });\n }\n }\n\n return claims;\n}\n","/**\n * Shared helpers for /api/v1/* routes.\n * Provides CORS headers, JSON response builders, and OPTIONS handler.\n */\n\nimport { NextResponse } from \"next/server\";\n\nconst CORS_HEADERS = {\n \"Access-Control-Allow-Origin\": \"*\",\n \"Access-Control-Allow-Methods\": \"GET, OPTIONS\",\n \"Access-Control-Allow-Headers\": \"Content-Type\",\n};\n\n/**\n * Build a JSON response with CORS and Cache-Control headers.\n */\nexport function jsonResponse(data: unknown, status = 200) {\n return NextResponse.json(data, {\n status,\n headers: {\n ...CORS_HEADERS,\n \"Cache-Control\": \"public, max-age=30\",\n },\n });\n}\n\n/**\n * Build an error JSON response with CORS headers (no caching).\n */\nexport function errorResponse(\n error: string,\n status: number,\n hint?: string\n) {\n return NextResponse.json(\n { error, ...(hint ? { hint } : {}) },\n { status, headers: CORS_HEADERS }\n );\n}\n\n/**\n * Preflight OPTIONS handler for CORS. Re-export from each route file.\n */\nexport function OPTIONS() {\n return new NextResponse(null, { status: 204, headers: CORS_HEADERS });\n}\n"],"names":[],"mappings":"8iCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAaO,SAAS,EAAc,CAAU,EACtC,IAAM,EAAW,EAAG,WAAW,CAAC,YAChC,AAAiB,CAAC,GAAG,CAAjB,EAAwB,EACrB,EAAG,SAAS,CAAC,EAAG,EACzB,CAKO,SAAS,EAAuB,CAAgB,EACrD,IAAM,EAAa,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,EAAU,eAClC,GAAI,CACF,IAAM,EAAU,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAY,SACnC,EAAS,CAAA,EAAA,EAAA,KAAA,AAAS,EAAC,GACnB,EAAa,GAAQ,OAAO,WAClC,GAAI,MAAM,OAAO,CAAC,GAChB,OAAO,EACJ,CAF0B,EAEvB,CAAC,AAAC,GAAc,CAA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,OAAO,CAAC,MACvC,EAAO,GAAG,CAAC,EAAQ,MAAM,CAAE,CACzB,OAAQ,EAAQ,MAAM,CACtB,IAAK,EAAQ,GAAG,CAChB,YAAa,EAAQ,WAAW,CAChC,OAAQ,EAAQ,MAAM,CACtB,UAAW,EAAQ,SAAS,AAC9B,EAEJ,CAEA,OAAO,CACT,iECxZA,IAAA,EAAA,EAAA,CAAA,CAAA,OAEA,IAAM,EAAe,CACnB,8BAA+B,IAC/B,+BAAgC,eAChC,+BAAgC,cAClC,EAKO,SAAS,EAAa,CAAa,CAAE,EAAS,GAAG,EACtD,OAAO,EAAA,YAAY,CAAC,IAAI,CAAC,EAAM,CAC7B,SACA,QAAS,CACP,GAAG,CAAY,CACf,gBAAiB,oBACnB,CACF,EACF,CAKO,SAAS,EACd,CAAa,CACb,CAAc,CACd,CAAa,EAEb,OAAO,EAAA,YAAY,CAAC,IAAI,CACtB,OAAE,EAAO,GAAI,EAAO,MAAE,CAAK,EAAI,CAAC,CAAC,AAAE,EACnC,CAAE,SAAQ,QAAS,CAAa,EAEpC,CAKO,SAAS,IACd,OAAO,IAAI,EAAA,YAAY,CAAC,KAAM,CAAE,OAAQ,IAAK,QAAS,CAAa,EACrE"}
|
|
1
|
+
{"version":3,"sources":["../../../lib/parse-beads.ts","../../../lib/comments.ts","../../../lib/api-helpers.ts"],"sourcesContent":["import { readFileSync, existsSync } from \"fs\";\nimport { join, resolve } from \"path\";\nimport { parse as parseYaml } from \"yaml\";\nimport { discoverBeadsDir } from \"./discover\";\nimport type {\n BeadIssue,\n BeadDependency,\n GraphNode,\n GraphLink,\n GraphData,\n BeadsApiResponse,\n} from \"./types\";\n\n/**\n * Extract the prefix from a bead ID (e.g. \"my-app-5gw\" -> \"my-app\")\n */\nexport function extractPrefix(id: string): string {\n const lastDash = id.lastIndexOf(\"-\");\n if (lastDash === -1) return id;\n return id.substring(0, lastDash);\n}\n\n/**\n * Read repos.additional paths from .beads/config.yaml\n */\nexport function getAdditionalRepoPaths(beadsDir: string): string[] {\n const configPath = join(beadsDir, \"config.yaml\");\n try {\n const content = readFileSync(configPath, \"utf-8\");\n const config = parseYaml(content);\n const additional = config?.repos?.additional;\n if (Array.isArray(additional)) {\n return additional\n .map((p: string) => resolve(beadsDir, \"..\", p))\n .filter((p: string) => existsSync(join(p, \".beads\", \"issues.jsonl\")));\n }\n } catch (err) {\n console.error(\"Failed to read config.yaml:\", err);\n }\n return [];\n}\n\n/**\n * Parse a single issues.jsonl file and return issues\n */\nfunction parseJsonlFile(filePath: string): BeadIssue[] {\n let content: string;\n try {\n content = readFileSync(filePath, \"utf-8\");\n } catch (err) {\n console.error(`Failed to read ${filePath}:`, err);\n return [];\n }\n\n const lines = content.split(\"\\n\").filter((line) => line.trim().length > 0);\n const issues: BeadIssue[] = [];\n\n for (let i = 0; i < lines.length; i++) {\n try {\n issues.push(JSON.parse(lines[i]) as BeadIssue);\n } catch (err) {\n console.warn(`Skipping malformed line ${i + 1} in ${filePath}:`, err);\n }\n }\n\n return issues;\n}\n\n/**\n * Parse issues.jsonl from the primary .beads directory and all additional repos\n */\nexport function parseIssuesJsonl(beadsDir?: string): BeadIssue[] {\n const dir = beadsDir || discoverBeadsDir().beadsDir;\n\n // Load primary repo issues\n const primaryPath = join(dir, \"issues.jsonl\");\n const issues = parseJsonlFile(primaryPath);\n\n // Load additional repo issues from config.yaml\n const additionalRepos = getAdditionalRepoPaths(dir);\n for (const repoPath of additionalRepos) {\n const repoJsonl = join(repoPath, \".beads\", \"issues.jsonl\");\n const repoIssues = parseJsonlFile(repoJsonl);\n issues.push(...repoIssues);\n }\n\n // Deduplicate by issue ID (primary repo wins for non-empty fields).\n // When a duplicate is found, merge any empty fields from the duplicate into the first copy.\n // This handles the case where the hub DB lost created_by/owner during import\n // but individual repos have them.\n const seen = new Map<string, BeadIssue>();\n const result: BeadIssue[] = [];\n for (const issue of issues) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((issue as any).status === \"tombstone\") continue;\n const existing = seen.get(issue.id);\n if (existing) {\n // Merge: fill empty fields from duplicate\n if (!existing.created_by && issue.created_by) existing.created_by = issue.created_by;\n if (!existing.owner && issue.owner) existing.owner = issue.owner;\n if (!existing.assignee && issue.assignee) existing.assignee = issue.assignee;\n if (!existing.close_reason && issue.close_reason) existing.close_reason = issue.close_reason;\n if (!existing.acceptance_criteria && issue.acceptance_criteria) existing.acceptance_criteria = issue.acceptance_criteria;\n if (existing.estimated_minutes == null && issue.estimated_minutes != null) existing.estimated_minutes = issue.estimated_minutes;\n if ((!existing.labels || existing.labels.length === 0) && issue.labels && issue.labels.length > 0) existing.labels = issue.labels;\n } else {\n seen.set(issue.id, issue);\n result.push(issue);\n }\n }\n return result;\n}\n\n/**\n * Extract all dependencies from issues (they're embedded in each issue)\n */\nexport function extractDependencies(issues: BeadIssue[]): BeadDependency[] {\n const deps: BeadDependency[] = [];\n const seen = new Set<string>();\n\n for (const issue of issues) {\n if (issue.dependencies) {\n for (const dep of issue.dependencies) {\n const key = `${dep.issue_id}->${dep.depends_on_id}:${dep.type}`;\n if (!seen.has(key)) {\n seen.add(key);\n deps.push(dep);\n }\n }\n }\n }\n\n return deps;\n}\n\n/**\n * Build graph data from issues and dependencies\n */\nexport function buildGraphData(\n issues: BeadIssue[],\n dependencies: BeadDependency[]\n): GraphData {\n const issueMap = new Map(issues.map((i) => [i.id, i]));\n\n // Count blockers and dependents for each issue\n const blockerCounts = new Map<string, string[]>(); // issue -> issues it blocks\n const dependentCounts = new Map<string, string[]>(); // issue -> issues that block it\n\n for (const dep of dependencies) {\n if (dep.type === \"blocks\" || dep.type === \"parent-child\") {\n // For blocks: depends_on_id blocks issue_id\n // For parent-child: depends_on_id is parent of issue_id\n // Both count as connections for node sizing\n if (!blockerCounts.has(dep.depends_on_id)) {\n blockerCounts.set(dep.depends_on_id, []);\n }\n blockerCounts.get(dep.depends_on_id)!.push(dep.issue_id);\n\n if (!dependentCounts.has(dep.issue_id)) {\n dependentCounts.set(dep.issue_id, []);\n }\n dependentCounts.get(dep.issue_id)!.push(dep.depends_on_id);\n }\n }\n\n const nodes: GraphNode[] = issues.map((issue) => ({\n id: issue.id,\n title: issue.title,\n description: issue.description,\n status: issue.status,\n priority: issue.priority,\n issueType: issue.issue_type,\n owner: issue.owner,\n assignee: issue.assignee,\n createdBy: issue.created_by,\n createdAt: issue.created_at,\n updatedAt: issue.updated_at,\n closedAt: issue.closed_at,\n closeReason: issue.close_reason,\n acceptanceCriteria: issue.acceptance_criteria,\n estimatedMinutes: issue.estimated_minutes,\n prefix: extractPrefix(issue.id),\n labels: issue.labels || [],\n\n blockerCount: blockerCounts.get(issue.id)?.length || 0,\n dependentCount: dependentCounts.get(issue.id)?.length || 0,\n blockerIds: blockerCounts.get(issue.id) || [],\n dependentIds: dependentCounts.get(issue.id) || [],\n }));\n\n // Build links: include blocking AND parent-child dependencies where both nodes exist\n const links: GraphLink[] = dependencies\n .filter(\n (d) =>\n (d.type === \"blocks\" || d.type === \"parent-child\") &&\n issueMap.has(d.issue_id) &&\n issueMap.has(d.depends_on_id)\n )\n .map((d) => ({\n // For both types: depends_on_id is the \"upstream\" node (blocker or parent)\n // blocks: blocker -> blocked\n // parent-child: parent -> child\n source: d.depends_on_id,\n target: d.issue_id,\n type: d.type,\n createdAt: d.created_at,\n }));\n\n return { nodes, links };\n}\n\n/**\n * Compute stats from issues and dependencies\n */\nexport function computeStats(\n issues: BeadIssue[],\n dependencies: BeadDependency[],\n graphData: GraphData\n) {\n const prefixes = [...new Set(issues.map((i) => extractPrefix(i.id)))];\n\n // An issue is \"actionable\" if it's open and has no open blockers\n const openIssueIds = new Set(\n issues.filter((i) => i.status !== \"closed\").map((i) => i.id)\n );\n\n const blockedByOpen = new Set<string>();\n for (const dep of dependencies) {\n if (dep.type === \"blocks\" && openIssueIds.has(dep.depends_on_id)) {\n // issue_id is blocked by depends_on_id which is still open\n blockedByOpen.add(dep.issue_id);\n }\n }\n\n const actionable = issues.filter(\n (i) =>\n (i.status === \"open\" || i.status === \"in_progress\") &&\n !blockedByOpen.has(i.id)\n ).length;\n\n return {\n total: issues.length,\n open: issues.filter((i) => i.status === \"open\").length,\n inProgress: issues.filter((i) => i.status === \"in_progress\").length,\n blocked: issues.filter((i) => i.status === \"blocked\").length,\n closed: issues.filter((i) => i.status === \"closed\").length,\n actionable,\n edges: graphData.links.length,\n prefixes,\n };\n}\n\n/**\n * Full pipeline: parse, extract, build, compute\n */\nexport function loadBeadsData(beadsDir?: string): BeadsApiResponse {\n const issues = parseIssuesJsonl(beadsDir);\n const dependencies = extractDependencies(issues);\n const graphData = buildGraphData(issues, dependencies);\n const stats = computeStats(issues, dependencies, graphData);\n\n return { issues, dependencies, graphData, stats };\n}\n","/**\n * Shared comment-fetching logic for beads.\n *\n * Fetches comments and likes from the Hypergoat GraphQL indexer,\n * resolves Bluesky profiles, builds threaded comment trees, and\n * detects claim info. Used by both the React hook (useBeadsComments)\n * and the public API routes (/api/v1/*).\n */\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface BeadsLike {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n createdAt: string;\n uri: string; // AT-URI of the like record\n rkey: string;\n}\n\nexport interface BeadsComment {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n text: string;\n createdAt: string;\n uri: string; // AT-URI of the comment record\n rkey: string;\n nodeId: string; // The beads issue ID this comment targets\n replyTo?: string; // AT-URI of parent comment (for threading)\n likes: BeadsLike[]; // Likes on this comment\n replies: BeadsComment[]; // Nested child comments (built during assembly)\n}\n\nexport interface ClaimInfo {\n handle: string;\n did: string;\n displayName?: string;\n avatar?: string;\n claimedAt: string;\n}\n\nexport interface FetchCommentsResult {\n /** Map from node ID -> threaded comment trees (root comments with nested replies) */\n commentsByNode: Map<string, BeadsComment[]>;\n /** Map from node ID -> total comment count (including replies) */\n commentedNodeIds: Map<string, number>;\n /** Flat list of ALL comments (including replies), newest-first */\n allComments: BeadsComment[];\n}\n\n// ============================================================================\n// Profile resolution (cached, deduplicated)\n// ============================================================================\n\ninterface ResolvedProfile {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n}\n\nconst profileCache = new Map<string, ResolvedProfile>();\nconst profileInflight = new Map<string, Promise<ResolvedProfile>>();\n\nasync function resolveProfile(did: string): Promise<ResolvedProfile> {\n const cached = profileCache.get(did);\n if (cached) return cached;\n\n const inflight = profileInflight.get(did);\n if (inflight) return inflight;\n\n const promise = (async () => {\n try {\n const res = await fetch(\n `https://public.api.bsky.app/xrpc/app.bsky.actor.getProfile?actor=${encodeURIComponent(did)}`\n );\n if (!res.ok) throw new Error(`Profile fetch failed: ${res.status}`);\n const data = await res.json();\n const profile: ResolvedProfile = {\n did,\n handle: data.handle || did,\n displayName: data.displayName || undefined,\n avatar: data.avatar || undefined,\n };\n profileCache.set(did, profile);\n return profile;\n } catch {\n // Fallback: use DID as handle\n const fallback: ResolvedProfile = {\n did,\n handle: did.slice(0, 20) + \"...\",\n };\n profileCache.set(did, fallback);\n return fallback;\n } finally {\n profileInflight.delete(did);\n }\n })();\n\n profileInflight.set(did, promise);\n return promise;\n}\n\n// ============================================================================\n// Hypergoat GraphQL fetching\n// ============================================================================\n\nconst INDEXER_URL =\n process.env.INDEXER_URL ||\n \"https://hypergoat-app-production.up.railway.app/graphql\";\n\nconst FETCH_RECORDS_QUERY = `\n query FetchRecords($collection: String!, $first: Int, $after: String) {\n records(collection: $collection, first: $first, after: $after) {\n edges {\n node {\n cid\n collection\n did\n rkey\n uri\n value\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n`;\n\ninterface IndexerRecord {\n cid: string;\n collection: string;\n did: string;\n rkey: string;\n uri: string;\n value: Record<string, unknown>;\n}\n\ninterface IndexerResponse {\n data?: {\n records?: {\n edges: Array<{ node: IndexerRecord }>;\n pageInfo: { hasNextPage: boolean; endCursor?: string };\n };\n };\n errors?: Array<{ message: string }>;\n}\n\nasync function fetchRecordsByCollection(\n collection: string\n): Promise<IndexerRecord[]> {\n const allRecords: IndexerRecord[] = [];\n let cursor: string | undefined;\n let hasMore = true;\n let pages = 0;\n const MAX_PAGES = 5; // Safety limit\n\n while (hasMore && pages < MAX_PAGES) {\n const res = await fetch(INDEXER_URL, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n query: FETCH_RECORDS_QUERY,\n variables: {\n collection,\n first: 100,\n after: cursor,\n },\n }),\n });\n\n if (!res.ok) {\n throw new Error(`Indexer fetch failed: ${res.status}`);\n }\n\n const json: IndexerResponse = await res.json();\n\n if (json.errors?.length) {\n throw new Error(json.errors[0].message);\n }\n\n const records = json.data?.records;\n if (!records) break;\n\n for (const edge of records.edges) {\n allRecords.push(edge.node);\n }\n\n hasMore = records.pageInfo.hasNextPage;\n cursor = records.pageInfo.endCursor;\n pages++;\n }\n\n return allRecords;\n}\n\n// ============================================================================\n// Core: fetch and process comments\n// ============================================================================\n\n/**\n * Fetch all beads comments and likes from Hypergoat, resolve profiles,\n * build threaded trees, and group by node.\n *\n * This is the pure data-fetching function used by both:\n * - `hooks/useBeadsComments.ts` (client-side React hook)\n * - `app/api/v1/*` routes (server-side API)\n */\nexport async function fetchBeadsComments(): Promise<FetchCommentsResult> {\n // 1. Fetch comments and likes in parallel from Hypergoat\n const [commentRecords, likeRecords] = await Promise.all([\n fetchRecordsByCollection(\"org.impactindexer.review.comment\"),\n fetchRecordsByCollection(\"org.impactindexer.review.like\"),\n ]);\n\n // 2. Filter to only beads-targeted comments\n const beadsCommentRecords = commentRecords.filter((r) => {\n const value = r.value as Record<string, unknown>;\n const subject = value.subject as\n | { uri?: string; type?: string }\n | undefined;\n return (\n subject?.uri &&\n typeof subject.uri === \"string\" &&\n subject.uri.startsWith(\"beads:\")\n );\n });\n\n // 3. Build likes-by-comment-URI map\n const likesByCommentUri = new Map<string, IndexerRecord[]>();\n for (const likeRecord of likeRecords) {\n const value = likeRecord.value as Record<string, unknown>;\n const subject = value.subject as\n | { uri?: string; type?: string }\n | undefined;\n if (\n subject?.uri &&\n typeof subject.uri === \"string\" &&\n subject.uri.startsWith(\"at://\")\n ) {\n const existing = likesByCommentUri.get(subject.uri) || [];\n existing.push(likeRecord);\n likesByCommentUri.set(subject.uri, existing);\n }\n }\n\n // 4. Resolve profiles for all unique DIDs (commenters + likers)\n const allDids = new Set<string>();\n for (const r of beadsCommentRecords) allDids.add(r.did);\n for (const r of likeRecords) allDids.add(r.did);\n\n const profiles = await Promise.all(\n [...allDids].map((did) => resolveProfile(did))\n );\n const profileMap = new Map(profiles.map((p) => [p.did, p]));\n\n // 5. Build flat comment list with likes attached\n const allFlat: BeadsComment[] = [];\n\n for (const record of beadsCommentRecords) {\n const value = record.value as Record<string, unknown>;\n const subject = value.subject as { uri: string };\n const nodeId = subject.uri.replace(/^beads:/, \"\");\n const text = (value.text as string) || \"\";\n const createdAt = (value.createdAt as string) || \"\";\n const replyTo = (value.replyTo as string) || undefined;\n const profile = profileMap.get(record.did);\n\n // Build likes for this comment\n const likeRecordsForComment =\n likesByCommentUri.get(record.uri) || [];\n const likes: BeadsLike[] = likeRecordsForComment.map((lr) => {\n const lp = profileMap.get(lr.did);\n const lv = lr.value as Record<string, unknown>;\n return {\n did: lr.did,\n handle: lp?.handle || lr.did.slice(0, 20) + \"...\",\n displayName: lp?.displayName,\n avatar: lp?.avatar,\n createdAt: (lv.createdAt as string) || \"\",\n uri: lr.uri,\n rkey: lr.rkey,\n };\n });\n\n const comment: BeadsComment = {\n did: record.did,\n handle: profile?.handle || record.did.slice(0, 20) + \"...\",\n displayName: profile?.displayName,\n avatar: profile?.avatar,\n text,\n createdAt,\n uri: record.uri,\n rkey: record.rkey,\n nodeId,\n replyTo,\n likes,\n replies: [], // Will be filled during tree assembly\n };\n\n allFlat.push(comment);\n }\n\n // 6. Build thread trees grouped by node\n\n // Index all comments by URI for tree assembly\n const commentByUri = new Map<string, BeadsComment>();\n for (const comment of allFlat) {\n commentByUri.set(comment.uri, comment);\n }\n\n // Assemble threads: attach replies to parents\n const rootComments: BeadsComment[] = [];\n for (const comment of allFlat) {\n if (comment.replyTo) {\n const parent = commentByUri.get(comment.replyTo);\n if (parent) {\n parent.replies.push(comment);\n continue; // Don't add as root\n }\n // Parent not found — treat as root comment\n }\n rootComments.push(comment);\n }\n\n // Sort: root comments newest-first, replies oldest-first (chronological)\n rootComments.sort(\n (a, b) =>\n new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()\n );\n\n function sortRepliesRecursive(comments: BeadsComment[]) {\n for (const c of comments) {\n c.replies.sort(\n (a, b) =>\n new Date(a.createdAt).getTime() -\n new Date(b.createdAt).getTime()\n );\n sortRepliesRecursive(c.replies);\n }\n }\n sortRepliesRecursive(rootComments);\n\n // Group root comments by nodeId\n const commentsByNode = new Map<string, BeadsComment[]>();\n for (const comment of rootComments) {\n const existing = commentsByNode.get(comment.nodeId) || [];\n existing.push(comment);\n commentsByNode.set(comment.nodeId, existing);\n }\n\n // 7. Build counts (total comments including replies per node)\n const commentedNodeIds = new Map<string, number>();\n for (const comment of allFlat) {\n commentedNodeIds.set(\n comment.nodeId,\n (commentedNodeIds.get(comment.nodeId) || 0) + 1\n );\n }\n\n // 8. Build allComments flat list (newest-first)\n const allComments = [...allFlat].sort(\n (a, b) =>\n new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()\n );\n\n return { commentsByNode, commentedNodeIds, allComments };\n}\n\n// ============================================================================\n// Claim detection\n// ============================================================================\n\n/**\n * Extract claim info from comments.\n * A claim comment has text starting with \"@\" and no spaces (e.g. \"@alice.bsky.social\").\n * First claim per node wins.\n */\nexport function getClaimedNodes(\n allComments: BeadsComment[]\n): Map<string, ClaimInfo> {\n const claims = new Map<string, ClaimInfo>();\n\n // Sort oldest-first so the first claim wins\n const sorted = [...allComments].sort(\n (a, b) =>\n new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()\n );\n\n for (const comment of sorted) {\n if (claims.has(comment.nodeId)) continue;\n\n const text = comment.text.trim();\n if (text.startsWith(\"@\") && text.indexOf(\" \") === -1) {\n claims.set(comment.nodeId, {\n handle: comment.handle,\n did: comment.did,\n displayName: comment.displayName,\n avatar: comment.avatar,\n claimedAt: comment.createdAt,\n });\n }\n }\n\n return claims;\n}\n","/**\n * Shared helpers for /api/v1/* routes.\n * Provides CORS headers, JSON response builders, and OPTIONS handler.\n */\n\nimport { NextResponse } from \"next/server\";\n\nconst CORS_HEADERS = {\n \"Access-Control-Allow-Origin\": \"*\",\n \"Access-Control-Allow-Methods\": \"GET, OPTIONS\",\n \"Access-Control-Allow-Headers\": \"Content-Type\",\n};\n\n/**\n * Build a JSON response with CORS and Cache-Control headers.\n */\nexport function jsonResponse(data: unknown, status = 200) {\n return NextResponse.json(data, {\n status,\n headers: {\n ...CORS_HEADERS,\n \"Cache-Control\": \"public, max-age=30\",\n },\n });\n}\n\n/**\n * Build an error JSON response with CORS headers (no caching).\n */\nexport function errorResponse(\n error: string,\n status: number,\n hint?: string\n) {\n return NextResponse.json(\n { error, ...(hint ? { hint } : {}) },\n { status, headers: CORS_HEADERS }\n );\n}\n\n/**\n * Preflight OPTIONS handler for CORS. Re-export from each route file.\n */\nexport function OPTIONS() {\n return new NextResponse(null, { status: 204, headers: CORS_HEADERS });\n}\n"],"names":[],"mappings":"8iCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAaO,SAAS,EAAc,CAAU,EACtC,IAAM,EAAW,EAAG,WAAW,CAAC,YAChC,AAAI,AAAa,CAAC,GAAG,GAAO,EACrB,EAAG,SAAS,CAAC,EAAG,EACzB,CAKO,SAAS,EAAuB,CAAgB,EACrD,IAAM,EAAa,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,EAAU,eAClC,GAAI,CACF,IAAM,EAAU,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAY,SACnC,EAAS,CAAA,EAAA,EAAA,KAAA,AAAS,EAAC,GACnB,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AAE,EAAS,GAAG,EACtD,OAAO,EAAA,YAAY,CAAC,IAAI,CAAC,EAAM,QAC7B,EACA,QAAS,CACP,GAAG,CAAY,CACf,gBAAiB,oBACnB,CACF,EACF,CAKO,SAAS,EACd,CAAa,CACb,CAAc,CACd,CAAa,EAEb,OAAO,EAAA,YAAY,CAAC,IAAI,CACtB,OAAE,EAAO,GAAI,EAAO,MAAE,CAAK,EAAI,CAAC,CAAC,AAAE,EACnC,CAAE,SAAQ,QAAS,CAAa,EAEpC,CAKO,SAAS,IACd,OAAO,IAAI,EAAA,YAAY,CAAC,KAAM,CAAE,OAAQ,IAAK,QAAS,CAAa,EACrE"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[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"))},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"))},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"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},48676,e=>{"use strict";var t=e.i(22734),r=e.i(14747),n=e.i(24863),a=e.i(63846);function s(e){let t=e.lastIndexOf("-");return -1===t?e:e.substring(0,t)}function i(e){let a=(0,r.join)(e,"config.yaml");try{let s=(0,t.readFileSync)(a,"utf-8"),i=(0,n.parse)(s),o=i?.repos?.additional;if(Array.isArray(o))return o.map(t=>(0,r.resolve)(e,"..",t)).filter(e=>(0,t.existsSync)((0,r.join)(e,".beads","issues.jsonl")))}catch(e){console.error("Failed to read config.yaml:",e)}return[]}function o(e){let r;try{r=(0,t.readFileSync)(e,"utf-8")}catch(t){return console.error(`Failed to read ${e}:`,t),[]}let n=r.split("\n").filter(e=>e.trim().length>0),a=[];for(let t=0;t<n.length;t++)try{a.push(JSON.parse(n[t]))}catch(r){console.warn(`Skipping malformed line ${t+1} in ${e}:`,r)}return a}function d(e){let t=function(e){let t=e||(0,a.discoverBeadsDir)().beadsDir,n=o((0,r.join)(t,"issues.jsonl"));for(let e of i(t)){let t=o((0,r.join)(e,".beads","issues.jsonl"));n.push(...t)}let s=new Set;return n.filter(e=>!s.has(e.id)&&(s.add(e.id),"tombstone"!==e.status))}(e),n=function(e){let t=[],r=new Set;for(let n of e)if(n.dependencies)for(let e of n.dependencies){let n=`${e.issue_id}->${e.depends_on_id}:${e.type}`;r.has(n)||(r.add(n),t.push(e))}return t}(t),d=function(e,t){let r=new Map(e.map(e=>[e.id,e])),n=new Map,a=new Map;for(let e of t)("blocks"===e.type||"parent-child"===e.type)&&(n.has(e.depends_on_id)||n.set(e.depends_on_id,[]),n.get(e.depends_on_id).push(e.issue_id),a.has(e.issue_id)||a.set(e.issue_id,[]),a.get(e.issue_id).push(e.depends_on_id));return{nodes:e.map(e=>({id:e.id,title:e.title,description:e.description,status:e.status,priority:e.priority,issueType:e.issue_type,owner:e.owner,assignee:e.assignee,createdBy:e.created_by,createdAt:e.created_at,updatedAt:e.updated_at,closedAt:e.closed_at,closeReason:e.close_reason,acceptanceCriteria:e.acceptance_criteria,estimatedMinutes:e.estimated_minutes,prefix:s(e.id),labels:e.labels||[],blockerCount:n.get(e.id)?.length||0,dependentCount:a.get(e.id)?.length||0,blockerIds:n.get(e.id)||[],dependentIds:a.get(e.id)||[]})),links:t.filter(e=>("blocks"===e.type||"parent-child"===e.type)&&r.has(e.issue_id)&&r.has(e.depends_on_id)).map(e=>({source:e.depends_on_id,target:e.issue_id,type:e.type,createdAt:e.created_at}))}}(t,n),l=function(e,t,r){let n=[...new Set(e.map(e=>s(e.id)))],a=new Set(e.filter(e=>"closed"!==e.status).map(e=>e.id)),i=new Set;for(let e of t)"blocks"===e.type&&a.has(e.depends_on_id)&&i.add(e.issue_id);let o=e.filter(e=>("open"===e.status||"in_progress"===e.status)&&!i.has(e.id)).length;return{total:e.length,open:e.filter(e=>"open"===e.status).length,inProgress:e.filter(e=>"in_progress"===e.status).length,blocked:e.filter(e=>"blocked"===e.status).length,closed:e.filter(e=>"closed"===e.status).length,actionable:o,edges:r.links.length,prefixes:n}}(t,n,d);return{issues:t,dependencies:n,graphData:d,stats:l}}e.s(["getAdditionalRepoPaths",()=>i,"loadBeadsData",()=>d])},63450,e=>{"use strict";var t=e.i(39776),r=e.i(76160),n=e.i(74151),a=e.i(8392),s=e.i(27644),i=e.i(15766),o=e.i(18404),d=e.i(68924),l=e.i(9942),u=e.i(77753),p=e.i(45771),c=e.i(31838),h=e.i(89953),f=e.i(17045),g=e.i(21874),x=e.i(93695);e.i(86257);var y=e.i(87875),R=e.i(69817),m=e.i(48676),v=e.i(63846);async function _(){try{let{beadsDir:e}=(0,v.discoverBeadsDir)(),t=(0,m.loadBeadsData)(e);return R.NextResponse.json(t)}catch(e){if(e?.message?.includes("No .beads/ directory found"))return R.NextResponse.json({error:"No .beads directory found",hint:"Run bd init in your project, then start heartbeads from that directory"},{status:404});return console.error("Failed to load beads data:",e),R.NextResponse.json({error:"Failed to load beads data"},{status:500})}}e.s(["GET",()=>_],57197);var b=e.i(57197);let w=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/beads/route",pathname:"/api/beads",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/beads/route.ts",nextConfigOutput:"",userland:b}),{workAsyncStorage:E,workUnitAsyncStorage:C,serverHooks:A}=w;function k(){return(0,n.patchFetch)({workAsyncStorage:E,workUnitAsyncStorage:C})}async function N(e,t,n){w.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let R="/api/beads/route";R=R.replace(/\/index$/,"")||"/";let m=await w.prepare(e,t,{srcPage:R,multiZoneDraftMode:!1});if(!m)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:v,params:_,nextConfig:b,parsedUrl:E,isDraftMode:C,prerenderManifest:A,routerServerContext:k,isOnDemandRevalidate:N,revalidateOnlyGenerated:S,resolvedPathname:j,clientReferenceManifest:T,serverActionsManifest:P}=m,O=(0,o.normalizeAppPath)(R),q=!!(A.dynamicRoutes[O]||A.routes[j]),D=async()=>((null==k?void 0:k.render404)?await k.render404(e,t,E,!1):t.end("This page could not be found"),null);if(q&&!C){let e=!!A.routes[j],t=A.dynamicRoutes[O];if(t&&!1===t.fallback&&!e){if(b.experimental.adapterPath)return await D();throw new x.NoFallbackError}}let I=null;!q||w.isDev||C||(I="/index"===(I=j)?"/":I);let H=!0===w.isDev||!q,M=q&&!H;P&&T&&(0,i.setManifestsSingleton)({page:R,clientReferenceManifest:T,serverActionsManifest:P});let U=e.method||"GET",$=(0,s.getTracer)(),F=$.getActiveScopeSpan(),B={params:_,prerenderManifest:A,renderOpts:{experimental:{authInterrupts:!!b.experimental.authInterrupts},cacheComponents:!!b.cacheComponents,supportsDynamicResponse:H,incrementalCache:(0,a.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:b.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>w.onRequestError(e,t,n,a,k)},sharedContext:{buildId:v}},K=new d.NodeNextRequest(e),L=new d.NodeNextResponse(t),G=l.NextRequestAdapter.fromNodeNextRequest(K,(0,l.signalFromNodeResponse)(t));try{let i=async e=>w.handle(G,B).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.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=`${U} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${U} ${R}`)}),o=!!(0,a.getRequestMeta)(e,"minimalMode"),d=async a=>{var s,d;let l=async({previousCacheEntry:r})=>{try{if(!o&&N&&S&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(a);e.fetchMetrics=B.renderOpts.fetchMetrics;let d=B.renderOpts.pendingWaitUntil;d&&n.waitUntil&&(n.waitUntil(d),d=void 0);let l=B.renderOpts.collectedTags;if(!q)return await (0,c.sendResponse)(K,L,s,B.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[g.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==B.renderOpts.collectedRevalidate&&!(B.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,n=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=g.INFINITE_CACHE?void 0:B.renderOpts.collectedExpire;return{value:{kind:y.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await w.onRequestError(e,t,{routerKind:"App Router",routePath:R,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:N})},!1,k),t}},u=await w.handleResponse({req:e,nextConfig:b,cacheKey:I,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:S,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:o});if(!q)return null;if((null==u||null==(s=u.value)?void 0:s.kind)!==y.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(d=u.value)?void 0:d.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});o||t.setHeader("x-nextjs-cache",N?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let x=(0,h.fromNodeOutgoingHttpHeaders)(u.value.headers);return o&&q||x.delete(g.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||x.get("Cache-Control")||x.set("Cache-Control",(0,f.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(K,L,new Response(u.value.body,{headers:x,status:u.value.status||200})),null};F?await d(F):await $.withPropagatedContext(e.headers,()=>$.trace(u.BaseServerSpan.handleRequest,{spanName:`${U} ${R}`,kind:s.SpanKind.SERVER,attributes:{"http.method":U,"http.target":e.url}},d))}catch(t){if(t instanceof x.NoFallbackError||await w.onRequestError(e,t,{routerKind:"App Router",routePath:O,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:N})},!1,k),q)throw t;return await (0,c.sendResponse)(K,L,new Response(null,{status:500})),null}}e.s(["handler",()=>N,"patchFetch",()=>k,"routeModule",()=>w,"serverHooks",()=>A,"workAsyncStorage",()=>E,"workUnitAsyncStorage",()=>C],63450)}];
|
|
1
|
+
module.exports=[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"))},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"))},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"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},48676,e=>{"use strict";var t=e.i(22734),r=e.i(14747),a=e.i(24863),n=e.i(63846);function s(e){let t=e.lastIndexOf("-");return -1===t?e:e.substring(0,t)}function i(e){let n=(0,r.join)(e,"config.yaml");try{let s=(0,t.readFileSync)(n,"utf-8"),i=(0,a.parse)(s),o=i?.repos?.additional;if(Array.isArray(o))return o.map(t=>(0,r.resolve)(e,"..",t)).filter(e=>(0,t.existsSync)((0,r.join)(e,".beads","issues.jsonl")))}catch(e){console.error("Failed to read config.yaml:",e)}return[]}function o(e){let r;try{r=(0,t.readFileSync)(e,"utf-8")}catch(t){return console.error(`Failed to read ${e}:`,t),[]}let a=r.split("\n").filter(e=>e.trim().length>0),n=[];for(let t=0;t<a.length;t++)try{n.push(JSON.parse(a[t]))}catch(r){console.warn(`Skipping malformed line ${t+1} in ${e}:`,r)}return n}function l(e){let t=function(e){let t=e||(0,n.discoverBeadsDir)().beadsDir,a=o((0,r.join)(t,"issues.jsonl"));for(let e of i(t)){let t=o((0,r.join)(e,".beads","issues.jsonl"));a.push(...t)}let s=new Map,l=[];for(let e of a){if("tombstone"===e.status)continue;let t=s.get(e.id);t?(!t.created_by&&e.created_by&&(t.created_by=e.created_by),!t.owner&&e.owner&&(t.owner=e.owner),!t.assignee&&e.assignee&&(t.assignee=e.assignee),!t.close_reason&&e.close_reason&&(t.close_reason=e.close_reason),!t.acceptance_criteria&&e.acceptance_criteria&&(t.acceptance_criteria=e.acceptance_criteria),null==t.estimated_minutes&&null!=e.estimated_minutes&&(t.estimated_minutes=e.estimated_minutes),(!t.labels||0===t.labels.length)&&e.labels&&e.labels.length>0&&(t.labels=e.labels)):(s.set(e.id,e),l.push(e))}return l}(e),a=function(e){let t=[],r=new Set;for(let a of e)if(a.dependencies)for(let e of a.dependencies){let a=`${e.issue_id}->${e.depends_on_id}:${e.type}`;r.has(a)||(r.add(a),t.push(e))}return t}(t),l=function(e,t){let r=new Map(e.map(e=>[e.id,e])),a=new Map,n=new Map;for(let e of t)("blocks"===e.type||"parent-child"===e.type)&&(a.has(e.depends_on_id)||a.set(e.depends_on_id,[]),a.get(e.depends_on_id).push(e.issue_id),n.has(e.issue_id)||n.set(e.issue_id,[]),n.get(e.issue_id).push(e.depends_on_id));return{nodes:e.map(e=>({id:e.id,title:e.title,description:e.description,status:e.status,priority:e.priority,issueType:e.issue_type,owner:e.owner,assignee:e.assignee,createdBy:e.created_by,createdAt:e.created_at,updatedAt:e.updated_at,closedAt:e.closed_at,closeReason:e.close_reason,acceptanceCriteria:e.acceptance_criteria,estimatedMinutes:e.estimated_minutes,prefix:s(e.id),labels:e.labels||[],blockerCount:a.get(e.id)?.length||0,dependentCount:n.get(e.id)?.length||0,blockerIds:a.get(e.id)||[],dependentIds:n.get(e.id)||[]})),links:t.filter(e=>("blocks"===e.type||"parent-child"===e.type)&&r.has(e.issue_id)&&r.has(e.depends_on_id)).map(e=>({source:e.depends_on_id,target:e.issue_id,type:e.type,createdAt:e.created_at}))}}(t,a),d=function(e,t,r){let a=[...new Set(e.map(e=>s(e.id)))],n=new Set(e.filter(e=>"closed"!==e.status).map(e=>e.id)),i=new Set;for(let e of t)"blocks"===e.type&&n.has(e.depends_on_id)&&i.add(e.issue_id);let o=e.filter(e=>("open"===e.status||"in_progress"===e.status)&&!i.has(e.id)).length;return{total:e.length,open:e.filter(e=>"open"===e.status).length,inProgress:e.filter(e=>"in_progress"===e.status).length,blocked:e.filter(e=>"blocked"===e.status).length,closed:e.filter(e=>"closed"===e.status).length,actionable:o,edges:r.links.length,prefixes:a}}(t,a,l);return{issues:t,dependencies:a,graphData:l,stats:d}}e.s(["getAdditionalRepoPaths",()=>i,"loadBeadsData",()=>l])},63450,e=>{"use strict";var t=e.i(39776),r=e.i(76160),a=e.i(74151),n=e.i(8392),s=e.i(27644),i=e.i(15766),o=e.i(18404),l=e.i(68924),d=e.i(9942),u=e.i(77753),c=e.i(45771),p=e.i(31838),h=e.i(89953),f=e.i(17045),g=e.i(21874),x=e.i(93695);e.i(86257);var _=e.i(87875),y=e.i(69817),m=e.i(48676),R=e.i(63846);async function b(){try{let{beadsDir:e}=(0,R.discoverBeadsDir)(),t=(0,m.loadBeadsData)(e);return y.NextResponse.json(t)}catch(e){if(e?.message?.includes("No .beads/ directory found"))return y.NextResponse.json({error:"No .beads directory found",hint:"Run bd init in your project, then start heartbeads from that directory"},{status:404});return console.error("Failed to load beads data:",e),y.NextResponse.json({error:"Failed to load beads data"},{status:500})}}e.s(["GET",()=>b],57197);var v=e.i(57197);let w=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/beads/route",pathname:"/api/beads",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/beads/route.ts",nextConfigOutput:"",userland:v}),{workAsyncStorage:E,workUnitAsyncStorage:C,serverHooks:A}=w;function k(){return(0,a.patchFetch)({workAsyncStorage:E,workUnitAsyncStorage:C})}async function N(e,t,a){w.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let y="/api/beads/route";y=y.replace(/\/index$/,"")||"/";let m=await w.prepare(e,t,{srcPage:y,multiZoneDraftMode:!1});if(!m)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:R,params:b,nextConfig:v,parsedUrl:E,isDraftMode:C,prerenderManifest:A,routerServerContext:k,isOnDemandRevalidate:N,revalidateOnlyGenerated:j,resolvedPathname:S,clientReferenceManifest:T,serverActionsManifest:P}=m,O=(0,o.normalizeAppPath)(y),q=!!(A.dynamicRoutes[O]||A.routes[S]),D=async()=>((null==k?void 0:k.render404)?await k.render404(e,t,E,!1):t.end("This page could not be found"),null);if(q&&!C){let e=!!A.routes[S],t=A.dynamicRoutes[O];if(t&&!1===t.fallback&&!e){if(v.experimental.adapterPath)return await D();throw new x.NoFallbackError}}let I=null;!q||w.isDev||C||(I="/index"===(I=S)?"/":I);let H=!0===w.isDev||!q,M=q&&!H;P&&T&&(0,i.setManifestsSingleton)({page:y,clientReferenceManifest:T,serverActionsManifest:P});let U=e.method||"GET",$=(0,s.getTracer)(),F=$.getActiveScopeSpan(),B={params:b,prerenderManifest:A,renderOpts:{experimental:{authInterrupts:!!v.experimental.authInterrupts},cacheComponents:!!v.cacheComponents,supportsDynamicResponse:H,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:v.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>w.onRequestError(e,t,a,n,k)},sharedContext:{buildId:R}},K=new l.NodeNextRequest(e),L=new l.NodeNextResponse(t),G=d.NextRequestAdapter.fromNodeNextRequest(K,(0,d.signalFromNodeResponse)(t));try{let i=async e=>w.handle(G,B).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.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=`${U} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${U} ${y}`)}),o=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var s,l;let d=async({previousCacheEntry:r})=>{try{if(!o&&N&&j&&!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=B.renderOpts.fetchMetrics;let l=B.renderOpts.pendingWaitUntil;l&&a.waitUntil&&(a.waitUntil(l),l=void 0);let d=B.renderOpts.collectedTags;if(!q)return await (0,p.sendResponse)(K,L,s,B.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);d&&(t[g.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==B.renderOpts.collectedRevalidate&&!(B.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,a=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=g.INFINITE_CACHE?void 0:B.renderOpts.collectedExpire;return{value:{kind:_.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 w.onRequestError(e,t,{routerKind:"App Router",routePath:y,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:N})},!1,k),t}},u=await w.handleResponse({req:e,nextConfig:v,cacheKey:I,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:j,responseGenerator:d,waitUntil:a.waitUntil,isMinimalMode:o});if(!q)return null;if((null==u||null==(s=u.value)?void 0:s.kind)!==_.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});o||t.setHeader("x-nextjs-cache",N?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let x=(0,h.fromNodeOutgoingHttpHeaders)(u.value.headers);return o&&q||x.delete(g.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||x.get("Cache-Control")||x.set("Cache-Control",(0,f.getCacheControlHeader)(u.cacheControl)),await (0,p.sendResponse)(K,L,new Response(u.value.body,{headers:x,status:u.value.status||200})),null};F?await l(F):await $.withPropagatedContext(e.headers,()=>$.trace(u.BaseServerSpan.handleRequest,{spanName:`${U} ${y}`,kind:s.SpanKind.SERVER,attributes:{"http.method":U,"http.target":e.url}},l))}catch(t){if(t instanceof x.NoFallbackError||await w.onRequestError(e,t,{routerKind:"App Router",routePath:O,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:N})},!1,k),q)throw t;return await (0,p.sendResponse)(K,L,new Response(null,{status:500})),null}}e.s(["handler",()=>N,"patchFetch",()=>k,"routeModule",()=>w,"serverHooks",()=>A,"workAsyncStorage",()=>E,"workUnitAsyncStorage",()=>C],63450)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=%5Broot-of-the-server%5D__3cb3ed30._.js.map
|