veryfront 0.1.1157 → 0.1.1159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/cli/commands/deploy/command.d.ts.map +1 -1
- package/esm/cli/commands/deploy/command.js +44 -12
- package/esm/deno.js +2 -2
- package/esm/src/agent/runtime/tool-helpers.d.ts.map +1 -1
- package/esm/src/agent/runtime/tool-helpers.js +34 -6
- package/esm/src/agent/streaming/fork-runtime-part-mapper.d.ts.map +1 -1
- package/esm/src/agent/streaming/fork-runtime-part-mapper.js +3 -1
- package/esm/src/agent/streaming/fork-runtime-stream.d.ts.map +1 -1
- package/esm/src/agent/streaming/fork-runtime-stream.js +10 -1
- package/esm/src/html/html-injection.d.ts +3 -0
- package/esm/src/html/html-injection.d.ts.map +1 -1
- package/esm/src/html/html-injection.js +6 -2
- package/esm/src/html/hydration-script-builder/dev-client-renderer.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/dev-client-renderer.js +4 -2
- package/esm/src/html/hydration-script-builder/prod-scripts.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/prod-scripts.js +4 -2
- package/esm/src/html/hydration-script-builder/templates/index.d.ts +1 -0
- package/esm/src/html/hydration-script-builder/templates/index.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/templates/index.js +1 -0
- package/esm/src/html/hydration-script-builder/templates/navigation-store.d.ts +11 -0
- package/esm/src/html/hydration-script-builder/templates/navigation-store.d.ts.map +1 -0
- package/esm/src/html/hydration-script-builder/templates/navigation-store.js +53 -0
- package/esm/src/html/hydration-script-builder/templates/router.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/templates/router.js +13 -5
- package/esm/src/release-assets/build-executor.d.ts.map +1 -1
- package/esm/src/release-assets/build-executor.js +29 -30
- package/esm/src/release-assets/client-module-map.d.ts +3 -1
- package/esm/src/release-assets/client-module-map.d.ts.map +1 -1
- package/esm/src/release-assets/client-module-map.js +18 -3
- package/esm/src/release-assets/route-path.d.ts +8 -0
- package/esm/src/release-assets/route-path.d.ts.map +1 -1
- package/esm/src/release-assets/route-path.js +39 -0
- package/esm/src/rendering/orchestrator/html.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/html.js +1 -0
- package/esm/src/tool/host-tools.d.ts.map +1 -1
- package/esm/src/tool/host-tools.js +10 -2
- package/esm/src/tool/remote-source-tools.d.ts.map +1 -1
- package/esm/src/tool/remote-source-tools.js +13 -11
- package/esm/src/tool/remote-tool-provenance.d.ts +5 -0
- package/esm/src/tool/remote-tool-provenance.d.ts.map +1 -0
- package/esm/src/tool/remote-tool-provenance.js +19 -0
- package/esm/src/transforms/mdx/esm-module-loader/cache/index.js +1 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/deploy/command.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAI3E,OAAO,EACL,KAAK,SAAS,EAOf,MAAM,wBAAwB,CAAC;AAShC,OAAO,EAIL,KAAK,aAAa,EAInB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/deploy/command.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAI3E,OAAO,EACL,KAAK,SAAS,EAOf,MAAM,wBAAwB,CAAC;AAShC,OAAO,EAIL,KAAK,aAAa,EAInB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gDAAgD,CAAC;AAInG;;GAEG;AACH,eAAO,MAAM,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AE,MAAM,CAAC;IACf,YAAY,EAAE,OAAO,CAAC;CACvB,GAAG,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,CAmB9D;AAgOD,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IACP,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACf,GACL,OAAO,CAAC,4BAA4B,CAAC,CAmCvC;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA8LzE"}
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* @module cli/commands/deploy
|
|
8
8
|
*/
|
|
9
9
|
import { defineSchema, lazySchema } from "../../../src/schemas/index.js";
|
|
10
|
-
import { createFileSystem, cwd } from "../../../src/platform/index.js";
|
|
11
|
-
import { join, relative } from "../../../src/platform/compat/path/index.js";
|
|
12
|
-
import { getEnvironmentConfig } from "../../../src/config/index.js";
|
|
10
|
+
import { createFileSystem, cwd, runtime } from "../../../src/platform/index.js";
|
|
11
|
+
import { join, relative, resolve } from "../../../src/platform/compat/path/index.js";
|
|
12
|
+
import { getConfig, getEnvironmentConfig } from "../../../src/config/index.js";
|
|
13
13
|
import { createApiClient, readConfigFile, resolveConfigWithAuth, resolveConfigWithAuthDetails, writeProjectSlug, } from "../../shared/config.js";
|
|
14
14
|
import { CommonArgs, createArgParser } from "../../shared/args.js";
|
|
15
15
|
import { confirmPrompt, logInfo, logSuccess, logWarning } from "../../utils/index.js";
|
|
@@ -21,6 +21,7 @@ import { isAutoConfirmEnabled } from "../../shared/interactive.js";
|
|
|
21
21
|
import { isJsonMode, streamJsonLine } from "../../shared/json-output.js";
|
|
22
22
|
import { computeSourceDigest, getProjectTarget, normalizeControlPlane, readPushReceipt, resolveGitSource, validatePushReceipt, } from "../../shared/deployment-provenance.js";
|
|
23
23
|
import { routeForPage } from "../../../src/release-assets/route-path.js";
|
|
24
|
+
import { isWithinDirectory, normalizePath } from "../../../src/utils/path-utils.js";
|
|
24
25
|
/**
|
|
25
26
|
* Schema factory for deploy command arguments
|
|
26
27
|
*/
|
|
@@ -394,10 +395,36 @@ async function ensureProjectLinkedForDeploy(projectDir, env, dryRun, quiet) {
|
|
|
394
395
|
plannedProjectSlug: created.slug,
|
|
395
396
|
};
|
|
396
397
|
}
|
|
398
|
+
async function getProjectRouteDirectories(projectDir) {
|
|
399
|
+
const adapter = await runtime.get();
|
|
400
|
+
const config = await getConfig(projectDir, adapter);
|
|
401
|
+
return {
|
|
402
|
+
app: normalizeConfiguredRouteDirectory(config.directories?.app ?? "app"),
|
|
403
|
+
pages: normalizeConfiguredRouteDirectory(config.directories?.pages ?? "pages"),
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
function normalizeConfiguredRouteDirectory(path) {
|
|
407
|
+
return path.replace(/\\/g, "/");
|
|
408
|
+
}
|
|
409
|
+
function isAbsoluteConfiguredRouteDirectory(path) {
|
|
410
|
+
return path.startsWith("/") || /^[A-Za-z]:\//.test(path);
|
|
411
|
+
}
|
|
412
|
+
function resolveProjectRouteDirectory(projectDir, directory, name) {
|
|
413
|
+
if (isAbsoluteConfiguredRouteDirectory(directory)) {
|
|
414
|
+
throw new Error(`Configured ${name} directory "${directory}" must be project-relative. Set directories.${name} to a path inside the project, for example "${name}" or "src/${name}".`);
|
|
415
|
+
}
|
|
416
|
+
const projectRoot = normalizePath(projectDir);
|
|
417
|
+
const routeRoot = normalizePath(resolve(projectRoot, directory));
|
|
418
|
+
if (!isWithinDirectory(projectRoot, routeRoot)) {
|
|
419
|
+
throw new Error(`Configured ${name} directory "${directory}" resolves outside the project directory. Set directories.${name} to a project-relative path inside the project.`);
|
|
420
|
+
}
|
|
421
|
+
return routeRoot;
|
|
422
|
+
}
|
|
397
423
|
async function collectProjectPageRoutes(projectDir) {
|
|
398
424
|
const fs = createFileSystem();
|
|
425
|
+
const directories = await getProjectRouteDirectories(projectDir);
|
|
399
426
|
const routes = new Set();
|
|
400
|
-
async function walk(dir) {
|
|
427
|
+
async function walk(rootDir, dir, routeRoot) {
|
|
401
428
|
let entries;
|
|
402
429
|
try {
|
|
403
430
|
if (!(await fs.exists(dir)))
|
|
@@ -410,23 +437,25 @@ async function collectProjectPageRoutes(projectDir) {
|
|
|
410
437
|
for await (const entry of entries) {
|
|
411
438
|
const path = join(dir, entry.name);
|
|
412
439
|
if (entry.isDirectory) {
|
|
413
|
-
await walk(path);
|
|
440
|
+
await walk(rootDir, path, routeRoot);
|
|
414
441
|
continue;
|
|
415
442
|
}
|
|
416
443
|
if (!/\.(tsx|ts|jsx|mdx|js)$/.test(entry.name))
|
|
417
444
|
continue;
|
|
418
|
-
const relativePath = relative(
|
|
445
|
+
const relativePath = relative(rootDir, path).replace(/\\/g, "/");
|
|
419
446
|
if (relativePath === "." || relativePath === ".." || relativePath.startsWith("../")) {
|
|
420
447
|
continue;
|
|
421
448
|
}
|
|
422
|
-
const route = routeForPage(relativePath);
|
|
449
|
+
const route = routeForPage(`${routeRoot}/${relativePath}`);
|
|
423
450
|
if (route)
|
|
424
451
|
routes.add(route);
|
|
425
452
|
}
|
|
426
453
|
}
|
|
454
|
+
const appDir = resolveProjectRouteDirectory(projectDir, directories.app, "app");
|
|
455
|
+
const pagesDir = resolveProjectRouteDirectory(projectDir, directories.pages, "pages");
|
|
427
456
|
await Promise.all([
|
|
428
|
-
walk(
|
|
429
|
-
walk(
|
|
457
|
+
walk(appDir, appDir, "app"),
|
|
458
|
+
walk(pagesDir, pagesDir, "pages"),
|
|
430
459
|
]);
|
|
431
460
|
return [...routes].sort();
|
|
432
461
|
}
|
|
@@ -486,11 +515,13 @@ export async function deployCommand(options) {
|
|
|
486
515
|
const environmentConfig = getEnvironmentConfig();
|
|
487
516
|
const setup = await ensureProjectLinkedForDeploy(projectDir, environmentConfig, dryRun, quiet);
|
|
488
517
|
let { config, client, project } = setup;
|
|
489
|
-
const expectedPageRoutes = await collectProjectPageRoutes(projectDir);
|
|
490
518
|
if (dryRun && !project) {
|
|
491
519
|
spinner.stop();
|
|
492
520
|
if (!quiet) {
|
|
493
|
-
|
|
521
|
+
const actions = skipSourcePush
|
|
522
|
+
? `create release and deploy to "${env}"`
|
|
523
|
+
: `push source to "${branch}", create release, and deploy to "${env}"`;
|
|
524
|
+
logInfo(`Would ${actions} for project ${setup.plannedProjectSlug}`);
|
|
494
525
|
}
|
|
495
526
|
return;
|
|
496
527
|
}
|
|
@@ -579,6 +610,7 @@ export async function deployCommand(options) {
|
|
|
579
610
|
sourceDigest: source.sourceDigest,
|
|
580
611
|
});
|
|
581
612
|
spinner.update(`Waiting for release assets for ${release.version}...`);
|
|
613
|
+
const expectedPageRoutes = await collectProjectPageRoutes(projectDir);
|
|
582
614
|
await waitForReleaseAssetManifest(client, project.slug, release.id, {
|
|
583
615
|
expectedRoutes: expectedPageRoutes,
|
|
584
616
|
pollIntervalMs: assetManifestPollIntervalMs,
|
|
@@ -645,7 +677,6 @@ async function deployCommandJson(options) {
|
|
|
645
677
|
const environmentConfig = getEnvironmentConfig();
|
|
646
678
|
const setup = await ensureProjectLinkedForDeploy(projectDir, environmentConfig, dryRun, true);
|
|
647
679
|
let { config, client, project } = setup;
|
|
648
|
-
const expectedPageRoutes = await collectProjectPageRoutes(projectDir);
|
|
649
680
|
streamJsonLine({ type: "step", name: "resolve-config", status: "completed" });
|
|
650
681
|
if (dryRun && !project) {
|
|
651
682
|
streamJsonLine({
|
|
@@ -742,6 +773,7 @@ async function deployCommandJson(options) {
|
|
|
742
773
|
});
|
|
743
774
|
streamJsonLine({ type: "step", name: "verify-release-source", status: "completed" });
|
|
744
775
|
streamJsonLine({ type: "step", name: "wait-release-assets", status: "started" });
|
|
776
|
+
const expectedPageRoutes = await collectProjectPageRoutes(projectDir);
|
|
745
777
|
await waitForReleaseAssetManifest(client, project.slug, release.id, {
|
|
746
778
|
expectedRoutes: expectedPageRoutes,
|
|
747
779
|
pollIntervalMs: assetManifestPollIntervalMs,
|
package/esm/deno.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1159",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"nodeModulesDir": "auto",
|
|
6
6
|
"minimumDependencyAge": {
|
|
@@ -472,7 +472,7 @@ export default {
|
|
|
472
472
|
"test:all-runtimes": "deno task test:unit && deno task test:node && deno task test:bun",
|
|
473
473
|
"test:e2e": "deno task test:e2e:playwright",
|
|
474
474
|
"test:e2e:playwright": "PW_DISABLE_TS_ESM=1 npx playwright test --config=tests/e2e/playwright.config.cjs",
|
|
475
|
-
"test:e2e:rsc-browser": "deno task generate && VF_DISABLE_LRU_INTERVAL=1 SSR_TRANSFORM_PER_PROJECT_LIMIT=0 REVALIDATION_PER_PROJECT_LIMIT=0 NODE_ENV=production LOG_FORMAT=text deno test --no-check --allow-all tests/e2e/regressions/rsc-proxy-hydration.test.ts --unstable-worker-options --unstable-net",
|
|
475
|
+
"test:e2e:rsc-browser": "deno task generate && VF_DISABLE_LRU_INTERVAL=1 SSR_TRANSFORM_PER_PROJECT_LIMIT=0 REVALIDATION_PER_PROJECT_LIMIT=0 NODE_ENV=production LOG_FORMAT=text deno test --no-check --allow-all tests/e2e/regressions/rsc-proxy-hydration.test.ts tests/e2e/regressions/2026-07-27-legacy-router-hydration.test.ts --unstable-worker-options --unstable-net",
|
|
476
476
|
"test:e2e:binary": "deno task generate && deno test --allow-all tests/integration/compiled-binary-e2e.test.ts",
|
|
477
477
|
"test:e2e:binary:fresh": "deno task generate && VERYFRONT_BINARY_FRESH=1 deno test --allow-all tests/integration/compiled-binary-e2e.test.ts",
|
|
478
478
|
"test:e2e:templates": "deno run --allow-all scripts/test/template-runtime-e2e.ts",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-helpers.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/tool-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-helpers.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/tool-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAWxG,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,qCAAqC,CAAC;AAI7C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAuBD;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACxC,cAAc,CAyBhB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;;GAGG;AAEH,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC;AA8JvD,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAAS,EAC/D,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE;IACR,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C,GACA,IAAI,GAAG,IAAI,CAgCb;AAED,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,WAAW,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAAS,EAC/D,OAAO,CAAC,EAAE,oBAAoB,EAC9B,sBAAsB,CAAC,EAAE,MAAM,EAAE,EACjC,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,EACtC,uBAAuB,CAAC,EAAE,+BAA+B,EACzD,OAAO,CAAC,EAAE;IACR,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,GACA,OAAO,CAAC,OAAO,CAAC,CA8DlB;AAyCD;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAAS,EAC/D,OAAO,CAAC,EAAE;IACR,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;IAClC,8BAA8B,CAAC,EAAE,cAAc,EAAE,CAAC;IAClD,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACvC,iBAAiB,CAAC,EAAE,oBAAoB,CAAC;IACzC,uBAAuB,CAAC,EAAE,+BAA+B,CAAC;IAC1D,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,wDAAwD;IACxD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GACA,OAAO,CAAC,cAAc,EAAE,CAAC,CAgJ3B"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { executeTool, isToolVisibleTo, toolRegistry } from "../../tool/index.js";
|
|
9
9
|
import { assertLocalToolId, toolToProviderDefinition } from "../../tool/registry.js";
|
|
10
|
+
import { getRemoteToolProvenance } from "../../tool/remote-tool-provenance.js";
|
|
10
11
|
import { SKILL_TOOL_IDS } from "../../skill/types.js";
|
|
11
12
|
import { serverLogger } from "../../utils/index.js";
|
|
12
13
|
import { createError, PERMISSION_DENIED, toError } from "../../errors/index.js";
|
|
@@ -62,6 +63,15 @@ export function parseToolArgs(rawArgs) {
|
|
|
62
63
|
export function isDynamicTool(name) {
|
|
63
64
|
return toolRegistry.get(name)?.type === "dynamic";
|
|
64
65
|
}
|
|
66
|
+
function getConfiguredRemoteToolName(entry) {
|
|
67
|
+
return typeof entry === "object" ? getRemoteToolProvenance(entry) : undefined;
|
|
68
|
+
}
|
|
69
|
+
function getConfiguredToolAuthorizationName(toolName, entry) {
|
|
70
|
+
return getConfiguredRemoteToolName(entry) ?? toolName;
|
|
71
|
+
}
|
|
72
|
+
function isRemoteToolAllowed(toolName, allowedRemoteToolNames) {
|
|
73
|
+
return allowedRemoteToolNames === undefined || allowedRemoteToolNames.includes(toolName);
|
|
74
|
+
}
|
|
65
75
|
/**
|
|
66
76
|
* Resolve a configured tool name for a caller: the caller's own tool by short
|
|
67
77
|
* name first, then an exact registry id — returning only tools visible to the
|
|
@@ -173,7 +183,8 @@ export function resolveConfiguredTool(toolsConfig, toolName, context, options) {
|
|
|
173
183
|
return registryTool && isToolVisibleTo(registryTool, context) ? registryTool : null;
|
|
174
184
|
}
|
|
175
185
|
if (configuredEntry && typeof configuredEntry === "object") {
|
|
176
|
-
if (options?.allowIntegrationStyleConcreteTools !== true
|
|
186
|
+
if (options?.allowIntegrationStyleConcreteTools !== true &&
|
|
187
|
+
getConfiguredRemoteToolName(configuredEntry) === undefined) {
|
|
177
188
|
assertLocalToolId(toolName);
|
|
178
189
|
assertLocalToolId(configuredEntry.id);
|
|
179
190
|
}
|
|
@@ -182,9 +193,18 @@ export function resolveConfiguredTool(toolsConfig, toolName, context, options) {
|
|
|
182
193
|
return null;
|
|
183
194
|
}
|
|
184
195
|
export async function executeConfiguredTool(toolName, input, toolsConfig, context, allowedRemoteToolNames, remoteToolSources, sourceIntegrationPolicy, options) {
|
|
196
|
+
const configuredEntry = toolsConfig === true ? undefined : toolsConfig?.[toolName];
|
|
197
|
+
const configuredRemoteToolName = getConfiguredRemoteToolName(configuredEntry);
|
|
198
|
+
const authorizationToolName = getConfiguredToolAuthorizationName(toolName, configuredEntry);
|
|
185
199
|
if (sourceIntegrationPolicy &&
|
|
186
|
-
!isIntegrationToolAllowedBySourcePolicy(
|
|
187
|
-
throw new Error(`Tool "${
|
|
200
|
+
!isIntegrationToolAllowedBySourcePolicy(authorizationToolName, sourceIntegrationPolicy)) {
|
|
201
|
+
throw new Error(`Tool "${authorizationToolName}" is not allowed by the source integration policy`);
|
|
202
|
+
}
|
|
203
|
+
if (configuredRemoteToolName !== undefined &&
|
|
204
|
+
!isRemoteToolAllowed(configuredRemoteToolName, allowedRemoteToolNames)) {
|
|
205
|
+
throw PERMISSION_DENIED.create({
|
|
206
|
+
detail: `Tool "${configuredRemoteToolName}" is not allowed for this run`,
|
|
207
|
+
});
|
|
188
208
|
}
|
|
189
209
|
const configuredTool = resolveConfiguredTool(toolsConfig, toolName, context, {
|
|
190
210
|
allowIntegrationStyleConcreteTools: options?.strictConfiguredToolsOnly,
|
|
@@ -292,9 +312,12 @@ export async function getAvailableTools(toolsConfig, options) {
|
|
|
292
312
|
const remoteToolNames = new Set(remoteDefs.map((def) => def.name));
|
|
293
313
|
const explicitlyRequestedRemoteToolNames = new Set();
|
|
294
314
|
const unresolvedConfiguredToolNames = [];
|
|
315
|
+
const configuredAuthorizationToolNames = new Map();
|
|
295
316
|
for (const [name, entry] of Object.entries(toolsConfig)) {
|
|
317
|
+
const configuredRemoteToolName = getConfiguredRemoteToolName(entry);
|
|
318
|
+
const authorizationToolName = getConfiguredToolAuthorizationName(name, entry);
|
|
296
319
|
if (sourceIntegrationPolicy &&
|
|
297
|
-
!isIntegrationToolAllowedBySourcePolicy(
|
|
320
|
+
!isIntegrationToolAllowedBySourcePolicy(authorizationToolName, sourceIntegrationPolicy)) {
|
|
298
321
|
continue;
|
|
299
322
|
}
|
|
300
323
|
if (entry === true) {
|
|
@@ -319,10 +342,15 @@ export async function getAvailableTools(toolsConfig, options) {
|
|
|
319
342
|
continue;
|
|
320
343
|
}
|
|
321
344
|
if (entry && typeof entry === "object") {
|
|
322
|
-
if (
|
|
345
|
+
if (configuredRemoteToolName !== undefined &&
|
|
346
|
+
!isRemoteToolAllowed(configuredRemoteToolName, options?.allowedRemoteToolNames)) {
|
|
347
|
+
continue;
|
|
348
|
+
}
|
|
349
|
+
if (!strictConfiguredToolsOnly && configuredRemoteToolName === undefined) {
|
|
323
350
|
assertLocalToolId(name);
|
|
324
351
|
assertLocalToolId(entry.id);
|
|
325
352
|
}
|
|
353
|
+
configuredAuthorizationToolNames.set(name, authorizationToolName);
|
|
326
354
|
addToolDefinition(tools, name, entry);
|
|
327
355
|
}
|
|
328
356
|
}
|
|
@@ -348,6 +376,6 @@ export async function getAvailableTools(toolsConfig, options) {
|
|
|
348
376
|
throwUnknownConfiguredToolsError(unresolvedConfiguredToolNames, visibleLocalToolNames, remoteToolNames);
|
|
349
377
|
}
|
|
350
378
|
return sourceIntegrationPolicy
|
|
351
|
-
? tools.filter((definition) => isIntegrationToolAllowedBySourcePolicy(definition.name, sourceIntegrationPolicy))
|
|
379
|
+
? tools.filter((definition) => isIntegrationToolAllowedBySourcePolicy(configuredAuthorizationToolNames.get(definition.name) ?? definition.name, sourceIntegrationPolicy))
|
|
352
380
|
: tools;
|
|
353
381
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fork-runtime-part-mapper.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/streaming/fork-runtime-part-mapper.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAM1E,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAElG,KA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AAK,EAAE,6BAA6B,GACnC,QAAQ,EAAE,CAEZ"}
|
|
@@ -277,7 +277,9 @@ export function mapAgUiRuntimeEventToForkParts(event, state) {
|
|
|
277
277
|
case "error": {
|
|
278
278
|
const errorText = typeof event.errorText === "string"
|
|
279
279
|
? event.errorText
|
|
280
|
-
:
|
|
280
|
+
: typeof event.error === "string"
|
|
281
|
+
? event.error
|
|
282
|
+
: "Framework stream failed";
|
|
281
283
|
return [{ type: "error", error: new Error(errorText) }];
|
|
282
284
|
}
|
|
283
285
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fork-runtime-stream.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/streaming/fork-runtime-stream.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,IAAI,EAET,KAAK,qBAAqB,EAC3B,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"fork-runtime-stream.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/streaming/fork-runtime-stream.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,IAAI,EAET,KAAK,qBAAqB,EAC3B,MAAM,qBAAqB,CAAC;AAoB7B,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAElF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAO1D,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClG,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,qCAAqC,CAAC;AAE7C,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAElG,OAAO,EACL,uBAAuB,EACvB,mCAAmC,EACnC,0BAA0B,EAC1B,8BAA8B,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,eAAe,CAAC;IACtB,eAAe,EAAE,YAAY,EAAE,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC;IAAE,0BAA0B,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,YAAY,EAAE,CAAA;CAAE,GAAG,IAAI,CAAC,CAoB1F;AAED,iCAAiC;AACjC,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,GAAG,uBAAuB,CA6GhG"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as dntShim from "../../../_dnt.shims.js";
|
|
2
2
|
import { createToolsFromHostDefinitions, traceHostTools, } from "../../tool/index.js";
|
|
3
|
+
import { getRemoteToolProvenance } from "../../tool/remote-tool-provenance.js";
|
|
3
4
|
import { runWithVeryfrontCloudContextAsync } from "../../provider/veryfront-cloud/context.js";
|
|
4
5
|
import { streamDataStreamEvents } from "./data-stream.js";
|
|
5
6
|
import { buildRecoveredStepParts, createForkRuntimeStreamMappingState, mapAgUiRuntimeEventToForkParts, } from "./fork-runtime-part-mapper.js";
|
|
@@ -89,6 +90,14 @@ async function prepareForkRuntimeStep(input) {
|
|
|
89
90
|
system: input.buildInstructions(),
|
|
90
91
|
};
|
|
91
92
|
}
|
|
93
|
+
function getForkRuntimeAuthorizationToolNames(toolNames, runtimeTools) {
|
|
94
|
+
return toolNames.map((toolName) => {
|
|
95
|
+
const runtimeTool = runtimeTools[toolName];
|
|
96
|
+
return runtimeTool && typeof runtimeTool === "object"
|
|
97
|
+
? getRemoteToolProvenance(runtimeTool) ?? toolName
|
|
98
|
+
: toolName;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
92
101
|
/** Run agent runtime fork step. */
|
|
93
102
|
export async function runAgentRuntimeForkStep(input) {
|
|
94
103
|
let resolveResponsePromise;
|
|
@@ -126,7 +135,7 @@ export async function runAgentRuntimeForkStep(input) {
|
|
|
126
135
|
}),
|
|
127
136
|
}
|
|
128
137
|
: {}),
|
|
129
|
-
__vfAllowedRemoteTools: input.forkToolNames,
|
|
138
|
+
__vfAllowedRemoteTools: getForkRuntimeAuthorizationToolNames(input.forkToolNames, input.runtimeTools),
|
|
130
139
|
...(input.sourceIntegrationPolicy
|
|
131
140
|
? { __vfSourceIntegrationPolicy: input.sourceIntegrationPolicy }
|
|
132
141
|
: {}),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { HTMLMetadata } from "../transforms/mdx/types.js";
|
|
2
|
+
import { type ConfiguredRouteDirectories } from "../release-assets/route-path.js";
|
|
2
3
|
import type { ReleaseAssetManifest } from "../release-assets/manifest-schema.js";
|
|
3
4
|
export interface InjectHTMLContentOptions {
|
|
4
5
|
mode: string;
|
|
@@ -39,6 +40,8 @@ export interface InjectHTMLContentOptions {
|
|
|
39
40
|
projectStylesheetHref?: string;
|
|
40
41
|
/** Ready release asset manifest used to hydrate full HTML client pages */
|
|
41
42
|
releaseAssetManifest?: ReleaseAssetManifest | null;
|
|
43
|
+
/** Configured route directories used to map physical page paths to route keys */
|
|
44
|
+
directories?: ConfiguredRouteDirectories;
|
|
42
45
|
}
|
|
43
46
|
export declare function injectHTMLContent(template: string, content: string, metadata: HTMLMetadata, options: InjectHTMLContentOptions): string;
|
|
44
47
|
//# sourceMappingURL=html-injection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-injection.d.ts","sourceRoot":"","sources":["../../../src/src/html/html-injection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAsB/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,M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,MAAM,CAAC;IACpB,kDAAkD;IAClD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC3C,gDAAgD;IAChD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,WAAW,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;IACvC,+DAA+D;IAC/D,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,0EAA0E;IAC1E,oBAAoB,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACnD,iFAAiF;IACjF,WAAW,CAAC,EAAE,0BAA0B,CAAC;CAC1C;AAgBD,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,wBAAwB,GAChC,MAAM,CAqHR"}
|
|
@@ -5,6 +5,7 @@ import { buildNonceAttribute, escapeHTML } from "./html-escape.js";
|
|
|
5
5
|
import { escapeInlineJsonText, jsonForInlineScript, } from "../security/client/html-sanitizer.js";
|
|
6
6
|
import { getDevScripts, getDevStyles, getPreviewStylesheetLink, getProdScripts, getStudioScripts, } from "./dev-scripts.js";
|
|
7
7
|
import { buildReleaseAssetModules } from "../release-assets/client-module-map.js";
|
|
8
|
+
import { routeForConfiguredPage, } from "../release-assets/route-path.js";
|
|
8
9
|
function toProjectRelativePath(absolutePath, projectDir) {
|
|
9
10
|
const normalizedPath = absolutePath.replace(/\\/g, "/");
|
|
10
11
|
if (!projectDir)
|
|
@@ -54,12 +55,13 @@ export function injectHTMLContent(template, content, metadata, options) {
|
|
|
54
55
|
const hasBodyClose = /<\/body>/i.test(html);
|
|
55
56
|
// Inject hydration data for 'use client' pages (before scripts, so client.js can find it)
|
|
56
57
|
if (options.pagePath && options.isClientPage && hasBodyClose) {
|
|
58
|
+
const pagePath = toProjectRelativePath(options.pagePath, options.projectDir);
|
|
57
59
|
// Serialize with jsonForInlineScript, not raw JSON.stringify: route params
|
|
58
60
|
// (and slug) are URL-derived and decoded, so a segment like `%3C/script%3E`
|
|
59
61
|
// would otherwise break out of the <script> tag (reflected XSS). This escapes
|
|
60
62
|
// `<`, `>`, `&`, and line separators, matching the main shell hydration path.
|
|
61
63
|
const hydrationData = jsonForInlineScript({
|
|
62
|
-
pagePath
|
|
64
|
+
pagePath,
|
|
63
65
|
slug: options.slug,
|
|
64
66
|
isClientPage: true,
|
|
65
67
|
params: options.params ?? {},
|
|
@@ -67,7 +69,9 @@ export function injectHTMLContent(template, content, metadata, options) {
|
|
|
67
69
|
isLocalProject: options.isLocalProject ?? options.mode === "development",
|
|
68
70
|
environment: options.environment,
|
|
69
71
|
}),
|
|
70
|
-
releaseAssetModules: buildReleaseAssetModules(options.releaseAssetManifest
|
|
72
|
+
releaseAssetModules: buildReleaseAssetModules(options.releaseAssetManifest, {
|
|
73
|
+
route: routeForConfiguredPage(pagePath, options.directories),
|
|
74
|
+
}),
|
|
71
75
|
});
|
|
72
76
|
const nonceAttr = buildNonceAttribute(options.nonce);
|
|
73
77
|
const hydrationScript = `<script id="veryfront-hydration-data" type="application/json"${nonceAttr}>${hydrationData}</script>`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-client-renderer.d.ts","sourceRoot":"","sources":["../../../../src/src/html/hydration-script-builder/dev-client-renderer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev-client-renderer.d.ts","sourceRoot":"","sources":["../../../../src/src/html/hydration-script-builder/dev-client-renderer.ts"],"names":[],"mappings":"AAQA,wBAAgB,+BAA+B,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAgBtE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getLoaderScript, getRendererScript, getRouterScript } from "./templates/index.js";
|
|
1
|
+
import { getLoaderScript, getNavigationStoreCompatibilityScript, getRendererScript, getRouterScript, } from "./templates/index.js";
|
|
2
2
|
import { buildNonceAttribute } from "../html-escape.js";
|
|
3
3
|
export function generateDevClientRendererScript(nonce) {
|
|
4
4
|
const nonceAttr = buildNonceAttribute(nonce);
|
|
@@ -6,8 +6,10 @@ export function generateDevClientRendererScript(nonce) {
|
|
|
6
6
|
<script type="module"${nonceAttr}>
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import { createRoot } from 'react-dom/client';
|
|
9
|
-
import { RouterProvider, useRouter as useRouterFromModule
|
|
9
|
+
import { RouterProvider, useRouter as useRouterFromModule } from 'veryfront/router';
|
|
10
|
+
import * as RouterRuntime from 'veryfront/router';
|
|
10
11
|
import { PageContextProvider } from 'veryfront/context';
|
|
12
|
+
${getNavigationStoreCompatibilityScript()}
|
|
11
13
|
|
|
12
14
|
${getRouterScript()}
|
|
13
15
|
${getLoaderScript()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prod-scripts.d.ts","sourceRoot":"","sources":["../../../../src/src/html/hydration-script-builder/prod-scripts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prod-scripts.d.ts","sourceRoot":"","sources":["../../../../src/src/html/hydration-script-builder/prod-scripts.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,0BAA0B,qCAAqC,CAAC;AAC7E,eAAO,MAAM,4CAA4C,QACH,CAAC;AAIvD,wBAAgB,2BAA2B,IAAI,MAAM,CAYpD;AAED,wBAAgB,0BAA0B,IAAI,MAAM,CAMnD;AAED,wBAAgB,kCAAkC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE5E;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAC3C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,CAGR"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getLoaderScript, getRendererScript, getRouterScript } from "./templates/index.js";
|
|
1
|
+
import { getLoaderScript, getNavigationStoreCompatibilityScript, getRendererScript, getRouterScript, } from "./templates/index.js";
|
|
2
2
|
import { buildNonceAttribute } from "../html-escape.js";
|
|
3
3
|
import { fnv1aHash } from "../../utils/hash-utils.js";
|
|
4
4
|
export const PROD_HYDRATION_MODULE_PATH = "/_veryfront/hydration-runtime.js";
|
|
@@ -8,8 +8,10 @@ export function generateProdHydrationModule() {
|
|
|
8
8
|
return [
|
|
9
9
|
`import * as React from 'react';`,
|
|
10
10
|
`import { createRoot } from 'react-dom/client';`,
|
|
11
|
-
`import { RouterProvider, useRouter as useRouterFromModule
|
|
11
|
+
`import { RouterProvider, useRouter as useRouterFromModule } from 'veryfront/router';`,
|
|
12
|
+
`import * as RouterRuntime from 'veryfront/router';`,
|
|
12
13
|
`import { PageContextProvider } from 'veryfront/context';`,
|
|
14
|
+
getNavigationStoreCompatibilityScript().trim(),
|
|
13
15
|
getRouterScript().trim(),
|
|
14
16
|
getLoaderScript().trim(),
|
|
15
17
|
getRendererScript().trim(),
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* @module html/hydration-script-builder/templates
|
|
5
5
|
*/
|
|
6
6
|
export { getRouterScript } from "./router.js";
|
|
7
|
+
export { getNavigationStoreCompatibilityScript } from "./navigation-store.js";
|
|
7
8
|
export { getLoaderScript } from "./loader.js";
|
|
8
9
|
export { getRendererScript } from "./renderer.js";
|
|
9
10
|
export { getSpaLoaderScript, getSpaRendererScript } from "./spa-renderer.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* @module html/hydration-script-builder/templates
|
|
5
5
|
*/
|
|
6
6
|
export { getRouterScript } from "./router.js";
|
|
7
|
+
export { getNavigationStoreCompatibilityScript } from "./navigation-store.js";
|
|
7
8
|
export { getLoaderScript } from "./loader.js";
|
|
8
9
|
export { getRendererScript } from "./renderer.js";
|
|
9
10
|
export { getSpaLoaderScript, getSpaRendererScript } from "./spa-renderer.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate the compatibility bridge between the shared hydration runtime and
|
|
3
|
+
* release-pinned router assets.
|
|
4
|
+
*
|
|
5
|
+
* Router releases since the v1 navigation store landed share the same
|
|
6
|
+
* Symbol.for registry entry even when they predate the public
|
|
7
|
+
* getNavigationStore export. Keeping the fallback store shape in sync with the
|
|
8
|
+
* two v1 implementations lets those releases retain SPA navigation.
|
|
9
|
+
*/
|
|
10
|
+
export declare const getNavigationStoreCompatibilityScript: () => string;
|
|
11
|
+
//# sourceMappingURL=navigation-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-store.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/navigation-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,qCAAqC,cA2CjD,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate the compatibility bridge between the shared hydration runtime and
|
|
3
|
+
* release-pinned router assets.
|
|
4
|
+
*
|
|
5
|
+
* Router releases since the v1 navigation store landed share the same
|
|
6
|
+
* Symbol.for registry entry even when they predate the public
|
|
7
|
+
* getNavigationStore export. Keeping the fallback store shape in sync with the
|
|
8
|
+
* two v1 implementations lets those releases retain SPA navigation.
|
|
9
|
+
*/
|
|
10
|
+
export const getNavigationStoreCompatibilityScript = () => `
|
|
11
|
+
const navigationStoreUsesRegistryFallback =
|
|
12
|
+
typeof RouterRuntime.getNavigationStore !== 'function';
|
|
13
|
+
const getNavigationStore = navigationStoreUsesRegistryFallback
|
|
14
|
+
? () => {
|
|
15
|
+
const storeKey = Symbol.for('veryfront.navigation.store.v1');
|
|
16
|
+
const existing = globalThis[storeKey];
|
|
17
|
+
if (existing) return existing;
|
|
18
|
+
|
|
19
|
+
const listeners = new Set();
|
|
20
|
+
let navigator = null;
|
|
21
|
+
const store = {
|
|
22
|
+
subscribe(listener) {
|
|
23
|
+
listeners.add(listener);
|
|
24
|
+
return () => listeners.delete(listener);
|
|
25
|
+
},
|
|
26
|
+
getHref() {
|
|
27
|
+
const loc = globalThis.location;
|
|
28
|
+
return loc ? loc.pathname + loc.search + loc.hash : '/';
|
|
29
|
+
},
|
|
30
|
+
notify() {
|
|
31
|
+
for (const listener of [...listeners]) {
|
|
32
|
+
try {
|
|
33
|
+
listener();
|
|
34
|
+
} catch {
|
|
35
|
+
// One subscriber must not prevent the others from updating.
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
navigate(href, options) {
|
|
40
|
+
if (navigator) return navigator(href, options);
|
|
41
|
+
globalThis.location?.assign(href);
|
|
42
|
+
return Promise.resolve();
|
|
43
|
+
},
|
|
44
|
+
setNavigator(next) {
|
|
45
|
+
navigator = next;
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
globalThis[storeKey] = store;
|
|
50
|
+
return store;
|
|
51
|
+
}
|
|
52
|
+
: RouterRuntime.getNavigationStore;
|
|
53
|
+
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/router.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/router.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,cA8wC3B,CAAC"}
|
|
@@ -1153,11 +1153,19 @@ export const getRouterScript = () => `
|
|
|
1153
1153
|
// same SPA navigator that intercepts <Link> clicks. Without this the shared
|
|
1154
1154
|
// navigation store has no navigator registered and its navigate() falls back
|
|
1155
1155
|
// to a full-page location.assign (finding #7: push() full-reloads).
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1156
|
+
if (
|
|
1157
|
+
typeof navigationStoreUsesRegistryFallback !== 'undefined' &&
|
|
1158
|
+
navigationStoreUsesRegistryFallback
|
|
1159
|
+
) {
|
|
1160
|
+
log('Router runtime does not export getNavigationStore; using shared v1 registry fallback');
|
|
1161
|
+
}
|
|
1162
|
+
if (typeof getNavigationStore === 'function') {
|
|
1163
|
+
getNavigationStore().setNavigator((href, options) => {
|
|
1164
|
+
const mode = options && options.history;
|
|
1165
|
+
const historyMode = mode === 'replace' ? 'replace' : mode === 'none' ? 'none' : 'push';
|
|
1166
|
+
return navigateSPA(href, historyMode);
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1161
1169
|
|
|
1162
1170
|
// ============================================
|
|
1163
1171
|
// Event handlers
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-executor.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/build-executor.ts"],"names":[],"mappings":"AAmBA,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"build-executor.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/build-executor.ts"],"names":[],"mappings":"AAmBA,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,oBAAoB,CAAC;AAiD5B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA2B/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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,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"}
|
|
@@ -38,7 +38,7 @@ import { validatePathSync } from "../security/path-validation.js";
|
|
|
38
38
|
import { collectCssImportPaths, CSS_IMPORTING_SOURCE_EXTENSIONS, } from "../html/styles-builder/css-import-extraction.js";
|
|
39
39
|
import { computeHashBytes } from "../utils/index.js";
|
|
40
40
|
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";
|
|
41
|
-
import { routeForPage } from "./route-path.js";
|
|
41
|
+
import { configuredRoutePath, normalizeLogicalPath, routeForConfiguredPage, routeForPage, } from "./route-path.js";
|
|
42
42
|
export { routeForPage } from "./route-path.js";
|
|
43
43
|
const logger = serverLogger.component("release-asset-build");
|
|
44
44
|
/** Browser module source extensions eligible for transform. */
|
|
@@ -98,33 +98,37 @@ function isTransformableBrowserModule(path) {
|
|
|
98
98
|
return true;
|
|
99
99
|
}
|
|
100
100
|
/** True when a logical path should seed the browser module graph. */
|
|
101
|
-
function isBrowserModule(path) {
|
|
101
|
+
function isBrowserModule(path, directories) {
|
|
102
102
|
if (!isTransformableBrowserModule(path))
|
|
103
103
|
return false;
|
|
104
|
-
if (
|
|
104
|
+
if (routeForConfiguredPage(path, directories) !== null)
|
|
105
105
|
return true;
|
|
106
|
-
return
|
|
106
|
+
return isConfiguredAppRouterLayout(path, directories) ||
|
|
107
|
+
BROWSER_MODULE_DIRS.some((dir) => path.startsWith(dir));
|
|
107
108
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
109
|
+
function isConfiguredAppRouterLayout(path, directories) {
|
|
110
|
+
const appPath = configuredRoutePath(path, directories, "app");
|
|
111
|
+
if (!appPath?.startsWith("app/"))
|
|
110
112
|
return false;
|
|
111
|
-
const withoutPrefix =
|
|
113
|
+
const withoutPrefix = appPath.slice("app/".length);
|
|
112
114
|
const segments = withoutPrefix.split("/");
|
|
113
115
|
const fileName = segments.pop();
|
|
114
116
|
if (!fileName || !/^layout\.(tsx|ts|jsx|mdx|js)$/.test(fileName))
|
|
115
117
|
return false;
|
|
116
118
|
return !segments.some((segment) => segment.startsWith("@") || segment.startsWith("_"));
|
|
117
119
|
}
|
|
118
|
-
function
|
|
119
|
-
|
|
120
|
+
function collectConfiguredAppRouterLayoutsForPage(logicalPath, directories, knownPaths) {
|
|
121
|
+
const appPath = configuredRoutePath(logicalPath, directories, "app");
|
|
122
|
+
if (!appPath || routeForPage(appPath) === null)
|
|
120
123
|
return [];
|
|
121
124
|
const segments = logicalPath.split("/");
|
|
122
125
|
segments.pop();
|
|
126
|
+
const appRootDepth = normalizeLogicalPath(directories.app).split("/").filter(Boolean).length;
|
|
123
127
|
const layouts = [];
|
|
124
|
-
for (let depth =
|
|
128
|
+
for (let depth = appRootDepth; depth <= segments.length; depth++) {
|
|
125
129
|
const dir = segments.slice(0, depth).join("/");
|
|
126
130
|
for (const ext of BROWSER_MODULE_EXTENSIONS) {
|
|
127
|
-
const candidate = `${dir}/layout${ext}`;
|
|
131
|
+
const candidate = dir ? `${dir}/layout${ext}` : `layout${ext}`;
|
|
128
132
|
if (knownPaths.has(candidate)) {
|
|
129
133
|
layouts.push(candidate);
|
|
130
134
|
break;
|
|
@@ -133,6 +137,12 @@ function collectAppRouterLayoutsForPage(logicalPath, knownPaths) {
|
|
|
133
137
|
}
|
|
134
138
|
return layouts;
|
|
135
139
|
}
|
|
140
|
+
function releaseRouterDirectories(config) {
|
|
141
|
+
return {
|
|
142
|
+
app: config.directories?.app ?? "app",
|
|
143
|
+
pages: config.directories?.pages ?? "pages",
|
|
144
|
+
};
|
|
145
|
+
}
|
|
136
146
|
function resolveKnownModulePath(path, knownPaths) {
|
|
137
147
|
const normalized = normalizeLogicalPath(path
|
|
138
148
|
.replace(/^\/?_vf_modules\//, "")
|
|
@@ -150,19 +160,6 @@ function resolveKnownModulePath(path, knownPaths) {
|
|
|
150
160
|
}
|
|
151
161
|
return null;
|
|
152
162
|
}
|
|
153
|
-
function normalizeLogicalPath(path) {
|
|
154
|
-
const parts = [];
|
|
155
|
-
for (const part of path.split("/")) {
|
|
156
|
-
if (!part || part === ".")
|
|
157
|
-
continue;
|
|
158
|
-
if (part === "..") {
|
|
159
|
-
parts.pop();
|
|
160
|
-
continue;
|
|
161
|
-
}
|
|
162
|
-
parts.push(part);
|
|
163
|
-
}
|
|
164
|
-
return parts.join("/");
|
|
165
|
-
}
|
|
166
163
|
function normalizeProjectSpecifier(specifier, logicalPath) {
|
|
167
164
|
if (specifier.startsWith("http://") ||
|
|
168
165
|
specifier.startsWith("https://") ||
|
|
@@ -1085,8 +1082,9 @@ async function runBuildInner(input, tempDir, client, transform) {
|
|
|
1085
1082
|
for (const file of files) {
|
|
1086
1083
|
if (typeof file.content !== "string")
|
|
1087
1084
|
continue;
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1085
|
+
const logicalPath = file.path.replace(/\\/g, "/");
|
|
1086
|
+
const abs = resolveMaterializedReleasePath(tempDir, logicalPath);
|
|
1087
|
+
sourceByPath.set(normalizeLogicalPath(logicalPath), file.content);
|
|
1090
1088
|
await fs.mkdir(dirname(abs), { recursive: true });
|
|
1091
1089
|
await fs.writeTextFile(abs, file.content);
|
|
1092
1090
|
}
|
|
@@ -1102,6 +1100,7 @@ async function runBuildInner(input, tempDir, client, transform) {
|
|
|
1102
1100
|
const vendorHttpImports = input.vendorHttpImports ?? vendorHttpImportsWithCache;
|
|
1103
1101
|
const vendorDependencies = isDependencyImportMapEnabled();
|
|
1104
1102
|
const releaseConfig = await resolveReleaseConfigFromSourceFiles(sourceByPath, input, tempDir);
|
|
1103
|
+
const routeDirectories = releaseRouterDirectories(releaseConfig);
|
|
1105
1104
|
const releaseReactVersion = await resolveReleaseReactVersion(sourceByPath, releaseConfig, input.reactVersion, tempDir);
|
|
1106
1105
|
const transformingModules = new Set();
|
|
1107
1106
|
async function transformProjectModule(logicalPath) {
|
|
@@ -1183,7 +1182,7 @@ async function runBuildInner(input, tempDir, client, transform) {
|
|
|
1183
1182
|
return null;
|
|
1184
1183
|
}
|
|
1185
1184
|
for (const logicalPath of sourceByPath.keys()) {
|
|
1186
|
-
if (!isBrowserModule(logicalPath))
|
|
1185
|
+
if (!isBrowserModule(logicalPath, routeDirectories))
|
|
1187
1186
|
continue;
|
|
1188
1187
|
const failure = await transformProjectModule(logicalPath);
|
|
1189
1188
|
if (failure)
|
|
@@ -1304,14 +1303,14 @@ async function runBuildInner(input, tempDir, client, transform) {
|
|
|
1304
1303
|
// B2. Routes: walk the transformed browser import closure from each page entrypoint.
|
|
1305
1304
|
// Modules missing from transformedModules are recorded as closure gaps.
|
|
1306
1305
|
const routes = {};
|
|
1307
|
-
const pageModules = Object.keys(modules).filter((p) =>
|
|
1306
|
+
const pageModules = Object.keys(modules).filter((p) => routeForConfiguredPage(p, routeDirectories) !== null);
|
|
1308
1307
|
for (const logicalPath of pageModules) {
|
|
1309
|
-
const route =
|
|
1308
|
+
const route = routeForConfiguredPage(logicalPath, routeDirectories);
|
|
1310
1309
|
if (!route)
|
|
1311
1310
|
continue;
|
|
1312
1311
|
const entryModules = [
|
|
1313
1312
|
logicalPath,
|
|
1314
|
-
...
|
|
1313
|
+
...collectConfiguredAppRouterLayoutsForPage(logicalPath, routeDirectories, knownPaths),
|
|
1315
1314
|
];
|
|
1316
1315
|
const { modules: closureModules, gaps: closureGaps } = await collectRouteClosure(entryModules, transformedModules, knownPaths);
|
|
1317
1316
|
// Include only modules we actually have in the manifest (transformed +
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { ReleaseAssetManifest } from "./manifest-schema.js";
|
|
2
|
-
export declare function buildReleaseAssetModules(manifest?: ReleaseAssetManifest | null
|
|
2
|
+
export declare function buildReleaseAssetModules(manifest?: ReleaseAssetManifest | null, options?: {
|
|
3
|
+
route?: string | null;
|
|
4
|
+
}): Record<string, string> | undefined;
|
|
3
5
|
//# sourceMappingURL=client-module-map.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-module-map.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/client-module-map.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,wBAAgB,wBAAwB,CACtC,QAAQ,CAAC,EAAE,oBAAoB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"client-module-map.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/client-module-map.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,wBAAgB,wBAAwB,CACtC,QAAQ,CAAC,EAAE,oBAAoB,GAAG,IAAI,EACtC,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,GACtC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAuBpC"}
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import { releaseAssetUrl } from "./constants.js";
|
|
2
|
-
export function buildReleaseAssetModules(manifest) {
|
|
2
|
+
export function buildReleaseAssetModules(manifest, options = {}) {
|
|
3
3
|
if (!manifest)
|
|
4
4
|
return undefined;
|
|
5
|
+
const routeModules = options.route ? manifest.routes[options.route]?.modules : undefined;
|
|
6
|
+
const buildFallback = () => {
|
|
7
|
+
const fallbackModules = {};
|
|
8
|
+
for (const [path, entry] of Object.entries(manifest.modules)) {
|
|
9
|
+
fallbackModules[path] = releaseAssetUrl(entry.contentHash, "js");
|
|
10
|
+
}
|
|
11
|
+
return Object.keys(fallbackModules).length > 0 ? fallbackModules : undefined;
|
|
12
|
+
};
|
|
13
|
+
if (!routeModules)
|
|
14
|
+
return buildFallback();
|
|
15
|
+
if (routeModules.length === 0)
|
|
16
|
+
return buildFallback();
|
|
5
17
|
const modules = {};
|
|
6
|
-
for (const
|
|
18
|
+
for (const path of routeModules) {
|
|
19
|
+
const entry = manifest.modules[path];
|
|
20
|
+
if (!entry)
|
|
21
|
+
return buildFallback();
|
|
7
22
|
modules[path] = releaseAssetUrl(entry.contentHash, "js");
|
|
8
23
|
}
|
|
9
|
-
return
|
|
24
|
+
return modules;
|
|
10
25
|
}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
export interface ConfiguredRouteDirectories {
|
|
2
|
+
app?: string;
|
|
3
|
+
pages?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function normalizeLogicalPath(path: string): string;
|
|
6
|
+
export declare function pathBelowRoot(path: string, root: string): string | null;
|
|
7
|
+
export declare function configuredRoutePath(path: string, directories: ConfiguredRouteDirectories | undefined, routeRoot: "app" | "pages"): string | null;
|
|
1
8
|
/** Derive a route path from a page module logical path. */
|
|
2
9
|
export declare function routeForPage(logicalPath: string): string | null;
|
|
10
|
+
export declare function routeForConfiguredPage(path: string, directories?: ConfiguredRouteDirectories): string | null;
|
|
3
11
|
//# sourceMappingURL=route-path.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-path.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/route-path.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"route-path.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/route-path.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,0BAA0B;IACzC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAQD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAWzD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOvE;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,0BAA0B,GAAG,SAAS,EACnD,SAAS,EAAE,KAAK,GAAG,OAAO,GACzB,MAAM,GAAG,IAAI,CAGf;AAED,2DAA2D;AAC3D,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAuC/D;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,0BAA0B,GACvC,MAAM,GAAG,IAAI,CAWf"}
|
|
@@ -7,6 +7,33 @@ function stripPageModuleExtension(logicalPath) {
|
|
|
7
7
|
return null;
|
|
8
8
|
return logicalPath.replace(PAGE_MODULE_EXTENSION, "");
|
|
9
9
|
}
|
|
10
|
+
export function normalizeLogicalPath(path) {
|
|
11
|
+
const parts = [];
|
|
12
|
+
for (const part of path.replace(/\\/g, "/").split("/")) {
|
|
13
|
+
if (!part || part === ".")
|
|
14
|
+
continue;
|
|
15
|
+
if (part === "..") {
|
|
16
|
+
parts.pop();
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
parts.push(part);
|
|
20
|
+
}
|
|
21
|
+
return parts.join("/");
|
|
22
|
+
}
|
|
23
|
+
export function pathBelowRoot(path, root) {
|
|
24
|
+
const normalizedPath = normalizeLogicalPath(path);
|
|
25
|
+
const normalizedRoot = normalizeLogicalPath(root);
|
|
26
|
+
if (normalizedRoot === "")
|
|
27
|
+
return normalizedPath;
|
|
28
|
+
if (normalizedPath === normalizedRoot)
|
|
29
|
+
return "";
|
|
30
|
+
const prefix = `${normalizedRoot}/`;
|
|
31
|
+
return normalizedPath.startsWith(prefix) ? normalizedPath.slice(prefix.length) : null;
|
|
32
|
+
}
|
|
33
|
+
export function configuredRoutePath(path, directories, routeRoot) {
|
|
34
|
+
const relativePath = pathBelowRoot(path, directories?.[routeRoot] ?? routeRoot);
|
|
35
|
+
return relativePath === null ? null : `${routeRoot}/${relativePath}`;
|
|
36
|
+
}
|
|
10
37
|
/** Derive a route path from a page module logical path. */
|
|
11
38
|
export function routeForPage(logicalPath) {
|
|
12
39
|
if (logicalPath.startsWith("pages/")) {
|
|
@@ -45,3 +72,15 @@ export function routeForPage(logicalPath) {
|
|
|
45
72
|
}
|
|
46
73
|
return null;
|
|
47
74
|
}
|
|
75
|
+
export function routeForConfiguredPage(path, directories) {
|
|
76
|
+
const appPath = configuredRoutePath(path, directories, "app");
|
|
77
|
+
if (appPath) {
|
|
78
|
+
const route = routeForPage(appPath);
|
|
79
|
+
if (route !== null)
|
|
80
|
+
return route;
|
|
81
|
+
}
|
|
82
|
+
const pagesPath = configuredRoutePath(path, directories, "pages");
|
|
83
|
+
if (pagesPath)
|
|
84
|
+
return routeForPage(pagesPath);
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/orchestrator/html.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAClF,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAmIlF,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAsB;gBAExB,MAAM,EAAE,mBAAmB;IAIjC,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;IAgBjE,kBAAkB,CACtB,WAAW,EAAE,cAAc,EAC3B,OAAO,EAAE,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,GAC3C,OAAO,CAAC,cAAc,CAAC;YAkEZ,sBAAsB;
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/orchestrator/html.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAClF,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAmIlF,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAsB;gBAExB,MAAM,EAAE,mBAAmB;IAIjC,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;IAgBjE,kBAAkB,CACtB,WAAW,EAAE,cAAc,EAC3B,OAAO,EAAE,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,GAC3C,OAAO,CAAC,cAAc,CAAC;YAkEZ,sBAAsB;YA+DtB,4BAA4B;YAiB5B,wBAAwB;YAmBxB,gBAAgB;YAyBhB,kBAAkB;IAwDhC,OAAO,CAAC,cAAc;IAQtB;;;;;;OAMG;IACG,qBAAqB,CACzB,OAAO,EAAE,qBAAqB,EAC9B,KAAK,EAAE,KAAK,GACX,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAwB/C,yBAAyB,CAC7B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;YAqDzC,eAAe;YAkBf,gBAAgB;IA+G9B;;;;OAIG;YACW,gBAAgB;CAc/B"}
|
|
@@ -205,6 +205,7 @@ export class HTMLGenerator {
|
|
|
205
205
|
importMapJson,
|
|
206
206
|
projectStylesheetHref,
|
|
207
207
|
releaseAssetManifest,
|
|
208
|
+
directories: this.config.config.directories,
|
|
208
209
|
});
|
|
209
210
|
if (injectedHtml.trimStart().toLowerCase().startsWith("<!doctype"))
|
|
210
211
|
return injectedHtml;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-tools.d.ts","sourceRoot":"","sources":["../../../src/src/tool/host-tools.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAU,MAAM,+BAA+B,CAAC;AACxE,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"host-tools.d.ts","sourceRoot":"","sources":["../../../src/src/tool/host-tools.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAU,MAAM,+BAA+B,CAAC;AACxE,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGlF,KAAK,eAAe,GAAG;IACrB,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;CAChG,CAAC,gBAAgB,CAAC,CAAC;AAEpB,gCAAgC;AAChC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACpB,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,eAAe,CAAC;IAC5C,GAAG,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;CACzB,CAAC;AAEF,6CAA6C;AAC7C,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;AAO7D,qDAAqD;AACrD,MAAM,WAAW,8BAA8B;IAC7C,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;CACnD;AA2DD,0CAA0C;AAC1C,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,WAAW,EACxB,OAAO,CAAC,EAAE,8BAA8B,GACvC,OAAO,CAAC;AACX,0CAA0C;AAC1C,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,OAAO,CAAC,EAAE,8BAA8B,GACvC,OAAO,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as dntShim from "../../_dnt.shims.js";
|
|
2
2
|
import { dynamicTool, tool } from "./factory.js";
|
|
3
3
|
import { agentLogger } from "../utils/index.js";
|
|
4
|
+
import { getRemoteToolProvenance, markRemoteToolProvenance } from "./remote-tool-provenance.js";
|
|
4
5
|
function isRecord(value) {
|
|
5
6
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6
7
|
}
|
|
@@ -49,8 +50,9 @@ export function createToolsFromHostDefinitions(definitions, options = {}) {
|
|
|
49
50
|
continue;
|
|
50
51
|
const execute = async (input, context) => await definition.execute(input, normalizeExecutionContext(toolName, context, options));
|
|
51
52
|
try {
|
|
53
|
+
let materializedTool;
|
|
52
54
|
if (definition.inputSchemaJson) {
|
|
53
|
-
|
|
55
|
+
materializedTool = dynamicTool({
|
|
54
56
|
id: toolName,
|
|
55
57
|
description: definition.description,
|
|
56
58
|
inputSchema: definition.inputSchema,
|
|
@@ -60,7 +62,7 @@ export function createToolsFromHostDefinitions(definitions, options = {}) {
|
|
|
60
62
|
});
|
|
61
63
|
}
|
|
62
64
|
else if (isSchemaLike(definition.inputSchema)) {
|
|
63
|
-
|
|
65
|
+
materializedTool = tool({
|
|
64
66
|
id: toolName,
|
|
65
67
|
description: definition.description,
|
|
66
68
|
inputSchema: definition.inputSchema,
|
|
@@ -68,6 +70,12 @@ export function createToolsFromHostDefinitions(definitions, options = {}) {
|
|
|
68
70
|
mcp: definition.mcp,
|
|
69
71
|
});
|
|
70
72
|
}
|
|
73
|
+
if (materializedTool) {
|
|
74
|
+
const canonicalRemoteToolName = getRemoteToolProvenance(definition);
|
|
75
|
+
tools[toolName] = canonicalRemoteToolName
|
|
76
|
+
? markRemoteToolProvenance(materializedTool, canonicalRemoteToolName)
|
|
77
|
+
: materializedTool;
|
|
78
|
+
}
|
|
71
79
|
}
|
|
72
80
|
catch (error) {
|
|
73
81
|
agentLogger.warn("Skipping host tool: schema conversion failed", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-source-tools.d.ts","sourceRoot":"","sources":["../../../src/src/tool/remote-source-tools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remote-source-tools.d.ts","sourceRoot":"","sources":["../../../src/src/tool/remote-source-tools.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE/F,uDAAuD;AACvD,MAAM,WAAW,gCAAgC;IAC/C,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAkBD,4CAA4C;AAC5C,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,gBAAgB,EACxB,WAAW,EAAE,SAAS,cAAc,EAAE,EACtC,OAAO,GAAE,IAAI,CAAC,gCAAgC,EAAE,SAAS,CAAM,GAC9D,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CA0BxC;AAED,sCAAsC;AACtC,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,gBAAgB,EACxB,OAAO,GAAE,gCAAqC,GAC7C,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAKjD"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineSchema } from "../schemas/index.js";
|
|
2
2
|
import { dynamicTool } from "./factory.js";
|
|
3
|
+
import { markRemoteToolProvenance } from "./remote-tool-provenance.js";
|
|
3
4
|
/**
|
|
4
5
|
* Permissive input schema used for remote tools whose JSON Schema is
|
|
5
6
|
* sourced from the remote and we only need a no-op contract `Schema<T>` to
|
|
@@ -17,19 +18,20 @@ function toToolInputRecord(input) {
|
|
|
17
18
|
export function createToolsFromRemoteDefinitions(source, definitions, options = {}) {
|
|
18
19
|
return Object.fromEntries(definitions.map((definition) => {
|
|
19
20
|
const toolName = options.toolNameAliases?.[definition.name] ?? definition.name;
|
|
21
|
+
const remoteTool = markRemoteToolProvenance(dynamicTool({
|
|
22
|
+
id: toolName,
|
|
23
|
+
description: definition.description,
|
|
24
|
+
inputSchema: getRemoteToolPassthroughSchema(),
|
|
25
|
+
inputSchemaJson: definition.parameters,
|
|
26
|
+
mcp: {
|
|
27
|
+
title: definition.title,
|
|
28
|
+
annotations: definition.annotations,
|
|
29
|
+
},
|
|
30
|
+
execute: async (input, context) => await source.executeTool(definition.name, toToolInputRecord(input), context),
|
|
31
|
+
}), definition.name);
|
|
20
32
|
return [
|
|
21
33
|
toolName,
|
|
22
|
-
|
|
23
|
-
id: toolName,
|
|
24
|
-
description: definition.description,
|
|
25
|
-
inputSchema: getRemoteToolPassthroughSchema(),
|
|
26
|
-
inputSchemaJson: definition.parameters,
|
|
27
|
-
mcp: {
|
|
28
|
-
title: definition.title,
|
|
29
|
-
annotations: definition.annotations,
|
|
30
|
-
},
|
|
31
|
-
execute: async (input, context) => await source.executeTool(definition.name, toToolInputRecord(input), context),
|
|
32
|
-
}),
|
|
34
|
+
remoteTool,
|
|
33
35
|
];
|
|
34
36
|
}));
|
|
35
37
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Mark a runtime tool as materialized from a trusted remote tool source. */
|
|
2
|
+
export declare function markRemoteToolProvenance<T extends object>(tool: T, canonicalToolName: string): T;
|
|
3
|
+
/** Return the canonical remote tool name carried by trusted provenance. */
|
|
4
|
+
export declare function getRemoteToolProvenance(value: unknown): string | undefined;
|
|
5
|
+
//# sourceMappingURL=remote-tool-provenance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-tool-provenance.d.ts","sourceRoot":"","sources":["../../../src/src/tool/remote-tool-provenance.ts"],"names":[],"mappings":"AAMA,6EAA6E;AAC7E,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,MAAM,EACvD,IAAI,EAAE,CAAC,EACP,iBAAiB,EAAE,MAAM,GACxB,CAAC,CAMH;AAED,2EAA2E;AAC3E,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAS1E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const REMOTE_TOOL_PROVENANCE = Symbol("veryfront.remote-tool-provenance");
|
|
2
|
+
/** Mark a runtime tool as materialized from a trusted remote tool source. */
|
|
3
|
+
export function markRemoteToolProvenance(tool, canonicalToolName) {
|
|
4
|
+
Object.defineProperty(tool, REMOTE_TOOL_PROVENANCE, {
|
|
5
|
+
value: canonicalToolName,
|
|
6
|
+
enumerable: true,
|
|
7
|
+
});
|
|
8
|
+
return tool;
|
|
9
|
+
}
|
|
10
|
+
/** Return the canonical remote tool name carried by trusted provenance. */
|
|
11
|
+
export function getRemoteToolProvenance(value) {
|
|
12
|
+
if (typeof value !== "object" || value === null) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
const canonicalToolName = value[REMOTE_TOOL_PROVENANCE];
|
|
16
|
+
return typeof canonicalToolName === "string" && canonicalToolName.length > 0
|
|
17
|
+
? canonicalToolName
|
|
18
|
+
: undefined;
|
|
19
|
+
}
|
|
@@ -398,7 +398,7 @@ export async function clearESMDiskCache() {
|
|
|
398
398
|
const fs = getLocalFs();
|
|
399
399
|
try {
|
|
400
400
|
// Remove entire cache directory and recreate it
|
|
401
|
-
// This handles nested project directories
|
|
401
|
+
// This handles nested project directories such as customer/local-main/
|
|
402
402
|
await fs.remove(cacheDir, { recursive: true });
|
|
403
403
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
404
404
|
logger.debug(`${LOG_PREFIX_MDX_LOADER} Cleared ESM disk cache`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1159",
|
|
4
4
|
"description": "The simplest way to build AI-powered apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -332,10 +332,10 @@
|
|
|
332
332
|
"@types/react": "19.2.14",
|
|
333
333
|
"@types/react-dom": "19.2.3",
|
|
334
334
|
"ws": "8.21.0",
|
|
335
|
-
"@veryfront/ext-bundler-esbuild": "0.1.
|
|
336
|
-
"@veryfront/ext-content-mdx": "0.1.
|
|
337
|
-
"@veryfront/ext-css-tailwind": "0.1.
|
|
338
|
-
"@veryfront/ext-parser-babel": "0.1.
|
|
335
|
+
"@veryfront/ext-bundler-esbuild": "0.1.1159",
|
|
336
|
+
"@veryfront/ext-content-mdx": "0.1.1159",
|
|
337
|
+
"@veryfront/ext-css-tailwind": "0.1.1159",
|
|
338
|
+
"@veryfront/ext-parser-babel": "0.1.1159"
|
|
339
339
|
},
|
|
340
340
|
"devDependencies": {
|
|
341
341
|
"@types/node": "20.9.0"
|