veryfront 0.1.213 → 0.1.214
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.
- package/esm/cli/mcp/advanced-tools.d.ts.map +1 -1
- package/esm/cli/mcp/advanced-tools.js +2 -0
- package/esm/cli/mcp/standalone.d.ts.map +1 -1
- package/esm/cli/mcp/standalone.js +34 -0
- package/esm/cli/mcp/tools/deploy-tool.d.ts +37 -0
- package/esm/cli/mcp/tools/deploy-tool.d.ts.map +1 -0
- package/esm/cli/mcp/tools/deploy-tool.js +85 -0
- package/esm/deno.js +1 -1
- package/esm/src/agent/ag-ui-browser-encoder.d.ts.map +1 -1
- package/esm/src/agent/ag-ui-browser-encoder.js +3 -0
- package/esm/src/agent/runtime/chat-stream-handler.d.ts.map +1 -1
- package/esm/src/agent/runtime/chat-stream-handler.js +7 -0
- package/esm/src/agent/runtime/runtime-tool-types.d.ts +3 -0
- package/esm/src/agent/runtime/runtime-tool-types.d.ts.map +1 -1
- package/esm/src/provider/runtime-loader.d.ts +2 -0
- package/esm/src/provider/runtime-loader.d.ts.map +1 -1
- package/esm/src/provider/runtime-loader.js +159 -4
- package/esm/src/provider/veryfront-cloud/provider.js +2 -2
- package/esm/src/provider/veryfront-cloud/shared.d.ts +1 -1
- package/esm/src/provider/veryfront-cloud/shared.d.ts.map +1 -1
- package/esm/src/provider/veryfront-cloud/shared.js +4 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
- package/src/cli/mcp/advanced-tools.ts +2 -0
- package/src/cli/mcp/standalone.ts +34 -0
- package/src/cli/mcp/tools/deploy-tool.ts +132 -0
- package/src/deno.js +1 -1
- package/src/src/agent/ag-ui-browser-encoder.ts +3 -0
- package/src/src/agent/runtime/chat-stream-handler.ts +8 -0
- package/src/src/agent/runtime/runtime-tool-types.ts +4 -0
- package/src/src/provider/runtime-loader.ts +213 -4
- package/src/src/provider/veryfront-cloud/provider.ts +2 -2
- package/src/src/provider/veryfront-cloud/shared.ts +8 -1
- 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;
|
|
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/mcp/standalone.ts"],"names":[],"mappings":"AAsCA,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,KAAK,CAAmB;IAChC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAA4B;gBAEnC,MAAM,GAAE,mBAAwB;IAM5C,KAAK,IAAI,IAAI;IAWb,IAAI,IAAI,IAAI;YAME,aAAa;IAW3B,OAAO,CAAC,cAAc;YAgCR,eAAe;IAqB7B,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,mBAAmB;YAyBb,mBAAmB;IA6CjC,OAAO,CAAC,iBAAiB;YAkBX,gBAAgB;IAwB9B,OAAO,CAAC,WAAW;
|
|
1
|
+
{"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../../../src/cli/mcp/standalone.ts"],"names":[],"mappings":"AAsCA,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,KAAK,CAAmB;IAChC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAA4B;gBAEnC,MAAM,GAAE,mBAAwB;IAM5C,KAAK,IAAI,IAAI;IAWb,IAAI,IAAI,IAAI;YAME,aAAa;IAW3B,OAAO,CAAC,cAAc;YAgCR,eAAe;IAqB7B,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,mBAAmB;YAyBb,mBAAmB;IA6CjC,OAAO,CAAC,iBAAiB;YAkBX,gBAAgB;IAwB9B,OAAO,CAAC,WAAW;IAoSnB,OAAO,CAAC,mBAAmB;CA0F5B;AAED,wBAAgB,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 +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,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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AO,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,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACj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ASG;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();
|
|
@@ -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,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;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,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A,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;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,uBAAuB,EAAE,CAAC;IACtC,WAAW,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAC1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M,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":"
|
|
1
|
+
{"version":3,"file":"runtime-loader.d.ts","sourceRoot":"","sources":["../../../src/src/provider/runtime-loader.ts"],"names":[],"mappings":"AACA,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,CAAC,KAAK,CAAC;CACjC;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,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3D,qBAAa,kBAAmB,SAAQ,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) {
|
|
20
|
+
const events = [];
|
|
21
|
+
for (const [toolCallId, state] of toolStates.entries()) {
|
|
22
|
+
if (state.dueAt === null || state.dueAt > now || state.lastStatus === "pending_input") {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
state.dueAt = null;
|
|
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()));
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
nextPartPromise = null;
|
|
141
|
+
if (timeoutResult.result.done) {
|
|
142
|
+
buffered.push(...collectDueToolStatuses(toolStates, Date.now()));
|
|
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,
|
|
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.
|
|
1
|
+
export declare const VERSION = "0.1.214";
|
|
2
2
|
//# sourceMappingURL=version-constant.d.ts.map
|
package/package.json
CHANGED
|
@@ -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
|
@@ -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,206 @@ 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
|
+
): Array<{ type: "data-tool-call-status"; data: { toolCallId: string; status: "pending_input" } }> {
|
|
412
|
+
const events: Array<
|
|
413
|
+
{ type: "data-tool-call-status"; data: { toolCallId: string; status: "pending_input" } }
|
|
414
|
+
> = [];
|
|
415
|
+
|
|
416
|
+
for (const [toolCallId, state] of toolStates.entries()) {
|
|
417
|
+
if (state.dueAt === null || state.dueAt > now || state.lastStatus === "pending_input") {
|
|
418
|
+
continue;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
state.dueAt = null;
|
|
422
|
+
state.lastStatus = "pending_input";
|
|
423
|
+
events.push({
|
|
424
|
+
type: "data-tool-call-status",
|
|
425
|
+
data: {
|
|
426
|
+
toolCallId,
|
|
427
|
+
status: "pending_input",
|
|
428
|
+
},
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
return events;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
export async function* withToolInputStatusTransitions(
|
|
436
|
+
stream: AsyncIterable<unknown>,
|
|
437
|
+
thresholdMs = TOOL_INPUT_PENDING_THRESHOLD_MS,
|
|
438
|
+
): AsyncIterable<unknown> {
|
|
439
|
+
const iterator = stream[Symbol.asyncIterator]();
|
|
440
|
+
const toolStates = new Map<string, ToolInputStatusState>();
|
|
441
|
+
const buffered: unknown[] = [];
|
|
442
|
+
let nextPartPromise: Promise<IteratorResult<unknown>> | null = null;
|
|
443
|
+
|
|
444
|
+
const closeTool = (toolCallId: string | null) => {
|
|
445
|
+
if (!toolCallId) {
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
toolStates.delete(toolCallId);
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
const schedulePending = (toolCallId: string | null) => {
|
|
453
|
+
if (!toolCallId) {
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
const state = toolStates.get(toolCallId) ?? {
|
|
458
|
+
dueAt: null,
|
|
459
|
+
lastStatus: null,
|
|
460
|
+
};
|
|
461
|
+
state.dueAt = Date.now() + thresholdMs;
|
|
462
|
+
toolStates.set(toolCallId, state);
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
const markStreaming = (toolCallId: string | null) => {
|
|
466
|
+
if (!toolCallId) {
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
const state = toolStates.get(toolCallId) ?? {
|
|
471
|
+
dueAt: null,
|
|
472
|
+
lastStatus: null,
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
if (state.lastStatus !== "streaming_input") {
|
|
476
|
+
buffered.push({
|
|
477
|
+
type: "data-tool-call-status",
|
|
478
|
+
data: {
|
|
479
|
+
toolCallId,
|
|
480
|
+
status: "streaming_input",
|
|
481
|
+
},
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
state.lastStatus = "streaming_input";
|
|
486
|
+
state.dueAt = Date.now() + thresholdMs;
|
|
487
|
+
toolStates.set(toolCallId, state);
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
const processPart = (part: unknown) => {
|
|
491
|
+
if (!part || typeof part !== "object") {
|
|
492
|
+
buffered.push(part);
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
const record = part as Record<string, unknown>;
|
|
497
|
+
const partType = typeof record.type === "string" ? record.type : null;
|
|
498
|
+
const toolCallId = getToolCallIdFromStreamPart(part);
|
|
499
|
+
|
|
500
|
+
switch (partType) {
|
|
501
|
+
case "tool-input-start":
|
|
502
|
+
schedulePending(toolCallId);
|
|
503
|
+
buffered.push(part);
|
|
504
|
+
return;
|
|
505
|
+
case "tool-input-delta":
|
|
506
|
+
markStreaming(toolCallId);
|
|
507
|
+
buffered.push(part);
|
|
508
|
+
return;
|
|
509
|
+
case "tool-call":
|
|
510
|
+
case "tool-result":
|
|
511
|
+
case "tool-error":
|
|
512
|
+
closeTool(toolCallId);
|
|
513
|
+
buffered.push(part);
|
|
514
|
+
return;
|
|
515
|
+
case "finish":
|
|
516
|
+
case "error":
|
|
517
|
+
toolStates.clear();
|
|
518
|
+
buffered.push(part);
|
|
519
|
+
return;
|
|
520
|
+
default:
|
|
521
|
+
buffered.push(part);
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
while (true) {
|
|
527
|
+
if (buffered.length > 0) {
|
|
528
|
+
yield buffered.shift();
|
|
529
|
+
continue;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
if (!nextPartPromise) {
|
|
533
|
+
nextPartPromise = iterator.next();
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
const nextDueAt = [...toolStates.values()]
|
|
537
|
+
.map((state) => state.dueAt)
|
|
538
|
+
.filter((value): value is number => value !== null)
|
|
539
|
+
.sort((left, right) => left - right)[0] ?? null;
|
|
540
|
+
|
|
541
|
+
if (nextDueAt !== null) {
|
|
542
|
+
let timeoutId: ReturnType<typeof dntShim.setTimeout> | null = null;
|
|
543
|
+
const timeoutResult = await Promise.race([
|
|
544
|
+
nextPartPromise.then((result) => ({ kind: "part" as const, result })),
|
|
545
|
+
new Promise<{ kind: "timeout" }>((resolve) => {
|
|
546
|
+
timeoutId = dntShim.setTimeout(
|
|
547
|
+
() => resolve({ kind: "timeout" }),
|
|
548
|
+
Math.max(0, nextDueAt - Date.now()),
|
|
549
|
+
);
|
|
550
|
+
}),
|
|
551
|
+
]);
|
|
552
|
+
if (timeoutId !== null) {
|
|
553
|
+
clearTimeout(timeoutId);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
if (timeoutResult.kind === "timeout") {
|
|
557
|
+
buffered.push(...collectDueToolStatuses(toolStates, Date.now()));
|
|
558
|
+
continue;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
nextPartPromise = null;
|
|
562
|
+
if (timeoutResult.result.done) {
|
|
563
|
+
buffered.push(...collectDueToolStatuses(toolStates, Date.now()));
|
|
564
|
+
while (buffered.length > 0) {
|
|
565
|
+
yield buffered.shift();
|
|
566
|
+
}
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
processPart(timeoutResult.result.value);
|
|
571
|
+
continue;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
const result = await nextPartPromise;
|
|
575
|
+
nextPartPromise = null;
|
|
576
|
+
if (result.done) {
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
processPart(result.value);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
382
583
|
|
|
383
584
|
function joinUrl(base: string, path: string): string {
|
|
384
585
|
return `${base.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
@@ -2901,7 +3102,9 @@ export function createOpenAIModelRuntime(
|
|
|
2901
3102
|
}).then((responseStream) => {
|
|
2902
3103
|
const drained = warnings.drain();
|
|
2903
3104
|
return {
|
|
2904
|
-
stream: ReadableStream.from(
|
|
3105
|
+
stream: ReadableStream.from(
|
|
3106
|
+
withToolInputStatusTransitions(streamOpenAICompatibleParts(responseStream)),
|
|
3107
|
+
),
|
|
2905
3108
|
...(drained.length > 0 ? { warnings: drained } : {}),
|
|
2906
3109
|
};
|
|
2907
3110
|
});
|
|
@@ -3552,7 +3755,9 @@ export function createOpenAIResponsesRuntime(
|
|
|
3552
3755
|
}).then((responseStream) => {
|
|
3553
3756
|
const drained = warnings.drain();
|
|
3554
3757
|
return {
|
|
3555
|
-
stream: ReadableStream.from(
|
|
3758
|
+
stream: ReadableStream.from(
|
|
3759
|
+
withToolInputStatusTransitions(streamOpenAIResponsesParts(responseStream)),
|
|
3760
|
+
),
|
|
3556
3761
|
...(drained.length > 0 ? { warnings: drained } : {}),
|
|
3557
3762
|
};
|
|
3558
3763
|
});
|
|
@@ -3633,7 +3838,9 @@ export function createAnthropicModelRuntime(
|
|
|
3633
3838
|
}).then((responseStream) => {
|
|
3634
3839
|
const drained = warnings.drain();
|
|
3635
3840
|
return {
|
|
3636
|
-
stream: ReadableStream.from(
|
|
3841
|
+
stream: ReadableStream.from(
|
|
3842
|
+
withToolInputStatusTransitions(streamAnthropicCompatibleParts(responseStream)),
|
|
3843
|
+
),
|
|
3637
3844
|
...(drained.length > 0 ? { warnings: drained } : {}),
|
|
3638
3845
|
};
|
|
3639
3846
|
});
|
|
@@ -3710,7 +3917,9 @@ export function createGoogleModelRuntime(
|
|
|
3710
3917
|
}).then((responseStream) => {
|
|
3711
3918
|
const drained = warnings.drain();
|
|
3712
3919
|
return {
|
|
3713
|
-
stream: ReadableStream.from(
|
|
3920
|
+
stream: ReadableStream.from(
|
|
3921
|
+
withToolInputStatusTransitions(streamGoogleCompatibleParts(responseStream)),
|
|
3922
|
+
),
|
|
3714
3923
|
...(drained.length > 0 ? { warnings: drained } : {}),
|
|
3715
3924
|
};
|
|
3716
3925
|
});
|
|
@@ -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(
|
|
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
|
}
|