import { defineConfig } from "tsup";

export default defineConfig({
  entry: [
    "src/index.ts",
    "src/access-cli.ts",
    "src/adapters/claude-code.ts",
    "src/adapters/codex.ts",
    "src/adapters/hermes.ts",
    "src/adapters/index.ts",
    "src/adapters/registry.ts",
    "src/adapters/replit.ts",
    "src/adapters/types.ts",
    "src/cli.ts",
    "src/compat/checks.ts",
    "src/compat/types.ts",
    "src/connectors/index.ts",
    "src/connectors/codex-materialize.ts",
    "src/connectors/codex-materialize-runner.ts",
    "src/consolidation-operator.ts",
    "src/consolidation-provenance-check.ts",
    "src/consolidation-undo.ts",
    "src/conversation-index/backend.ts",
    "src/conversation-index/chunker.ts",
    "src/conversation-index/cleanup.ts",
    "src/conversation-index/faiss-adapter.ts",
    "src/conversation-index/indexer.ts",
    "src/conversation-index/search.ts",
    "src/delinearize.ts",
    "src/embedding-fallback.ts",
    "src/enrichment.ts",
    "src/entity-retrieval.ts",
    "src/evals.ts",
    "src/extraction.ts",
    "src/explicit-capture.ts",
    "src/fallback-llm.ts",
    "src/graph-dashboard-diff.ts",
    "src/graph-dashboard-key.ts",
    "src/graph-dashboard-parser.ts",
    "src/graph-edge-reinforcement.ts",
    "src/graph-events.ts",
    "src/graph-snapshot.ts",
    "src/graph.ts",
    "src/harmonic-retrieval.ts",
    "src/himem.ts",
    "src/hygiene.ts",
    "src/identity-continuity.ts",
    "src/importance.ts",
    "src/json-store.ts",
    "src/lcm/archive.ts",
    "src/lcm/dag.ts",
    "src/lcm/engine.ts",
    "src/lcm/index.ts",
    "src/lcm/queue.ts",
    "src/lcm/recall.ts",
    "src/lcm/schema.ts",
    "src/lcm/summarizer.ts",
    "src/lcm/tools.ts",
    "src/maintenance/archive-observations.ts",
    "src/maintenance/backup-stamp.ts",
    "src/maintenance/memory-governance.ts",
    "src/maintenance/memory-governance-cron.ts",
    "src/maintenance/migrate-observations.ts",
    "src/maintenance/observation-ledger-utils.ts",
    "src/maintenance/rebuild-memory-lifecycle-ledger.ts",
    "src/maintenance/rebuild-memory-projection.ts",
    "src/maintenance/rebuild-observations.ts",
    "src/memory-projection-format.ts",
    "src/memory-projection-store.ts",
    "src/migrate/from-engram.ts",
    "src/model-registry.ts",
    "src/models-json.ts",
    "src/namespaces/migrate.ts",
    "src/namespaces/principal.ts",
    "src/namespaces/search.ts",
    "src/namespaces/storage.ts",
    "src/openai-chat-compat.ts",
    "src/operator-toolkit.ts",
    "src/opik-exporter.ts",
    "src/orchestrator.ts",
    "src/profiling.ts",
    "src/qmd.ts",
    "src/qmd-recall-cache.ts",
    "src/reconstruct.ts",
    "src/relevance.ts",
    "src/rerank.ts",
    "src/retrieval.ts",
    "src/retrieval-agents.ts",
    "src/replay/normalizers/chatgpt.ts",
    "src/replay/normalizers/claude.ts",
    "src/replay/normalizers/openclaw.ts",
    "src/replay/normalizers/shared.ts",
    "src/replay/runner.ts",
    "src/replay/types.ts",
    "src/resume-bundles.ts",
    "src/routing/engine.ts",
    "src/routing/store.ts",
    "src/runtime/better-sqlite.ts",
    "src/runtime/child-process.ts",
    "src/runtime/env.ts",
    "src/sanitize.ts",
    "src/search/document-scanner.ts",
    "src/search/embed-helper.ts",
    "src/search/factory.ts",
    "src/search/index.ts",
    "src/search/lancedb-backend.ts",
    "src/search/meilisearch-backend.ts",
    "src/search/noop-backend.ts",
    "src/search/orama-backend.ts",
    "src/search/port.ts",
    "src/search/remote-backend.ts",
    "src/secure-store/index.ts",
    "src/schemas.ts",
    "src/sdk-compat.ts",
    "src/session-observer-bands.ts",
    "src/session-observer-state.ts",
    "src/session-integrity.ts",
    "src/shared-context/manager.ts",
    "src/signal.ts",
    "src/source-attribution.ts",
    "src/store-contract.ts",
    "src/summarizer.ts",
    "src/summary-snapshot.ts",
    "src/temporal-index.ts",
    "src/temporal-validity.ts",
    "src/tier-migration.ts",
    "src/tier-routing.ts",
    "src/threading.ts",
    "src/tmt.ts",
    "src/topics.ts",
    "src/transcript.ts",
    "src/trust-zones.ts",
    "src/types.ts",
    "src/utility-learner.ts",
    "src/utility-telemetry.ts",
    "src/transfer/autodetect.ts",
    "src/transfer/backup.ts",
    "src/transfer/capsule-export.ts",
    "src/transfer/capsule-import.ts",
    "src/transfer/constants.ts",
    "src/transfer/export-json.ts",
    "src/transfer/export-md.ts",
    "src/transfer/export-sqlite.ts",
    "src/transfer/fs-utils.ts",
    "src/transfer/import-json.ts",
    "src/transfer/import-md.ts",
    "src/transfer/import-sqlite.ts",
    "src/transfer/sqlite-schema.ts",
    "src/transfer/types.ts",
    "src/work/board.ts",
    "src/work/boundary.ts",
    "src/work/storage.ts",
    "src/work/types.ts",
  ],
  format: ["esm"],
  target: "es2022",
  platform: "node",
  outDir: "dist",
  clean: true,
  sourcemap: true,
  dts: false,
  external: [
    "openclaw",
    "@node-rs/argon2",
    "@lancedb/lancedb",
    "meilisearch",
    "@orama/orama",
    "@orama/plugin-data-persistence",
  ],
  banner: {
    js: "// openclaw-engram: Local-first memory plugin",
  },
});
