Files
agents-marketplace/vitest.config.ts
david 6de62b8cf0 feat(gateway): OpenAI-compatible custodial gateway
New multi-tenant gateway package: external developers point any OpenAI SDK at
the marketplace. Each API key is its own custodial buyer wallet (AES-256-GCM
sealed under GATEWAY_MASTER_KEY); every request posts an on-chain escrow from
that user's wallet.

- POST /openai/v1/chat/completions (one escrow/call, llm.text.generate.v1,
  buffered + pseudo-stream), chat sessions (one escrow/session, llm.chat.v1,
  real SSE), GET /openai/v1/models, /signup, /account, /account/withdraw.
- Settles by resolving the Submitted ref via the indexer + awaited Accept;
  state-aware reclaim sweeper + per-wallet auto-consolidation for collateral.
- Reuses the buyer Marketplace SDK via new buyer exports ./sdk; new shared
  buildWithdrawTx (custodial exit). Runs via tsx; Dockerfile + mainnet compose.

Design in docs/gateway.md. Typecheck passes for all packages; 20 vitest tests
pass. Not yet exercised against a live chain.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-22 10:22:58 +02:00

57 lines
2.1 KiB
TypeScript

import { defineConfig } from "vitest/config";
import { fileURLToPath } from "node:url";
import { dirname, resolve } from "node:path";
import react from "@vitejs/plugin-react";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export default defineConfig({
plugins: [react()],
cacheDir: ".vitest-cache",
resolve: {
alias: {
// The lucid-evolution packages are devDeps of @marketplace/shared and
// therefore live under packages/shared/node_modules. Tests in tests/unit
// import them as bare specifiers (e.g. `from "@lucid-evolution/lucid"`),
// which Node's resolver cannot satisfy from the root cwd because there
// is no @lucid-evolution entry in the root node_modules. Aliasing both
// packages to their concrete entry-points lets vitest resolve them
// regardless of the importing file's location.
"@lucid-evolution/lucid": resolve(
__dirname,
"packages/shared/node_modules/@lucid-evolution/lucid/dist/index.js",
),
"@lucid-evolution/plutus": resolve(
__dirname,
"packages/shared/node_modules/@lucid-evolution/plutus/dist/index.js",
),
"@lucid-evolution/uplc": resolve(
__dirname,
"node_modules/.pnpm/@lucid-evolution+uplc@0.2.20/node_modules/@lucid-evolution/uplc/dist/node/uplc_tx.js",
),
},
},
test: {
include: [
"tests/unit/**/*.{test,spec}.ts",
"tests/unit/**/*.{test,spec}.tsx",
"tests/ogmios/**/*.{test,spec}.ts",
"tests/lifecycle/**/*.{test,spec}.ts",
"packages/**/*.{test,spec}.ts",
"buyer/**/*.{test,spec}.ts",
"buyer/**/*.{test,spec}.tsx",
"gateway/**/*.{test,spec}.ts",
"supplier/**/*.{test,spec}.ts",
"indexer/**/*.{test,spec}.ts",
],
exclude: ["**/node_modules/**", "**/dist/**"],
passWithNoTests: true,
// Per-file environment override via @vitest-environment docblock is still
// supported; default remains "node" for all non-UI tests.
environment: "node",
globals: true,
setupFiles: ["./tests/setup.ts"],
},
});