veryfront 0.1.754 → 0.1.756
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/auth/callback-server.d.ts +4 -1
- package/esm/cli/auth/callback-server.d.ts.map +1 -1
- package/esm/cli/auth/callback-server.js +52 -13
- package/esm/cli/auth/index.d.ts +1 -1
- package/esm/cli/auth/index.d.ts.map +1 -1
- package/esm/cli/auth/index.js +1 -1
- package/esm/cli/auth/login.d.ts +2 -0
- package/esm/cli/auth/login.d.ts.map +1 -1
- package/esm/cli/auth/login.js +18 -6
- package/esm/cli/commands/demo/demo.d.ts.map +1 -1
- package/esm/cli/commands/demo/demo.js +6 -7
- package/esm/deno.js +1 -1
- package/esm/src/agent/runtime/index.d.ts +3 -96
- package/esm/src/agent/runtime/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/index.js +21 -341
- package/esm/src/agent/runtime/model-capabilities.d.ts +3 -0
- package/esm/src/agent/runtime/model-capabilities.d.ts.map +1 -0
- package/esm/src/agent/runtime/model-capabilities.js +18 -0
- package/esm/src/agent/runtime/runtime-tool-config.d.ts +14 -0
- package/esm/src/agent/runtime/runtime-tool-config.d.ts.map +1 -0
- package/esm/src/agent/runtime/runtime-tool-config.js +37 -0
- package/esm/src/agent/runtime/skill-policy-enforcement.d.ts +16 -0
- package/esm/src/agent/runtime/skill-policy-enforcement.d.ts.map +1 -0
- package/esm/src/agent/runtime/skill-policy-enforcement.js +55 -0
- package/esm/src/agent/runtime/tool-result-continuation.d.ts +34 -0
- package/esm/src/agent/runtime/tool-result-continuation.d.ts.map +1 -0
- package/esm/src/agent/runtime/tool-result-continuation.js +194 -0
- package/esm/src/agent/schemas/agent.schema.d.ts +7 -0
- package/esm/src/agent/schemas/agent.schema.d.ts.map +1 -1
- package/esm/src/agent/schemas/agent.schema.js +9 -3
- package/esm/src/agent/schemas/index.d.ts +1 -1
- package/esm/src/agent/schemas/index.d.ts.map +1 -1
- package/esm/src/agent/schemas/index.js +1 -1
- package/esm/src/cache/dependency-graph.d.ts +1 -0
- package/esm/src/cache/dependency-graph.d.ts.map +1 -1
- package/esm/src/cache/dependency-graph.js +7 -1
- package/esm/src/modules/server/module-batch-handler.d.ts.map +1 -1
- package/esm/src/modules/server/module-batch-handler.js +47 -35
- package/esm/src/modules/server/module-server.d.ts.map +1 -1
- package/esm/src/modules/server/module-server.js +31 -9
- package/esm/src/modules/server/rate-limiter.d.ts +3 -2
- package/esm/src/modules/server/rate-limiter.d.ts.map +1 -1
- package/esm/src/platform/adapters/base.d.ts +24 -3
- package/esm/src/platform/adapters/base.d.ts.map +1 -1
- package/esm/src/platform/adapters/base.js +15 -1
- package/esm/src/platform/adapters/runtime/bun/websocket-adapter.d.ts +2 -0
- package/esm/src/platform/adapters/runtime/bun/websocket-adapter.d.ts.map +1 -1
- package/esm/src/platform/adapters/runtime/bun/websocket-adapter.js +33 -1
- package/esm/src/platform/adapters/runtime/node/websocket-adapter.d.ts +1 -1
- package/esm/src/platform/adapters/runtime/node/websocket-adapter.d.ts.map +1 -1
- package/esm/src/platform/adapters/runtime/node/websocket-adapter.js +3 -10
- package/esm/src/proxy/handler.d.ts.map +1 -1
- package/esm/src/proxy/handler.js +25 -116
- package/esm/src/proxy/local-project-resolver.d.ts +18 -0
- package/esm/src/proxy/local-project-resolver.d.ts.map +1 -0
- package/esm/src/proxy/local-project-resolver.js +63 -0
- package/esm/src/proxy/proxy-token-resolution.d.ts +37 -0
- package/esm/src/proxy/proxy-token-resolution.d.ts.map +1 -0
- package/esm/src/proxy/proxy-token-resolution.js +51 -0
- package/esm/src/rendering/orchestrator/module-loader/index.d.ts +10 -0
- package/esm/src/rendering/orchestrator/module-loader/index.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/index.js +23 -158
- package/esm/src/rendering/orchestrator/module-loader/module-persistence.d.ts +20 -0
- package/esm/src/rendering/orchestrator/module-loader/module-persistence.d.ts.map +1 -0
- package/esm/src/rendering/orchestrator/module-loader/module-persistence.js +80 -0
- package/esm/src/rendering/orchestrator/module-loader/module-transform-cache.d.ts +59 -0
- package/esm/src/rendering/orchestrator/module-loader/module-transform-cache.d.ts.map +1 -0
- package/esm/src/rendering/orchestrator/module-loader/module-transform-cache.js +97 -0
- package/esm/src/routing/api/handler.d.ts +2 -1
- package/esm/src/routing/api/handler.d.ts.map +1 -1
- package/esm/src/routing/api/handler.js +2 -1
- package/esm/src/routing/api/route-executor.d.ts +3 -0
- package/esm/src/routing/api/route-executor.d.ts.map +1 -1
- package/esm/src/routing/api/route-executor.js +28 -0
- package/esm/src/runtime/runtime-bridge.js +2 -2
- package/esm/src/security/http/base-handler.d.ts +3 -2
- package/esm/src/security/http/base-handler.d.ts.map +1 -1
- package/esm/src/security/http/base-handler.js +1 -1
- package/esm/src/security/sandbox/project-worker.d.ts +1 -0
- package/esm/src/security/sandbox/project-worker.d.ts.map +1 -1
- package/esm/src/security/sandbox/project-worker.js +17 -1
- package/esm/src/security/sandbox/worker-egress-guard.d.ts +15 -0
- package/esm/src/security/sandbox/worker-egress-guard.d.ts.map +1 -0
- package/esm/src/security/sandbox/worker-egress-guard.js +201 -0
- package/esm/src/security/sandbox/worker-permissions.d.ts +6 -2
- package/esm/src/security/sandbox/worker-permissions.d.ts.map +1 -1
- package/esm/src/security/sandbox/worker-permissions.js +34 -3
- package/esm/src/security/sandbox/worker-pool.d.ts +1 -1
- package/esm/src/security/sandbox/worker-pool.d.ts.map +1 -1
- package/esm/src/security/sandbox/worker-pool.js +35 -9
- package/esm/src/server/handlers/preview/hmr-client-manager.d.ts +3 -2
- package/esm/src/server/handlers/preview/hmr-client-manager.d.ts.map +1 -1
- package/esm/src/server/handlers/preview/hmr.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/preview/hmr.handler.js +4 -1
- package/esm/src/server/handlers/request/api/api-handler-wrapper.js +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.d.ts +32 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.d.ts.map +1 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.js +27 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/import-rewriter.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/import-rewriter.js +23 -3
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.js +32 -30
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/persistence.d.ts +34 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/persistence.d.ts.map +1 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/persistence.js +30 -0
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-result-continuation.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/tool-result-continuation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAElF,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAMtE;AAED,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,OAAO,EACf,gBAAgB,UAAQ,GACvB,OAAO,CAeT;AAED,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,OAAO,C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AAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,GACC;IACA,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;CAC1C,CAAC;AAEJ,wBAAgB,2BAA2B,CACzC,EAAE,EAAE,iBAAiB,GACpB,+BAA+B,CAoCjC;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,IAAI,cAAc,CAE1E"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { stripLeadingEmptyObjectPlaceholder } from "../streaming/data-stream.js";
|
|
2
|
+
import { parseToolArgs } from "./tool-helpers.js";
|
|
3
|
+
import { stringifyToolError } from "./error-utils.js";
|
|
4
|
+
export function getToolResultError(result) {
|
|
5
|
+
if (!result || typeof result !== "object" || !("error" in result)) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
return stringifyToolError(result.error);
|
|
9
|
+
}
|
|
10
|
+
export function createToolResultMessage(toolCallId, toolName, result, providerExecuted = false) {
|
|
11
|
+
return {
|
|
12
|
+
id: `tool_${toolCallId}`,
|
|
13
|
+
role: "tool",
|
|
14
|
+
parts: [
|
|
15
|
+
{
|
|
16
|
+
type: "tool-result",
|
|
17
|
+
toolCallId,
|
|
18
|
+
toolName,
|
|
19
|
+
result,
|
|
20
|
+
...(providerExecuted ? { providerExecuted: true } : {}),
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
timestamp: Date.now(),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function createToolErrorMessage(toolCallId, toolName, error) {
|
|
27
|
+
return {
|
|
28
|
+
id: `tool_error_${toolCallId}`,
|
|
29
|
+
role: "tool",
|
|
30
|
+
parts: [
|
|
31
|
+
{
|
|
32
|
+
type: "tool-result",
|
|
33
|
+
toolCallId,
|
|
34
|
+
toolName,
|
|
35
|
+
result: { error },
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
timestamp: Date.now(),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export function getProviderExecutedToolNames(runtimeTools) {
|
|
42
|
+
if (!runtimeTools) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
return Object.entries(runtimeTools).flatMap(([toolName, definition]) => {
|
|
46
|
+
if (definition &&
|
|
47
|
+
typeof definition === "object" &&
|
|
48
|
+
"type" in definition &&
|
|
49
|
+
definition.type === "provider") {
|
|
50
|
+
return [toolName];
|
|
51
|
+
}
|
|
52
|
+
return [];
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
export function collectFinalStreamToolResults(state) {
|
|
56
|
+
const finalToolResults = new Map();
|
|
57
|
+
for (const toolResult of state.toolResults) {
|
|
58
|
+
if (toolResult.preliminary === true) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
finalToolResults.set(toolResult.toolCallId, toolResult);
|
|
62
|
+
}
|
|
63
|
+
return finalToolResults;
|
|
64
|
+
}
|
|
65
|
+
export function collectPersistedToolResults(messages) {
|
|
66
|
+
const persistedToolResults = new Map();
|
|
67
|
+
for (const message of messages) {
|
|
68
|
+
if (message.role !== "tool") {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
for (const part of message.parts) {
|
|
72
|
+
if (!isToolResultPart(part)) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
persistedToolResults.set(part.toolCallId, part);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return persistedToolResults;
|
|
79
|
+
}
|
|
80
|
+
export function collectGeneratedToolResults(toolResults) {
|
|
81
|
+
const generatedToolResults = new Map();
|
|
82
|
+
for (const toolResult of toolResults ?? []) {
|
|
83
|
+
generatedToolResults.set(toolResult.toolCallId, toolResult);
|
|
84
|
+
}
|
|
85
|
+
return generatedToolResults;
|
|
86
|
+
}
|
|
87
|
+
export function shouldContinueAfterStreamStep(state) {
|
|
88
|
+
if (!state.toolCalls.size) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
const streamedToolCalls = Array.from(state.toolCalls.values());
|
|
92
|
+
const hasIncompleteToolCall = streamedToolCalls.some(isStreamedToolCallIncomplete);
|
|
93
|
+
const hasFinalizedClientToolCall = streamedToolCalls.some((toolCall) => toolCall.inputAvailable === true && toolCall.providerExecuted !== true);
|
|
94
|
+
const hasProviderExecutedToolCall = streamedToolCalls.some((toolCall) => toolCall.providerExecuted === true);
|
|
95
|
+
// A non-finalized call whose only accumulated arguments are a bare
|
|
96
|
+
// empty-object placeholder is provisional streamed input the model never
|
|
97
|
+
// committed. The runtime can recover by re-calling the model, so it must not
|
|
98
|
+
// block continuation like a truncated partial-JSON call does.
|
|
99
|
+
const hasIncompleteDeadToolCall = streamedToolCalls.some((toolCall) => isStreamedToolCallIncomplete(toolCall) &&
|
|
100
|
+
!isRecoverablePlaceholderToolCall(toolCall));
|
|
101
|
+
const hasRecoverablePlaceholderToolCall = streamedToolCalls.some(isRecoverablePlaceholderToolCall);
|
|
102
|
+
if (state.finishReason === "tool-calls") {
|
|
103
|
+
if (hasIncompleteDeadToolCall) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if (hasProviderExecutedToolCall && !hasFinalizedClientToolCall) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
if (hasRecoverablePlaceholderToolCall && !hasFinalizedClientToolCall) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
return !hasIncompleteToolCall && hasFinalizedClientToolCall;
|
|
113
|
+
}
|
|
114
|
+
if (state.finishReason !== "stop") {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
if (state.accumulatedText.trim().length > 0) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
const finalToolResults = collectFinalStreamToolResults(state);
|
|
121
|
+
if (!finalToolResults.size) {
|
|
122
|
+
for (const toolCall of state.toolCalls.values()) {
|
|
123
|
+
if (toolCall.inputAvailable !== true || toolCall.providerExecuted === true) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
for (const [toolCallId, toolCall] of state.toolCalls) {
|
|
130
|
+
const toolResult = finalToolResults.get(toolCallId);
|
|
131
|
+
if (!toolResult) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
if (toolCall.providerExecuted !== true && toolResult.providerExecuted !== true) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
export function captureStreamedToolCallInput(toolCall) {
|
|
141
|
+
const { args, error } = parseToolArgs(toolCall.arguments);
|
|
142
|
+
return {
|
|
143
|
+
args,
|
|
144
|
+
...(toolCall.arguments.length > 0 ? { inputText: toolCall.arguments } : {}),
|
|
145
|
+
...(error ? { parseError: error } : {}),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
export function isStreamedToolCallIncomplete(toolCall) {
|
|
149
|
+
return toolCall.inputAvailable !== true;
|
|
150
|
+
}
|
|
151
|
+
export function isRecoverablePlaceholderToolCall(toolCall) {
|
|
152
|
+
if (!isStreamedToolCallIncomplete(toolCall)) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
const stripped = stripLeadingEmptyObjectPlaceholder(toolCall.arguments);
|
|
156
|
+
return stripped === "" || stripped === "{}";
|
|
157
|
+
}
|
|
158
|
+
export function materializeStreamedToolCall(tc) {
|
|
159
|
+
const providerExecutedPart = tc.providerExecuted === true
|
|
160
|
+
? { providerExecuted: true }
|
|
161
|
+
: {};
|
|
162
|
+
const basePart = {
|
|
163
|
+
type: `tool-${tc.name}`,
|
|
164
|
+
toolCallId: tc.id,
|
|
165
|
+
toolName: tc.name,
|
|
166
|
+
args: {},
|
|
167
|
+
...(tc.arguments.length > 0 ? { inputText: tc.arguments } : {}),
|
|
168
|
+
...providerExecutedPart,
|
|
169
|
+
};
|
|
170
|
+
if (isStreamedToolCallIncomplete(tc)) {
|
|
171
|
+
return {
|
|
172
|
+
kind: "incomplete",
|
|
173
|
+
part: basePart,
|
|
174
|
+
partialArgumentsLength: tc.arguments.length,
|
|
175
|
+
partialArgumentsPreview: tc.arguments.slice(0, 200),
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
const capturedInput = captureStreamedToolCallInput(tc);
|
|
179
|
+
const part = {
|
|
180
|
+
type: `tool-${tc.name}`,
|
|
181
|
+
toolCallId: tc.id,
|
|
182
|
+
toolName: tc.name,
|
|
183
|
+
args: capturedInput.args,
|
|
184
|
+
...(capturedInput.inputText ? { inputText: capturedInput.inputText } : {}),
|
|
185
|
+
...providerExecutedPart,
|
|
186
|
+
};
|
|
187
|
+
if (capturedInput.parseError) {
|
|
188
|
+
return { kind: "parse-error", part, parseError: capturedInput.parseError };
|
|
189
|
+
}
|
|
190
|
+
return { kind: "complete", part };
|
|
191
|
+
}
|
|
192
|
+
export function isToolResultPart(part) {
|
|
193
|
+
return part.type === "tool-result" && "result" in part;
|
|
194
|
+
}
|
|
@@ -50,6 +50,13 @@ export declare const getToolResultPartSchema: () => import("../../internal-agent
|
|
|
50
50
|
result: import("../../internal-agents/schema.js").Schema<unknown>;
|
|
51
51
|
providerExecuted: import("../../internal-agents/schema.js").Schema<boolean | undefined>;
|
|
52
52
|
}>>;
|
|
53
|
+
/** Compatibility policy for the legacy inline tool-call message part. */
|
|
54
|
+
export declare const AGENT_SCHEMA_LEGACY_TOOL_CALL_PART_POLICY: {
|
|
55
|
+
readonly status: "compatibility-retained";
|
|
56
|
+
readonly legacyShape: "{ type: \"tool-call\", toolCallId, toolName, args }";
|
|
57
|
+
readonly canonicalShape: "tool-prefixed message parts with \"args\" or \"input\"";
|
|
58
|
+
readonly removalGate: "Remove only in a planned breaking release after migration guidance and stored-message backfill coverage exist.";
|
|
59
|
+
};
|
|
53
60
|
export declare const getMessagePartSchema: () => import("../../internal-agents/schema.js").Schema<import("../../extensions/schema/schema-validator.js").InferShape<{
|
|
54
61
|
type: import("../../internal-agents/schema.js").Schema<string>;
|
|
55
62
|
toolCallId: import("../../internal-agents/schema.js").Schema<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.schema.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/schemas/agent.schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,kCAAkC,CAAC;AAErF,eAAO,MAAM,sBAAsB,qGAElC,CAAC;AAEF,eAAO,MAAM,oBAAoB,sIAWhC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;GAMjC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;GAO/B,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;GASzC,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;;;;GAS1C,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;GAKjC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;GAQnC,CAAC;
|
|
1
|
+
{"version":3,"file":"agent.schema.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/schemas/agent.schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,kCAAkC,CAAC;AAErF,eAAO,MAAM,sBAAsB,qGAElC,CAAC;AAEF,eAAO,MAAM,oBAAoB,sIAWhC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;GAMjC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;GAO/B,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;GASzC,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;;;;GAS1C,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;GAKjC,CAAC;AAEF,eAAO,M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AAM,MAAM,YAAY,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC;AACjF,4CAA4C;AAC5C,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC;AACrF,4CAA4C;AAC5C,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC;AAC/E,uCAAuC;AACvC,MAAM,MAAM,OAAO,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC;AACvE,gDAAgD;AAChD,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC;AACrF,yCAAyC;AACzC,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC;AACzE,kCAAkC;AAClC,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC;AACnF,yBAAyB;AACzB,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC"}
|
|
@@ -46,9 +46,15 @@ export const getToolResultPartSchema = defineSchema((v) => v.object({
|
|
|
46
46
|
result: v.unknown(),
|
|
47
47
|
providerExecuted: v.boolean().optional(),
|
|
48
48
|
}));
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
/** Compatibility policy for the legacy inline tool-call message part. */
|
|
50
|
+
export const AGENT_SCHEMA_LEGACY_TOOL_CALL_PART_POLICY = {
|
|
51
|
+
status: "compatibility-retained",
|
|
52
|
+
legacyShape: '{ type: "tool-call", toolCallId, toolName, args }',
|
|
53
|
+
canonicalShape: 'tool-prefixed message parts with "args" or "input"',
|
|
54
|
+
removalGate: "Remove only in a planned breaking release after migration guidance and stored-message backfill coverage exist.",
|
|
55
|
+
};
|
|
56
|
+
// Helper for the inline tool-call alternative within MessagePartSchema.
|
|
57
|
+
// Keep this branch in sync with AGENT_SCHEMA_LEGACY_TOOL_CALL_PART_POLICY.
|
|
52
58
|
const inlineToolCallPartShape = (v) => v.object({
|
|
53
59
|
type: v.literal("tool-call"),
|
|
54
60
|
toolCallId: v.string(),
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module agent/schemas
|
|
5
5
|
*/
|
|
6
|
-
export { type AgentContext, type AgentResponse, type AgentStatus, type EdgeConfig, getAgentContextSchema, getAgentResponseSchema, getAgentStatusSchema, getEdgeConfigSchema, getMemoryConfigSchema, getMessagePartSchema, getMessageSchema, getModelProviderSchema, getStreamToolCallSchema, getToolCallPartSchema, getToolCallPartWithArgsSchema, getToolCallPartWithInputSchema, getToolCallSchema, getToolResultPartSchema, type MemoryConfig, type Message, type MessagePart, type ModelProvider, type StreamToolCall, type ToolCall, type ToolCallPart, type ToolCallPartWithArgs, type ToolCallPartWithInput, type ToolResultPart, } from "./agent.schema.js";
|
|
6
|
+
export { AGENT_SCHEMA_LEGACY_TOOL_CALL_PART_POLICY, type AgentContext, type AgentResponse, type AgentStatus, type EdgeConfig, getAgentContextSchema, getAgentResponseSchema, getAgentStatusSchema, getEdgeConfigSchema, getMemoryConfigSchema, getMessagePartSchema, getMessageSchema, getModelProviderSchema, getStreamToolCallSchema, getToolCallPartSchema, getToolCallPartWithArgsSchema, getToolCallPartWithInputSchema, getToolCallSchema, getToolResultPartSchema, type MemoryConfig, type Message, type MessagePart, type ModelProvider, type StreamToolCall, type ToolCall, type ToolCallPart, type ToolCallPartWithArgs, type ToolCallPartWithInput, type ToolResultPart, } from "./agent.schema.js";
|
|
7
7
|
export { type AgentToolInput, getAgentToolInputSchema } from "./tool.schema.js";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/schemas/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,6BAA6B,EAC7B,8BAA8B,EAC9B,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,GACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,KAAK,cAAc,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/schemas/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,yCAAyC,EACzC,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,6BAA6B,EAC7B,8BAA8B,EAC9B,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,GACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,KAAK,cAAc,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module agent/schemas
|
|
5
5
|
*/
|
|
6
|
-
export { getAgentContextSchema, getAgentResponseSchema, getAgentStatusSchema, getEdgeConfigSchema, getMemoryConfigSchema, getMessagePartSchema, getMessageSchema, getModelProviderSchema, getStreamToolCallSchema, getToolCallPartSchema, getToolCallPartWithArgsSchema, getToolCallPartWithInputSchema, getToolCallSchema, getToolResultPartSchema, } from "./agent.schema.js";
|
|
6
|
+
export { AGENT_SCHEMA_LEGACY_TOOL_CALL_PART_POLICY, getAgentContextSchema, getAgentResponseSchema, getAgentStatusSchema, getEdgeConfigSchema, getMemoryConfigSchema, getMessagePartSchema, getMessageSchema, getModelProviderSchema, getStreamToolCallSchema, getToolCallPartSchema, getToolCallPartWithArgsSchema, getToolCallPartWithInputSchema, getToolCallSchema, getToolResultPartSchema, } from "./agent.schema.js";
|
|
7
7
|
export { getAgentToolInputSchema } from "./tool.schema.js";
|
|
@@ -21,6 +21,7 @@ export interface DependencyHashCache {
|
|
|
21
21
|
contentHashes: Map<string, string>;
|
|
22
22
|
completedModules: Set<string>;
|
|
23
23
|
inProgressModules: Map<string, Promise<void>>;
|
|
24
|
+
buildQueue: Promise<void>;
|
|
24
25
|
}
|
|
25
26
|
export declare function createDependencyHashCache(): DependencyHashCache;
|
|
26
27
|
export declare function extractImports(code: string): Promise<string[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency-graph.d.ts","sourceRoot":"","sources":["../../../src/src/cache/dependency-graph.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,qBAAa,eAAe;IAC1B,OAAO,CAAC,YAAY,CAAkC;IACtD,OAAO,CAAC,UAAU,CAAkC;IAEpD,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY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AAI,MAAM,EAAE;IAIzB,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,uBAAuB;IAsB/B,OAAO,CAAC,iBAAiB;CAgB1B;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,eAAe,CAAC;IACvB,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,wBAAgB,yBAAyB,IAAI,mBAAmB,CAQ/D;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAGpE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAWjE;AAED,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,CAsBR;AAMD,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,EAC7C,UAAU,EAAE,MAAM,EAClB,KAAK,GAAE,mBAAiD,GACvD,OAAO,CAAC,MAAM,CAAC,CAgBjB"}
|
|
@@ -85,6 +85,7 @@ export function createDependencyHashCache() {
|
|
|
85
85
|
contentHashes: new Map(),
|
|
86
86
|
completedModules: new Set(),
|
|
87
87
|
inProgressModules: new Map(),
|
|
88
|
+
buildQueue: Promise.resolve(),
|
|
88
89
|
};
|
|
89
90
|
}
|
|
90
91
|
export async function extractImports(code) {
|
|
@@ -129,7 +130,7 @@ function normalizeExtension(path) {
|
|
|
129
130
|
return path.replace(/\.(tsx?|jsx)$/, ".js");
|
|
130
131
|
}
|
|
131
132
|
export async function computeDepsHash(filePath, getContent, projectDir, cache = createDependencyHashCache()) {
|
|
132
|
-
await buildDependencyGraph(filePath, cache, getContent, projectDir);
|
|
133
|
+
await enqueueDependencyGraphBuild(cache, () => buildDependencyGraph(filePath, cache, getContent, projectDir));
|
|
133
134
|
const deps = [filePath, ...cache.graph.getTransitiveDependencies(filePath)].sort();
|
|
134
135
|
const combinedHash = deps
|
|
135
136
|
.map((dep) => cache.contentHashes.get(dep) ?? "")
|
|
@@ -137,6 +138,11 @@ export async function computeDepsHash(filePath, getContent, projectDir, cache =
|
|
|
137
138
|
.join(":");
|
|
138
139
|
return computeHash(combinedHash);
|
|
139
140
|
}
|
|
141
|
+
async function enqueueDependencyGraphBuild(cache, build) {
|
|
142
|
+
const queuedBuild = cache.buildQueue.then(build);
|
|
143
|
+
cache.buildQueue = queuedBuild.catch(() => { });
|
|
144
|
+
await queuedBuild;
|
|
145
|
+
}
|
|
140
146
|
async function buildDependencyGraph(filePath, cache, getContent, projectDir, visited = new Set()) {
|
|
141
147
|
if (cache.completedModules.has(filePath))
|
|
142
148
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-batch-handler.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/server/module-batch-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAiGtE,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,cAAc,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,CA6K/F;
|
|
1
|
+
{"version":3,"file":"module-batch-handler.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/server/module-batch-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAiGtE,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,cAAc,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,CA6K/F;AA2QD;;GAEG;AACH,wBAAgB,eAAe,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAc1D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAKrE"}
|
|
@@ -179,7 +179,7 @@ export function handleModuleBatch(req, options) {
|
|
|
179
179
|
headers: { "Content-Type": "text/plain" },
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
|
-
const
|
|
182
|
+
const bundleStream = createBatchBundleStream(successes, failures);
|
|
183
183
|
const duration = performance.now() - startTime;
|
|
184
184
|
const isSlow = duration > SLOW_REQUEST_THRESHOLD_MS;
|
|
185
185
|
const logMethod = isSlow ? logger.warn.bind(logger) : logger.info.bind(logger);
|
|
@@ -202,7 +202,7 @@ export function handleModuleBatch(req, options) {
|
|
|
202
202
|
})),
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
|
-
return new Response(
|
|
205
|
+
return new Response(bundleStream, {
|
|
206
206
|
status: HTTP_OK,
|
|
207
207
|
headers: {
|
|
208
208
|
"Content-Type": "application/javascript; charset=utf-8",
|
|
@@ -336,50 +336,62 @@ function createBatchSSRTargetCacheBusterResolver(options) {
|
|
|
336
336
|
return promise;
|
|
337
337
|
};
|
|
338
338
|
}
|
|
339
|
+
function createBatchBundleStream(successes, failures) {
|
|
340
|
+
const encoder = new TextEncoder();
|
|
341
|
+
return new ReadableStream({
|
|
342
|
+
start(controller) {
|
|
343
|
+
let isFirstChunk = true;
|
|
344
|
+
for (const chunk of generateBatchBundleChunks(successes, failures)) {
|
|
345
|
+
if (!isFirstChunk)
|
|
346
|
+
controller.enqueue(encoder.encode("\n"));
|
|
347
|
+
controller.enqueue(encoder.encode(chunk));
|
|
348
|
+
isFirstChunk = false;
|
|
349
|
+
}
|
|
350
|
+
controller.close();
|
|
351
|
+
},
|
|
352
|
+
});
|
|
353
|
+
}
|
|
339
354
|
/**
|
|
340
|
-
* Generate the batch bundle code
|
|
341
|
-
* Creates a module that exports all loaded modules by path
|
|
355
|
+
* Generate the batch bundle code chunks.
|
|
356
|
+
* Creates a module that exports all loaded modules by path.
|
|
342
357
|
*/
|
|
343
|
-
function
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
"",
|
|
351
|
-
];
|
|
358
|
+
function* generateBatchBundleChunks(successes, failures) {
|
|
359
|
+
yield "// Veryfront Module Batch Bundle";
|
|
360
|
+
yield "// Generated: " + new Date().toISOString();
|
|
361
|
+
yield `// Modules: ${successes.length} loaded, ${failures.length} failed`;
|
|
362
|
+
yield "";
|
|
363
|
+
yield "const __vf_batch_modules = new Map();";
|
|
364
|
+
yield "";
|
|
352
365
|
for (let i = 0; i < successes.length; i++) {
|
|
353
366
|
const item = successes[i];
|
|
354
367
|
if (!item)
|
|
355
368
|
continue;
|
|
356
369
|
const { path, code } = item;
|
|
357
370
|
const varName = `__mod_${i}`;
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
371
|
+
yield `// Module: ${path}`;
|
|
372
|
+
yield `const ${varName} = await (async () => {`;
|
|
373
|
+
yield " const exports = {};";
|
|
374
|
+
yield " const module = { exports };";
|
|
375
|
+
yield " // --- Module code start ---";
|
|
376
|
+
yield transformExportsForBundle(code);
|
|
377
|
+
yield " // --- Module code end ---";
|
|
378
|
+
yield " return exports;";
|
|
379
|
+
yield "})();";
|
|
380
|
+
yield `__vf_batch_modules.set("${path}", ${varName});`;
|
|
381
|
+
yield "";
|
|
369
382
|
}
|
|
370
383
|
for (const { path, error } of failures) {
|
|
371
|
-
|
|
372
|
-
|
|
384
|
+
yield `// Failed: ${path} - ${error}`;
|
|
385
|
+
yield `__vf_batch_modules.set("${path}", { __vf_error: "${error}" });`;
|
|
373
386
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
return parts.join("\n");
|
|
387
|
+
yield "";
|
|
388
|
+
yield "export const batchModules = __vf_batch_modules;";
|
|
389
|
+
yield "";
|
|
390
|
+
yield "export function getModule(path) {";
|
|
391
|
+
yield " return __vf_batch_modules.get(path);";
|
|
392
|
+
yield "}";
|
|
393
|
+
yield "";
|
|
394
|
+
yield "export default { batchModules, getModule };";
|
|
383
395
|
}
|
|
384
396
|
/**
|
|
385
397
|
* Transform module code for inclusion in batch bundle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-server.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/server/module-server.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAG5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"module-server.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/server/module-server.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAG5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAmCtE;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAwDrD,CAAC;AAiBF,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,OAAO,EAAE,cAAc,CAAC;IACxB,uBAAuB;IACvB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,sDAAsD;AACtD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAmWzF;AAwWD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAGrD"}
|
|
@@ -19,6 +19,7 @@ import { readLimitedCrossProjectSource } from "./cross-project-source-limit.js";
|
|
|
19
19
|
import { sha256Short } from "../../cache/hash.js";
|
|
20
20
|
import { buildSourceMissCacheKey, hasSourceMiss, rememberSourceMiss, } from "./module-source-resolution-cache.js";
|
|
21
21
|
const logger = serverLogger.component("module-server");
|
|
22
|
+
const PROJECT_FALLBACK_EMBEDDED_POLYFILLS = new Set(["deno"]);
|
|
22
23
|
/**
|
|
23
24
|
* Embedded polyfills for compiled Deno binaries.
|
|
24
25
|
*
|
|
@@ -83,6 +84,8 @@ export default {};
|
|
|
83
84
|
// Must be a JS module (not JSON) because esbuild strips `with { type: "json" }`
|
|
84
85
|
// at es2020 target, and browsers reject JSON MIME type without the assertion.
|
|
85
86
|
"_veryfront/_deno-config": `export default ${JSON.stringify({ version: VERSION })};\n`,
|
|
87
|
+
// dnt rewrites #deno-config to relative deno.js in npm framework modules.
|
|
88
|
+
"deno": `export default ${JSON.stringify({ version: VERSION })};\n`,
|
|
86
89
|
};
|
|
87
90
|
const DEV_MODULE_PREFIX = /^\/(?:_vf_modules|_veryfront\/modules)\//;
|
|
88
91
|
const SNIPPET_MODULE_PREFIX = /^\/_vf_modules\/_snippets\/([a-f0-9]+)\.js/;
|
|
@@ -275,7 +278,7 @@ export function serveModule(req, options) {
|
|
|
275
278
|
branch,
|
|
276
279
|
releaseId: options.releaseId,
|
|
277
280
|
reactVersion,
|
|
278
|
-
});
|
|
281
|
+
}, modulePath);
|
|
279
282
|
if (!findResult) {
|
|
280
283
|
logger.warn("Module not found", {
|
|
281
284
|
modulePath,
|
|
@@ -398,7 +401,7 @@ function createSSRTargetCacheBusterResolver(options) {
|
|
|
398
401
|
branch: options.branch,
|
|
399
402
|
releaseId: options.releaseId,
|
|
400
403
|
reactVersion: options.reactVersion,
|
|
401
|
-
});
|
|
404
|
+
}, targetPath);
|
|
402
405
|
if (!findResult)
|
|
403
406
|
return undefined;
|
|
404
407
|
const source = await readSourceFileForVersion(options.secureFs, findResult);
|
|
@@ -464,7 +467,7 @@ async function findFirstSecureFile(secureFs, paths) {
|
|
|
464
467
|
}));
|
|
465
468
|
return results.find((path) => path !== null) ?? null;
|
|
466
469
|
}
|
|
467
|
-
async function findSourceFile(secureFs, projectDir, basePath, context) {
|
|
470
|
+
async function findSourceFile(secureFs, projectDir, basePath, context, requestedModulePath = basePath) {
|
|
468
471
|
const { reactVersion } = context;
|
|
469
472
|
// Extensions including .src for compiled binary embedded sources
|
|
470
473
|
const extensions = [
|
|
@@ -483,7 +486,10 @@ async function findSourceFile(secureFs, projectDir, basePath, context) {
|
|
|
483
486
|
".md", // Regular sources
|
|
484
487
|
];
|
|
485
488
|
logger.debug("findSourceFile called", { projectDir, basePath });
|
|
486
|
-
const
|
|
489
|
+
const knownExtMatch = basePath.match(/\.(json|tsx|ts|jsx|js|mdx|md)(\.src)?$/);
|
|
490
|
+
const requestedExtMatch = requestedModulePath.match(/\.(json|tsx|ts|jsx|js|mdx|md)(\.src)?$/);
|
|
491
|
+
const hasKnownExt = knownExtMatch !== null;
|
|
492
|
+
const requestedExt = requestedExtMatch?.[1] ?? knownExtMatch?.[1] ?? null;
|
|
487
493
|
const rawBasePathWithoutExt = hasKnownExt
|
|
488
494
|
? basePath.replace(/\.(json|tsx|ts|jsx|js|mdx|md)(\.src)?$/, "")
|
|
489
495
|
: basePath;
|
|
@@ -511,7 +517,9 @@ async function findSourceFile(secureFs, projectDir, basePath, context) {
|
|
|
511
517
|
// Note: checked before isFrameworkPath guard because relative imports from
|
|
512
518
|
// deeply nested modules (e.g. ../../../../_dnt.shims.js) resolve outside
|
|
513
519
|
// the _veryfront/ prefix.
|
|
514
|
-
const embeddedContent =
|
|
520
|
+
const embeddedContent = PROJECT_FALLBACK_EMBEDDED_POLYFILLS.has(basePathWithoutExt)
|
|
521
|
+
? undefined
|
|
522
|
+
: EMBEDDED_POLYFILLS[basePathWithoutExt];
|
|
515
523
|
if (embeddedContent) {
|
|
516
524
|
logger.debug("Using embedded polyfill", {
|
|
517
525
|
basePath: basePathWithoutExt,
|
|
@@ -573,8 +581,11 @@ async function findSourceFile(secureFs, projectDir, basePath, context) {
|
|
|
573
581
|
/* expected: file may not exist at this path */
|
|
574
582
|
}
|
|
575
583
|
}
|
|
584
|
+
const projectLookupExtensions = requestedExt !== null && requestedExt !== "json"
|
|
585
|
+
? extensions.filter((ext) => ext !== ".json")
|
|
586
|
+
: extensions;
|
|
576
587
|
// Project file lookups (using secureFs which may go through FSAdapter in proxy mode)
|
|
577
|
-
const projectFilePath = await findFirstSecureFile(secureFs,
|
|
588
|
+
const projectFilePath = await findFirstSecureFile(secureFs, projectLookupExtensions.map((ext) => join(projectDir, basePathWithoutExt + ext)));
|
|
578
589
|
if (projectFilePath) {
|
|
579
590
|
logger.debug("Found file", { basePath, resolvedPath: projectFilePath });
|
|
580
591
|
return { path: projectFilePath, isFrameworkFile: false };
|
|
@@ -584,7 +595,7 @@ async function findSourceFile(secureFs, projectDir, basePath, context) {
|
|
|
584
595
|
if (!basePathWithoutExt.startsWith(prefix))
|
|
585
596
|
continue;
|
|
586
597
|
const strippedPath = basePathWithoutExt.slice(prefix.length);
|
|
587
|
-
const strippedFilePath = await findFirstSecureFile(secureFs,
|
|
598
|
+
const strippedFilePath = await findFirstSecureFile(secureFs, projectLookupExtensions.map((ext) => join(projectDir, strippedPath + ext)));
|
|
588
599
|
if (strippedFilePath) {
|
|
589
600
|
logger.debug("Found file after stripping prefix", {
|
|
590
601
|
originalPath: basePathWithoutExt,
|
|
@@ -594,7 +605,7 @@ async function findSourceFile(secureFs, projectDir, basePath, context) {
|
|
|
594
605
|
return { path: strippedFilePath, isFrameworkFile: false };
|
|
595
606
|
}
|
|
596
607
|
}
|
|
597
|
-
const indexFilePath = await findFirstSecureFile(secureFs,
|
|
608
|
+
const indexFilePath = await findFirstSecureFile(secureFs, projectLookupExtensions.map((ext) => join(projectDir, basePathWithoutExt, `index${ext}`)));
|
|
598
609
|
if (indexFilePath) {
|
|
599
610
|
logger.debug("Found index file", {
|
|
600
611
|
basePath: basePathWithoutExt,
|
|
@@ -605,7 +616,7 @@ async function findSourceFile(secureFs, projectDir, basePath, context) {
|
|
|
605
616
|
// Try looking in common project directories
|
|
606
617
|
const commonDirs = ["components", "app", "pages", "lib", "src"];
|
|
607
618
|
for (const dir of commonDirs) {
|
|
608
|
-
const commonDirFilePath = await findFirstSecureFile(secureFs,
|
|
619
|
+
const commonDirFilePath = await findFirstSecureFile(secureFs, projectLookupExtensions.map((ext) => join(projectDir, dir, basePathWithoutExt + ext)));
|
|
609
620
|
if (commonDirFilePath) {
|
|
610
621
|
logger.debug("Found file in common directory", {
|
|
611
622
|
basePath,
|
|
@@ -614,6 +625,17 @@ async function findSourceFile(secureFs, projectDir, basePath, context) {
|
|
|
614
625
|
return { path: commonDirFilePath, isFrameworkFile: false };
|
|
615
626
|
}
|
|
616
627
|
}
|
|
628
|
+
const projectFallbackEmbeddedContent = EMBEDDED_POLYFILLS[basePathWithoutExt];
|
|
629
|
+
if (projectFallbackEmbeddedContent) {
|
|
630
|
+
logger.debug("Using embedded polyfill after project lookup", {
|
|
631
|
+
basePath: basePathWithoutExt,
|
|
632
|
+
});
|
|
633
|
+
return {
|
|
634
|
+
path: `embedded:${basePath}`,
|
|
635
|
+
isFrameworkFile: true,
|
|
636
|
+
embeddedContent: projectFallbackEmbeddedContent,
|
|
637
|
+
};
|
|
638
|
+
}
|
|
617
639
|
rememberSourceMiss(missCacheKey);
|
|
618
640
|
return null;
|
|
619
641
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { WebSocketConnection } from "../../platform/adapters/base.js";
|
|
1
2
|
export declare class RateLimiter {
|
|
2
3
|
private readonly maxMessages;
|
|
3
4
|
private readonly messageCounts;
|
|
4
5
|
private readonly windowMs;
|
|
5
6
|
constructor(maxMessages: number);
|
|
6
|
-
check(socket:
|
|
7
|
-
cleanup(socket:
|
|
7
|
+
check(socket: WebSocketConnection): boolean;
|
|
8
|
+
cleanup(socket: WebSocketConnection): void;
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=rate-limiter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rate-limiter.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/server/rate-limiter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rate-limiter.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/server/rate-limiter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,qBAAa,WAAW;IAOV,OAAO,CAAC,QAAQ,CAAC,WAAW;IANxC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAG1B;IACJ,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA4B;gBAExB,WAAW,EAAE,MAAM;IAEhD,KAAK,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO;IAc3C,OAAO,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI;CAG3C"}
|
|
@@ -59,10 +59,30 @@ export interface RuntimeCapabilities {
|
|
|
59
59
|
export interface ServerAdapter {
|
|
60
60
|
upgradeWebSocket(request: Request): WebSocketUpgrade;
|
|
61
61
|
}
|
|
62
|
-
export interface
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
export interface WebSocketConnection {
|
|
63
|
+
readonly readyState: number;
|
|
64
|
+
send(data: string | ArrayBuffer): void;
|
|
65
|
+
close(code?: number, reason?: string): void;
|
|
66
|
+
addEventListener(type: string, listener: EventListener, options?: AddEventListenerOptions): void;
|
|
67
|
+
removeEventListener(type: string, listener: EventListener): void;
|
|
68
|
+
}
|
|
69
|
+
declare const WEBSOCKET_UPGRADE_RESPONSE_KIND = "websocket-upgrade";
|
|
70
|
+
export interface WebSocketUpgradeResponse {
|
|
71
|
+
readonly kind: typeof WEBSOCKET_UPGRADE_RESPONSE_KIND;
|
|
72
|
+
readonly status: 101;
|
|
73
|
+
readonly statusText: string;
|
|
74
|
+
readonly headers: Headers;
|
|
75
|
+
readonly body: null;
|
|
65
76
|
}
|
|
77
|
+
export interface WebSocketUpgrade {
|
|
78
|
+
socket: WebSocketConnection;
|
|
79
|
+
response: Response | WebSocketUpgradeResponse;
|
|
80
|
+
}
|
|
81
|
+
export declare function createWebSocketUpgradeResponse(input?: {
|
|
82
|
+
headers?: HeadersInit;
|
|
83
|
+
statusText?: string;
|
|
84
|
+
}): WebSocketUpgradeResponse;
|
|
85
|
+
export declare function isWebSocketUpgradeResponse(value: unknown): value is WebSocketUpgradeResponse;
|
|
66
86
|
export interface ServeOptions {
|
|
67
87
|
port?: number;
|
|
68
88
|
hostname?: string;
|
|
@@ -155,4 +175,5 @@ export interface KVStoreAdapter {
|
|
|
155
175
|
export interface FileWatcherAdapter {
|
|
156
176
|
watch(paths: string | string[], options?: WatchOptions): FileWatcher;
|
|
157
177
|
}
|
|
178
|
+
export {};
|
|
158
179
|
//# sourceMappingURL=base.d.ts.map
|