veryfront 0.1.213 → 0.1.215

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 +2 -0
  3. package/esm/cli/mcp/standalone.d.ts.map +1 -1
  4. package/esm/cli/mcp/standalone.js +34 -0
  5. package/esm/cli/mcp/tools/deploy-tool.d.ts +37 -0
  6. package/esm/cli/mcp/tools/deploy-tool.d.ts.map +1 -0
  7. package/esm/cli/mcp/tools/deploy-tool.js +85 -0
  8. package/esm/deno.js +1 -1
  9. package/esm/src/agent/ag-ui-browser-encoder.d.ts.map +1 -1
  10. package/esm/src/agent/ag-ui-browser-encoder.js +3 -0
  11. package/esm/src/agent/runtime/chat-stream-handler.d.ts.map +1 -1
  12. package/esm/src/agent/runtime/chat-stream-handler.js +7 -0
  13. package/esm/src/agent/runtime/runtime-tool-types.d.ts +3 -0
  14. package/esm/src/agent/runtime/runtime-tool-types.d.ts.map +1 -1
  15. package/esm/src/provider/runtime-loader.d.ts +2 -0
  16. package/esm/src/provider/runtime-loader.d.ts.map +1 -1
  17. package/esm/src/provider/runtime-loader.js +159 -4
  18. package/esm/src/provider/veryfront-cloud/provider.js +2 -2
  19. package/esm/src/provider/veryfront-cloud/shared.d.ts +1 -1
  20. package/esm/src/provider/veryfront-cloud/shared.d.ts.map +1 -1
  21. package/esm/src/provider/veryfront-cloud/shared.js +4 -1
  22. package/esm/src/utils/version-constant.d.ts +1 -1
  23. package/esm/src/utils/version-constant.js +1 -1
  24. package/package.json +1 -1
  25. package/src/cli/mcp/advanced-tools.ts +2 -0
  26. package/src/cli/mcp/standalone.ts +34 -0
  27. package/src/cli/mcp/tools/deploy-tool.ts +132 -0
  28. package/src/deno.js +1 -1
  29. package/src/src/agent/ag-ui-browser-encoder.ts +3 -0
  30. package/src/src/agent/runtime/chat-stream-handler.ts +8 -0
  31. package/src/src/agent/runtime/runtime-tool-types.ts +4 -0
  32. package/src/src/provider/runtime-loader.ts +214 -4
  33. package/src/src/provider/veryfront-cloud/provider.ts +2 -2
  34. package/src/src/provider/veryfront-cloud/shared.ts +8 -1
  35. package/src/src/utils/version-constant.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"advanced-tools.d.ts","sourceRoot":"","sources":["../../../src/cli/mcp/advanced-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAgC1C,eAAO,MAAM,aAAa,EAAE,OAAO,EA0BlC,CAAC"}
1
+ {"version":3,"file":"advanced-tools.d.ts","sourceRoot":"","sources":["../../../src/cli/mcp/advanced-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAiC1C,eAAO,MAAM,aAAa,EAAE,OAAO,EA2BlC,CAAC"}
@@ -2,6 +2,7 @@ import { vfCreateProject, vfListExamples, vfListIntegrations, vfListTemplates, v
2
2
  import { vfGetDebugContext, vfGetFlywheelStatus, vfHotReload, vfPreviewRoute, vfTriggerHmr, vfWaitForReady, } from "./tools/dev-tools.js";
3
3
  import { vfGetComponentTree, vfGetProjectContext, vfListLocalProjects, vfListRoutes, } from "./tools/project-tools.js";
4
4
  import { vfBuild } from "./tools/build-tool.js";
5
+ import { vfTriggerDeploy } from "./tools/deploy-tool.js";
5
6
  import { vfRunLint } from "./tools/run-lint-tool.js";
6
7
  import { vfRunTests } from "./tools/run-tests-tool.js";
7
8
  import { vfGetConventions, vfScaffold } from "./tools/scaffold-tools.js";
@@ -29,6 +30,7 @@ export const advancedTools = [
29
30
  vfGetDebugContext,
30
31
  vfGetComponentTree,
31
32
  vfBuild,
33
+ vfTriggerDeploy,
32
34
  vfHotReload,
33
35
  vfTriggerHmr,
34
36
  vfWaitForReady,
@@ -1 +1 @@
1
- {"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../../../src/cli/m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yBAAyB,CAAC,MAAM,GAAE,mBAAwB,GAAG,mBAAmB,CAI/F"}
@@ -442,6 +442,40 @@ export class StandaloneMCPServer {
442
442
  };
443
443
  },
444
444
  },
445
+ {
446
+ name: "vf_trigger_deploy",
447
+ description: "Deploy a project to an environment via the Veryfront API. " +
448
+ "Creates a release from the specified branch and deploys it to the target environment. " +
449
+ "Requires a valid API token (set VERYFRONT_API_TOKEN or run 'veryfront login'). " +
450
+ "Do not use for local builds — use vf_build instead. " +
451
+ "Do not use for running tests before deploy — use vf_run_tests instead.",
452
+ inputSchema: {
453
+ type: "object",
454
+ properties: {
455
+ projectSlug: {
456
+ type: "string",
457
+ description: "The project slug to deploy. Example: 'my-app'.",
458
+ },
459
+ environment: {
460
+ type: "string",
461
+ description: "Target environment name. Defaults to 'production'.",
462
+ },
463
+ branch: {
464
+ type: "string",
465
+ description: "Git branch to create the release from. Defaults to 'main'.",
466
+ },
467
+ },
468
+ required: ["projectSlug"],
469
+ },
470
+ async execute(args) {
471
+ const { triggerDeploy } = await import("./tools/deploy-tool.js");
472
+ return triggerDeploy({
473
+ projectSlug: args.projectSlug,
474
+ environment: args.environment ?? "production",
475
+ branch: args.branch ?? "main",
476
+ });
477
+ },
478
+ },
445
479
  ...this.createContext7Tools(),
446
480
  ];
447
481
  }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * MCP tool: vf_trigger_deploy
