veryfront 0.1.1049 → 0.1.1051

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.
Files changed (44) hide show
  1. package/esm/cli/commands/generate/handler.d.ts +1 -1
  2. package/esm/cli/mcp/tools/scaffold-tools.d.ts +1 -1
  3. package/esm/deno.js +1 -1
  4. package/esm/extensions/ext-llm-anthropic/src/anthropic-provider.d.ts.map +1 -1
  5. package/esm/extensions/ext-llm-anthropic/src/anthropic-provider.js +6 -2
  6. package/esm/extensions/ext-llm-anthropic/src/anthropic-stream.d.ts +2 -0
  7. package/esm/extensions/ext-llm-anthropic/src/anthropic-stream.d.ts.map +1 -1
  8. package/esm/extensions/ext-llm-anthropic/src/anthropic-stream.js +43 -5
  9. package/esm/src/agent/hosted/child-tool-input.d.ts +2 -2
  10. package/esm/src/agent/hosted/default-invoke-agent-tool.d.ts +3 -3
  11. package/esm/src/cache/backends/api.d.ts.map +1 -1
  12. package/esm/src/cache/backends/api.js +13 -10
  13. package/esm/src/cache/verified-api-credential-context.d.ts +8 -0
  14. package/esm/src/cache/verified-api-credential-context.d.ts.map +1 -0
  15. package/esm/src/cache/verified-api-credential-context.js +13 -0
  16. package/esm/src/channels/control-plane.d.ts +5 -5
  17. package/esm/src/html/styles-builder/css-import-extraction.d.ts +40 -0
  18. package/esm/src/html/styles-builder/css-import-extraction.d.ts.map +1 -0
  19. package/esm/src/html/styles-builder/css-import-extraction.js +103 -0
  20. package/esm/src/internal-agents/control-plane-auth.d.ts +13 -11
  21. package/esm/src/internal-agents/control-plane-auth.d.ts.map +1 -1
  22. package/esm/src/internal-agents/control-plane-auth.js +55 -4
  23. package/esm/src/platform/adapters/fs/veryfront/multi-project-adapter.d.ts +1 -3
  24. package/esm/src/platform/adapters/fs/veryfront/multi-project-adapter.d.ts.map +1 -1
  25. package/esm/src/platform/adapters/fs/veryfront/multi-project-adapter.js +0 -2
  26. package/esm/src/platform/adapters/fs/veryfront/request-context.d.ts +0 -4
  27. package/esm/src/platform/adapters/fs/veryfront/request-context.d.ts.map +1 -1
  28. package/esm/src/platform/adapters/fs/veryfront/request-context.js +0 -1
  29. package/esm/src/release-assets/build-executor.d.ts.map +1 -1
  30. package/esm/src/release-assets/build-executor.js +41 -2
  31. package/esm/src/security/http/base-handler.d.ts +2 -2
  32. package/esm/src/security/http/base-handler.d.ts.map +1 -1
  33. package/esm/src/security/http/base-handler.js +6 -1
  34. package/esm/src/server/handlers/dev/styles-css-import-scanner.d.ts +22 -0
  35. package/esm/src/server/handlers/dev/styles-css-import-scanner.d.ts.map +1 -0
  36. package/esm/src/server/handlers/dev/styles-css-import-scanner.js +114 -0
  37. package/esm/src/server/handlers/dev/styles-css.handler.d.ts.map +1 -1
  38. package/esm/src/server/handlers/dev/styles-css.handler.js +27 -0
  39. package/esm/src/server/handlers/request/agent-stream.handler.d.ts.map +1 -1
  40. package/esm/src/server/handlers/request/agent-stream.handler.js +2 -5
  41. package/esm/src/utils/version-constant.d.ts +1 -1
  42. package/esm/src/utils/version-constant.js +1 -1
  43. package/esm/src/workflow/schemas/workflow.schema.d.ts +4 -4
  44. package/package.json +5 -4
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import type { ParsedArgs } from "../../shared/types.js";
5
5
  export declare const parseGenerateArgs: (args: ParsedArgs) => import("../../shared/args.js").SafeParseResult<import("../../../src/extensions/schema/schema-validator.js").InferShape<{
6
- type: import("../../../src/internal-agents/schema.js").Schema<"prompt" | "page" | "api" | "agent" | "layout" | "resource" | "component" | "task" | "tool" | "integration" | "workflow" | "skill" | undefined>;
6
+ type: import("../../../src/internal-agents/schema.js").Schema<"prompt" | "page" | "api" | "agent" | "layout" | "resource" | "component" | "task" | "tool" | "integration" | "skill" | "workflow" | undefined>;
7
7
  name: import("../../../src/internal-agents/schema.js").Schema<string | undefined>;
8
8
  }>>;
9
9
  export declare function handleGenerateCommand(args: ParsedArgs): Promise<void>;
@@ -5,7 +5,7 @@ import type { InferSchema } from "../../../src/extensions/schema/index.js";
5
5
  import type { MCPTool } from "../tools.js";
6
6
  import { type ScaffoldResult } from "../../scaffold/engine.js";
