veryfront 0.1.208 → 0.1.210

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,9 @@ function getAnthropicMessagesUrl(baseURL) {
13
13
  function getOpenAIChatCompletionsUrl(baseURL) {
14
14
  return joinUrl(baseURL ?? DEFAULT_OPENAI_BASE_URL, "chat/completions");
15
15
  }
16
+ function getOpenAIResponsesUrl(baseURL) {
17
+ return joinUrl(baseURL ?? DEFAULT_OPENAI_BASE_URL, "responses");
18
+ }
16
19
  function getGoogleGenerateContentUrl(baseURL, modelId) {
17
20
  return joinUrl(baseURL ?? DEFAULT_GOOGLE_BASE_URL, `models/${encodeURIComponent(modelId)}:generateContent`);
18
21
  }
@@ -2026,6 +2029,542 @@ export function createOpenAIModelRuntime(config, modelId) {
2026
2029
  },
2027
2030
  };
2028
2031
  }
2032
+ /**
2033
+ * Convert the unified RuntimePromptMessage[] to the Responses API `input`
2034
+ * array shape. Differences from Chat Completions:
2035
+ * - System prompts go on the top-level `instructions` field, not inline.
2036
+ * - Content parts use `input_text` / `output_text` discriminants instead
2037
+ * of the Chat Completions plain-text shorthand.
2038
+ * - Assistant tool calls become standalone `function_call` items in the
2039
+ * input array, not nested `tool_calls` on a message.
2040
+ * - Tool results become standalone `function_call_output` items.
2041
+ * - Reasoning content parts roundtrip as `reasoning` items so callers can
2042
+ * replay multi-turn conversations with chain-of-thought intact.
2043
+ */
2044
+ function toOpenAIResponsesInput(prompt) {
2045
+ const instructionsParts = [];
2046
+ const input = [];
2047
+ for (const message of prompt) {
2048
+ switch (message.role) {
2049
+ case "system":
2050
+ if (message.content.length > 0) {
2051
+ instructionsParts.push(message.content);
2052
+ }
2053
+ break;
2054
+ case "user":
2055
+ input.push({
2056
+ role: "user",
2057
+ content: [{ type: "input_text", text: readTextParts(message.content) }],
2058
+ });
2059
+ break;
2060
+ case "assistant": {
2061
+ const messageContent = [];
2062
+ for (const part of message.content) {
2063
+ if (part.type === "text") {
2064
+ messageContent.push({ type: "output_text", text: part.text });
2065
+ continue;
2066
+ }
2067
+ if (part.type === "reasoning") {
2068
+ // Reasoning items are top-level entries in the input array,
2069
+ // not nested inside the assistant message — flush whatever
2070
+ // text we've accumulated first, then push the reasoning item.
2071
+ if (messageContent.length > 0) {
2072
+ input.push({ role: "assistant", content: [...messageContent] });
2073
+ messageContent.length = 0;
2074
+ }
2075
+ const summary = [];
2076
+ if (typeof part.text === "string" && part.text.length > 0) {
2077
+ summary.push({ type: "summary_text", text: part.text });
2078
+ }
2079
+ input.push({
2080
+ type: "reasoning",
2081
+ ...(typeof part.signature === "string" ? { encrypted_content: part.signature } : {}),
2082
+ summary,
2083
+ });
2084
+ continue;
2085
+ }
2086
+ // tool-call: flush message content, then push as standalone
2087
+ // function_call item per Responses API shape.
2088
+ if (messageContent.length > 0) {
2089
+ input.push({ role: "assistant", content: [...messageContent] });
2090
+ messageContent.length = 0;
2091
+ }
2092
+ input.push({
2093
+ type: "function_call",
2094
+ call_id: part.toolCallId,
2095
+ name: part.toolName,
2096
+ arguments: stringifyJsonValue(part.input),
2097
+ });
2098
+ }
2099
+ if (messageContent.length > 0) {
2100
+ input.push({ role: "assistant", content: messageContent });
2101
+ }
2102
+ break;
2103
+ }
2104
+ case "tool":
2105
+ for (const part of message.content) {
2106
+ input.push({
2107
+ type: "function_call_output",
2108
+ call_id: part.toolCallId,
2109
+ output: stringifyJsonValue(part.output.value),
2110
+ });
2111
+ }
2112
+ break;
2113
+ }
2114
+ }
2115
+ return {
2116
+ ...(instructionsParts.length > 0 ? { instructions: instructionsParts.join("\n\n") } : {}),
2117
+ input,
2118
+ };
2119
+ }
2120
+ /**
2121
+ * Tools on the Responses API differ from Chat Completions: instead of
2122
+ * `{ type: "function", function: { name, parameters } }` the function
2123
+ * shape lifts the name/parameters/strict to the top of the entry. Native
2124
+ * tools (web_search, file_search, computer_use, code_interpreter) live
2125
+ * alongside function tools in the same array.
2126
+ */
2127
+ function toOpenAIResponsesTools(tools) {
2128
+ if (!tools)
2129
+ return undefined;
2130
+ const normalized = [];
2131
+ for (const tool of tools) {
2132
+ if (tool.type === "function") {
2133
+ normalized.push({
2134
+ type: "function",
2135
+ name: tool.name,
2136
+ ...(typeof tool.description === "string" ? { description: tool.description } : {}),
2137
+ parameters: unwrapToolInputSchema(tool.inputSchema),
2138
+ });
2139
+ continue;
2140
+ }
2141
+ if (!tool.id.startsWith("openai."))
2142
+ continue;
2143
+ const providerType = tool.id.slice("openai.".length);
2144
+ if (providerType.length === 0)
2145
+ continue;
2146
+ normalized.push({
2147
+ type: providerType,
2148
+ ...toSnakeCaseRecord(tool.args),
2149
+ });
2150
+ }
2151
+ return normalized.length > 0 ? normalized : undefined;
2152
+ }
2153
+ function buildOpenAIResponsesRequest(modelId, providerName, options, stream, warnings) {
2154
+ const isReasoningModel = isOpenAIReasoningModel(modelId);
2155
+ const reasoningEffort = resolveOpenAIReasoningEffort(options.reasoning);
2156
+ const reasoningEnabled = isReasoningModel || reasoningEffort !== undefined;
2157
+ // Same param-sanitization rules as Chat Completions: reasoning models
2158
+ // reject sampling params. Drop with a warning.
2159
+ if (options.topK !== undefined) {
2160
+ warnings.push({
2161
+ type: "unsupported-setting",
2162
+ provider: "openai",
2163
+ setting: "topK",
2164
+ details: "OpenAI Responses API does not expose top_k; the value was dropped.",
2165
+ });
2166
+ }
2167
+ if (reasoningEnabled) {
2168
+ const dropped = [
2169
+ ["temperature", "temperature"],
2170
+ ["topP", "top_p"],
2171
+ ["presencePenalty", "presence_penalty"],
2172
+ ["frequencyPenalty", "frequency_penalty"],
2173
+ ];
2174
+ for (const [key, openaiName] of dropped) {
2175
+ if (options[key] !== undefined) {
2176
+ warnings.push({
2177
+ type: "unsupported-setting",
2178
+ provider: "openai",
2179
+ setting: key,
2180
+ details: `Dropped because OpenAI reasoning models reject ${openaiName}. Reasoning was active for this request.`,
2181
+ });
2182
+ }
2183
+ }
2184
+ }
2185
+ const { instructions, input } = toOpenAIResponsesInput(options.prompt);
2186
+ const responsesTools = toOpenAIResponsesTools(options.tools);
2187
+ const body = {
2188
+ model: modelId,
2189
+ input,
2190
+ ...(instructions !== undefined ? { instructions } : {}),
2191
+ ...(stream ? { stream: true } : {}),
2192
+ ...(options.maxOutputTokens !== undefined
2193
+ ? { max_output_tokens: options.maxOutputTokens }
2194
+ : {}),
2195
+ ...(!reasoningEnabled && options.temperature !== undefined
2196
+ ? { temperature: options.temperature }
2197
+ : {}),
2198
+ ...(!reasoningEnabled && options.topP !== undefined ? { top_p: options.topP } : {}),
2199
+ ...(responsesTools ? { tools: responsesTools } : {}),
2200
+ ...(options.toolChoice !== undefined ? { tool_choice: options.toolChoice } : {}),
2201
+ // The Responses API surfaces reasoning effort + summary verbosity
2202
+ // in a structured `reasoning` object instead of a flat field. We
2203
+ // request "auto" summary so callers see structured summary parts
2204
+ // without having to opt into them per request.
2205
+ ...(reasoningEffort !== undefined
2206
+ ? { reasoning: { effort: reasoningEffort, summary: "auto" } }
2207
+ : {}),
2208
+ ...(typeof options.userId === "string" && options.userId.length > 0
2209
+ ? { user: options.userId }
2210
+ : {}),
2211
+ ...(options.serviceTier !== undefined ? { service_tier: options.serviceTier } : {}),
2212
+ ...(options.parallelToolCalls !== undefined
2213
+ ? { parallel_tool_calls: options.parallelToolCalls }
2214
+ : {}),
2215
+ // Responses API uses `text.format` instead of Chat Completions'
2216
+ // `response_format`. The shape is similar but nested under `text`.
2217
+ ...(options.responseFormat && options.responseFormat.type !== "text"
2218
+ ? {
2219
+ text: {
2220
+ format: options.responseFormat.type === "json" ? { type: "json_object" } : {
2221
+ type: "json_schema",
2222
+ name: options.responseFormat.name,
2223
+ ...(typeof options.responseFormat.description === "string"
2224
+ ? { description: options.responseFormat.description }
2225
+ : {}),
2226
+ schema: unwrapToolInputSchema(options.responseFormat.schema),
2227
+ ...(options.responseFormat.strict !== undefined
2228
+ ? { strict: options.responseFormat.strict }
2229
+ : {}),
2230
+ },
2231
+ },
2232
+ }
2233
+ : {}),
2234
+ };
2235
+ Object.assign(body, readProviderOptions(options.providerOptions, "openai", providerName));
2236
+ return body;
2237
+ }
2238
+ /**
2239
+ * The Responses API uses `input_tokens` / `output_tokens` field names
2240
+ * instead of Chat Completions' `prompt_tokens` / `completion_tokens`.
2241
+ * It also nests cached input tokens under `input_tokens_details` and
2242
+ * exposes reasoning tokens via `output_tokens_details.reasoning_tokens`.
2243
+ */
2244
+ function extractOpenAIResponsesUsage(payload) {
2245
+ const record = readRecord(payload);
2246
+ // Streaming usage lives on response.completed inside `response.usage`;
2247
+ // non-streaming has it at the top level.
2248
+ const responseRecord = readRecord(record?.response);
2249
+ const usage = readRecord(responseRecord?.usage) ?? readRecord(record?.usage);
2250
+ if (!usage)
2251
+ return undefined;
2252
+ const inputTokens = typeof usage.input_tokens === "number" ? usage.input_tokens : undefined;
2253
+ const outputTokens = typeof usage.output_tokens === "number" ? usage.output_tokens : undefined;
2254
+ const totalTokens = typeof usage.total_tokens === "number"
2255
+ ? usage.total_tokens
2256
+ : (inputTokens !== undefined || outputTokens !== undefined
2257
+ ? (inputTokens ?? 0) + (outputTokens ?? 0)
2258
+ : undefined);
2259
+ const inputDetails = readRecord(usage.input_tokens_details);
2260
+ const cachedTokens = inputDetails?.cached_tokens;
2261
+ return {
2262
+ inputTokens,
2263
+ outputTokens,
2264
+ totalTokens,
2265
+ ...(typeof cachedTokens === "number" ? { cacheReadInputTokens: cachedTokens } : {}),
2266
+ };
2267
+ }
2268
+ function normalizeOpenAIResponsesFinishReason(raw) {
2269
+ if (typeof raw !== "string")
2270
+ return null;
2271
+ switch (raw) {
2272
+ case "completed":
2273
+ return { unified: "stop", raw };
2274
+ case "incomplete":
2275
+ return { unified: "length", raw };
2276
+ case "failed":
2277
+ return { unified: "error", raw };
2278
+ case "in_progress":
2279
+ return null;
2280
+ default:
2281
+ return raw;
2282
+ }
2283
+ }
2284
+ function buildOpenAIResponsesGenerateResult(payload) {
2285
+ const record = readRecord(payload);
2286
+ const output = Array.isArray(record?.output) ? record.output : [];
2287
+ const content = [];
2288
+ for (const item of output) {
2289
+ const itemRecord = readRecord(item);
2290
+ const itemType = typeof itemRecord?.type === "string" ? itemRecord.type : undefined;
2291
+ if (itemType === "message" && Array.isArray(itemRecord?.content)) {
2292
+ // A message item bundles one or more output_text parts. Concat
2293
+ // their texts into a single text content entry.
2294
+ let text = "";
2295
+ for (const part of itemRecord.content) {
2296
+ const p = readRecord(part);
2297
+ if (typeof p?.type === "string" && p.type === "output_text" && typeof p.text === "string") {
2298
+ text += p.text;
2299
+ }
2300
+ }
2301
+ if (text.length > 0) {
2302
+ content.push({ type: "text", text });
2303
+ }
2304
+ continue;
2305
+ }
2306
+ if (itemType === "function_call") {
2307
+ content.push({
2308
+ type: "tool-call",
2309
+ toolCallId: typeof itemRecord?.call_id === "string"
2310
+ ? itemRecord.call_id
2311
+ : (typeof itemRecord?.id === "string" ? itemRecord.id : ""),
2312
+ toolName: typeof itemRecord?.name === "string" ? itemRecord.name : "",
2313
+ input: typeof itemRecord?.arguments === "string"
2314
+ ? itemRecord.arguments
2315
+ : stringifyJsonValue(itemRecord?.arguments ?? {}),
2316
+ });
2317
+ continue;
2318
+ }
2319
+ if (itemType === "reasoning") {
2320
+ const summary = Array.isArray(itemRecord?.summary) ? itemRecord.summary : [];
2321
+ const summaries = [];
2322
+ for (const s of summary) {
2323
+ const sr = readRecord(s);
2324
+ if (typeof sr?.text === "string" && sr.text.length > 0) {
2325
+ summaries.push({
2326
+ ...(typeof sr?.id === "string" ? { id: sr.id } : {}),
2327
+ text: sr.text,
2328
+ });
2329
+ }
2330
+ }
2331
+ content.push({
2332
+ type: "reasoning",
2333
+ ...(summaries.length > 0 ? { summaries } : {}),
2334
+ ...(typeof itemRecord?.encrypted_content === "string"
2335
+ ? { signature: itemRecord.encrypted_content }
2336
+ : {}),
2337
+ });
2338
+ continue;
2339
+ }
2340
+ }
2341
+ return {
2342
+ content,
2343
+ finishReason: normalizeOpenAIResponsesFinishReason(record?.status),
2344
+ usage: extractOpenAIResponsesUsage(payload),
2345
+ };
2346
+ }
2347
+ /**
2348
+ * Parse the Responses API streaming event grammar into the same UI part
2349
+ * shapes the existing OpenAI / Anthropic / Google streams emit. The
2350
+ * Responses API uses a strict event-typed protocol — every event has a
2351
+ * `type` field naming the lifecycle phase — instead of the loose
2352
+ * `delta`-based shape Chat Completions uses.
2353
+ */
2354
+ async function* streamOpenAIResponsesParts(stream) {
2355
+ const decoder = new TextDecoder();
2356
+ let buffer = "";
2357
+ const reasoningBlocks = new Map();
2358
+ const functionCalls = new Map();
2359
+ const startedToolCalls = new Set();
2360
+ let finishReason = null;
2361
+ let usage;
2362
+ let reasoningCounter = 0;
2363
+ for await (const chunk of stream) {
2364
+ buffer += decoder.decode(chunk, { stream: true });
2365
+ const parsed = parseSseChunk(buffer);
2366
+ buffer = parsed.remainder;
2367
+ for (const event of parsed.events) {
2368
+ if (event === "[DONE]")
2369
+ continue;
2370
+ const record = readRecord(event);
2371
+ const type = typeof record?.type === "string" ? record.type : undefined;
2372
+ if (!type)
2373
+ continue;
2374
+ // response.output_item.added: a new output item begins. Track
2375
+ // function_call items so their argument deltas can be attributed,
2376
+ // and reasoning items so summary deltas can group correctly.
2377
+ if (type === "response.output_item.added") {
2378
+ const item = readRecord(record?.item);
2379
+ const itemType = typeof item?.type === "string" ? item.type : undefined;
2380
+ const itemId = typeof item?.id === "string" ? item.id : undefined;
2381
+ if (itemType === "function_call" && itemId) {
2382
+ const callId = typeof item?.call_id === "string" ? item.call_id : itemId;
2383
+ const name = typeof item?.name === "string" ? item.name : "";
2384
+ functionCalls.set(itemId, {
2385
+ id: itemId,
2386
+ toolCallId: callId,
2387
+ name,
2388
+ arguments: "",
2389
+ });
2390
+ }
2391
+ if (itemType === "reasoning" && itemId) {
2392
+ reasoningBlocks.set(itemId, {
2393
+ id: `reasoning-${reasoningCounter++}`,
2394
+ emittedStart: false,
2395
+ });
2396
+ }
2397
+ continue;
2398
+ }
2399
+ // response.output_text.delta: text chunk for a message item.
2400
+ if (type === "response.output_text.delta" && typeof record?.delta === "string") {
2401
+ if (record.delta.length > 0) {
2402
+ yield { type: "text-delta", delta: record.delta };
2403
+ }
2404
+ continue;
2405
+ }
2406
+ // response.reasoning_summary_text.delta: reasoning summary text
2407
+ // chunk. The first delta on an item lazily emits the
2408
+ // reasoning-start event so callers can group deltas into a part.
2409
+ if (type === "response.reasoning_summary_text.delta" && typeof record?.delta === "string") {
2410
+ const itemId = typeof record?.item_id === "string" ? record.item_id : undefined;
2411
+ const state = itemId ? reasoningBlocks.get(itemId) : undefined;
2412
+ if (state && record.delta.length > 0) {
2413
+ if (!state.emittedStart) {
2414
+ yield { type: "reasoning-start", id: state.id };
2415
+ state.emittedStart = true;
2416
+ }
2417
+ yield { type: "reasoning-delta", id: state.id, delta: record.delta };
2418
+ }
2419
+ continue;
2420
+ }
2421
+ // response.function_call_arguments.delta: tool call argument
2422
+ // chunk. The first delta lazily emits tool-input-start.
2423
+ if (type === "response.function_call_arguments.delta" && typeof record?.delta === "string") {
2424
+ const itemId = typeof record?.item_id === "string" ? record.item_id : undefined;
2425
+ const state = itemId ? functionCalls.get(itemId) : undefined;
2426
+ if (state && record.delta.length > 0) {
2427
+ if (!startedToolCalls.has(state.id)) {
2428
+ yield {
2429
+ type: "tool-input-start",
2430
+ id: state.toolCallId,
2431
+ toolName: state.name,
2432
+ };
2433
+ startedToolCalls.add(state.id);
2434
+ }
2435
+ state.arguments += record.delta;
2436
+ yield {
2437
+ type: "tool-input-delta",
2438
+ id: state.toolCallId,
2439
+ delta: record.delta,
2440
+ };
2441
+ }
2442
+ continue;
2443
+ }
2444
+ // response.output_item.done: an item has finished emitting deltas.
2445
+ // Close any reasoning or function-call streams that were open.
2446
+ if (type === "response.output_item.done") {
2447
+ const item = readRecord(record?.item);
2448
+ const itemType = typeof item?.type === "string" ? item.type : undefined;
2449
+ const itemId = typeof item?.id === "string" ? item.id : undefined;
2450
+ if (itemType === "reasoning" && itemId) {
2451
+ const state = reasoningBlocks.get(itemId);
2452
+ if (state?.emittedStart) {
2453
+ yield { type: "reasoning-end", id: state.id };
2454
+ }
2455
+ reasoningBlocks.delete(itemId);
2456
+ }
2457
+ if (itemType === "function_call" && itemId) {
2458
+ const state = functionCalls.get(itemId);
2459
+ if (state) {
2460
+ yield {
2461
+ type: "tool-call",
2462
+ toolCallId: state.toolCallId,
2463
+ toolName: state.name,
2464
+ input: state.arguments,
2465
+ };
2466
+ }
2467
+ functionCalls.delete(itemId);
2468
+ }
2469
+ continue;
2470
+ }
2471
+ // response.completed: terminal event with the final response object
2472
+ // (status + usage). Capture both for the final finish part.
2473
+ if (type === "response.completed") {
2474
+ usage = extractOpenAIResponsesUsage(record) ?? usage;
2475
+ const responseRecord = readRecord(record?.response);
2476
+ finishReason = normalizeOpenAIResponsesFinishReason(responseRecord?.status);
2477
+ continue;
2478
+ }
2479
+ if (type === "response.failed" || type === "response.incomplete") {
2480
+ const responseRecord = readRecord(record?.response);
2481
+ finishReason = normalizeOpenAIResponsesFinishReason(responseRecord?.status) ??
2482
+ (type === "response.failed"
2483
+ ? { unified: "error", raw: "failed" }
2484
+ : { unified: "length", raw: "incomplete" });
2485
+ usage = extractOpenAIResponsesUsage(record) ?? usage;
2486
+ continue;
2487
+ }
2488
+ }
2489
+ }
2490
+ // Close any reasoning streams still open at end-of-stream (defensive
2491
+ // — a clean Responses API stream always closes them via output_item.done).
2492
+ for (const state of reasoningBlocks.values()) {
2493
+ if (state.emittedStart) {
2494
+ yield { type: "reasoning-end", id: state.id };
2495
+ }
2496
+ }
2497
+ yield {
2498
+ type: "finish",
2499
+ finishReason,
2500
+ ...(usage ? { usage } : {}),
2501
+ };
2502
+ }
2503
+ export function createOpenAIResponsesRuntime(config, modelId) {
2504
+ const fetchImpl = config.fetch ?? globalThis.fetch;
2505
+ return {
2506
+ provider: config.name ?? "openai",
2507
+ modelId,
2508
+ specificationVersion: "v3",
2509
+ supportedUrls: {},
2510
+ doGenerate(optionsForRuntime) {
2511
+ const options = optionsForRuntime;
2512
+ const url = getOpenAIResponsesUrl(config.baseURL);
2513
+ const warnings = createWarningCollector();
2514
+ const body = buildOpenAIResponsesRequest(modelId, config.name ?? "openai", options, false, warnings);
2515
+ return requestJson({
2516
+ url,
2517
+ fetchImpl,
2518
+ providerLabel: config.name ?? "openai",
2519
+ providerKind: "openai",
2520
+ init: {
2521
+ method: "POST",
2522
+ headers: createRequestHeaders({
2523
+ apiKeyHeaderName: "authorization",
2524
+ apiKey: `Bearer ${config.apiKey}`,
2525
+ extraHeaders: options.headers,
2526
+ }),
2527
+ body: JSON.stringify(body),
2528
+ signal: options.abortSignal,
2529
+ },
2530
+ }).then((payload) => {
2531
+ const drained = warnings.drain();
2532
+ return {
2533
+ ...buildOpenAIResponsesGenerateResult(payload),
2534
+ ...(drained.length > 0 ? { warnings: drained } : {}),
2535
+ };
2536
+ });
2537
+ },
2538
+ doStream(optionsForRuntime) {
2539
+ const options = optionsForRuntime;
2540
+ const url = getOpenAIResponsesUrl(config.baseURL);
2541
+ const warnings = createWarningCollector();
2542
+ const body = buildOpenAIResponsesRequest(modelId, config.name ?? "openai", options, true, warnings);
2543
+ return requestStream({
2544
+ url,
2545
+ fetchImpl,
2546
+ providerLabel: config.name ?? "openai",
2547
+ providerKind: "openai",
2548
+ init: {
2549
+ method: "POST",
2550
+ headers: createRequestHeaders({
2551
+ apiKeyHeaderName: "authorization",
2552
+ apiKey: `Bearer ${config.apiKey}`,
2553
+ extraHeaders: options.headers,
2554
+ }),
2555
+ body: JSON.stringify(body),
2556
+ signal: options.abortSignal,
2557
+ },
2558
+ }).then((responseStream) => {
2559
+ const drained = warnings.drain();
2560
+ return {
2561
+ stream: ReadableStream.from(streamOpenAIResponsesParts(responseStream)),
2562
+ ...(drained.length > 0 ? { warnings: drained } : {}),
2563
+ };
2564
+ });
2565
+ },
2566
+ };
2567
+ }
2029
2568
  export function createAnthropicModelRuntime(config, modelId) {
2030
2569
  const fetchImpl = config.fetch ?? globalThis.fetch;
2031
2570
  return {
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.208";
1
+ export declare const VERSION = "0.1.210";
2
2
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
- export const VERSION = "0.1.208";
3
+ export const VERSION = "0.1.210";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.208",
3
+ "version": "0.1.210",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",
@@ -21,6 +21,7 @@ import {
21
21
  vfListLocalProjects,
22
22
  vfListRoutes,
23
23
  } from "./tools/project-tools.js";
24
+ import { vfRunTests } from "./tools/run-tests-tool.js";
24
25
  import { vfGetConventions, vfScaffold } from "./tools/scaffold-tools.js";
25
26
  import { vfGetSkillReference, vfGetSkills } from "./tools/skill-tools.js";
26
27
  import { cicdTools } from "./tools/cicd-tools.js";
@@ -48,4 +49,5 @@ export const advancedTools: MCPTool[] = [
48
49
  vfTriggerHmr,
49
50
  vfWaitForReady,
50
51
  vfGetFlywheelStatus,
52
+ vfRunTests,
51
53
  ];
@@ -411,6 +411,39 @@ export class StandaloneMCPServer {
411
411
  }
412
412
  },
413
413
  },
414
+ {
415
+ name: "vf_run_tests",
416
+ description: "Run the project's test suite and get structured pass/fail results. " +
417
+ "Returns a summary with total, passed, failed, skipped counts and failure details " +
418
+ "including file path, test name, error message, and line number. " +
419
+ "Do not use for lint checks — use vf_run_lint instead.",
420
+ inputSchema: {
421
+ type: "object",
422
+ properties: {
423
+ filter: {
424
+ type: "string",
425
+ description: "Filter tests by name pattern",
426
+ },
427
+ parallel: {
428
+ type: "boolean",
429
+ description: "Run tests in parallel",
430
+ },
431
+ timeout: {
432
+ type: "number",
433
+ description:
434
+ "Maximum time to wait for test completion in milliseconds (default: 300000)",
435
+ },
436
+ },
437
+ },
438
+ async execute(args) {
439
+ const { executeTests } = await import("./tools/run-tests-tool.js");
440
+ return executeTests({
441
+ filter: args.filter as string | undefined,
442
+ parallel: args.parallel as boolean | undefined,
443
+ timeout: args.timeout as number | undefined,
444
+ });
445
+ },
446
+ },
414
447
  ...this.createContext7Tools(),
415
448
  ];
416
449
  }