veryfront 0.1.811 → 0.1.813
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/conversation/durable-contracts.d.ts +204 -0
- package/esm/src/agent/conversation/durable-contracts.d.ts.map +1 -0
- package/esm/src/agent/conversation/durable-contracts.js +168 -0
- package/esm/src/agent/conversation/durable.d.ts +3 -198
- package/esm/src/agent/conversation/durable.d.ts.map +1 -1
- package/esm/src/agent/conversation/durable.js +2 -167
- package/esm/src/agent/runtime/agent-runtime-step.d.ts +44 -0
- package/esm/src/agent/runtime/agent-runtime-step.d.ts.map +1 -0
- package/esm/src/agent/runtime/agent-runtime-step.js +23 -0
- package/esm/src/agent/runtime/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/index.js +40 -39
- package/esm/src/agent/runtime/model-transport.d.ts +23 -0
- package/esm/src/agent/runtime/model-transport.d.ts.map +1 -0
- package/esm/src/agent/runtime/model-transport.js +26 -0
- package/esm/src/cache/keys/builders/render.d.ts.map +1 -1
- package/esm/src/cache/keys/builders/render.js +3 -2
- package/esm/src/cache/request-cacheability.d.ts +3 -0
- package/esm/src/cache/request-cacheability.d.ts.map +1 -0
- package/esm/src/cache/request-cacheability.js +26 -0
- package/esm/src/html/hydration-script-builder/hydration-data-generator.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/hydration-data-generator.js +1 -10
- package/esm/src/html/hydration-script-builder/templates/router.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/templates/router.js +41 -10
- package/esm/src/modules/import-map/loader.d.ts.map +1 -1
- package/esm/src/modules/import-map/loader.js +2 -1
- package/esm/src/modules/manifest/route-module-manifest.d.ts.map +1 -1
- package/esm/src/modules/manifest/route-module-manifest.js +2 -0
- package/esm/src/modules/server/module-server.d.ts.map +1 -1
- package/esm/src/modules/server/module-server.js +27 -9
- package/esm/src/observability/request-profiler.d.ts.map +1 -1
- package/esm/src/observability/request-profiler.js +1 -0
- package/esm/src/observability/simple-metrics/index.d.ts +6 -3
- package/esm/src/observability/simple-metrics/index.d.ts.map +1 -1
- package/esm/src/observability/simple-metrics/index.js +5 -2
- package/esm/src/observability/simple-metrics/metrics-recorder.d.ts +4 -0
- package/esm/src/observability/simple-metrics/metrics-recorder.d.ts.map +1 -1
- package/esm/src/observability/simple-metrics/metrics-recorder.js +34 -0
- package/esm/src/observability/simple-metrics/metrics-state.d.ts.map +1 -1
- package/esm/src/observability/simple-metrics/metrics-state.js +24 -0
- package/esm/src/observability/simple-metrics/otel-instruments.d.ts.map +1 -1
- package/esm/src/observability/simple-metrics/otel-instruments.js +13 -0
- package/esm/src/observability/simple-metrics/types.d.ts +12 -0
- package/esm/src/observability/simple-metrics/types.d.ts.map +1 -1
- package/esm/src/platform/adapters/runtime/shared/shared-watcher.d.ts.map +1 -1
- package/esm/src/platform/adapters/runtime/shared/shared-watcher.js +1 -1
- package/esm/src/platform/compat/http/native-response.d.ts +10 -1
- package/esm/src/platform/compat/http/native-response.d.ts.map +1 -1
- package/esm/src/platform/compat/http/native-response.js +20 -14
- package/esm/src/proxy/handler.d.ts +1 -7
- package/esm/src/proxy/handler.d.ts.map +1 -1
- package/esm/src/proxy/handler.js +63 -189
- package/esm/src/proxy/main.js +21 -20
- package/esm/src/proxy/proxy-access-control.d.ts +41 -0
- package/esm/src/proxy/proxy-access-control.d.ts.map +1 -0
- package/esm/src/proxy/proxy-access-control.js +151 -0
- package/esm/src/proxy/proxy-error-context.d.ts +20 -0
- package/esm/src/proxy/proxy-error-context.d.ts.map +1 -0
- package/esm/src/proxy/proxy-error-context.js +35 -0
- package/esm/src/proxy/request-lifecycle.d.ts +19 -0
- package/esm/src/proxy/request-lifecycle.d.ts.map +1 -0
- package/esm/src/proxy/request-lifecycle.js +27 -0
- package/esm/src/proxy/upstream-error-response.d.ts +5 -0
- package/esm/src/proxy/upstream-error-response.d.ts.map +1 -0
- package/esm/src/proxy/upstream-error-response.js +15 -0
- package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-composer.js +3 -1
- package/esm/src/release-assets/client-module-map.d.ts +3 -0
- package/esm/src/release-assets/client-module-map.d.ts.map +1 -0
- package/esm/src/release-assets/client-module-map.js +10 -0
- package/esm/src/rendering/cache/cache-coordinator.d.ts.map +1 -1
- package/esm/src/rendering/cache/cache-coordinator.js +1 -0
- package/esm/src/rendering/cache/stores/memory-store.d.ts +2 -0
- package/esm/src/rendering/cache/stores/memory-store.d.ts.map +1 -1
- package/esm/src/rendering/cache/stores/memory-store.js +2 -1
- package/esm/src/rendering/orchestrator/lifecycle.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/lifecycle.js +1 -0
- package/esm/src/rendering/orchestrator/module-loader/index.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/index.js +13 -49
- package/esm/src/rendering/orchestrator/module-loader/module-cache-lookup.d.ts +25 -0
- package/esm/src/rendering/orchestrator/module-loader/module-cache-lookup.d.ts.map +1 -0
- package/esm/src/rendering/orchestrator/module-loader/module-cache-lookup.js +69 -0
- package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/pipeline.js +22 -35
- package/esm/src/rendering/orchestrator/render-result-assembly.d.ts +27 -0
- package/esm/src/rendering/orchestrator/render-result-assembly.d.ts.map +1 -0
- package/esm/src/rendering/orchestrator/render-result-assembly.js +28 -0
- package/esm/src/rendering/orchestrator/types.d.ts +2 -0
- package/esm/src/rendering/orchestrator/types.d.ts.map +1 -1
- package/esm/src/rendering/renderer.d.ts.map +1 -1
- package/esm/src/rendering/renderer.js +24 -19
- package/esm/src/rendering/shared/context-aware-cache.d.ts.map +1 -1
- package/esm/src/rendering/shared/context-aware-cache.js +1 -0
- package/esm/src/server/handlers/dev/dashboard/api.d.ts +3 -0
- package/esm/src/server/handlers/dev/dashboard/api.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/dashboard/api.js +41 -57
- package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/framework-candidates.generated.js +11 -1
- package/esm/src/server/handlers/request/module/page-data-endpoint-handler.d.ts +1 -0
- package/esm/src/server/handlers/request/module/page-data-endpoint-handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/module/page-data-endpoint-handler.js +98 -8
- package/esm/src/transforms/esm/specifier-resolver.d.ts.map +1 -1
- package/esm/src/transforms/esm/specifier-resolver.js +14 -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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as dntShim from "../../../_dnt.shims.js";
|
|
2
|
-
import {
|
|
2
|
+
import { AppendConversationRunEventsResponseSchema, CompleteConversationRunResponseSchema, ConversationRunProjectionSchema, CreateConversationRunAcceptedSchema, getConversationRunErrorSchema, resolveConversationRunTargets, } from "./durable-contracts.js";
|
|
3
|
+
export { AppendConversationRunEventsResponseSchema, CompleteConversationRunResponseSchema, ConversationRunProjectionSchema, ConversationRunStatusSchema, ConversationRunTargetsSchema, CreateConversationRunAcceptedSchema, getAppendConversationRunEventsResponseSchema, getCompleteConversationRunResponseSchema, getConversationRunProjectionSchema, getConversationRunStatusSchema, getConversationRunTargetsSchema, getCreateConversationRunAcceptedSchema, resolveConversationRunTargets, } from "./durable-contracts.js";
|
|
3
4
|
const AGENT_RUN_API_TIMEOUT_MS = 15_000;
|
|
4
5
|
function createTimedAbortSignal(timeoutMs, abortSignal) {
|
|
5
6
|
const controller = new AbortController();
|
|
@@ -26,173 +27,7 @@ function createTimedAbortSignal(timeoutMs, abortSignal) {
|
|
|
26
27
|
},
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
|
-
/** Zod schema for get conversation run targets. */
|
|
30
|
-
export const getConversationRunTargetsSchema = defineSchema((v) => v.object({
|
|
31
|
-
sourceTargetKind: v.enum(["project", "preview_branch"]).nullable(),
|
|
32
|
-
runtimeTargetKind: v.enum(["main_branch", "preview_branch"]).nullable(),
|
|
33
|
-
targetBranchId: v.string().uuid().nullable(),
|
|
34
|
-
}));
|
|
35
|
-
/** Schema for conversation run targets.
|
|
36
|
-
* @deprecated Use getConversationRunTargetsSchema()
|
|
37
|
-
*/
|
|
38
|
-
export const ConversationRunTargetsSchema = lazySchema(getConversationRunTargetsSchema);
|
|
39
|
-
/** Resolves conversation run targets. */
|
|
40
|
-
export function resolveConversationRunTargets(input) {
|
|
41
|
-
return getConversationRunTargetsSchema().parse(!input.projectId
|
|
42
|
-
? {
|
|
43
|
-
sourceTargetKind: null,
|
|
44
|
-
runtimeTargetKind: null,
|
|
45
|
-
targetBranchId: null,
|
|
46
|
-
}
|
|
47
|
-
: input.branchId
|
|
48
|
-
? {
|
|
49
|
-
sourceTargetKind: "preview_branch",
|
|
50
|
-
runtimeTargetKind: "preview_branch",
|
|
51
|
-
targetBranchId: input.branchId,
|
|
52
|
-
}
|
|
53
|
-
: {
|
|
54
|
-
sourceTargetKind: "project",
|
|
55
|
-
runtimeTargetKind: "main_branch",
|
|
56
|
-
targetBranchId: null,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
/** Zod schema for get conversation run status. */
|
|
60
|
-
export const getConversationRunStatusSchema = defineSchema((v) => v.enum(["pending", "running", "waiting_for_tool", "completed", "failed", "cancelled"]));
|
|
61
|
-
/** Schema for conversation run status.
|
|
62
|
-
* @deprecated Use getConversationRunStatusSchema()
|
|
63
|
-
*/
|
|
64
|
-
export const ConversationRunStatusSchema = lazySchema(getConversationRunStatusSchema);
|
|
65
|
-
/** Zod schema for get conversation run projection. */
|
|
66
|
-
export const getConversationRunProjectionSchema = defineSchema((v) => v.object({
|
|
67
|
-
runId: v.string().min(1).optional(),
|
|
68
|
-
run_id: v.string().min(1).optional(),
|
|
69
|
-
conversationId: v.string().uuid().optional(),
|
|
70
|
-
conversation_id: v.string().uuid().optional(),
|
|
71
|
-
messageId: v.string().uuid().optional(),
|
|
72
|
-
message_id: v.string().uuid().optional(),
|
|
73
|
-
latestEventId: v.number().int().nonnegative().optional(),
|
|
74
|
-
latest_event_id: v.number().int().nonnegative().optional(),
|
|
75
|
-
latestExternalEventSequence: v.number().int().nonnegative().optional(),
|
|
76
|
-
latest_external_event_sequence: v.number().int().nonnegative().optional(),
|
|
77
|
-
waitingToolCallId: v.string().min(1).nullable().optional(),
|
|
78
|
-
waiting_tool_call_id: v.string().min(1).nullable().optional(),
|
|
79
|
-
waitingToolName: v.string().nullable().optional(),
|
|
80
|
-
waiting_tool_name: v.string().nullable().optional(),
|
|
81
|
-
status: getConversationRunStatusSchema(),
|
|
82
|
-
})
|
|
83
|
-
.passthrough()
|
|
84
|
-
.transform((data) => {
|
|
85
|
-
const d = data;
|
|
86
|
-
const runId = (d.runId ?? d.run_id);
|
|
87
|
-
const conversationId = (d.conversationId ?? d.conversation_id);
|
|
88
|
-
const messageId = (d.messageId ?? d.message_id);
|
|
89
|
-
const latestEventId = (d.latestEventId ?? d.latest_event_id) ?? 0;
|
|
90
|
-
const latestExternalEventSequence = (d.latestExternalEventSequence ??
|
|
91
|
-
d.latest_external_event_sequence);
|
|
92
|
-
if (!runId || !conversationId || !messageId) {
|
|
93
|
-
throw new Error("Missing run identifiers in durable run response");
|
|
94
|
-
}
|
|
95
|
-
if (latestExternalEventSequence === undefined) {
|
|
96
|
-
throw new Error("Missing latestExternalEventSequence in durable run response");
|
|
97
|
-
}
|
|
98
|
-
return {
|
|
99
|
-
runId,
|
|
100
|
-
conversationId,
|
|
101
|
-
messageId,
|
|
102
|
-
latestEventId,
|
|
103
|
-
latestExternalEventSequence,
|
|
104
|
-
waitingToolCallId: (d.waitingToolCallId ?? d.waiting_tool_call_id) ??
|
|
105
|
-
null,
|
|
106
|
-
waitingToolName: (d.waitingToolName ?? d.waiting_tool_name) ?? null,
|
|
107
|
-
status: d.status,
|
|
108
|
-
};
|
|
109
|
-
}));
|
|
110
|
-
/** Schema for conversation run projection.
|
|
111
|
-
* @deprecated Use getConversationRunProjectionSchema()
|
|
112
|
-
*/
|
|
113
|
-
export const ConversationRunProjectionSchema = lazySchema(getConversationRunProjectionSchema);
|
|
114
|
-
/** Zod schema for get create conversation run accepted. */
|
|
115
|
-
export const getCreateConversationRunAcceptedSchema = defineSchema((v) => v.object({
|
|
116
|
-
run: v.object({
|
|
117
|
-
runId: v.string().min(1).optional(),
|
|
118
|
-
run_id: v.string().min(1).optional(),
|
|
119
|
-
}).passthrough(),
|
|
120
|
-
})
|
|
121
|
-
.passthrough()
|
|
122
|
-
.transform((data) => {
|
|
123
|
-
const d = data;
|
|
124
|
-
const runId = (d.run.runId ?? d.run.run_id);
|
|
125
|
-
if (!runId) {
|
|
126
|
-
throw new Error("Missing run id in canonical create run response");
|
|
127
|
-
}
|
|
128
|
-
return { runId };
|
|
129
|
-
}));
|
|
130
|
-
/** Schema for create conversation run accepted.
|
|
131
|
-
* @deprecated Use getCreateConversationRunAcceptedSchema()
|
|
132
|
-
*/
|
|
133
|
-
export const CreateConversationRunAcceptedSchema = lazySchema(getCreateConversationRunAcceptedSchema);
|
|
134
|
-
/** Zod schema for get complete conversation run response. */
|
|
135
|
-
export const getCompleteConversationRunResponseSchema = defineSchema((v) => v.object({
|
|
136
|
-
completed: v.boolean(),
|
|
137
|
-
run: v.object({
|
|
138
|
-
runId: v.string().min(1).optional(),
|
|
139
|
-
run_id: v.string().min(1).optional(),
|
|
140
|
-
status: v.enum(["pending", "running", "waiting", "completed", "failed", "cancelled"]),
|
|
141
|
-
}).passthrough(),
|
|
142
|
-
}).passthrough());
|
|
143
|
-
/** Schema for complete conversation run response.
|
|
144
|
-
* @deprecated Use getCompleteConversationRunResponseSchema()
|
|
145
|
-
*/
|
|
146
|
-
export const CompleteConversationRunResponseSchema = lazySchema(getCompleteConversationRunResponseSchema);
|
|
147
|
-
/** Zod schema for get append conversation run events response. */
|
|
148
|
-
export const getAppendConversationRunEventsResponseSchema = defineSchema((v) => v.union([
|
|
149
|
-
v.object({
|
|
150
|
-
latestEventId: v.number().int().nonnegative(),
|
|
151
|
-
latestExternalEventSequence: v.number().int().nonnegative(),
|
|
152
|
-
appendedCount: v.number().int().nonnegative(),
|
|
153
|
-
run: v.object({
|
|
154
|
-
runId: v.string().min(1),
|
|
155
|
-
conversationId: v.string().uuid(),
|
|
156
|
-
latestEventId: v.number().int().nonnegative(),
|
|
157
|
-
latestExternalEventSequence: v.number().int().nonnegative(),
|
|
158
|
-
}).passthrough(),
|
|
159
|
-
}),
|
|
160
|
-
v.object({
|
|
161
|
-
latest_event_id: v.number().int().nonnegative(),
|
|
162
|
-
latest_external_event_sequence: v.number().int().nonnegative(),
|
|
163
|
-
appended_count: v.number().int().nonnegative(),
|
|
164
|
-
run: v.object({
|
|
165
|
-
run_id: v.string().min(1),
|
|
166
|
-
conversation_id: v.string().uuid(),
|
|
167
|
-
latest_event_id: v.number().int().nonnegative(),
|
|
168
|
-
latest_external_event_sequence: v.number().int().nonnegative(),
|
|
169
|
-
}).passthrough(),
|
|
170
|
-
}).transform((data) => {
|
|
171
|
-
const d = data;
|
|
172
|
-
const run = d.run;
|
|
173
|
-
return {
|
|
174
|
-
latestEventId: d.latest_event_id,
|
|
175
|
-
latestExternalEventSequence: d.latest_external_event_sequence,
|
|
176
|
-
appendedCount: d.appended_count,
|
|
177
|
-
run: {
|
|
178
|
-
...run,
|
|
179
|
-
runId: run.run_id,
|
|
180
|
-
conversationId: run.conversation_id,
|
|
181
|
-
latestEventId: run.latest_event_id,
|
|
182
|
-
latestExternalEventSequence: run.latest_external_event_sequence,
|
|
183
|
-
},
|
|
184
|
-
};
|
|
185
|
-
}),
|
|
186
|
-
]));
|
|
187
|
-
/** Schema for append conversation run events response.
|
|
188
|
-
* @deprecated Use getAppendConversationRunEventsResponseSchema()
|
|
189
|
-
*/
|
|
190
|
-
export const AppendConversationRunEventsResponseSchema = lazySchema(getAppendConversationRunEventsResponseSchema);
|
|
191
30
|
const DEFAULT_MAX_CONVERSATION_RUN_BATCH_BYTES = 512 * 1024;
|
|
192
|
-
const getConversationRunErrorSchema = defineSchema((v) => v.object({
|
|
193
|
-
detail: v.string().min(1).optional(),
|
|
194
|
-
error: v.string().min(1).optional(),
|
|
195
|
-
}));
|
|
196
31
|
/** Error shape for conversation run terminal state. */
|
|
197
32
|
export class ConversationRunTerminalStateError extends Error {
|
|
198
33
|
status;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { RemoteToolSource, ToolDefinition, ToolExecutionContext } from "../../tool/index.js";
|
|
2
|
+
import type { AgentConfig, Message } from "../types.js";
|
|
3
|
+
import type { ToolConfigEntry } from "./tool-helpers.js";
|
|
4
|
+
export type AgentRuntimeStepMode = "generate" | "stream";
|
|
5
|
+
export type RuntimeStepToolLoader = (toolsConfig: true | Record<string, ToolConfigEntry> | undefined, options?: {
|
|
6
|
+
includeSkillTools?: boolean;
|
|
7
|
+
includeIntegrationTools?: boolean;
|
|
8
|
+
allowedRemoteToolNames?: string[];
|
|
9
|
+
forwardedRemoteToolDefinitions?: ToolDefinition[];
|
|
10
|
+
remoteToolSources?: RemoteToolSource[];
|
|
11
|
+
remoteToolContext?: ToolExecutionContext;
|
|
12
|
+
callerAgentId?: string;
|
|
13
|
+
}) => Promise<ToolDefinition[]>;
|
|
14
|
+
export interface AgentRuntimeStepState {
|
|
15
|
+
systemPrompt: string;
|
|
16
|
+
context?: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
export type RuntimeStepStateResolver = (messages: Message[], runtimeContext: Record<string, unknown> | undefined, mode: AgentRuntimeStepMode, step: number, systemPrompt: string) => Promise<AgentRuntimeStepState>;
|
|
19
|
+
export interface PrepareAgentRuntimeStepInput {
|
|
20
|
+
agentId: string;
|
|
21
|
+
activeSkillPolicy: string[] | undefined;
|
|
22
|
+
allowedRemoteToolNames: string[] | undefined;
|
|
23
|
+
config: AgentConfig;
|
|
24
|
+
forwardedRemoteToolDefinitions: ToolDefinition[] | undefined;
|
|
25
|
+
getAvailableTools: RuntimeStepToolLoader;
|
|
26
|
+
isLocalModel: boolean;
|
|
27
|
+
messages: Message[];
|
|
28
|
+
mode: AgentRuntimeStepMode;
|
|
29
|
+
remoteToolSources: RemoteToolSource[] | undefined;
|
|
30
|
+
resolveRuntimeState: RuntimeStepStateResolver;
|
|
31
|
+
runtimeContext: Record<string, unknown> | undefined;
|
|
32
|
+
step: number;
|
|
33
|
+
systemPrompt: string;
|
|
34
|
+
toolContextBase: ToolExecutionContext | undefined;
|
|
35
|
+
}
|
|
36
|
+
export interface PreparedAgentRuntimeStep {
|
|
37
|
+
runtimeContext: Record<string, unknown> | undefined;
|
|
38
|
+
systemPrompt: string;
|
|
39
|
+
toolContext: ToolExecutionContext;
|
|
40
|
+
tools: ToolDefinition[];
|
|
41
|
+
}
|
|
42
|
+
/** Resolve per-step runtime state and the tools visible for that step. */
|
|
43
|
+
export declare function prepareAgentRuntimeStep(input: PrepareAgentRuntimeStepInput): Promise<PreparedAgentRuntimeStep>;
|
|
44
|
+
//# sourceMappingURL=agent-runtime-step.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-runtime-step.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/agent-runtime-step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAClG,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG,CAClC,WAAW,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAAS,EAC/D,OAAO,CAAC,EAAE;IACR,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,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AC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,oBAAoB,GAAG,SAAS,CAAC;CACnD;AAED,MAAM,WAAW,wBAAwB;IACvC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,oBAAoB,CAAC;IAClC,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAED,0EAA0E;AAC1E,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,4BAA4B,GAClC,OAAO,CAAC,wBAAwB,CAAC,CA6BnC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { filterToolsForSkill } from "../../skill/allowed-tools.js";
|
|
2
|
+
/** Resolve per-step runtime state and the tools visible for that step. */
|
|
3
|
+
export async function prepareAgentRuntimeStep(input) {
|
|
4
|
+
const runtimeState = await input.resolveRuntimeState(input.messages, input.runtimeContext, input.mode, input.step, input.systemPrompt);
|
|
5
|
+
const toolContext = { ...input.toolContextBase, ...runtimeState.context };
|
|
6
|
+
let tools = input.isLocalModel ? [] : await input.getAvailableTools(input.config.tools, {
|
|
7
|
+
callerAgentId: input.agentId,
|
|
8
|
+
includeSkillTools: Boolean(input.config.skills),
|
|
9
|
+
allowedRemoteToolNames: input.allowedRemoteToolNames,
|
|
10
|
+
forwardedRemoteToolDefinitions: input.forwardedRemoteToolDefinitions,
|
|
11
|
+
remoteToolSources: input.remoteToolSources,
|
|
12
|
+
remoteToolContext: toolContext,
|
|
13
|
+
});
|
|
14
|
+
if (input.activeSkillPolicy) {
|
|
15
|
+
tools = filterToolsForSkill(tools, input.activeSkillPolicy);
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
runtimeContext: runtimeState.context,
|
|
19
|
+
systemPrompt: runtimeState.systemPrompt,
|
|
20
|
+
toolContext,
|
|
21
|
+
tools,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -1 +1 @@
|
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E,MAAM,KAAK,IAAI,CAAC;QAClC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;KAC9C,EACD,aAAa,CAAC,EAAE,MAAM,EACtB,uBAAuB,CAAC,EAAE,MAAM,EAChC,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAwJtC;;OAEG;YACW,gBAAgB;IA+S9B;;;;OAIG;YACW,yBAAyB;IA6avC;;OAEG;YACW,eAAe;IAgC7B;;OAEG;YACW,mBAAmB;IAOjC;;OAEG;IACH,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,sBAAsB;IAoB9B;;OAEG;IACH,SAAS,IAAI,MAAM,CAAC,OAAO,CAAC;IAI5B;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC;QAC9B,aAAa,EAAE,MAAM,CAAC;QACtB,eAAe,EAAE,MAAM,CAAC;QACxB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IAIF;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAGnC"}
|
|
@@ -19,7 +19,6 @@ import { serverLogger } from "../../utils/index.js";
|
|
|
19
19
|
import { addSpanEvent, setSpanAttributes, withSpan, } from "../../observability/tracing/index.js";
|
|
20
20
|
import { convertToTextGenerationRuntimeMessages } from "./text-generation-runtime-message-converter.js";
|
|
21
21
|
import { convertToolsToRuntimeTools } from "./model-tool-converter.js";
|
|
22
|
-
import { resolveProviderOptionsWithDefaults } from "./default-provider-options.js";
|
|
23
22
|
import { getRuntimeRemoteToolSources } from "./mcp-server-tool-sources.js";
|
|
24
23
|
import { createStreamState, processStream, } from "./chat-stream-handler.js";
|
|
25
24
|
import { repairToolCall } from "./repair-tool-call.js";
|
|
@@ -30,6 +29,7 @@ import { generateText, streamText } from "../../runtime/runtime-bridge.js";
|
|
|
30
29
|
import { captureStreamedToolCallInput, collectFinalStreamToolResults, collectGeneratedToolResults, createToolErrorMessage, createToolResultMessage, getProviderExecutedToolNames, getToolResultError, isRecoverablePlaceholderToolCall, isStreamedToolCallIncomplete, materializeStreamedToolCall, shouldContinueAfterStreamStep, } from "./tool-result-continuation.js";
|
|
31
30
|
import { enforceSkillPolicy, extractSkillId, extractSkillPolicy, hasSubmittedFormInputResult, hydrateActiveSkillStateFromMessages, LOAD_SKILL_TOOL_ID, removeFormInputAfterSubmission, } from "./skill-policy-enforcement.js";
|
|
32
31
|
import { getRuntimeAllowedRemoteTools, getRuntimeForwardedIntegrationToolDefs, getRuntimeProviderTools, } from "./runtime-tool-config.js";
|
|
32
|
+
import { prepareAgentRuntimeStep } from "./agent-runtime-step.js";
|
|
33
33
|
// Re-export from submodules
|
|
34
34
|
export { closeSSEStream, generateMessageId, sendSSE } from "./sse-utils.js";
|
|
35
35
|
export { RunAlreadyExistsError, RunCancelledError, RunNotActiveError, RunResumeSessionManager, WaitConflictError, WaitNotPendingError, } from "./resume-session.js";
|
|
@@ -44,11 +44,11 @@ import { DEFAULT_MAX_TOKENS, DEFAULT_TEMPERATURE, getModelMaxOutputTokens } from
|
|
|
44
44
|
import { closeSSEStream, generateMessageId, sendSSE } from "./sse-utils.js";
|
|
45
45
|
import { executeConfiguredTool, getAvailableTools, isDynamicTool } from "./tool-helpers.js";
|
|
46
46
|
import { accumulateUsage, getMaxSteps, normalizeInput } from "./input-utils.js";
|
|
47
|
-
import {
|
|
48
|
-
import { resolveConfiguredAgentModel, resolveRuntimeModel } from "./model-resolution.js";
|
|
47
|
+
import { resolveRuntimeModel } from "./model-resolution.js";
|
|
49
48
|
import { stringifyToolError, throwIfAborted } from "./error-utils.js";
|
|
50
49
|
import { supportsTemperatureParameter } from "./model-capabilities.js";
|
|
51
50
|
import { applySkillDelegationOverridesToToolInput, extractSkillDelegationOverrides, } from "./skill-delegation-overrides.js";
|
|
51
|
+
import { resolveAgentModelTransport } from "./model-transport.js";
|
|
52
52
|
const logger = serverLogger.component("agent");
|
|
53
53
|
function isAbortError(error, abortSignal) {
|
|
54
54
|
if (abortSignal?.aborted && error === abortSignal.reason) {
|
|
@@ -92,22 +92,13 @@ export class AgentRuntime {
|
|
|
92
92
|
return persisted.length > 0 ? persisted : inputMessages;
|
|
93
93
|
}
|
|
94
94
|
async resolveModelTransport(context, modelOverride, mode) {
|
|
95
|
-
|
|
96
|
-
const resolvedModelString = resolveRuntimeModel(modelOverride || this.config.model);
|
|
97
|
-
const transport = await this.config.resolveModelTransport?.({
|
|
95
|
+
return await resolveAgentModelTransport({
|
|
98
96
|
agentId: this.id,
|
|
99
|
-
|
|
100
|
-
resolvedModel: resolvedModelString,
|
|
97
|
+
config: this.config,
|
|
101
98
|
context,
|
|
99
|
+
modelOverride,
|
|
102
100
|
mode,
|
|
103
101
|
});
|
|
104
|
-
return {
|
|
105
|
-
requestedModel,
|
|
106
|
-
resolvedModelString,
|
|
107
|
-
languageModel: transport?.model ?? resolveModel(resolvedModelString),
|
|
108
|
-
headers: transport?.headers,
|
|
109
|
-
providerOptions: resolveProviderOptionsWithDefaults(resolvedModelString, transport?.providerOptions),
|
|
110
|
-
};
|
|
111
102
|
}
|
|
112
103
|
async resolveRuntimeState(messages, context, mode, step, systemPrompt) {
|
|
113
104
|
const refreshed = await this.config.resolveRuntimeState?.({
|
|
@@ -317,22 +308,27 @@ export class AgentRuntime {
|
|
|
317
308
|
for (let step = 0; step < maxSteps; step++) {
|
|
318
309
|
this.status = "thinking";
|
|
319
310
|
addSpanEvent(loopSpan, "step_start", { step });
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
const toolContext = { ...toolContextBase, ...currentRuntimeContext };
|
|
324
|
-
let tools = isLocal ? [] : await getAvailableTools(this.config.tools, {
|
|
325
|
-
callerAgentId: this.id,
|
|
326
|
-
includeSkillTools: Boolean(this.config.skills),
|
|
311
|
+
const preparedStep = await prepareAgentRuntimeStep({
|
|
312
|
+
agentId: this.id,
|
|
313
|
+
activeSkillPolicy,
|
|
327
314
|
allowedRemoteToolNames,
|
|
315
|
+
config: this.config,
|
|
328
316
|
forwardedRemoteToolDefinitions,
|
|
317
|
+
getAvailableTools,
|
|
318
|
+
isLocalModel: isLocal,
|
|
319
|
+
messages: currentMessages,
|
|
320
|
+
mode: "generate",
|
|
329
321
|
remoteToolSources,
|
|
330
|
-
|
|
322
|
+
resolveRuntimeState: this.resolveRuntimeState.bind(this),
|
|
323
|
+
runtimeContext: currentRuntimeContext,
|
|
324
|
+
step,
|
|
325
|
+
systemPrompt: currentSystemPrompt,
|
|
326
|
+
toolContextBase,
|
|
331
327
|
});
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
328
|
+
currentSystemPrompt = preparedStep.systemPrompt;
|
|
329
|
+
currentRuntimeContext = preparedStep.runtimeContext;
|
|
330
|
+
const toolContext = preparedStep.toolContext;
|
|
331
|
+
const tools = preparedStep.tools;
|
|
336
332
|
const temperature = this.resolveTemperature(temperatureModelString ?? effectiveModel);
|
|
337
333
|
const response = await withSpan("agent.generate_text", async (span) => {
|
|
338
334
|
setSpanAttributes(span, {
|
|
@@ -549,22 +545,27 @@ export class AgentRuntime {
|
|
|
549
545
|
throwIfAborted(abortSignal);
|
|
550
546
|
sendSSE(controller, encoder, { type: "step-start" });
|
|
551
547
|
const currentStepToolResults = new Map();
|
|
552
|
-
const
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
const toolContext = { ...toolContextBase, ...currentRuntimeContext };
|
|
556
|
-
let tools = isLocalStreaming ? [] : await getAvailableTools(this.config.tools, {
|
|
557
|
-
callerAgentId: this.id,
|
|
558
|
-
includeSkillTools: Boolean(this.config.skills),
|
|
548
|
+
const preparedStep = await prepareAgentRuntimeStep({
|
|
549
|
+
agentId: this.id,
|
|
550
|
+
activeSkillPolicy,
|
|
559
551
|
allowedRemoteToolNames,
|
|
552
|
+
config: this.config,
|
|
560
553
|
forwardedRemoteToolDefinitions,
|
|
554
|
+
getAvailableTools,
|
|
555
|
+
isLocalModel: isLocalStreaming,
|
|
556
|
+
messages: currentMessages,
|
|
557
|
+
mode: "stream",
|
|
561
558
|
remoteToolSources,
|
|
562
|
-
|
|
559
|
+
resolveRuntimeState: this.resolveRuntimeState.bind(this),
|
|
560
|
+
runtimeContext: currentRuntimeContext,
|
|
561
|
+
step,
|
|
562
|
+
systemPrompt: currentSystemPrompt,
|
|
563
|
+
toolContextBase,
|
|
563
564
|
});
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
565
|
+
currentSystemPrompt = preparedStep.systemPrompt;
|
|
566
|
+
currentRuntimeContext = preparedStep.runtimeContext;
|
|
567
|
+
const toolContext = preparedStep.toolContext;
|
|
568
|
+
const tools = preparedStep.tools;
|
|
568
569
|
const runtimeTools = convertToolsToRuntimeTools(tools, {
|
|
569
570
|
model: effectiveModel,
|
|
570
571
|
providerTools,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model transport resolution for the agent runtime.
|
|
3
|
+
*
|
|
4
|
+
* @module agent/runtime/model-transport
|
|
5
|
+
*/
|
|
6
|
+
import { type AgentConfig } from "../types.js";
|
|
7
|
+
import { type ModelRuntime } from "../../provider/index.js";
|
|
8
|
+
export type ResolvedModelTransport = {
|
|
9
|
+
requestedModel: string;
|
|
10
|
+
resolvedModelString: string;
|
|
11
|
+
languageModel: ModelRuntime;
|
|
12
|
+
headers?: HeadersInit;
|
|
13
|
+
providerOptions?: Record<string, unknown>;
|
|
14
|
+
};
|
|
15
|
+
export interface ResolveAgentModelTransportInput {
|
|
16
|
+
agentId: string;
|
|
17
|
+
config: AgentConfig;
|
|
18
|
+
context: Record<string, unknown> | undefined;
|
|
19
|
+
modelOverride: string | undefined;
|
|
20
|
+
mode: "generate" | "stream";
|
|
21
|
+
}
|
|
22
|
+
export declare function resolveAgentModelTransport(input: ResolveAgentModelTransportInput): Promise<ResolvedModelTransport>;
|
|
23
|
+
//# sourceMappingURL=model-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-transport.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/model-transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,yBAAyB,CAAC;AAI1E,MAAM,MAAM,sBAAsB,GAAG;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,aAAa,EAAE,YAAY,CAAC;IAC5B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C,CAAC;AAEF,MAAM,WAAW,+BAA+B;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC7C,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC;CAC7B;AAED,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,+BAA+B,GACrC,OAAO,CAAC,sBAAsB,CAAC,CAqBjC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model transport resolution for the agent runtime.
|
|
3
|
+
*
|
|
4
|
+
* @module agent/runtime/model-transport
|
|
5
|
+
*/
|
|
6
|
+
import { resolveModel } from "../../provider/index.js";
|
|
7
|
+
import { resolveProviderOptionsWithDefaults } from "./default-provider-options.js";
|
|
8
|
+
import { resolveConfiguredAgentModel, resolveRuntimeModel } from "./model-resolution.js";
|
|
9
|
+
export async function resolveAgentModelTransport(input) {
|
|
10
|
+
const requestedModel = resolveConfiguredAgentModel(input.modelOverride || input.config.model);
|
|
11
|
+
const resolvedModelString = resolveRuntimeModel(input.modelOverride || input.config.model);
|
|
12
|
+
const transport = await input.config.resolveModelTransport?.({
|
|
13
|
+
agentId: input.agentId,
|
|
14
|
+
requestedModel,
|
|
15
|
+
resolvedModel: resolvedModelString,
|
|
16
|
+
context: input.context,
|
|
17
|
+
mode: input.mode,
|
|
18
|
+
});
|
|
19
|
+
return {
|
|
20
|
+
requestedModel,
|
|
21
|
+
resolvedModelString,
|
|
22
|
+
languageModel: transport?.model ?? resolveModel(resolvedModelString),
|
|
23
|
+
headers: transport?.headers,
|
|
24
|
+
providerOptions: resolveProviderOptionsWithDefaults(resolvedModelString, transport?.providerOptions),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../../../src/src/cache/keys/builders/render.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAI7D,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,SAAS,GAAG,YAAY,EACrC,UAAU,EAAE,MAAM;AAClB;;;;;GAKG;AACH,eAAe,CAAC,EAAE,MAAM,GACvB,MAAM,CAGR;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,SAAS,GAAG,YAAY,EACrC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACnC,MAAM,CAaR;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAEnF;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,MAAM,CAER;AAED,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,MAAM,GACtB,MAAM,CAER;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,MAAM,CAER;AAED,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,OAAO,EACvB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,MAAM,EAAE,MAAM,GAAG,IAAI,GACpB,MAAM,CAaR;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,GAAG,EACT,OAAO,CAAC,EAAE,sBAAsB,GAC/B,MAAM,
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../../../src/src/cache/keys/builders/render.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAI7D,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,SAAS,GAAG,YAAY,EACrC,UAAU,EAAE,MAAM;AAClB;;;;;GAKG;AACH,eAAe,CAAC,EAAE,MAAM,GACvB,MAAM,CAGR;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,SAAS,GAAG,YAAY,EACrC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACnC,MAAM,CAaR;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAEnF;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,MAAM,CAER;AAED,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,MAAM,GACtB,MAAM,CAER;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,MAAM,CAER;AAED,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,OAAO,EACvB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,MAAM,EAAE,MAAM,GAAG,IAAI,GACpB,MAAM,CAaR;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,GAAG,EACT,OAAO,CAAC,EAAE,sBAAsB,GAC/B,MAAM,CAMR"}
|
|
@@ -82,8 +82,9 @@ export function buildProxyManagerCacheKey(projectSlug, productionMode, releaseId
|
|
|
82
82
|
* @returns Cache key string
|
|
83
83
|
*/
|
|
84
84
|
export function buildQueryAwareCacheKey(slug, url, options) {
|
|
85
|
+
const normalizedSlug = slug || "index";
|
|
85
86
|
if (!url)
|
|
86
|
-
return
|
|
87
|
+
return normalizedSlug;
|
|
87
88
|
const queryPart = sanitizeQueryParamsForCacheKey(url, options);
|
|
88
|
-
return queryPart ? `${
|
|
89
|
+
return queryPart ? `${normalizedSlug}:q:${queryPart}` : normalizedSlug;
|
|
89
90
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-cacheability.d.ts","sourceRoot":"","sources":["../../../src/src/cache/request-cacheability.ts"],"names":[],"mappings":"AAIA,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CASnE;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE9D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const CACHE_NEUTRAL_COOKIES = new Set([
|
|
2
|
+
"lb",
|
|
3
|
+
]);
|
|
4
|
+
export function requestHasCacheSensitiveState(req) {
|
|
5
|
+
if (req.headers.has("authorization") || req.headers.has("x-api-key")) {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
const cookieHeader = req.headers.get("cookie");
|
|
9
|
+
if (!cookieHeader)
|
|
10
|
+
return false;
|
|
11
|
+
return parseCookieNames(cookieHeader).some((name) => !isCacheNeutralCookieName(name));
|
|
12
|
+
}
|
|
13
|
+
export function isCacheNeutralCookieName(name) {
|
|
14
|
+
return CACHE_NEUTRAL_COOKIES.has(name.trim().toLowerCase());
|
|
15
|
+
}
|
|
16
|
+
function parseCookieNames(cookieHeader) {
|
|
17
|
+
return cookieHeader
|
|
18
|
+
.split(";")
|
|
19
|
+
.map((part) => part.trim())
|
|
20
|
+
.filter(Boolean)
|
|
21
|
+
.map((part) => {
|
|
22
|
+
const separatorIndex = part.indexOf("=");
|
|
23
|
+
return separatorIndex === -1 ? part : part.slice(0, separatorIndex).trim();
|
|
24
|
+
})
|
|
25
|
+
.filter(Boolean);
|
|
26
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydration-data-generator.d.ts","sourceRoot":"","sources":["../../../../src/src/html/hydration-script-builder/hydration-data-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAM3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AA8BzD,KAAK,gBAAgB,GAAG,qBAAqB,GAAG;IAC9C,oBAAoB,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACpD,CAAC;
|
|
1
|
+
{"version":3,"file":"hydration-data-generator.d.ts","sourceRoot":"","sources":["../../../../src/src/html/hydration-script-builder/hydration-data-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAM3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AA8BzD,KAAK,gBAAgB,GAAG,qBAAqB,GAAG;IAC9C,oBAAoB,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACpD,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EACzC,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,gBAAgB,EACzB,gBAAgB,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GACtC,MAAM,CAiDR"}
|
|
@@ -2,7 +2,7 @@ import { resolveRelativePath } from "../../modules/react-loader/path-resolver.js
|
|
|
2
2
|
import { getExtensionName } from "../../utils/path-utils.js";
|
|
3
3
|
import { determineClientModuleStrategy } from "../../rendering/rsc/client-module-strategy.js";
|
|
4
4
|
import { jsonForInlineScript } from "../../security/client/html-sanitizer.js";
|
|
5
|
-
import {
|
|
5
|
+
import { buildReleaseAssetModules } from "../../release-assets/client-module-map.js";
|
|
6
6
|
function toProjectRelativePath(absolutePath, projectDir) {
|
|
7
7
|
if (!absolutePath)
|
|
8
8
|
return "";
|
|
@@ -20,15 +20,6 @@ function inferPageType(pagePath) {
|
|
|
20
20
|
return undefined;
|
|
21
21
|
return PAGE_TYPE_EXTENSIONS.has(ext) ? ext : undefined;
|
|
22
22
|
}
|
|
23
|
-
function buildReleaseAssetModules(manifest) {
|
|
24
|
-
if (!manifest)
|
|
25
|
-
return undefined;
|
|
26
|
-
const modules = {};
|
|
27
|
-
for (const [path, entry] of Object.entries(manifest.modules)) {
|
|
28
|
-
modules[path] = releaseAssetUrl(entry.contentHash, "js");
|
|
29
|
-
}
|
|
30
|
-
return Object.keys(modules).length > 0 ? modules : undefined;
|
|
31
|
-
}
|
|
32
23
|
export function generateHydrationData(slug, params, props, options, serializeOptions) {
|
|
33
24
|
const layouts = (options.nestedLayouts ?? [])
|
|
34
25
|
.map((layout) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/router.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/router.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,cAwtB3B,CAAC"}
|
|
@@ -306,9 +306,11 @@ export const getRouterScript = () => `
|
|
|
306
306
|
|
|
307
307
|
async function fetchPageDataForPrefetch(path) {
|
|
308
308
|
if (getCachedPageData(path)) return;
|
|
309
|
-
return fetchPageDataFresh(path, null)
|
|
310
|
-
|
|
311
|
-
|
|
309
|
+
return fetchPageDataFresh(path, null)
|
|
310
|
+
.then((data) => preloadModulesForPageData(data, path))
|
|
311
|
+
.catch((error) => {
|
|
312
|
+
logBackgroundFetchFailure('Page data prefetch', path, error);
|
|
313
|
+
});
|
|
312
314
|
}
|
|
313
315
|
|
|
314
316
|
// ============================================
|
|
@@ -406,11 +408,7 @@ export const getRouterScript = () => `
|
|
|
406
408
|
}
|
|
407
409
|
|
|
408
410
|
perfStart('render:loadAll');
|
|
409
|
-
const
|
|
410
|
-
const allPaths = [pageData.pagePath, ...layoutPaths];
|
|
411
|
-
|
|
412
|
-
if (pageData.appPath) allPaths.push(pageData.appPath);
|
|
413
|
-
|
|
411
|
+
const allPaths = getPageDataModulePaths(pageData);
|
|
414
412
|
const components = await Promise.all(allPaths.map((path) => loadComponent(path)));
|
|
415
413
|
perfEnd('render:loadAll');
|
|
416
414
|
|
|
@@ -517,14 +515,47 @@ export const getRouterScript = () => `
|
|
|
517
515
|
}
|
|
518
516
|
|
|
519
517
|
// ============================================
|
|
520
|
-
// Prefetching on hover
|
|
518
|
+
// Prefetching on hover
|
|
521
519
|
// ============================================
|
|
522
520
|
let prefetchTimeout = null;
|
|
523
521
|
const prefetchedPaths = new Set();
|
|
524
522
|
const inFlightPrefetches = new Set();
|
|
525
523
|
|
|
524
|
+
function getPageDataModulePaths(pageData) {
|
|
525
|
+
const layoutPaths = (pageData.layouts || []).map((l) => l.path).filter(Boolean);
|
|
526
|
+
const allPaths = [pageData.pagePath, ...layoutPaths].filter(Boolean);
|
|
527
|
+
|
|
528
|
+
if (pageData.appPath) allPaths.push(pageData.appPath);
|
|
529
|
+
|
|
530
|
+
return allPaths;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
async function preloadModulesForPageData(pageData, path) {
|
|
534
|
+
if (!pageData) return;
|
|
535
|
+
if (pageData.releaseAssetModules && window.__veryfrontSetReleaseAssetModules) {
|
|
536
|
+
window.__veryfrontSetReleaseAssetModules(pageData.releaseAssetModules);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
const modulePaths = getPageDataModulePaths(pageData);
|
|
540
|
+
if (modulePaths.length === 0) return;
|
|
541
|
+
|
|
542
|
+
try {
|
|
543
|
+
await Promise.all(modulePaths.map((modulePath) => loadComponent(modulePath)));
|
|
544
|
+
} catch (error) {
|
|
545
|
+
logBackgroundFetchFailure('Module prefetch', path, error);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
526
549
|
function prefetchPage(href) {
|
|
527
|
-
if (prefetchedPaths.has(href) ||
|
|
550
|
+
if (prefetchedPaths.has(href) || inFlightPrefetches.has(href)) return;
|
|
551
|
+
|
|
552
|
+
const cachedPageData = getCachedPageData(href);
|
|
553
|
+
if (cachedPageData) {
|
|
554
|
+
preloadModulesForPageData(cachedPageData, href).catch((error) => {
|
|
555
|
+
logBackgroundFetchFailure('Module prefetch', href, error);
|
|
556
|
+
});
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
528
559
|
|
|
529
560
|
if (prefetchedPaths.size >= MAX_PREFETCH_PATHS) {
|
|
530
561
|
const oldest = prefetchedPaths.values().next().value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/import-map/loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAGtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/import-map/loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAGtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAoIlD,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,eAAe,CAAC,CAqC1B"}
|