7
7
  declare const getScaffoldInput: () => import("../../../src/internal-agents/schema.js").Schema<import("../../../src/extensions/schema/schema-validator.js").InferShape<{
8
- type: import("../../../src/internal-agents/schema.js").Schema<"prompt" | "page" | "api" | "agent" | "layout" | "resource" | "component" | "task" | "tool" | "workflow" | "skill">;
8
+ type: import("../../../src/internal-agents/schema.js").Schema<"prompt" | "page" | "api" | "agent" | "layout" | "resource" | "component" | "task" | "tool" | "skill" | "workflow">;
9
9
  name: import("../../../src/internal-agents/schema.js").Schema<string>;
10
10
  methods: import("../../../src/internal-agents/schema.js").Schema<string[] | undefined>;
11
11
  projectPath: import("../../../src/internal-agents/schema.js").Schema<string | undefined>;
package/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.1049",
3
+ "version": "0.1.1051",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "minimumDependencyAge": {
@@ -1 +1 @@
1
- {"version":3,"file":"anthropic-provider.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-llm-anthropic/src/anthropic-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAE3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EACL,kBAAkB,EAIlB,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EAKpB,+BAA+B,EAC/B,8BAA8B,EAC/B,MAAM,uCAAuC,CAAC;AAW/C,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,+BAA+B,EAC/B,8BAA8B,GAC/B,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AA4KD,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,sBAAsB,EAC9B,OAAO,EAAE,MAAM,GACd,YAAY,CAyEd;AAED,qBAAa,iBAAkB,YAAW,WAAW;IACnD,QAAQ,CAAC,EAAE,eAAe;IAE1B,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,YAAY;CAYtE"}
1
+ {"version":3,"file":"anthropic-provider.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-llm-anthropic/src/anthropic-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAE3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EACL,kBAAkB,EAIlB,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EAKpB,+BAA+B,EAC/B,8BAA8B,EAC/B,MAAM,uCAAuC,CAAC;AAW/C,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,+BAA+B,EAC/B,8BAA8B,GAC/B,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AA4KD,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,sBAAsB,EAC9B,OAAO,EAAE,MAAM,GACd,YAAY,CAgFd;AAED,qBAAa,iBAAkB,YAAW,WAAW;IACnD,QAAQ,CAAC,EAAE,eAAe;IAE1B,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,YAAY;CAYtE"}
@@ -134,8 +134,12 @@ function buildAnthropicGenerateResult(payload) {
134
134
  }
135
135
  export function createAnthropicModelRuntime(config, modelId) {
136
136
  const fetchImpl = config.fetch ?? globalThis.fetch;
137
+ const providerName = config.name ?? "anthropic";
138
+ const streamOptions = providerName === "veryfront-cloud"
139
+ ? { clientToolUseTrailingUsageTimeoutMode: "drain" }
140
+ : undefined;
137
141
  return {
138
- provider: config.name ?? "anthropic",
142
+ provider: providerName,
139
143
  modelId,
140
144
  specificationVersion: "v3",
141
145
  supportedUrls: {},
@@ -185,7 +189,7 @@ export function createAnthropicModelRuntime(config, modelId) {
185
189
  }).then((responseStream) => {
186
190
  const drained = warnings.drain();
187
191
  return {
188
- stream: ReadableStream.from(withToolInputStatusTransitions(streamAnthropicCompatibleParts(responseStream))),
192
+ stream: ReadableStream.from(withToolInputStatusTransitions(streamAnthropicCompatibleParts(responseStream, streamOptions))),
189
193
  ...(drained.length > 0 ? { warnings: drained } : {}),
190
194
  };
191
195
  });
@@ -1,6 +1,8 @@
1
1
  import type { RuntimeUsage } from "../../../src/provider/shared/index.js";
2
2
  type AnthropicStreamOptions = {
3
3
  clientToolUseTrailingUsageGraceMs?: number;
4
+ clientToolUseTrailingUsageTimeoutMode?: "cancel" | "drain";
5
+ clientToolUseTrailingUsageDrainTimeoutMs?: number;
4
6
  };
5
7
  export declare function normalizeAnthropicFinishReason(raw: unknown): string | {
6
8
  unified: string;
@@ -1 +1 @@
1
- {"version":3,"file":"anthropic-stream.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-llm-anthropic/src/anthropic-stream.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAgB1E,KAAK,sBAAsB,GAAG;IAC5B,iCAAiC,CAAC,EAAE,MAAM,CAAC;CAC5C,CAAC;AAmBF,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,OAAO,GACX,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAgBlD;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CA+DhF;AAqDD,wBAAuB,8BAA8B,CACnD,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,EAClC,OAAO,GAAE,sBAA2B,GACnC,aAAa,CAAC,OAAO,CAAC,CA4TxB"}
1
+ {"version":3,"file":"anthropic-stream.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-llm-anthropic/src/anthropic-stream.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAgB1E,KAAK,sBAAsB,GAAG;IAC5B,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAC3C,qCAAqC,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC3D,wCAAwC,CAAC,EAAE,MAAM,CAAC;CACnD,CAAC;AAoBF,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,OAAO,GACX,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAgBlD;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CA+DhF;AA+FD,wBAAuB,8BAA8B,CACnD,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,EAClC,OAAO,GAAE,sBAA2B,GACnC,aAAa,CAAC,OAAO,CAAC,CAwUxB"}
@@ -2,6 +2,7 @@ import * as dntShim from "../../../_dnt.shims.js";
2
2
  import { mergeUsage, parseSseChunk, readGatewayBillingMode, readRecord, stringifyJsonValue, } from "../../../src/provider/shared/index.js";
3
3
  const CLIENT_TOOL_USE_FINISH_REASON = { unified: "tool-calls", raw: "tool_use" };
4
4
  const DEFAULT_CLIENT_TOOL_USE_TRAILING_USAGE_GRACE_MS = 100;
5
+ const DEFAULT_CLIENT_TOOL_USE_TRAILING_USAGE_DRAIN_TIMEOUT_MS = 15_000;
5
6
  function isEmptyRecord(value) {
6
7
  return Boolean(value &&
7
8
  typeof value === "object" &&
@@ -90,7 +91,7 @@ function isToolCallsFinishReason(finishReason) {
90
91
  return finishReason === "tool-calls" ||
91
92
  (typeof finishReason === "object" && finishReason?.unified === "tool-calls");
92
93
  }
93
- async function readStreamChunk(reader, timeoutMs) {
94
+ async function readStreamChunk(reader, timeoutMs, timeoutMode = "cancel", drainTimeoutMs = DEFAULT_CLIENT_TOOL_USE_TRAILING_USAGE_DRAIN_TIMEOUT_MS) {
94
95
  if (timeoutMs === undefined) {
95
96
  const read = await reader.read();
96
97
  return read.done ? { kind: "done" } : { kind: "chunk", chunk: read.value };
@@ -98,12 +99,17 @@ async function readStreamChunk(reader, timeoutMs) {
98
99
  let timeoutId;
99
100
  const readPromise = reader.read().then((read) => read.done ? { kind: "done" } : { kind: "chunk", chunk: read.value });
100
101
  const timeoutPromise = new Promise((resolve) => {
101
- timeoutId = dntShim.setTimeout(() => resolve({ kind: "timeout" }), Math.max(1, timeoutMs));
102
+ timeoutId = dntShim.setTimeout(() => resolve({ kind: "timeout", readerMode: timeoutMode }), Math.max(1, timeoutMs));
102
103
  });
103
104
  try {
104
105
  const result = await Promise.race([readPromise, timeoutPromise]);
105
106
  if (result.kind === "timeout") {
106
- await cancelStreamReader(reader, "Timed out waiting for trailing Anthropic tool-use usage metadata");
107
+ if (timeoutMode === "drain") {
108
+ void drainStreamReaderAfterTimeout(reader, readPromise, drainTimeoutMs);
109
+ }
110
+ else {
111
+ await cancelStreamReader(reader, "Timed out waiting for trailing Anthropic tool-use usage metadata");
112
+ }
107
113
  }
108
114
  return result;
109
115
  }
@@ -121,11 +127,40 @@ async function cancelStreamReader(reader, reason) {
121
127
  // The upstream body may already be closed or canceled by the runtime.
122
128
  }
123
129
  }
130
+ async function drainStreamReaderAfterTimeout(reader, pendingRead, timeoutMs) {
131
+ const timeoutId = dntShim.setTimeout(() => {
132
+ void cancelStreamReader(reader, "Timed out draining trailing Anthropic tool-use usage metadata");
133
+ }, Math.max(1, timeoutMs));
134
+ try {
135
+ const firstRead = await pendingRead;
136
+ if (firstRead.kind === "done") {
137
+ return;
138
+ }
139
+ while (true) {
140
+ const read = await reader.read();
141
+ if (read.done) {
142
+ return;
143
+ }
144
+ }
145
+ }
146
+ catch {
147
+ // The caller has already emitted a finish event; late drain failures should
148
+ // not fail the completed tool turn.
149
+ }
150
+ finally {
151
+ clearTimeout(timeoutId);
152
+ reader.releaseLock();
153
+ }
154
+ }
124
155
  export async function* streamAnthropicCompatibleParts(stream, options = {}) {
125
156
  const decoder = new TextDecoder();
126
157
  const reader = stream.getReader();
127
158
  const trailingUsageGraceMs = options.clientToolUseTrailingUsageGraceMs ??
128
159
  DEFAULT_CLIENT_TOOL_USE_TRAILING_USAGE_GRACE_MS;
160
+ const trailingUsageTimeoutMode = options.clientToolUseTrailingUsageTimeoutMode ?? "cancel";
161
+ const trailingUsageDrainTimeoutMs = options.clientToolUseTrailingUsageDrainTimeoutMs ??
162
+ DEFAULT_CLIENT_TOOL_USE_TRAILING_USAGE_DRAIN_TIMEOUT_MS;
163
+ let readerReleased = false;
129
164
  let buffer = "";
130
165
  const toolCalls = new Map();
131
166
  const reasoningBlocks = new Map();
@@ -165,8 +200,9 @@ export async function* streamAnthropicCompatibleParts(stream, options = {}) {
165
200
  });
166
201
  try {
167
202
  while (true) {
168
- const read = await readStreamChunk(reader, getClientToolUseReadTimeoutMs());
203
+ const read = await readStreamChunk(reader, getClientToolUseReadTimeoutMs(), trailingUsageTimeoutMode, trailingUsageDrainTimeoutMs);
169
204
  if (read.kind === "timeout") {
205
+ readerReleased = read.readerMode === "drain";
170
206
  mergeTrailingBufferUsage();
171
207
  finishReason ??= CLIENT_TOOL_USE_FINISH_REASON;
172
208
  yield buildFinishPart();
@@ -386,7 +422,9 @@ export async function* streamAnthropicCompatibleParts(stream, options = {}) {
386
422
  }
387
423
  }
388
424
  finally {
389
- reader.releaseLock();
425
+ if (!readerReleased) {
426
+ reader.releaseLock();
427
+ }
390
428
  }
391
429
  mergeTrailingBufferUsage();
392
430
  yield buildFinishPart();
@@ -14,7 +14,7 @@ export declare const getHostedChildForkToolInputSchema: () => import("../../inte
14
14
  model: import("../../internal-agents/schema.js").Schema<string | undefined>;
15
15
  thinking: import("../../internal-agents/schema.js").Schema<number | undefined>;
16
16
  max_steps: import("../../internal-agents/schema.js").Schema<number | undefined>;
17
- result_mode: import("../../internal-agents/schema.js").Schema<"full" | "summary" | undefined>;
17
+ result_mode: import("../../internal-agents/schema.js").Schema<"summary" | "full" | undefined>;
18
18
  }>>;
19
19
  /** Schema for hosted child fork tool input.
20
20
  * @deprecated Use getHostedChildForkToolInputSchema()
@@ -28,7 +28,7 @@ export declare const hostedChildForkToolInputSchema: import("../../internal-agen
28
28
  model: import("../../internal-agents/schema.js").Schema<string | undefined>;
29
29
  thinking: import("../../internal-agents/schema.js").Schema<number | undefined>;
30
30
  max_steps: import("../../internal-agents/schema.js").Schema<number | undefined>;
31
- result_mode: import("../../internal-agents/schema.js").Schema<"full" | "summary" | undefined>;
31
+ result_mode: import("../../internal-agents/schema.js").Schema<"summary" | "full" | undefined>;
32
32
  }>>;
33
33
  /** Input payload for hosted child fork tool. */
34
34
  export type HostedChildForkToolInput = InferSchema<ReturnType<typeof getHostedChildForkToolInputSchema>>;
@@ -88,7 +88,7 @@ export declare const getDefaultHostedInvokeAgentInputSchema: () => import("../..
88
88
  model?: string | undefined;
89
89
  thinking?: number | undefined;
90
90
  max_steps?: number | undefined;
91
- result_mode?: "full" | "summary" | undefined;
91
+ result_mode?: "summary" | "full" | undefined;
92
92
  } & {
93
93
  agent_id: string;
94
94
  }>;
@@ -105,7 +105,7 @@ export declare const defaultHostedInvokeAgentInputSchema: import("../../internal
105
105
  model?: string | undefined;
106
106
  thinking?: number | undefined;
107
107
  max_steps?: number | undefined;
108
- result_mode?: "full" | "summary" | undefined;
108
+ result_mode?: "summary" | "full" | undefined;
109
109
  } & {
110
110
  agent_id: string;
111
111
  }>;
@@ -124,7 +124,7 @@ export declare function createDefaultHostedInvokeAgentTool<TContext extends Defa
124
124
  model?: string | undefined;
125
125
  thinking?: number | undefined;
126
126
  max_steps?: number | undefined;
127
- result_mode?: "full" | "summary" | undefined;
127
+ result_mode?: "summary" | "full" | undefined;
128
128
  } & {
129
129
  agent_id: string;
130
130
  }, DefaultHostedInvokeAgentToolResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/src/cache/backends/api.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAsDhD,qBAAa,eAAgB,YAAW,YAAY;IAClD,QAAQ,CAAC,IAAI,EAAG,KAAK,CAAU;IAC/B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,cAAc,CAAC;gBAGrB,OAAO,GAAE;QACP,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;KACxB;IAiBR,OAAO,CAAC,SAAS;YAIH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MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAQxC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;YAuBrD,eAAe;IAKvB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,SAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQhE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAYrF,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/B,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAMrD"}
@@ -9,6 +9,7 @@ import { buildBatchResults } from "../batch-results.js";
9
9
  import { REQUEST_ERROR } from "../../errors/index.js";
10
10
  import { sanitizeUrlForSpan } from "../../utils/logger/redact.js";
11
11
  import { getHostEnv } from "../../platform/compat/process.js";
12
+ import { getVerifiedCacheApiCredential } from "../verified-api-credential-context.js";
12
13
  const logger = baseLogger.component("api-cache-backend");
13
14
  const DEFAULT_TIMEOUT_MS = 10_000;
14
15
  const CIRCUIT_BREAKER_RESET_TIMEOUT_MS = 15_000;
@@ -66,20 +67,22 @@ export class ApiCacheBackend {
66
67
  const reqCtx = getCurrentRequestContext();
67
68
  const hostToken = getHostEnv("VERYFRONT_API_TOKEN");
68
69
  const envToken = getEnvValue("VERYFRONT_API_TOKEN");
69
- const verifiedRequestToken = reqCtx?.tokenTrust === "verified-control-plane"
70
- ? reqCtx.token
71
- : undefined;
72
- // Ordinary proxy headers are not cache credentials. Only a request token
73
- // explicitly marked after control-plane verification may override the host.
74
- const token = verifiedRequestToken || hostToken || envToken || null;
70
+ const verifiedCredential = getVerifiedCacheApiCredential();
71
+ const verifiedRequestToken = verifiedCredential?.token;
72
+ // The private verified-request context cannot be changed through the
73
+ // globally exposed filesystem request context.
74
+ const token = verifiedRequestToken || hostToken || reqCtx?.token || envToken || null;
75
75
  const tokenSource = verifiedRequestToken
76
76
  ? "verified-control-plane"
77
77
  : hostToken
78
78
  ? "host-env"
79
- : envToken
80
- ? "env"
81
- : "none";
82
- const projectRef = reqCtx?.projectId || reqCtx?.projectSlug ||
79
+ : reqCtx?.token
80
+ ? "request"
81
+ : envToken
82
+ ? "env"
83
+ : "none";
84
+ const projectRef = verifiedCredential?.projectId || verifiedCredential?.projectSlug ||
85
+ reqCtx?.projectId || reqCtx?.projectSlug ||
83
86
  tryGetCacheKeyContext()?.projectId || null;
84
87
  if (!token || !projectRef) {
85
88
  logger.debug("Missing auth or project context", {
@@ -0,0 +1,8 @@
1
+ import { type VerifiedControlPlaneCacheCredential, type VerifiedControlPlaneRequestClaims } from "../internal-agents/control-plane-auth.js";
2
+ /**
3
+ * Runs framework work with the exact cache API credential from a verified
4
+ * control-plane request body. Keep this helper on internal import surfaces.
5
+ */
6
+ export declare function runWithVerifiedCacheApiCredential<T>(claims: VerifiedControlPlaneRequestClaims, fn: () => T): T;
7
+ export declare function getVerifiedCacheApiCredential(): VerifiedControlPlaneCacheCredential | undefined;
8
+ //# sourceMappingURL=verified-api-credential-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verified-api-credential-context.d.ts","sourceRoot":"","sources":["../../../src/src/cache/verified-api-credential-context.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,mCAAmC,EACxC,KAAK,iCAAiC,EACvC,MAAM,0CAA0C,CAAC;AAMlD;;;GAGG;AACH,wBAAgB,iCAAiC,CAAC,CAAC,EACjD,MAAM,EAAE,iCAAiC,EACzC,EAAE,EAAE,MAAM,CAAC,GACV,CAAC,CAKH;AAED,wBAAgB,6BAA6B,IACzC,mCAAmC,GACnC,SAAS,CAEZ"}
@@ -0,0 +1,13 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ import { consumeVerifiedControlPlaneCacheCredential, } from "../internal-agents/control-plane-auth.js";
3
+ const verifiedCredentialStorage = new AsyncLocalStorage();
4
+ /**
5
+ * Runs framework work with the exact cache API credential from a verified
6
+ * control-plane request body. Keep this helper on internal import surfaces.
7
+ */
8
+ export function runWithVerifiedCacheApiCredential(claims, fn) {
9
+ return verifiedCredentialStorage.run(consumeVerifiedControlPlaneCacheCredential(claims), fn);
10
+ }
11
+ export function getVerifiedCacheApiCredential() {
12
+ return verifiedCredentialStorage.getStore() || undefined;
13
+ }
@@ -11,20 +11,20 @@ export declare const CONTROL_PLANE_RUN_STREAM_PATH = "/api/control-plane/runs/:r
11
11
  /** Allowed control-plane surfaces — source of truth for the schema and {@link ControlPlaneSurface}. */
12
12
  export declare const CONTROL_PLANE_SURFACES: readonly ["studio", "channels", "a2a", "mcp"];
13
13
  /** Zod schema for get control plane surface. */
14
- export declare const getControlPlaneSurfaceSchema: () => Schema<"mcp" | "channels" | "studio" | "a2a">;
14
+ export declare const getControlPlaneSurfaceSchema: () => Schema<"mcp" | "studio" | "channels" | "a2a">;
15
15
  /** Zod schema for control plane surface. */
16
- export declare const ControlPlaneSurfaceSchema: Schema<"mcp" | "channels" | "studio" | "a2a">;
16
+ export declare const ControlPlaneSurfaceSchema: Schema<"mcp" | "studio" | "channels" | "a2a">;
17
17
  /** Zod schema for get control plane agents list request. */
18
18
  export declare const getControlPlaneAgentsListRequestSchema: () => Schema<import("../extensions/schema/schema-validator.js").InferShape<{
19
19
  requestId: Schema<string>;
20
20
  projectId: Schema<string>;
21
- surface: Schema<"mcp" | "channels" | "studio" | "a2a">;
21
+ surface: Schema<"mcp" | "studio" | "channels" | "a2a">;
22
22
  }>>;
23
23
  /** Zod schema for control plane agents list request. */
24
24
  export declare const ControlPlaneAgentsListRequestSchema: Schema<import("../extensions/schema/schema-validator.js").InferShape<{
25
25
  requestId: Schema<string>;
26
26
  projectId: Schema<string>;
27
- surface: Schema<"mcp" | "channels" | "studio" | "a2a">;
27
+ surface: Schema<"mcp" | "studio" | "channels" | "a2a">;
28
28
  }>>;
29
29
  /** Zod schema for get runtime agent skill. */
30
30
  export declare const getRuntimeAgentSkillSchema: () => Schema<import("../extensions/schema/schema-validator.js").InferShape<{
@@ -236,7 +236,7 @@ declare const getControlPlaneClaimsSchema: () => Schema<import("../extensions/sc
236
236
  iss: Schema<string>;
237
237
  aud: Schema<string>;
238
238
  sub: Schema<string>;
239
- surface: Schema<"mcp" | "channels" | "studio" | "a2a">;
239
+ surface: Schema<"mcp" | "studio" | "channels" | "a2a">;
240
240
  project_id: Schema<string>;
241
241
  request_hash: Schema<string>;
242
242
  iat: Schema<number>;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * CSS Import Extraction
3
+ *
4
+ * Pure helpers for discovering CSS files imported by project source modules
5
+ * (side-effect imports like `import "./styles.css"` in app/layout.tsx, `@/`
6
+ * alias imports, and CSS module imports).
7
+ *
8
+ * The production SSR pipeline collects CSS imports while loading modules and
9
+ * merges them into the page stylesheet. Two other stylesheet producers have no
10
+ * module-loading pass and recover the same information with these helpers:
11
+ * the dev/preview /_vf_styles/styles.css route and the release-asset build
12
+ * executor.
13
+ *
14
+ * Extraction is intentionally text-based (like Tailwind candidate scanning):
15
+ * it must stay cheap enough to run on every stylesheet compile and must not
16
+ * depend on bundler/parser extensions being registered. Unresolvable or
17
+ * unreadable specifiers are skipped downstream, so over-matching is harmless.
18
+ *
19
+ * @module html/styles-builder/css-import-extraction
20
+ */
21
+ /** Module extensions whose sources can carry CSS imports. */
22
+ export declare const CSS_IMPORTING_SOURCE_EXTENSIONS: string[];
23
+ /** Extract the raw specifiers of all static CSS imports in a source file. */
24
+ export declare function extractCssImportSpecifiers(source: string): string[];
25
+ /**
26
+ * Resolve a CSS import specifier to an absolute project path.
27
+ * Supports `./`/`../` (relative to the importing file) and the `@/` project
28
+ * alias. Bare and URL specifiers are ignored. Returns null when the resolved
29
+ * path would escape the project directory.
30
+ */
31
+ export declare function resolveCssImportPath(specifier: string, importerPath: string, projectDir: string): string | null;
32
+ /**
33
+ * Collect the resolved absolute paths of all CSS files imported by the given
34
+ * source files, deduplicated and sorted for deterministic output.
35
+ */
36
+ export declare function collectCssImportPaths(files: Iterable<{
37
+ path: string;
38
+ content: string;
39
+ }>, projectDir: string): string[];
40
+ //# sourceMappingURL=css-import-extraction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css-import-extraction.d.ts","sourceRoot":"","sources":["../../../../src/src/html/styles-builder/css-import-extraction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,6DAA6D;AAC7D,eAAO,MAAM,+BAA+B,UAAyC,CAAC;AAUtF,6EAA6E;AAC7E,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAMnE;AAkBD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,MAAM,GAAG,IAAI,CAmBf;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,EAClD,UAAU,EAAE,MAAM,GACjB,MAAM,EAAE,CAcV"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * CSS Import Extraction
3
+ *
4
+ * Pure helpers for discovering CSS files imported by project source modules
5
+ * (side-effect imports like `import "./styles.css"` in app/layout.tsx, `@/`
6
+ * alias imports, and CSS module imports).
7
+ *
8
+ * The production SSR pipeline collects CSS imports while loading modules and
9
+ * merges them into the page stylesheet. Two other stylesheet producers have no
10
+ * module-loading pass and recover the same information with these helpers:
11
+ * the dev/preview /_vf_styles/styles.css route and the release-asset build
12
+ * executor.
13
+ *
14
+ * Extraction is intentionally text-based (like Tailwind candidate scanning):
15
+ * it must stay cheap enough to run on every stylesheet compile and must not
16
+ * depend on bundler/parser extensions being registered. Unresolvable or
17
+ * unreadable specifiers are skipped downstream, so over-matching is harmless.
18
+ *
19
+ * @module html/styles-builder/css-import-extraction
20
+ */
21
+ import { isWithinDirectory, normalizePath } from "../../utils/path-utils.js";
22
+ /** Module extensions whose sources can carry CSS imports. */
23
+ export const CSS_IMPORTING_SOURCE_EXTENSIONS = [".tsx", ".jsx", ".mdx", ".ts", ".js"];
24
+ /**
25
+ * Static ESM import statements whose specifier ends in `.css`:
26
+ * import "./styles.css";
27
+ * import styles from "./button.module.css";
28
+ * `[^'";]*` keeps the match from crossing statement boundaries.
29
+ */
30
+ const CSS_IMPORT_RE = /import[^'";]*['"]([^'"]+\.css)['"]/g;
31
+ /** Extract the raw specifiers of all static CSS imports in a source file. */
32
+ export function extractCssImportSpecifiers(source) {
33
+ const specifiers = [];
34
+ for (const match of source.matchAll(CSS_IMPORT_RE)) {
35
+ if (match[1])
36
+ specifiers.push(match[1]);
37
+ }
38
+ return specifiers;
39
+ }
40
+ /** Resolve `.`/`..` segments; returns null if the path escapes its root. */
41
+ function collapseSegments(path) {
42
+ const segments = path.split("/");
43
+ const out = [];
44
+ for (const segment of segments) {
45
+ if (segment === "." || (segment === "" && out.length > 0))
46
+ continue;
47
+ if (segment === "..") {
48
+ if (out.length <= 1)
49
+ return null;
50
+ out.pop();
51
+ continue;
52
+ }
53
+ out.push(segment);
54
+ }
55
+ return out.join("/") || "/";
56
+ }
57
+ /**
58
+ * Resolve a CSS import specifier to an absolute project path.
59
+ * Supports `./`/`../` (relative to the importing file) and the `@/` project
60
+ * alias. Bare and URL specifiers are ignored. Returns null when the resolved
61
+ * path would escape the project directory.
62
+ */
63
+ export function resolveCssImportPath(specifier, importerPath, projectDir) {
64
+ const normalizedImporter = normalizePath(importerPath);
65
+ const normalizedProjectDir = normalizePath(projectDir);
66
+ let candidate;
67
+ if (specifier.startsWith("./") || specifier.startsWith("../")) {
68
+ const dirEnd = normalizedImporter.lastIndexOf("/");
69
+ if (dirEnd <= 0)
70
+ return null;
71
+ candidate = `${normalizedImporter.slice(0, dirEnd)}/${specifier}`;
72
+ }
73
+ else if (specifier.startsWith("@/")) {
74
+ candidate = `${normalizedProjectDir}/${specifier.slice(2)}`;
75
+ }
76
+ else {
77
+ return null;
78
+ }
79
+ const collapsed = collapseSegments(normalizePath(candidate));
80
+ if (!collapsed)
81
+ return null;
82
+ if (!isWithinDirectory(normalizedProjectDir, collapsed))
83
+ return null;
84
+ return collapsed;
85
+ }
86
+ /**
87
+ * Collect the resolved absolute paths of all CSS files imported by the given
88
+ * source files, deduplicated and sorted for deterministic output.
89
+ */
90
+ export function collectCssImportPaths(files, projectDir) {
91
+ const cssImports = new Set();
92
+ for (const file of files) {
93
+ // Cheap pre-filter before running the regex against large files.
94
+ if (!file.content.includes(".css"))
95
+ continue;
96
+ for (const specifier of extractCssImportSpecifiers(file.content)) {
97
+ const resolved = resolveCssImportPath(specifier, file.path, projectDir);
98
+ if (resolved)
99
+ cssImports.add(resolved);
100
+ }
101
+ }
102
+ return [...cssImports].sort();
103
+ }
@@ -1,5 +1,15 @@
1
- import { type ControlPlaneSurface } from "../channels/control-plane.js";
1
+ import { type ControlPlaneClaims, type ControlPlaneSurface } from "../channels/control-plane.js";
2
2
  import type { HandlerContext } from "../types/index.js";
3
+ declare const verifiedControlPlaneRequestBrand: unique symbol;
4
+ export type VerifiedControlPlaneRequestClaims = ControlPlaneClaims & {
5
+ readonly [verifiedControlPlaneRequestBrand]: true;
6
+ };
7
+ export interface VerifiedControlPlaneCacheCredential {
8
+ readonly token: string;
9
+ readonly projectId: string;
10
+ readonly projectSlug: string;
11
+ }
12
+ export declare function consumeVerifiedControlPlaneCacheCredential(claims: VerifiedControlPlaneRequestClaims): VerifiedControlPlaneCacheCredential | null;
3
13
  export declare class ControlPlaneRequestError extends Error {
4
14
  readonly status: number;
5
15
  constructor(status: number, message: string);
@@ -8,14 +18,6 @@ export declare function getControlPlaneVerificationPublicKey(ctx: HandlerContext
8
18
  export declare function verifyControlPlaneRequest(req: Request, ctx: HandlerContext, rawBody: string, options?: {
9
19
  expectedSubject?: string;
10
20
  expectedSurface?: ControlPlaneSurface;
11
- }): Promise<import("../extensions/schema/schema-validator.js").InferShape<{
12
- iss: import("./schema.js").Schema<string>;
13
- aud: import("./schema.js").Schema<string>;
14
- sub: import("./schema.js").Schema<string>;
15
- surface: import("./schema.js").Schema<"mcp" | "channels" | "studio" | "a2a">;
16
- project_id: import("./schema.js").Schema<string>;
17
- request_hash: import("./schema.js").Schema<string>;
18
- iat: import("./schema.js").Schema<number>;
19
- exp: import("./schema.js").Schema<number>;
20
- }>>;
21
+ }): Promise<VerifiedControlPlaneRequestClaims>;
22
+ export {};
21
23
  //# sourceMappingURL=control-plane-auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-plane-auth.d.ts","sourceRoot":"","sources":["../../../src/src/internal-agents/control-plane-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAQxD,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK5C;AAED,wBAAgB,oCAAoC,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAM5F;AAED,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;IACP,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,mBAAmB,CAAC;CAClC;;;;;;;;;IA2CP"}
1
+ {"version":3,"file":"control-plane-auth.d.ts","sourceRoot":"","sources":["../../../src/src/internal-agents/control-plane-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EAEzB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AASxD,OAAO,CAAC,MAAM,gCAAgC,EAAE,OAAO,MAAM,CAAC;AAE9D,MAAM,MAAM,iCAAiC,GAAG,kBAAkB,GAAG;IACnE,QAAQ,CAAC,CAAC,gCAAgC,CAAC,EAAE,IAAI,CAAC;CACnD,CAAC;AAEF,MAAM,WAAW,mCAAmC;IAClD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAoCD,wBAAgB,0CAA0C,CACxD,MAAM,EAAE,iCAAiC,GACxC,mCAAmC,GAAG,IAAI,CAK5C;AAED,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK5C;AAED,wBAAgB,oCAAoC,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAM5F;AAED,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;IACP,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,mBAAmB,CAAC;CAClC,GACL,OAAO,CAAC,iCAAiC,CAAC,CAsE5C"}
@@ -4,7 +4,36 @@ import { serverLogger } from "../utils/index.js";
4
4
  import { HTTP_INTERNAL_SERVER_ERROR } from "../utils/constants/index.js";
5
5
  const CONTROL_PLANE_JWS_HEADER = "x-veryfront-control-plane-jws";
6
6
  const MAX_CONTROL_PLANE_SIGNATURE_AGE_SECONDS = 60;
7
+ const CONTROL_PLANE_SIGNING_KEY_ENV = "CHANNEL_DISPATCH_SIGNING_PUBLIC_KEY";
7
8
  const logger = serverLogger.component("internal-agents-auth");
9
+ const verifiedCacheCredentials = new WeakMap();
10
+ function extractVerifiedCacheCredential(rawBody, claims) {
11
+ try {
12
+ const body = JSON.parse(rawBody);
13
+ const credentials = body.credentials;
14
+ if (!credentials || typeof credentials !== "object" || Array.isArray(credentials)) {
15
+ return null;
16
+ }
17
+ const token = credentials.authToken;
18
+ if (typeof token !== "string" || token.length === 0)
19
+ return null;
20
+ return Object.freeze({
21
+ token,
22
+ projectId: claims.project_id,
23
+ projectSlug: claims.aud,
24
+ });
25
+ }
26
+ catch {
27
+ return null;
28
+ }
29
+ }
30
+ export function consumeVerifiedControlPlaneCacheCredential(claims) {
31
+ const grant = verifiedCacheCredentials.get(claims);
32
+ verifiedCacheCredentials.delete(claims);
33
+ if (!grant || grant.expiresAt <= Math.floor(Date.now() / 1000))
34
+ return null;
35
+ return grant.credential;
36
+ }
8
37
  export class ControlPlaneRequestError extends Error {
9
38
  status;
10
39
  constructor(status, message) {
@@ -17,10 +46,11 @@ export function getControlPlaneVerificationPublicKey(ctx) {
17
46
  // Project env overlays intentionally hide host secrets from request-scoped reads.
18
47
  // Control-plane verification is framework-owned config, so it must fall back to
19
48
  // the host environment when the runtime adapter env is overlay-aware.
20
- return ctx.adapter.env.get("CHANNEL_DISPATCH_SIGNING_PUBLIC_KEY") ??
21
- getHostEnv("CHANNEL_DISPATCH_SIGNING_PUBLIC_KEY");
49
+ return ctx.adapter.env.get(CONTROL_PLANE_SIGNING_KEY_ENV) ??
50
+ getHostEnv(CONTROL_PLANE_SIGNING_KEY_ENV);
22
51
  }
23
52
  export async function verifyControlPlaneRequest(req, ctx, rawBody, options = {}) {
53
+ const hostPublicKeyPem = getHostEnv(CONTROL_PLANE_SIGNING_KEY_ENV);
24
54
  const publicKeyPem = getControlPlaneVerificationPublicKey(ctx);
25
55
  if (!publicKeyPem) {
26
56
  throw new ControlPlaneRequestError(HTTP_INTERNAL_SERVER_ERROR, "Control-plane verification is not configured");
@@ -34,14 +64,35 @@ export async function verifyControlPlaneRequest(req, ctx, rawBody, options = {})
34
64
  throw new ControlPlaneRequestError(401, "Missing control-plane signature");
35
65
  }
36
66
  try {
37
- return await verifyControlPlaneJws(controlPlaneJws, rawBody, {
67
+ const verificationOptions = {
38
68
  audience: projectSlug,
39
69
  expectedProjectId: ctx.projectId,
40
70
  expectedSubject: options.expectedSubject,
41
71
  expectedSurface: options.expectedSurface,
42
72
  publicKeyPem,
43
73
  maxAgeSeconds: MAX_CONTROL_PLANE_SIGNATURE_AGE_SECONDS,
44
- });
74
+ };
75
+ const claims = await verifyControlPlaneJws(controlPlaneJws, rawBody, verificationOptions);
76
+ const verifiedClaims = claims;
77
+ let hostVerified = hostPublicKeyPem === publicKeyPem && Boolean(hostPublicKeyPem);
78
+ if (hostPublicKeyPem && !hostVerified) {
79
+ try {
80
+ await verifyControlPlaneJws(controlPlaneJws, rawBody, {
81
+ ...verificationOptions,
82
+ publicKeyPem: hostPublicKeyPem,
83
+ });
84
+ hostVerified = true;
85
+ }
86
+ catch {
87
+ // Compatibility verification can still succeed through the adapter,
88
+ // but only the host key may mint the cache credential capability.
89
+ }
90
+ }
91
+ verifiedCacheCredentials.set(verifiedClaims, Object.freeze({
92
+ credential: hostVerified ? extractVerifiedCacheCredential(rawBody, claims) : null,
93
+ expiresAt: claims.exp,
94
+ }));
95
+ return verifiedClaims;
45
96
  }
46
97
  catch (error) {
47
98
  // verifyControlPlaneJws performs only crypto and claim validation with no
@@ -2,9 +2,8 @@ import type { DirectoryEntry, FSAdapter, FSAdapterConfig } from "./types.js";
2
2
  import type { FileInfo, ResolveFileOptions } from "../../base.js";
3
3
  import { ProxyFSAdapterManager } from "./proxy-manager.js";
4
4
  import type { VeryfrontFSAdapter } from "./adapter.js";
5
- import { type RequestTokenTrust } from "./request-context.js";
6
5
  export { clearRequestScopedFileCache, getCurrentRequestContext, getRequestScopedFile, runWithRequestContext, setRequestScopedFile, wrapWithCurrentContext, } from "./request-context.js";
7
- export type { RequestContext, RequestTokenTrust } from "./request-context.js";
6
+ export type { RequestContext } from "./request-context.js";
8
7
  export declare class MultiProjectFSAdapter implements FSAdapter {
9
8
  private manager;
10
9
  private defaultAdapter?;
@@ -14,7 +13,6 @@ export declare class MultiProjectFSAdapter implements FSAdapter {
14
13
  releaseId?: string | null;
15
14
  branch?: string | null;
16
15
  environmentName?: string | null;
17
- tokenTrust?: RequestTokenTrust;
18
16
  }): Promise<T>;
19
17
  setRequestContext(projectSlug: string, token: string): void;
20
18
  setProductionMode(_enabled: boolean, _releaseId?: string | null): void;
@@ -1 +1 @@
1
- {"version":3,"file":"multi-project-adapter.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/multi-project-adapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAQ9E,qBAAa,qBAAsB,YAAW,SAAS;IACrD,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,cAAc,CAAC,CAAqB;gBAEhC,MAAM,EAAE,eAAe;I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E,MAAM,EAChB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAKnB,qBAAqB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY3D,OAAO,IAAI,IAAI;IAOf,eAAe,IAAI,UAAU,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAI1D,cAAc,IAAI,OAAO,CAAC,UAAU,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC,GAAG,SAAS,CAAC;IAUvF,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAUpE,iBAAiB,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAoB9E;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,qBAAqB,CAExF"}
1
+ {"version":3,"file":"multi-project-adapter.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/multi-project-adapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAOvD,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAQ3D,qBAAa,qBAAsB,YAAW,SAAS;IACr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G,aAAa,CAAC,cAAc,CAAC;IAOrD,WAAW,CACf,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAKnB,qBAAqB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY3D,OAAO,IAAI,IAAI;IAOf,eAAe,IAAI,UAAU,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAI1D,cAAc,IAAI,OAAO,CAAC,UAAU,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC,GAAG,SAAS,CAAC;IAUvF,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAUpE,iBAAiB,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAoB9E;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,qBAAqB,CAExF"}
@@ -40,7 +40,6 @@ export class MultiProjectFSAdapter {
40
40
  projectSlug,
41
41
  projectId,
42
42
  token,
43
- tokenTrust: options?.tokenTrust,
44
43
  productionMode,
45
44
  releaseId: productionMode ? releaseId : null,
46
45
  branch: productionMode ? null : branch,
@@ -72,7 +71,6 @@ export class MultiProjectFSAdapter {
72
71
  return;
73
72
  store.projectSlug = projectSlug;
74
73
  store.token = token;
75
- store.tokenTrust = undefined;
76
74
  }
77
75
  setProductionMode(_enabled, _releaseId) {
78
76
  // No-op: In proxy mode, productionMode/releaseId are passed via runWithContext().
@@ -1,11 +1,8 @@
1
1
  import { AsyncLocalStorage } from "node:async_hooks";
2
- export type RequestTokenTrust = "verified-control-plane";
3
2
  export interface RequestContext {
4
3
  projectSlug: string;
5
4
  projectId?: string;
6
5
  token: string;
7
- /** Trust marker set only after the control-plane request signature is verified. */
8
- tokenTrust?: RequestTokenTrust;
9
6
  productionMode: boolean;
10
7
  /** Release ID for production mode (mutually exclusive with branch) */
11
8
  releaseId?: string | null;
@@ -43,7 +40,6 @@ export declare function clearRequestScopedFileCache(): number;
43
40
  export declare function runWithRequestContext<T>(options: {
44
41
  projectSlug: string;
45
42
  token: string;
46
- tokenTrust?: RequestTokenTrust;
47
43
  projectId?: string;
48
44
  productionMode?: boolean;
49
45
  releaseId?: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"request-context.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/request-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAEzD,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,2EAA2E;IAC3E,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;;OAIG;IACH,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,eAAO,MAAM,iBAAiB,mCAA0C,CAAC;AAEzE,wBAAgB,wBAAwB,IAAI,cAAc,GAAG,IAAI,CAEhE;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAOxF;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEzE;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAE5E;AAED,wBAAgB,2BAA2B,IAAI,MAAM,CAKpD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,OAAO,EAAE;IACP,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC,EACD,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAcZ;AAED;;;;GAIG;AACH,UAAU,2BAA2B;IACnC,wBAAwB,EAAE,MAAM,cAAc,GAAG,IAAI,CAAC;IACtD,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC/D,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClE,2BAA2B,EAAE,MAAM,MAAM,CAAC;CAC3C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,0BAA0B,EAAE,2BAA2B,GAAG,SAAS,CAAC;CACzE"}
1
+ {"version":3,"file":"request-context.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/request-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,WAAW,cAAc;I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,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAaZ;AAED;;;;GAIG;AACH,UAAU,2BAA2B;IACnC,wBAAwB,EAAE,MAAM,cAAc,GAAG,IAAI,CAAC;IACtD,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC/D,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClE,2BAA2B,EAAE,MAAM,MAAM,CAAC;CAC3C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,0BAA0B,EAAE,2BAA2B,GAAG,SAAS,CAAC;CACzE"}
@@ -43,7 +43,6 @@ export function runWithRequestContext(options, fn) {
43
43
  projectSlug: options.projectSlug,
44
44
  projectId: options.projectId,
45
45
  token: options.token,
46
- tokenTrust: options.tokenTrust,
47
46
  productionMode,
48
47
  releaseId: options.releaseId ?? null,
49
48
  branch: productionMode ? null : (options.branch ?? null),
@@ -1 +1 @@
1
- {"version":3,"file":"build-executor.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/build-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA+BH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA0B/C,MAAM,WAAW,sBAAsB;IACrC,yDAAyD;IACzD,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,yDAAyD;IACzD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,MAAM,EAAE,uBAAuB,CAAC;IAChC,sDAAsD;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AAG,OAAO,CAAC;IACV,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC5C,MAAM,EAAE,oBAAoB,EAAE,CAAC;IAC/B,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC,CAqCD;AA4DD;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,sBAAsB,EAC7B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,uBAAuB,CAAC,CA2ClC"}
1
+ {"version":3,"file":"build-executor.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/build-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAmCH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA0B/C,MAAM,WAAW,sBAAsB;IACrC,yDAAyD;IACzD,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,yDAAyD;IACzD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,MAAM,EAAE,uBAAuB,CAAC;IAChC,sDAAsD;IAEtD,OAAO,EAAE,GAAG,CAAC;IACb;;;;OAIG;IACH,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAClC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,gCAAgC,CAAC;CACtD;AAED,MAAM,MAAM,qBAAqB,GAAG,CAClC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAElB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,OAAO,CAA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../transforms/esm/lexer.js";
27
27
  import { getReactUrls } from "../transforms/esm/package-registry.js";
28
28
  import { PLATFORM_UTILITIES } from "../html/utils.js";
29
29
  import { extractCandidatesFromFiles } from "../html/styles-builder/candidate-extractor.js";
30
+ import { collectCssImportPaths, CSS_IMPORTING_SOURCE_EXTENSIONS, } from "../html/styles-builder/css-import-extraction.js";
30
31
  import { sha256HexBytes } from "./hash.js";
31
32
  import { RELEASE_ASSET_BASE_PATH, RELEASE_ASSET_CONTENT_TYPES, RELEASE_ASSET_DEPENDENCY_IMPORT_MAP_ENV_FLAG, RELEASE_ASSET_MANIFEST_SCHEMA_VERSION, RELEASE_ASSET_MAX_SIZE_BYTES, RELEASE_ASSET_UPLOAD_CONCURRENCY, releaseAssetUrl, } from "./constants.js";
32
33
  import { routeForPage } from "./route-path.js";
@@ -1168,7 +1169,8 @@ async function runBuildInner(input, tempDir, client, transform) {
1168
1169
  if (client.compileProjectCss) {
1169
1170
  try {
1170
1171
  const candidates = collectClassCandidates(sourceByPath);
1171
- const stylesheet = resolveProjectStylesheet(sourceByPath, input.stylesheetPath);
1172
+ const resolvedStylesheet = resolveProjectStylesheet(sourceByPath, input.stylesheetPath);
1173
+ const stylesheet = mergeModuleCssImports(sourceByPath, resolvedStylesheet);
1172
1174
  const compiled = await client.compileProjectCss(candidates, stylesheet);
1173
1175
  if (compiled && compiled.css) {
1174
1176
  const bytes = new TextEncoder().encode(compiled.css);
@@ -1300,10 +1302,47 @@ function resolveProjectStylesheet(sourceByPath, stylesheetPath) {
1300
1302
  for (const path of candidatePaths) {
1301
1303
  const content = sourceByPath.get(path);
1302
1304
  if (typeof content === "string")
1303
- return content;
1305
+ return { content, path };
1304
1306
  }
1305
1307
  return undefined;
1306
1308
  }
1309
+ /**
1310
+ * Merge plain CSS files imported by project modules (`import "./styles.css"`
1311
+ * in a layout or component) into the resolved stylesheet. The production SSR
1312
+ * pipeline includes these imports per page at render time; release assets are
1313
+ * compiled once per release, so the merge happens here instead — mirroring the
1314
+ * dev /_vf_styles route.
1315
+ *
1316
+ * `*.module.css` files are skipped: their class names are rewritten per-module
1317
+ * by the runtime, so inlining them raw would leak unscoped selectors.
1318
+ */
1319
+ function mergeModuleCssImports(sourceByPath, stylesheet) {
1320
+ const sourceFiles = [];
1321
+ for (const [path, content] of sourceByPath) {
1322
+ if (!CSS_IMPORTING_SOURCE_EXTENSIONS.some((ext) => path.endsWith(ext)))
1323
+ continue;
1324
+ // Resolution is rooted at "/" so relative and @/ specifiers resolve
1325
+ // against the release file set's project-relative paths.
1326
+ sourceFiles.push({ path: `/${path}`, content });
1327
+ }
1328
+ const segments = [];
1329
+ for (const importedPath of collectCssImportPaths(sourceFiles, "/")) {
1330
+ const relativePath = importedPath.replace(/^\/+/, "");
1331
+ if (relativePath === stylesheet?.path)
1332
+ continue;
1333
+ if (relativePath.endsWith(".module.css"))
1334
+ continue;
1335
+ const content = sourceByPath.get(relativePath);
1336
+ if (content)
1337
+ segments.push(content);
1338
+ }
1339
+ if (segments.length === 0)
1340
+ return stylesheet?.content;
1341
+ logger.debug("Merged module CSS imports into release stylesheet", {
1342
+ importedCount: segments.length,
1343
+ });
1344
+ return [stylesheet?.content, ...segments].filter(Boolean).join("\n");
1345
+ }
1307
1346
  /** Extract Tailwind class candidates from materialized source. */
1308
1347
  function collectClassCandidates(sourceByPath) {
1309
1348
  return extractCandidatesFromFiles([...sourceByPath.entries()].map(([path, content]) => ({ path, content })));
@@ -1,6 +1,6 @@
1
1
  import type { Handler, HandlerContext, HandlerMetadata, HandlerResult } from "../../types/index.js";
2
+ import type { VerifiedControlPlaneRequestClaims } from "../../internal-agents/control-plane-auth.js";
2
3
  import type { WebSocketUpgradeResponse } from "../../platform/adapters/base.js";
3
- import type { RequestTokenTrust } from "../../platform/adapters/fs/veryfront/request-context.js";
4
4
  import { ResponseBuilder } from "./response/index.js";
5
5
  export interface HandlerHelpers {
6
6
  createResponseBuilder: (ctx: HandlerContext, nonce?: string) => ResponseBuilder;
@@ -24,7 +24,7 @@ export declare abstract class BaseHandler implements Handler {
24
24
  protected respond(response: Response | WebSocketUpgradeResponse, metadata?: Record<string, unknown>): HandlerResult;
25
25
  protected withProxyContext<T>(ctx: HandlerContext, fn: () => Promise<T>, options?: {
26
26
  requireToken?: boolean;
27
- tokenTrust?: RequestTokenTrust;
27
+ verifiedControlPlaneClaims?: VerifiedControlPlaneRequestClaims;
28
28
  }): Promise<T>;
29
29
  }
30
30
  //# sourceMappingURL=base-handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-handler.d.ts","sourceRoot":"","sources":["../../../../src/src/security/http/base-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,eAAe,EACf,aAAa,EAEd,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAEjG,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,WAAW,cAAc;IAC7B,qBAAqB,EAAE,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,eAAe,CAAC;IAChF,OAAO,EAAE,CACP,QAAQ,EAAE,QAAQ,GAAG,wBAAwB,EAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC/B,aAAa,CAAC;IACnB,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAC3F,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC;IAC5C,QAAQ,EAAE,MAAM,aAAa,CAAC;CAC/B;AAED,8BAAsB,WAAY,YAAW,OAAO;IAClD,QAAQ,CAAC,QAAQ,E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fd"}
@@ -1,4 +1,5 @@
1
1
  import { runWithCacheBatching } from "../../cache/request-cache-batcher.js";
2
+ import { runWithVerifiedCacheApiCredential } from "../../cache/verified-api-credential-context.js";
2
3
  import { getHostEnv } from "../../platform/compat/process.js";
3
4
  import { serverLogger } from "../../utils/index.js";
4
5
  import { ResponseBuilder } from "./response/index.js";
@@ -67,6 +68,11 @@ export class BaseHandler {
67
68
  return { response: response, continue: false, metadata };
68
69
  }
69
70
  withProxyContext(ctx, fn, options = {}) {
71
+ if (options.verifiedControlPlaneClaims) {
72
+ return runWithVerifiedCacheApiCredential(options.verifiedControlPlaneClaims, () => this.withProxyContext(ctx, fn, {
73
+ requireToken: options.requireToken,
74
+ }));
75
+ }
70
76
  // Framework-owned token: bypass project env overlay so proxy mode works
71
77
  // when a remote project overlay is active.
72
78
  const effectiveToken = ctx.proxyToken || getHostEnv("VERYFRONT_API_TOKEN") || "";
@@ -106,7 +112,6 @@ export class BaseHandler {
106
112
  releaseId: ctx.releaseId,
107
113
  branch,
108
114
  environmentName: ctx.environmentName,
109
- tokenTrust: options.tokenTrust,
110
115
  });
111
116
  }
112
117
  if (typeof fsWrapper.setRequestToken === "function" && effectiveToken) {
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Styles CSS Import Scanner
3
+ *
4
+ * Discovers CSS files imported by project source modules (side-effect imports
5
+ * like `import "./styles.css"` in app/layout.tsx, `@/` alias imports, and CSS
6
+ * module imports). The production SSR pipeline collects these imports while
7
+ * loading modules and merges them into the page stylesheet; the page-agnostic
8
+ * /_vf_styles/styles.css dev route has no module-loading pass, so this scanner
9
+ * recovers the same information from project sources using the shared
10
+ * css-import-extraction helpers.
11
+ *
12
+ * @module server/handlers/dev/styles-css-import-scanner
13
+ */
14
+ import type { HandlerContext } from "../types.js";
15
+ /**
16
+ * Scan project source files for CSS imports and return the resolved absolute
17
+ * paths, deduplicated. Mirrors the file coverage of the Tailwind candidate
18
+ * scanner: the FS adapter's `getAllSourceFiles()` in proxy/remote mode, and a
19
+ * recursive local walk otherwise.
20
+ */
21
+ export declare function extractProjectCssImports(ctx: HandlerContext): Promise<string[]>;
22
+ //# sourceMappingURL=styles-css-import-scanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles-css-import-scanner.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/dev/styles-css-import-scanner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAeH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAUlD;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAYrF"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Styles CSS Import Scanner
3
+ *
4
+ * Discovers CSS files imported by project source modules (side-effect imports
5
+ * like `import "./styles.css"` in app/layout.tsx, `@/` alias imports, and CSS
6
+ * module imports). The production SSR pipeline collects these imports while
7
+ * loading modules and merges them into the page stylesheet; the page-agnostic
8
+ * /_vf_styles/styles.css dev route has no module-loading pass, so this scanner
9
+ * recovers the same information from project sources using the shared
10
+ * css-import-extraction helpers.
11
+ *
12
+ * @module server/handlers/dev/styles-css-import-scanner
13
+ */
14
+ import { serverLogger } from "../../../utils/index.js";
15
+ import { normalizePath } from "../../../utils/path-utils.js";
16
+ import { collectCssImportPaths, CSS_IMPORTING_SOURCE_EXTENSIONS, } from "../../../html/styles-builder/css-import-extraction.js";
17
+ import { createStyleScopeProfile, shouldIncludeStylePath, shouldTraverseStyleDirectory, } from "../../../html/styles-builder/style-scope-profile.js";
18
+ import { createFileSystem } from "../../../platform/compat/fs.js";
19
+ import { join } from "../../../platform/compat/path/index.js";
20
+ const logger = serverLogger.component("styles-css-import-scanner");
21
+ /**
22
+ * Scan project source files for CSS imports and return the resolved absolute
23
+ * paths, deduplicated. Mirrors the file coverage of the Tailwind candidate
24
+ * scanner: the FS adapter's `getAllSourceFiles()` in proxy/remote mode, and a
25
+ * recursive local walk otherwise.
26
+ */
27
+ export async function extractProjectCssImports(ctx) {
28
+ const files = await collectSourceFiles(ctx);
29
+ const cssImports = collectCssImportPaths(files, ctx.projectDir);
30
+ if (cssImports.length > 0) {
31
+ logger.debug("Discovered module CSS imports", {
32
+ projectDir: ctx.projectDir,
33
+ count: cssImports.length,
34
+ });
35
+ }
36
+ return cssImports;
37
+ }
38
+ async function collectSourceFiles(ctx) {
39
+ const wrappedFs = ctx.adapter.fs;
40
+ const fsAdapter = typeof wrappedFs.getUnderlyingAdapter === "function"
41
+ ? wrappedFs.getUnderlyingAdapter()
42
+ : undefined;
43
+ if (typeof fsAdapter?.getAllSourceFiles === "function") {
44
+ const files = await fsAdapter.getAllSourceFiles();
45
+ const collected = [];
46
+ for (const file of files) {
47
+ if (!CSS_IMPORTING_SOURCE_EXTENSIONS.some((ext) => file.path.endsWith(ext)))
48
+ continue;
49
+ const absolutePath = file.path.startsWith("/")
50
+ ? normalizePath(file.path)
51
+ : normalizePath(join(ctx.projectDir, file.path));
52
+ const content = file.content ?? await readFileOrNull(ctx, absolutePath);
53
+ if (content === null)
54
+ continue;
55
+ collected.push({ path: absolutePath, content });
56
+ }
57
+ return collected;
58
+ }
59
+ return scanLocalSourceFiles(ctx);
60
+ }
61
+ async function readFileOrNull(ctx, path) {
62
+ try {
63
+ return await ctx.adapter.fs.readFile(path);
64
+ }
65
+ catch (_) {
66
+ /* expected: skip files that can't be read */
67
+ return null;
68
+ }
69
+ }
70
+ /** Fallback for local development mode: walk the project directory on disk. */
71
+ async function scanLocalSourceFiles(ctx) {
72
+ const styleProfile = createStyleScopeProfile(ctx.config);
73
+ const fs = createFileSystem();
74
+ const collected = [];
75
+ const scanDir = async (dir) => {
76
+ let entries;
77
+ try {
78
+ entries = fs.readDir(dir);
79
+ }
80
+ catch (_) {
81
+ /* expected: directory may not exist */
82
+ return;
83
+ }
84
+ for await (const entry of entries) {
85
+ const fullPath = join(dir, entry.name);
86
+ if (entry.isDirectory) {
87
+ if (shouldTraverseStyleDirectory(styleProfile, fullPath, ctx.projectDir)) {
88
+ await scanDir(fullPath);
89
+ }
90
+ continue;
91
+ }
92
+ if (!entry.isFile)
93
+ continue;
94
+ if (!shouldIncludeStylePath(styleProfile, fullPath, ctx.projectDir))
95
+ continue;
96
+ if (!CSS_IMPORTING_SOURCE_EXTENSIONS.some((ext) => entry.name.endsWith(ext)))
97
+ continue;
98
+ const content = await readFileOrNull(ctx, fullPath);
99
+ if (content === null)
100
+ continue;
101
+ collected.push({ path: normalizePath(fullPath), content });
102
+ }
103
+ };
104
+ try {
105
+ await scanDir(ctx.projectDir);
106
+ }
107
+ catch (error) {
108
+ logger.warn("Failed to scan local files for CSS imports", {
109
+ projectDir: ctx.projectDir,
110
+ error: error instanceof Error ? error.message : String(error),
111
+ });
112
+ }
113
+ return collected;
114
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"styles-css.handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/dev/styles-css.handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAiCnG,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,QAAQ,EAAE,eAAe,CAKvB;IAEI,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;YAkLzD,cAAc;IAkB5B,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,wBAAwB;IA0BhC,OAAO,CAAC,4BAA4B;YA2CtB,2BAA2B;YAoD3B,oBAAoB;YASpB,2BAA2B;IA2BzC,OAAO,CAAC,oCAAoC;YAI9B,4BAA4B;CAsB3C"}
1
+ {"version":3,"file":"styles-css.handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/dev/styles-css.handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAmCnG,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,QAAQ,EAAE,eAAe,CAKvB;IAEI,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;YAgNzD,cAAc;IAkB5B,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,wBAAwB;IA0BhC,OAAO,CAAC,4BAA4B;YA2CtB,2BAA2B;YAoD3B,oBAAoB;YASpB,2BAA2B;IA2BzC,OAAO,CAAC,oCAAoC;YAI9B,4BAA4B;CAsB3C"}
@@ -14,6 +14,8 @@ import { createPreparedProjectCSSContext, storePreparedProjectCSS, tryGetPrepare
14
14
  import { createStyleScopeProfile } from "../../../html/styles-builder/style-scope-profile.js";
15
15
  import { serverLogger } from "../../../utils/index.js";
16
16
  import { extractProjectCandidates } from "./styles-candidate-scanner.js";
17
+ import { extractProjectCssImports } from "./styles-css-import-scanner.js";
18
+ import { mergeImportedCSS } from "../../../rendering/orchestrator/html-imported-css.js";
17
19
  import { profilePhase } from "../../../observability/request-profiler.js";
18
20
  const logger = serverLogger.component("styles-css-handler");
19
21
  export class StylesCSSHandler extends BaseHandler {
@@ -42,6 +44,31 @@ export class StylesCSSHandler extends BaseHandler {
42
44
  });
43
45
  rawCss = DEFAULT_STYLESHEET;
44
46
  }
47
+ // Production SSR merges CSS imported by modules (`import "./styles.css"`
48
+ // in a layout) into the page stylesheet during module loading. This
49
+ // route has no module-loading pass, so discover those imports from the
50
+ // project sources and merge them here. Runs before the prepared-CSS
51
+ // context is created so cache keys reflect the merged stylesheet.
52
+ try {
53
+ const cssImports = await profilePhase("css.scan_css_imports", () => extractProjectCssImports(ctx));
54
+ if (cssImports.length > 0) {
55
+ const merged = await profilePhase("css.merge_imported_css", () => mergeImportedCSS({
56
+ fs: ctx.adapter.fs,
57
+ logger,
58
+ projectDir: ctx.projectDir,
59
+ globalCSS: rawCss,
60
+ cssImports,
61
+ stylesheetPath: ctx.config?.tailwind?.stylesheet ?? "globals.css",
62
+ }));
63
+ if (merged)
64
+ rawCss = merged;
65
+ }
66
+ }
67
+ catch (error) {
68
+ logger.error("Failed to merge module CSS imports", {
69
+ error: error instanceof Error ? error.message : String(error),
70
+ });
71
+ }
45
72
  const preparedContext = this.createPreparedCSSContext(projectScope, rawCss, styleProfile.hash, contentContext, ctx);
46
73
  if (preparedContext) {
47
74
  const prepared = await profilePhase("css.prepared_cache_lookup", () => tryGetPreparedProjectCSS(preparedContext));
@@ -1 +1 @@
1
- {"version":3,"file":"agent-stream.handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/request/agent-stream.handler.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAEpF,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,wCAAwC,CAAC;AAQhD,OAAO,EACL,4BAA4B,EAE7B,MAAM,2CAA2C,CAAC;AAyBnD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAcnG,MAAM,WAAW,sBACf,SAAQ,yBAAyB,EAAE,+BAA+B;IAClE,4BAA4B,CAAC,EAAE,OAAO,4BAA4B,CAAC;IACnE,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,+BAA+B,CAAC,YAAY,CAAC,CAAC;CACpF;AA6gBD,qBAAa,kBAAmB,SAAQ,WAAW;IASrC,OAAO,CAAC,QAAQ,CAAC,IAAI;IARjC,QAAQ,EAAE,eAAe,CAMvB;gBAE2B,IAAI,GAAE,sBAAoC;IAIvE,OAAO,CAAC,sBAAsB;IAwBxB,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAqMxE"}
1
+ {"version":3,"file":"agent-stream.handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/request/agent-stream.handler.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAEpF,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,wCAAwC,CAAC;AAQhD,OAAO,EACL,4BAA4B,EAE7B,MAAM,2CAA2C,CAAC;AAyBnD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAcnG,MAAM,WAAW,sBACf,SAAQ,yBAAyB,EAAE,+BAA+B;IAClE,4BAA4B,CAAC,EAAE,OAAO,4BAA4B,CAAC;IACnE,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,+BAA+B,CAAC,YAAY,CAAC,CAAC;CACpF;AAwgBD,qBAAa,kBAAmB,SAAQ,WAAW;IASrC,OAAO,CAAC,QAAQ,CAAC,IAAI;IARjC,QAAQ,EAAE,eAAe,CAMvB;gBAE2B,IAAI,GAAE,sBAAoC;IAIvE,OAAO,CAAC,sBAAsB;IAwBxB,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAqMxE"}
@@ -339,20 +339,17 @@ function buildAgentSourceRunOptions(sourceContext) {
339
339
  return {
340
340
  productionMode: false,
341
341
  branch: sourceContext.branch,
342
- tokenTrust: "verified-control-plane",
343
342
  };
344
343
  case "environment":
345
344
  return {
346
345
  productionMode: true,
347
346
  environmentName: sourceContext.environmentName,
348
347
  releaseId: sourceContext.releaseId ?? null,
349
- tokenTrust: "verified-control-plane",
350
348
  };
351
349
  case "release":
352
350
  return {
353
351
  productionMode: true,
354
352
  releaseId: sourceContext.releaseId,
355
- tokenTrust: "verified-control-plane",
356
353
  };
357
354
  }
358
355
  }
@@ -436,7 +433,7 @@ export class AgentStreamHandler extends BaseHandler {
436
433
  if (!pathRunId || pathRunId !== payload.runId) {
437
434
  return this.respond(builder.json({ error: "CONTROL_PLANE_RUN_ID_MISMATCH" }, 400));
438
435
  }
439
- await verifyControlPlaneRequest(req, ctx, rawBody, {
436
+ const verifiedClaims = await verifyControlPlaneRequest(req, ctx, rawBody, {
440
437
  expectedSubject: payload.runId,
441
438
  expectedSurface: "studio",
442
439
  });
@@ -541,7 +538,7 @@ export class AgentStreamHandler extends BaseHandler {
541
538
  ? setResponseHeader(response, RUNTIME_OWNER_INVOKE_URL_HEADER, runtimeOwnerInvokeUrl)
542
539
  : response;
543
540
  return this.respond(applyBuilderHeaders(responseWithOwner, builder.headers));
544
- }), { tokenTrust: "verified-control-plane" });
541
+ }), { verifiedControlPlaneClaims: verifiedClaims });
545
542
  }
546
543
  catch (error) {
547
544
  if (error instanceof InternalAgentRequestBodyTooLargeError) {
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.1049";
2
+ export declare const VERSION = "0.1.1051";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.1049";
4
+ export const VERSION = "0.1.1051";
@@ -82,7 +82,7 @@ export declare const getCheckpointSchema: () => import("../../internal-agents/sc
82
82
  /**
83
83
  * Approval status schema
84
84
  */
85
- export declare const getApprovalStatusSchema: () => import("../../internal-agents/schema.js").Schema<"rejected" | "pending" | "approved" | "expired">;
85
+ export declare const getApprovalStatusSchema: () => import("../../internal-agents/schema.js").Schema<"pending" | "rejected" | "approved" | "expired">;
86
86
  /**
87
87
  * Pending approval schema
88
88
  */
@@ -94,7 +94,7 @@ export declare const getPendingApprovalSchema: () => import("../../internal-agen
94
94
  approvers: import("../../internal-agents/schema.js").Schema<string[] | undefined>;
95
95
  requestedAt: import("../../internal-agents/schema.js").Schema<Date>;
96
96
  expiresAt: import("../../internal-agents/schema.js").Schema<Date | undefined>;
97
- status: import("../../internal-agents/schema.js").Schema<"rejected" | "pending" | "approved" | "expired">;
97
+ status: import("../../internal-agents/schema.js").Schema<"pending" | "rejected" | "approved" | "expired">;
98
98
  decidedBy: import("../../internal-agents/schema.js").Schema<string | undefined>;
99
99
  decidedAt: import("../../internal-agents/schema.js").Schema<Date | undefined>;
100
100
  comment: import("../../internal-agents/schema.js").Schema<string | undefined>;
@@ -193,7 +193,7 @@ export declare const CheckpointSchema: import("../../internal-agents/schema.js")
193
193
  completedAt: import("../../internal-agents/schema.js").Schema<Date | undefined>;
194
194
  }>>>;
195
195
  }>>;
196
- export declare const ApprovalStatusSchema: import("../../internal-agents/schema.js").Schema<"rejected" | "pending" | "approved" | "expired">;
196
+ export declare const ApprovalStatusSchema: import("../../internal-agents/schema.js").Schema<"pending" | "rejected" | "approved" | "expired">;
197
197
  export declare const PendingApprovalSchema: import("../../internal-agents/schema.js").Schema<import("../../extensions/schema/schema-validator.js").InferShape<{
198
198
  id: import("../../internal-agents/schema.js").Schema<string>;
199
199
  nodeId: import("../../internal-agents/schema.js").Schema<string>;
@@ -202,7 +202,7 @@ export declare const PendingApprovalSchema: import("../../internal-agents/schema
202
202
  approvers: import("../../internal-agents/schema.js").Schema<string[] | undefined>;
203
203
  requestedAt: import("../../internal-agents/schema.js").Schema<Date>;
204
204
  expiresAt: import("../../internal-agents/schema.js").Schema<Date | undefined>;
205
- status: import("../../internal-agents/schema.js").Schema<"rejected" | "pending" | "approved" | "expired">;
205
+ status: import("../../internal-agents/schema.js").Schema<"pending" | "rejected" | "approved" | "expired">;
206
206
  decidedBy: import("../../internal-agents/schema.js").Schema<string | undefined>;
207
207
  decidedAt: import("../../internal-agents/schema.js").Schema<Date | undefined>;
208
208
  comment: import("../../internal-agents/schema.js").Schema<string | undefined>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.1049",
3
+ "version": "0.1.1051",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",
@@ -329,9 +329,10 @@
329
329
  "@types/react": "19.2.14",
330
330
  "@types/react-dom": "19.2.3",
331
331
  "ws": "8.21.0",
332
- "@veryfront/ext-bundler-esbuild": "0.1.1049",
333
- "@veryfront/ext-content-mdx": "0.1.1049",
334
- "@veryfront/ext-css-tailwind": "0.1.1049"
332
+ "@veryfront/ext-bundler-esbuild": "0.1.1051",
333
+ "@veryfront/ext-content-mdx": "0.1.1051",
334
+ "@veryfront/ext-css-tailwind": "0.1.1051",
335
+ "@veryfront/ext-parser-babel": "0.1.1051"
335
336
  },
336
337
  "devDependencies": {
337
338
  "@types/node": "20.9.0"