3
+ *
4
+ * Creates a release from a branch and deploys it to an environment.
5
+ * Wraps the same API calls used by the `vf deploy` CLI command.
6
+ */
7
+ import { z } from "zod";
8
+ import type { MCPTool } from "../../../src/mcp/index.js";
9
+ declare const triggerDeployInput: z.ZodObject<{
10
+ projectSlug: z.ZodString;
11
+ environment: z.ZodDefault<z.ZodOptional<z.ZodString>>;
12
+ branch: z.ZodDefault<z.ZodOptional<z.ZodString>>;
13
+ }, z.core.$strip>;
14
+ export type TriggerDeployInput = z.infer<typeof triggerDeployInput>;
15
+ export interface TriggerDeployResult {
16
+ success: boolean;
17
+ deploymentId?: string;
18
+ release?: {
19
+ id: string;
20
+ name: string;
21
+ version: string;
22
+ };
23
+ environment?: {
24
+ id: string;
25
+ name: string;
26
+ };
27
+ error?: string;
28
+ }
29
+ /**
30
+ * Trigger a deploy via the Veryfront API.
31
+ *
32
+ * Exported for standalone MCP server reuse.
33
+ */
34
+ export declare function triggerDeploy(input: TriggerDeployInput): Promise<TriggerDeployResult>;
35
+ export declare const vfTriggerDeploy: MCPTool<TriggerDeployInput, TriggerDeployResult>;
36
+ export {};
37
+ //# sourceMappingURL=deploy-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-tool.d.ts","sourceRoot":"","sources":["../../../../src/cli/mcp/tools/deploy-tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AASzD,QAAA,MAAM,kBAAkB;;;;iBAUtB,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,WAAW,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,mBAAmB,CAAC,CAiE9B;AAED,eAAO,MAAM,eAAe,EAAE,OAAO,CAAC,kBAAkB,EAAE,mBAAmB,CAkB5E,CAAC"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * MCP tool: vf_trigger_deploy
3
+ *
4
+ * Creates a release from a branch and deploys it to an environment.
5
+ * Wraps the same API calls used by the `vf deploy` CLI command.
6
+ */
7
+ import { z } from "zod";
8
+ import { getEnvironmentConfig } from "../../../src/config/index.js";
9
+ import { createApiClient, resolveConfig } from "../../shared/config.js";
10
+ import { createDeployment, createRelease, getEnvironmentByName, } from "../../commands/deploy/command.js";
11
+ const triggerDeployInput = z.object({
12
+ projectSlug: z.string().describe("The project slug to deploy. Example: 'my-app'."),
13
+ environment: z.string().optional().default("production").describe("Target environment name. Defaults to 'production'."),
14
+ branch: z.string().optional().default("main").describe("Git branch to create the release from. Defaults to 'main'."),
15
+ });
16
+ /**
17
+ * Trigger a deploy via the Veryfront API.
18
+ *
19
+ * Exported for standalone MCP server reuse.
20
+ */
21
+ export async function triggerDeploy(input) {
22
+ try {
23
+ const env = getEnvironmentConfig();
24
+ const apiToken = env.apiToken;
25
+ if (!apiToken) {
26
+ return {
27
+ success: false,
28
+ error: "Not authenticated. Run 'veryfront login' first.",
29
+ };
30
+ }
31
+ const config = await resolveConfig(undefined, {
32
+ ...env,
33
+ apiToken,
34
+ projectSlug: input.projectSlug,
35
+ });
36
+ const client = createApiClient(config);
37
+ const environment = await getEnvironmentByName(client, input.projectSlug, input.environment);
38
+ if (!environment) {
39
+ return {
40
+ success: false,
41
+ error: `Environment "${input.environment}" not found.`,
42
+ };
43
+ }
44
+ const release = await createRelease(client, input.projectSlug, {
45
+ branch: input.branch,
46
+ });
47
+ const deployment = await createDeployment(client, input.projectSlug, release.id, environment.id);
48
+ return {
49
+ success: true,
50
+ deploymentId: deployment.id,
51
+ release: { id: release.id, name: release.name, version: release.version },
52
+ environment: { id: environment.id, name: environment.name },
53
+ };
54
+ }
55
+ catch (error) {
56
+ const message = error instanceof Error ? error.message : String(error);
57
+ if (message.includes("Missing API token") ||
58
+ message.includes("Authentication required") ||
59
+ message.includes("401")) {
60
+ return {
61
+ success: false,
62
+ error: "Not authenticated. Run 'veryfront login' first.",
63
+ };
64
+ }
65
+ return { success: false, error: message };
66
+ }
67
+ }
68
+ export const vfTriggerDeploy = {
69
+ name: "vf_trigger_deploy",
70
+ title: "Trigger Deploy",
71
+ annotations: {
72
+ readOnlyHint: false,
73
+ destructiveHint: false,
74
+ idempotentHint: false,
75
+ openWorldHint: true,
76
+ },
77
+ description: "Use this when you need to deploy a project to an environment via the Veryfront API. " +
78
+ "Creates a release from the specified branch and deploys it to the target environment. " +
79
+ "Returns the deployment ID, release info, and environment info on success. " +
80
+ "Requires a valid API token (set VERYFRONT_API_TOKEN or run 'veryfront login'). " +
81
+ "Do not use for local builds — use vf_build instead. " +
82
+ "Do not use for running tests before deploy — use vf_run_tests instead.",
83
+ inputSchema: triggerDeployInput,
84
+ execute: (input) => triggerDeploy(input),
85
+ };
package/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.213",
3
+ "version": "0.1.215",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -1 +1 @@
1
- {"version":3,"file":"ag-ui-browser-encoder.d.ts","sourceRoot":"","sources":["../../../src/src/agent/ag-ui-browser-encoder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAA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AW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,8BAA8B,CAAC;CAC1C;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,wBAAgB,6BAA6B,IAAI,uBAAuB,CAYvE;AAuND,wBAAgB,wCAAwC,CACtD,KAAK,EAAE,uBAAuB,EAC9B,KAAK,EAAE,sBAAsB,GAC5B,uBAAuB,EAAE,CAgN3B;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,uBAAuB,EAC9B,QAAQ,EAAE,aAAa,GAAG,IAAI,GAC7B,uBAAuB,EAAE,CA8B3B"}
@@ -344,6 +344,9 @@ export function mapRuntimeStreamEventToAgUiBrowserEvents(state, event) {
344
344
  },
345
345
  ];
