veryfront 0.1.1237 → 0.1.1238

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 (37) hide show
  1. package/esm/cli/commands/build/error-handler.d.ts.map +1 -1
  2. package/esm/cli/commands/build/error-handler.js +41 -3
  3. package/esm/cli/commands/build/handler.d.ts.map +1 -1
  4. package/esm/cli/commands/build/handler.js +1 -1
  5. package/esm/cli/commands/dev/command.d.ts.map +1 -1
  6. package/esm/cli/commands/dev/command.js +14 -1
  7. package/esm/cli/commands/dev/inference-status.d.ts +6 -0
  8. package/esm/cli/commands/dev/inference-status.d.ts.map +1 -1
  9. package/esm/cli/commands/dev/inference-status.js +14 -2
  10. package/esm/cli/commands/generate/command.d.ts.map +1 -1
  11. package/esm/cli/commands/generate/command.js +62 -0
  12. package/esm/cli/shared/args.d.ts +5 -1
  13. package/esm/cli/shared/args.d.ts.map +1 -1
  14. package/esm/cli/shared/args.js +41 -1
  15. package/esm/deno.js +1 -1
  16. package/esm/src/agent/conversation/run-chunk-mirror.d.ts.map +1 -1
  17. package/esm/src/agent/conversation/run-chunk-mirror.js +14 -2
  18. package/esm/src/config/loader.d.ts.map +1 -1
  19. package/esm/src/config/loader.js +37 -1
  20. package/esm/src/html/hydration-script-builder/hydration-runtime.generated.js +1 -1
  21. package/esm/src/observability/application-errors.d.ts.map +1 -1
  22. package/esm/src/observability/application-errors.js +9 -1
  23. package/esm/src/platform/compat/http/pinned-fetch.d.ts +1 -1
  24. package/esm/src/rendering/orchestrator/css-candidate-manifest.d.ts.map +1 -1
  25. package/esm/src/rendering/orchestrator/css-candidate-manifest.js +30 -1
  26. package/esm/src/security/sandbox/worker-pool.d.ts.map +1 -1
  27. package/esm/src/security/sandbox/worker-pool.js +6 -1
  28. package/esm/src/server/bootstrap.d.ts.map +1 -1
  29. package/esm/src/server/bootstrap.js +6 -0
  30. package/esm/src/server/project-env/fetcher.d.ts.map +1 -1
  31. package/esm/src/server/project-env/fetcher.js +11 -11
  32. package/esm/src/server/project-env/internal-authorization.d.ts +7 -0
  33. package/esm/src/server/project-env/internal-authorization.d.ts.map +1 -0
  34. package/esm/src/server/project-env/internal-authorization.js +32 -0
  35. package/esm/src/utils/version-constant.d.ts +1 -1
  36. package/esm/src/utils/version-constant.js +1 -1
  37. package/package.json +8 -8
@@ -3,12 +3,12 @@
3
3
  *
4
4
  * @module server/project-env/fetcher
5
5
  */
6
- import { encodeBase64, getBaseLogger } from "../../utils/index.js";
6
+ import { getBaseLogger } from "../../utils/index.js";
7
7
  import { readResponseTextPrefix } from "../../utils/response-body.js";
8
- import { AUTHENTICATION_REQUIRED, isVeryfrontError, NETWORK_ERROR, PERMISSION_DENIED, } from "../../errors/index.js";
9
- import { getHostEnv } from "../../platform/compat/process.js";
8
+ import { AUTHENTICATION_REQUIRED, CONFIG_INVALID, isVeryfrontError, NETWORK_ERROR, PERMISSION_DENIED, } from "../../errors/index.js";
10
9
  import { isErrorAcrossRealms } from "../../platform/compat/error-introspection.js";
11
10
  import { createProjectEnvSnapshot } from "./snapshot.js";
11
+ import { getMissingProjectEnvInternalCredentialDetail, getProjectEnvInternalAuthorization, requiresProjectEnvInternalAuthorization, } from "./internal-authorization.js";
12
12
  const baseLogger = getBaseLogger("PROJECT-ENV");
13
13
  const logger = baseLogger.component("project-env");
14
14
  /** Max env vars per request. API enforces a hard cap of 100. */
@@ -92,13 +92,6 @@ function parseEnvironmentResponse(text) {
92
92
  throw invalidEnvironmentResponse("Project environment response violated runtime limits", cause);
93
93
  }
94
94
  }
