veryfront 0.1.799 → 0.1.801
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/ag-ui/host-support.d.ts.map +1 -1
- package/esm/src/agent/ag-ui/host-support.js +16 -7
- package/esm/src/agent/ag-ui/runtime-support.d.ts.map +1 -1
- package/esm/src/agent/ag-ui/runtime-support.js +4 -1
- package/esm/src/agent/runtime/text-generation-runtime-message-converter.d.ts.map +1 -1
- package/esm/src/agent/runtime/text-generation-runtime-message-converter.js +7 -11
- package/esm/src/channels/invoke.d.ts.map +1 -1
- package/esm/src/channels/invoke.js +26 -11
- package/esm/src/html/html-shell-generator.d.ts.map +1 -1
- package/esm/src/html/html-shell-generator.js +4 -3
- package/esm/src/rendering/orchestrator/html.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/html.js +18 -7
- package/esm/src/rendering/renderer.js +2 -2
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-support.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/ag-ui/host-support.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAa3C,mCAAmC;AACnC,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAgBD,eAAO,MAAM,yBAAyB;;;;GASrC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;GAuBpC,CAAC;AAuBF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiBhC,CAAC;AAE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edToolNames, provide
|
|
|
126
126
|
}
|
|
127
127
|
return false;
|
|
128
128
|
}
|
|
129
|
-
function normalizeMessagePart(part) {
|
|
129
|
+
function normalizeMessagePart(part, toolNamesById = new Map()) {
|
|
130
130
|
if (part.type === "text" && typeof part.text === "string" &&
|
|
131
131
|
part.text.length <= MAX_TEXT_PART_LENGTH) {
|
|
132
132
|
return { type: "text", text: part.text };
|
|
@@ -165,7 +165,9 @@ function normalizeMessagePart(part) {
|
|
|
165
165
|
return {
|
|
166
166
|
type: "tool-result",
|
|
167
167
|
toolCallId: part.tool_call_id,
|
|
168
|
-
toolName: typeof part.tool_name === "string"
|
|
168
|
+
toolName: typeof part.tool_name === "string"
|
|
169
|
+
? part.tool_name
|
|
170
|
+
: toolNamesById.get(part.tool_call_id) ?? "unknown",
|
|
169
171
|
result: "output" in part ? part.output : undefined,
|
|
170
172
|
};
|
|
171
173
|
}
|
|
@@ -173,7 +175,9 @@ function normalizeMessagePart(part) {
|
|
|
173
175
|
return {
|
|
174
176
|
type: "tool-result",
|
|
175
177
|
toolCallId: part.toolCallId,
|
|
176
|
-
toolName: typeof part.toolName === "string"
|
|
178
|
+
toolName: typeof part.toolName === "string"
|
|
179
|
+
? part.toolName
|
|
180
|
+
: toolNamesById.get(part.toolCallId) ?? "unknown",
|
|
177
181
|
result: "result" in part ? part.result : undefined,
|
|
178
182
|
};
|
|
179
183
|
}
|
|
@@ -185,7 +189,7 @@ function buildMessageMetadataFields(message) {
|
|
|
185
189
|
...(message.metadata ? { metadata: message.metadata } : {}),
|
|
186
190
|
};
|
|
187
191
|
}
|
|
188
|
-
function normalizeAssistantMessage(message, providerOwnedToolNames, providerOwnedToolCallIds) {
|
|
192
|
+
function normalizeAssistantMessage(message, providerOwnedToolNames, providerOwnedToolCallIds, toolNamesById) {
|
|
189
193
|
const messages = [];
|
|
190
194
|
const metadataFields = buildMessageMetadataFields(message);
|
|
191
195
|
let segmentParts = [];
|
|
@@ -203,9 +207,12 @@ function normalizeAssistantMessage(message, providerOwnedToolNames, providerOwne
|
|
|
203
207
|
segmentIndex += 1;
|
|
204
208
|
};
|
|
205
209
|
for (const part of message.parts) {
|
|
206
|
-
const normalizedPart = normalizeMessagePart(part);
|
|
210
|
+
const normalizedPart = normalizeMessagePart(part, toolNamesById);
|
|
207
211
|
if (!normalizedPart)
|
|
208
212
|
continue;
|
|
213
|
+
if (normalizedPart.type !== "tool-result" && "toolCallId" in normalizedPart) {
|
|
214
|
+
toolNamesById.set(normalizedPart.toolCallId, normalizedPart.toolName);
|
|
215
|
+
}
|
|
209
216
|
if (!shouldKeepProviderVisibleToolPart(normalizedPart, providerOwnedToolNames, providerOwnedToolCallIds)) {
|
|
210
217
|
continue;
|
|
211
218
|
}
|
|
@@ -241,18 +248,20 @@ export async function parseAgUiRequestOrError(request) {
|
|
|
241
248
|
export function normalizeAgUiMessages(messages, options = {}) {
|
|
242
249
|
const providerOwnedToolNames = new Set(options.providerOwnedToolNames ?? []);
|
|
243
250
|
const providerOwnedToolCallIds = new Set();
|
|
251
|
+
const toolNamesById = new Map();
|
|
244
252
|
return messages.flatMap((message) => {
|
|
245
253
|
if (message.role === "user" || message.role === "system") {
|
|
246
254
|
providerOwnedToolCallIds.clear();
|
|
255
|
+
toolNamesById.clear();
|
|
247
256
|
}
|
|
248
257
|
if (message.role === "assistant") {
|
|
249
|
-
return normalizeAssistantMessage(message, providerOwnedToolNames, providerOwnedToolCallIds);
|
|
258
|
+
return normalizeAssistantMessage(message, providerOwnedToolNames, providerOwnedToolCallIds, toolNamesById);
|
|
250
259
|
}
|
|
251
260
|
const normalizedMessage = {
|
|
252
261
|
id: message.id,
|
|
253
262
|
role: message.role,
|
|
254
263
|
parts: message.parts
|
|
255
|
-
.map((part) => normalizeMessagePart(part))
|
|
264
|
+
.map((part) => normalizeMessagePart(part, toolNamesById))
|
|
256
265
|
.filter((part) => part !== null)
|
|
257
266
|
.filter((part) => shouldKeepProviderVisibleToolPart(part, providerOwnedToolNames, providerOwnedToolCallIds)),
|
|
258
267
|
...buildMessageMetadataFields(message),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-support.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/ag-ui/runtime-support.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAevE,yCAAyC;AACzC,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,kBAAkB,CAAC,UAAU,CAAC,GACvC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"runtime-support.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/ag-ui/runtime-support.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAevE,yCAAyC;AACzC,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,kBAAkB,CAAC,UAAU,CAAC,GACvC,OAAO,EAAE,CAiDX"}
|
|
@@ -12,11 +12,13 @@ function parseToolArguments(serializedArguments) {
|
|
|
12
12
|
}
|
|
13
13
|
/** Normalizes AG-UI runtime messages. */
|
|
14
14
|
export function normalizeAgUiRuntimeMessages(messages) {
|
|
15
|
+
const toolNamesById = new Map();
|
|
15
16
|
return messages.map((message) => {
|
|
16
17
|
const parts = [];
|
|
17
18
|
switch (message.role) {
|
|
18
19
|
case "system":
|
|
19
20
|
case "user":
|
|
21
|
+
toolNamesById.clear();
|
|
20
22
|
parts.push({ type: "text", text: message.content });
|
|
21
23
|
break;
|
|
22
24
|
case "assistant":
|
|
@@ -30,13 +32,14 @@ export function normalizeAgUiRuntimeMessages(messages) {
|
|
|
30
32
|
toolName: toolCall.function.name,
|
|
31
33
|
args: parseToolArguments(toolCall.function.arguments),
|
|
32
34
|
});
|
|
35
|
+
toolNamesById.set(toolCall.id, toolCall.function.name);
|
|
33
36
|
}
|
|
34
37
|
break;
|
|
35
38
|
case "tool":
|
|
36
39
|
parts.push({
|
|
37
40
|
type: "tool-result",
|
|
38
41
|
toolCallId: message.toolCallId,
|
|
39
|
-
toolName: "unknown",
|
|
42
|
+
toolName: toolNamesById.get(message.toolCallId) ?? "unknown",
|
|
40
43
|
result: message.error
|
|
41
44
|
? {
|
|
42
45
|
content: message.content,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-generation-runtime-message-converter.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/text-generation-runtime-message-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAGV,4BAA4B,EAK7B,MAAM,4CAA4C,CAAC;AAEpD,OAAO,
|
|
1
|
+
{"version":3,"file":"text-generation-runtime-message-converter.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/text-generation-runtime-message-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAGV,4BAA4B,EAK7B,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAAsC,KAAK,OAAO,EAAqB,MAAM,aAAa,CAAC;AAwMlG;;GAEG;AACH,wBAAgB,qCAAqC,CACnD,GAAG,EAAE,OAAO,EACZ,OAAO,GAAE;IAAE,2BAA2B,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAO,GAC1D,4BAA4B,CA6F9B;AAuHD;;GAEG;AACH,wBAAgB,sCAAsC,CACpD,QAAQ,EAAE,OAAO,EAAE,GAClB,4BAA4B,EAAE,CAyChC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module ai/agent/runtime/text-generation-runtime-message-converter
|
|
8
8
|
*/
|
|
9
9
|
import { buildDataFileAnnotation } from "../../chat/types.js";
|
|
10
|
-
import { getTextFromParts, getToolArguments
|
|
10
|
+
import { getTextFromParts, getToolArguments } from "../types.js";
|
|
11
11
|
function getStringPartField(part, key) {
|
|
12
12
|
if (!part || typeof part !== "object" || Array.isArray(part))
|
|
13
13
|
return undefined;
|
|
@@ -228,19 +228,15 @@ export function convertToTextGenerationRuntimeMessage(msg, options = {}) {
|
|
|
228
228
|
}
|
|
229
229
|
case "tool": {
|
|
230
230
|
const content = [];
|
|
231
|
+
const toolNamesById = new Map();
|
|
231
232
|
for (const part of msg.parts) {
|
|
232
|
-
if (part
|
|
233
|
-
continue;
|
|
234
|
-
const resultPart = part;
|
|
235
|
-
if (shouldSkipProviderExecutedToolResult(resultPart, providerExecutedToolCallIds)) {
|
|
233
|
+
if (shouldSkipProviderExecutedToolResult(part, providerExecutedToolCallIds)) {
|
|
236
234
|
continue;
|
|
237
235
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
output: { type: "json", value: resultPart.result },
|
|
243
|
-
});
|
|
236
|
+
const toolResultPart = getTextGenerationToolResultPart(part, toolNamesById);
|
|
237
|
+
if (toolResultPart) {
|
|
238
|
+
content.push(toolResultPart);
|
|
239
|
+
}
|
|
244
240
|
}
|
|
245
241
|
const toolMessage = { role: "tool", content };
|
|
246
242
|
return toolMessage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../../../src/src/channels/invoke.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,IAAI,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAKjE,OAAO,EAAqB,KAAK,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAqDvF,iDAAiD;AACjD,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAoC,CAAC;AAC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BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAwCnF,mDAAmD;AACnD,wBAAgB,sCAAsC,CACpD,QAAQ,EAAE,oBAAoB,CAAC,qBAAqB,CAAC,GACpD,OAAO,EAAE,CA4BX;AAED,qCAAqC;AACrC,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC,GACxC,KAAK,GAAG,SAAS,CAEnB;AAsDD,qCAAqC;AACrC,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,aAAa,GAAG,mBAAmB,EAAE,CAiDxF;AAgBD,8BAA8B;AAC9B,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,oBAAoB,EAC7B,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,qBAAqB,CAAC,CAkEhC"}
|
|
@@ -144,7 +144,7 @@ export async function listChannelAssistants(ctx, deps) {
|
|
|
144
144
|
return ChannelAssistantsResponseSchema.parse({ assistants });
|
|
145
145
|
}
|
|
146
146
|
export { verifyDispatchJws, verifyDispatchJwsSignature } from "./control-plane.js";
|
|
147
|
-
function normalizeConversationPart(part) {
|
|
147
|
+
function normalizeConversationPart(part, toolNamesById = new Map()) {
|
|
148
148
|
if (part.type === "text" && typeof part.text === "string") {
|
|
149
149
|
return { type: "text", text: part.text };
|
|
150
150
|
}
|
|
@@ -165,7 +165,9 @@ function normalizeConversationPart(part) {
|
|
|
165
165
|
return {
|
|
166
166
|
type: "tool-result",
|
|
167
167
|
toolCallId: part.tool_call_id,
|
|
168
|
-
toolName: typeof part.tool_name === "string"
|
|
168
|
+
toolName: typeof part.tool_name === "string"
|
|
169
|
+
? part.tool_name
|
|
170
|
+
: toolNamesById.get(part.tool_call_id) ?? "unknown",
|
|
169
171
|
result: "output" in part ? part.output : undefined,
|
|
170
172
|
};
|
|
171
173
|
}
|
|
@@ -173,15 +175,28 @@ function normalizeConversationPart(part) {
|
|
|
173
175
|
}
|
|
174
176
|
/** Normalizes conversation history for runtime. */
|
|
175
177
|
export function normalizeConversationHistoryForRuntime(messages) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
role
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
178
|
+
const toolNamesById = new Map();
|
|
179
|
+
return messages.map((message) => {
|
|
180
|
+
if (message.role === "user" || message.role === "system") {
|
|
181
|
+
toolNamesById.clear();
|
|
182
|
+
}
|
|
183
|
+
const parts = message.parts
|
|
184
|
+
.map((part) => {
|
|
185
|
+
const normalizedPart = normalizeConversationPart(part, toolNamesById);
|
|
186
|
+
if (normalizedPart?.type !== "tool-result" && normalizedPart && "toolCallId" in normalizedPart) {
|
|
187
|
+
toolNamesById.set(normalizedPart.toolCallId, normalizedPart.toolName);
|
|
188
|
+
}
|
|
189
|
+
return normalizedPart;
|
|
190
|
+
})
|
|
191
|
+
.filter((part) => part !== null);
|
|
192
|
+
return {
|
|
193
|
+
id: message.id,
|
|
194
|
+
role: message.role,
|
|
195
|
+
parts,
|
|
196
|
+
...(message.createdAt ? { timestamp: Date.parse(message.createdAt) || undefined } : {}),
|
|
197
|
+
...(message.metadata ? { metadata: message.metadata } : {}),
|
|
198
|
+
};
|
|
199
|
+
});
|
|
185
200
|
}
|
|
186
201
|
/** Resolves channel invoke agent. */
|
|
187
202
|
export function resolveChannelInvokeAgent(assistantId, deps) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-shell-generator.d.ts","sourceRoot":"","sources":["../../../src/src/html/html-shell-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA2BxE,OAAO,EAGL,aAAa,EACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAqCxD,KAAK,gBAAgB,GAAG,OAAO,CA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E,cAAc,EACpB,OAAO,EAAE,qBAAqB,EAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAC1C,KAAK,CAAC,EAAE,cAAc,EACtB,iBAAiB,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAC5C,OAAO,CAAC,MAAM,CAAC,CAoBjB"}
|
|
@@ -135,11 +135,12 @@ async function generateHTMLShellPartsImpl(meta, options, params, props, contentF
|
|
|
135
135
|
// Enable dev scripts for local dev OR preview mode (for HMR support in Studio),
|
|
136
136
|
// unless a caller explicitly forces production client scripts for fair benchmarking.
|
|
137
137
|
const useDevScripts = !options.forceProductionScripts && (isLocalProject || isPreviewMode);
|
|
138
|
+
const explicitReleaseManifest = options
|
|
139
|
+
.releaseAssetManifest;
|
|
138
140
|
const releaseManifest = options.studioEmbed
|
|
139
141
|
? null
|
|
140
|
-
:
|
|
141
|
-
?
|
|
142
|
-
.releaseAssetManifest ?? null
|
|
142
|
+
: explicitReleaseManifest !== undefined
|
|
143
|
+
? explicitReleaseManifest
|
|
143
144
|
: await profilePhase("html.release_asset_manifest", () => getReadyManifestForRenderAsync(options.releaseId));
|
|
144
145
|
const importMapPromise = buildImportMap({
|
|
145
146
|
projectDir: options.projectDir,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/orchestrator/html.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/orchestrator/html.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAClF,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AA+FlF,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAsB;gBAExB,MAAM,EAAE,mBAAmB;IAIjC,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;IA0BjE,kBAAkB,CACtB,WAAW,EAAE,cAAc,EAC3B,OAAO,EAAE,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,GAC3C,OAAO,CAAC,cAAc,CAAC;YAqEZ,sBAAsB;YAuDtB,4BAA4B;YAiB5B,wBAAwB;YAmBxB,gBAAgB;YAyBhB,kBAAkB;IAwDhC,OAAO,CAAC,cAAc;YAQR,eAAe;YAaf,gBAAgB;IAoF9B;;;;OAIG;YACW,gBAAgB;CAc/B"}
|
|
@@ -7,6 +7,7 @@ import { addNonceToHtmlTags } from "../../html/nonce-injection.js";
|
|
|
7
7
|
import { injectElementSelectors } from "../../studio/element-selector-injector.js";
|
|
8
8
|
import { computeSourceHash } from "../../studio/hash-utils.js";
|
|
9
9
|
import { extractRelativePath } from "../../utils/route-path-utils.js";
|
|
10
|
+
import { getReadyManifestForRenderAsync } from "../../release-assets/manifest-cache.js";
|
|
10
11
|
import { resolveAppComponentPath } from "../layouts/utils/app-resolver.js";
|
|
11
12
|
import { StreamTimeoutError, streamToString } from "../utils/stream-utils.js";
|
|
12
13
|
import { profilePhase, profileSyncPhase } from "../../observability/request-profiler.js";
|
|
@@ -29,6 +30,13 @@ function resolveReleaseId(options) {
|
|
|
29
30
|
return source.slice("release-".length);
|
|
30
31
|
return undefined;
|
|
31
32
|
}
|
|
33
|
+
async function resolveReleaseAssetManifestForHTML(options) {
|
|
34
|
+
if (options?.studioEmbed)
|
|
35
|
+
return null;
|
|
36
|
+
if (options?.releaseAssetManifest !== undefined)
|
|
37
|
+
return options.releaseAssetManifest;
|
|
38
|
+
return await profilePhase("html.release_asset_manifest", () => getReadyManifestForRenderAsync(resolveReleaseId(options)));
|
|
39
|
+
}
|
|
32
40
|
function applyExplicitThemeToDocument(html, colorScheme, enabled) {
|
|
33
41
|
if (!enabled || !colorScheme)
|
|
34
42
|
return html;
|
|
@@ -137,14 +145,15 @@ export class HTMLGenerator {
|
|
|
137
145
|
async handleFullHTMLDocument(context, projectCSSPromise) {
|
|
138
146
|
const metadata = extractHTMLMetadata((context.pageInfo.entity.frontmatter || {}), (context.layoutBundle?.frontmatter || {}));
|
|
139
147
|
const pagePath = context.pageInfo.entity.path;
|
|
140
|
-
const [isClientPage,
|
|
148
|
+
const [isClientPage, releaseAssetManifest] = await Promise.all([
|
|
141
149
|
this.detectUseClientDirective(pagePath),
|
|
142
|
-
|
|
143
|
-
projectDir: this.config.projectDir,
|
|
144
|
-
config: this.config.config,
|
|
145
|
-
releaseAssetManifest: context.options?.releaseAssetManifest,
|
|
146
|
-
}),
|
|
150
|
+
resolveReleaseAssetManifestForHTML(context.options),
|
|
147
151
|
]);
|
|
152
|
+
const importMapJson = await buildImportMapJson({
|
|
153
|
+
projectDir: this.config.projectDir,
|
|
154
|
+
config: this.config.config,
|
|
155
|
+
releaseAssetManifest,
|
|
156
|
+
});
|
|
148
157
|
const themedHtml = injectThemePersistenceScript(applyExplicitThemeToDocument(context.html, context.options?.colorScheme, context.options?.colorSchemeFromParam), context.options?.colorScheme, context.options?.colorSchemeFromParam, context.options?.nonce);
|
|
149
158
|
const projectStylesheetHref = await this.resolveProjectStylesheetHref(context, projectCSSPromise);
|
|
150
159
|
const injectedHtml = injectHTMLContent(themedHtml, "", metadata, {
|
|
@@ -307,7 +316,9 @@ export class HTMLGenerator {
|
|
|
307
316
|
isLocalProject: this.config.mode === "development",
|
|
308
317
|
noHmr: context.options?.noHmr,
|
|
309
318
|
forceProductionScripts: context.options?.forceProductionScripts,
|
|
310
|
-
|
|
319
|
+
...(context.options?.releaseAssetManifest !== undefined
|
|
320
|
+
? { releaseAssetManifest: context.options.releaseAssetManifest }
|
|
321
|
+
: {}),
|
|
311
322
|
}));
|
|
312
323
|
}
|
|
313
324
|
/**
|
|
@@ -186,8 +186,8 @@ export class Renderer {
|
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
188
|
async resolveReleaseAssetManifest(ctx, options) {
|
|
189
|
-
if (options
|
|
190
|
-
return options.releaseAssetManifest
|
|
189
|
+
if (options?.releaseAssetManifest !== undefined) {
|
|
190
|
+
return options.releaseAssetManifest;
|
|
191
191
|
}
|
|
192
192
|
if (options?.studioEmbed || ctx.environment !== "production")
|
|
193
193
|
return null;
|