Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.
TypeScript agentic-aiaiai-agentsai-videocompilerdslffmpeggenerative-aillmmarkup-languagemonorepoplugin-systemprogramming-languagetext-to-videotypescriptvideovideo-automationvideo-clonevideo-editingvideo-generation
refactor(runtime): remove Provider price quoting
kashorinc9fa9ebf06f2
diff --git a/docs/guide/providers.md b/docs/guide/providers.mdindex edea4345..36b77fc2 100644--- a/docs/guide/providers.md+++ b/docs/guide/providers.md@@ -140,13 +140,6 @@ the Runtime has resolved that Endpoint's declared credential slots. It may makerequest to the real service, such as reading the authenticated model catalog. It must not be called byBuild preflight and must never submit generation work.-A paid capability may declare `quote(context)` beside its handler. The quote belongs to the Provider-because the selected Provider owns the currency, rate card and routing facts. It receives one exact-`Need`, may read a live rate card, and returns either an estimate with its source and observation time-or an honest `unknown`; it never submits work. Do not copy changing service prices into Core, model-packages, the CLI or Skill. A static graph plan does not yet claim a complete total when exact downstream-Needs are only produced during execution.-## 5. Declare a Managed Program when neededIf the Provider depends on a warm external program, export its declaration beside the Endpoint.diff --git a/docs/zh/guide/providers.md b/docs/zh/guide/providers.mdindex ea7330d0..ad585b34 100644--- a/docs/zh/guide/providers.md+++ b/docs/zh/guide/providers.md@@ -133,12 +133,6 @@ Activation 还可以返回 `diagnose(context)`。它只会在用户显式运行Runtime 会先解析该 Endpoint 自己声明的凭据槽。它可以对真实服务做一次有界只读请求,例如读取已认证账户的模型目录;Build 预检不能调用它,它也绝不能提交生成任务。-付费 capability 可以在 handler 旁声明 `quote(context)`。价格属于 Provider,因为币种、价目和-真实路由都是所选 Provider 的事实。报价接收一项已经完整形成的准确 `Need`,可以读取实时价目,-返回带来源和观察时间的估价,或诚实返回 `unknown`;它绝不提交任务。不能把会变动的服务价格-复制进 Core、模型包、CLI 或 Skill。当下游准确 Need 只能在执行中产生时,静态图 Plan 暂时不能-假装给出完整总价。-## 5. 按需声明 Managed Program如果 Provider 依赖需要保持温热的外部程序,就在 Endpoint 旁边导出它的声明。这里没有第二个diff --git a/packages/endpoint-kit/src/index.ts b/packages/endpoint-kit/src/index.tsindex d421d1b6..98dd1065 100644--- a/packages/endpoint-kit/src/index.ts+++ b/packages/endpoint-kit/src/index.ts@@ -31,33 +31,6 @@ export type EndpointInvocationContext = {readonly credentials: Readonly<Record<string, CredentialValue>>;};-export type EndpointPriceQuote =- | {- readonly status: "estimated";- readonly amount: number;- readonly currency: string;- readonly basis: {- readonly mode: string;- readonly quantity: number;- readonly rate: number;- readonly base?: number;- readonly multiplier?: number;- };- readonly source: string;- readonly observedAt: number;- }- | { readonly status: "unknown"; readonly reason: string };--export type EndpointQuoteContext = {- readonly need: Need;- /** Only slots explicitly declared by this configured Endpoint instance are present. */- readonly credentials: Readonly<Record<string, CredentialValue>>;-};--export type EndpointQuoteHandler = (- context: EndpointQuoteContext,-) => Awaitable<EndpointPriceQuote>;-export type ImmediateEndpointHandler = (context: EndpointInvocationContext,) => Awaitable<EndpointFulfillment>;@@ -152,7 +125,6 @@ export type EndpointOffer = {readonly returns: TypeRef;readonly endpoint: string;readonly supports?: (need: Need) => boolean;- readonly quote?: EndpointQuoteHandler;};export type EndpointCredentialDescription = {@@ -168,8 +140,6 @@ type EndpointCapabilityBase = {readonly capability: CapabilityRef;readonly returns: TypeRef;readonly supports?: (need: Need) => boolean;- /** Provider-owned live or stable price estimate for this exact Need. */- readonly quote?: EndpointQuoteHandler;/** Stable Provider-local queue lane. Defaults to the capability name. */readonly lane?: string;/** Lane capacity; the Provider pool keeps its independent total capacity. */@@ -272,7 +242,6 @@ export function defineEndpointPackage(options: DefineEndpointPackageOptions): Encapability: structuredClone(item.capability),returns: structuredClone(item.returns),...(item.supports === undefined ? {} : { supports: item.supports }),- ...(item.quote === undefined ? {} : { quote: item.quote }),}));const instance = {id: options.instance,diff --git a/packages/provider-hypihub/README.md b/packages/provider-hypihub/README.mdindex d578f1f9..cfa7d7f7 100644--- a/packages/provider-hypihub/README.md+++ b/packages/provider-hypihub/README.md@@ -45,9 +45,7 @@ Runtime operation. Embedded callers may override that transport with `publicAsseThe default remote alignment model is `victor-upmeet/whisperx`; `transcriptionModel` may select anotherHypiHub model that exposes the `transcriptions` route. `hypit doctor` reads the authenticated model-catalog to verify configured capabilities; ordinary preflight never makes that request. Each paid-offer can quote one exact Need from the current model card in HypiHub credits. Changing prices are not-copied into Hypit, and unsupported pricing modes remain explicitly unknown.+catalog to verify configured capabilities; ordinary preflight never makes that request.HypiHub exposes MiMo VoiceDesign by default. Set `audio: false` only when the user explicitly selectsanother VoiceDesign Provider. Hypit does not expose MiMo preset-voice or voice-cloning models.diff --git a/packages/provider-hypihub/src/provider.ts b/packages/provider-hypihub/src/provider.tsindex 5c7c4bc6..655a042d 100644--- a/packages/provider-hypihub/src/provider.ts+++ b/packages/provider-hypihub/src/provider.ts@@ -1,4 +1,4 @@-import type { AsyncEndpoint, EndpointFulfillment, EndpointInvocationContext, EndpointPollContext, EndpointStartContext, EndpointOutcome, EndpointPriceQuote, EndpointQuoteContext, ImmediateEndpointHandler } from "@hypit/endpoint-kit";+import type { AsyncEndpoint, EndpointFulfillment, EndpointInvocationContext, EndpointPollContext, EndpointStartContext, EndpointOutcome, ImmediateEndpointHandler } from "@hypit/endpoint-kit";import { defineEndpointPackage, wakeAfter } from "@hypit/endpoint-kit";import { geminiCapabilities, geminiModels, verifyGeminiRequest } from "@hypit/gemini";import type { GeminiRequest } from "@hypit/gemini";@@ -58,11 +58,6 @@ function credential(context: EndpointInvocationContext): string {assert(typeof value === "string" && value.length > 0, "HypiHub login is unavailable; run hypit auth login for HypiHub");return value;}-function quoteCredential(context: EndpointQuoteContext): string {- const value = context.credentials.apiKey?.secret;- assert(typeof value === "string" && value.length > 0, "HypiHub login is unavailable; run hypit auth login for HypiHub");- return value;-}function guidedMessage(error: unknown): string {const message = error instanceof Error ? error.message : String(error);return /API key is unavailable|HypiHub login is unavailable|HTTP (?:401|403|404)\b|not enabled for|model_not_found|no_capable_provider/iu.test(message)@@ -87,119 +82,11 @@ function jobId(value: Record<string, unknown>): string {type HypiHubModelOperation = "images" | "image_edits" | "videos" | "audio_speech" | "transcriptions" | "gemini";-async function verifyModelRoute(client: HypiHubClient, apiKey: string, model: string, operation: HypiHubModelOperation): Promise<Record<string, unknown>> {+async function verifyModelRoute(client: HypiHubClient, apiKey: string, model: string, operation: HypiHubModelOperation): Promise<void> {const card = await client.json(`/models/${encodeURIComponent(model)}`, apiKey);const endpoints = card.endpoints;assert(Array.isArray(endpoints) && endpoints.includes(operation),`HypiHub model ${model} is not enabled for ${operation} with this API key`);- return card;-}--function numeric(value: unknown): number | undefined {- return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : undefined;-}--function firstNumber(input: Record<string, unknown>, keys: readonly string[]): number | undefined {- for (const key of keys) {- const value = numeric(input[key]);- if (value !== undefined) return value;- }- return undefined;-}--function ratioKey(value: unknown): string | undefined {- if (typeof value !== "string") return undefined;- const normalized = value.toLowerCase();- if (normalized === "1024x1024") return "1k";- if (normalized === "2048x2048") return "2k";- if (normalized === "3840x2160") return "4k";- return normalized;-}--function ratio(table: unknown, key: string | undefined): number | undefined {- if (table === undefined || table === null) return 1;- if (typeof table !== "object" || Array.isArray(table)) return undefined;- if (key === undefined) return 1;- return numeric((table as Record<string, unknown>)[key]);-}--function modelQuote(- card: Record<string, unknown>,- input: Record<string, unknown>,- options: { readonly quantity?: number; readonly source: string; readonly observedAt: number },-): EndpointPriceQuote {- const pricing = object(card.pricing, "HypiHub model pricing");- const mode = pricing.mode;- assert(typeof mode === "string" && mode.length > 0, "HypiHub model card has no pricing mode");- if (pricing.free === true) return {- status: "estimated",- amount: 0,- currency: "credits",- basis: { mode: "free", quantity: options.quantity ?? 1, rate: 0 },- source: options.source,- observedAt: options.observedAt,- };- const credits = object(pricing.credits, "HypiHub credit pricing");- let quantity: number;- let rate: number | undefined;- let base: number | undefined;- if (mode === "per_image") {- quantity = options.quantity ?? firstNumber(input, ["n"]) ?? 1;- rate = numeric(credits.base);- } else if (mode === "per_request") {- quantity = options.quantity ?? 1;- rate = numeric(credits.base);- } else if (mode === "per_second") {- quantity = options.quantity ?? firstNumber(input, ["seconds", "duration_seconds", "duration"]) ?? NaN;- rate = numeric(credits.per_second);- } else if (mode === "per_audio_second") {- quantity = options.quantity ?? NaN;- rate = numeric(credits.per_audio_second);- base = numeric(credits.base);- } else if (mode === "per_k_char") {- const text = [input.input, input.text, input.prompt].find((value) => typeof value === "string");- quantity = typeof text === "string" ? text.length / 1_000 : NaN;- rate = numeric(credits.per_k_char);- } else {- return { status: "unknown", reason: `HypiHub pricing mode ${mode} cannot be estimated before execution` };- }- if (!Number.isFinite(quantity) || quantity < 0 || rate === undefined) {- return { status: "unknown", reason: `HypiHub model card lacks the inputs required for ${mode} pricing` };- }- const factors = [- ratio(pricing.resolution_ratio, ratioKey(input.resolution)),- ratio(pricing.size_ratio, ratioKey(input.size)),- ratio(pricing.quality_ratio, ratioKey(input.quality)),- ];- const flagRatios = pricing.flag_ratio === undefined || pricing.flag_ratio === null- ? {}- : (typeof pricing.flag_ratio === "object" && !Array.isArray(pricing.flag_ratio)- ? pricing.flag_ratio as Record<string, unknown> : undefined);- if (flagRatios === undefined) {- return { status: "unknown", reason: "HypiHub model card has an invalid flag price table" };- }- for (const [flag, candidate] of Object.entries(flagRatios)) {- if (input[flag] === true) factors.push(numeric(candidate));- }- if (factors.some((factor) => factor === undefined)) {- return { status: "unknown", reason: "HypiHub model card has no price factor for this exact request" };- }- const multiplier = factors.reduce<number>((value, factor) => value * factor!, 1);- const amount = Math.round((((base ?? 0) + quantity * rate) * multiplier) * 10_000) / 10_000;- return {- status: "estimated",- amount,- currency: "credits",- basis: {- mode,- quantity,- rate,- ...(base === undefined ? {} : { base }),- ...(multiplier === 1 ? {} : { multiplier }),- },- source: options.source,- observedAt: options.observedAt,- };}function dataUrl(bytes: Uint8Array, mediaType: string): string {@@ -342,43 +229,6 @@ function generationOperation(route: (typeof hypiHubRoutes)[number], input: Recorreturn hasReferences ? "image_edits" : "images";}-async function quoteHypiHubNeed(- client: HypiHubClient,- context: EndpointQuoteContext,- transcriptionModel: string,-): Promise<EndpointPriceQuote> {- const observedAt = Date.now();- const apiKey = quoteCredential(context);- if (capabilityKey(context.need.capability) === capabilityKey(whisperXCapabilities.alignment)) {- const request = verifyWhisperXAlignmentRequest(context.need.constraints);- const card = await verifyModelRoute(client, apiKey, transcriptionModel, "transcriptions");- return modelQuote(card, {}, {- quantity: request.sampleFrames / 16_000,- source: `${client.baseUrl}/models/${encodeURIComponent(transcriptionModel)}`,- observedAt,- });- }- if (geminiModels.some((model) => model === context.need.capability.name)- && context.need.capability.module.name === geminiCapabilities[geminiModels[0]].module.name- && context.need.capability.module.version === geminiCapabilities[geminiModels[0]].module.version) {- const model = context.need.capability.name;- const card = await verifyModelRoute(client, apiKey, model, "gemini");- return modelQuote(card, {}, {- source: `${client.baseUrl}/models/${encodeURIComponent(model)}`,- observedAt,- });- }- const route = hypiHubRouteForCapability(context.need.capability);- if (route === undefined) return { status: "unknown", reason: "HypiHub does not quote this capability" };- const compiled = await route.compile(context.need.constraints, async () => "https://quote.invalid/reference");- const input = compiled.input as Record<string, unknown>;- const card = await verifyModelRoute(client, apiKey, compiled.model, generationOperation(route, input));- return modelQuote(card, input, {- source: `${client.baseUrl}/models/${encodeURIComponent(compiled.model)}`,- observedAt,- });-}-async function complete(client: HypiHubClient, apiKey: string, route: (typeof hypiHubRoutes)[number], id: string, artifacts: ResourceStore): Promise<EndpointOutcome> {const response = await client.json(`/jobs/${encodeURIComponent(id)}/assets`, apiKey); const items = response.items;assert(Array.isArray(items) && items.length > 0, "HypiHub job has no assets"); const blobs: BlobRef[] = [];@@ -522,17 +372,14 @@ export function createHypiHubProvider(options: CreateHypiHubProviderOptions = {}...hypiHubRoutes.filter((route) => options.audio !== false || route.media !== "audio").map((route) => route.media === "audio"- ? { capability: route.capability, returns: route.returns, lifecycle: "immediate" as const, handler: audioEndpoint, lane: route.capability.name,- quote: async (context: EndpointQuoteContext) => await quoteHypiHubNeed(client, context, transcriptionModel) }- : { capability: route.capability, returns: route.returns, lifecycle: "asynchronous" as const, endpoint: asyncEndpoint, lane: route.capability.name,- quote: async (context: EndpointQuoteContext) => await quoteHypiHubNeed(client, context, transcriptionModel) }),+ ? { capability: route.capability, returns: route.returns, lifecycle: "immediate" as const, handler: audioEndpoint, lane: route.capability.name }+ : { capability: route.capability, returns: route.returns, lifecycle: "asynchronous" as const, endpoint: asyncEndpoint, lane: route.capability.name }),...geminiModels.map((model) => ({capability: geminiCapabilities[model],returns: textTypes.text,lifecycle: "immediate" as const,handler: geminiEndpoint,lane: "gemini",- quote: async (context: EndpointQuoteContext) => await quoteHypiHubNeed(client, context, transcriptionModel),})),{capability: whisperXCapabilities.alignment,@@ -540,7 +387,6 @@ export function createHypiHubProvider(options: CreateHypiHubProviderOptions = {}lifecycle: "immediate" as const,handler: whisperXEndpoint,lane: "transcription",- quote: async (context: EndpointQuoteContext) => await quoteHypiHubNeed(client, context, transcriptionModel),},],});diff --git a/packages/provider-hypihub/test/provider.test.ts b/packages/provider-hypihub/test/provider.test.tsindex c24eed85..b2436618 100644--- a/packages/provider-hypihub/test/provider.test.ts+++ b/packages/provider-hypihub/test/provider.test.ts@@ -62,64 +62,6 @@ test("HypiHub declares its own credential acquisition flow", () => {assert.equal(credential?.acquisition?.tokenEndpoint, "https://hypit.ai/oauth/token");});-test("HypiHub quotes an exact generation Need from the authenticated model card", async () => {- const request = need(sealSeedanceRequest("seedance-2-mini", {- prompt: ["A presenter turns toward camera."],- resolution: ["720p"],- aspectRatio: ["16:9"],- duration: [5],- generateAudio: [false],- webSearch: [false],- }) as unknown as CanonicalValue);- const provider = createHypiHubProvider({ fetch: async (input) => {- assert.match(String(input), /\/v1\/models\/bytedance%2Fseedance-2-mini$/u);- return Response.json({- endpoints: ["videos"],- pricing: {- mode: "per_second",- resolution_ratio: { "480p": 1, "720p": 2.1579 },- credits: { per_second: 5.648 },- },- });- } });- const offer = provider.offers.find((item) => item.capability.name === "seedance-2-mini");- assert.ok(offer?.quote !== undefined);- const quote = await offer.quote({ need: request, credentials: { apiKey: { secret: "test-key" } } });- assert.deepEqual(quote, {- status: "estimated",- amount: 60.9391,- currency: "credits",- basis: { mode: "per_second", quantity: 5, rate: 5.648, multiplier: 2.1579 },- source: "https://hypit.ai/v1/models/bytedance%2Fseedance-2-mini",- observedAt: quote.status === "estimated" ? quote.observedAt : -1,- });-});--test("HypiHub refuses to underquote an exact request whose price factor is absent", async () => {- const request = need(sealSeedanceRequest("seedance-2-mini", {- prompt: ["A presenter turns toward camera."],- resolution: ["720p"],- aspectRatio: ["16:9"],- duration: [5],- generateAudio: [false],- webSearch: [false],- }) as unknown as CanonicalValue);- const provider = createHypiHubProvider({ fetch: async () => Response.json({- endpoints: ["videos"],- pricing: {- mode: "per_second",- resolution_ratio: { "480p": 1 },- credits: { per_second: 5.648 },- },- }) });- const offer = provider.offers.find((item) => item.capability.name === "seedance-2-mini");- assert.ok(offer?.quote !== undefined);- assert.deepEqual(await offer.quote({ need: request, credentials: { apiKey: { secret: "test-key" } } }), {- status: "unknown",- reason: "HypiHub model card has no price factor for this exact request",- });-});-test("HypiHub doctor checks the authenticated catalogue only when actively invoked", async () => {let calls = 0;const diagnostics = await diagnoseHypiHubProvider({ fetch: async (input, init) => {diff --git a/packages/runtime-host-node/src/index.ts b/packages/runtime-host-node/src/index.tsindex 0158f5c6..5ac5e9bd 100644--- a/packages/runtime-host-node/src/index.ts+++ b/packages/runtime-host-node/src/index.ts@@ -5,7 +5,7 @@ import { delimiter, isAbsolute, join, resolve } from "node:path";import type { ArtifactAttachment } from "@hypit/workspace";import type { BuildResultForward } from "@hypit/build-result";import type { BuildResultRepositoryLocation } from "@hypit/build-result-kit";-import type { BuildDefinition, BuildState, CapabilityRef, Need } from "@hypit/protocol";+import type { BuildDefinition, BuildState, CapabilityRef } from "@hypit/protocol";import type {BuildCatalogDescriptor,BuildCompletion,@@ -127,28 +127,6 @@ export type RuntimeHostDoctorResult = {readonly diagnostics: readonly RuntimeDoctorDiagnostic[];};-export type RuntimeHostNeedQuote = {- readonly need: string;- readonly capability: CapabilityRef;- readonly endpoint?: string;- readonly quote:- | {- readonly status: "estimated";- readonly amount: number;- readonly currency: string;- readonly basis: {- readonly mode: string;- readonly quantity: number;- readonly rate: number;- readonly base?: number;- readonly multiplier?: number;- };- readonly source: string;- readonly observedAt: number;- }- | { readonly status: "unknown"; readonly reason: string };-};-export type ManagedProgramProgress = {readonly id: string;readonly phase: "checking" | "installing" | "starting" | "waiting" | "ready";@@ -231,8 +209,6 @@ export type NodeRuntimeHost = {doctor(options?: {readonly capabilities?: readonly CapabilityRef[];}): Promise<RuntimeHostDoctorResult>;- /** Ask the selected Provider for the current price of each exact Need; never submits work. */- quote(needs: readonly Need[]): Promise<readonly RuntimeHostNeedQuote[]>;runWorker(readyFile: string, owner: string): Promise<void>;};diff --git a/packages/runtime-local/src/config.ts b/packages/runtime-local/src/config.tsindex 1b7b86d9..a4c3d090 100644--- a/packages/runtime-local/src/config.ts+++ b/packages/runtime-local/src/config.ts@@ -8,7 +8,7 @@ import {} from "@hypit/package-loader-node";import type { NodePackageSelectionRequest } from "@hypit/package-loader-node";import { assertBuildId, canonicalize, canonicalStringify } from "@hypit/protocol";-import type { CanonicalValue, CapabilityRef, Need } from "@hypit/protocol";+import type { CanonicalValue, CapabilityRef } from "@hypit/protocol";import {CompositeCredentialStore,} from "@hypit/runtime";@@ -44,7 +44,7 @@ import {hypitHostStateRoot,prepareHostPackages,} from "@hypit/runtime-host-node";-import type { HostPackageProgress, HostPackageReport, RuntimeHostNeedQuote } from "@hypit/runtime-host-node";+import type { HostPackageProgress, HostPackageReport } from "@hypit/runtime-host-node";import { SqliteRuntimeState } from "@hypit/store-sqlite";import { createLocalRuntime } from "./runtime.js";@@ -632,74 +632,6 @@ export async function doctorRuntimeConfig(return await inspectRuntimeConfig(path, { ...options, active: true });}-/** Provider-owned price estimates for exact Needs. This may read remote rate cards but never submits work. */-export async function quoteRuntimeConfig(- path: string,- needs: readonly Need[],- options: LoadRuntimeConfigOptions = {},-): Promise<readonly RuntimeHostNeedQuote[]> {- if (needs.length === 0) return [];- const { document, root, packageRoot } = await openRuntimeConfig(path, options.packageRoot);- const hostStateRoot = resolve(options.hostStateRoot ?? hypitHostStateRoot());- const registry = options.registry ?? new RuntimeAdapterRegistry();- await installRuntimeAdapters(registry, packageRoot, runtimePackageSelection(document), options.distributionPackageRoot);- const endpoints = await activatedEndpoints(document, root, hostStateRoot, registry);- let stores: Awaited<ReturnType<typeof openCredentialStores>> | undefined;- try {- stores = await openCredentialStores(document, root, hostStateRoot, registry);- return await Promise.all(needs.map(async (need): Promise<RuntimeHostNeedQuote> => {- const matches = endpoints.flatMap(({ activation }) => activation.endpoint.offers- .filter((offer) => sameRef(offer.capability, need.capability)- && sameRef(offer.returns, need.returns)- && (offer.supports?.(need) ?? true))- .map((offer) => ({ activation, offer })));- const base = { need: need.id, capability: structuredClone(need.capability) };- if (matches.length === 0) return {- ...base,- quote: { status: "unknown", reason: "No selected Endpoint implements this exact Need" },- };- if (matches.length > 1) return {- ...base,- quote: {- status: "unknown",- reason: `Several selected Endpoints implement this Need: ${matches.map((item) => item.offer.endpoint).sort().join(", ")}`,- },- };- const match = matches[0]!;- if (match.offer.quote === undefined) return {- ...base,- endpoint: match.offer.endpoint,- quote: { status: "unknown", reason: "The selected Provider does not expose a price estimate" },- };- const credentials: Record<string, CredentialValue> = {};- for (const slot of match.activation.endpoint.credentials) {- const value = await stores!.store.resolve(slot.ref);- if (value === undefined) return {- ...base,- endpoint: match.offer.endpoint,- quote: { status: "unknown", reason: `${slot.label} is not configured` },- };- credentials[slot.slot] = value;- }- try {- return {- ...base,- endpoint: match.offer.endpoint,- quote: await match.offer.quote({ need, credentials }),- };- } catch (error) {- return {- ...base,- endpoint: match.offer.endpoint,- quote: { status: "unknown", reason: error instanceof Error ? error.message : String(error) },- };- }- }));- } finally {- await stores?.close();- }-}-export async function createRuntimeFromConfig(path: string,options: LoadRuntimeConfigOptions = {},diff --git a/packages/runtime-local/src/host.ts b/packages/runtime-local/src/host.tsindex 77bf6b00..2b3f62b6 100644--- a/packages/runtime-local/src/host.ts+++ b/packages/runtime-local/src/host.ts@@ -15,7 +15,6 @@ import {doctorRuntimeConfig,prepareRuntimeConfigPackages,preflightRuntimeConfig,- quoteRuntimeConfig,resolveRuntimeConfigPaths,} from "./config.js";import {@@ -131,10 +130,6 @@ export async function openLocalRuntimeHost(...distribution,...(options?.capabilities === undefined ? {} : { capabilities: options.capabilities }),}),- quote: async (needs) => await quoteRuntimeConfig(profile, needs, {- packageRoot: basePackageRoot,- ...distribution,- }),runWorker: async (readyFile, owner) => {const selected = await resolveRuntimeConfigPaths(profile, { packageRoot: basePackageRoot, ...distribution });const leaseState = new SqliteRuntimeState(join(selected.dataRoot, "runtime.sqlite"));diff --git a/packages/runtime-local/src/index.ts b/packages/runtime-local/src/index.tsindex 624402d5..b7256ea2 100644--- a/packages/runtime-local/src/index.ts+++ b/packages/runtime-local/src/index.ts@@ -19,7 +19,6 @@ export {doctorRuntimeConfig,prepareRuntimeConfigPackages,preflightRuntimeConfig,- quoteRuntimeConfig,parseLocalRuntimeProfile,resolveRuntimeConfigPaths,} from "./config.js";diff --git a/packages/runtime-local/test/config.test.ts b/packages/runtime-local/test/config.test.tsindex cbf7a719..3a68685f 100644--- a/packages/runtime-local/test/config.test.ts+++ b/packages/runtime-local/test/config.test.ts@@ -26,7 +26,6 @@ import {openProjectBuildResultRepository,parseLocalRuntimeProfile,preflightRuntimeConfig,- quoteRuntimeConfig,} from "@hypit/runtime-local";function profile(config: {readonly dataRoot?: string;@@ -260,72 +259,3 @@ test("preflight never runs an Endpoint's active doctor", async () => {}});-test("Runtime quote selects one exact Endpoint and resolves only its declared credential", async () => {- const root = await mkdtemp(join(tmpdir(), "hypit-runtime-quote-"));- const path = join(root, "hypit.runtime.json");- await writeFile(path, JSON.stringify(profile({- dataRoot: ".",- credentials: { secrets: { use: "example.credentials" } },- endpoints: { paid: { use: "example.paid" } },- })));- const capability = { module: { name: "example.model", version: "1" }, name: "generate" } as const;- const returns = { module: { name: "example.value", version: "1" }, name: "Output" } as const;- const registry = new RuntimeAdapterRegistry();- registry.registerFacet(createRuntimeCredentialStoreAdapterFacet({- use: "example.credentials",- validate() {},- open: () => ({- value: {- async resolve(ref) {- return ref.store === "secrets" && ref.key === "paid.key" ? { secret: "configured" } : undefined;- },- },- }),- }));- registry.registerFacet(createRuntimeEndpointAdapterFacet({- use: "example.paid",- activate: (context) => ({- endpoint: defineEndpointPackage({- module: { name: "example.provider", version: "1" },- facet: "paid",- instance: context.instance,- pool: context.pool ?? context.instance,- credentials: { apiKey: credentialRef("secrets", "paid.key") },- capabilities: [{- capability,- returns,- lifecycle: "immediate",- handler: () => ({ value: { kind: "inline", value: null } }),- quote: ({ credentials }) => ({- status: "estimated",- amount: credentials.apiKey?.secret === "configured" ? 2 : 999,- currency: "credits",- basis: { mode: "per_request", quantity: 1, rate: 2 },- source: "https://prices.example/model",- observedAt: 1,- }),- }],- }),- }),- }));- try {- const [quote] = await quoteRuntimeConfig(path, [{- id: "need:priced",- capability,- returns,- constraints: {},- result: "record:priced",- }], { registry });- assert.equal(quote?.endpoint, "paid");- assert.deepEqual(quote?.quote, {- status: "estimated",- amount: 2,- currency: "credits",- basis: { mode: "per_request", quantity: 1, rate: 2 },- source: "https://prices.example/model",- observedAt: 1,- });- } finally {- await rm(root, { recursive: true, force: true });- }-});