@standardagents/builder 0.11.0-next.0fa8695 → 0.11.0-next.174a940
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/dist/index.js +4 -12
- package/dist/index.js.map +1 -1
- package/dist/plugin.js +4 -12
- package/dist/plugin.js.map +1 -1
- package/package.json +4 -4
package/dist/plugin.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs2 from 'fs';
|
|
2
2
|
import path3 from 'path';
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
|
+
import { createRequire } from 'module';
|
|
4
5
|
|
|
5
6
|
// src/plugin.ts
|
|
6
7
|
var TSCONFIG_CONTENT = `{
|
|
@@ -1616,6 +1617,7 @@ function validateAgentData(data) {
|
|
|
1616
1617
|
}
|
|
1617
1618
|
|
|
1618
1619
|
// src/plugin.ts
|
|
1620
|
+
createRequire(import.meta.url);
|
|
1619
1621
|
var VIRTUAL_TOOLS_ID = "virtual:@standardagents-tools";
|
|
1620
1622
|
var RESOLVED_VIRTUAL_TOOLS_ID = "\0" + VIRTUAL_TOOLS_ID;
|
|
1621
1623
|
var VIRTUAL_ROUTES_ID = "virtual:@standardagents-routes";
|
|
@@ -2068,15 +2070,7 @@ function agentbuilder(options = {}) {
|
|
|
2068
2070
|
"zod",
|
|
2069
2071
|
"openai"
|
|
2070
2072
|
];
|
|
2071
|
-
const currentDir = path3.dirname(fileURLToPath(import.meta.url));
|
|
2072
|
-
const isInDist = currentDir.endsWith("dist");
|
|
2073
|
-
const builderClientDir = path3.resolve(
|
|
2074
|
-
currentDir,
|
|
2075
|
-
isInDist ? "./client" : "../dist/client"
|
|
2076
|
-
);
|
|
2077
2073
|
return {
|
|
2078
|
-
// Set publicDir to builder's client assets so Cloudflare plugin preserves assets config
|
|
2079
|
-
publicDir: fs2.existsSync(builderClientDir) ? builderClientDir : void 0,
|
|
2080
2074
|
optimizeDeps: {
|
|
2081
2075
|
// Exclude our packages from pre-bundling - they contain cloudflare:workers imports
|
|
2082
2076
|
// that cannot be resolved during dependency optimization
|
|
@@ -2316,15 +2310,13 @@ async function serveUI(pathname, env) {
|
|
|
2316
2310
|
// Create a proper request for the asset path
|
|
2317
2311
|
// Use a dummy origin since we only care about the path
|
|
2318
2312
|
// Re-add mount point since pathname was stripped by router
|
|
2319
|
-
|
|
2320
|
-
const mountPrefix = MOUNT_POINT === "/" ? "" : MOUNT_POINT;
|
|
2321
|
-
const assetUrl = \`http://localhost\${mountPrefix}\${pathname}\`;
|
|
2313
|
+
const assetUrl = \`http://localhost\${MOUNT_POINT}\${pathname}\`;
|
|
2322
2314
|
let response = await env.ASSETS.fetch(assetUrl);
|
|
2323
2315
|
|
|
2324
2316
|
// If not found, fall back to index.html for SPA routing
|
|
2325
2317
|
const isIndexHtml = response.status === 404 || pathname === "/" || !pathname.includes(".");
|
|
2326
2318
|
if (isIndexHtml) {
|
|
2327
|
-
response = await env.ASSETS.fetch(\`http://localhost\${
|
|
2319
|
+
response = await env.ASSETS.fetch(\`http://localhost\${MOUNT_POINT}/index.html\`);
|
|
2328
2320
|
|
|
2329
2321
|
// Transform HTML to use configured mount point
|
|
2330
2322
|
if (response.status === 200) {
|