veryfront 0.1.210 → 0.1.212

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.
Files changed (35) hide show
  1. package/esm/cli/mcp/advanced-tools.d.ts.map +1 -1
  2. package/esm/cli/mcp/advanced-tools.js +6 -0
  3. package/esm/cli/mcp/standalone.d.ts.map +1 -1
  4. package/esm/cli/mcp/standalone.js +60 -0
  5. package/esm/cli/mcp/tools/bootstrap-tool.d.ts +29 -0
  6. package/esm/cli/mcp/tools/bootstrap-tool.d.ts.map +1 -0
  7. package/esm/cli/mcp/tools/bootstrap-tool.js +51 -0
  8. package/esm/cli/mcp/tools/build-tool.d.ts +28 -0
  9. package/esm/cli/mcp/tools/build-tool.d.ts.map +1 -0
  10. package/esm/cli/mcp/tools/build-tool.js +88 -0
  11. package/esm/cli/mcp/tools/run-lint-tool.d.ts +14 -0
  12. package/esm/cli/mcp/tools/run-lint-tool.d.ts.map +1 -0
  13. package/esm/cli/mcp/tools/run-lint-tool.js +55 -0
  14. package/esm/deno.js +1 -1
  15. package/esm/src/agent/data-stream.d.ts.map +1 -1
  16. package/esm/src/agent/data-stream.js +25 -17
  17. package/esm/src/agent/runtime/constants.d.ts +2 -0
  18. package/esm/src/agent/runtime/constants.d.ts.map +1 -1
  19. package/esm/src/agent/runtime/constants.js +16 -0
  20. package/esm/src/agent/runtime/index.d.ts +52 -1
  21. package/esm/src/agent/runtime/index.d.ts.map +1 -1
  22. package/esm/src/agent/runtime/index.js +102 -15
  23. package/esm/src/utils/version-constant.d.ts +1 -1
  24. package/esm/src/utils/version-constant.js +1 -1
  25. package/package.json +1 -1
  26. package/src/cli/mcp/advanced-tools.ts +6 -0
  27. package/src/cli/mcp/standalone.ts +65 -0
  28. package/src/cli/mcp/tools/bootstrap-tool.ts +67 -0
  29. package/src/cli/mcp/tools/build-tool.ts +115 -0
  30. package/src/cli/mcp/tools/run-lint-tool.ts +69 -0
  31. package/src/deno.js +1 -1
  32. package/src/src/agent/data-stream.ts +28 -18
  33. package/src/src/agent/runtime/constants.ts +18 -0
  34. package/src/src/agent/runtime/index.ts +147 -15
  35. package/src/src/utils/version-constant.ts +1 -1
@@ -34,7 +34,7 @@ export { executeConfiguredTool, getAvailableTools, isDynamicTool, parseToolArgs,
34
34
  export { accumulateUsage, getMaxSteps, normalizeInput } from "./input-utils.js";
35
35
  export { createStreamState, processStream } from "./chat-stream-handler.js";
36
36
  export { DEFAULT_MAX_STEPS, DEFAULT_MAX_TOKENS, DEFAULT_TEMPERATURE, MAX_STREAM_BUFFER_SIZE, } from "./constants.js";
37
- import { DEFAULT_MAX_TOKENS, DEFAULT_TEMPERATURE } from "./constants.js";
37
+ import { DEFAULT_MAX_TOKENS, DEFAULT_TEMPERATURE, getModelMaxOutputTokens } from "./constants.js";
38
38
  import { closeSSEStream, generateMessageId, sendSSE } from "./sse-utils.js";
39
39
  import { executeConfiguredTool, getAvailableTools, isDynamicTool, parseToolArgs, } from "./tool-helpers.js";
40
40
  import { accumulateUsage, getMaxSteps, normalizeInput } from "./input-utils.js";
@@ -99,6 +99,59 @@ export function captureStreamedToolCallInput(toolCall) {
99
99
  ...(error ? { parseError: error } : {}),
100
100
  };
101
101
  }