95
- function getInternalAuthorization() {
96
- const username = getHostEnv("VERYFRONT_API_INTERNAL_USER");
97
- const password = getHostEnv("VERYFRONT_API_INTERNAL_PASS");
98
- if (!username || !password)
99
- return undefined;
100
- return `Basic ${encodeBase64(`${username}:${password}`)}`;
101
- }
102
95
  async function fetchEnvironmentVariables(url, authorization, projectSlug, environmentId, signal, headers = {}) {
103
96
  try {
104
97
  const requestHeaders = new Headers(headers);
@@ -171,7 +164,14 @@ export async function fetchProjectEnvVars(apiBaseUrl, projectSlug, environmentId
171
164
  }
172
165
  // Do not even materialize the host credential until the tenant credential
173
166
  // has proved access to this canonical project/environment pair.
174
- const internalAuthorization = getInternalAuthorization();
167
+ const internalAuthorization = getProjectEnvInternalAuthorization();
168
+ if (!internalAuthorization && requiresProjectEnvInternalAuthorization()) {
169
+ discardResponseBody(response);
170
+ throw CONFIG_INVALID.create({
171
+ detail: getMissingProjectEnvInternalCredentialDetail() ??
172
+ "Internal project environment authorization is unavailable in hosted proxy mode",
173
+ });
174
+ }
175
175
  if (internalAuthorization) {
176
176
  discardResponseBody(response);
177
177
  response = await fetchEnvironmentVariables(internalUrl, internalAuthorization, projectSlug, environmentId, signal, { "x-project-slug": projectSlug });
@@ -0,0 +1,7 @@
1
+ /** Whether project env reads require the hosted runtime's internal API credential. */
2
+ export declare function requiresProjectEnvInternalAuthorization(): boolean;
3
+ /** Name the missing hosted runtime credentials without exposing their values. */
4
+ export declare function getMissingProjectEnvInternalCredentialDetail(): string | undefined;
5
+ /** Build the internal API authorization header when both credentials are present. */
6
+ export declare function getProjectEnvInternalAuthorization(): string | undefined;
7
+ //# sourceMappingURL=internal-authorization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-authorization.d.ts","sourceRoot":"","sources":["../../../../src/src/server/project-env/internal-authorization.ts"],"names":[],"mappings":"AAQA,sFAAsF;AACtF,wBAAgB,uCAAuC,IAAI,OAAO,CAKjE;AAED,iFAAiF;AACjF,wBAAgB,4CAA4C,IAAI,MAAM,GAAG,SAAS,CAQjF;AAED,qFAAqF;AACrF,wBAAgB,kCAAkC,IAAI,MAAM,GAAG,SAAS,CAKvE"}
@@ -0,0 +1,32 @@
1
+ import { getHostEnv } from "../../platform/compat/process.js";
2
+ import { encodeBase64 } from "../../utils/index.js";
3
+ import { getEnvSource } from "../../utils/env-loader.js";
4
+ const INTERNAL_USER_ENV = "VERYFRONT_API_INTERNAL_USER";
5
+ const INTERNAL_PASS_ENV = "VERYFRONT_API_INTERNAL_PASS";
6
+ const LOCAL_CLI_PROXY_MODE_ENV = "VERYFRONT_CLI_LOCAL_PROXY_MODE";
7
+ /** Whether project env reads require the hosted runtime's internal API credential. */
8
+ export function requiresProjectEnvInternalAuthorization() {
9
+ if (getHostEnv("PROXY_MODE") !== "1")
10
+ return false;
11
+ const isLocalCliProxyMode = getHostEnv(LOCAL_CLI_PROXY_MODE_ENV) === "1" &&
12
+ getEnvSource(LOCAL_CLI_PROXY_MODE_ENV).source === "process";
13
+ return !isLocalCliProxyMode;
14
+ }
15
+ /** Name the missing hosted runtime credentials without exposing their values. */
16
+ export function getMissingProjectEnvInternalCredentialDetail() {
17
+ const missing = [
18
+ getHostEnv(INTERNAL_USER_ENV) ? undefined : INTERNAL_USER_ENV,
19
+ getHostEnv(INTERNAL_PASS_ENV) ? undefined : INTERNAL_PASS_ENV,
20
+ ].filter((name) => name !== undefined);
21
+ return missing.length > 0
22
+ ? `${missing.join(" and ")} must be set in hosted proxy mode`
23
+ : undefined;
24
+ }
25
+ /** Build the internal API authorization header when both credentials are present. */
26
+ export function getProjectEnvInternalAuthorization() {
27
+ const username = getHostEnv(INTERNAL_USER_ENV);
28
+ const password = getHostEnv(INTERNAL_PASS_ENV);
29
+ if (!username || !password)
30
+ return undefined;
31
+ return `Basic ${encodeBase64(`${username}:${password}`)}`;
32
+ }
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.1237";
2
+ export declare const VERSION = "0.1.1238";
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.1237";
4
+ export const VERSION = "0.1.1238";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.1237",
3
+ "version": "0.1.1238",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",
@@ -425,13 +425,13 @@
425
425
  "@deno/shim-crypto": "0.3.1",
426
426
  "@types/react": "19.2.14",
427
427
  "@types/react-dom": "19.2.3",
428
- "@veryfront/ext-bundler-esbuild": "0.1.1237",
429
- "@veryfront/ext-content-mdx": "0.1.1237",
430
- "@veryfront/ext-css-tailwind": "0.1.1237",
431
- "@veryfront/ext-dev-ui-react": "0.1.1237",
432
- "@veryfront/ext-node-websocket-ws": "0.1.1237",
433
- "@veryfront/ext-parser-babel": "0.1.1237",
434
- "@veryfront/ext-yaml": "0.1.1237"
428
+ "@veryfront/ext-bundler-esbuild": "0.1.1238",
429
+ "@veryfront/ext-content-mdx": "0.1.1238",
430
+ "@veryfront/ext-css-tailwind": "0.1.1238",
431
+ "@veryfront/ext-dev-ui-react": "0.1.1238",
432
+ "@veryfront/ext-node-websocket-ws": "0.1.1238",
433
+ "@veryfront/ext-parser-babel": "0.1.1238",
434
+ "@veryfront/ext-yaml": "0.1.1238"
435
435
  },
436
436
  "devDependencies": {
437
437
  "@types/node": "20.9.0"