semantic-atlas 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/.agents/skills/semantic-atlas/SKILL.md +3 -0
  2. package/.agents/skills/semantic-atlas/references/product-feedback.md +34 -0
  3. package/.agents/skills/semantic-atlas-insights/SKILL.md +55 -0
  4. package/README.md +229 -88
  5. package/README.zh-CN.md +204 -85
  6. package/dist/cli/argument-parser.js +9 -1
  7. package/dist/cli/bin.js +17 -2
  8. package/dist/cli/cli-application.d.ts +1 -0
  9. package/dist/cli/cli-application.d.ts.map +1 -1
  10. package/dist/cli/cli-application.js +64 -12
  11. package/dist/cli/insights-cli.d.ts +6 -0
  12. package/dist/cli/insights-cli.d.ts.map +1 -0
  13. package/dist/cli/insights-cli.js +236 -0
  14. package/dist/cli/main.d.ts.map +1 -1
  15. package/dist/cli/main.js +94 -2
  16. package/dist/cli/standalone-cli.d.ts.map +1 -1
  17. package/dist/cli/standalone-cli.js +44 -5
  18. package/dist/cli/types.d.ts +2 -0
  19. package/dist/cli/types.d.ts.map +1 -1
  20. package/dist/cli/web-cli.d.ts +9 -0
  21. package/dist/cli/web-cli.d.ts.map +1 -0
  22. package/dist/cli/web-cli.js +134 -0
  23. package/dist/contracts/cli.d.ts +63 -0
  24. package/dist/contracts/cli.d.ts.map +1 -1
  25. package/dist/contracts/cli.js +7 -0
  26. package/dist/contracts/insights.d.ts +2 -0
  27. package/dist/contracts/insights.d.ts.map +1 -0
  28. package/dist/contracts/insights.js +1 -0
  29. package/dist/contracts/public-contracts.d.ts +1 -0
  30. package/dist/contracts/public-contracts.d.ts.map +1 -1
  31. package/dist/contracts/public-contracts.js +1 -0
  32. package/dist/graph/graph-store.d.ts +2 -2
  33. package/dist/graph/graph-store.d.ts.map +1 -1
  34. package/dist/graph/graph-store.js +2 -2
  35. package/dist/insights/contracts.d.ts +266 -0
  36. package/dist/insights/contracts.d.ts.map +1 -0
  37. package/dist/insights/contracts.js +124 -0
  38. package/dist/insights/insights-store.d.ts +73 -0
  39. package/dist/insights/insights-store.d.ts.map +1 -0
  40. package/dist/insights/insights-store.js +246 -0
  41. package/dist/repository/repository-inspector.d.ts +1 -0
  42. package/dist/repository/repository-inspector.d.ts.map +1 -1
  43. package/dist/repository/repository-inspector.js +13 -0
  44. package/dist/setup/package-upgrader.d.ts +54 -0
  45. package/dist/setup/package-upgrader.d.ts.map +1 -0
  46. package/dist/setup/package-upgrader.js +169 -0
  47. package/dist/setup/skill-installer.d.ts +3 -2
  48. package/dist/setup/skill-installer.d.ts.map +1 -1
  49. package/dist/setup/skill-installer.js +67 -36
  50. package/dist/storage/atlas-database.d.ts +8 -1
  51. package/dist/storage/atlas-database.d.ts.map +1 -1
  52. package/dist/storage/atlas-database.js +68 -11
  53. package/dist/web/application/atlas-read-service.d.ts +27 -0
  54. package/dist/web/application/atlas-read-service.d.ts.map +1 -0
  55. package/dist/web/application/atlas-read-service.js +216 -0
  56. package/dist/web/application/primary-repository-catalog.d.ts +15 -0
  57. package/dist/web/application/primary-repository-catalog.d.ts.map +1 -0
  58. package/dist/web/application/primary-repository-catalog.js +202 -0
  59. package/dist/web/application/types.d.ts +41 -0
  60. package/dist/web/application/types.d.ts.map +1 -0
  61. package/dist/web/application/types.js +1 -0
  62. package/dist/web/server/api-router.d.ts +4 -0
  63. package/dist/web/server/api-router.d.ts.map +1 -0
  64. package/dist/web/server/api-router.js +151 -0
  65. package/dist/web/server/local-web-server.d.ts +12 -0
  66. package/dist/web/server/local-web-server.d.ts.map +1 -0
  67. package/dist/web/server/local-web-server.js +100 -0
  68. package/dist/web-client/assets/index-DneaErDj.css +1 -0
  69. package/dist/web-client/assets/index-cze_4vtt.js +2 -0
  70. package/dist/web-client/assets/index-cze_4vtt.js.map +1 -0
  71. package/dist/web-client/index.html +61 -0
  72. package/dist/world/world-graph-query.d.ts +5 -1
  73. package/dist/world/world-graph-query.d.ts.map +1 -1
  74. package/dist/world/world-graph-query.js +4 -2
  75. package/dist/world/world-snapshot-store.d.ts +2 -1
  76. package/dist/world/world-snapshot-store.d.ts.map +1 -1
  77. package/dist/world/world-snapshot-store.js +2 -2
  78. package/docs/architecture/web-viewer.md +225 -0
  79. package/docs/contracts/cli-v1.md +40 -4
  80. package/docs/contracts/http-api-v1.md +155 -0
  81. package/docs/contracts/insights-v1.md +84 -0
  82. package/docs/index.md +7 -0
  83. package/docs/log.md +103 -0
  84. package/docs/product-contract.md +45 -10
  85. package/package.json +7 -4
  86. package/schemas/cli-envelope-v1.schema.json +85 -1
  87. package/schemas/insights-envelope-v1.schema.json +428 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-cze_4vtt.js","sources":["../../../src/web/client/map-cache.ts","../../../src/web/client/map-layout.ts","../../../src/web/client/map-camera.ts","../../../src/web/client/main.ts"],"sourcesContent":["export function loadCachedValue<Key, Value>(\n values: Map<Key, Value>,\n pending: Map<Key, Promise<Value>>,\n key: Key,\n load: () => Promise<Value>,\n): Promise<Value> {\n const cached = values.get(key);\n if (cached !== undefined) return Promise.resolve(cached);\n\n const inFlight = pending.get(key);\n if (inFlight !== undefined) return inFlight;\n\n const request = load()\n .then((value) => {\n values.set(key, value);\n return value;\n })\n .finally(() => pending.delete(key));\n pending.set(key, request);\n return request;\n}\n","export const BUSINESS_MAP_WORLD = {\n width: 3_000,\n height: 2_200,\n} as const;\n\nexport interface BusinessMapLayoutInput {\n readonly key: string;\n readonly role: \"root\" | \"child\" | \"context\";\n readonly parentKey?: string | undefined;\n}\n\nexport interface BusinessMapLayoutNode {\n readonly key: string;\n readonly x: number;\n readonly y: number;\n readonly ring: number;\n readonly depth: number;\n readonly role: BusinessMapLayoutInput[\"role\"];\n readonly parentKey: string | undefined;\n}\n\nexport interface BusinessMapLayout {\n readonly center: { readonly x: number; readonly y: number };\n readonly nodes: readonly BusinessMapLayoutNode[];\n}\n\nexport function layoutBusinessMap(\n regions: readonly BusinessMapLayoutInput[],\n existingNodes: readonly BusinessMapLayoutNode[] = [],\n): BusinessMapLayout {\n const center = {\n x: BUSINESS_MAP_WORLD.width / 2,\n y: BUSINESS_MAP_WORLD.height / 2,\n };\n const positions = new Map(existingNodes.map((node) => [node.key, node]));\n const pending = regions.filter(({ key }) => !positions.has(key));\n\n while (pending.length > 0) {\n const ready = pending.filter(({ parentKey }) => parentKey === undefined || positions.has(parentKey));\n const next = ready.length > 0 ? ready : pending;\n for (const [parentKey, siblings] of groupByParent(next)) {\n placeSiblings(siblings, parentKey, positions, center);\n }\n for (const { key } of next) removeRegion(pending, key);\n }\n\n return {\n center,\n nodes: regions.map(({ key }) => positions.get(key)!),\n };\n}\n\nfunction placeSiblings(\n siblings: readonly BusinessMapLayoutInput[],\n parentKey: string | undefined,\n positions: Map<string, BusinessMapLayoutNode>,\n center: BusinessMapLayout[\"center\"],\n): void {\n const parent = parentKey === undefined ? undefined : positions.get(parentKey);\n const existingSiblings = [...positions.values()]\n .filter((node) => node.parentKey === parentKey)\n .sort(compareNodes);\n const allSiblings = [...existingSiblings, ...siblings]\n .sort((left, right) => left.key.localeCompare(right.key));\n const root = parent === undefined;\n const parentPosition = parent ?? { x: center.x, y: center.y, depth: 0 };\n const outwardAngle = root\n ? -Math.PI / 2\n : Math.atan2(parentPosition.y - center.y, parentPosition.x - center.x);\n\n for (const region of siblings) {\n const index = allSiblings.findIndex(({ key }) => key === region.key);\n const angle = siblingAngle(outwardAngle, index, allSiblings.length, root);\n const depth = parentPosition.depth + 1;\n const radius = siblingRadius(depth, region.role, root);\n positions.set(region.key, {\n key: region.key,\n x: Math.round(parentPosition.x + Math.cos(angle) * radius.x),\n y: Math.round(parentPosition.y + Math.sin(angle) * radius.y),\n ring: depth + (region.role === \"context\" ? 1 : 0),\n depth,\n role: region.role,\n parentKey,\n });\n }\n}\n\nfunction siblingAngle(\n outwardAngle: number,\n index: number,\n count: number,\n root: boolean,\n): number {\n if (count <= 1) return outwardAngle;\n if (root) return outwardAngle + (Math.PI * 2 * index) / count;\n const span = Math.min(1.7, Math.max(0.85, (count - 1) * 0.46));\n return outwardAngle - span / 2 + (span * index) / (count - 1);\n}\n\nfunction siblingRadius(\n depth: number,\n role: BusinessMapLayoutInput[\"role\"],\n root: boolean,\n): { readonly x: number; readonly y: number } {\n const base = root ? 430 : 320 + Math.min(depth, 4) * 28;\n const contextOffset = role === \"context\" ? 155 : 0;\n return {\n x: base + contextOffset,\n y: Math.round((base + contextOffset) * 0.72),\n };\n}\n\nfunction groupByParent(\n nodes: readonly BusinessMapLayoutInput[],\n): ReadonlyMap<string | undefined, readonly BusinessMapLayoutInput[]> {\n const groups = new Map<string | undefined, BusinessMapLayoutInput[]>();\n for (const node of nodes) {\n const group = groups.get(node.parentKey) ?? [];\n group.push(node);\n groups.set(node.parentKey, group);\n }\n return groups;\n}\n\nfunction removeRegion(regions: BusinessMapLayoutInput[], key: string): void {\n const index = regions.findIndex((region) => region.key === key);\n if (index >= 0) regions.splice(index, 1);\n}\n\nfunction compareNodes(left: BusinessMapLayoutNode, right: BusinessMapLayoutNode): number {\n return left.key.localeCompare(right.key);\n}\n","export const MAP_CAMERA_LIMITS = {\n minScale: 0.2,\n maxScale: 4.8,\n} as const;\n\nexport interface MapCamera {\n readonly scale: number;\n readonly x: number;\n readonly y: number;\n}\n\nexport interface MapPoint {\n readonly x: number;\n readonly y: number;\n}\n\nexport interface MapViewport {\n readonly width: number;\n readonly height: number;\n}\n\nexport interface MapBounds {\n readonly left: number;\n readonly top: number;\n readonly right: number;\n readonly bottom: number;\n}\n\nexport function zoomMapCameraAt(\n camera: MapCamera,\n factor: number,\n pointer: MapPoint,\n): MapCamera {\n const scale = clamp(camera.scale * factor, MAP_CAMERA_LIMITS.minScale, MAP_CAMERA_LIMITS.maxScale);\n const worldX = (pointer.x - camera.x) / camera.scale;\n const worldY = (pointer.y - camera.y) / camera.scale;\n return {\n scale,\n x: pointer.x - worldX * scale,\n y: pointer.y - worldY * scale,\n };\n}\n\nexport function panMapCamera(camera: MapCamera, delta: MapPoint): MapCamera {\n return {\n ...camera,\n x: camera.x + delta.x,\n y: camera.y + delta.y,\n };\n}\n\nexport function fitMapCamera(\n viewport: MapViewport,\n bounds: MapBounds,\n padding = 80,\n): MapCamera {\n const width = Math.max(1, bounds.right - bounds.left);\n const height = Math.max(1, bounds.bottom - bounds.top);\n const scale = clamp(\n Math.min((viewport.width - padding * 2) / width, (viewport.height - padding * 2) / height),\n MAP_CAMERA_LIMITS.minScale,\n MAP_CAMERA_LIMITS.maxScale,\n );\n return {\n scale,\n x: (viewport.width - width * scale) / 2 - bounds.left * scale,\n y: (viewport.height - height * scale) / 2 - bounds.top * scale,\n };\n}\n\nexport function semanticRevealScale(depth: number): number {\n if (depth <= 1) return MAP_CAMERA_LIMITS.minScale;\n return clamp(0.55 * 1.6 ** (depth - 1), MAP_CAMERA_LIMITS.minScale, MAP_CAMERA_LIMITS.maxScale);\n}\n\nexport function isMapNodeVisible(depth: number, scale: number): boolean {\n return depth <= 1 || scale >= semanticRevealScale(depth);\n}\n\nexport function isMapConnectionVisible(\n fromDepth: number,\n toDepth: number,\n scale: number,\n): boolean {\n return isMapNodeVisible(fromDepth, scale) && isMapNodeVisible(toDepth, scale);\n}\n\nfunction clamp(value: number, minimum: number, maximum: number): number {\n return Math.min(maximum, Math.max(minimum, value));\n}\n","import \"./styles.css\";\nimport { loadCachedValue } from \"./map-cache.js\";\nimport { BUSINESS_MAP_WORLD, layoutBusinessMap, type BusinessMapLayoutNode } from \"./map-layout.js\";\nimport {\n fitMapCamera,\n isMapConnectionVisible,\n isMapNodeVisible,\n panMapCamera,\n semanticRevealScale,\n zoomMapCameraAt,\n type MapCamera,\n} from \"./map-camera.js\";\n\ntype Freshness = \"current\" | \"stale\" | \"missing\";\ntype PublicationStatus = \"missing\" | \"building\" | \"current\" | \"failed\";\n\ninterface ProjectSummary {\n readonly id: string;\n readonly name: string;\n readonly root: string;\n readonly branch: \"main\" | \"master\";\n readonly headCommit: string;\n readonly snapshotId: string | null;\n readonly freshness: Freshness;\n readonly status: PublicationStatus;\n}\n\ninterface BusinessNode {\n readonly domain: \"business\";\n readonly key: string;\n readonly kind: string;\n readonly label: string;\n readonly summary: string;\n readonly aliases: readonly string[];\n readonly certainty: \"exact\" | \"inferred\" | \"hypothesis\";\n readonly validity: \"valid\" | \"stale\";\n readonly evidence: readonly Evidence[];\n}\n\ninterface Evidence {\n readonly symbolId: string;\n readonly file: string;\n readonly range: {\n readonly start: { readonly line: number; readonly column: number };\n readonly end: { readonly line: number; readonly column: number };\n };\n}\n\ninterface MapRegion {\n readonly node: BusinessNode;\n readonly role: \"root\" | \"child\" | \"context\";\n readonly childCount: number;\n readonly expandable: boolean;\n}\n\ninterface MapConnection {\n readonly from: { readonly key: string };\n readonly to: { readonly key: string };\n readonly relations: readonly {\n readonly type: string;\n readonly directCount: number;\n readonly aggregatedCount: number;\n }[];\n}\n\ninterface BusinessMap {\n readonly focus: BusinessNode | null;\n readonly breadcrumbs: readonly BusinessNode[];\n readonly regions: readonly MapRegion[];\n readonly connections: readonly MapConnection[];\n}\n\ninterface SearchResult {\n readonly score: number;\n readonly node: BusinessNode;\n}\n\ninterface BusinessSearch {\n readonly query: string;\n readonly limit: number;\n readonly results: readonly SearchResult[];\n}\n\ninterface GraphNeighbor {\n readonly direction: \"incoming\" | \"outgoing\";\n readonly relation: { readonly type: string; readonly certainty: string; readonly validity: string };\n readonly node: { readonly label: string; readonly kind: string };\n}\n\ninterface BusinessNodeView {\n readonly node: BusinessNode;\n readonly relations: readonly GraphNeighbor[];\n}\n\ninterface ApiEnvelope<Data> {\n readonly schemaVersion: 1;\n readonly data: Data;\n}\n\ninterface ApiErrorEnvelope {\n readonly schemaVersion: 1;\n readonly error: { readonly code: string; readonly message: string };\n}\n\nclass ApiRequestError extends Error {\n constructor(readonly code: string, message: string) {\n super(message);\n this.name = \"ApiRequestError\";\n }\n}\n\ninterface MapViewportController {\n fit(): void;\n focus(key: string, scale?: number): void;\n refresh(): void;\n}\n\ninterface CachedMapNode extends MapRegion {\n readonly parentKey: string | undefined;\n}\n\ninterface InteractiveMapState {\n readonly projectId: string;\n readonly maps: Map<string, BusinessMap>;\n readonly mapRequests: Map<string, Promise<BusinessMap>>;\n readonly nodes: Map<string, CachedMapNode>;\n readonly connections: Map<string, MapConnection>;\n positions: Map<string, BusinessMapLayoutNode>;\n camera: MapCamera | undefined;\n}\n\nconst projectList = requireElement<HTMLElement>(\"project-list\");\nconst breadcrumbs = requireElement<HTMLElement>(\"breadcrumbs\");\nconst mapSurface = requireElement<HTMLElement>(\"map-surface\");\nconst detailPanel = requireElement<HTMLElement>(\"detail-panel\");\nconst searchForm = requireElement<HTMLFormElement>(\"search-form\");\nconst searchInput = requireElement<HTMLInputElement>(\"business-search\");\nconst searchResults = requireElement<HTMLElement>(\"search-results\");\nconst notice = requireElement<HTMLElement>(\"notice\");\n\nlet projects: readonly ProjectSummary[] = [];\nlet activeProject: ProjectSummary | undefined;\nlet activeMapViewport: MapViewportController | undefined;\nlet selectedBusinessKey: string | undefined;\nlet interactiveMap: InteractiveMapState | undefined;\nlet searchSequence = 0;\nlet noticeTimer: number | undefined;\n\nvoid initialize();\n\nasync function initialize(): Promise<void> {\n installInteractions();\n try {\n projects = (await api<{ readonly projects: readonly ProjectSummary[] }>(\"/api/v1/projects\"))\n .projects;\n renderProjects();\n const requestedProject = new URLSearchParams(location.search).get(\"project\");\n const initialProject = projects.find(({ id }) => id === requestedProject)\n ?? projects.find(({ freshness }) => freshness === \"current\")\n ?? projects[0];\n if (initialProject !== undefined) {\n await selectProject(initialProject.id);\n } else {\n renderNoProjects();\n }\n } catch (error) {\n renderFatalError(\"项目列表暂时无法显示\", errorMessage(error));\n }\n}\n\nfunction installInteractions(): void {\n searchForm.addEventListener(\"submit\", (event) => event.preventDefault());\n let debounceTimer: number | undefined;\n searchInput.addEventListener(\"input\", () => {\n window.clearTimeout(debounceTimer);\n const query = searchInput.value.trim();\n if (query.length === 0) {\n hideSearchResults();\n return;\n }\n debounceTimer = window.setTimeout(() => void runSearch(query), 170);\n });\n searchInput.addEventListener(\"keydown\", (event) => {\n if (event.key === \"Escape\") {\n hideSearchResults();\n searchInput.blur();\n }\n });\n document.addEventListener(\"keydown\", (event) => {\n const target = event.target as HTMLElement | null;\n if (event.key === \"Escape\" && document.body.classList.contains(\"is-immersive-map\")) {\n event.preventDefault();\n setImmersiveMap(false);\n return;\n }\n if (event.key === \"/\" && target?.tagName !== \"INPUT\" && activeProject !== undefined) {\n event.preventDefault();\n searchInput.focus();\n }\n });\n document.addEventListener(\"click\", (event) => {\n if (!searchForm.contains(event.target as Node)) hideSearchResults();\n });\n window.addEventListener(\"resize\", () => activeMapViewport?.fit());\n}\n\nasync function selectProject(projectId: string): Promise<void> {\n const project = projects.find(({ id }) => id === projectId);\n if (project === undefined) return;\n activeProject = project;\n activeMapViewport = undefined;\n selectedBusinessKey = undefined;\n interactiveMap = {\n projectId: project.id,\n maps: new Map(),\n mapRequests: new Map(),\n nodes: new Map(),\n connections: new Map(),\n positions: new Map(),\n camera: undefined,\n };\n searchInput.disabled = false;\n searchInput.value = \"\";\n hideSearchResults();\n renderProjects();\n renderLoading(mapSurface, \"正在加载业务地图\");\n renderDetailPlaceholder();\n replaceLocationProject(project.id);\n\n try {\n const map = await readMap();\n renderMap(map);\n } catch (error) {\n renderMapError(error);\n }\n}\n\nasync function loadMap(focusKey?: string): Promise<void> {\n if (activeProject === undefined) return;\n try {\n const map = await readMap(focusKey);\n renderMap(map);\n } catch (error) {\n renderMapError(error);\n }\n}\n\nasync function readMap(focusKey?: string): Promise<BusinessMap> {\n const project = activeProject;\n const state = interactiveMap;\n if (project === undefined || state === undefined) {\n throw new Error(\"请先选择一个项目。\");\n }\n const cacheKey = focusKey ?? \"\";\n return loadCachedValue(\n state.maps,\n state.mapRequests,\n cacheKey,\n async () => {\n const query = focusKey === undefined ? \"\" : `?focus=${encodeURIComponent(focusKey)}`;\n const map = await api<BusinessMap>(`/api/v1/projects/${project.id}/map${query}`);\n mergeMap(state, map);\n return map;\n },\n );\n}\n\nfunction mergeMap(state: InteractiveMapState, map: BusinessMap): void {\n let parentKey: string | undefined;\n for (const node of map.breadcrumbs) {\n cacheMapNode(state, node, parentKey === undefined ? \"root\" : \"child\", parentKey, 0, true);\n parentKey = node.key;\n }\n const breadcrumbFocus = map.breadcrumbs.at(-1);\n if (map.focus !== null && breadcrumbFocus?.key !== map.focus.key) {\n cacheMapNode(state, map.focus, \"child\", parentKey, 0, true);\n }\n for (const region of map.regions) {\n cacheMapNode(\n state,\n region.node,\n region.role,\n map.focus?.key,\n region.childCount,\n region.expandable,\n );\n }\n for (const connection of map.connections) {\n state.connections.set(`${connection.from.key}\\0${connection.to.key}`, connection);\n }\n const layout = layoutBusinessMap(\n [...state.nodes.values()].map(({ node, role, parentKey: nodeParentKey }) => ({\n key: node.key,\n role,\n parentKey: nodeParentKey,\n })),\n [...state.positions.values()],\n );\n state.positions = new Map(layout.nodes.map((position) => [position.key, position]));\n}\n\nfunction cacheMapNode(\n state: InteractiveMapState,\n node: BusinessNode,\n role: MapRegion[\"role\"],\n parentKey: string | undefined,\n childCount: number,\n expandable: boolean,\n): void {\n const existing = state.nodes.get(node.key);\n const keepHierarchy = existing !== undefined && role === \"context\";\n state.nodes.set(node.key, {\n node,\n role: keepHierarchy ? existing.role : role,\n parentKey: keepHierarchy ? existing.parentKey : parentKey,\n childCount: Math.max(existing?.childCount ?? 0, childCount),\n expandable: (existing?.expandable ?? false) || expandable,\n });\n}\n\nfunction renderProjects(): void {\n projectList.replaceChildren();\n if (projects.length === 0) {\n const empty = element(\"p\", \"rail-empty\");\n empty.textContent = \"暂无可查看的项目。\";\n projectList.append(empty);\n return;\n }\n for (const project of projects) {\n const button = element(\"button\", \"project-button\");\n button.type = \"button\";\n button.setAttribute(\"aria-current\", String(project.id === activeProject?.id));\n button.setAttribute(\"aria-label\", `${project.name},${project.branch} 分支`);\n button.addEventListener(\"click\", () => void selectProject(project.id));\n const name = element(\"span\", \"project-name\");\n name.textContent = project.name;\n button.append(name);\n projectList.append(button);\n }\n}\n\nfunction renderMap(map: BusinessMap): void {\n if (interactiveMap !== undefined) mergeMap(interactiveMap, map);\n renderBreadcrumbs(map);\n mapSurface.replaceChildren();\n\n if (map.regions.length === 0 && map.focus === null) {\n const empty = element(\"div\", \"empty-state\");\n const emptyTitle = element(\"h3\");\n emptyTitle.textContent = map.focus === null\n ? \"还没有可展示的业务知识\"\n : \"这里没有更多业务区域\";\n const emptyCopy = element(\"p\");\n emptyCopy.textContent = map.focus === null\n ? \"业务知识会在日常研发过程中逐步整理。\"\n : \"这个区域仍可能包含简介和相关业务。\";\n empty.append(emptyTitle, emptyCopy);\n mapSurface.append(empty);\n return;\n }\n if (interactiveMap !== undefined) {\n mapSurface.append(renderSpatialMap(interactiveMap));\n }\n}\n\nfunction renderSpatialMap(state: InteractiveMapState): HTMLElement {\n const viewport = element(\"section\", \"map-viewport\");\n viewport.tabIndex = 0;\n viewport.setAttribute(\"aria-label\", \"交互式业务地图。拖拽移动,滚轮缩放。\");\n const world = element(\"div\", \"map-world\");\n world.style.width = `${BUSINESS_MAP_WORLD.width}px`;\n world.style.height = `${BUSINESS_MAP_WORLD.height}px`;\n\n const connectionLayer = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n connectionLayer.classList.add(\"map-connections\");\n connectionLayer.setAttribute(\"viewBox\", `0 0 ${BUSINESS_MAP_WORLD.width} ${BUSINESS_MAP_WORLD.height}`);\n connectionLayer.setAttribute(\"aria-hidden\", \"true\");\n renderMapEdges(connectionLayer, state);\n world.append(connectionLayer, renderMapHub());\n for (const cached of state.nodes.values()) {\n const position = state.positions.get(cached.node.key);\n if (position !== undefined) world.append(renderMapNode(cached, position));\n }\n\n viewport.append(world, renderMapControls());\n const shouldFitLoadedMap = state.camera === undefined;\n activeMapViewport = installMapViewport(viewport, world, state);\n requestAnimationFrame(() => {\n if (shouldFitLoadedMap) activeMapViewport?.fit();\n else activeMapViewport?.refresh();\n });\n return viewport;\n}\n\nfunction renderMapHub(): HTMLElement {\n const hub = element(\"div\", \"map-hub\");\n hub.style.left = `${BUSINESS_MAP_WORLD.width / 2}px`;\n hub.style.top = `${BUSINESS_MAP_WORLD.height / 2}px`;\n const label = element(\"span\", \"map-hub-label\");\n label.textContent = activeProject?.name ?? \"项目\";\n hub.append(label);\n return hub;\n}\n\nfunction renderMapNode(cached: CachedMapNode, position: BusinessMapLayoutNode): HTMLElement {\n const node = element(\"article\", \"map-node\");\n node.dataset.key = cached.node.key;\n node.dataset.depth = String(position.depth);\n node.dataset.role = cached.role;\n node.dataset.kind = cached.node.kind.toLowerCase().replaceAll(\" \", \"-\");\n node.dataset.validity = cached.node.validity;\n node.classList.toggle(\"is-selected\", cached.node.key === selectedBusinessKey);\n node.style.left = `${position.x}px`;\n node.style.top = `${position.y}px`;\n\n const select = element(\"button\", \"map-node-core\");\n select.type = \"button\";\n select.title = cached.expandable ? \"进入这个业务区域\" : \"查看这个业务区域\";\n select.setAttribute(\"aria-label\", cached.node.label);\n select.addEventListener(\"click\", () => void selectMapNode(cached.node.key));\n const name = element(\"span\", \"map-node-label\");\n name.textContent = cached.node.label;\n select.append(name);\n if (cached.childCount > 0) {\n const count = element(\"span\", \"map-node-count\");\n count.textContent = `${cached.childCount} 项`;\n select.append(count);\n }\n node.append(select);\n return node;\n}\n\nfunction renderMapEdges(layer: SVGSVGElement, state: InteractiveMapState): void {\n const center = { x: BUSINESS_MAP_WORLD.width / 2, y: BUSINESS_MAP_WORLD.height / 2 };\n for (const cached of state.nodes.values()) {\n if (cached.role === \"context\") continue;\n const to = state.positions.get(cached.node.key);\n if (to === undefined) continue;\n const parent = cached.parentKey === undefined\n ? undefined\n : state.positions.get(cached.parentKey);\n const from = parent ?? center;\n if (from !== undefined) {\n appendMapEdge(layer, from, to, \"map-hierarchy-edge\", parent?.depth ?? 1, to.depth);\n }\n }\n for (const connection of state.connections.values()) {\n const from = state.positions.get(connection.from.key);\n const to = state.positions.get(connection.to.key);\n if (from === undefined || to === undefined) continue;\n appendMapEdge(\n layer,\n from,\n to,\n \"map-business-edge\",\n from.depth,\n to.depth,\n );\n }\n}\n\nfunction appendMapEdge(\n layer: SVGSVGElement,\n from: { readonly x: number; readonly y: number },\n to: { readonly x: number; readonly y: number },\n className: string,\n fromDepth: number,\n toDepth: number,\n): void {\n const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\n path.classList.add(className);\n path.dataset.fromDepth = String(fromDepth);\n path.dataset.toDepth = String(toDepth);\n const midpoint = { x: (from.x + to.x) / 2, y: (from.y + to.y) / 2 };\n const normal = { x: -(to.y - from.y) * 0.08, y: (to.x - from.x) * 0.08 };\n path.setAttribute(\"d\", `M ${from.x} ${from.y} Q ${midpoint.x + normal.x} ${midpoint.y + normal.y} ${to.x} ${to.y}`);\n layer.append(path);\n}\n\nfunction renderMapControls(): HTMLElement {\n const controls = element(\"div\", \"map-controls\");\n const immersive = document.body.classList.contains(\"is-immersive-map\");\n for (const [action, label, title] of [\n [\"zoom-out\", \"−\", \"缩小\"],\n [\"fit\", \"适应\", \"适应当前地图\"],\n [\"zoom-in\", \"+\", \"放大\"],\n [\"immersive\", immersive ? \"退出\" : \"沉浸\", immersive ? \"退出沉浸查看\" : \"进入沉浸查看\"],\n ] as const) {\n const button = element(\"button\", \"map-control\");\n button.type = \"button\";\n button.dataset.action = action;\n button.textContent = label;\n button.title = title;\n if (action === \"immersive\") button.setAttribute(\"aria-pressed\", String(immersive));\n controls.append(button);\n }\n return controls;\n}\n\nfunction installMapViewport(\n viewport: HTMLElement,\n world: HTMLElement,\n state: InteractiveMapState,\n): MapViewportController {\n let camera = state.camera ?? { scale: 1, x: 0, y: 0 };\n let drag: { readonly pointerId: number; readonly x: number; readonly y: number } | undefined;\n const controls = new Map(\n [...viewport.querySelectorAll<HTMLButtonElement>(\"[data-action]\")]\n .map((button) => [button.dataset.action!, button]),\n );\n\n const apply = (animated = false): void => {\n world.classList.toggle(\"is-animating\", animated);\n world.style.transform = `translate3d(${camera.x}px, ${camera.y}px, 0) scale(${camera.scale})`;\n state.camera = camera;\n viewport.dataset.zoom = camera.scale < 0.75 ? \"overview\" : camera.scale < 1.4 ? \"region\" : \"detail\";\n updateMapVisibility(viewport, state, camera.scale);\n };\n const fit = (): void => {\n camera = fitMapCamera(viewport.getBoundingClientRect(), mapBounds(state));\n apply(true);\n };\n const focus = (key: string, scale = camera.scale): void => {\n const position = state.positions.get(key);\n if (position === undefined) return;\n const rect = viewport.getBoundingClientRect();\n camera = {\n scale,\n x: rect.width / 2 - position.x * scale,\n y: rect.height / 2 - position.y * scale,\n };\n apply(true);\n };\n const zoom = (factor: number, point: { readonly x: number; readonly y: number }): void => {\n camera = zoomMapCameraAt(camera, factor, point);\n apply();\n };\n\n controls.get(\"zoom-in\")?.addEventListener(\"click\", () => {\n zoom(1.25, viewportCenter(viewport));\n });\n controls.get(\"zoom-out\")?.addEventListener(\"click\", () => {\n zoom(0.8, viewportCenter(viewport));\n });\n controls.get(\"fit\")?.addEventListener(\"click\", fit);\n controls.get(\"immersive\")?.addEventListener(\"click\", () => {\n setImmersiveMap(!document.body.classList.contains(\"is-immersive-map\"));\n });\n viewport.addEventListener(\"wheel\", (event) => {\n event.preventDefault();\n const rect = viewport.getBoundingClientRect();\n const point = { x: event.clientX - rect.left, y: event.clientY - rect.top };\n const before = camera.scale;\n zoom(Math.exp(-event.deltaY * 0.0015), point);\n if (camera.scale > before) maybeExpandFromZoom(event.target, state, camera, point);\n }, { passive: false });\n viewport.addEventListener(\"pointerdown\", (event) => {\n if (event.button !== 0 || (event.target as Element).closest(\"button\")) return;\n drag = { pointerId: event.pointerId, x: event.clientX, y: event.clientY };\n viewport.setPointerCapture(event.pointerId);\n viewport.classList.add(\"is-panning\");\n });\n viewport.addEventListener(\"pointermove\", (event) => {\n if (drag?.pointerId !== event.pointerId) return;\n camera = panMapCamera(camera, {\n x: event.clientX - drag.x,\n y: event.clientY - drag.y,\n });\n drag = { ...drag, x: event.clientX, y: event.clientY };\n apply();\n });\n viewport.addEventListener(\"pointerup\", () => {\n drag = undefined;\n viewport.classList.remove(\"is-panning\");\n });\n viewport.addEventListener(\"keydown\", (event) => {\n if (event.key === \"+\" || event.key === \"=\") {\n event.preventDefault();\n zoom(1.25, viewportCenter(viewport));\n }\n if (event.key === \"-\") {\n event.preventDefault();\n zoom(0.8, viewportCenter(viewport));\n }\n if (event.key === \"0\") {\n event.preventDefault();\n fit();\n }\n });\n apply();\n return { fit, focus, refresh: () => apply() };\n}\n\nfunction setImmersiveMap(immersive: boolean): void {\n document.body.classList.toggle(\"is-immersive-map\", immersive);\n const control = document.querySelector<HTMLButtonElement>(\"[data-action=immersive]\");\n if (control !== null) {\n control.textContent = immersive ? \"退出\" : \"沉浸\";\n control.title = immersive ? \"退出沉浸查看\" : \"进入沉浸查看\";\n control.setAttribute(\"aria-pressed\", String(immersive));\n }\n requestAnimationFrame(() => {\n const camera = interactiveMap?.camera;\n if (selectedBusinessKey !== undefined && camera !== undefined) {\n activeMapViewport?.focus(selectedBusinessKey, camera.scale);\n } else {\n activeMapViewport?.fit();\n }\n });\n}\n\nfunction maybeExpandFromZoom(\n target: EventTarget | null,\n state: InteractiveMapState,\n camera: MapCamera,\n pointer: { readonly x: number; readonly y: number },\n): void {\n const nodeElement = target instanceof Element ? target.closest<HTMLElement>(\".map-node\") : null;\n const key = nodeElement?.dataset.key\n ?? nearestExpandableMapNode(state, camera, pointer)\n ?? selectedBusinessKey;\n if (key === undefined || state.maps.has(key) || state.mapRequests.has(key)) return;\n const node = state.nodes.get(key);\n const position = state.positions.get(key);\n if (node?.expandable === true && position !== undefined && camera.scale >= semanticRevealScale(position.depth + 1)) {\n void selectMapNode(key);\n }\n}\n\nfunction nearestExpandableMapNode(\n state: InteractiveMapState,\n camera: MapCamera,\n pointer: { readonly x: number; readonly y: number },\n): string | undefined {\n let closest: { readonly key: string; readonly distance: number } | undefined;\n for (const cached of state.nodes.values()) {\n if (!cached.expandable) continue;\n const position = state.positions.get(cached.node.key);\n if (position === undefined) continue;\n const x = position.x * camera.scale + camera.x;\n const y = position.y * camera.scale + camera.y;\n const distance = Math.hypot(pointer.x - x, pointer.y - y);\n if (distance <= 130 && (closest === undefined || distance < closest.distance)) {\n closest = { key: cached.node.key, distance };\n }\n }\n return closest?.key;\n}\n\nfunction updateMapVisibility(viewport: HTMLElement, state: InteractiveMapState, scale: number): void {\n const nodesByKey = new Map(\n [...viewport.querySelectorAll<HTMLElement>(\".map-node\")]\n .map((element_) => [element_.dataset.key, element_]),\n );\n for (const node of state.nodes.values()) {\n const position = state.positions.get(node.node.key);\n const element_ = nodesByKey.get(node.node.key);\n if (position === undefined || element_ === undefined) continue;\n element_.hidden = !isMapNodeVisible(position.depth, scale);\n }\n viewport.querySelectorAll<SVGElement>(\"[data-from-depth][data-to-depth]\").forEach((element_) => {\n const visible = isMapConnectionVisible(\n Number(element_.dataset.fromDepth),\n Number(element_.dataset.toDepth),\n scale,\n );\n element_.toggleAttribute(\"hidden\", !visible);\n element_.style.display = visible ? \"\" : \"none\";\n });\n}\n\nfunction mapBounds(state: InteractiveMapState): { left: number; top: number; right: number; bottom: number } {\n const positions = [...state.positions.values()];\n if (positions.length === 0) {\n const x = BUSINESS_MAP_WORLD.width / 2;\n const y = BUSINESS_MAP_WORLD.height / 2;\n return { left: x - 240, top: y - 160, right: x + 240, bottom: y + 160 };\n }\n return {\n left: Math.min(BUSINESS_MAP_WORLD.width / 2, ...positions.map(({ x }) => x)) - 150,\n top: Math.min(BUSINESS_MAP_WORLD.height / 2, ...positions.map(({ y }) => y)) - 150,\n right: Math.max(BUSINESS_MAP_WORLD.width / 2, ...positions.map(({ x }) => x)) + 150,\n bottom: Math.max(BUSINESS_MAP_WORLD.height / 2, ...positions.map(({ y }) => y)) + 150,\n };\n}\n\nfunction viewportCenter(viewport: HTMLElement): { x: number; y: number } {\n const rect = viewport.getBoundingClientRect();\n return { x: rect.width / 2, y: rect.height / 2 };\n}\n\nasync function selectMapNode(key: string): Promise<void> {\n const state = interactiveMap;\n if (state === undefined) return;\n selectedBusinessKey = key;\n const cached = state.nodes.get(key);\n const mapPromise = cached?.expandable === true || cached === undefined\n ? readMap(key)\n : Promise.resolve(undefined);\n const nodePromise = loadNode(key);\n const map = await mapPromise;\n if (map !== undefined) renderMap(map);\n await nodePromise;\n const loadedNode = state.nodes.get(key);\n const position = state.positions.get(key);\n const targetScale = position === undefined\n ? state.camera?.scale\n : loadedNode?.expandable === true\n ? semanticRevealScale(position.depth + 1)\n : Math.max(state.camera?.scale ?? 1, semanticRevealScale(position.depth));\n activeMapViewport?.focus(key, targetScale);\n}\n\nasync function focusMapRoot(): Promise<void> {\n try {\n const map = await readMap();\n renderMap(map);\n activeMapViewport?.fit();\n } catch (error) {\n renderMapError(error);\n }\n}\n\nasync function loadNode(businessKey: string): Promise<void> {\n if (activeProject === undefined) return;\n selectedBusinessKey = businessKey;\n mapSurface.querySelectorAll<HTMLElement>(\".map-node\").forEach((node) => {\n node.classList.toggle(\"is-selected\", node.dataset.key === businessKey);\n });\n renderLoading(detailPanel, \"正在加载详情\");\n try {\n const view = await api<BusinessNodeView>(\n `/api/v1/projects/${activeProject.id}/node?key=${encodeURIComponent(businessKey)}`,\n );\n renderNode(view);\n } catch (error) {\n const state = element(\"div\", \"error-state\");\n const title = element(\"h3\");\n title.textContent = \"详情暂时无法显示\";\n const copy = element(\"p\");\n copy.textContent = errorMessage(error);\n state.append(title, copy);\n detailPanel.replaceChildren(state);\n }\n}\n\nfunction renderNode(view: BusinessNodeView): void {\n const node = view.node;\n detailPanel.replaceChildren();\n const heading = element(\"header\", \"detail-heading\");\n const kind = element(\"p\", \"detail-kind\");\n kind.textContent = `类型:${localizeBusinessKind(node.kind)}`;\n const title = element(\"h3\");\n title.textContent = node.label;\n const summary = element(\"p\");\n summary.textContent = node.summary;\n heading.append(kind, title, summary);\n detailPanel.append(heading);\n\n if (view.relations.length === 0) return;\n const relations = detailSection(\"相关业务\");\n view.relations.forEach((neighbor) => {\n const row = element(\"div\", \"relation-item\");\n const label = element(\"span\");\n label.textContent = neighbor.node.label;\n row.append(label);\n relations.append(row);\n });\n detailPanel.append(relations);\n}\n\nfunction renderBreadcrumbs(map: BusinessMap): void {\n breadcrumbs.replaceChildren();\n const root = element(\"button\", \"breadcrumb-button\");\n root.type = \"button\";\n root.textContent = activeProject?.name ?? \"业务地图\";\n root.addEventListener(\"click\", () => {\n void focusMapRoot();\n renderDetailPlaceholder();\n });\n breadcrumbs.append(root);\n for (const node of map.breadcrumbs) {\n const separator = element(\"span\", \"breadcrumb-separator\");\n separator.textContent = \"/\";\n const button = element(\"button\", \"breadcrumb-button\");\n button.type = \"button\";\n button.textContent = node.label;\n button.addEventListener(\"click\", () => {\n void selectMapNode(node.key);\n });\n breadcrumbs.append(separator, button);\n }\n}\n\nasync function runSearch(query: string): Promise<void> {\n if (activeProject === undefined) return;\n const sequence = ++searchSequence;\n searchResults.hidden = false;\n const loading = element(\"div\", \"search-message\");\n loading.textContent = \"正在搜索业务知识…\";\n searchResults.replaceChildren(loading);\n try {\n const result = await api<BusinessSearch>(\n `/api/v1/projects/${activeProject.id}/search?q=${encodeURIComponent(query)}&limit=12`,\n );\n if (sequence !== searchSequence || searchInput.value.trim() !== query) return;\n renderSearchResults(result.results);\n } catch (error) {\n if (sequence !== searchSequence) return;\n const message = element(\"div\", \"search-message\");\n message.textContent = errorMessage(error);\n searchResults.replaceChildren(message);\n }\n}\n\nfunction renderSearchResults(results: readonly SearchResult[]): void {\n searchResults.replaceChildren();\n searchResults.hidden = false;\n if (results.length === 0) {\n const message = element(\"div\", \"search-message\");\n message.textContent = \"没有找到匹配的业务知识。\";\n searchResults.append(message);\n return;\n }\n for (const result of results) {\n const button = element(\"button\", \"search-result\");\n button.type = \"button\";\n const label = element(\"strong\");\n label.textContent = result.node.label;\n const meta = element(\"span\");\n meta.textContent = `类型:${localizeBusinessKind(result.node.kind)}`;\n button.append(label, meta);\n button.addEventListener(\"click\", () => {\n searchInput.value = \"\";\n hideSearchResults();\n void selectMapNode(result.node.key);\n });\n searchResults.append(button);\n }\n}\n\nfunction hideSearchResults(): void {\n searchSequence += 1;\n searchResults.hidden = true;\n searchResults.replaceChildren();\n}\n\nfunction renderNoProjects(): void {\n searchInput.disabled = true;\n const state = element(\"div\", \"empty-state\");\n const title = element(\"h3\");\n title.textContent = \"没有可查看的项目\";\n const copy = element(\"p\");\n copy.textContent = \"请先为主分支项目准备业务知识。\";\n state.append(title, copy);\n mapSurface.replaceChildren(state);\n}\n\nfunction renderMapError(error: unknown): void {\n breadcrumbs.replaceChildren();\n const root = element(\"span\", \"breadcrumb-button\");\n root.textContent = activeProject?.name ?? \"业务地图\";\n breadcrumbs.append(root);\n const state = element(\"div\", \"error-state\");\n const title = element(\"h3\");\n title.textContent = error instanceof ApiRequestError && error.code === \"ATLAS_STATE_UNAVAILABLE\"\n ? \"地图尚未准备好\"\n : \"业务地图暂时无法显示\";\n const copy = element(\"p\");\n copy.textContent = errorMessage(error);\n state.append(title, copy);\n mapSurface.replaceChildren(state);\n}\n\nfunction renderFatalError(titleText: string, message: string): void {\n const state = element(\"div\", \"error-state\");\n const title = element(\"h3\");\n title.textContent = titleText;\n const copy = element(\"p\");\n copy.textContent = message;\n state.append(title, copy);\n mapSurface.replaceChildren(state);\n showNotice(message);\n}\n\nfunction renderDetailPlaceholder(): void {\n const placeholder = element(\"div\", \"detail-placeholder\");\n const title = element(\"h3\");\n title.textContent = \"选择一个业务区域\";\n const copy = element(\"p\");\n copy.textContent = \"在地图上点击节点查看简介和相关业务。\";\n placeholder.append(title, copy);\n detailPanel.replaceChildren(placeholder);\n}\n\nfunction renderLoading(target: HTMLElement, label: string): void {\n const state = element(\"div\", \"loading-state\");\n state.textContent = label;\n target.replaceChildren(state);\n}\n\nfunction detailSection(titleText: string): HTMLElement {\n const section = element(\"section\", \"detail-section\");\n const title = element(\"h4\");\n title.textContent = titleText;\n section.append(title);\n return section;\n}\n\nasync function api<Data>(path: string): Promise<Data> {\n const response = await fetch(path, { headers: { Accept: \"application/json\" } });\n const envelope = await response.json() as ApiEnvelope<Data> | ApiErrorEnvelope;\n if (!response.ok || \"error\" in envelope) {\n const error = \"error\" in envelope\n ? envelope.error\n : { code: \"INVALID_RESPONSE\", message: \"The local API returned an invalid response.\" };\n throw new ApiRequestError(error.code, error.message);\n }\n return envelope.data;\n}\n\nfunction replaceLocationProject(projectId: string): void {\n const url = new URL(location.href);\n url.searchParams.set(\"project\", projectId);\n history.replaceState(null, \"\", url);\n}\n\nfunction showNotice(message: string): void {\n window.clearTimeout(noticeTimer);\n notice.textContent = message;\n notice.hidden = false;\n noticeTimer = window.setTimeout(() => { notice.hidden = true; }, 4500);\n}\n\nfunction localizeBusinessKind(kind: string): string {\n const labels: Readonly<Record<string, string>> = {\n Capability: \"能力\",\n Scenario: \"场景\",\n Operation: \"操作\",\n Invariant: \"规则\",\n Interface: \"接口\",\n Data: \"数据\",\n };\n return labels[kind] ?? kind;\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\nfunction requireElement<ElementType extends HTMLElement>(id: string): ElementType {\n const found = document.getElementById(id);\n if (found === null) throw new Error(`Missing required interface element ${id}`);\n return found as ElementType;\n}\n\nfunction element<Tag extends keyof HTMLElementTagNameMap>(\n tag: Tag,\n className?: string,\n): HTMLElementTagNameMap[Tag] {\n const created = document.createElement(tag);\n if (className !== undefined) created.className = className;\n return created;\n}\n"],"names":["loadCachedValue","values","pending","key","load","cached","inFlight","request","value","BUSINESS_MAP_WORLD","layoutBusinessMap","regions","existingNodes","center","positions","node","ready","parentKey","next","siblings","groupByParent","placeSiblings","removeRegion","parent","allSiblings","compareNodes","left","right","root","parentPosition","outwardAngle","region","index","angle","siblingAngle","depth","radius","siblingRadius","count","span","role","base","contextOffset","nodes","groups","group","MAP_CAMERA_LIMITS","zoomMapCameraAt","camera","factor","pointer","scale","clamp","worldX","worldY","panMapCamera","delta","fitMapCamera","viewport","bounds","padding","width","height","semanticRevealScale","isMapNodeVisible","isMapConnectionVisible","fromDepth","toDepth","minimum","maximum","ApiRequestError","code","message","projectList","requireElement","breadcrumbs","mapSurface","detailPanel","searchForm","searchInput","searchResults","notice","projects","activeProject","activeMapViewport","selectedBusinessKey","interactiveMap","searchSequence","noticeTimer","initialize","installInteractions","api","renderProjects","requestedProject","initialProject","id","freshness","selectProject","renderNoProjects","error","renderFatalError","errorMessage","event","debounceTimer","query","hideSearchResults","runSearch","target","setImmersiveMap","projectId","project","renderLoading","renderDetailPlaceholder","replaceLocationProject","map","readMap","renderMap","renderMapError","focusKey","state","cacheKey","mergeMap","cacheMapNode","breadcrumbFocus","connection","layout","nodeParentKey","position","childCount","expandable","existing","keepHierarchy","empty","element","button","name","renderBreadcrumbs","emptyTitle","emptyCopy","renderSpatialMap","world","connectionLayer","renderMapEdges","renderMapHub","renderMapNode","renderMapControls","shouldFitLoadedMap","installMapViewport","hub","label","select","selectMapNode","layer","to","from","appendMapEdge","className","path","midpoint","normal","controls","immersive","action","title","drag","apply","animated","updateMapVisibility","fit","mapBounds","focus","rect","zoom","point","viewportCenter","before","maybeExpandFromZoom","control","nearestExpandableMapNode","closest","x","y","distance","nodesByKey","element_","visible","mapPromise","nodePromise","loadNode","loadedNode","targetScale","focusMapRoot","businessKey","view","renderNode","copy","heading","kind","localizeBusinessKind","summary","relations","detailSection","neighbor","row","separator","sequence","loading","result","renderSearchResults","results","meta","titleText","showNotice","placeholder","section","response","envelope","url","found","tag","created"],"mappings":"ssBAAO,SAASA,GACdC,EACAC,EACAC,EACAC,EACgB,CAChB,MAAMC,EAASJ,EAAO,IAAIE,CAAG,EAC7B,GAAIE,IAAW,OAAW,OAAO,QAAQ,QAAQA,CAAM,EAEvD,MAAMC,EAAWJ,EAAQ,IAAIC,CAAG,EAChC,GAAIG,IAAa,OAAW,OAAOA,EAEnC,MAAMC,EAAUH,EAAA,EACb,KAAMI,IACLP,EAAO,IAAIE,EAAKK,CAAK,EACdA,EACR,EACA,QAAQ,IAAMN,EAAQ,OAA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,CAEA,SAASqH,GAAqBD,EAAsB,CASlD,MARiD,CAC/C,WAAY,KACZ,SAAU,KACV,UAAW,KACX,UAAW,KACX,UAAW,KACX,KAAM,IAAA,EAEMA,CAAI,GAAKA,CACzB,CAEA,SAAShG,EAAaF,EAAwB,CAC5C,OAAOA,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,CAC9D,CAEA,SAASzB,EAAgDqB,EAAyB,CAChF,MAAM2H,EAAQ,SAAS,eAAe3H,CAAE,EACxC,GAAI2H,IAAU,KAAM,MAAM,IAAI,MAAM,sCAAsC3H,CAAE,EAAE,EAC9E,OAAO2H,CACT,CAEA,SAASrF,EACPsF,EACA/D,EAC4B,CAC5B,MAAMgE,EAAU,SAAS,cAAcD,CAAG,EAC1C,OAAI/D,IAAc,SAAWgE,EAAQ,UAAYhE,GAC1CgE,CACT"}