346
346
  default:
347
+ if (typeof event.type === "string" && event.type.startsWith("data-")) {
348
+ return [createCustomDataEvent(event.type.slice(5), event.data)];
349
+ }
347
350
  return [];
348
351
  }
349
352
  }
@@ -1 +1 @@
1
- {"version":3,"file":"chat-stream-handler.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/chat-stream-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAqB,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAYtF,MA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BAAmB;IAClC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAChB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,KAAK,IAAI,CAAC;CACZ;AAyED,wBAAgB,iBAAiB,IAAI,eAAe,CAQnD;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,eAAe,EACtB,UAAU,EAAE,+BAA+B,EAC3C,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,SAAS,CAAC,EAAE,mBAAmB,EAC/B,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,IAAI,CAAC,CA+Zf"}
@@ -202,6 +202,13 @@ export function processStream(result, state, controller, encoder, textPartId, ca
202
202
  continue;
203
203
  }
204
204
  const typedPart = part;
205
+ if (typedPart.type.startsWith("data-")) {
206
+ sendSSE(controller, encoder, {
207
+ type: typedPart.type,
208
+ data: "data" in typedPart ? typedPart.data : undefined,
209
+ });
210
+ continue;
211
+ }
205
212
  switch (typedPart.type) {
206
213
  case "text-delta": {
207
214
  closeReasoningSegment();
@@ -58,6 +58,9 @@ export type RuntimeStreamPart = {
58
58
  } | {
59
59
  type: "reasoning-end";
60
60
  id: string;
61
+ } | {
62
+ type: `data-${string}`;
63
+ data: unknown;
61
64
  } | {
62
65
  type: "tool-input-start";
63
66
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-tool-types.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/runtime-tool-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,MAAM,MAAM,cAAc,GAAG,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tB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GACC;IACA,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GACC;IACA,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,CAAC,EAAE;QACX,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,IAAI,CAAC;CACV,GACC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtC,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACnC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACnC"}
1
+ {"version":3,"file":"runtime-tool-types.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/runtime-tool-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErD,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC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;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GACC;IACA,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,CAAC,EAAE;QACX,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,IAAI,CAAC;CACV,GACC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtC,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACnC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACnC"}
@@ -18,6 +18,8 @@ export interface GoogleRuntimeConfig {
18
18
  name?: string;
19
19
  fetch?: typeof globalThis.fetch;
20
20
  }
21
+ export declare const TOOL_INPUT_PENDING_THRESHOLD_MS = 5000;
22
+ export declare function withToolInputStatusTransitions(stream: AsyncIterable<unknown>, thresholdMs?: number): AsyncIterable<unknown>;
21
23
  type ProviderKind = "anthropic" | "openai" | "google";
22
24
  /**
23
25
  * Structured warning emitted when a provider runtime drops or rewrites a
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-loader.d.ts","sourceRoot":"","sources":["../../../src/src/provider/runtime-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,UAAU,CAA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AQ,aAAa;CAAG;AAExD,6DAA6D;AAC7D,qBAAa,oBAAqB,SAAQ,aAAa;CAAG;AAqtE1D,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,MAAM,GACd,YAAY,CA8Ed;AA4jBD,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,MAAM,GACd,YAAY,CA8Ed;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,sBAAsB,EAC9B,OAAO,EAAE,MAAM,GACd,YAAY,CA8Ed;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,MAAM,GACd,YAAY,CA0Ed;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,MAAM,GACd,gBAAgB,CA2ClB;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,MAAM,GACd,gBAAgB,CAiDlB"}
@@ -1,6 +1,161 @@
1
+ import * as dntShim from "../../_dnt.shims.js";
1
2
  const DEFAULT_ANTHROPIC_BASE_URL = "https://api.anthropic.com/v1";
2
3
  const DEFAULT_OPENAI_BASE_URL = "https://api.openai.com/v1";
3
4
  const DEFAULT_GOOGLE_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
5
+ export const TOOL_INPUT_PENDING_THRESHOLD_MS = 5_000;
6
+ function getToolCallIdFromStreamPart(part) {
7
+ if (!part || typeof part !== "object") {
8
+ return null;
9
+ }
10
+ const record = part;
11
+ if (typeof record.toolCallId === "string" && record.toolCallId.length > 0) {
12
+ return record.toolCallId;
13
+ }
14
+ if (typeof record.id === "string" && record.id.length > 0) {
15
+ return record.id;
16
+ }
17
+ return null;
18
+ }
19
+ function collectDueToolStatuses(toolStates, now, thresholdMs) {
20
+ const events = [];
21
+ for (const [toolCallId, state] of toolStates.entries()) {
22
+ if (state.dueAt === null || state.dueAt > now) {
23
+ continue;
24
+ }
25
+ state.dueAt = now + thresholdMs;
26
+ state.lastStatus = "pending_input";
27
+ events.push({
28
+ type: "data-tool-call-status",
29
+ data: {
30
+ toolCallId,
31
+ status: "pending_input",
32
+ },
33
+ });
34
+ }
35
+ return events;
36
+ }
37
+ export async function* withToolInputStatusTransitions(stream, thresholdMs = TOOL_INPUT_PENDING_THRESHOLD_MS) {
38
+ const iterator = stream[Symbol.asyncIterator]();
39
+ const toolStates = new Map();
40
+ const buffered = [];
41
+ let nextPartPromise = null;
42
+ const closeTool = (toolCallId) => {
43
+ if (!toolCallId) {
44
+ return;
45
+ }
46
+ toolStates.delete(toolCallId);
47
+ };
48
+ const schedulePending = (toolCallId) => {
49
+ if (!toolCallId) {
50
+ return;
51
+ }
52
+ const state = toolStates.get(toolCallId) ?? {
53
+ dueAt: null,
54
+ lastStatus: null,
55
+ };
56
+ state.dueAt = Date.now() + thresholdMs;
57
+ toolStates.set(toolCallId, state);
58
+ };
59
+ const markStreaming = (toolCallId) => {
60
+ if (!toolCallId) {
61
+ return;
62
+ }
63
+ const state = toolStates.get(toolCallId) ?? {
64
+ dueAt: null,
65
+ lastStatus: null,
66
+ };
67
+ if (state.lastStatus !== "streaming_input") {
68
+ buffered.push({
69
+ type: "data-tool-call-status",
70
+ data: {
71
+ toolCallId,
72
+ status: "streaming_input",
73
+ },
74
+ });
75
+ }
76
+ state.lastStatus = "streaming_input";
77
+ state.dueAt = Date.now() + thresholdMs;
78
+ toolStates.set(toolCallId, state);
79
+ };
80
+ const processPart = (part) => {
81
+ if (!part || typeof part !== "object") {
82
+ buffered.push(part);
83
+ return;
84
+ }
85
+ const record = part;
86
+ const partType = typeof record.type === "string" ? record.type : null;
87
+ const toolCallId = getToolCallIdFromStreamPart(part);
88
+ switch (partType) {
89
+ case "tool-input-start":
90
+ schedulePending(toolCallId);
91
+ buffered.push(part);
92
+ return;
93
+ case "tool-input-delta":
94
+ markStreaming(toolCallId);
95
+ buffered.push(part);
96
+ return;
97
+ case "tool-call":
98
+ case "tool-result":
99
+ case "tool-error":
100
+ closeTool(toolCallId);
101
+ buffered.push(part);
102
+ return;
103
+ case "finish":
104
+ case "error":
105
+ toolStates.clear();
106
+ buffered.push(part);
107
+ return;
108
+ default:
109
+ buffered.push(part);
110
+ return;
111
+ }
112
+ };
113
+ while (true) {
114
+ if (buffered.length > 0) {
115
+ yield buffered.shift();
116
+ continue;
117
+ }
118
+ if (!nextPartPromise) {
119
+ nextPartPromise = iterator.next();
120
+ }
121
+ const nextDueAt = [...toolStates.values()]
122
+ .map((state) => state.dueAt)
123
+ .filter((value) => value !== null)
124
+ .sort((left, right) => left - right)[0] ?? null;
125
+ if (nextDueAt !== null) {
126
+ let timeoutId = null;
127
+ const timeoutResult = await Promise.race([
128
+ nextPartPromise.then((result) => ({ kind: "part", result })),
129
+ new Promise((resolve) => {
130
+ timeoutId = dntShim.setTimeout(() => resolve({ kind: "timeout" }), Math.max(0, nextDueAt - Date.now()));
131
+ }),
132
+ ]);
133
+ if (timeoutId !== null) {
134
+ clearTimeout(timeoutId);
135
+ }
136
+ if (timeoutResult.kind === "timeout") {
137
+ buffered.push(...collectDueToolStatuses(toolStates, Date.now(), thresholdMs));
138
+ continue;
139
+ }
140
+ nextPartPromise = null;
141
+ if (timeoutResult.result.done) {
142
+ buffered.push(...collectDueToolStatuses(toolStates, Date.now(), thresholdMs));
143
+ while (buffered.length > 0) {
144
+ yield buffered.shift();
145
+ }
146
+ return;
147
+ }
148
+ processPart(timeoutResult.result.value);
149
+ continue;
150
+ }
151
+ const result = await nextPartPromise;
152
+ nextPartPromise = null;
153
+ if (result.done) {
154
+ return;
155
+ }
156
+ processPart(result.value);
157
+ }
158
+ }
4
159
  function joinUrl(base, path) {
5
160
  return `${base.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
6
161
  }
@@ -2022,7 +2177,7 @@ export function createOpenAIModelRuntime(config, modelId) {
2022
2177
  }).then((responseStream) => {
2023
2178
  const drained = warnings.drain();
2024
2179
  return {
2025
- stream: ReadableStream.from(streamOpenAICompatibleParts(responseStream)),
2180
+ stream: ReadableStream.from(withToolInputStatusTransitions(streamOpenAICompatibleParts(responseStream))),
2026
2181
  ...(drained.length > 0 ? { warnings: drained } : {}),
2027
2182
  };
2028
2183
  });
@@ -2558,7 +2713,7 @@ export function createOpenAIResponsesRuntime(config, modelId) {
2558
2713
  }).then((responseStream) => {
2559
2714
  const drained = warnings.drain();
2560
2715
  return {
2561
- stream: ReadableStream.from(streamOpenAIResponsesParts(responseStream)),
2716
+ stream: ReadableStream.from(withToolInputStatusTransitions(streamOpenAIResponsesParts(responseStream))),
2562
2717
  ...(drained.length > 0 ? { warnings: drained } : {}),
2563
2718
  };
2564
2719
  });
@@ -2623,7 +2778,7 @@ export function createAnthropicModelRuntime(config, modelId) {
2623
2778
  }).then((responseStream) => {
2624
2779
  const drained = warnings.drain();
2625
2780
  return {
2626
- stream: ReadableStream.from(streamAnthropicCompatibleParts(responseStream)),
2781
+ stream: ReadableStream.from(withToolInputStatusTransitions(streamAnthropicCompatibleParts(responseStream))),
2627
2782
  ...(drained.length > 0 ? { warnings: drained } : {}),
2628
2783
  };
2629
2784
  });
@@ -2688,7 +2843,7 @@ export function createGoogleModelRuntime(config, modelId) {
2688
2843
  }).then((responseStream) => {
2689
2844
  const drained = warnings.drain();
2690
2845
  return {
2691
- stream: ReadableStream.from(streamGoogleCompatibleParts(responseStream)),
2846
+ stream: ReadableStream.from(withToolInputStatusTransitions(streamGoogleCompatibleParts(responseStream))),
2692
2847
  ...(drained.length > 0 ? { warnings: drained } : {}),
2693
2848
  };
2694
2849
  });
@@ -3,9 +3,9 @@ import { createAnthropicModelRuntime, createGoogleModelRuntime, createOpenAIMode
3
3
  import { createVeryfrontCloudFetch, getVeryfrontCloudGatewayBaseUrl, parseVeryfrontCloudModelId, requireVeryfrontCloudBootstrap, } from "./shared.js";
4
4
  export function createVeryfrontCloudModel(modelId) {
5
5
  const { provider, modelId: upstreamModelId } = parseVeryfrontCloudModelId(modelId, "language");
6
- const { apiBaseUrl, apiToken } = requireVeryfrontCloudBootstrap();
6
+ const { apiBaseUrl, apiToken, projectSlug } = requireVeryfrontCloudBootstrap();
7
7
  const baseURL = getVeryfrontCloudGatewayBaseUrl(apiBaseUrl, provider);
8
- const fetch = createVeryfrontCloudFetch(apiToken);
8
+ const fetch = createVeryfrontCloudFetch(apiToken, projectSlug);
9
9
  switch (provider) {
10
10
  case "anthropic":
11
11
  return createAnthropicModelRuntime({
@@ -19,6 +19,6 @@ export declare function getVeryfrontCloudGatewayBaseUrl(apiBaseUrl: string, prov
19
19
  * The gateway expects only Bearer auth, so we strip all provider-specific
20
20
  * headers to prevent credential leakage to the wrong auth path.
21
21
  */
22
- export declare function createVeryfrontCloudFetch(apiToken: string): typeof fetch;
22
+ export declare function createVeryfrontCloudFetch(apiToken: string, projectSlug?: string): typeof fetch;
23
23
  export {};
24
24
  //# sourceMappingURL=shared.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../src/src/provider/veryfront-cloud/shared.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,wBAAwB,GAChC,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,YAAY,CAAC;AAEjB,UAAU,2BAA2B;IACnC,QAAQ,EAAE,wBAAwB,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;CACjB;AA+BD,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,UAAU,GAAG,WAAW,GAC7B,2BAA2B,CA+B7B;AAED,wBAAgB,8BAA8B,IAAI;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAmBA;AAED,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,wBAAwB,GACjC,MAAM,CAER;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,KAAK,CAWxE"}
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../src/src/provider/veryfront-cloud/shared.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,wBAAwB,GAChC,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,YAAY,CAAC;AAEjB,UAAU,2BAA2B;IACnC,QAAQ,EAAE,wBAAwB,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;CACjB;AA+BD,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,UAAU,GAAG,WAAW,GAC7B,2BAA2B,CA+B7B;AAED,wBAAgB,8BAA8B,IAAI;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAmBA;AAED,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,wBAAwB,GACjC,MAAM,CAER;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,KAAK,CAed"}
@@ -74,13 +74,16 @@ export function getVeryfrontCloudGatewayBaseUrl(apiBaseUrl, provider) {
74
74
  * The gateway expects only Bearer auth, so we strip all provider-specific
75
75
  * headers to prevent credential leakage to the wrong auth path.
76
76
  */
77
- export function createVeryfrontCloudFetch(apiToken) {
77
+ export function createVeryfrontCloudFetch(apiToken, projectSlug) {
78
78
  return (input, init) => {
79
79
  const request = new Request(input, init);
80
80
  const headers = new Headers(request.headers);
81
81
  headers.delete("x-api-key");
82
82
  headers.delete("x-goog-api-key");
83
83
  headers.set("Authorization", `Bearer ${apiToken}`);
84
+ if (projectSlug) {
85
+ headers.set("x-veryfront-project-slug", projectSlug);
86
+ }
84
87
  return fetch(new Request(request, { headers }));
85
88
  };
86
89
  }
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.213";
1
+ export declare const VERSION = "0.1.215";
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.213";
3
+ export const VERSION = "0.1.215";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.213",
3
+ "version": "0.1.215",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",
@@ -22,6 +22,7 @@ import {
22
22
  vfListRoutes,
23
23
  } from "./tools/project-tools.js";
24
24
  import { vfBuild } from "./tools/build-tool.js";
25
+ import { vfTriggerDeploy } from "./tools/deploy-tool.js";
25
26
  import { vfRunLint } from "./tools/run-lint-tool.js";
26
27
  import { vfRunTests } from "./tools/run-tests-tool.js";
27
28
  import { vfGetConventions, vfScaffold } from "./tools/scaffold-tools.js";
@@ -50,6 +51,7 @@ export const advancedTools: MCPTool[] = [
50
51
  vfGetDebugContext,
51
52
  vfGetComponentTree,
52
53
  vfBuild,
54
+ vfTriggerDeploy,
53
55
  vfHotReload,
54
56
  vfTriggerHmr,
55
57
  vfWaitForReady,
@@ -509,6 +509,40 @@ export class StandaloneMCPServer {
509
509
  };
510
510
  },
511
511
  },
512
+ {
513
+ name: "vf_trigger_deploy",
514
+ description: "Deploy a project to an environment via the Veryfront API. " +
515
+ "Creates a release from the specified branch and deploys it to the target environment. " +
516
+ "Requires a valid API token (set VERYFRONT_API_TOKEN or run 'veryfront login'). " +
517
+ "Do not use for local builds — use vf_build instead. " +
518
+ "Do not use for running tests before deploy — use vf_run_tests instead.",
519
+ inputSchema: {
520
+ type: "object",
521
+ properties: {
522
+ projectSlug: {
523
+ type: "string",
524
+ description: "The project slug to deploy. Example: 'my-app'.",
525
+ },
526
+ environment: {
527
+ type: "string",
528
+ description: "Target environment name. Defaults to 'production'.",
529
+ },
530
+ branch: {
531
+ type: "string",
532
+ description: "Git branch to create the release from. Defaults to 'main'.",
533
+ },
534
+ },
535
+ required: ["projectSlug"],
536
+ },
537
+ async execute(args) {
538
+ const { triggerDeploy } = await import("./tools/deploy-tool.js");
539
+ return triggerDeploy({
540
+ projectSlug: args.projectSlug as string,
541
+ environment: (args.environment as string) ?? "production",
542
+ branch: (args.branch as string) ?? "main",
543
+ });
544
+ },
545
+ },
512
546
  ...this.createContext7Tools(),
513
547
  ];
514
548
  }
@@ -0,0 +1,132 @@
1
+ /**
2
+ * MCP tool: vf_trigger_deploy
3
+ *
4
+ * Creates a release from a branch and deploys it to an environment.
5
+ * Wraps the same API calls used by the `vf deploy` CLI command.
6
+ */
7
+
8
+ import { z } from "zod";
9
+ import type { MCPTool } from "../../../src/mcp/index.js";
10
+ import { getEnvironmentConfig } from "../../../src/config/index.js";
11
+ import { createApiClient, resolveConfig } from "../../shared/config.js";
12
+ import {
13
+ createDeployment,
14
+ createRelease,
15
+ getEnvironmentByName,
16
+ } from "../../commands/deploy/command.js";
17
+
18
+ const triggerDeployInput = z.object({
19
+ projectSlug: z.string().describe(
20
+ "The project slug to deploy. Example: 'my-app'.",
21
+ ),
22
+ environment: z.string().optional().default("production").describe(
23
+ "Target environment name. Defaults to 'production'.",
24
+ ),
25
+ branch: z.string().optional().default("main").describe(
26
+ "Git branch to create the release from. Defaults to 'main'.",
27
+ ),
28
+ });
29
+
30
+ export type TriggerDeployInput = z.infer<typeof triggerDeployInput>;
31
+
32
+ export interface TriggerDeployResult {
33
+ success: boolean;
34
+ deploymentId?: string;
35
+ release?: { id: string; name: string; version: string };
36
+ environment?: { id: string; name: string };
37
+ error?: string;
38
+ }
39
+
40
+ /**
41
+ * Trigger a deploy via the Veryfront API.
42
+ *
43
+ * Exported for standalone MCP server reuse.
44
+ */
45
+ export async function triggerDeploy(
46
+ input: TriggerDeployInput,
47
+ ): Promise<TriggerDeployResult> {
48
+ try {
49
+ const env = getEnvironmentConfig();
50
+ const apiToken = env.apiToken;
51
+
52
+ if (!apiToken) {
53
+ return {
54
+ success: false,
55
+ error: "Not authenticated. Run 'veryfront login' first.",
56
+ };
57
+ }
58
+
59
+ const config = await resolveConfig(undefined, {
60
+ ...env,
61
+ apiToken,
62
+ projectSlug: input.projectSlug,
63
+ });
64
+
65
+ const client = createApiClient(config);
66
+
67
+ const environment = await getEnvironmentByName(
68
+ client,
69
+ input.projectSlug,
70
+ input.environment,
71
+ );
72
+ if (!environment) {
73
+ return {
74
+ success: false,
75
+ error: `Environment "${input.environment}" not found.`,
76
+ };
77
+ }
78
+
79
+ const release = await createRelease(client, input.projectSlug, {
80
+ branch: input.branch,
81
+ });
82
+
83
+ const deployment = await createDeployment(
84
+ client,
85
+ input.projectSlug,
86
+ release.id,
87
+ environment.id,
88
+ );
89
+
90
+ return {
91
+ success: true,
92
+ deploymentId: deployment.id,
93
+ release: { id: release.id, name: release.name, version: release.version },
94
+ environment: { id: environment.id, name: environment.name },
95
+ };
96
+ } catch (error) {
97
+ const message = error instanceof Error ? error.message : String(error);
98
+
99
+ if (
100
+ message.includes("Missing API token") ||
101
+ message.includes("Authentication required") ||
102
+ message.includes("401")
103
+ ) {
104
+ return {
105
+ success: false,
106
+ error: "Not authenticated. Run 'veryfront login' first.",
107
+ };
108
+ }
109
+
110
+ return { success: false, error: message };
111
+ }
112
+ }
113
+
114
+ export const vfTriggerDeploy: MCPTool<TriggerDeployInput, TriggerDeployResult> = {
115
+ name: "vf_trigger_deploy",
116
+ title: "Trigger Deploy",
117
+ annotations: {
118
+ readOnlyHint: false,
119
+ destructiveHint: false,
120
+ idempotentHint: false,
121
+ openWorldHint: true,
122
+ },
123
+ description:
124
+ "Use this when you need to deploy a project to an environment via the Veryfront API. " +
125
+ "Creates a release from the specified branch and deploys it to the target environment. " +
126
+ "Returns the deployment ID, release info, and environment info on success. " +
127
+ "Requires a valid API token (set VERYFRONT_API_TOKEN or run 'veryfront login'). " +
128
+ "Do not use for local builds — use vf_build instead. " +
129
+ "Do not use for running tests before deploy — use vf_run_tests instead.",
130
+ inputSchema: triggerDeployInput,
131
+ execute: (input) => triggerDeploy(input),
132
+ };
package/src/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.213",
3
+ "version": "0.1.215",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -462,6 +462,9 @@ export function mapRuntimeStreamEventToAgUiBrowserEvents(
462
462
  ];
463
463
 
464
464
  default:
465
+ if (typeof event.type === "string" && event.type.startsWith("data-")) {
466
+ return [createCustomDataEvent(event.type.slice(5), event.data)];
467
+ }
465
468
  return [];
466
469
  }
467
470
  }
