veryfront 0.1.999 → 0.1.1002
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/commands/pull/command.d.ts.map +1 -1
- package/esm/cli/commands/pull/command.js +5 -3
- package/esm/cli/commands/up/command.d.ts.map +1 -1
- package/esm/cli/commands/up/command.js +4 -3
- package/esm/cli/shared/config.d.ts.map +1 -1
- package/esm/cli/shared/config.js +22 -10
- package/esm/cli/shared/constants.d.ts +1 -0
- package/esm/cli/shared/constants.d.ts.map +1 -1
- package/esm/cli/shared/constants.js +16 -1
- package/esm/deno.js +1 -1
- package/esm/deps/esm.sh/react-dom@19.2.4/client.d.ts +3 -2
- package/esm/deps/esm.sh/react-dom@19.2.4/server.d.ts +3 -2
- package/esm/deps/esm.sh/react-dom@19.2.4.d.ts +3 -2
- package/esm/deps/esm.sh/react@19.2.4/jsx-dev-runtime.d.ts +3 -2
- package/esm/deps/esm.sh/react@19.2.4/jsx-runtime.d.ts +3 -2
- package/esm/deps/esm.sh/react@19.2.4.d.ts +3 -2
- package/esm/deps/esm.sh/scheduler@^0.27.0.d.ts +3 -2
- package/esm/src/agent/hosted/chat-preparation.d.ts +1 -1
- package/esm/src/agent/hosted/chat-preparation.d.ts.map +1 -1
- package/esm/src/agent/hosted/chat-preparation.js +5 -0
- package/esm/src/agent/runtime/message-file-url-refresh.d.ts +26 -1
- package/esm/src/agent/runtime/message-file-url-refresh.d.ts.map +1 -1
- package/esm/src/agent/runtime/message-file-url-refresh.js +219 -0
- package/esm/src/agent/runtime/message-preparation.d.ts +4 -1
- package/esm/src/agent/runtime/message-preparation.d.ts.map +1 -1
- package/esm/src/agent/runtime/message-preparation.js +20 -4
- package/esm/src/discovery/transpiler.d.ts.map +1 -1
- package/esm/src/discovery/transpiler.js +8 -1
- package/esm/src/extensions/bundler/defaults.d.ts +6 -0
- package/esm/src/extensions/bundler/defaults.d.ts.map +1 -0
- package/esm/src/extensions/bundler/defaults.js +21 -0
- package/esm/src/internal-agents/run-stream.d.ts +1 -0
- package/esm/src/internal-agents/run-stream.d.ts.map +1 -1
- package/esm/src/internal-agents/run-stream.js +5 -1
- package/esm/src/provider/model-registry.d.ts.map +1 -1
- package/esm/src/provider/model-registry.js +15 -1
- package/esm/src/server/handlers/request/agent-stream.handler.d.ts +1 -0
- package/esm/src/server/handlers/request/agent-stream.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/agent-stream.handler.js +4 -0
- package/esm/src/testing/init.js +2 -18
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.d.ts.map +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/pull/command.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/pull/command.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAM3E,OAAO,EACL,eAAe,EAIhB,MAAM,wBAAwB,CAAC;AAOhC;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;GAY7B,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;GAAgC,CAAC;AAE5D,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC;AAEzE;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;GAUxB,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA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,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAmBjG;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,EAC1C,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,MAAM,CAAC,CAQjB;AA8ID;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuGpE"}
|
|
@@ -9,12 +9,13 @@
|
|
|
9
9
|
import { defineSchema, lazySchema } from "../../../src/schemas/index.js";
|
|
10
10
|
import { dirname, join, normalize, resolve } from "../../../src/platform/compat/path/index.js";
|
|
11
11
|
import { cliLogger } from "../../utils/index.js";
|
|
12
|
+
import { resolveCliApiUrl } from "../../shared/constants.js";
|
|
12
13
|
import { cwd } from "../../../src/platform/index.js";
|
|
13
14
|
import { createFileSystem } from "../../../src/platform/index.js";
|
|
14
15
|
import { createApiClient, readConfigFile, resolveConfigWithAuth, } from "../../shared/config.js";
|
|
15
16
|
import { confirmPrompt, logInfo, logSuccess, logWarning } from "../../utils/index.js";
|
|
16
17
|
import { createNoopSpinner, createSpinner } from "../../ui/index.js";
|
|
17
|
-
import { getApiTokenEnv } from "../../../src/config/index.js";
|
|
18
|
+
import { getApiTokenEnv, getEnvironmentConfig } from "../../../src/config/index.js";
|
|
18
19
|
import { withSpan } from "../../../src/observability/tracing/otlp-setup.js";
|
|
19
20
|
import { CommonArgs, createArgParser } from "../../shared/args.js";
|
|
20
21
|
/**
|
|
@@ -268,12 +269,13 @@ export function pullCommand(options = {}) {
|
|
|
268
269
|
spinner.stop();
|
|
269
270
|
if (!projects?.length)
|
|
270
271
|
throw error;
|
|
271
|
-
const
|
|
272
|
+
const env = getEnvironmentConfig();
|
|
273
|
+
const token = getApiTokenEnv(env) ?? configFile?.apiToken;
|
|
272
274
|
if (!token) {
|
|
273
275
|
throw new Error("VERYFRONT_API_TOKEN environment variable or apiToken in veryfront.json is required when using --projects");
|
|
274
276
|
}
|
|
275
277
|
config = {
|
|
276
|
-
apiUrl: configFile?.apiUrl
|
|
278
|
+
apiUrl: resolveCliApiUrl(env, configFile?.apiUrl),
|
|
277
279
|
apiToken: token,
|
|
278
280
|
projectSlug: "",
|
|
279
281
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/up/command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAO3E,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/up/command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAO3E,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,8BAA8B,CAAC;AAS5F,eAAO,MAAM,eAAe;;;GAK3B,CAAC;AAEF,eAAO,MAAM,YAAY;;;GAA8B,CAAC;AAExD,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC;AAExE,eAAO,MAAM,WAAW;;;GAGtB,CAAC;AAyEH,wBAAsB,SAAS,CAC7B,OAAO,GAAE,OAAO,CAAC,SAAS,CAAM,EAChC,GAAG,GAAE,iBAA0C,GAC9C,OAAO,CAAC,IAAI,CAAC,CA+Gf"}
|
|
@@ -10,6 +10,7 @@ import { createSpinner, shouldUseColor } from "../../ui/index.js";
|
|
|
10
10
|
import { isTTY, promptUser } from "../../utils/index.js";
|
|
11
11
|
import { CommonArgs, createArgParser } from "../../shared/args.js";
|
|
12
12
|
import { readConfigFile } from "../../shared/config.js";
|
|
13
|
+
import { resolveCliApiUrl } from "../../shared/constants.js";
|
|
13
14
|
import { pushCommand } from "../push/index.js";
|
|
14
15
|
import { deployCommand } from "../deploy/index.js";
|
|
15
16
|
export const getUpArgsSchema = defineSchema((v) => v.object({
|
|
@@ -77,7 +78,7 @@ export async function upCommand(options = {}, env = getEnvironmentConfig()) {
|
|
|
77
78
|
const useColor = shouldUseColor();
|
|
78
79
|
const c = (fn, s) => (useColor ? fn(s) : s);
|
|
79
80
|
const projectDir = cwd();
|
|
80
|
-
const userInfo = await ensureAuthenticated();
|
|
81
|
+
const userInfo = await ensureAuthenticated(env);
|
|
81
82
|
if (!userInfo)
|
|
82
83
|
return;
|
|
83
84
|
const spinner = createSpinner("Analyzing project...");
|
|
@@ -114,8 +115,8 @@ export async function upCommand(options = {}, env = getEnvironmentConfig()) {
|
|
|
114
115
|
else {
|
|
115
116
|
const projectSpinner = createSpinner(`Creating project "${slug}"...`);
|
|
116
117
|
try {
|
|
117
|
-
const apiUrl = env
|
|
118
|
-
const resolvedToken = env.apiToken ?? (await readToken());
|
|
118
|
+
const apiUrl = resolveCliApiUrl(env);
|
|
119
|
+
const resolvedToken = env.apiToken ?? (await readToken(env));
|
|
119
120
|
if (!resolvedToken) {
|
|
120
121
|
projectSpinner.stop();
|
|
121
122
|
cliLogger.error("Not authenticated");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/cli/shared/config.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAGxE,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,2BAA2B,CAAC;AA6BzF,eAAO,MAAM,wBAAwB;;IAGjC,mDAAmD;;;;GAKtD,CAAC;AACF,eAAO,MAAM,qBAAqB;;IAN9B,mDAAmD;;;;GAMkB,CAAC;AAC1E,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAA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C,cAAc,CAYhB,CAAC;AAUhE,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAClE,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAClD,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACjD,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACnD,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACrC;AAED,eAAO,MAAM,iBAAiB;;;;GAM7B,CAAC;AACF,eAAO,MAAM,cAAc;;;;GAAgC,CAAC;AAC5D,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC;AAEzE,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,CA+GjE"}
|
package/esm/cli/shared/config.js
CHANGED
|
@@ -12,7 +12,7 @@ import { getEnvironmentConfig } from "../../src/config/index.js";
|
|
|
12
12
|
import { cliLogger, VERSION } from "../utils/index.js";
|
|
13
13
|
import { readToken } from "../auth/token-store.js";
|
|
14
14
|
import { ensureAuthenticated } from "../auth/login.js";
|
|
15
|
-
import {
|
|
15
|
+
import { resolveCliApiUrl } from "./constants.js";
|
|
16
16
|
import { isRetryableConnectionError } from "../../src/proxy/retry.js";
|
|
17
17
|
// Delays for exponential backoff with jitter: attempt 1 = ~300ms, 2 = ~1s, 3 = ~3s
|
|
18
18
|
const API_RETRY_DELAYS_MS = [300, 1000, 3000];
|
|
@@ -49,6 +49,7 @@ export const getResolvedConfigSchema = defineSchema((v) => v.object({
|
|
|
49
49
|
export const ResolvedConfigSchema = lazySchema(getResolvedConfigSchema);
|
|
50
50
|
export async function readConfigFile(projectDir) {
|
|
51
51
|
const fs = createFileSystem();
|
|
52
|
+
let moduleProjectSlug;
|
|
52
53
|
for (const ext of [".ts", ".js"]) {
|
|
53
54
|
const configPath = join(projectDir, `veryfront.config${ext}`);
|
|
54
55
|
try {
|
|
@@ -56,25 +57,36 @@ export async function readConfigFile(projectDir) {
|
|
|
56
57
|
continue;
|
|
57
58
|
const module = await import(`file://${configPath}`);
|
|
58
59
|
const config = module.default ?? module;
|
|
59
|
-
if (config?.projectSlug)
|
|
60
|
-
|
|
60
|
+
if (config?.projectSlug) {
|
|
61
|
+
moduleProjectSlug = config.projectSlug;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
61
64
|
}
|
|
62
65
|
catch (error) {
|
|
63
66
|
cliLogger.debug(`Failed to import config file ${configPath}:`, error);
|
|
64
67
|
}
|
|
65
68
|
}
|
|
69
|
+
// veryfront.json is always merged in: veryfront.config.ts owns the
|
|
70
|
+
// projectSlug when both define one, but apiUrl/apiToken only live in
|
|
71
|
+
// veryfront.json and must not be dropped because a TS config exists.
|
|
66
72
|
const configJsonPath = join(projectDir, "veryfront.json");
|
|
73
|
+
let jsonConfig = null;
|
|
67
74
|
try {
|
|
68
|
-
if (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
if (await fs.exists(configJsonPath)) {
|
|
76
|
+
const content = await fs.readTextFile(configJsonPath);
|
|
77
|
+
const parsed = VeryfrontConfigSchema.safeParse(JSON.parse(content));
|
|
78
|
+
jsonConfig = parsed.success ? parsed.data : null;
|
|
79
|
+
}
|
|
73
80
|
}
|
|
74
81
|
catch (error) {
|
|
75
82
|
cliLogger.debug(`Failed to read veryfront.json:`, error);
|
|
76
|
-
return null;
|
|
77
83
|
}
|
|
84
|
+
if (!moduleProjectSlug && !jsonConfig)
|
|
85
|
+
return null;
|
|
86
|
+
return {
|
|
87
|
+
...jsonConfig,
|
|
88
|
+
...(moduleProjectSlug ? { projectSlug: moduleProjectSlug } : {}),
|
|
89
|
+
};
|
|
78
90
|
}
|
|
79
91
|
export async function writeProjectSlug(projectDir, slug) {
|
|
80
92
|
const fs = createFileSystem();
|
|
@@ -121,7 +133,7 @@ function resolveTenantProjectReference() {
|
|
|
121
133
|
async function resolveConfigBase(projectDir, env, interactive) {
|
|
122
134
|
const dir = projectDir ?? cwd();
|
|
123
135
|
const configFile = await readConfigFile(dir);
|
|
124
|
-
const apiUrl = env
|
|
136
|
+
const apiUrl = resolveCliApiUrl(env, configFile?.apiUrl);
|
|
125
137
|
let apiToken = env.apiToken ?? configFile?.apiToken ?? (await readToken(env));
|
|
126
138
|
if (!apiToken && interactive) {
|
|
127
139
|
const userInfo = await ensureAuthenticated(env);
|
|
@@ -12,6 +12,7 @@ export declare const DEFAULT_CALLBACK_PORT = 9876;
|
|
|
12
12
|
export declare const MAX_PORT_ATTEMPTS = 100;
|
|
13
13
|
export declare const DEFAULT_API_URL = "https://api.veryfront.com";
|
|
14
14
|
export declare const DEFAULT_LOCAL_API_URL = "https://api.veryfront.com";
|
|
15
|
+
export declare function resolveCliApiUrl(env?: EnvironmentConfig, configApiUrl?: string): string;
|
|
15
16
|
export declare function getApiUrl(env?: EnvironmentConfig): string;
|
|
16
17
|
export declare const DEFAULT_LOGIN_TIMEOUT_MS = 120000;
|
|
17
18
|
export declare const SHUTDOWN_TIMEOUT_MS = 3000;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/cli/shared/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,2BAA2B,CAAC;AAEzF,eAAO,MAAM,gBAAgB,O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AC"}
|
|
@@ -12,8 +12,23 @@ export const DEFAULT_CALLBACK_PORT = 9876;
|
|
|
12
12
|
export const MAX_PORT_ATTEMPTS = 100;
|
|
13
13
|
export const DEFAULT_API_URL = "https://api.veryfront.com";
|
|
14
14
|
export const DEFAULT_LOCAL_API_URL = "https://api.veryfront.com";
|
|
15
|
+
function getExplicitApiBaseUrl(env) {
|
|
16
|
+
if (!env.apiBaseUrl || env.apiBaseUrl === DEFAULT_API_URL)
|
|
17
|
+
return undefined;
|
|
18
|
+
return env.apiBaseUrl;
|
|
19
|
+
}
|
|
20
|
+
export function resolveCliApiUrl(env = getEnvironmentConfig(), configApiUrl) {
|
|
21
|
+
// VERYFRONT_API_URL wins. A non-default VERYFRONT_API_BASE_URL is an
|
|
22
|
+
// operator override, so it wins over a checked-in veryfront.json apiUrl.
|
|
23
|
+
// The default production apiBaseUrl stays below project config.
|
|
24
|
+
return env.apiUrl ??
|
|
25
|
+
getExplicitApiBaseUrl(env) ??
|
|
26
|
+
configApiUrl ??
|
|
27
|
+
env.apiBaseUrl ??
|
|
28
|
+
DEFAULT_API_URL;
|
|
29
|
+
}
|
|
15
30
|
export function getApiUrl(env = getEnvironmentConfig()) {
|
|
16
|
-
return env
|
|
31
|
+
return resolveCliApiUrl(env);
|
|
17
32
|
}
|
|
18
33
|
export const DEFAULT_LOGIN_TIMEOUT_MS = 120_000;
|
|
19
34
|
export const SHUTDOWN_TIMEOUT_MS = 3_000;
|
package/esm/deno.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* npm package shim for esm.sh react-dom@19.2.4/client.d.ts */
|
|
2
|
+
export * from "react-dom/client";
|
|
3
|
+
export { default } from "react-dom/client";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* npm package shim for esm.sh react-dom@19.2.4/server.d.ts */
|
|
2
|
+
export * from "react-dom/server";
|
|
3
|
+
export { default } from "react-dom/server";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* npm package shim for esm.sh react-dom@19.2.4.d.ts */
|
|
2
|
+
export * from "react-dom";
|
|
3
|
+
export { default } from "react-dom";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* npm package shim for esm.sh react@19.2.4/jsx-dev-runtime.d.ts */
|
|
2
|
+
export * from "react/jsx-dev-runtime";
|
|
3
|
+
export { default } from "react/jsx-dev-runtime";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* npm package shim for esm.sh react@19.2.4/jsx-runtime.d.ts */
|
|
2
|
+
export * from "react/jsx-runtime";
|
|
3
|
+
export { default } from "react/jsx-runtime";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* npm package shim for esm.sh react@19.2.4.d.ts */
|
|
2
|
+
export * from "react";
|
|
3
|
+
export { default } from "react";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* npm package shim for esm.sh scheduler@^0.27.0.d.ts */
|
|
2
|
+
export * from "scheduler";
|
|
3
|
+
export { default } from "scheduler";
|
|
@@ -16,7 +16,7 @@ export type NormalizedHostedChatRequest = {
|
|
|
16
16
|
parentMessageId: string | undefined;
|
|
17
17
|
};
|
|
18
18
|
/** Options accepted by prepare hosted chat runtime messages. */
|
|
19
|
-
export type PrepareHostedChatRuntimeMessagesOptions = Pick<PrepareAgentRuntimeMessagesFromUiMessagesOptions, "emptyConversationPrompt" | "providerOwnedToolNames"> & {
|
|
19
|
+
export type PrepareHostedChatRuntimeMessagesOptions = Pick<PrepareAgentRuntimeMessagesFromUiMessagesOptions, "emptyConversationPrompt" | "providerOwnedToolNames" | "abortSignal" | "fileContentFetchTimeoutMs"> & {
|
|
20
20
|
authToken?: string;
|
|
21
21
|
apiUrl?: string | URL;
|
|
22
22
|
projectId?: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-preparation.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/chat-preparation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,KAAK,EACV,gCAAgC,EAChC,+BAA+B,EAEhC,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EACL,KAAK,gCAAgC,EAErC,KAAK,4CAA4C,EAClD,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAEL,KAAK,gDAAgD,EACtD,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AACjF,OAAO,EACL,KAAK,kCAAkC,EAExC,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAA2B,KAAK,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACpG,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAEjC,MAAM,6BAA6B,CAAC;AAGrC,kDAAkD;AAClD,MAAM,MAAM,2BAA2B,GAAG;IACxC,iBAAiB,EAAE,aAAa,EAAE,CAAC;IACnC,yBAAyB,EAAE,kBAAkB,CAAC;IAC9C,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC,CAAC;AAEF,gEAAgE;AAChE,MAAM,MAAM,uCAAuC,GAC/C,IAAI,CACJ,gDAAgD,
|
|
1
|
+
{"version":3,"file":"chat-preparation.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/chat-preparation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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,OAAO,CAAC,mBAAmB,EAAE,CAAC,CA2BhC"}
|
|
@@ -167,6 +167,7 @@ export async function prepareHostedChatExecution(input) {
|
|
|
167
167
|
apiUrl: input.apiUrl,
|
|
168
168
|
projectId: input.request.projectId,
|
|
169
169
|
providerOwnedToolNames: getProviderToolNames(input.agentConfig),
|
|
170
|
+
abortSignal: input.abortSignal,
|
|
170
171
|
});
|
|
171
172
|
let budgetedContext;
|
|
172
173
|
if (input.contextBudget) {
|
|
@@ -213,6 +214,8 @@ export async function prepareHostedChatRuntimeMessages(messages, options = {}) {
|
|
|
213
214
|
messages,
|
|
214
215
|
emptyConversationPrompt: options.emptyConversationPrompt,
|
|
215
216
|
providerOwnedToolNames: options.providerOwnedToolNames,
|
|
217
|
+
abortSignal: options.abortSignal,
|
|
218
|
+
fileContentFetchTimeoutMs: options.fileContentFetchTimeoutMs,
|
|
216
219
|
});
|
|
217
220
|
}
|
|
218
221
|
const authToken = options.authToken;
|
|
@@ -221,6 +224,8 @@ export async function prepareHostedChatRuntimeMessages(messages, options = {}) {
|
|
|
221
224
|
messages,
|
|
222
225
|
emptyConversationPrompt: options.emptyConversationPrompt,
|
|
223
226
|
providerOwnedToolNames: options.providerOwnedToolNames,
|
|
227
|
+
abortSignal: options.abortSignal,
|
|
228
|
+
fileContentFetchTimeoutMs: options.fileContentFetchTimeoutMs,
|
|
224
229
|
resolveFileUrl: ({ uploadId }) => getRuntimeUploadUrl({
|
|
225
230
|
apiUrl,
|
|
226
231
|
authToken,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ChatUiMessage, type FileUIPartWithUpload } from "../../chat/types.js";
|
|
2
2
|
/** Input payload for runtime file URL resolver. */
|
|
3
3
|
export type RuntimeFileUrlResolverInput = {
|
|
4
4
|
uploadId: string;
|
|
@@ -7,6 +7,31 @@ export type RuntimeFileUrlResolverInput = {
|
|
|
7
7
|
};
|
|
8
8
|
/** Public API contract for runtime file URL resolver. */
|
|
9
9
|
export type RuntimeFileUrlResolver = (input: RuntimeFileUrlResolverInput) => Promise<string | undefined>;
|
|
10
|
+
/** Input payload for runtime file content fetcher. */
|
|
11
|
+
export type RuntimeFileContentFetcherInput = {
|
|
12
|
+
url: string;
|
|
13
|
+
mediaType: string;
|
|
14
|
+
filename?: string;
|
|
15
|
+
uploadId?: string;
|
|
16
|
+
uploadPath?: string;
|
|
17
|
+
abortSignal?: AbortSignal;
|
|
18
|
+
timeoutMs?: number;
|
|
19
|
+
part: FileUIPartWithUpload;
|
|
20
|
+
message: ChatUiMessage;
|
|
21
|
+
};
|
|
22
|
+
/** Public API contract for runtime file content fetcher. */
|
|
23
|
+
export type RuntimeFileContentFetcher = (input: RuntimeFileContentFetcherInput) => Promise<string | undefined>;
|
|
24
|
+
/** Creates a safe runtime file content fetcher. */
|
|
25
|
+
export declare function createRuntimeFileContentFetcher(options?: {
|
|
26
|
+
trustedUrls?: ReadonlySet<string>;
|
|
27
|
+
abortSignal?: AbortSignal;
|
|
28
|
+
timeoutMs?: number;
|
|
29
|
+
}): RuntimeFileContentFetcher;
|
|
10
30
|
/** Resolves runtime message file urls. */
|
|
11
31
|
export declare function resolveRuntimeMessageFileUrls(messages: readonly ChatUiMessage[], resolveFileUrl: RuntimeFileUrlResolver): Promise<ChatUiMessage[]>;
|
|
32
|
+
/** Fetches text attachment bodies and adds them as adjacent text parts. */
|
|
33
|
+
export declare function inlineRuntimeMessageFileContents(messages: readonly ChatUiMessage[], fetchFileContent?: RuntimeFileContentFetcher, options?: {
|
|
34
|
+
abortSignal?: AbortSignal;
|
|
35
|
+
fetchTimeoutMs?: number;
|
|
36
|
+
}): Promise<ChatUiMessage[]>;
|
|
12
37
|
//# sourceMappingURL=message-file-url-refresh.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-file-url-refresh.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/message-file-url-refresh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"message-file-url-refresh.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/message-file-url-refresh.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAE1B,MAAM,qBAAqB,CAAC;AAK7B,mDAAmD;AACnD,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,oBAAoB,CAAC;IAC3B,OAAO,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,yDAAyD;AACzD,MAAM,MAAM,sBAAsB,GAAG,CACnC,KAAK,EAAE,2BAA2B,KAC/B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAEjC,sDAAsD;AACtD,MAAM,MAAM,8BAA8B,GAAG;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,oBAAoB,CAAC;IAC3B,OAAO,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,4DAA4D;AAC5D,MAAM,MAAM,yBAAyB,GAAG,CACtC,KAAK,EAAE,8BAA8B,KAClC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAEjC,mDAAmD;AACnD,wBAAgB,+BAA+B,CAC7C,OAAO,GAAE;IACP,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACf,GACL,yBAAyB,CAe3B;AAED,0CAA0C;AAC1C,wBAAsB,6BAA6B,CACjD,QAAQ,EAAE,SAAS,aAAa,EAAE,EAClC,cAAc,EAAE,sBAAsB,GACrC,OAAO,CAAC,aAAa,EAAE,CAAC,CAqC1B;AAED,2EAA2E;AAC3E,wBAAsB,gCAAgC,CACpD,QAAQ,EAAE,SAAS,aAAa,EAAE,EAClC,gBAAgB,GAAE,yBAA6D,EAC/E,OAAO,GAAE;IACP,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;CACpB,GACL,OAAO,CAAC,aAAa,EAAE,CAAC,CA4C1B"}
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
import { isTextPreviewFile, } from "../../chat/types.js";
|
|
2
|
+
const MAX_INLINE_FILE_CONTENT_CHARS = 200_000;
|
|
3
|
+
const DEFAULT_RUNTIME_FILE_CONTENT_FETCH_TIMEOUT_MS = 15_000;
|
|
4
|
+
/** Creates a safe runtime file content fetcher. */
|
|
5
|
+
export function createRuntimeFileContentFetcher(options = {}) {
|
|
6
|
+
const trustedUrls = options.trustedUrls;
|
|
7
|
+
return async (input) => {
|
|
8
|
+
if (!isFetchableRuntimeFileContentUrl(input.url, trustedUrls)) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
const abortSignal = input.abortSignal ?? options.abortSignal;
|
|
12
|
+
const timeoutMs = input.timeoutMs ?? options.timeoutMs;
|
|
13
|
+
return await fetchRuntimeTextFileContent({
|
|
14
|
+
...input,
|
|
15
|
+
...(abortSignal ? { abortSignal } : {}),
|
|
16
|
+
...(timeoutMs != null ? { timeoutMs } : {}),
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
}
|
|
1
20
|
/** Resolves runtime message file urls. */
|
|
2
21
|
export async function resolveRuntimeMessageFileUrls(messages, resolveFileUrl) {
|
|
3
22
|
const urlByUploadId = new Map();
|
|
@@ -29,6 +48,45 @@ export async function resolveRuntimeMessageFileUrls(messages, resolveFileUrl) {
|
|
|
29
48
|
return { ...message, parts };
|
|
30
49
|
}));
|
|
31
50
|
}
|
|
51
|
+
/** Fetches text attachment bodies and adds them as adjacent text parts. */
|
|
52
|
+
export async function inlineRuntimeMessageFileContents(messages, fetchFileContent = createRuntimeFileContentFetcher(), options = {}) {
|
|
53
|
+
const contentByUrl = new Map();
|
|
54
|
+
return Promise.all(messages.map(async (message) => {
|
|
55
|
+
if (!message.parts.some((part) => shouldInlineFileContent(part))) {
|
|
56
|
+
return message;
|
|
57
|
+
}
|
|
58
|
+
const parts = [];
|
|
59
|
+
for (const part of message.parts) {
|
|
60
|
+
parts.push(part);
|
|
61
|
+
const file = getInlineableFilePart(part);
|
|
62
|
+
if (!file)
|
|
63
|
+
continue;
|
|
64
|
+
let contentPromise = contentByUrl.get(file.url);
|
|
65
|
+
if (!contentPromise) {
|
|
66
|
+
contentPromise = fetchFileContent({
|
|
67
|
+
url: file.url,
|
|
68
|
+
mediaType: file.mediaType,
|
|
69
|
+
...(file.filename ? { filename: file.filename } : {}),
|
|
70
|
+
...(file.uploadId ? { uploadId: file.uploadId } : {}),
|
|
71
|
+
...(file.uploadPath ? { uploadPath: file.uploadPath } : {}),
|
|
72
|
+
...(options.abortSignal ? { abortSignal: options.abortSignal } : {}),
|
|
73
|
+
...(options.fetchTimeoutMs != null ? { timeoutMs: options.fetchTimeoutMs } : {}),
|
|
74
|
+
part: file,
|
|
75
|
+
message,
|
|
76
|
+
}).then(normalizeInlineFileContent);
|
|
77
|
+
contentByUrl.set(file.url, contentPromise);
|
|
78
|
+
}
|
|
79
|
+
const content = await contentPromise;
|
|
80
|
+
if (!content)
|
|
81
|
+
continue;
|
|
82
|
+
parts.push({
|
|
83
|
+
type: "text",
|
|
84
|
+
text: buildInlineFileContentText(file, content),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return { ...message, parts };
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
32
90
|
function isRecord(value) {
|
|
33
91
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
34
92
|
}
|
|
@@ -44,6 +102,9 @@ function getUploadId(part) {
|
|
|
44
102
|
}
|
|
45
103
|
return getStringField(part, "uploadId") ?? getStringField(part, "upload_id");
|
|
46
104
|
}
|
|
105
|
+
function getUploadPath(part) {
|
|
106
|
+
return getStringField(part, "uploadPath") ?? getStringField(part, "upload_path");
|
|
107
|
+
}
|
|
47
108
|
function getMediaType(part) {
|
|
48
109
|
return getStringField(part, "mediaType") ?? getStringField(part, "media_type");
|
|
49
110
|
}
|
|
@@ -69,6 +130,164 @@ function normalizeUploadedFilePart(part, uploadId) {
|
|
|
69
130
|
...(uploadPath ? { uploadPath } : {}),
|
|
70
131
|
};
|
|
71
132
|
}
|
|
133
|
+
function shouldInlineFileContent(part) {
|
|
134
|
+
return getInlineableFilePart(part) !== null;
|
|
135
|
+
}
|
|
136
|
+
function getInlineableFilePart(part) {
|
|
137
|
+
if (!isRecord(part) || part.type !== "file")
|
|
138
|
+
return null;
|
|
139
|
+
const mediaType = getMediaType(part);
|
|
140
|
+
const url = getStringField(part, "url");
|
|
141
|
+
if (!mediaType || !url)
|
|
142
|
+
return null;
|
|
143
|
+
const filename = getStringField(part, "filename");
|
|
144
|
+
if (!isTextPreviewFile(filename, mediaType))
|
|
145
|
+
return null;
|
|
146
|
+
return {
|
|
147
|
+
type: "file",
|
|
148
|
+
mediaType,
|
|
149
|
+
url,
|
|
150
|
+
...(filename ? { filename } : {}),
|
|
151
|
+
...(getUploadId(part) ? { uploadId: getUploadId(part) } : {}),
|
|
152
|
+
...(getUploadPath(part) ? { uploadPath: getUploadPath(part) } : {}),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
async function fetchRuntimeTextFileContent(input) {
|
|
156
|
+
const timeoutMs = input.timeoutMs ?? DEFAULT_RUNTIME_FILE_CONTENT_FETCH_TIMEOUT_MS;
|
|
157
|
+
const fetchSignal = createRuntimeFileContentFetchSignal(input.abortSignal, timeoutMs);
|
|
158
|
+
const response = await waitForRuntimeFileContentFetchOperation(fetch(input.url, { signal: fetchSignal.signal }), input, fetchSignal, timeoutMs);
|
|
159
|
+
if (!response.ok) {
|
|
160
|
+
throw new Error(`Failed to fetch text attachment content${formatFileContentFetchLabel(input)}: HTTP ${response.status}${response.statusText ? ` ${response.statusText}` : ""}`);
|
|
161
|
+
}
|
|
162
|
+
return await readRuntimeTextFileContent(response, input, fetchSignal, timeoutMs);
|
|
163
|
+
}
|
|
164
|
+
async function readRuntimeTextFileContent(response, input, fetchSignal, timeoutMs) {
|
|
165
|
+
if (!response.body) {
|
|
166
|
+
return "";
|
|
167
|
+
}
|
|
168
|
+
const reader = response.body.getReader();
|
|
169
|
+
const decoder = new TextDecoder();
|
|
170
|
+
let content = "";
|
|
171
|
+
let shouldCancelReader = false;
|
|
172
|
+
try {
|
|
173
|
+
while (content.length <= MAX_INLINE_FILE_CONTENT_CHARS) {
|
|
174
|
+
const result = await waitForRuntimeFileContentFetchOperation(reader.read(), input, fetchSignal, timeoutMs);
|
|
175
|
+
if (result.done) {
|
|
176
|
+
return appendRuntimeTextContentUntilInlineLimit(content, decoder.decode()).content;
|
|
177
|
+
}
|
|
178
|
+
const nextContent = appendRuntimeTextContentUntilInlineLimit(content, decoder.decode(result.value, { stream: true }));
|
|
179
|
+
content = nextContent.content;
|
|
180
|
+
if (nextContent.reachedLimit) {
|
|
181
|
+
shouldCancelReader = true;
|
|
182
|
+
return content;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return content;
|
|
186
|
+
}
|
|
187
|
+
finally {
|
|
188
|
+
if (shouldCancelReader || fetchSignal.signal.aborted) {
|
|
189
|
+
void reader.cancel().catch(() => { });
|
|
190
|
+
}
|
|
191
|
+
try {
|
|
192
|
+
reader.releaseLock();
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
// Ignore release failures after cancellation has already been requested.
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function appendRuntimeTextContentUntilInlineLimit(content, decoded) {
|
|
200
|
+
const readLimit = MAX_INLINE_FILE_CONTENT_CHARS + 1;
|
|
201
|
+
const remainingChars = readLimit - content.length;
|
|
202
|
+
if (decoded.length >= remainingChars) {
|
|
203
|
+
return {
|
|
204
|
+
content: `${content}${decoded.slice(0, Math.max(0, remainingChars))}`,
|
|
205
|
+
reachedLimit: true,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
return { content: `${content}${decoded}`, reachedLimit: false };
|
|
209
|
+
}
|
|
210
|
+
function createRuntimeFileContentFetchSignal(abortSignal, timeoutMs) {
|
|
211
|
+
const timeoutSignal = AbortSignal.timeout(Math.max(0, timeoutMs));
|
|
212
|
+
if (!abortSignal) {
|
|
213
|
+
return {
|
|
214
|
+
signal: timeoutSignal,
|
|
215
|
+
wasAbortedByCaller: () => false,
|
|
216
|
+
didTimeout: () => timeoutSignal.aborted,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
return {
|
|
220
|
+
signal: AbortSignal.any([abortSignal, timeoutSignal]),
|
|
221
|
+
wasAbortedByCaller: () => abortSignal.aborted,
|
|
222
|
+
didTimeout: () => timeoutSignal.aborted,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
async function waitForRuntimeFileContentFetchOperation(operation, input, fetchSignal, timeoutMs) {
|
|
226
|
+
let abortError;
|
|
227
|
+
let removeAbortListener = () => { };
|
|
228
|
+
const abortPromise = new Promise((_, reject) => {
|
|
229
|
+
const rejectAbort = () => {
|
|
230
|
+
abortError = createRuntimeFileContentAbortError(input, fetchSignal, timeoutMs);
|
|
231
|
+
reject(abortError);
|
|
232
|
+
};
|
|
233
|
+
if (fetchSignal.signal.aborted) {
|
|
234
|
+
rejectAbort();
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
fetchSignal.signal.addEventListener("abort", rejectAbort, { once: true });
|
|
238
|
+
removeAbortListener = () => fetchSignal.signal.removeEventListener("abort", rejectAbort);
|
|
239
|
+
});
|
|
240
|
+
try {
|
|
241
|
+
return await Promise.race([operation, abortPromise]);
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
if (error === abortError) {
|
|
245
|
+
throw error;
|
|
246
|
+
}
|
|
247
|
+
const abortFailure = createRuntimeFileContentAbortError(input, fetchSignal, timeoutMs, error);
|
|
248
|
+
if (abortFailure) {
|
|
249
|
+
throw abortFailure;
|
|
250
|
+
}
|
|
251
|
+
throw error;
|
|
252
|
+
}
|
|
253
|
+
finally {
|
|
254
|
+
removeAbortListener();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function createRuntimeFileContentAbortError(input, fetchSignal, timeoutMs, cause) {
|
|
258
|
+
if (fetchSignal.wasAbortedByCaller()) {
|
|
259
|
+
return new Error(`Failed to fetch text attachment content${formatFileContentFetchLabel(input)}: request aborted`, { cause });
|
|
260
|
+
}
|
|
261
|
+
if (fetchSignal.didTimeout()) {
|
|
262
|
+
return new Error(`Failed to fetch text attachment content${formatFileContentFetchLabel(input)}: request timed out after ${timeoutMs}ms`, { cause });
|
|
263
|
+
}
|
|
264
|
+
return undefined;
|
|
265
|
+
}
|
|
266
|
+
function formatFileContentFetchLabel(input) {
|
|
267
|
+
const label = input.filename ?? input.uploadId ?? input.uploadPath;
|
|
268
|
+
return label ? ` for ${label}` : "";
|
|
269
|
+
}
|
|
270
|
+
function isFetchableRuntimeFileContentUrl(url, trustedUrls) {
|
|
271
|
+
if (url.startsWith("data:")) {
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
return trustedUrls?.has(url) ?? false;
|
|
275
|
+
}
|
|
276
|
+
function normalizeInlineFileContent(content) {
|
|
277
|
+
if (!content || content.trim().length === 0)
|
|
278
|
+
return undefined;
|
|
279
|
+
if (content.length <= MAX_INLINE_FILE_CONTENT_CHARS) {
|
|
280
|
+
return content;
|
|
281
|
+
}
|
|
282
|
+
return `${content.slice(0, MAX_INLINE_FILE_CONTENT_CHARS)}\n\n[Attachment content truncated]`;
|
|
283
|
+
}
|
|
284
|
+
function escapeXmlAttr(value) {
|
|
285
|
+
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
286
|
+
}
|
|
287
|
+
function buildInlineFileContentText(part, content) {
|
|
288
|
+
const name = part.filename ?? part.uploadId ?? "file";
|
|
289
|
+
return `Attached file content:\n\n<file_content name="${escapeXmlAttr(name)}" type="${escapeXmlAttr(part.mediaType)}">\n${content}\n</file_content>`;
|
|
290
|
+
}
|
|
72
291
|
function toResolverPart(part, uploadId) {
|
|
73
292
|
const normalized = normalizeUploadedFilePart(part, uploadId);
|
|
74
293
|
if (isRecord(normalized) && normalized.type === "file") {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { ChatUiMessage } from "../../chat/types.js";
|
|
2
2
|
import { type AgentRuntimeMessage } from "./message-adapter.js";
|
|
3
|
-
import { type RuntimeFileUrlResolver } from "./message-file-url-refresh.js";
|
|
3
|
+
import { type RuntimeFileContentFetcher, type RuntimeFileUrlResolver } from "./message-file-url-refresh.js";
|
|
4
4
|
/** Options accepted by prepare agent runtime messages from UI messages. */
|
|
5
5
|
export type PrepareAgentRuntimeMessagesFromUiMessagesOptions = {
|
|
6
6
|
messages: readonly ChatUiMessage[];
|
|
7
7
|
emptyConversationPrompt?: string;
|
|
8
8
|
resolveFileUrl?: RuntimeFileUrlResolver;
|
|
9
|
+
fetchFileContent?: RuntimeFileContentFetcher;
|
|
10
|
+
abortSignal?: AbortSignal;
|
|
11
|
+
fileContentFetchTimeoutMs?: number;
|
|
9
12
|
providerOwnedToolNames?: readonly string[];
|
|
10
13
|
};
|
|
11
14
|
/** Prepare agent runtime messages from UI messages. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-preparation.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/message-preparation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,
|
|
1
|
+
{"version":3,"file":"message-preparation.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/message-preparation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAIL,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC5B,MAAM,+BAA+B,CAAC;AAKvC,2EAA2E;AAC3E,MAAM,MAAM,gDAAgD,GAAG;IAC7D,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;IACnC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACxC,gBAAgB,CAAC,EAAE,yBAAyB,CAAC;IAC7C,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,sBAAsB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C,CAAC;AAEF,uDAAuD;AACvD,wBAAsB,yCAAyC,CAC7D,OAAO,EAAE,gDAAgD,GACxD,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAuChC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { prepareProviderModelMessagesFromUiMessages } from "../../chat/message-prep.js";
|
|
2
2
|
import { convertProviderMessagesToAgentRuntimeMessages, } from "./message-adapter.js";
|
|
3
|
-
import { resolveRuntimeMessageFileUrls, } from "./message-file-url-refresh.js";
|
|
3
|
+
import { createRuntimeFileContentFetcher, inlineRuntimeMessageFileContents, resolveRuntimeMessageFileUrls, } from "./message-file-url-refresh.js";
|
|
4
4
|
const DEFAULT_EMPTY_CONVERSATION_PROMPT = "Please provide 3-4 specific suggestions for what I could build or improve based on the current project context.";
|
|
5
5
|
/** Prepare agent runtime messages from UI messages. */
|
|
6
6
|
export async function prepareAgentRuntimeMessagesFromUiMessages(options) {
|
|
@@ -12,10 +12,26 @@ export async function prepareAgentRuntimeMessagesFromUiMessages(options) {
|
|
|
12
12
|
},
|
|
13
13
|
]);
|
|
14
14
|
}
|
|
15
|
-
const
|
|
16
|
-
|
|
15
|
+
const trustedFileContentUrls = new Set();
|
|
16
|
+
const resolveFileUrl = options.resolveFileUrl;
|
|
17
|
+
const refreshedMessages = resolveFileUrl
|
|
18
|
+
? await resolveRuntimeMessageFileUrls(options.messages, async (input) => {
|
|
19
|
+
const url = await resolveFileUrl(input);
|
|
20
|
+
if (url) {
|
|
21
|
+
trustedFileContentUrls.add(url);
|
|
22
|
+
}
|
|
23
|
+
return url;
|
|
24
|
+
})
|
|
17
25
|
: [...options.messages];
|
|
18
|
-
|
|
26
|
+
const messagesWithFileContent = await inlineRuntimeMessageFileContents(refreshedMessages, options.fetchFileContent ?? createRuntimeFileContentFetcher({
|
|
27
|
+
trustedUrls: trustedFileContentUrls,
|
|
28
|
+
}), {
|
|
29
|
+
...(options.abortSignal ? { abortSignal: options.abortSignal } : {}),
|
|
30
|
+
...(options.fileContentFetchTimeoutMs != null
|
|
31
|
+
? { fetchTimeoutMs: options.fileContentFetchTimeoutMs }
|
|
32
|
+
: {}),
|
|
33
|
+
});
|
|
34
|
+
return convertProviderMessagesToAgentRuntimeMessages(prepareProviderModelMessagesFromUiMessages(messagesWithFileContent, {
|
|
19
35
|
providerOwnedToolNames: options.providerOwnedToolNames,
|
|
20
36
|
}));
|
|
21
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transpiler.d.ts","sourceRoot":"","sources":["../../../src/src/discovery/transpiler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transpiler.d.ts","sourceRoot":"","sources":["../../../src/src/discovery/transpiler.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AA6IvD;;GAEG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,OAAO,CAAC,CAwGlB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* for dynamic import during discovery.
|
|
6
6
|
*/
|
|
7
7
|
import * as dntShim from "../../_dnt.shims.js";
|
|
8
|
+
import { ensureDefaultBundlerContracts } from "../extensions/bundler/defaults.js";
|
|
8
9
|
import { isDeno, isDenoCompiled } from "../platform/compat/runtime.js";
|
|
9
10
|
import { createFileSystem } from "../platform/compat/fs.js";
|
|
10
11
|
import * as pathHelper from "../platform/compat/path/index.js";
|
|
@@ -149,6 +150,7 @@ export async function importModule(file, context) {
|
|
|
149
150
|
});
|
|
150
151
|
}
|
|
151
152
|
const loader = getEsbuildLoader(filePath);
|
|
153
|
+
await ensureDefaultBundlerContracts();
|
|
152
154
|
const { build } = await import("../extensions/bundler/index.js");
|
|
153
155
|
const fileDir = pathHelper.dirname(filePath);
|
|
154
156
|
// When using fsAdapter (VFS), bundle all relative imports via the plugin.
|
|
@@ -191,7 +193,12 @@ export async function importModule(file, context) {
|
|
|
191
193
|
contents: source,
|
|
192
194
|
loader,
|
|
193
195
|
resolveDir: fileDir,
|
|
194
|
-
|
|
196
|
+
// Must be a basename: esbuild joins resolveDir + sourcefile to form the
|
|
197
|
+
// entry module path when sourcefile is relative. Passing the full
|
|
198
|
+
// relative filePath (e.g. "tools/foo.ts") on VFS runs (baseDir === "")
|
|
199
|
+
// doubles the prefix to "tools/tools/foo.ts", which anchors ../ imports
|
|
200
|
+
// one directory too deep.
|
|
201
|
+
sourcefile: pathHelper.basename(filePath),
|
|
195
202
|
},
|
|
196
203
|
});
|
|
197
204
|
if (result.errors.length > 0) {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazily register the first-party Bundler + ModuleLexer implementation when it
|
|
3
|
+
* is available from workspace source or an installed @veryfront/ext package.
|
|
4
|
+
*/
|
|
5
|
+
export declare function ensureDefaultBundlerContracts(): Promise<void>;
|
|
6
|
+
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../../src/src/extensions/bundler/defaults.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,wBAAsB,6BAA6B,IAAI,OAAO,CAAC,IAAI,CAAC,CAgBnE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { register, tryResolve } from "../contracts.js";
|
|
2
|
+
import { importFirstPartyExtensionModule, isMissingFirstPartyExtensionModule, } from "../first-party-import.js";
|
|
3
|
+
/**
|
|
4
|
+
* Lazily register the first-party Bundler + ModuleLexer implementation when it
|
|
5
|
+
* is available from workspace source or an installed @veryfront/ext package.
|
|
6
|
+
*/
|
|
7
|
+
export async function ensureDefaultBundlerContracts() {
|
|
8
|
+
if (tryResolve("Bundler") && tryResolve("ModuleLexer"))
|
|
9
|
+
return;
|
|
10
|
+
try {
|
|
11
|
+
const { EsbuildBundler, EsModuleLexer } = await importFirstPartyExtensionModule("ext-bundler-esbuild", "@veryfront/ext-bundler-esbuild");
|
|
12
|
+
if (!tryResolve("Bundler"))
|
|
13
|
+
register("Bundler", new EsbuildBundler());
|
|
14
|
+
if (!tryResolve("ModuleLexer"))
|
|
15
|
+
register("ModuleLexer", new EsModuleLexer());
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
if (!isMissingFirstPartyExtensionModule(error))
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -5,6 +5,7 @@ import { type AgentRunSessionManager } from "./session-manager.js";
|
|
|
5
5
|
import type { RuntimeRunAgentInput } from "./schema.js";
|
|
6
6
|
export interface RuntimeAgentStreamExecutionDeps {
|
|
7
7
|
sessionManager: AgentRunSessionManager;
|
|
8
|
+
localTools?: Record<string, Tool | boolean>;
|
|
8
9
|
projectAgentSandbox?: {
|
|
9
10
|
apiUrl?: string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AAE,MAAM,GAAG,IAAI,CAAC;QAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,cAAc,CAAC,EAAE,+BAA+B,CAAC,gBAAgB,CAAC,CAAC;IACnE,8BAA8B,CAAC,EAAE,CAC/B,KAAK,EAAE,+BAA+B,KACnC,OAAO,CAAC,8BAA8B,CAAC,CAAC;IAC7C,aAAa,CAAC,EAAE,CACd,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAClC;QACH,MAAM,EAAE,CACN,QAAQ,EAAE,OAAO,EAAE,EACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,SAAS,CAAC,EAAE;YACV,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;SAC9C,EACD,aAAa,CAAC,EAAE,MAAM,EACtB,uBAAuB,CAAC,EAAE,MAAM,EAChC,WAAW,CAAC,EAAE,WAAW,KACtB,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;KAC1C,CAAC;CACH;AAoCD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,oBAAoB,EAC3B,cAAc,EAAE,sBAAsB,EACtC,2BAA2B,CAAC,EAAE,MAAM,EAAE,EACtC,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC;;cAsFrD;AA2KD,wBAAsB,gCAAgC,CACpD,KAAK,EAAE,oBAAoB,EAC3B,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,+BAA+B,GACpC,OAAO,CAAC,QAAQ,CAAC,CAkUnB"}
|
|
@@ -263,7 +263,11 @@ export async function createRuntimeAgentStreamResponse(input, agent, deps) {
|
|
|
263
263
|
const forwardedIntegrationToolDefs = getForwardedIntegrationToolDefinitions(input.forwardedProps);
|
|
264
264
|
const availableForwardedToolNames = forwardedIntegrationToolDefs?.map((tool) => tool.name);
|
|
265
265
|
const sandboxTools = await buildProjectAgentSandboxTools({ agent, deps });
|
|
266
|
-
const
|
|
266
|
+
const availableLocalTools = {
|
|
267
|
+
...(deps.localTools ?? {}),
|
|
268
|
+
...(sandboxTools.tools ?? {}),
|
|
269
|
+
};
|
|
270
|
+
const mergedTools = buildMergedTools(agent, input, deps.sessionManager, availableForwardedToolNames, Object.keys(availableLocalTools).length > 0 ? availableLocalTools : undefined);
|
|
267
271
|
const runtimeAgent = {
|
|
268
272
|
...agent,
|
|
269
273
|
config: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-registry.d.ts","sourceRoot":"","sources":["../../../src/src/provider/model-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAeH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,sDAAsD;AACtD,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"model-registry.d.ts","sourceRoot":"","sources":["../../../src/src/provider/model-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAeH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,sDAAsD;AACtD,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,YAAY,CAAC;AAqBrE;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,GAC5B,IAAI,CAEN;AAuJD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,YAAY,CAuC9D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGtD;AAED;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,MAAM,EAAE,CAGtD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,IAAI,CAAC,CAKf;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C"}
|
|
@@ -22,6 +22,20 @@ import { createVeryfrontCloudModel } from "./veryfront-cloud/provider.js";
|
|
|
22
22
|
import { getModelRuntimeId, hasLocalModelRuntimeMarker } from "./runtime-inspection.js";
|
|
23
23
|
const manager = new ProjectScopedRegistryManager("model-provider");
|
|
24
24
|
let autoInitialized = false;
|
|
25
|
+
function isOpenAIBaseURL(baseURL) {
|
|
26
|
+
if (!baseURL)
|
|
27
|
+
return true;
|
|
28
|
+
try {
|
|
29
|
+
const hostname = new URL(baseURL).hostname.toLowerCase();
|
|
30
|
+
return hostname === "api.openai.com" || hostname.endsWith(".api.openai.com");
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function getOpenAIEnvProviderName(baseURL) {
|
|
37
|
+
return isOpenAIBaseURL(baseURL) ? "openai" : "openai-compatible";
|
|
38
|
+
}
|
|
25
39
|
/**
|
|
26
40
|
* Register a custom model provider factory for the current project.
|
|
27
41
|
*
|
|
@@ -65,7 +79,7 @@ function autoInitializeFromEnv() {
|
|
|
65
79
|
return provider.createModel(id, {
|
|
66
80
|
credential: config.apiKey,
|
|
67
81
|
baseURL: config.baseURL,
|
|
68
|
-
providerName:
|
|
82
|
+
providerName: getOpenAIEnvProviderName(config.baseURL),
|
|
69
83
|
});
|
|
70
84
|
}
|
|
71
85
|
throw toError(createError({
|
|
@@ -5,6 +5,7 @@ import { BaseHandler } from "../response/base.js";
|
|
|
5
5
|
import type { HandlerContext, HandlerMetadata, HandlerResult } from "../types.js";
|
|
6
6
|
export interface AgentStreamHandlerDeps extends RuntimeAgentDiscoveryDeps, RuntimeAgentStreamExecutionDeps {
|
|
7
7
|
resolveRuntimeOwnerInvokeUrl?: typeof resolveRuntimeOwnerInvokeUrl;
|
|
8
|
+
getLocalTools?: (agentId: string) => RuntimeAgentStreamExecutionDeps["localTools"];
|
|
8
9
|
}
|
|
9
10
|
export declare class AgentStreamHandler extends BaseHandler {
|
|
10
11
|
private readonly deps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-stream.handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/request/agent-stream.handler.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-stream.handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/request/agent-stream.handler.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAEpF,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,wCAAwC,CAAC;AAQhD,OAAO,EACL,4BAA4B,EAE7B,MAAM,2CAA2C,CAAC;AAyBnD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAanG,MAAM,WAAW,sBACf,SAAQ,yBAAyB,EAAE,+BAA+B;IAClE,4BAA4B,CAAC,EAAE,OAAO,4BAA4B,CAAC;IACnE,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,+BAA+B,CAAC,YAAY,CAAC,CAAC;CACpF;AAofD,qBAAa,kBAAmB,SAAQ,WAAW;IASrC,OAAO,CAAC,QAAQ,CAAC,IAAI;IARjC,QAAQ,EAAE,eAAe,CAMvB;gBAE2B,IAAI,GAAE,sBAAoC;IAIvE,OAAO,CAAC,sBAAsB;IAwBxB,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CA4LxE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createRemoteMCPToolSource, toolRegistry, } from "../../../tool/index.js";
|
|
2
2
|
import { defaultChannelInvokeDeps } from "../../../channels/invoke.js";
|
|
3
|
+
import { getDiscoveredHostTools } from "../../../agent/hosted/veryfront-cloud-agent-service.js";
|
|
3
4
|
import { createRuntimeAgentStreamResponse, } from "../../../internal-agents/run-stream.js";
|
|
4
5
|
import { createRuntimeAgentFromMarkdownDefinition } from "../../../agent/runtime/agent-markdown-adapter.js";
|
|
5
6
|
import { buildStudioMcpHeaders } from "../../../agent/project/live-studio-mcp-tools.js";
|
|
@@ -21,6 +22,7 @@ const defaultDeps = {
|
|
|
21
22
|
...defaultChannelInvokeDeps,
|
|
22
23
|
sessionManager: agentRunSessionManager,
|
|
23
24
|
resolveRuntimeOwnerInvokeUrl,
|
|
25
|
+
getLocalTools: (agentId) => getDiscoveredHostTools({ agentId }),
|
|
24
26
|
};
|
|
25
27
|
const logger = serverLogger.component("agent-stream-handler");
|
|
26
28
|
const RUN_STREAM_PATH_REGEX = /^\/api\/control-plane\/runs\/([^/]+)\/stream$/;
|
|
@@ -450,6 +452,7 @@ export class AgentStreamHandler extends BaseHandler {
|
|
|
450
452
|
? createRuntimeAgentFromMarkdownDefinition(payload.agentConfig)
|
|
451
453
|
: agent;
|
|
452
454
|
const runtimeInput = sanitizeRuntimeRunAgentInput(toRuntimeRunAgentInput(payload));
|
|
455
|
+
const localTools = this.deps.getLocalTools?.(runtimeBaseAgent.id);
|
|
453
456
|
const apiAuthToken = payload.credentials?.authToken || ctx.proxyToken ||
|
|
454
457
|
getHostEnv("VERYFRONT_API_TOKEN") || "";
|
|
455
458
|
const platformRuntimeAgent = await withVeryfrontPlatformRemoteTools({
|
|
@@ -486,6 +489,7 @@ export class AgentStreamHandler extends BaseHandler {
|
|
|
486
489
|
}
|
|
487
490
|
const runAgentStream = () => createRuntimeAgentStreamResponse(runtimeInput, runtimeAgent, {
|
|
488
491
|
...this.deps,
|
|
492
|
+
localTools,
|
|
489
493
|
projectAgentSandbox: {
|
|
490
494
|
apiUrl: getHostEnv("VERYFRONT_API_URL") ?? "https://api.veryfront.com",
|
|
491
495
|
authToken: apiAuthToken || undefined,
|
package/esm/src/testing/init.js
CHANGED
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
12
|
import * as dntShim from "../../_dnt.shims.js";
|
|
13
|
-
import {
|
|
14
|
-
import { importFirstPartyExtensionModule, isMissingFirstPartyExtensionModule, } from "../extensions/first-party-import.js";
|
|
13
|
+
import { ensureDefaultBundlerContracts } from "../extensions/bundler/defaults.js";
|
|
15
14
|
const g = dntShim.dntGlobalThis;
|
|
16
15
|
g.__vfDisableLruInterval = true;
|
|
17
16
|
g.__vfTestEnv = true;
|
|
@@ -21,19 +20,4 @@ g.__vfTestEnvMask = {
|
|
|
21
20
|
// Tests don't run the extension orchestrator; prime the Bundler + ModuleLexer
|
|
22
21
|
// contracts here so transforms that depend on them (lexer.ts, parse-cache.ts,
|
|
23
22
|
// the platform/compat/esbuild shim, and bundler call-sites) work in tests.
|
|
24
|
-
await
|
|
25
|
-
async function registerDefaultBundlerContracts() {
|
|
26
|
-
if (tryResolve("Bundler") && tryResolve("ModuleLexer"))
|
|
27
|
-
return;
|
|
28
|
-
try {
|
|
29
|
-
const { EsbuildBundler, EsModuleLexer } = await importFirstPartyExtensionModule("ext-bundler-esbuild", "@veryfront/ext-bundler-esbuild");
|
|
30
|
-
if (!tryResolve("Bundler"))
|
|
31
|
-
registerContract("Bundler", new EsbuildBundler());
|
|
32
|
-
if (!tryResolve("ModuleLexer"))
|
|
33
|
-
registerContract("ModuleLexer", new EsModuleLexer());
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
if (!isMissingFirstPartyExtensionModule(error))
|
|
37
|
-
throw error;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
23
|
+
await ensureDefaultBundlerContracts();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-constant.d.ts","sourceRoot":"","sources":["../../../src/src/utils/version-constant.ts"],"names":[],"mappings":"AAEA,4BAA4B;AAC5B,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version-constant.d.ts","sourceRoot":"","sources":["../../../src/src/utils/version-constant.ts"],"names":[],"mappings":"AAEA,4BAA4B;AAC5B,eAAO,MAAM,OAAO,aAAa,CAAC"}
|