veryfront 0.1.802 → 0.1.805
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/deno.js +1 -1
- package/esm/src/agent/hosted/veryfront-cloud-agent-service.d.ts +1 -1
- package/esm/src/agent/hosted/veryfront-cloud-agent-service.d.ts.map +1 -1
- package/esm/src/agent/hosted/veryfront-cloud-agent-service.js +4 -2
- package/esm/src/agent/runtime/load-skill-tool.d.ts +1 -0
- package/esm/src/agent/runtime/load-skill-tool.d.ts.map +1 -1
- package/esm/src/agent/runtime/load-skill-tool.js +37 -5
- package/esm/src/agent/service/mcp-server-config.js +1 -1
- package/esm/src/release-assets/build-executor.d.ts.map +1 -1
- package/esm/src/release-assets/build-executor.js +22 -7
- package/esm/src/server/handlers/request/agent-stream.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/agent-stream.handler.js +78 -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/esm/deno.js
CHANGED
|
@@ -4,7 +4,7 @@ import { type RunAgentServiceMainOptions } from "../service/bootstrap.js";
|
|
|
4
4
|
import { type HostedChatRuntimeCreationResult } from "./chat-runtime-contract.js";
|
|
5
5
|
import type { HostedConversationRootRunContext } from "../conversation/root-run-lifecycle.js";
|
|
6
6
|
import { type AgentRuntimeMessage } from "../runtime/message-adapter.js";
|
|
7
|
-
import type
|
|
7
|
+
import { type AgentServiceMcpServerConfig } from "../service/mcp-server-config.js";
|
|
8
8
|
import type { AgentVeryfrontMcpServerConfig } from "../types.js";
|
|
9
9
|
import { type ProjectAgentRuntimeAgentSource } from "../project/agent-runtime.js";
|
|
10
10
|
import { type CreateNodeAgentServiceRuntimeInfrastructureOptions } from "../service/node-runtime-infrastructure.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"veryfront-cloud-agent-service.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/veryfront-cloud-agent-service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAiB9E,OAAO,EAGL,KAAK,WAAW,EAIjB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"veryfront-cloud-agent-service.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/veryfront-cloud-agent-service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAiB9E,OAAO,EAGL,KAAK,WAAW,EAIjB,MAAM,qBAAqB,CAAC;AAiB7B,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EAAE,KAAK,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAC9F,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAmBzE,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAKjE,OAAO,EAML,KAAK,8BAA8B,EAEpC,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAEL,KAAK,kDAAkD,EACxD,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAK9B,KAAK,2BAA2B,EACjC,MAAM,uBAAuB,CAAC;AAS/B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAahF,iFAAiF;AACjF,MAAM,MAAM,2CAA2C,GACnD,WAAW,CAAC,0BAA0B,CAAC,eAAe,CAAC,CAAC,GACxD,WAAW,CAAC,kDAAkD,CAAC,eAAe,CAAC,CAAC,GAChF;IACA,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS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,MAAM,mBAAmB,GAAG,qCAAqC,CAAC;AASxE,qFAAqF;AACrF,MAAM,MAAM,+CAA+C,GAAG,2BAA2B,GAAG;IAC1F,MAAM,EAAE,yBAAyB,CAAC;IAClC,KAAK,EAAE,+BAA+B,CAAC,OAAO,CAAC,CAAC;IAChD,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,EAAE,mBAAmB,EAAE,CAAC;IACrC,QAAQ,EAAE,2BAA2B,CAAC,UAAU,CAAC,CAAC;IAClD,cAAc,EAAE,gCAAgC,CAAC;CAClD,CAAC;AACF,gEAAgE;AAChE,MAAM,MAAM,6BAA6B,GAAG,+CAA+C,CAAC;AAC5F,4DAA4D;AAC5D,MAAM,MAAM,yBAAyB,GAAG,2CAA2C,CAAC;AA6XpF,wBAAgB,sBAAsB,CAAC,KAAK,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CAYhF;AAqcD,yDAAyD;AACzD,wBAAsB,2CAA2C,CAC/D,OAAO,GAAE,qCAA0C,GAClD,OAAO,CAAC,yBAAyB,CAAC,+CAA+C,CAAC,CAAC,CAKrF;AAED,iDAAiD;AACjD,wBAAsB,mCAAmC,CACvD,OAAO,GAAE,qCAA0C,GAClD,OAAO,CAAC,2BAA2B,CAAC,+CAA+C,CAAC,CAAC,CAgBvF;AAED,4BAA4B;AAC5B,wBAAsB,iBAAiB,CACrC,OAAO,GAAE,qCAA0C,GAClD,OAAO,CAAC,IAAI,CAAC,CAiDf"}
|
|
@@ -10,6 +10,7 @@ import { defineSchema } from "../../schemas/index.js";
|
|
|
10
10
|
import { NodeTelemetryProviderName, } from "../../extensions/observability/index.js";
|
|
11
11
|
import { SandboxShellToolsProviderName, } from "../../extensions/sandbox/index.js";
|
|
12
12
|
import { createRemoteMCPToolSource, createToolsFromRemoteDefinitions, isToolVisibleTo, sleepTool, toolRegistry, } from "../../tool/index.js";
|
|
13
|
+
import { SKILL_TOOL_IDS } from "../../skill/types.js";
|
|
13
14
|
import { parseProviderError } from "../../chat/provider-errors.js";
|
|
14
15
|
import { DEFAULT_PROJECT_DISCOVERY_DIRS } from "../../discovery/index.js";
|
|
15
16
|
import { nodeAdapter } from "../../platform/adapters/node.js";
|
|
@@ -25,6 +26,7 @@ import { createDefaultHostedChatRuntime, } from "./default-chat-runtime.js";
|
|
|
25
26
|
import { createVeryfrontCloudContextSummaryGenerator } from "./context-summary-generator.js";
|
|
26
27
|
import { createDefaultHostedInvokeAgentTool } from "./default-invoke-agent-tool.js";
|
|
27
28
|
import { createDefaultHostedProjectSteeringRefresh, fetchDefaultHostedProjectSteering, } from "./default-project-steering-refresh.js";
|
|
29
|
+
import { defaultAgentServiceMcpServers, } from "../service/mcp-server-config.js";
|
|
28
30
|
import { createRuntimeAgentDefinitionFromAgent, describeProjectAgentRuntimeAgentIdCandidates, discoverProjectAgentRuntime, doesProjectAgentRuntimeAgentMatchSource, getProjectAgentRuntimeAgentIdCandidates, resolveSingleProjectAgentRuntimeAgentId, } from "../project/agent-runtime.js";
|
|
29
31
|
import { buildVeryfrontCloudRuntimeInstructions } from "./cloud-runtime-system-messages.js";
|
|
30
32
|
import { createNodeAgentServiceRuntimeInfrastructure, } from "../service/node-runtime-infrastructure.js";
|
|
@@ -143,7 +145,7 @@ function resolveDefaultProcessTarget() {
|
|
|
143
145
|
return process;
|
|
144
146
|
}
|
|
145
147
|
function resolveMcpServers(options) {
|
|
146
|
-
return options.mcpServers ??
|
|
148
|
+
return options.mcpServers ?? defaultAgentServiceMcpServers();
|
|
147
149
|
}
|
|
148
150
|
async function loadDefaultCreateBashTool() {
|
|
149
151
|
const provider = tryResolve(SandboxShellToolsProviderName);
|
|
@@ -325,7 +327,7 @@ export function getDiscoveredHostTools(scope) {
|
|
|
325
327
|
// Hosted per-agent runs pass their task context identity so owned colocated
|
|
326
328
|
// tools are available to their owner and hidden from other agents.
|
|
327
329
|
return Object.fromEntries([...toolRegistry.getAll()]
|
|
328
|
-
.filter(([, registryTool]) => isToolVisibleTo(registryTool, scope))
|
|
330
|
+
.filter(([toolId, registryTool]) => !SKILL_TOOL_IDS.has(toolId) && isToolVisibleTo(registryTool, scope))
|
|
329
331
|
.sort(([left], [right]) => left.localeCompare(right)));
|
|
330
332
|
}
|
|
331
333
|
function getProjectInstructions(context, lookup) {
|
|
@@ -11,6 +11,7 @@ export type RuntimeLoadSkillToolContext = RuntimeProjectSkillContext & {
|
|
|
11
11
|
availableSkillIds?: readonly string[];
|
|
12
12
|
availableToolNames?: readonly string[];
|
|
13
13
|
loadedSkillResponses?: Record<string, RuntimeLoadedSkillResponse>;
|
|
14
|
+
loadedSkillReferenceResponses?: Record<string, RuntimeLoadSkillReferenceFileOutput>;
|
|
14
15
|
};
|
|
15
16
|
/** Public API contract for runtime load skill builtin store. */
|
|
16
17
|
export type RuntimeLoadSkillBuiltinStore = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-skill-tool.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/load-skill-tool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAchD,OAAO,KAAK,EAEV,0BAA0B,EAC1B,yBAAyB,EAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,kCAAkC,EACvC,KAAK,0BAA0B,EAChC,MAAM,qBAAqB,CAAC;AAG7B,yDAAyD;AACzD,eAAO,MAAM,oCAAoC,2mBACqP,CAAC;AAEvS,mDAAmD;AACnD,eAAO,MAAM,8BAA8B,unBAC0a,CAAC;AAatd,2CAA2C;AAC3C,MAAM,MAAM,2BAA2B,GAAG,0BAA0B,GAAG;IACrE,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,oBAAoB,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AC;CAClE,CAAC;AAEF,gEAAgE;AAChE,MAAM,MAAM,4BAA4B,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;AAEvF,mDAAmD;AACnD,MAAM,MAAM,2BAA2B,GAAG;IACxC,OAAO,EAAE,2BAA2B,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,yBAAyB,CAAC;IAC9C,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,YAAY,CAAC,EAAE,4BAA4B,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,4BAA4B,CAAC;IACxC,MAAM,CAAC,EAAE,0BAA0B,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;GAS9C,CAAC;AAKF,iDAAiD;AACjD,MAAM,MAAM,yBAAyB,GAAG,WAAW,CACjD,UAAU,CAAC,OAAO,kCAAkC,CAAC,CACtD,CAAC;AAEF,qDAAqD;AACrD,MAAM,MAAM,mCAAmC,GAAG;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,4CAA4C;AAC5C,MAAM,MAAM,2BAA2B,GAAG;IACxC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,2CAA2C;AAC3C,MAAM,MAAM,0BAA0B,GAClC,0BAA0B,GAC1B,mCAAmC,GACnC,2BAA2B,CAAC;AAiOhC,sCAAsC;AACtC,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,2BAA2B,GACnC,IAAI,CAAC,yBAAyB,EAAE,0BAA0B,CAAC,CA8C7D"}
|
|
@@ -85,6 +85,28 @@ function buildMissingSkillError(options, skillId) {
|
|
|
85
85
|
error: `Skill not found: ${skillId}. Available skills: ${available}`,
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
+
function buildAlreadyLoadedSkillReferenceResponse(skillId, file) {
|
|
89
|
+
return {
|
|
90
|
+
skillId,
|
|
91
|
+
file,
|
|
92
|
+
content: `Reference file "${skillId}/${file}" is already loaded in this turn. Do not call load_skill for this file again. ` +
|
|
93
|
+
"Continue from the existing reference content and produce the next useful response now.",
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function buildRuntimeSkillCacheKey(context, skillId) {
|
|
97
|
+
return JSON.stringify([
|
|
98
|
+
skillId,
|
|
99
|
+
context.projectId ?? null,
|
|
100
|
+
context.branchId ?? null,
|
|
101
|
+
context.skillSourcePaths?.[skillId] ?? null,
|
|
102
|
+
]);
|
|
103
|
+
}
|
|
104
|
+
function buildRuntimeSkillReferenceCacheKey(context, skillId, normalizedFile) {
|
|
105
|
+
return JSON.stringify([
|
|
106
|
+
buildRuntimeSkillCacheKey(context, skillId),
|
|
107
|
+
normalizedFile,
|
|
108
|
+
]);
|
|
109
|
+
}
|
|
88
110
|
function buildRuntimeLoadSkillDescription(options) {
|
|
89
111
|
if (options.description) {
|
|
90
112
|
return options.description;
|
|
@@ -127,13 +149,22 @@ async function loadRuntimeSkillReferenceFile(options, skillId, file) {
|
|
|
127
149
|
if (!normalizedFile) {
|
|
128
150
|
return { error: `Invalid reference file path: ${file}` };
|
|
129
151
|
}
|
|
152
|
+
const loadedSkillReferenceResponses = options.context.loadedSkillReferenceResponses ??= {};
|
|
153
|
+
const referenceKey = buildRuntimeSkillReferenceCacheKey(options.context, skillId, normalizedFile);
|
|
154
|
+
if (loadedSkillReferenceResponses[referenceKey]) {
|
|
155
|
+
return buildAlreadyLoadedSkillReferenceResponse(skillId, normalizedFile);
|
|
156
|
+
}
|
|
130
157
|
const projectFileContent = await options.projectSkillLoader.loadProjectSkillReference(options.context, skillId, normalizedFile);
|
|
131
158
|
if (projectFileContent) {
|
|
132
|
-
|
|
159
|
+
const response = { skillId, file: normalizedFile, content: projectFileContent };
|
|
160
|
+
loadedSkillReferenceResponses[referenceKey] = response;
|
|
161
|
+
return response;
|
|
133
162
|
}
|
|
134
163
|
const localContent = getBuiltinStore(options).readReferenceFile(options.skillsDir, skillId, normalizedFile);
|
|
135
164
|
if (localContent) {
|
|
136
|
-
|
|
165
|
+
const response = { skillId, file: normalizedFile, content: localContent };
|
|
166
|
+
loadedSkillReferenceResponses[referenceKey] = response;
|
|
167
|
+
return response;
|
|
137
168
|
}
|
|
138
169
|
return { error: `Reference file not found: ${skillId}/${normalizedFile}` };
|
|
139
170
|
}
|
|
@@ -152,7 +183,8 @@ export function createRuntimeLoadSkillTool(options) {
|
|
|
152
183
|
return await loadRuntimeSkillReferenceFile(options, skillId, file);
|
|
153
184
|
}
|
|
154
185
|
const loadedSkillResponses = options.context.loadedSkillResponses ??= {};
|
|
155
|
-
const
|
|
186
|
+
const loadedSkillKey = buildRuntimeSkillCacheKey(options.context, skillId);
|
|
187
|
+
const loadedResponse = loadedSkillResponses[loadedSkillKey];
|
|
156
188
|
if (loadedResponse) {
|
|
157
189
|
return buildAlreadyLoadedSkillResponse(skillId, loadedResponse);
|
|
158
190
|
}
|
|
@@ -164,7 +196,7 @@ export function createRuntimeLoadSkillTool(options) {
|
|
|
164
196
|
instructions: projectSkill.instructions,
|
|
165
197
|
references: projectSkill.references,
|
|
166
198
|
});
|
|
167
|
-
loadedSkillResponses[
|
|
199
|
+
loadedSkillResponses[loadedSkillKey] = response;
|
|
168
200
|
return response;
|
|
169
201
|
}
|
|
170
202
|
const localContent = builtinStore.readSkill(options.skillsDir, skillId);
|
|
@@ -175,7 +207,7 @@ export function createRuntimeLoadSkillTool(options) {
|
|
|
175
207
|
instructions: localContent,
|
|
176
208
|
references: builtinStore.listReferences(options.skillsDir, skillId),
|
|
177
209
|
});
|
|
178
|
-
loadedSkillResponses[
|
|
210
|
+
loadedSkillResponses[loadedSkillKey] = response;
|
|
179
211
|
return response;
|
|
180
212
|
}
|
|
181
213
|
return buildMissingSkillError(options, skillId);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { buildStudioMcpHeaders } from "../project/live-studio-mcp-tools.js";
|
|
2
2
|
import { clientAllowsStudioMcp } from "../runtime/client-profile.js";
|
|
3
3
|
export function defaultAgentServiceMcpServers() {
|
|
4
|
-
return [{ kind: "veryfront-api" }];
|
|
4
|
+
return [{ kind: "veryfront-api" }, { kind: "veryfront-studio" }];
|
|
5
5
|
}
|
|
6
6
|
function createGenericRemoteMcpConfig(server) {
|
|
7
7
|
const config = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-executor.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/build-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAwBH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAsB/C,MAAM,WAAW,sBAAsB;IACrC,yDAAyD;IACzD,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,yDAAyD;IACzD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,MAAM,EAAE,uBAAuB,CAAC;IAChC,sDAAsD;IAEtD,OAAO,EAAE,GAAG,CAAC;IACb;;;;OAIG;IACH,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAClC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,gCAAgC,CAAC;CACtD;AAED,MAAM,MAAM,qBAAqB,GAAG,CAClC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAElB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE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M,EACf,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzD,+BAA+B,CAC7B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,SAAS,GAAG,QAAQ,EAC3B,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,CAAC,CAAC;IACpB;;;;;;;OAOG;IACH,iBAAiB,CAAC,CAChB,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EACvB,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;CACrE;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"build-executor.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/build-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAwBH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAsB/C,MAAM,WAAW,sBAAsB;IACrC,yDAAyD;IACzD,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,yDAAyD;IACzD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oCAAoC;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f,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA+2BD;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,sBAAsB,EAC7B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,uBAAuB,CAAC,CA2ClC"}
|
|
@@ -20,7 +20,7 @@ import { createFileSystem } from "../platform/compat/fs.js";
|
|
|
20
20
|
import { dirname, join, normalize } from "../platform/compat/path/index.js";
|
|
21
21
|
import { resolveFrameworkSourcePath } from "../platform/compat/framework-source-resolver.js";
|
|
22
22
|
import { transformToESM } from "../transforms/esm-transform.js";
|
|
23
|
-
import { cacheHttpImportsToLocal } from "../transforms/esm/http-cache.js";
|
|
23
|
+
import { cacheHttpImportsToLocal, normalizeHttpUrl } from "../transforms/esm/http-cache.js";
|
|
24
24
|
import { extractSourceUrl } from "../transforms/esm/source-url-embed.js";
|
|
25
25
|
import { parseImports, replaceSpecifiers } from "../transforms/esm/lexer.js";
|
|
26
26
|
import { getReactUrls } from "../transforms/esm/package-registry.js";
|
|
@@ -289,17 +289,32 @@ function addDependencyModule(dependencies, dependency) {
|
|
|
289
289
|
function normalizeDependencySpecifier(specifier) {
|
|
290
290
|
return specifier.replace(/[?#].*$/, "");
|
|
291
291
|
}
|
|
292
|
+
function dependencyLookupKeys(specifier) {
|
|
293
|
+
const keys = new Set([specifier, normalizeDependencySpecifier(specifier)]);
|
|
294
|
+
if (specifier.startsWith("http://") || specifier.startsWith("https://")) {
|
|
295
|
+
const normalizedHttp = normalizeHttpUrl(specifier);
|
|
296
|
+
keys.add(normalizedHttp);
|
|
297
|
+
keys.add(normalizeDependencySpecifier(normalizedHttp));
|
|
298
|
+
}
|
|
299
|
+
return keys;
|
|
300
|
+
}
|
|
292
301
|
function findDependencyModuleBySpecifier(dependencies, specifier) {
|
|
293
|
-
const
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
|
|
302
|
+
const lookupKeys = dependencyLookupKeys(specifier);
|
|
303
|
+
for (const key of lookupKeys) {
|
|
304
|
+
const direct = dependencies.get(key);
|
|
305
|
+
if (direct)
|
|
306
|
+
return direct;
|
|
307
|
+
}
|
|
297
308
|
for (const dependency of dependencies.values()) {
|
|
298
|
-
if (
|
|
309
|
+
if (lookupKeys.has(dependency.manifestKey)) {
|
|
299
310
|
return dependency;
|
|
300
311
|
}
|
|
301
312
|
for (const dependencySpecifier of dependency.specifiers) {
|
|
302
|
-
|
|
313
|
+
for (const key of dependencyLookupKeys(dependencySpecifier)) {
|
|
314
|
+
if (lookupKeys.has(key))
|
|
315
|
+
return dependency;
|
|
316
|
+
}
|
|
317
|
+
if (lookupKeys.has(normalizeDependencySpecifier(dependencySpecifier))) {
|
|
303
318
|
return dependency;
|
|
304
319
|
}
|
|
305
320
|
}
|
|
@@ -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;AACpF,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,wCAAwC,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;AACpF,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,wCAAwC,CAAC;AAOhD,OAAO,EACL,4BAA4B,EAE7B,MAAM,2CAA2C,CAAC;AAwBnD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAYnG,MAAM,WAAW,sBACf,SAAQ,yBAAyB,EAAE,+BAA+B;IAClE,4BAA4B,CAAC,EAAE,OAAO,4BAA4B,CAAC;CACpE;AAgZD,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;CAoLxE"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createRemoteMCPToolSource, toolRegistry, } from "../../../tool/index.js";
|
|
2
2
|
import { defaultChannelInvokeDeps } from "../../../channels/invoke.js";
|
|
3
3
|
import { createRuntimeAgentStreamResponse, } from "../../../internal-agents/run-stream.js";
|
|
4
|
+
import { buildStudioMcpHeaders } from "../../../agent/project/live-studio-mcp-tools.js";
|
|
5
|
+
import { clientAllowsStudioMcp, resolveRuntimeClientProfile, } from "../../../agent/runtime/client-profile.js";
|
|
4
6
|
import { resolveRuntimeOwnerInvokeUrl, RUNTIME_OWNER_INVOKE_URL_HEADER, } from "../../../internal-agents/runtime-owner.js";
|
|
5
7
|
import { ControlPlaneRequestError, verifyControlPlaneRequest, } from "../../../internal-agents/control-plane-auth.js";
|
|
6
8
|
import { INTERNAL_AGENT_STREAM_MAX_BODY_BYTES, InternalAgentRequestBodyTooLargeError, readInternalAgentRequestBody, } from "../../../internal-agents/request-body.js";
|
|
@@ -22,6 +24,15 @@ const defaultDeps = {
|
|
|
22
24
|
const logger = serverLogger.component("agent-stream-handler");
|
|
23
25
|
const RUN_STREAM_PATH_REGEX = /^\/api\/control-plane\/runs\/([^/]+)\/stream$/;
|
|
24
26
|
const VERYFRONT_PLATFORM_REMOTE_TOOL_SOURCE_ID = "veryfront-platform-mcp";
|
|
27
|
+
const VERYFRONT_STUDIO_REMOTE_TOOL_SOURCE_ID = "veryfront-studio-mcp";
|
|
28
|
+
const STUDIO_RUNTIME_REMOTE_TOOL_NAMES = new Set([
|
|
29
|
+
"studio_suggestions",
|
|
30
|
+
"studio_todo_write",
|
|
31
|
+
"studio_panel_control",
|
|
32
|
+
"studio_open_project",
|
|
33
|
+
"studio_display_media",
|
|
34
|
+
"studio_capture_screenshot",
|
|
35
|
+
]);
|
|
25
36
|
const LOCAL_RUNTIME_BOOLEAN_TOOL_NAMES = new Set(["bash"]);
|
|
26
37
|
// Per-environment env var cache shared across all agent stream requests (60s TTL)
|
|
27
38
|
const _agentEnvVarCache = new EnvironmentVariableCache((environmentId, token, projectSlug) => {
|
|
@@ -75,6 +86,28 @@ function mergeAllowedRemoteTools(current, requestedToolNames) {
|
|
|
75
86
|
}
|
|
76
87
|
return [...allowed].sort();
|
|
77
88
|
}
|
|
89
|
+
function isRecord(value) {
|
|
90
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
91
|
+
}
|
|
92
|
+
function getForwardedAllowedRemoteToolNames(forwardedProps) {
|
|
93
|
+
const runtimeOverrides = isRecord(forwardedProps?.runtimeOverrides)
|
|
94
|
+
? forwardedProps.runtimeOverrides
|
|
95
|
+
: null;
|
|
96
|
+
const allowedTools = runtimeOverrides?.allowedTools;
|
|
97
|
+
return Array.isArray(allowedTools) &&
|
|
98
|
+
allowedTools.every((toolName) => typeof toolName === "string")
|
|
99
|
+
? allowedTools
|
|
100
|
+
: [];
|
|
101
|
+
}
|
|
102
|
+
function getRequestedStudioToolNames(input) {
|
|
103
|
+
const requestedToolNames = new Set([
|
|
104
|
+
...getForwardedAllowedRemoteToolNames(input.forwardedProps),
|
|
105
|
+
...(input.availableToolNames ?? []),
|
|
106
|
+
]);
|
|
107
|
+
return [...requestedToolNames]
|
|
108
|
+
.filter((toolName) => STUDIO_RUNTIME_REMOTE_TOOL_NAMES.has(toolName))
|
|
109
|
+
.sort();
|
|
110
|
+
}
|
|
78
111
|
function getVeryfrontApiMcpPolicy(agent) {
|
|
79
112
|
const requestedToolNames = new Set();
|
|
80
113
|
const deniedToolNames = new Set();
|
|
@@ -101,6 +134,10 @@ function hasVeryfrontPlatformRemoteToolSource(remoteTools) {
|
|
|
101
134
|
return remoteTools?.some((source) => source.id === VERYFRONT_PLATFORM_REMOTE_TOOL_SOURCE_ID) ??
|
|
102
135
|
false;
|
|
103
136
|
}
|
|
137
|
+
function hasVeryfrontStudioRemoteToolSource(remoteTools) {
|
|
138
|
+
return remoteTools?.some((source) => source.id === VERYFRONT_STUDIO_REMOTE_TOOL_SOURCE_ID) ??
|
|
139
|
+
false;
|
|
140
|
+
}
|
|
104
141
|
function createStaticRemoteToolSource(source, toolDefinitions) {
|
|
105
142
|
return {
|
|
106
143
|
id: source.id,
|
|
@@ -161,6 +198,38 @@ async function withVeryfrontPlatformRemoteTools(input) {
|
|
|
161
198
|
config: runtimeConfig,
|
|
162
199
|
};
|
|
163
200
|
}
|
|
201
|
+
function withVeryfrontStudioRemoteTools(input) {
|
|
202
|
+
const studioMcpUrl = getHostEnv("VERYFRONT_STUDIO_MCP_URL")?.trim();
|
|
203
|
+
const clientProfile = resolveRuntimeClientProfile(input.forwardedProps);
|
|
204
|
+
const requestedStudioToolNames = getRequestedStudioToolNames({
|
|
205
|
+
forwardedProps: input.forwardedProps,
|
|
206
|
+
availableToolNames: input.availableToolNames,
|
|
207
|
+
});
|
|
208
|
+
if (!input.token ||
|
|
209
|
+
!studioMcpUrl ||
|
|
210
|
+
!clientAllowsStudioMcp(clientProfile) ||
|
|
211
|
+
requestedStudioToolNames.length === 0) {
|
|
212
|
+
return input.agent;
|
|
213
|
+
}
|
|
214
|
+
const runtimeRemoteToolConfig = input.agent.config;
|
|
215
|
+
const remoteTools = runtimeRemoteToolConfig.__vfRemoteToolSources ?? [];
|
|
216
|
+
const studioRemoteToolSources = hasVeryfrontStudioRemoteToolSource(remoteTools) ? [] : [
|
|
217
|
+
createRemoteMCPToolSource({
|
|
218
|
+
id: VERYFRONT_STUDIO_REMOTE_TOOL_SOURCE_ID,
|
|
219
|
+
endpoint: studioMcpUrl,
|
|
220
|
+
headers: () => buildStudioMcpHeaders(input.token ?? "", input.projectId ?? null, input.conversationId),
|
|
221
|
+
}),
|
|
222
|
+
];
|
|
223
|
+
const runtimeConfig = {
|
|
224
|
+
...input.agent.config,
|
|
225
|
+
__vfAllowedRemoteTools: mergeAllowedRemoteTools(runtimeRemoteToolConfig.__vfAllowedRemoteTools, requestedStudioToolNames),
|
|
226
|
+
__vfRemoteToolSources: [...remoteTools, ...studioRemoteToolSources],
|
|
227
|
+
};
|
|
228
|
+
return {
|
|
229
|
+
...input.agent,
|
|
230
|
+
config: runtimeConfig,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
164
233
|
function buildAgentStreamEnv(input) {
|
|
165
234
|
const apiUrl = getHostEnv("VERYFRONT_API_URL") ?? "https://api.veryfront.com";
|
|
166
235
|
return {
|
|
@@ -302,12 +371,20 @@ export class AgentStreamHandler extends BaseHandler {
|
|
|
302
371
|
const runtimeInput = toRuntimeRunAgentInput(payload);
|
|
303
372
|
const apiAuthToken = payload.credentials?.authToken || ctx.proxyToken ||
|
|
304
373
|
getHostEnv("VERYFRONT_API_TOKEN") || "";
|
|
305
|
-
const
|
|
374
|
+
const platformRuntimeAgent = await withVeryfrontPlatformRemoteTools({
|
|
306
375
|
agent: agent,
|
|
307
376
|
token: apiAuthToken || null,
|
|
308
377
|
projectId: ctx.projectId ?? null,
|
|
309
378
|
availableToolNames: runtimeInput.tools.map((tool) => tool.name),
|
|
310
379
|
});
|
|
380
|
+
const runtimeAgent = withVeryfrontStudioRemoteTools({
|
|
381
|
+
agent: platformRuntimeAgent,
|
|
382
|
+
token: apiAuthToken || null,
|
|
383
|
+
projectId: ctx.projectId ?? null,
|
|
384
|
+
forwardedProps: runtimeInput.forwardedProps,
|
|
385
|
+
availableToolNames: runtimeInput.tools.map((tool) => tool.name),
|
|
386
|
+
conversationId: runtimeInput.threadId,
|
|
387
|
+
});
|
|
311
388
|
// Load project env vars so source-defined MCP tool headers resolve
|
|
312
389
|
// via _getProjectEnv(). Control-plane requests don't go through the proxy and
|
|
313
390
|
// therefore don't carry x-environment-id, so we discover the production env ID
|