Bonded-escrow marketplace for prompt → response between buyers and
local-LLM suppliers, settling on Vector (UTxO) via Aiken Plutus V3
validators. Lifecycle PostEscrow → Claim → Submit → Accept proven on
Vector testnet 2026-05-06; AcceptEscrow tx 125e3cfe…7dc100d distributes
payment + bonds per the validator's distribution rule.
Workspace layout (pnpm + TypeScript):
contracts/marketplace/ Aiken validators (advert + escrow) + plutus.json
packages/shared/ Tx-builders (lucid-evolution), CBOR codecs,
chain providers (mock / read-only / live Ogmios)
supplier/ OpenAI-compatible HTTP node (Ollama by default;
vLLM / llama.cpp / OpenRouter / OpenClaw all
swap-in via OLLAMA_URL); 202+poll chat handler
buyer/ Express + React SPA; server-side runs the full
chain lifecycle via /v1/submit-prompt and
/v1/accept; SPA never holds the buyer key
indexer/ Chain-follower (extends apex-dashboard pattern),
SSE event stream + REST queries
indexer-ui/ Operator dashboard (events + suppliers + escrow
lookup)
tests/ 1098 vitest unit + integration tests (10 skipped
under M1-F-D-defer for UPLC test plumbing)
deploy/testnet/ Per-service docker-compose for the Hetzner stack
docs/EXECUTIVE_SUMMARY.* Marp deck (PDF + PPTX) — 11 slides, mermaid
diagrams pre-rendered for portable export
docs/CLOUDFLARE_WAF_BYPASS.md CF Skip-rule runbook for /v1/* paths
docs/ARCHITECTURE.md canonical spec
Live demo (testnet, 2026-05-06):
https://mp-buyers.vector.testnet.apexfusion.org (buyer SPA)
https://mp-suppliers.vector.testnet.apexfusion.org (supplier API)
https://mp-indexer.vector.testnet.apexfusion.org (indexer + UI)
50 lines
2.1 KiB
TypeScript
50 lines
2.1 KiB
TypeScript
/**
|
|
* tests/unit/indexer-config-ui.test.ts — RED phase (M1-F-5)
|
|
*
|
|
* Category H: INDEXER_UI_DIST config extension (~3 tests)
|
|
*
|
|
* Tests FAIL until M1-F-5-green because loadConfig does not yet accept or
|
|
* return uiDistDir.
|
|
*
|
|
* Design contract for Catherine:
|
|
* - loadConfig(env) extended with optional INDEXER_UI_DIST env var
|
|
* - When INDEXER_UI_DIST is set, IndexerConfig.uiDistDir = <value>
|
|
* - When INDEXER_UI_DIST is absent, IndexerConfig.uiDistDir is undefined
|
|
* (no UI mount, backwards-compatible)
|
|
* - INDEXER_UI_DIST is NOT validated (any string is accepted — directory
|
|
* existence is checked at server startup, not config load time)
|
|
*/
|
|
|
|
import { describe, it, expect } from "vitest";
|
|
import { loadConfig } from "../../indexer/src/config.js";
|
|
|
|
const VALID_BASE_ENV = {
|
|
OGMIOS_URL: "ws://localhost:1337",
|
|
DB_PATH: "/tmp/indexer.db",
|
|
NETWORK_ID: "0",
|
|
};
|
|
|
|
describe("loadConfig — INDEXER_UI_DIST", () => {
|
|
it("RED: INDEXER_UI_DIST=/some/path → config.uiDistDir === '/some/path'", () => {
|
|
// RED: loadConfig does not yet return uiDistDir — M1-F-5-green adds it.
|
|
const config = loadConfig({ ...VALID_BASE_ENV, INDEXER_UI_DIST: "/some/path" }) as ReturnType<typeof loadConfig> & { uiDistDir?: string };
|
|
expect(config.uiDistDir).toBe("/some/path");
|
|
});
|
|
|
|
it("RED: uiDistDir is undefined when INDEXER_UI_DIST is absent (no UI mount)", () => {
|
|
// RED: currently loadConfig has no uiDistDir field. After green it must be
|
|
// present but undefined when the env var is absent.
|
|
const config = loadConfig({ ...VALID_BASE_ENV }) as ReturnType<typeof loadConfig> & { uiDistDir?: string };
|
|
expect(config.uiDistDir).toBeUndefined();
|
|
});
|
|
|
|
it("RED: INDEXER_UI_DIST accepts any non-empty string (no directory existence check at config time)", () => {
|
|
// Any string path is valid; directory existence is checked at server startup.
|
|
const config = loadConfig({
|
|
...VALID_BASE_ENV,
|
|
INDEXER_UI_DIST: "/repo/indexer-ui/dist",
|
|
}) as ReturnType<typeof loadConfig> & { uiDistDir?: string };
|
|
expect(config.uiDistDir).toBe("/repo/indexer-ui/dist");
|
|
});
|
|
});
|