@@ -0,0 +1,61 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta name="color-scheme" content="light" />
7
+ <meta name="theme-color" content="#f3f0e8" />
8
+ <title>Semantic Atlas</title>
9
+ <script type="module" crossorigin src="/assets/index-cze_4vtt.js"></script>
10
+ <link rel="stylesheet" crossorigin href="/assets/index-DneaErDj.css">
11
+ </head>
12
+ <body>
13
+ <div class="app-shell">
14
+ <aside class="project-rail" aria-label="项目">
15
+ <header class="rail-header">
16
+ <h1>项目</h1>
17
+ </header>
18
+ <nav id="project-list" class="project-list" aria-live="polite"></nav>
19
+ </aside>
20
+
21
+ <main class="workspace">
22
+ <header class="workspace-header">
23
+ <nav id="breadcrumbs" class="breadcrumbs" aria-label="业务路径"></nav>
24
+ <form id="search-form" class="search" role="search">
25
+ <label class="sr-only" for="business-search">搜索当前项目的业务知识</label>
26
+ <svg viewBox="0 0 24 24" aria-hidden="true">
27
+ <circle cx="11" cy="11" r="6.5"></circle>
28
+ <path d="m16 16 4 4"></path>
29
+ </svg>
30
+ <input
31
+ id="business-search"
32
+ name="q"
33
+ type="search"
34
+ autocomplete="off"
35
+ placeholder="搜索业务"
36
+ disabled
37
+ />
38
+ <div id="search-results" class="search-results" hidden></div>
39
+ </form>
40
+ </header>
41
+
42
+ <div class="content-layout">
43
+ <section id="map-surface" class="map-surface" aria-live="polite">
44
+ <div class="welcome-state">
45
+ <h3>选择一个项目</h3>
46
+ <p>地图会展示已整理的业务知识。</p>
47
+ </div>
48
+ </section>
49
+
50
+ <aside id="detail-panel" class="detail-panel" aria-label="业务详情" aria-live="polite">
51
+ <div class="detail-placeholder">
52
+ <h3>选择一个业务区域</h3>
53
+ <p>在地图上点击节点查看简介和相关业务。</p>
54
+ </div>
55
+ </aside>
56
+ </div>
57
+ </main>
58
+ </div>
59
+ <div id="notice" class="notice" role="status" hidden></div>
60
+ </body>
61
+ </html>
@@ -2,10 +2,14 @@ import type { GitRepository } from "../repository/types.js";
2
2
  import { GraphStore } from "../graph/graph-store.js";
