@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/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { sip } from '@standardagents/sip';
|
|
|
2
2
|
import fs2 from 'fs';
|
|
3
3
|
import path3 from 'path';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
|
+
import { createRequire } from 'module';
|
|
5
6
|
export { defineAgent, defineHook, defineModel, definePrompt, defineThreadEndpoint, defineTool } from '@standardagents/spec';
|
|
6
7
|
import { DurableObject } from 'cloudflare:workers';
|
|
7
8
|
|
|
@@ -7697,6 +7698,7 @@ function validateAgentData(data) {
|
|
|
7697
7698
|
}
|
|
7698
7699
|
|
|
7699
7700
|
// src/plugin.ts
|
|
7701
|
+
createRequire(import.meta.url);
|
|
7700
7702
|
var VIRTUAL_TOOLS_ID = "virtual:@standardagents-tools";
|
|
7701
7703
|
var RESOLVED_VIRTUAL_TOOLS_ID = "\0" + VIRTUAL_TOOLS_ID;
|
|
7702
7704
|
var VIRTUAL_ROUTES_ID = "virtual:@standardagents-routes";
|
|
@@ -8149,15 +8151,7 @@ function agentbuilder(options = {}) {
|
|
|
8149
8151
|
"zod",
|
|
8150
8152
|
"openai"
|
|
8151
8153
|
];
|
|
8152
|
-
const currentDir = path3.dirname(fileURLToPath(import.meta.url));
|
|
8153
|
-
const isInDist = currentDir.endsWith("dist");
|
|
8154
|
-
const builderClientDir = path3.resolve(
|
|
8155
|
-
currentDir,
|
|
8156
|
-
isInDist ? "./client" : "../dist/client"
|
|
8157
|
-
);
|
|
8158
8154
|
return {
|
|
8159
|
-
// Set publicDir to builder's client assets so Cloudflare plugin preserves assets config
|
|
8160
|
-
publicDir: fs2.existsSync(builderClientDir) ? builderClientDir : void 0,
|
|
8161
8155
|
optimizeDeps: {
|
|
8162
8156
|
// Exclude our packages from pre-bundling - they contain cloudflare:workers imports
|
|
8163
8157
|
// that cannot be resolved during dependency optimization
|
|
@@ -8397,15 +8391,13 @@ async function serveUI(pathname, env) {
|
|
|
8397
8391
|
// Create a proper request for the asset path
|
|
8398
8392
|
// Use a dummy origin since we only care about the path
|
|
8399
8393
|
// Re-add mount point since pathname was stripped by router
|
|
8400
|
-
|
|
8401
|
-
const mountPrefix = MOUNT_POINT === "/" ? "" : MOUNT_POINT;
|
|
8402
|
-
const assetUrl = \`http://localhost\${mountPrefix}\${pathname}\`;
|
|
8394
|
+
const assetUrl = \`http://localhost\${MOUNT_POINT}\${pathname}\`;
|
|
8403
8395
|
let response = await env.ASSETS.fetch(assetUrl);
|
|
8404
8396
|
|
|
8405
8397
|
// If not found, fall back to index.html for SPA routing
|
|
8406
8398
|
const isIndexHtml = response.status === 404 || pathname === "/" || !pathname.includes(".");
|
|
8407
8399
|
if (isIndexHtml) {
|
|
8408
|
-
response = await env.ASSETS.fetch(\`http://localhost\${
|
|
8400
|
+
response = await env.ASSETS.fetch(\`http://localhost\${MOUNT_POINT}/index.html\`);
|
|
8409
8401
|
|
|
8410
8402
|
// Transform HTML to use configured mount point
|
|
8411
8403
|
if (response.status === 200) {
|