// src/components/docs/knowledge/KnowledgeSpacesPage.tsx
import Link from "@contractspec/lib.ui-link";
import { ChevronRight } from "lucide-react";
import { jsx, jsxs } from "react/jsx-runtime";
function KnowledgeSpacesPage() {
  return /* @__PURE__ */ jsxs("div", {
    className: "space-y-8",
    children: [
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h1", {
            className: "text-4xl font-bold",
            children: "Knowledge Spaces"
          }),
          /* @__PURE__ */ jsxs("p", {
            className: "text-muted-foreground",
            children: [
              "A ",
              /* @__PURE__ */ jsx("strong", {
                children: "KnowledgeSpaceSpec"
              }),
              " defines a logical domain of knowledge with a specific category, storage strategy, and intended audience. Spaces are defined globally and populated per-tenant through knowledge sources."
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "KnowledgeSpaceSpec"
          }),
          /* @__PURE__ */ jsx("div", {
            className: "bg-background/50 border-border text-muted-foreground overflow-x-auto rounded-lg border p-4 font-mono text-sm",
            children: /* @__PURE__ */ jsx("pre", {
              children: `type KnowledgeSpaceSpec = {
  id: string;
  label: string;
  description: string;
  
  // Trust and access
  category: KnowledgeCategory;
  intendedAudience: "agents" | "humans" | "admin-only";
  
  // Storage and indexing
  storageStrategy: "vector" | "search" | "hybrid";
  indexProvider: string;  // e.g., "qdrant", "elasticsearch"
  vectorDimensions?: number;  // For vector storage
  
  // Lifecycle
  retentionPolicy: {
    days?: number;
    versions?: number;
  };
  
  // Metadata
  tags?: string[];
  owner?: string;
  createdAt: string;
  updatedAt: string;
};`
            })
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Common knowledge spaces"
          }),
          /* @__PURE__ */ jsxs("div", {
            className: "space-y-6",
            children: [
              /* @__PURE__ */ jsxs("div", {
                className: "card-subtle p-4",
                children: [
                  /* @__PURE__ */ jsx("h3", {
                    className: "mb-2 text-lg font-semibold",
                    children: "Product Canon"
                  }),
                  /* @__PURE__ */ jsx("div", {
                    className: "bg-background/50 border-border text-muted-foreground overflow-x-auto rounded border p-3 font-mono text-xs",
                    children: /* @__PURE__ */ jsx("pre", {
                      children: `{
  id: "product-canon",
  label: "Product Canon",
  description: "Official product specifications and schemas",
  category: "canonical",
  intendedAudience: "agents",
  storageStrategy: "hybrid",
  indexProvider: "qdrant",
  vectorDimensions: 1536,
  retentionPolicy: { versions: 10 }
}`
                    })
                  }),
                  /* @__PURE__ */ jsxs("p", {
                    className: "text-muted-foreground mt-2 text-sm",
                    children: [
                      /* @__PURE__ */ jsx("strong", {
                        children: "Use cases:"
                      }),
                      " Invoice generation, quote creation, product recommendations, schema validation"
                    ]
                  })
                ]
              }),
              /* @__PURE__ */ jsxs("div", {
                className: "card-subtle p-4",
                children: [
                  /* @__PURE__ */ jsx("h3", {
                    className: "mb-2 text-lg font-semibold",
                    children: "Support History"
                  }),
                  /* @__PURE__ */ jsx("div", {
                    className: "bg-background/50 border-border text-muted-foreground overflow-x-auto rounded border p-3 font-mono text-xs",
                    children: /* @__PURE__ */ jsx("pre", {
                      children: `{
  id: "support-history",
  label: "Support History",
  description: "Past support tickets and resolutions",
  category: "operational",
  intendedAudience: "agents",
  storageStrategy: "vector",
  indexProvider: "qdrant",
  vectorDimensions: 1536,
  retentionPolicy: { days: 365 }
}`
                    })
                  }),
                  /* @__PURE__ */ jsxs("p", {
                    className: "text-muted-foreground mt-2 text-sm",
                    children: [
                      /* @__PURE__ */ jsx("strong", {
                        children: "Use cases:"
                      }),
                      " Customer support, troubleshooting, similar issue detection"
                    ]
                  })
                ]
              }),
              /* @__PURE__ */ jsxs("div", {
                className: "card-subtle p-4",
                children: [
                  /* @__PURE__ */ jsx("h3", {
                    className: "mb-2 text-lg font-semibold",
                    children: "External Provider Docs"
                  }),
                  /* @__PURE__ */ jsx("div", {
                    className: "bg-background/50 border-border text-muted-foreground overflow-x-auto rounded border p-3 font-mono text-xs",
                    children: /* @__PURE__ */ jsx("pre", {
                      children: `{
  id: "provider-docs",
  label: "External Provider Docs",
  description: "Third-party integration documentation",
  category: "external",
  intendedAudience: "agents",
  storageStrategy: "search",
  indexProvider: "elasticsearch",
  retentionPolicy: { days: 90 }
}`
                    })
                  }),
                  /* @__PURE__ */ jsxs("p", {
                    className: "text-muted-foreground mt-2 text-sm",
                    children: [
                      /* @__PURE__ */ jsx("strong", {
                        children: "Use cases:"
                      }),
                      " Integration help, API reference, troubleshooting external services"
                    ]
                  })
                ]
              }),
              /* @__PURE__ */ jsxs("div", {
                className: "card-subtle p-4",
                children: [
                  /* @__PURE__ */ jsx("h3", {
                    className: "mb-2 text-lg font-semibold",
                    children: "Agent Scratchpad"
                  }),
                  /* @__PURE__ */ jsx("div", {
                    className: "bg-background/50 border-border text-muted-foreground overflow-x-auto rounded border p-3 font-mono text-xs",
                    children: /* @__PURE__ */ jsx("pre", {
                      children: `{
  id: "agent-scratchpad",
  label: "Agent Scratchpad",
  description: "Temporary agent working memory",
  category: "ephemeral",
  intendedAudience: "agents",
  storageStrategy: "vector",
  indexProvider: "qdrant",
  vectorDimensions: 1536,
  retentionPolicy: { days: 1 }
}`
                    })
                  }),
                  /* @__PURE__ */ jsxs("p", {
                    className: "text-muted-foreground mt-2 text-sm",
                    children: [
                      /* @__PURE__ */ jsx("strong", {
                        children: "Use cases:"
                      }),
                      " Conversation continuity, intermediate calculations, session state"
                    ]
                  })
                ]
              })
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Storage strategies"
          }),
          /* @__PURE__ */ jsx("div", {
            className: "border-border/50 overflow-x-auto rounded-lg border",
            children: /* @__PURE__ */ jsxs("table", {
              className: "w-full text-left text-sm",
              children: [
                /* @__PURE__ */ jsx("thead", {
                  className: "bg-card/50",
                  children: /* @__PURE__ */ jsxs("tr", {
                    className: "border-border/50 border-b",
                    children: [
                      /* @__PURE__ */ jsx("th", {
                        className: "px-4 py-3 font-semibold",
                        children: "Strategy"
                      }),
                      /* @__PURE__ */ jsx("th", {
                        className: "px-4 py-3 font-semibold",
                        children: "Best For"
                      }),
                      /* @__PURE__ */ jsx("th", {
                        className: "px-4 py-3 font-semibold",
                        children: "Providers"
                      })
                    ]
                  })
                }),
                /* @__PURE__ */ jsxs("tbody", {
                  className: "divide-border/50 divide-y",
                  children: [
                    /* @__PURE__ */ jsxs("tr", {
                      children: [
                        /* @__PURE__ */ jsx("td", {
                          className: "px-4 py-3 font-mono text-xs",
                          children: "vector"
                        }),
                        /* @__PURE__ */ jsx("td", {
                          className: "px-4 py-3",
                          children: "Semantic search, RAG, similarity matching"
                        }),
                        /* @__PURE__ */ jsx("td", {
                          className: "px-4 py-3",
                          children: "Qdrant, Pinecone, Weaviate"
                        })
                      ]
                    }),
                    /* @__PURE__ */ jsxs("tr", {
                      children: [
                        /* @__PURE__ */ jsx("td", {
                          className: "px-4 py-3 font-mono text-xs",
                          children: "search"
                        }),
                        /* @__PURE__ */ jsx("td", {
                          className: "px-4 py-3",
                          children: "Keyword search, exact matching, filtering"
                        }),
                        /* @__PURE__ */ jsx("td", {
                          className: "px-4 py-3",
                          children: "Elasticsearch, Algolia"
                        })
                      ]
                    }),
                    /* @__PURE__ */ jsxs("tr", {
                      children: [
                        /* @__PURE__ */ jsx("td", {
                          className: "px-4 py-3 font-mono text-xs",
                          children: "hybrid"
                        }),
                        /* @__PURE__ */ jsx("td", {
                          className: "px-4 py-3",
                          children: "Combined semantic + keyword search"
                        }),
                        /* @__PURE__ */ jsx("td", {
                          className: "px-4 py-3",
                          children: "Qdrant + Elasticsearch"
                        })
                      ]
                    })
                  ]
                })
              ]
            })
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Best practices"
          }),
          /* @__PURE__ */ jsxs("ul", {
            className: "text-muted-foreground list-inside list-disc space-y-2",
            children: [
              /* @__PURE__ */ jsx("li", {
                children: "Choose storage strategy based on query patterns - use vector for semantic, search for exact"
              }),
              /* @__PURE__ */ jsx("li", {
                children: "Set appropriate retention policies - canonical is permanent, ephemeral is short-lived"
              }),
              /* @__PURE__ */ jsx("li", {
                children: "Use consistent vector dimensions across spaces that will be queried together"
              }),
              /* @__PURE__ */ jsx("li", {
                children: "Document the intended audience and use cases for each space"
              }),
              /* @__PURE__ */ jsx("li", {
                children: "Monitor space size and query performance - add sharding if needed"
              })
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "flex items-center gap-4 pt-4",
        children: [
          /* @__PURE__ */ jsx(Link, {
            href: "/docs/knowledge/categories",
            className: "btn-ghost",
            children: "Previous: Categories"
          }),
          /* @__PURE__ */ jsxs(Link, {
            href: "/docs/knowledge/sources",
            className: "btn-primary",
            children: [
              "Knowledge Sources ",
              /* @__PURE__ */ jsx(ChevronRight, {
                size: 16
              })
            ]
          })
        ]
      })
    ]
  });
}
export {
  KnowledgeSpacesPage
};
