45bfae6e94
Initial import of all source code, config, and README assets: the packages workspace (cli, core, server, web, docs, landing, skills), build scripts, tooling config, and CI workflows. Includes the data-layout revision made on this branch: the local data root defaults to ~/.penguin/data (PENGUIN_HOME still overrides; the installer keeps its binaries in ~/.penguin), and every Agent lives under <project>/agents/<agent>/ — path helpers, the three agent-enumeration scans, the system prompt, built-in Skills, tests and docs all follow the new layout. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ihk8iQuo3kv2aPjAYEPuR
509 lines
23 KiB
TypeScript
509 lines
23 KiB
TypeScript
/**
|
||
* Model config integration tests: both a fresh Project and the admin-seeded default_project come
|
||
* preloaded with the built-in model catalog (`provider` and `model_id` are **stored as separate
|
||
* columns**; the (provider, model_id) pair is the unique key, ids are never concatenated, and the user
|
||
* only adds an API key); credentials are inlined in the single config file `.project_config.toml`
|
||
* (0600); GET models looks up the catalog by the paired ref to fill in displayName / envKey, taking
|
||
* vision from the TOML annotation and falling back to the catalog default; PUT persists a custom
|
||
* model's vision and an OPENAI_API_KEY fallback for client_type=openai; connectivity-test model refs
|
||
* are given as a pair in the request body.
|
||
*/
|
||
import { createServer } from "node:http";
|
||
import type { AddressInfo } from "node:net";
|
||
import { readFile, stat } from "node:fs/promises";
|
||
import path from "node:path";
|
||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||
import { MODEL_CATALOG } from "@prismshadow/penguin-core";
|
||
import type {
|
||
ModelsResponse,
|
||
ModelTestResponse,
|
||
ProjectCreateResponse,
|
||
SessionCreateResponse,
|
||
} from "../src/api/types.js";
|
||
import { ProjectConfigService } from "../src/services/project-config-service.js";
|
||
import { apiClient, createTestApp, loginAdmin, provisionUser } from "./helpers.js";
|
||
import type { TestApp } from "./helpers.js";
|
||
|
||
/** Catalog paired refs (config primary key = (provider, model_id)). */
|
||
const catalogPairs = MODEL_CATALOG.map((m) => `${m.provider} |