102
+ /**
103
+ * A streamed tool call is "incomplete" when the provider stream terminated
104
+ * (abort, stall, timeout, transport error) before the SDK emitted the
105
+ * finalizing `tool-call` event that sets `inputAvailable: true`. In that state
106
+ * `arguments` only holds partial JSON fragments from `tool-input-delta` events,
107
+ * so the tool call is NOT a committed model choice and must not be parsed or
108
+ * executed. This is semantically distinct from a parse failure on a finalized
109
+ * tool call (`inputAvailable: true` but malformed JSON — which only happens on
110
+ * genuine provider bugs) and needs to be reported as a stream-termination
111
+ * error rather than a tool-argument error.
112
+ */
113
+ export function isStreamedToolCallIncomplete(toolCall) {
114
+ return toolCall.inputAvailable !== true;
115
+ }
116
+ /**
117
+ * Classify and build the persisted `MessagePart` for a single streamed tool
118
+ * call. Pure function — no logging, no SSE, no memory. Callers decide what to
119
+ * do with the result so this stays unit-testable.
120
+ *
121
+ * The resulting `part` is always pushed into the assistant message so the
122
+ * conversation history is transparent: even incomplete tool calls leave a
123
+ * visible trace with their partial `inputText`. What differs is the caller's
124
+ * error-surfacing behavior (log warning, SSE event, tool-result error).
125
+ */
126
+ export function materializeStreamedToolCall(tc) {
127
+ const basePart = {
128
+ type: `tool-${tc.name}`,
129
+ toolCallId: tc.id,
130
+ toolName: tc.name,
131
+ args: {},
132
+ ...(tc.arguments.length > 0 ? { inputText: tc.arguments } : {}),
133
+ };
134
+ if (isStreamedToolCallIncomplete(tc)) {
135
+ return {
136
+ kind: "incomplete",
137
+ part: basePart,
138
+ partialArgumentsLength: tc.arguments.length,
139
+ partialArgumentsPreview: tc.arguments.slice(0, 200),
140
+ };
141
+ }
142
+ const capturedInput = captureStreamedToolCallInput(tc);
143
+ const part = {
144
+ type: `tool-${tc.name}`,
145
+ toolCallId: tc.id,
146
+ toolName: tc.name,
147
+ args: capturedInput.args,
148
+ ...(capturedInput.inputText ? { inputText: capturedInput.inputText } : {}),
149
+ };
150
+ if (capturedInput.parseError) {
151
+ return { kind: "parse-error", part, parseError: capturedInput.parseError };
152
+ }
153
+ return { kind: "complete", part };
154
+ }
102
155
  function isToolResultPart(part) {
103
156
  return part.type === "tool-result" && "result" in part;
104
157
  }
@@ -393,7 +446,7 @@ export class AgentRuntime {
393
446
  allowedToolNames: allowedRemoteToolNames,
394
447
  }),
395
448
  experimental_repairToolCall: repairToolCall,
396
- maxOutputTokens: this.resolveMaxOutputTokens(maxOutputTokensOverride),
449
+ maxOutputTokens: this.resolveMaxOutputTokens(effectiveModel, maxOutputTokensOverride),
397
450
  temperature: DEFAULT_TEMPERATURE,
398
451
  ...(headers ? { headers } : {}),
399
452
  ...(providerOptions ? { providerOptions } : {}),
@@ -632,7 +685,7 @@ export class AgentRuntime {
632
685
  allowedToolNames: allowedRemoteToolNames,
633
686
  }),
634
687
  experimental_repairToolCall: repairToolCall,
635
- maxOutputTokens: this.resolveMaxOutputTokens(maxOutputTokensOverride),
688
+ maxOutputTokens: this.resolveMaxOutputTokens(effectiveModel, maxOutputTokensOverride),
636
689
  temperature: DEFAULT_TEMPERATURE,
637
690
  ...(headers ? { headers } : {}),