3
3
  import type { BusinessGraphView, BusinessGraphNode, BusinessMapView, GraphSearchResult, StructuralGraphNode } from "../graph/types.js";
4
4
  import type { StructuralIndexBackend } from "../structural-backend/types.js";
5
+ import type { AtlasDatabaseAccess } from "../storage/atlas-database.js";
5
6
  import type { SemanticGraphChangeOptions, SemanticGraphChanges } from "./types.js";
7
+ export interface WorldGraphQueryOptions {
8
+ readonly atlasAccess?: AtlasDatabaseAccess;
9
+ }
6
10
  export declare class WorldGraphQuery implements Disposable {
7
11
  #private;
8
- constructor(repository: GitRepository, graph?: GraphStore, structural?: StructuralIndexBackend);
12
+ constructor(repository: GitRepository, graph?: GraphStore, structural?: StructuralIndexBackend, options?: WorldGraphQueryOptions);
9
13
  view(focusKey?: string): Promise<BusinessMapView | undefined>;
10
14
  searchBusiness(query: string, options?: {
11
15
  readonly limit?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"world-graph-query.d.ts","sourceRoot":"","sources":["../../src/world/world-graph-query.ts"],"names":[],"mappings":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C;IAgBvE,OAAO,CAAC,OAAO,GAAE,0BAA+B,GAAG,oBAAoB,GAAG,SAAS;IAKnF,KAAK,IAAI,IAAI;IAMb,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;IAIxB,OAAO,CAAC,YAAY;YAKN,gBAAgB;YAgBhB,OAAO;YAWP,iBAAiB;YAmBjB,cAAc;CAgB7B"}
@@ -59,12 +59,14 @@ export class WorldGraphQuery {
59
59
  #graph;
60
60
  #structural;
61
61
  #ownsGraph;
62
- constructor(repository, graph, structural = new CodeGraphStructuralBackend(repository)) {
62
+ #atlasAccess;
63
+ constructor(repository, graph, structural = new CodeGraphStructuralBackend(repository), options = {}) {
63
64
  const dependencies = createDependencies(repository, graph, structural);
64
65
  this.#repository = repository;
65
66
  this.#graph = dependencies.graph;
66
67
  this.#structural = dependencies.structural;
67
68
  this.#ownsGraph = dependencies.ownsGraph;
69
+ this.#atlasAccess = options.atlasAccess ?? "read-write";
68
70
  }
69
71
  async view(focusKey) {
70
72
  return this.withCurrentWorld(async (snapshot) => {
@@ -135,7 +137,7 @@ export class WorldGraphQuery {
135
137
  currentWorld() {
136
138
  const env_2 = { stack: [], error: void 0, hasError: false };
137
139
  try {
138
- const store = __addDisposableResource(env_2, new WorldSnapshotStore(this.#repository), false);
140
+ const store = __addDisposableResource(env_2, new WorldSnapshotStore(this.#repository, { access: this.#atlasAccess }), false);
139
141
  return store.requireCurrentWorld();
140
142
  }
141
143
  catch (e_2) {
@@ -1,12 +1,13 @@
1
1
  import type { GitRepository } from "../repository/types.js";
2
2
  import type { RepositorySnapshot } from "../snapshots/types.js";
3
+ import { type AtlasDatabaseOptions } from "../storage/atlas-database.js";
3
4
  import type { CurrentWorldSnapshot, SemanticGraphChangeOptions, SemanticGraphChanges, StructuralEvidenceResolver, WorldPublicationMetadata, WorldSnapshotState } from "./types.js";
4
5
  interface ReconciliationResult {
5
6
  readonly staleAssertions: readonly string[];
6
7
  }
7
8
  export declare class WorldSnapshotStore implements Disposable {
8
9
  #private;
9
- constructor(repository: GitRepository);
10
+ constructor(repository: GitRepository, options?: AtlasDatabaseOptions);
10
11
  readState(): WorldSnapshotState;
11
12
  begin(targetSnapshotId: string): void;
12
13
  publish(snapshot: RepositorySnapshot, backendVersion: string, extractionVersion: number | null, resolver: StructuralEvidenceResolver, changes: Omit<WorldPublicationMetadata, "staleAssertions">): ReconciliationResult;
@@ -1 +1 @@
1
- {"version":3,"file":"world-snapshot-store.d.ts","sourceRoot":"","sources":["../../src/world/world-snapshot-store.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,KAAK,EACV,oBAAoB,EAEpB,0BAA0B,EAC1B,oBAAoB,EACpB,0BAA0B,EAE1B,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAmBpB,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7C;AAwBD,qBAAa,kBAAmB,YAAW,UAAU;;gBAKvC,UAAU,EAAE,aAAa;IAMrC,SAAS,IAAI,kBAAkB;IAsC/B,KAAK,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI;IAmBrC,OAAO,CACL,QAAQ,EAAE,kBAAkB,EAC5B,cAAc,EAAE,MAAM,EACtB,iBAAiB,EAAE,MAAM,GAAG,IAAI,EAChC,QAAQ,EAAE,0BAA0B,EACpC,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,iBAAiB,CAAC,GACzD,oBAAoB;IAiEvB,IAAI,CAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAoBpD,sBAAsB,IAAI,kBAAkB;IAI5C,mBAAmB,IAAI,oBAAoB;IAuB3C,mBAAmB,CAAC,OAAO,GAAE,0BAA+B,GAAG,oBAAoB,GAAG,SAAS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E,MAAM,GAAG,IAAI;IAmBrC,OAAO,CACL,QAAQ,EAAE,kBAAkB,EAC5B,cAAc,EAAE,MAAM,EACtB,iBAAiB,EAAE,MAAM,GAAG,IAAI,EAChC,QAAQ,EAAE,0BAA0B,EACpC,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,iBAAiB,CAAC,GACzD,oBAAoB;IAiEvB,IAAI,CAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAoBpD,sBAAsB,IAAI,kBAAkB;IAI5C,mBAAmB,IAAI,oBAAoB;IAuB3C,mBAAmB,CAAC,OAAO,GAAE,0BAA+B,GAAG,oBAAoB,GAAG,SAAS;IAgD/F,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,uBAAuB;IAe/B,OAAO,CAAC,eAAe;IAqBvB,OAAO,CAAC,YAAY;IAYpB,KAAK,IAAI,IAAI;IAIb,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;IAIxB,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,uBAAuB;IAO/B,OAAO,CAAC,YAAY;IAcpB,OAAO,CAAC,cAAc;IA8BtB,OAAO,CAAC,iBAAiB;IAsBzB,OAAO,CAAC,mBAAmB;IA+E3B,OAAO,CAAC,+BAA+B;IAmFvC,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,wBAAwB;IAehC,OAAO,CAAC,eAAe;IAmBvB,OAAO,CAAC,oBAAoB;IAuD5B,OAAO,CAAC,oBAAoB;CA8B7B"}
@@ -5,8 +5,8 @@ export class WorldSnapshotStore {
5
5
  #database;
6
6
  #repositoryId;
7
7
  #gitDirectory;
8
- constructor(repository) {
9
- this.#database = new AtlasDatabase(repository);
8
+ constructor(repository, options = {}) {
9
+ this.#database = new AtlasDatabase(repository, options);
10
10
  this.#repositoryId = repository.repositoryId;
11
11
  this.#gitDirectory = repository.gitDirectory;
12
12
  }
@@ -0,0 +1,225 @@
1
+ # Desktop Web Viewer
2
+
3
+ This page answers how people browse Semantic Atlas business knowledge without
4
+ changing the Agent workflow, graph model, or repository state. It applies to
5
+ the `semantic-atlas web` command, its local HTTP API, and the bundled desktop
6
+ browser interface. Status: implemented in the current package.
7
+
8
+ ## Product role
9
+
10
+ The Web viewer is a human-facing, read-only surface over the same Semantic
11
+ Atlas business world used by coding agents. It helps a person select a project,
12
+ read summarized business knowledge, move through the established `part_of`
13
+ hierarchy, search business vocabulary, and inspect direct relationships and
14
+ evidence.
15
+
16
+ The viewer presents business knowledge as a real spatial node map. The map
17
+ metaphor defines topology and interaction rather than a game theme: users see
18
+ business regions positioned on a canvas, follow visible hierarchy and business
19
+ relationship lines, pan and zoom the canvas, and enter a region to reveal its
20
+ next level. The surrounding interface remains a restrained product-development
21
+ UI with project selection, breadcrumb, search, and a detail panel. It does not
22
+ introduce game roles, presentation-specific node kinds, decorative world
23
+ semantics, or a mobile experience.
24
+
25
+ ## Stable boundary
26
+
27
+ ```text
28
+ semantic-atlas web
29
+ |
30
+ v
31
+ LocalWebServer -------- bundled desktop Web application
32
+ |
33
+ v
34
+ AtlasReadService
35
+ |-- PrimaryRepositoryCatalog
36
+ `-- WorldGraphQuery
37
+ |
38
+ v
39
+ existing Atlas repository knowledge and current structural publication
40
+ ```
41
+
42
+ - `LocalWebServer` owns loopback HTTP, static assets, request validation, and
43
+ API presentation.
44
+ - `AtlasReadService` owns the read use cases shared by HTTP and future CLI
45
+ presentation refactoring. The server calls it directly and never executes
46
+ `semantic-atlas map ...` as a subprocess.
47
+ - `PrimaryRepositoryCatalog` discovers Atlas repositories through Atlas-owned
48
+ storage and Git inspection. It never exposes backend tables to the browser.
49
+ - `WorldGraphQuery` remains the authority for business views, search, direct
50
+ node details, publication consistency, certainty, and validity.
51
+
52
+ The Web slice adds no graph table, node kind, relation kind, evidence format,
53
+ or presentation coordinate to durable Atlas knowledge. Layout is derived in
54
+ the browser for the visible frontier and is disposable.
55
+
56
+ ## Primary-branch project scope
57
+
58
+ The Web viewer deliberately ignores linked worktrees. A project is visible
59
+ only when Atlas can resolve its primary working tree and that working tree is
60
+ currently attached to a branch named exactly `main` or `master`.
61
+
62
+ Repository discovery therefore follows these rules:
63
+
64
+ 1. Group durable state by Atlas `repositoryId`.
65
+ 2. Select only the state whose Git directory is the common Git directory; this
66
+ is the repository's primary working tree.
67
+ 3. Inspect that working tree's current branch and retain only `main` or
68
+ `master`.
69
+ 4. Return at most one project entry for each repository.
70
+ 5. Never return linked-worktree roots, branches, or publication choices through
71
+ the Web project catalog.
72
+
73
+ When a primary working tree moves away from `main` or `master`, the project is
74
+ absent until it returns. The viewer reads the most recent successfully published
75
+ business map for that primary working tree even when newer source changes make
76
+ the publication freshness `stale`. This is a browsing surface, not an indexing
77
+ gate: it never indexes or repairs the repository merely to answer a map request.
78
+ Missing, building, failed, or structurally incomplete publications remain
79
+ unavailable because there is no complete published map to read.
80
+
81
+ ## Read-only lifecycle
82
+
83
+ `semantic-atlas web` starts one local server on `127.0.0.1`, optionally opens
84
+ the default browser, and remains active until interrupted. The server exposes
85
+ only the GET operations defined by [HTTP API v1](../contracts/http-api-v1.md).
86
+
87
+ The viewer never:
88
+
89
+ - invokes `index`, `learn`, GraphPatch, feedback mutation, or Git mutation;
90
+ - edits source, tests, configuration, Skills, or generated project state;
91
+ - accepts an arbitrary repository path from an HTTP client;
92
+ - returns linked worktrees or permits branch selection;
93
+ - exposes CodeGraph APIs, storage schema, structural search, or unrestricted
94
+ source traversal.
95
+
96
+ Reads for one repository are serialized. Every map, search, and node request
97
+ uses the most recent complete publication for the current primary `main` or
98
+ `master` working tree and retains the existing publication-change check. A
99
+ publication change during a query fails the request instead of combining two
100
+ snapshots.
101
+
102
+ ## Desktop information architecture
103
+
104
+ The first release targets desktop browsers only.
105
+
106
+ ```text
107
+ +------------------+-----------------------------------------------+
108
+ | Projects | Breadcrumb Search |
109
+ | +-----------------------------------------------+
110
+ | semantic-atlas | |
111
+ | sample-project | Visible business regions and relationships |
112
+ | | |
113
+ | | Detail panel |
114
+ +------------------+-----------------------------------------------+
115
+ ```
116
+
117
+ - The left rail lists eligible `main` or `master` projects and their current
118
+ publication state.
119
+ - The header contains the current business breadcrumb and project-scoped
120
+ business search.
121
+ - The main surface starts with the top-level `BusinessMapView`, then reads a
122
+ focused map only when the user enters that region or semantic zoom reaches
123
+ its next level. It does not request or draw the full graph.
124
+ - Selecting a region opens its business summary and direct relationships.
125
+ - Entering an expandable region requests its focused map view. Breadcrumb
126
+ selection returns to an established ancestor.
127
+ - Search ranks existing business vocabulary. Selecting a result focuses its
128
+ map view and node details.
129
+
130
+ Business `kind` remains existing Atlas data. It informs the node color and the
131
+ concise detail panel without adding a competing label to the map. Certainty and
132
+ validity remain part of the read model, while this human browsing surface keeps
133
+ the map focused on business names and available child counts.
134
+
135
+ ### Spatial map interaction contract
136
+
137
+ - The project hub is a virtual center. Top-level regions occupy a complete
138
+ deterministic ring; children expand in the outward-facing sector of their
139
+ parent. Existing positions never move when another branch is loaded.
140
+ - Each selected project owns an in-memory map cache containing loaded focused
141
+ maps, parentage, asserted connections, coordinates, camera state, and pending
142
+ reads. It is cleared when the project changes and is never written to Atlas.
143
+ - Hierarchy paths connect a node to its parent using neutral solid lines.
144
+ Asserted or projected business relationships use a distinct highlighted line
145
+ treatment without exposing raw relation labels on the map, so navigation
146
+ topology is not presented as a stored business assertion.
147
+ - Business regions are compact graph nodes, not content cards. Their label,
148
+ and, when present, child count remain visible. Existing `kind`, validity,
149
+ summaries, and evidence stay in the data model or concise detail panel rather
150
+ than competing with business labels on the map. A leaf node has no secondary
151
+ map text; an expandable node shows only its `N 项` child count.
152
+ - Selecting a node opens its details. Selecting an expandable node loads its
153
+ focused map once, moves the camera to it, and zooms to the next semantic
154
+ level; selecting a leaf only centers it and reads its details. Breadcrumbs
155
+ move the camera to loaded ancestors rather than switching a page.
156
+ - Pointer drag pans the canvas. The wheel and controls zoom between `0.2` and
157
+ `4.8`; wheel zoom remains anchored to the pointer. A fit control restores the
158
+ complete loaded map.
159
+ - The map toolbar offers an immersive desktop mode. It hides the project rail,
160
+ surrounding navigation, and detail panel while preserving the selected node,
161
+ loaded map cache, and camera context; the same control or `Escape` restores
162
+ the normal product view.
163
+ - Roots remain visible at every scale. Deeper levels appear at
164
+ `0.55 * 1.6^(depth - 1)` and disappear visually below that threshold without
165
+ deleting their cached maps, nodes, or coordinates. A relationship line is
166
+ visible only while both of its endpoint regions are visible, so semantic
167
+ zoom never leaves a line pointing to a hidden region. Crossing a threshold
168
+ can load the nearby or selected expandable region.
169
+ - Search selection fills any missing focused-map path, then moves the camera to
170
+ the matching node and opens its details; it does not create a separate
171
+ list-based navigation model.
172
+
173
+ A card grid, tree list, or dashboard tile collection does not satisfy the map
174
+ surface contract. Cards may appear in search results or supporting details,
175
+ but they do not replace the spatial node-and-connection canvas.
176
+
177
+ The visual language is a light, neutral product interface with strong
178
+ typography, restrained color, legible topology, thin relationships, and short
179
+ state transitions. It does not use game styling, character metaphors,
180
+ decorative map textures, elaborate animation, or mobile-specific layouts.
181
+
182
+ The desktop viewer uses Simplified Chinese for its fixed interface copy. It
183
+ keeps authored business labels and summaries in their recorded language rather
184
+ than attempting an unreliable browser-side translation. The normal view keeps
185
+ only the project selector, compact path, search, map, camera controls, and a
186
+ small business-detail panel. Decorative branding, project diagnostics, map
187
+ legends, and instructional copy stay outside the primary viewing surface.
188
+
189
+ The detail panel describes the selected business region with its summary, the
190
+ existing business kind in the viewer locale, and nearby business names. It does
191
+ not expose aliases, evidence files, source symbols, certainty or validity
192
+ chips, raw relationship names, or incoming/outgoing direction. Those concepts
193
+ remain part of the read API and Agent evidence model; the human viewer does not
194
+ need them to browse business knowledge. Detail text and related-business names
195
+ wrap within the panel so long recorded labels cannot overflow the layout.
196
+
197
+ ## Empty and unavailable states
198
+
199
+ - No eligible repositories: explain that the viewer lists only primary
200
+ `main`/`master` working trees with Atlas state.
201
+ - Missing business knowledge: show the existing
202
+ `BUSINESS_KNOWLEDGE_EMPTY` state without substituting code directories.
203
+ - Stale repository publication: continue to show the most recent complete
204
+ primary-branch map. A later CLI or Agent index can refresh it, but browsing
205
+ remains available in the meantime.
206
+ - Stale assertion: retain the node vocabulary and label the summary or relation
207
+ as stale.
208
+ - Unknown project or node: return a typed not-found response without revealing
209
+ filesystem candidates.
210
+
211
+ ## Acceptance boundary
212
+
213
+ The slice is complete when a packaged installation can start
214
+ `semantic-atlas web`, list only primary `main`/`master` repositories, navigate a
215
+ current world and focused views through a pannable and zoomable spatial map,
216
+ search business nodes, inspect one node, serve no mutation endpoint, and leave
217
+ source, Git state, Atlas knowledge, and the Agent CLI behavior unchanged.
218
+
219
+ ## Related contracts
220
+
221
+ - [Product contract](../product-contract.md)
222
+ - [Graph model](../contracts/graph-model.md)
223
+ - [CLI v1](../contracts/cli-v1.md)
224
+ - [HTTP API v1](../contracts/http-api-v1.md)
225
+ - [Continuous business learning](continuous-business-learning.md)
@@ -4,12 +4,14 @@
4
4
 
5
5
  The npm package and executable are both named `semantic-atlas`. Development uses Node.js 24; the published CLI supports Node.js 22.12 through 24.
6
6
 
7
- Repository-independent commands run before Git, Atlas storage, or SQLite is
8
- opened:
7
+ Repository-independent lifecycle commands run before Git, Atlas storage, or
8
+ SQLite is opened:
9
9
 
10
10
  | Command | Contract |
11
11
  | --- | --- |
12
- | `setup` | Atomically install or update the exact bundled Skill at `~/.agents/skills/semantic-atlas`. A recognized legacy `~/.codex/skills/semantic-atlas` copy is removed after the shared installation succeeds. |
12
+ | `setup` | Atomically install or update the exact bundled `semantic-atlas` and `semantic-atlas-insights` Skills at `~/.agents/skills/`. A recognized legacy `~/.codex/skills/semantic-atlas` copy is removed after the shared installation succeeds. |
13
+ | `upgrade` | Resolve npm's `latest` tag, install that exact release globally, verify the new executable, and invoke the new package's `setup`. An already-current package still verifies and repairs its bundled Skills. |
14
+ | `web` | Start the loopback, desktop-only, read-only Web viewer and HTTP API. The project catalog contains only primary working trees on `main` or `master` and excludes linked worktrees. |
13
15
  | `-h`, `--help` | Print top-level usage and command help. |
14
16
  | `--version` | Print the installed package version. |
15
17
 
@@ -19,10 +21,36 @@ repeated execution verifies the installed files and restores a changed managed
19
21
  copy. A directory that does not identify itself as the Semantic Atlas Skill is
20
22
  reported as a conflict and left unchanged.
21
23
 
24
+ `upgrade` resolves a version before mutation and installs
25
+ `semantic-atlas@<resolved-version>` rather than leaving the install step bound to
26
+ a moving tag. It locates the new package through npm's global root and starts its
27
+ CLI through the current Node executable, so Skill synchronization is owned by
28
+ the package that was actually installed. Registry lookup, package installation,
29
+ new-version verification, and Skill synchronization are one fail-closed command:
30
+ any failed step returns exit code `1` and does not report the upgrade as ready.
31
+ `setup` and `upgrade` do not discover a Git repository or open Atlas storage.
32
+ `web` discovers existing Atlas repository stores, validates their primary Git
33
+ working trees, starts on `127.0.0.1`, and remains active until interrupted. It
34
+ does not write a project JSON envelope because its output is the local server
35
+ address and lifecycle diagnostics. The browser uses [HTTP API v1](http-api-v1.md),
36
+ not CLI subprocesses.
37
+ Installation-scoped `insights` commands also avoid Git and repository Atlas
38
+ storage, while opening the separate local insights store described in
39
+ [Insights v1](insights-v1.md).
40
+
22
41
  Global project options:
23
42
 
24
43
  - `--repo <path>` selects a directory within the target repository; the default is the current directory.
25
- - `--pretty` indents JSON without changing fields or values.
44
+ - `--pretty` indents a project or insights JSON envelope without changing fields or values.
45
+
46
+ Web options:
47
+
48
+ - `--port <n>` selects a TCP port from `1` through `65535`; the default is
49
+ `4310`.
50
+ - `--no-open` starts the server without opening the default browser.
51
+ - `--repo <path>` selects the initial project only when the path resolves to an
52
+ eligible primary working tree on `main` or `master`. It does not add or expose
53
+ a linked worktree.
26
54
 
27
55
  Project commands:
28
56
 
@@ -36,6 +64,7 @@ Project commands:
36
64
  | `code search <structural-term> [--limit <n>]` | Return bounded structural symbols and source locations when business knowledge is absent or insufficient; the default limit is 20. |
37
65
  | `learn --stdin` | Read one complete GraphPatch v1 JSON value from standard input and apply it atomically. |
38
66
  | `changes [--from <snapshot-id>] [--to <snapshot-id>]` | Report net semantic graph changes between persisted Atlas snapshot endpoints, not a raw Git diff. The source must be an ancestor of the target in the publication chain; defaults compare the previous and current snapshots. |
67
+ | `feedback report --stdin` | Store an explicit, evidence-contextual product problem or suggestion after source confirmation. The report links nearby local command-event IDs without storing arguments or output. |
39
68
 
40
69
  `map` commands expose business navigation. `code search` is the explicit structural fallback. The calling agent extracts concepts, reformulates searches, opens returned source locations, and judges impact.
41
70
 
@@ -90,6 +119,7 @@ The schema requires these fields while allowing additive fields inside command d
90
119
  | `code.search` | `query`, `limit`, scored structural-only `results` with source locations and support |
91
120
  | `learn` | `baseSnapshotId`, `snapshotId`, applied operation counts |
92
121
  | `changes` | source and target snapshot IDs, node/relation change sets, stale assertions |
122
+ | `feedback.report` | created report ID, classification, source-confirmed flag, status, and linked-event count |
93
123
 
94
124
  `index.facts` uses one structural-fact unit across every publication: one backend node or
95
125
  relation is one fact. `added`, `changed`, and `reused` partition the facts in the newly
@@ -105,6 +135,12 @@ Each connection identifies visible business endpoints and groups summaries by re
105
135
 
106
136
  `BUSINESS_KNOWLEDGE_EMPTY` is the stable warning code for a current indexed world with no learned business nodes. World `map.view` returns an empty `regions` array in this state. Structural modules and symbols remain discoverable through `code.search`; they are never emitted as business regions.
107
137
 
138
+ `feedback report --stdin` accepts one strict JSON object with `kind`, `category`,
139
+ `impact`, `observed`, `expected`, optional `suggestion`, and `sourceConfirmed`.
140
+ The report itself is explicit feedback; the surrounding passive command event
141
+ contains only objective metadata. It is operational product data and never a
142
+ GraphPatch or business-world assertion.
143
+
108
144
  Change ranges follow the current publication history and fold the requested endpoints into one content comparison. When a content-addressed snapshot was published more than once, `--to` selects its latest occurrence in that history and `--from` selects the latest matching occurrence at or before the target; equal IDs compare the selected occurrence with itself. Paths that have the same presence and content at both endpoints are omitted even if they changed in between, while `staleAssertions` reports the selected target occurrence's final validity state. An unknown target has no change result.
109
145
 
110
146
  ## Errors