@@ -301,6 +301,14 @@ export function processStream(
301
301
 
302
302
  const typedPart = part as RuntimeStreamPart;
303
303
 
304
+ if (typedPart.type.startsWith("data-")) {
305
+ sendSSE(controller, encoder, {
306
+ type: typedPart.type,
307
+ data: "data" in typedPart ? typedPart.data : undefined,
308
+ });
309
+ continue;
310
+ }
311
+
304
312
  switch (typedPart.type) {
305
313
  case "text-delta": {
306
314
  closeReasoningSegment();
@@ -62,6 +62,10 @@ export type RuntimeStreamPart =
62
62
  | { type: "reasoning-start"; id: string }
63
63
  | { type: "reasoning-delta"; id: string; delta: string }
64
64
  | { type: "reasoning-end"; id: string }
65
+ | {
66
+ type: `data-${string}`;
67
+ data: unknown;
68
+ }
65
69
  | {
66
70
  type: "tool-input-start";
67
71
  id: string;
@@ -1,3 +1,4 @@
1
+ import * as dntShim from "../../_dnt.shims.js";
1
2
  import type { EmbeddingRuntime, ModelRuntime } from "./types.js";
2
3
 
3
4
  export interface OpenAIRuntimeConfig {
@@ -379,6 +380,207 @@ type GoogleCompatibleRequest = {
379
380
  const DEFAULT_ANTHROPIC_BASE_URL = "https://api.anthropic.com/v1";
380
381
  const DEFAULT_OPENAI_BASE_URL = "https://api.openai.com/v1";
381
382
  const DEFAULT_GOOGLE_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
383
+ export const TOOL_INPUT_PENDING_THRESHOLD_MS = 5_000;
384
+ type ToolInputActivityStatus = "pending_input" | "streaming_input";
385
+
386
+ type ToolInputStatusState = {
387
+ dueAt: number | null;
388
+ lastStatus: ToolInputActivityStatus | null;
389
+ };
390
+
391
+ function getToolCallIdFromStreamPart(part: unknown): string | null {
392
+ if (!part || typeof part !== "object") {
393
+ return null;
394
+ }
395
+
396
+ const record = part as Record<string, unknown>;
397
+ if (typeof record.toolCallId === "string" && record.toolCallId.length > 0) {
398
+ return record.toolCallId;
399
+ }
400
+
401
+ if (typeof record.id === "string" && record.id.length > 0) {
402
+ return record.id;
403
+ }
404
+
405
+ return null;
406
+ }
407
+
408
+ function collectDueToolStatuses(
409
+ toolStates: Map<string, ToolInputStatusState>,
410
+ now: number,
411
+ thresholdMs: number,
412
+ ): Array<{ type: "data-tool-call-status"; data: { toolCallId: string; status: "pending_input" } }> {
413
+ const events: Array<
414
+ { type: "data-tool-call-status"; data: { toolCallId: string; status: "pending_input" } }
415
+ > = [];
416
+
417
+ for (const [toolCallId, state] of toolStates.entries()) {
418
+ if (state.dueAt === null || state.dueAt > now) {
419
+ continue;
420
+ }
421
+
422
+ state.dueAt = now + thresholdMs;
423
+ state.lastStatus = "pending_input";
424
+ events.push({
425
+ type: "data-tool-call-status",
426
+ data: {
427
+ toolCallId,
428
+ status: "pending_input",
429
+ },
430
+ });
431
+ }
432
+
433
+ return events;
434
+ }
435
+
436
+ export async function* withToolInputStatusTransitions(
437
+ stream: AsyncIterable<unknown>,
438
+ thresholdMs = TOOL_INPUT_PENDING_THRESHOLD_MS,
439
+ ): AsyncIterable<unknown> {
440
+ const iterator = stream[Symbol.asyncIterator]();
441
+ const toolStates = new Map<string, ToolInputStatusState>();
442
+ const buffered: unknown[] = [];
443
+ let nextPartPromise: Promise<IteratorResult<unknown>> | null = null;
444
+
445
+ const closeTool = (toolCallId: string | null) => {
446
+ if (!toolCallId) {
447
+ return;
448
+ }
449
+
450
+ toolStates.delete(toolCallId);
451
+ };
452
+
453
+ const schedulePending = (toolCallId: string | null) => {
454
+ if (!toolCallId) {
455
+ return;
456
+ }
457
+
458
+ const state = toolStates.get(toolCallId) ?? {
459
+ dueAt: null,
460
+ lastStatus: null,
461
+ };
462
+ state.dueAt = Date.now() + thresholdMs;
463
+ toolStates.set(toolCallId, state);
464
+ };
465
+
466
+ const markStreaming = (toolCallId: string | null) => {
467
+ if (!toolCallId) {
468
+ return;
469
+ }
470
+
471
+ const state = toolStates.get(toolCallId) ?? {
472
+ dueAt: null,
473
+ lastStatus: null,
474
+ };
475
+
476
+ if (state.lastStatus !== "streaming_input") {
477
+ buffered.push({
478
+ type: "data-tool-call-status",
479
+ data: {
480
+ toolCallId,
481
+ status: "streaming_input",
482
+ },
483
+ });
484
+ }
485
+
486
+ state.lastStatus = "streaming_input";
487
+ state.dueAt = Date.now() + thresholdMs;
488
+ toolStates.set(toolCallId, state);
489
+ };
490
+
491
+ const processPart = (part: unknown) => {
492
+ if (!part || typeof part !== "object") {
493
+ buffered.push(part);
494
+ return;
495
+ }
496
+
497
+ const record = part as Record<string, unknown>;
498
+ const partType = typeof record.type === "string" ? record.type : null;
499
+ const toolCallId = getToolCallIdFromStreamPart(part);
500
+
501
+ switch (partType) {
502
+ case "tool-input-start":
503
+ schedulePending(toolCallId);
504
+ buffered.push(part);
505
+ return;
506
+ case "tool-input-delta":
507
+ markStreaming(toolCallId);
508
+ buffered.push(part);
509
+ return;
510
+ case "tool-call":
511
+ case "tool-result":
512
+ case "tool-error":
513
+ closeTool(toolCallId);
514
+ buffered.push(part);
515
+ return;
516
+ case "finish":
517
+ case "error":
518
+ toolStates.clear();
519
+ buffered.push(part);
520
+ return;
521
+ default:
522
+ buffered.push(part);
523
+ return;
524
+ }
525
+ };
526
+
527
+ while (true) {
528
+ if (buffered.length > 0) {
529
+ yield buffered.shift();
530
+ continue;
531
+ }
532
+
533
+ if (!nextPartPromise) {
534
+ nextPartPromise = iterator.next();
535
+ }
536
+
537
+ const nextDueAt = [...toolStates.values()]
538
+ .map((state) => state.dueAt)
539
+ .filter((value): value is number => value !== null)
540
+ .sort((left, right) => left - right)[0] ?? null;
541
+
542
+ if (nextDueAt !== null) {
543
+ let timeoutId: ReturnType<typeof dntShim.setTimeout> | null = null;
544
+ const timeoutResult = await Promise.race([
545
+ nextPartPromise.then((result) => ({ kind: "part" as const, result })),
546
+ new Promise<{ kind: "timeout" }>((resolve) => {
547
+ timeoutId = dntShim.setTimeout(
548
+ () => resolve({ kind: "timeout" }),
549
+ Math.max(0, nextDueAt - Date.now()),
550
+ );
551
+ }),
552
+ ]);
553
+ if (timeoutId !== null) {
554
+ clearTimeout(timeoutId);
555
+ }
556
+
557
+ if (timeoutResult.kind === "timeout") {
558
+ buffered.push(...collectDueToolStatuses(toolStates, Date.now(), thresholdMs));
559
+ continue;
560
+ }
561
+
562
+ nextPartPromise = null;
563
+ if (timeoutResult.result.done) {
564
+ buffered.push(...collectDueToolStatuses(toolStates, Date.now(), thresholdMs));
565
+ while (buffered.length > 0) {
566
+ yield buffered.shift();
567
+ }
568
+ return;
569
+ }
570
+
571
+ processPart(timeoutResult.result.value);
572
+ continue;
573
+ }
574
+
575
+ const result = await nextPartPromise;
576
+ nextPartPromise = null;
577
+ if (result.done) {
578
+ return;
579
+ }
580
+
581
+ processPart(result.value);
582
+ }
583
+ }
382
584
 
383
585
  function joinUrl(base: string, path: string): string {
384
586
  return `${base.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
@@ -2901,7 +3103,9 @@ export function createOpenAIModelRuntime(
2901
3103
  }).then((responseStream) => {
2902
3104
  const drained = warnings.drain();
2903
3105
  return {
2904
- stream: ReadableStream.from(streamOpenAICompatibleParts(responseStream)),
3106
+ stream: ReadableStream.from(
3107
+ withToolInputStatusTransitions(streamOpenAICompatibleParts(responseStream)),
3108
+ ),
2905
3109
  ...(drained.length > 0 ? { warnings: drained } : {}),
2906
3110
  };
2907
3111
  });
@@ -3552,7 +3756,9 @@ export function createOpenAIResponsesRuntime(
3552
3756
  }).then((responseStream) => {
3553
3757
  const drained = warnings.drain();
3554
3758
  return {
3555
- stream: ReadableStream.from(streamOpenAIResponsesParts(responseStream)),
3759
+ stream: ReadableStream.from(
3760
+ withToolInputStatusTransitions(streamOpenAIResponsesParts(responseStream)),
3761
+ ),
3556
3762
  ...(drained.length > 0 ? { warnings: drained } : {}),
3557
3763
  };
3558
3764
  });
@@ -3633,7 +3839,9 @@ export function createAnthropicModelRuntime(
3633
3839
  }).then((responseStream) => {
3634
3840
  const drained = warnings.drain();
3635
3841
  return {
3636
- stream: ReadableStream.from(streamAnthropicCompatibleParts(responseStream)),
3842
+ stream: ReadableStream.from(
3843
+ withToolInputStatusTransitions(streamAnthropicCompatibleParts(responseStream)),
3844
+ ),
3637
3845
  ...(drained.length > 0 ? { warnings: drained } : {}),
3638
3846
  };
3639
3847
  });
@@ -3710,7 +3918,9 @@ export function createGoogleModelRuntime(
3710
3918
  }).then((responseStream) => {
3711
3919
  const drained = warnings.drain();
3712
3920
  return {
3713
- stream: ReadableStream.from(streamGoogleCompatibleParts(responseStream)),
3921
+ stream: ReadableStream.from(
3922
+ withToolInputStatusTransitions(streamGoogleCompatibleParts(responseStream)),
3923
+ ),
3714
3924
  ...(drained.length > 0 ? { warnings: drained } : {}),
3715
3925
  };
3716
3926
  });
@@ -14,9 +14,9 @@ import {
14
14
 
15
15
  export function createVeryfrontCloudModel(modelId: string): ModelRuntime {
16
16
  const { provider, modelId: upstreamModelId } = parseVeryfrontCloudModelId(modelId, "language");
17
- const { apiBaseUrl, apiToken } = requireVeryfrontCloudBootstrap();
17
+ const { apiBaseUrl, apiToken, projectSlug } = requireVeryfrontCloudBootstrap();
18
18
  const baseURL = getVeryfrontCloudGatewayBaseUrl(apiBaseUrl, provider);
19
- const fetch = createVeryfrontCloudFetch(apiToken);
19
+ const fetch = createVeryfrontCloudFetch(apiToken, projectSlug);
20
20
 
21
21
  switch (provider) {
22
22
  case "anthropic":
@@ -118,7 +118,10 @@ export function getVeryfrontCloudGatewayBaseUrl(
118
118
  * The gateway expects only Bearer auth, so we strip all provider-specific
119
119
  * headers to prevent credential leakage to the wrong auth path.
120
120
  */
121
- export function createVeryfrontCloudFetch(apiToken: string): typeof fetch {
121
+ export function createVeryfrontCloudFetch(
122
+ apiToken: string,
123
+ projectSlug?: string,
124
+ ): typeof fetch {
122
125
  return (input, init) => {
123
126
  const request = new Request(input, init);
124
127
  const headers = new Headers(request.headers);
@@ -127,6 +130,10 @@ export function createVeryfrontCloudFetch(apiToken: string): typeof fetch {
127
130
  headers.delete("x-goog-api-key");
128
131
  headers.set("Authorization", `Bearer ${apiToken}`);
129
132
 
133
+ if (projectSlug) {
134
+ headers.set("x-veryfront-project-slug", projectSlug);
135
+ }
136
+
130
137
  return fetch(new Request(request, { headers }));
131
138
  };
132
139
  }
@@ -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.213";
3
+ export const VERSION = "0.1.215";