638
691
  ...(providerOptions ? { providerOptions } : {}),
@@ -649,20 +702,35 @@ export class AgentRuntime {
649
702
  if (state.accumulatedText)
650
703
  streamParts.push({ type: "text", text: state.accumulatedText });
651
704
  for (const tc of state.toolCalls.values()) {
652
- const capturedInput = captureStreamedToolCallInput(tc);
653
- if (capturedInput.parseError) {
705
+ const materialized = materializeStreamedToolCall(tc);
706
+ streamParts.push(materialized.part);
707
+ if (materialized.kind === "incomplete") {
708
+ // Stream terminated before the provider emitted the finalizing
709
+ // `tool-call` event for this block. The model never committed this
710
+ // tool use. Surface the failure via SSE so the live client can
711
+ // react, and leave the partial fragment under `inputText` in the
712
+ // persisted part above so the history is replayable and transparent.
713
+ logger.warn("Streamed tool call terminated before tool-call event", {
714
+ toolCallId: tc.id,
715
+ toolName: tc.name,
716
+ partialArgumentsLength: materialized.partialArgumentsLength,
717
+ partialArgumentsPreview: materialized.partialArgumentsPreview,
718
+ });
719
+ const dynamicIncomplete = isDynamicTool(tc.name);
720
+ sendSSE(controller, encoder, {
721
+ type: "tool-input-error",
722
+ toolCallId: tc.id,
723
+ errorText: `Stream terminated before tool-call event fired for "${tc.name}". ` +
724
+ `Received ${materialized.partialArgumentsLength} chars of partial tool-input deltas.`,
725
+ ...(dynamicIncomplete ? { dynamic: true } : {}),
726
+ });
727
+ }
728
+ else if (materialized.kind === "parse-error") {
654
729
  logger.warn("Failed to parse streamed tool arguments", {
655
730
  toolCallId: tc.id,
656
- error: capturedInput.parseError,
731
+ error: materialized.parseError,
657
732
  });
658
733
  }
659
- streamParts.push({
660
- type: `tool-${tc.name}`,
661
- toolCallId: tc.id,
662
- toolName: tc.name,
663
- args: capturedInput.args,
664
- ...(capturedInput.inputText ? { inputText: capturedInput.inputText } : {}),
665
- });
666
734
  }
667
735
  const assistantMessage = {
668
736
  id: `msg_${Date.now()}_${step}`,
@@ -711,6 +779,23 @@ export class AgentRuntime {
711
779
  streamedToolCalls.some((tc) => tc.name === LOAD_SKILL_TOOL_ID);
712
780
  for (const tc of streamedToolCalls) {
713
781
  throwIfAborted(abortSignal);
782
+ if (isStreamedToolCallIncomplete(tc)) {
783
+ // Stream ended before the provider finalized this tool call. We
784
+ // cannot execute it — record a distinct stream-termination error
785
+ // (not a tool-argument parse error) so the parent step and any
786
+ // upstream orchestrator (e.g. the child-fork watchdog) see a
787
+ // completed step with a clearly-labelled failure and can recover.
788
+ const incompleteToolCall = {
789
+ id: tc.id,
790
+ name: tc.name,
791
+ args: {},
792
+ ...(tc.arguments.length > 0 ? { inputText: tc.arguments } : {}),
793
+ status: "pending",
794
+ };
795
+ await this.recordToolError(incompleteToolCall, `Stream terminated before tool-call event fired for "${tc.name}". ` +
796
+ `Received ${tc.arguments.length} chars of partial tool-input deltas.`, controller, encoder, currentMessages, toolCalls);
797
+ continue;
798
+ }
714
799
  const capturedInput = captureStreamedToolCallInput(tc);
715
800
  const toolCall = {
716
801
  id: tc.id,
@@ -872,13 +957,15 @@ export class AgentRuntime {
872
957
  const edgeMaxSteps = this.config.edge?.enabled ? this.config.edge.maxSteps : undefined;
873
958
  return getMaxSteps(this.config.maxSteps, edgeMaxSteps, platformLimit);
874
959
  }
875
- resolveMaxOutputTokens(maxOutputTokensOverride) {
960
+ resolveMaxOutputTokens(modelString, maxOutputTokensOverride) {
876
961
  if (typeof maxOutputTokensOverride === "number" &&
877
962
  Number.isFinite(maxOutputTokensOverride) &&
878
963
  maxOutputTokensOverride > 0) {
879
964
  return Math.floor(maxOutputTokensOverride);
880
965
  }
881
- return this.config.memory?.maxTokens ?? DEFAULT_MAX_TOKENS;
966
+ return this.config.memory?.maxTokens ??
967
+ (modelString ? getModelMaxOutputTokens(modelString) : undefined) ??
968
+ DEFAULT_MAX_TOKENS;
882
969
  }
883
970
  /**
884
971
  * Get memory instance (for advanced use cases)
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.210";
1
+ export declare const VERSION = "0.1.212";
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.210";
3
+ export const VERSION = "0.1.212";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.210",
3
+ "version": "0.1.212",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",
@@ -21,15 +21,19 @@ import {
21
21
  vfListLocalProjects,
22
22
  vfListRoutes,
23
23
  } from "./tools/project-tools.js";
24
+ import { vfBuild } from "./tools/build-tool.js";
25
+ import { vfRunLint } from "./tools/run-lint-tool.js";
24
26
  import { vfRunTests } from "./tools/run-tests-tool.js";
25
27
  import { vfGetConventions, vfScaffold } from "./tools/scaffold-tools.js";
26
28
  import { vfGetSkillReference, vfGetSkills } from "./tools/skill-tools.js";
29
+ import { vfBootstrap } from "./tools/bootstrap-tool.js";
27
30
  import { cicdTools } from "./tools/cicd-tools.js";
28
31
  import { introspectionTools } from "./tools/introspection-tools.js";
29
32
 
30
33
  export const advancedTools: MCPTool[] = [
31
34
  ...cicdTools,
32
35
  ...introspectionTools,
36
+ vfBootstrap,
33
37
  vfGetSkills,
34
38
  vfGetSkillReference,
35
39
  vfListLocalProjects,
@@ -45,9 +49,11 @@ export const advancedTools: MCPTool[] = [
45
49
  vfPreviewRoute,
46
50
  vfGetDebugContext,
47
51
  vfGetComponentTree,
52
+ vfBuild,
48
53
  vfHotReload,
49
54
  vfTriggerHmr,
50
55
  vfWaitForReady,
56
+ vfRunLint,
51
57
  vfGetFlywheelStatus,
52
58
  vfRunTests,
53
59
  ];
@@ -444,6 +444,71 @@ export class StandaloneMCPServer {
444
444
  });
445
445
  },
446
446
  },
447
+ {
448
+ name: "vf_run_lint",
449
+ description:
450
+ "Run the linter. Returns structured diagnostics with file, line, column, rule code, and message. " +
451
+ "Do not use for test results — use vf_run_tests instead. " +
452
+ "Do not use for compile/runtime errors — use vf_get_errors instead.",
453
+ inputSchema: {
454
+ type: "object",
455
+ properties: {
456
+ timeout: {
457
+ type: "number",
458
+ description:
459
+ "Maximum time to wait for lint completion in milliseconds (default: 120000)",
460
+ },
461
+ },
462
+ },
463
+ async execute(args) {
464
+ const { executeLint } = await import("./tools/run-lint-tool.js");
465
+ return executeLint({
466
+ timeout: args.timeout as number | undefined,
467
+ });
468
+ },
469
+ },
470
+ {
471
+ name: "vf_bootstrap",
472
+ description:
473
+ "Get full project context in one call: structure, conventions, errors, and server status. " +
474
+ "Use at session start instead of calling vf_get_project_context + vf_get_conventions + " +
475
+ "vf_get_errors + vf_get_status separately.",
476
+ inputSchema: {
477
+ type: "object",
478
+ properties: {
479
+ projectPath: {
480
+ type: "string",
481
+ description: "Project directory (defaults to cwd)",
482
+ },
483
+ },
484
+ },
485
+ async execute(args) {
486
+ const { vfGetProjectContext } = await import("./tools/project-tools.js");
487
+ const { vfGetConventions } = await import("./tools/scaffold-tools.js");
488
+
489
+ const [project, conventions] = await Promise.all([
490
+ vfGetProjectContext.execute({ projectPath: args.projectPath as string }),
491
+ vfGetConventions.execute({ topic: "all" }),
492
+ ]);
493
+
494
+ let errors: unknown[] = [];
495
+ let running = false;
496
+ try {
497
+ const result = await client.getLiveErrors();
498
+ errors = Array.isArray(result) ? result : [];
499
+ running = true;
500
+ } catch {
501
+ // Dev server not running — no errors available
502
+ }
503
+
504
+ return {
505
+ project,
506
+ conventions,
507
+ errors: { total: errors.length, items: errors.slice(-20) },
508
+ status: { running },
509
+ };
510
+ },
511
+ },
447
512
  ...this.createContext7Tools(),
448
513
  ];
449
514
  }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * MCP tool: vf_bootstrap
3
+ *
4
+ * Returns everything an agent needs at session start in a single call:
5
+ * project context, coding conventions, current errors, and server status.
6
+ */
7
+
8
+ import { z } from "zod";
9
+ import type { MCPTool } from "../../../src/mcp/index.js";
10
+ import { type DevError, getErrorCollector } from "../../../src/observability/index.js";
11
+ import { vfGetProjectContext } from "./project-tools.js";
12
+ import { vfGetConventions } from "./scaffold-tools.js";
13
+
14
+ const bootstrapInput = z.object({
15
+ projectPath: z.string().optional().describe(
16
+ "Project directory (defaults to current working directory)",
17
+ ),
18
+ });
19
+
20
+ type BootstrapInput = z.infer<typeof bootstrapInput>;
21
+
22
+ interface BootstrapResult {
23
+ project: Awaited<ReturnType<typeof vfGetProjectContext.execute>>;
24
+ conventions: Awaited<ReturnType<typeof vfGetConventions.execute>>;
25
+ errors: { total: number; items: DevError[] };
26
+ status: { running: boolean };
27
+ }
28
+
29
+ export const vfBootstrap: MCPTool<BootstrapInput, BootstrapResult> = {
30
+ name: "vf_bootstrap",
31
+ title: "Bootstrap",
32
+ annotations: {
33
+ readOnlyHint: true,
34
+ destructiveHint: false,
35
+ idempotentHint: true,
36
+ openWorldHint: false,
37
+ },
38
+ description: "Use this at the start of a new session to get full project context in one call. " +
39
+ "Returns project structure, coding conventions, current errors, and server status. " +
40
+ "Equivalent to calling vf_get_project_context + vf_get_conventions + vf_get_errors + " +
41
+ "vf_get_status separately, but in a single round-trip. " +
42
+ "Do not use repeatedly — call once at session bootstrap.",
43
+ inputSchema: bootstrapInput,
44
+ execute: async (input) => {
45
+ const [project, conventions] = await Promise.all([
46
+ vfGetProjectContext.execute({ projectPath: input.projectPath }),
47
+ vfGetConventions.execute({ topic: "all" }),
48
+ ]);
49
+
50
+ let errors: DevError[] = [];
51
+ let running = false;
52
+ try {
53
+ const collector = getErrorCollector();
54
+ errors = collector.getAll();
55
+ running = true;
56
+ } catch {
57
+ running = false;
58
+ }
59
+
60
+ return {
61
+ project,
62
+ conventions,
63
+ errors: { total: errors.length, items: errors.slice(-20) },
64
+ status: { running },
65
+ };
66
+ },
67
+ };
@@ -0,0 +1,115 @@
1
+ /**
2
+ * MCP tool for production builds.
3
+ */
4
+
5
+ import { z } from "zod";
6
+ import { cwd } from "../../../src/platform/index.js";
7
+ import { join } from "../../../src/platform/compat/path/index.js";
8
+ import { buildProduction } from "../../../src/build/index.js";
9
+ import { withSpan } from "../../../src/observability/tracing/otlp-setup.js";
10
+ import type { MCPTool } from "../tools.js";
11
+
12
+ // ============================================================================
13
+ // Tool: vf_build
14
+ // ============================================================================
15
+
16
+ const buildInput = z.object({
17
+ outputDir: z
18
+ .string()
19
+ .optional()
20
+ .describe("Output directory for the build. Defaults to '<projectDir>/dist'."),
21
+ splitting: z
22
+ .boolean()
23
+ .optional()
24
+ .default(true)
25
+ .describe("Enable code splitting. Defaults to true."),
26
+ compress: z
27
+ .boolean()
28
+ .optional()
29
+ .default(true)
30
+ .describe("Enable compression (gzip/brotli). Defaults to true."),
31
+ ssg: z
32
+ .boolean()
33
+ .optional()
34
+ .default(true)
35
+ .describe("Enable static site generation. Defaults to true."),
36
+ dryRun: z
37
+ .boolean()
38
+ .optional()
39
+ .default(false)
40
+ .describe("Preview the build without writing files to disk. Defaults to false."),
41
+ });
42
+
43
+ type BuildInput = z.infer<typeof buildInput>;
44
+
45
+ interface BuildResult {
46
+ success: boolean;
47
+ pages?: number;
48
+ chunks?: number;
49
+ assets?: number;
50
+ totalSize?: number;
51
+ duration_ms?: number;
52
+ outputDir?: string;
53
+ dryRun?: boolean;
54
+ ssgPaths?: string[];
55
+ error?: string;
56
+ }
57
+
58
+ export const vfBuild: MCPTool<BuildInput, BuildResult> = {
59
+ name: "vf_build",
60
+ title: "Production Build",
61
+ annotations: {
62
+ readOnlyHint: false,
63
+ destructiveHint: false,
64
+ idempotentHint: true,
65
+ openWorldHint: false,
66
+ },
67
+ description: "Use this when you need to run a production build for the current project. " +
68
+ "Bundles, optimises, and writes output to the dist directory. " +
69
+ "Use dryRun=true to preview the build without writing files. " +
70
+ "Do not use for development — use the dev server tools instead. " +
71
+ "Do not use for lint checks — use vf_run_lint instead.",
72
+ inputSchema: buildInput,
73
+ execute: (input) =>
74
+ withSpan(
75
+ "cli.mcp.tool.vf_build",
76
+ async () => {
77
+ const projectDir = cwd();
78
+ const outputDir = input.outputDir ?? join(projectDir, "dist");
79
+ const startTime = Date.now();
80
+
81
+ try {
82
+ const stats = await buildProduction({
83
+ projectDir,
84
+ outputDir,
85
+ enableSplitting: input.splitting,
86
+ enableCompression: input.compress,
87
+ ssg: input.ssg,
88
+ dryRun: input.dryRun,
89
+ });
90
+
91
+ const duration_ms = Date.now() - startTime;
92
+
93
+ return {
94
+ success: true,
95
+ pages: stats.pages,
96
+ chunks: stats.chunks,
97
+ assets: stats.assets,
98
+ totalSize: stats.totalSize,
99
+ duration_ms,
100
+ outputDir,
101
+ dryRun: input.dryRun,
102
+ ssgPaths: stats.ssgPaths,
103
+ };
104
+ } catch (error) {
105
+ const duration_ms = Date.now() - startTime;
106
+ return {
107
+ success: false,
108
+ error: error instanceof Error ? error.message : String(error),
109
+ duration_ms,
110
+ };
111
+ }
112
+ },
113
+ { "tool.dryRun": input.dryRun },
114
+ ),
115
+ };
@@ -0,0 +1,69 @@
1
+ /**
2
+ * MCP tool: vf_run_lint
3
+ *
4
+ * Runs the linter via subprocess and returns structured diagnostics.
5
+ * Reuses parseLintJsonOutput from the CLI lint command.
6
+ */
7
+ import * as dntShim from "../../../_dnt.shims.js";
8
+
9
+
10
+ import { z } from "zod";
11
+ import type { MCPTool } from "../tools.js";
12
+ import { type LintResult, parseLintJsonOutput } from "../../commands/lint/command.js";
13
+
14
+ const runLintInput = z.object({
15
+ timeout: z.number().optional().default(120000).describe(
16
+ "Maximum time to wait for lint completion in milliseconds. Defaults to 120000 (2 minutes).",
17
+ ),
18
+ });
19
+
20
+ type RunLintInput = z.infer<typeof runLintInput>;
21
+
22
+ /** Spawn deno lint and return structured results. Exported for standalone reuse. */
23
+ export async function executeLint(
24
+ input: { timeout?: number } = {},
25
+ ): Promise<LintResult> {
26
+ const cmd = new dntShim.Deno.Command("deno", {
27
+ args: ["lint", "--json"],
28
+ stdout: "piped",
29
+ stderr: "piped",
30
+ });
31
+
32
+ const child = cmd.spawn();
33
+ const timeoutMs = input.timeout ?? 120000;
34
+
35
+ const result = await Promise.race([
36
+ child.output(),
37
+ new Promise<never>((_, reject) => {
38
+ const timer = dntShim.setTimeout(() => {
39
+ try {
40
+ child.kill();
41
+ } catch {
42
+ // Process may have already exited
43
+ }
44
+ reject(new Error(`Lint execution timed out after ${timeoutMs}ms`));
45
+ }, timeoutMs);
46
+ dntShim.Deno.unrefTimer(timer);
47
+ }),
48
+ ]);
49
+
50
+ const stdout = new TextDecoder().decode(result.stdout);
51
+ return parseLintJsonOutput(stdout, result.code);
52
+ }
53
+
54
+ export const vfRunLint: MCPTool<RunLintInput, LintResult> = {
55
+ name: "vf_run_lint",
56
+ title: "Run Lint",
57
+ annotations: {
58
+ readOnlyHint: true,
59
+ destructiveHint: false,
60
+ idempotentHint: true,
61
+ openWorldHint: false,
62
+ },
63
+ description: "Use this when you need to check for lint issues in the project. " +
64
+ "Returns structured diagnostics with file path, line, column, rule code, and message for each issue. " +
65
+ "Do not use for test results — use vf_run_tests instead. " +
66
+ "Do not use for compile/runtime errors — use vf_get_errors instead.",
67
+ inputSchema: runLintInput,
68
+ execute: (input) => executeLint(input),
69
+ };
package/src/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.210",
3
+ "version": "0.1.212",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -26,14 +26,16 @@ export function stripLeadingEmptyObjectPlaceholder(rawArgs: string): string {
26
26
  }
27
27
 
28
28
  export function mergeToolInputDelta(currentArguments: string, nextDelta: string): string {
29
- if (currentArguments === "{}") {
30
- const normalizedDelta = nextDelta.trimStart();
31
- if (normalizedDelta.startsWith("{")) {
32
- return normalizedDelta;
33
- }
34
-
35
- if (normalizedDelta.startsWith('"')) {
36
- return `{${normalizedDelta}`;
29
+ const normalizedDelta = nextDelta.trimStart();
30
+ const candidateDeltas = normalizedDelta.startsWith('"')
31
+ ? [normalizedDelta, `{${normalizedDelta}`]
32
+ : [normalizedDelta];
33
+
34
+ if (currentArguments === "{}" || currentArguments.length === 0) {
35
+ for (const candidate of candidateDeltas) {
36
+ if (candidate.startsWith("{")) {
37
+ return candidate;
38
+ }
37
39
  }
38
40
  }
39
41
 
@@ -45,18 +47,20 @@ export function mergeToolInputDelta(currentArguments: string, nextDelta: string)
45
47
  return nextDelta;
46
48
  }
47
49
 
48
- if (nextDelta === currentArguments || currentArguments.includes(nextDelta)) {
49
- return currentArguments;
50
- }
50
+ for (const candidate of candidateDeltas) {
51
+ if (candidate === currentArguments || currentArguments.includes(candidate)) {
52
+ return currentArguments;
53
+ }
51
54
 
52
- if (nextDelta.startsWith(currentArguments)) {
53
- return nextDelta;
54
- }
55
+ if (candidate.startsWith(currentArguments)) {
56
+ return candidate;
57
+ }
55
58
 
56
- const maxOverlap = Math.min(currentArguments.length, nextDelta.length);
57
- for (let overlap = maxOverlap; overlap > 0; overlap--) {
58
- if (currentArguments.endsWith(nextDelta.slice(0, overlap))) {
59
- return currentArguments + nextDelta.slice(overlap);
59
+ const maxOverlap = Math.min(currentArguments.length, candidate.length);
60
+ for (let overlap = maxOverlap; overlap > 0; overlap--) {
61
+ if (currentArguments.endsWith(candidate.slice(0, overlap))) {
62
+ return currentArguments + candidate.slice(overlap);
63
+ }
60
64
  }
61
65
  }
62
66
 
@@ -68,10 +72,16 @@ export function mergeToolCallInput(currentArguments: string, nextInput: string):
68
72
  return nextInput;
69
73
  }
70
74
 
75
+ const normalizedCurrent = stripLeadingEmptyObjectPlaceholder(currentArguments);
76
+
71
77
  if (nextInput.trim() === "{}" && currentArguments.trim().startsWith("{")) {
72
78
  return currentArguments;
73
79
  }
74
80
 
81
+ if (nextInput.trim() === "{}" && normalizedCurrent.trim().startsWith("{")) {
82
+ return normalizedCurrent;
83
+ }
84
+
75
85
  if (currentArguments.trim() === "{}" && nextInput.trim().startsWith("{")) {
76
86
  return nextInput;
77
87
  }
@@ -4,3 +4,21 @@ export const DEFAULT_MAX_TOKENS = AGENT_DEFAULTS.maxTokens;
4
4
  export const DEFAULT_TEMPERATURE = AGENT_DEFAULTS.temperature;
5
5
  export const MAX_STREAM_BUFFER_SIZE = STREAMING_DEFAULTS.maxBufferSize;
6
6
  export const DEFAULT_MAX_STEPS = 20;
7
+
8
+ /** Max output token limits per model (normalized IDs without `veryfront-cloud/` prefix). */
9
+ const MODEL_MAX_OUTPUT_TOKENS: Record<string, number> = {
10
+ "anthropic/claude-opus-4-6": 32_768,
11
+ "anthropic/claude-sonnet-4-6": 16_384,
12
+ "anthropic/claude-haiku-4-5-20251001": 8_192,
13
+ "openai/gpt-5.2": 16_384,
14
+ "google-ai-studio/gemini-2.5-pro": 65_536,
15
+ "google-ai-studio/gemini-2.5-flash": 8_192,
16
+ };
17
+
18
+ /** Look up max output tokens for a model, stripping the `veryfront-cloud/` prefix. */
19
+ export function getModelMaxOutputTokens(modelString: string): number | undefined {
20
+ const normalized = modelString.startsWith("veryfront-cloud/")
21
+ ? modelString.slice("veryfront-cloud/".length)
22
+ : modelString;
23
+ return MODEL_MAX_OUTPUT_TOKENS[normalized];
24
+ }