veryfront 0.1.1101 → 0.1.1102
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/factory.d.ts.map +1 -1
- package/esm/src/agent/factory.js +2 -0
- package/esm/src/agent/hosted/cloud-runtime-system-messages.d.ts +5 -0
- package/esm/src/agent/hosted/cloud-runtime-system-messages.d.ts.map +1 -1
- package/esm/src/agent/hosted/cloud-runtime-system-messages.js +3 -2
- package/esm/src/agent/runtime/agent-invocation-contract.d.ts +1 -0
- package/esm/src/agent/runtime/agent-invocation-contract.d.ts.map +1 -1
- package/esm/src/agent/runtime/agent-invocation-contract.js +1 -0
- package/esm/src/agent/runtime/effective-agent-system.d.ts +8 -0
- package/esm/src/agent/runtime/effective-agent-system.d.ts.map +1 -0
- package/esm/src/agent/runtime/effective-agent-system.js +9 -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 +53 -0
- package/esm/src/internal-agents/run-system-prompt.d.ts +42 -0
- package/esm/src/internal-agents/run-system-prompt.d.ts.map +1 -0
- package/esm/src/internal-agents/run-system-prompt.js +109 -0
- package/esm/src/internal-agents/schema.d.ts +2 -0
- package/esm/src/internal-agents/schema.d.ts.map +1 -1
- package/esm/src/internal-agents/schema.js +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 +1 -0
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +5 -5
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/src/agent/factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,KAAK,EACL,WAAW,EACX,eAAe,EAKhB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/src/agent/factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,KAAK,EACL,WAAW,EACX,eAAe,EAKhB,MAAM,YAAY,CAAC;AAsFpB,oBAAoB;AACpB,wBAAgB,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,KAAK,CAyNhD;AAcD;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,YAAY,CAAC,GACnD,eAAe,EAAE,CAanB"}
|
package/esm/src/agent/factory.js
CHANGED
|
@@ -13,6 +13,7 @@ import { createError, toError } from "../errors/index.js";
|
|
|
13
13
|
import { COMMON_BLOCKED_PATTERNS, securityMiddleware } from "./middleware/security/validator.js";
|
|
14
14
|
import { withSpan } from "../observability/tracing/otlp-setup.js";
|
|
15
15
|
import { resolveConfiguredAgentModel } from "./runtime/model-resolution.js";
|
|
16
|
+
import { setEffectiveAgentSystem } from "./runtime/effective-agent-system.js";
|
|
16
17
|
import { defineSchema } from "../schemas/index.js";
|
|
17
18
|
import { getMessageSchema } from "./schemas/agent.schema.js";
|
|
18
19
|
import { isRequestBodyTooLargeError, readBodyWithLimit, } from "../security/input-validation/limits.js";
|
|
@@ -204,6 +205,7 @@ export function agent(config) {
|
|
|
204
205
|
return runtime.clearMemory();
|
|
205
206
|
},
|
|
206
207
|
};
|
|
208
|
+
setEffectiveAgentSystem(agentInstance, augmentedSystem);
|
|
207
209
|
agentRegistry.register(id, agentInstance);
|
|
208
210
|
return agentInstance;
|
|
209
211
|
}
|
|
@@ -11,6 +11,11 @@ export type CreateVeryfrontCloudRuntimeSystemMessagesInput = {
|
|
|
11
11
|
branchId?: string | null;
|
|
12
12
|
environmentContext?: string;
|
|
13
13
|
};
|
|
14
|
+
/** Builds the shared project-context prompt block (project reference + branch). */
|
|
15
|
+
export declare function buildProjectContextPromptBlock(input: {
|
|
16
|
+
projectId: string;
|
|
17
|
+
branchId?: string | null;
|
|
18
|
+
}): string;
|
|
14
19
|
/** Create Veryfront Cloud runtime system messages. */
|
|
15
20
|
export declare function createVeryfrontCloudRuntimeSystemMessages(input: CreateVeryfrontCloudRuntimeSystemMessagesInput): ChatSystemMessage[];
|
|
16
21
|
/** Builds Veryfront Cloud runtime instructions. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-runtime-system-messages.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/cloud-runtime-system-messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,uBAAuB,CAAC;AAEhF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAE3E,wEAAwE;AACxE,MAAM,MAAM,8CAA8C,GAAG;IAC3D,KAAK,EAAE,8BAA8B,CAAC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;
|
|
1
|
+
{"version":3,"file":"cloud-runtime-system-messages.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/cloud-runtime-system-messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,uBAAuB,CAAC;AAEhF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAE3E,wEAAwE;AACxE,MAAM,MAAM,8CAA8C,GAAG;IAC3D,KAAK,EAAE,8BAA8B,CAAC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AASF,mFAAmF;AACnF,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACrD,MAAM,CAcR;AAED,sDAAsD;AACtD,wBAAgB,yCAAyC,CACvD,KAAK,EAAE,8CAA8C,GACpD,iBAAiB,EAAE,CAsBrB;AAED,mDAAmD;AACnD,wBAAgB,sCAAsC,CACpD,KAAK,EAAE,kCAAkC,CAAC,8BAA8B,CAAC,GACxE,iBAAiB,EAAE,CASrB"}
|
|
@@ -6,7 +6,8 @@ function createProjectInstructionsBlock(instructions) {
|
|
|
6
6
|
content: `CRITICAL: You MUST follow these project-specific guidelines:\n\n${instructions}`,
|
|
7
7
|
});
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
/** Builds the shared project-context prompt block (project reference + branch). */
|
|
10
|
+
export function buildProjectContextPromptBlock(input) {
|
|
10
11
|
const branchLine = input.branchId
|
|
11
12
|
? `branch_id: "${input.branchId}"`
|
|
12
13
|
: "branch_id: main (no branch_id needed for file operations)";
|
|
@@ -27,7 +28,7 @@ export function createVeryfrontCloudRuntimeSystemMessages(input) {
|
|
|
27
28
|
runtimeBlocks.push(createProjectInstructionsBlock(input.instructions));
|
|
28
29
|
}
|
|
29
30
|
if (input.projectId) {
|
|
30
|
-
runtimeBlocks.push(
|
|
31
|
+
runtimeBlocks.push(buildProjectContextPromptBlock({
|
|
31
32
|
projectId: input.projectId,
|
|
32
33
|
branchId: input.branchId,
|
|
33
34
|
}));
|
|
@@ -397,6 +397,7 @@ export type RuntimeAgentControlPlaneStreamRequest = {
|
|
|
397
397
|
messages: RuntimeAgentRunInvocation["messages"];
|
|
398
398
|
tools: RuntimeAgentRunInvocation["tools"];
|
|
399
399
|
context: RuntimeAgentRunInvocation["context"];
|
|
400
|
+
runtimeTargetBranchId?: RuntimeAgentProjectContext["runtimeTargetBranchId"];
|
|
400
401
|
credentials?: RuntimeAgentRunInvocation["credentials"];
|
|
401
402
|
agentSource: RuntimeAgentRunInvocation["agentSource"];
|
|
402
403
|
agentConfig?: RuntimeAgentRunInvocation["agentConfig"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-invocation-contract.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/agent-invocation-contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAuBnF,eAAO,MAAM,0BAA0B,gEAEtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,0DAAyC,CAAC;AAE9E,eAAO,MAAM,+BAA+B,gEAAkD,CAAC;AAE/F;;GAEG;AACH,eAAO,MAAM,4BAA4B,0DAA8C,CAAC;AAExF,eAAO,MAAM,8BAA8B,gEAK1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,0DAA6C,CAAC;AAEtF,eAAO,MAAM,uBAAuB,gEAAkD,CAAC;AAEvF;;GAEG;AACH,eAAO,MAAM,oBAAoB,0DAAsC,CAAC;AAExE,eAAO,MAAM,6BAA6B,gEAKzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,0DAA4C,CAAC;AASpF,eAAO,MAAM,yBAAyB;;;;;;GAWrC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;GAAwC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,IAAI,GAAG,SAAS,CAAC,CAAC;IAC/E,QAAQ,EAAE,yBAAyB,CAAC,UAAU,CAAC,CAAC;IAChD,KAAK,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAC1C,OAAO,EAAE,yBAAyB,CAAC,SAAS,CAAC,CAAC;IAC9C,WAAW,CAAC,EAAE,yBAAyB,CAAC,aAAa,CAAC,CAAC;IACvD,WAAW,EAAE,yBAAyB,CAAC,aAAa,CAAC,CAAC;IACtD,WAAW,CAAC,EAAE,yBAAyB,CAAC,aAAa,CAAC,CAAC;IACvD,cAAc,CAAC,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,CAAC;CAC9D,CAAC;AAEF,yEAAyE;AACzE,wBAAgB,wDAAwD,CACtE,KAAK,EAAE,yBAAyB,GAC/B,qCAAqC,
|
|
1
|
+
{"version":3,"file":"agent-invocation-contract.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/agent-invocation-contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAuBnF,eAAO,MAAM,0BAA0B,gEAEtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,0DAAyC,CAAC;AAE9E,eAAO,MAAM,+BAA+B,gEAAkD,CAAC;AAE/F;;GAEG;AACH,eAAO,MAAM,4BAA4B,0DAA8C,CAAC;AAExF,eAAO,MAAM,8BAA8B,gEAK1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,0DAA6C,CAAC;AAEtF,eAAO,MAAM,uBAAuB,gEAAkD,CAAC;AAEvF;;GAEG;AACH,eAAO,MAAM,oBAAoB,0DAAsC,CAAC;AAExE,eAAO,MAAM,6BAA6B,gEAKzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,0DAA4C,CAAC;AASpF,eAAO,MAAM,yBAAyB;;;;;;GAWrC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sB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,aAAa,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC,CAAC;IAC/E,QAAQ,EAAE,yBAAyB,CAAC,UAAU,CAAC,CAAC;IAChD,KAAK,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAC1C,OAAO,EAAE,yBAAyB,CAAC,SAAS,CAAC,CAAC;IAC9C,qBAAqB,CAAC,EAAE,0BAA0B,CAAC,uBAAuB,CAAC,CAAC;IAC5E,WAAW,CAAC,EAAE,yBAAyB,CAAC,aAAa,CAAC,CAAC;IACvD,WAAW,EAAE,yBAAyB,CAAC,aAAa,CAAC,CAAC;IACtD,WAAW,CAAC,EAAE,yBAAyB,CAAC,aAAa,CAAC,CAAC;IACvD,cAAc,CAAC,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,CAAC;CAC9D,CAAC;AAEF,yEAAyE;AACzE,wBAAgB,wDAAwD,CACtE,KAAK,EAAE,yBAAyB,GAC/B,qCAAqC,CAevC;AAED,2CAA2C;AAC3C,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,yBAAyB,CAAC,CAEpC;AAED,6DAA6D;AAC7D,wBAAsB,qCAAqC,CACzD,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,yBAAyB,GAAG,QAAQ,CAAC,CAK/C"}
|
|
@@ -246,6 +246,7 @@ export function buildRuntimeAgentControlPlaneStreamRequestFromInvocation(input)
|
|
|
246
246
|
messages: input.messages,
|
|
247
247
|
tools: input.tools,
|
|
248
248
|
context: input.context,
|
|
249
|
+
runtimeTargetBranchId: input.run.project.runtimeTargetBranchId ?? null,
|
|
249
250
|
...(input.credentials ? { credentials: input.credentials } : {}),
|
|
250
251
|
agentSource: input.agentSource,
|
|
251
252
|
...(input.agentConfig ? { agentConfig: input.agentConfig } : {}),
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Agent } from "../types.js";
|
|
2
|
+
type AgentSystem = Agent["config"]["system"];
|
|
3
|
+
/** Records the system resolver used by an agent's private runtime. */
|
|
4
|
+
export declare function setEffectiveAgentSystem(agent: Agent, system: AgentSystem): void;
|
|
5
|
+
/** Returns the effective runtime system resolver, including through config-preserving wrappers. */
|
|
6
|
+
export declare function getEffectiveAgentSystem(agent: Agent): AgentSystem;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=effective-agent-system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effective-agent-system.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/effective-agent-system.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,KAAK,WAAW,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;AAU7C,sEAAsE;AACtE,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAE/E;AAED,mGAAmG;AACnG,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,CAEjE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const EFFECTIVE_AGENT_SYSTEM = Symbol("veryfront.effectiveAgentSystem");
|
|
2
|
+
/** Records the system resolver used by an agent's private runtime. */
|
|
3
|
+
export function setEffectiveAgentSystem(agent, system) {
|
|
4
|
+
agent.config[EFFECTIVE_AGENT_SYSTEM] = system;
|
|
5
|
+
}
|
|
6
|
+
/** Returns the effective runtime system resolver, including through config-preserving wrappers. */
|
|
7
|
+
export function getEffectiveAgentSystem(agent) {
|
|
8
|
+
return agent.config[EFFECTIVE_AGENT_SYSTEM] ?? agent.config.system;
|
|
9
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-stream.d.ts","sourceRoot":"","sources":["../../../src/src/internal-agents/run-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,KAAK,EACV,KAAK,YAAY,IAAI,OAAO,EAC5B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M,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;AAoXD,wBAAsB,gCAAgC,CACpD,KAAK,EAAE,oBAAoB,EAC3B,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,+BAA+B,GACpC,OAAO,CAAC,QAAQ,CAAC,CAqdnB"}
|
|
@@ -3,6 +3,8 @@ import { normalizeAgUiRuntimeMessages } from "../agent/ag-ui/runtime-support.js"
|
|
|
3
3
|
import { compactForStep, estimateOverhead } from "../chat/message-prep.js";
|
|
4
4
|
import { getRuntimeRemoteToolSources, } from "../agent/runtime/mcp-server-tool-sources.js";
|
|
5
5
|
import { buildRuntimeUsageTraceAttributes } from "../agent/runtime/trace-usage.js";
|
|
6
|
+
import { getProviderNativeToolNames } from "../agent/runtime/provider-native-tool-inventory.js";
|
|
7
|
+
import { selectProviderCompatibleToolNames } from "../agent/runtime/provider-tool-compat.js";
|
|
6
8
|
import { convertAgentRuntimeMessagesToProviderMessages, convertProviderMessagesToAgentRuntimeMessages, } from "../agent/runtime/message-adapter.js";
|
|
7
9
|
import { createAgentServiceSandboxTools } from "../sandbox/index.js";
|
|
8
10
|
import { tryResolve } from "../extensions/contracts.js";
|
|
@@ -15,6 +17,7 @@ import { addSpanEvent, setSpanAttributes, withSpan, } from "../observability/tra
|
|
|
15
17
|
import { defineSchema, lazySchema } from "../schemas/index.js";
|
|
16
18
|
import { createStreamTransformState, finalizeRunEvents, formatAgUiEvent, mapRuntimeEventToAgUi, parseSseJsonEvents, } from "./ag-ui-sse.js";
|
|
17
19
|
import { AgentRunCancelledError } from "./session-manager.js";
|
|
20
|
+
import { createInternalAgentRunSystemPromptResolver } from "./run-system-prompt.js";
|
|
18
21
|
import { serverLogger } from "../utils/index.js";
|
|
19
22
|
const getAnyObjectSchema = defineSchema((v) => v.record(v.string(), v.unknown()));
|
|
20
23
|
const anyObjectSchema = lazySchema(getAnyObjectSchema);
|
|
@@ -303,6 +306,23 @@ function applyRuntimeToolAllowlist(mergedTools, toolAllowlist, agent) {
|
|
|
303
306
|
}
|
|
304
307
|
return Object.fromEntries(Object.entries(mergedTools).filter(([toolName]) => allowedToolNames.has(toolName)));
|
|
305
308
|
}
|
|
309
|
+
function getRequiredLocalToolNames(input) {
|
|
310
|
+
if (!input.mergedTools || input.mergedTools === true) {
|
|
311
|
+
return [];
|
|
312
|
+
}
|
|
313
|
+
return Object.entries(input.mergedTools)
|
|
314
|
+
.filter(([toolName, entry]) => {
|
|
315
|
+
if (entry && typeof entry === "object") {
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
318
|
+
if (Object.hasOwn(input.availableLocalTools, toolName)) {
|
|
319
|
+
return true;
|
|
320
|
+
}
|
|
321
|
+
const registryTool = toolRegistry.get(toolName);
|
|
322
|
+
return Boolean(registryTool && isToolVisibleTo(registryTool, { agentId: input.agent.id }));
|
|
323
|
+
})
|
|
324
|
+
.map(([toolName]) => toolName);
|
|
325
|
+
}
|
|
306
326
|
function getServerResolvedProjectToolNames(forwardedProps) {
|
|
307
327
|
const runtimeOverrides = isRecord(forwardedProps?.runtimeOverrides)
|
|
308
328
|
? forwardedProps.runtimeOverrides
|
|
@@ -430,10 +450,43 @@ export async function createRuntimeAgentStreamResponse(input, agent, deps) {
|
|
|
430
450
|
const cappedProviderTools = runtimeToolAllowlist !== null && Array.isArray(agent.config.providerTools)
|
|
431
451
|
? agent.config.providerTools.filter((toolName) => typeof toolName === "string" && runtimeToolAllowlist.has(toolName))
|
|
432
452
|
: undefined;
|
|
453
|
+
const effectiveProviderToolNames = cappedProviderTools ??
|
|
454
|
+
(Array.isArray(agent.config.providerTools)
|
|
455
|
+
? agent.config.providerTools.filter((toolName) => typeof toolName === "string")
|
|
456
|
+
: []);
|
|
457
|
+
const modelSupportedProviderToolNames = new Set(getProviderNativeToolNames({ model: agent.config.model }));
|
|
458
|
+
const providerToolNames = effectiveProviderToolNames.filter((toolName) => modelSupportedProviderToolNames.has(toolName));
|
|
459
|
+
const mergedToolNames = mergedTools && mergedTools !== true ? Object.keys(mergedTools) : [];
|
|
460
|
+
const allowedRemoteToolNameSet = new Set(allowedRemoteToolNames ?? []);
|
|
461
|
+
const forwardedToolNames = (forwardedIntegrationToolDefs?.map((def) => def.name) ?? [])
|
|
462
|
+
.filter((toolName) => allowedRemoteToolNameSet.has(toolName));
|
|
463
|
+
const localToolNames = getRequiredLocalToolNames({
|
|
464
|
+
mergedTools,
|
|
465
|
+
availableLocalTools,
|
|
466
|
+
agent,
|
|
467
|
+
});
|
|
468
|
+
const runtimeToolNames = selectProviderCompatibleToolNames([
|
|
469
|
+
...new Set([
|
|
470
|
+
...mergedToolNames,
|
|
471
|
+
...providerToolNames,
|
|
472
|
+
...(allowedRemoteToolNames ?? []),
|
|
473
|
+
...forwardedToolNames,
|
|
474
|
+
]),
|
|
475
|
+
].sort(), {
|
|
476
|
+
model: agent.config.model,
|
|
477
|
+
requiredToolNames: localToolNames,
|
|
478
|
+
});
|
|
433
479
|
const runtimeAgent = {
|
|
434
480
|
...agent,
|
|
435
481
|
config: {
|
|
436
482
|
...agent.config,
|
|
483
|
+
system: createInternalAgentRunSystemPromptResolver({
|
|
484
|
+
agent,
|
|
485
|
+
runInput: input,
|
|
486
|
+
projectId: deps.projectAgentSandbox?.projectId ?? null,
|
|
487
|
+
branchId: deps.projectAgentSandbox?.branchId,
|
|
488
|
+
toolNames: runtimeToolNames,
|
|
489
|
+
}),
|
|
437
490
|
tools: mergedTools,
|
|
438
491
|
...(cappedProviderTools !== undefined ? { providerTools: cappedProviderTools } : {}),
|
|
439
492
|
...(allowedRemoteToolNames !== undefined
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal Agent Run System Prompt
|
|
3
|
+
*
|
|
4
|
+
* Composes the system prompt for project-runtime agent runs, mirroring the
|
|
5
|
+
* hosted chat runtime's instruction assembly. Before this, internal runs used
|
|
6
|
+
* the agent's authored instructions verbatim, so request-scoped agents (e.g.
|
|
7
|
+
* Studio-created project agents) never learned the project reference, branch,
|
|
8
|
+
* Studio environment context, or effective tool surface of the run they were
|
|
9
|
+
* executing in and asked users for values the harness already knew.
|
|
10
|
+
*
|
|
11
|
+
* The composed prompt extends the agent's resolved base instructions (which
|
|
12
|
+
* already include the factory's skill manifest for skill-enabled agents) with:
|
|
13
|
+
* - the shared project-context block (project reference + branch)
|
|
14
|
+
* - the requested model
|
|
15
|
+
* - the caller-supplied environment context (`studio_context` context item)
|
|
16
|
+
* - the effective run tool inventory
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import type { Agent } from "../agent/index.js";
|
|
21
|
+
import type { RuntimeRunAgentInput } from "./schema.js";
|
|
22
|
+
/** Caller-supplied run context extracted from the `studio_context` item. */
|
|
23
|
+
export type InternalAgentStudioRunContext = {
|
|
24
|
+
environmentContext?: string;
|
|
25
|
+
projectId?: string;
|
|
26
|
+
branchId?: string | null;
|
|
27
|
+
};
|
|
28
|
+
/** Extracts the Studio-supplied run context from run context items. */
|
|
29
|
+
export declare function getInternalAgentStudioRunContext(context: RuntimeRunAgentInput["context"]): InternalAgentStudioRunContext;
|
|
30
|
+
/** Input payload for compose internal agent run system prompt. */
|
|
31
|
+
export type ComposeInternalAgentRunSystemPromptInput = {
|
|
32
|
+
agent: Agent;
|
|
33
|
+
runInput: RuntimeRunAgentInput;
|
|
34
|
+
projectId?: string | null;
|
|
35
|
+
branchId?: string | null;
|
|
36
|
+
toolNames: readonly string[];
|
|
37
|
+
};
|
|
38
|
+
/** Composes the internal agent run system prompt. */
|
|
39
|
+
export declare function composeInternalAgentRunSystemPrompt(input: ComposeInternalAgentRunSystemPromptInput): Promise<string>;
|
|
40
|
+
/** Creates a lazy system prompt resolver for an internal agent run. */
|
|
41
|
+
export declare function createInternalAgentRunSystemPromptResolver(input: ComposeInternalAgentRunSystemPromptInput): () => Promise<string>;
|
|
42
|
+
//# sourceMappingURL=run-system-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-system-prompt.d.ts","sourceRoot":"","sources":["../../../src/src/internal-agents/run-system-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAU/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAKxD,4EAA4E;AAC5E,MAAM,MAAM,6BAA6B,GAAG;IAC1C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAqBF,uEAAuE;AACvE,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,oBAAoB,CAAC,SAAS,CAAC,GACvC,6BAA6B,CAmB/B;AAYD,kEAAkE;AAClE,MAAM,MAAM,wCAAwC,GAAG;IACrD,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9B,CAAC;AAEF,qDAAqD;AACrD,wBAAsB,mCAAmC,CACvD,KAAK,EAAE,wCAAwC,GAC9C,OAAO,CAAC,MAAM,CAAC,CAwCjB;AAED,uEAAuE;AACvE,wBAAgB,0CAA0C,CACxD,KAAK,EAAE,wCAAwC,GAC9C,MAAM,OAAO,CAAC,MAAM,CAAC,CAEvB"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal Agent Run System Prompt
|
|
3
|
+
*
|
|
4
|
+
* Composes the system prompt for project-runtime agent runs, mirroring the
|
|
5
|
+
* hosted chat runtime's instruction assembly. Before this, internal runs used
|
|
6
|
+
* the agent's authored instructions verbatim, so request-scoped agents (e.g.
|
|
7
|
+
* Studio-created project agents) never learned the project reference, branch,
|
|
8
|
+
* Studio environment context, or effective tool surface of the run they were
|
|
9
|
+
* executing in and asked users for values the harness already knew.
|
|
10
|
+
*
|
|
11
|
+
* The composed prompt extends the agent's resolved base instructions (which
|
|
12
|
+
* already include the factory's skill manifest for skill-enabled agents) with:
|
|
13
|
+
* - the shared project-context block (project reference + branch)
|
|
14
|
+
* - the requested model
|
|
15
|
+
* - the caller-supplied environment context (`studio_context` context item)
|
|
16
|
+
* - the effective run tool inventory
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import { buildProjectContextPromptBlock } from "../agent/hosted/cloud-runtime-system-messages.js";
|
|
21
|
+
import { createRuntimeAgentSystemMessages } from "../agent/runtime/agent-definition.js";
|
|
22
|
+
import { getEffectiveAgentSystem } from "../agent/runtime/effective-agent-system.js";
|
|
23
|
+
import { getRuntimeAgentMarkdownDefinition } from "../agent/runtime/agent-markdown-adapter.js";
|
|
24
|
+
import { createRuntimePromptBlock } from "../agent/runtime/prompt-block.js";
|
|
25
|
+
import { flattenSystemInstructions, withRuntimeToolInventory, } from "../agent/runtime/tool-inventory.js";
|
|
26
|
+
const STUDIO_CONTEXT_ITEM_TITLE = "studio_context";
|
|
27
|
+
const DEFAULT_SYSTEM_PROMPT = "You are a helpful assistant.";
|
|
28
|
+
function isRecord(value) {
|
|
29
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
30
|
+
}
|
|
31
|
+
function getNonEmptyString(value) {
|
|
32
|
+
if (typeof value !== "string") {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
const trimmed = value.trim();
|
|
36
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
37
|
+
}
|
|
38
|
+
function getStudioContextData(item) {
|
|
39
|
+
if (!isRecord(item) || item.type !== "json" || item.title !== STUDIO_CONTEXT_ITEM_TITLE) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
return isRecord(item.data) ? item.data : undefined;
|
|
43
|
+
}
|
|
44
|
+
/** Extracts the Studio-supplied run context from run context items. */
|
|
45
|
+
export function getInternalAgentStudioRunContext(context) {
|
|
46
|
+
for (const item of context) {
|
|
47
|
+
const data = getStudioContextData(item);
|
|
48
|
+
if (!data) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const environmentContext = getNonEmptyString(data.environmentContext);
|
|
52
|
+
const projectId = getNonEmptyString(data.projectId);
|
|
53
|
+
const branchId = data.branchId === null ? null : getNonEmptyString(data.branchId);
|
|
54
|
+
return {
|
|
55
|
+
...(environmentContext ? { environmentContext } : {}),
|
|
56
|
+
...(projectId ? { projectId } : {}),
|
|
57
|
+
...(branchId !== undefined ? { branchId } : {}),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return {};
|
|
61
|
+
}
|
|
62
|
+
async function resolveBaseSystemPrompt(system) {
|
|
63
|
+
if (typeof system === "string") {
|
|
64
|
+
return system;
|
|
65
|
+
}
|
|
66
|
+
if (typeof system === "function") {
|
|
67
|
+
return await system();
|
|
68
|
+
}
|
|
69
|
+
return DEFAULT_SYSTEM_PROMPT;
|
|
70
|
+
}
|
|
71
|
+
/** Composes the internal agent run system prompt. */
|
|
72
|
+
export async function composeInternalAgentRunSystemPrompt(input) {
|
|
73
|
+
const baseInstructions = await resolveBaseSystemPrompt(getEffectiveAgentSystem(input.agent));
|
|
74
|
+
const studioContext = getInternalAgentStudioRunContext(input.runInput.context);
|
|
75
|
+
const projectId = input.projectId ?? studioContext.projectId;
|
|
76
|
+
const runtimeBlocks = [];
|
|
77
|
+
if (projectId) {
|
|
78
|
+
runtimeBlocks.push(buildProjectContextPromptBlock({
|
|
79
|
+
projectId,
|
|
80
|
+
branchId: input.branchId !== undefined ? input.branchId : studioContext.branchId ?? null,
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
if (input.agent.config.model) {
|
|
84
|
+
runtimeBlocks.push(createRuntimePromptBlock({
|
|
85
|
+
name: "runtime_info",
|
|
86
|
+
content: `model: "${input.agent.config.model}"`,
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
const definition = getRuntimeAgentMarkdownDefinition(input.agent);
|
|
90
|
+
const messages = createRuntimeAgentSystemMessages({
|
|
91
|
+
agent: {
|
|
92
|
+
...(definition ?? {
|
|
93
|
+
id: input.agent.id,
|
|
94
|
+
name: input.agent.config.name ?? input.agent.id,
|
|
95
|
+
description: input.agent.config.description ?? "",
|
|
96
|
+
}),
|
|
97
|
+
instructions: baseInstructions,
|
|
98
|
+
},
|
|
99
|
+
runtimeBlocks,
|
|
100
|
+
...(studioContext.environmentContext
|
|
101
|
+
? { environmentContext: studioContext.environmentContext }
|
|
102
|
+
: {}),
|
|
103
|
+
});
|
|
104
|
+
return flattenSystemInstructions(withRuntimeToolInventory(messages, input.toolNames));
|
|
105
|
+
}
|
|
106
|
+
/** Creates a lazy system prompt resolver for an internal agent run. */
|
|
107
|
+
export function createInternalAgentRunSystemPromptResolver(input) {
|
|
108
|
+
return () => composeInternalAgentRunSystemPrompt(input);
|
|
109
|
+
}
|
|
@@ -240,6 +240,7 @@ export declare const getInternalAgentControlPlaneStreamRequestSchema: () => Sche
|
|
|
240
240
|
description: Schema<string>;
|
|
241
241
|
value: Schema<string>;
|
|
242
242
|
}>)[]>;
|
|
243
|
+
runtimeTargetBranchId: Schema<string | null | undefined>;
|
|
243
244
|
agentSource: Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
244
245
|
type: Schema<"branch">;
|
|
245
246
|
branch: Schema<string>;
|
|
@@ -352,6 +353,7 @@ export declare const getInternalAgentStreamRequestSchema: () => Schema<import(".
|
|
|
352
353
|
description: Schema<string>;
|
|
353
354
|
value: Schema<string>;
|
|
354
355
|
}>)[]>;
|
|
356
|
+
runtimeTargetBranchId: Schema<string | null | undefined>;
|
|
355
357
|
agentSource: Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
356
358
|
type: Schema<"branch">;
|
|
357
359
|
branch: Schema<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/src/internal-agents/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EACL,KAAK,sBAAsB,EAE3B,KAAK,kBAAkB,EAQxB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EAEL,kCAAkC,EAClC,KAAK,yBAAyB,EAC/B,MAAM,+CAA+C,CAAC;AAkBvD,eAAO,MAAM,cAAc,sBAA4B,CAAC;AAExD,eAAO,MAAM,gBAAgB,sBAE5B,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;;;GAAmC,CAAC;AAC7E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;GAAkC,CAAC;AAC3E,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA8B,CAAC;AACnE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;GAA8B,CAAC;AACnE,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;GAAkD,CAAC;AAqNnG,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,OAAO,mCAAmC,CAAC,CAAC,GACzE,kBAAkB,CAWpB;AAED,eAAO,MAAM,qBAAqB;;;;;GAYjC,CAAC;AAEF,OAAO,EAAE,kCAAkC,EAAE,CAAC;AAC9C,YAAY,EAAE,yBAAyB,EAAE,CAAC;AAC1C,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAC,CAAC;AAC/F,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AACxD,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AACtD,MAAM,MAAM,0BAA0B,GAAG,WAAW,CAClD,UAAU,CAAC,OAAO,mCAAmC,CAAC,CACvD,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC;AAGjF,YAAY,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -40,6 +40,7 @@ export const getInternalAgentControlPlaneStreamRequestSchema = defineSchema((v)
|
|
|
40
40
|
messages: v.array(v.union([getRuntimeMessageSchema(), getInternalAgentCompatibilityMessageSchema()])).max(MAX_RUNTIME_MESSAGES),
|
|
41
41
|
tools: v.array(getRuntimeInjectedToolSchema()).max(50).default([]),
|
|
42
42
|
context: v.array(getRuntimeContextSchema()).max(10).default([]).refine((value) => isWithinJsonSizeLimit(value, 65_536), { message: "context must be less than 64 KB total" }),
|
|
43
|
+
runtimeTargetBranchId: v.string().uuid().nullable().optional(),
|
|
43
44
|
agentSource: getRuntimeAgentSourceContextSchema(),
|
|
44
45
|
agentConfig: getRuntimeAgentMarkdownDefinitionSchema().optional().refine((value) => value === undefined || isWithinJsonSizeLimit(value, MAX_AGENT_CONFIG_BYTES), { message: "agentConfig must be less than 64 KB" }),
|
|
45
46
|
credentials: getRuntimeAgentCredentialsSchema().optional(),
|
|
@@ -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;AAGpF,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,wCAAwC,CAAC;AAQhD,OAAO,EACL,4BAA4B,EAE7B,MAAM,2CAA2C,CAAC;AA0BnD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAkBnG,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;AAkhBD,qBAAa,kBAAmB,SAAQ,WAAW;IASrC,OAAO,CAAC,QAAQ,CAAC,IAAI;IARjC,QAAQ,EAAE,eAAe,CAMvB;gBAE2B,IAAI,GAAE,sBAAoC;IAIvE,OAAO,CAAC,sBAAsB;IAsBxB,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,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;AAGpF,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,wCAAwC,CAAC;AAQhD,OAAO,EACL,4BAA4B,EAE7B,MAAM,2CAA2C,CAAC;AA0BnD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAkBnG,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;AAkhBD,qBAAa,kBAAmB,SAAQ,WAAW;IASrC,OAAO,CAAC,QAAQ,CAAC,IAAI;IARjC,QAAQ,EAAE,eAAe,CAMvB;gBAE2B,IAAI,GAAE,sBAAoC;IAIvE,OAAO,CAAC,sBAAsB;IAsBxB,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CA6NxE"}
|
|
@@ -533,6 +533,7 @@ export class AgentStreamHandler extends BaseHandler {
|
|
|
533
533
|
projectAgentSandbox: {
|
|
534
534
|
apiUrl: resolveVeryfrontApiBaseUrlFromHostEnv(),
|
|
535
535
|
authToken: apiAuthToken || undefined,
|
|
536
|
+
branchId: payload.runtimeTargetBranchId,
|
|
536
537
|
projectId: sourceScopedContext.projectId ?? null,
|
|
537
538
|
},
|
|
538
539
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1102",
|
|
4
4
|
"description": "The simplest way to build AI-powered apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -328,10 +328,10 @@
|
|
|
328
328
|
"@types/react": "19.2.14",
|
|
329
329
|
"@types/react-dom": "19.2.3",
|
|
330
330
|
"ws": "8.21.0",
|
|
331
|
-
"@veryfront/ext-bundler-esbuild": "0.1.
|
|
332
|
-
"@veryfront/ext-content-mdx": "0.1.
|
|
333
|
-
"@veryfront/ext-css-tailwind": "0.1.
|
|
334
|
-
"@veryfront/ext-parser-babel": "0.1.
|
|
331
|
+
"@veryfront/ext-bundler-esbuild": "0.1.1102",
|
|
332
|
+
"@veryfront/ext-content-mdx": "0.1.1102",
|
|
333
|
+
"@veryfront/ext-css-tailwind": "0.1.1102",
|
|
334
|
+
"@veryfront/ext-parser-babel": "0.1.1102"
|
|
335
335
|
},
|
|
336
336
|
"devDependencies": {
|
|
337
337
|
"@types/node": "20.9.0"
|