@standardagents/builder 0.10.1-next.9e1860c → 0.11.0-next.0fa8695
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/built-in-routes.js +50 -88
- package/dist/built-in-routes.js.map +1 -1
- package/dist/client/assets/index.css +1 -1
- package/dist/client/index.js +23 -26
- package/dist/client/vendor.js +1 -1
- package/dist/client/vue.js +1 -1
- package/dist/index.d.ts +15 -7
- package/dist/index.js +18 -107
- package/dist/index.js.map +1 -1
- package/dist/plugin.js +7 -71
- package/dist/plugin.js.map +1 -1
- package/package.json +6 -8
- package/dist/sip.wasm +0 -0
package/dist/plugin.js
CHANGED
|
@@ -397,9 +397,6 @@ declare module 'virtual:@standardagents/builder' {
|
|
|
397
397
|
listThreads(params?: {
|
|
398
398
|
agent_name?: string;
|
|
399
399
|
user_id?: string;
|
|
400
|
-
search?: string;
|
|
401
|
-
startDate?: number;
|
|
402
|
-
endDate?: number;
|
|
403
400
|
limit?: number;
|
|
404
401
|
offset?: number;
|
|
405
402
|
}): Promise<{ threads: ThreadRegistryEntry[]; total: number }>;
|
|
@@ -2233,48 +2230,6 @@ function isPublicRoute(routePath) {
|
|
|
2233
2230
|
return false;
|
|
2234
2231
|
}
|
|
2235
2232
|
|
|
2236
|
-
// CORS headers for API responses
|
|
2237
|
-
const CORS_HEADERS = {
|
|
2238
|
-
"Access-Control-Allow-Origin": "*",
|
|
2239
|
-
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
|
|
2240
|
-
"Access-Control-Allow-Headers": "Content-Type, Authorization, X-Requested-With",
|
|
2241
|
-
"Access-Control-Max-Age": "86400",
|
|
2242
|
-
};
|
|
2243
|
-
|
|
2244
|
-
// Helper to create headers with CORS
|
|
2245
|
-
function corsHeaders(contentType) {
|
|
2246
|
-
return {
|
|
2247
|
-
"Content-Type": contentType,
|
|
2248
|
-
...CORS_HEADERS,
|
|
2249
|
-
};
|
|
2250
|
-
}
|
|
2251
|
-
|
|
2252
|
-
// Helper to add CORS headers to any Response without touching the body
|
|
2253
|
-
function addCorsHeaders(response) {
|
|
2254
|
-
// Skip WebSocket upgrade responses - they can't be wrapped
|
|
2255
|
-
if (response.status === 101) {
|
|
2256
|
-
return response;
|
|
2257
|
-
}
|
|
2258
|
-
|
|
2259
|
-
// Skip if already has CORS headers
|
|
2260
|
-
if (response.headers.has("Access-Control-Allow-Origin")) {
|
|
2261
|
-
return response;
|
|
2262
|
-
}
|
|
2263
|
-
|
|
2264
|
-
// Create new headers with CORS added
|
|
2265
|
-
const newHeaders = new Headers(response.headers);
|
|
2266
|
-
for (const [key, value] of Object.entries(CORS_HEADERS)) {
|
|
2267
|
-
newHeaders.set(key, value);
|
|
2268
|
-
}
|
|
2269
|
-
|
|
2270
|
-
// Return new Response with same body stream (not cloned, just transferred)
|
|
2271
|
-
return new Response(response.body, {
|
|
2272
|
-
status: response.status,
|
|
2273
|
-
statusText: response.statusText,
|
|
2274
|
-
headers: newHeaders,
|
|
2275
|
-
});
|
|
2276
|
-
}
|
|
2277
|
-
|
|
2278
2233
|
export async function router(request, env) {
|
|
2279
2234
|
const url = new URL(request.url);
|
|
2280
2235
|
const pathname = url.pathname;
|
|
@@ -2284,14 +2239,6 @@ export async function router(request, env) {
|
|
|
2284
2239
|
return null;
|
|
2285
2240
|
}
|
|
2286
2241
|
|
|
2287
|
-
// Handle CORS preflight requests
|
|
2288
|
-
if (request.method === "OPTIONS") {
|
|
2289
|
-
return new Response(null, {
|
|
2290
|
-
status: 204,
|
|
2291
|
-
headers: CORS_HEADERS,
|
|
2292
|
-
});
|
|
2293
|
-
}
|
|
2294
|
-
|
|
2295
2242
|
// Strip mount point prefix for route matching, ensuring we keep the leading slash
|
|
2296
2243
|
let routePath = pathname.slice(MOUNT_POINT.length) || "/";
|
|
2297
2244
|
if (!routePath.startsWith('/')) {
|
|
@@ -2326,7 +2273,7 @@ ${threadRouteCode}
|
|
|
2326
2273
|
|
|
2327
2274
|
// If requireAuth returns a Response, it's an error (401)
|
|
2328
2275
|
if (authResult instanceof Response) {
|
|
2329
|
-
return
|
|
2276
|
+
return authResult;
|
|
2330
2277
|
}
|
|
2331
2278
|
|
|
2332
2279
|
authContext = authResult;
|
|
@@ -2345,17 +2292,16 @@ ${threadRouteCode}
|
|
|
2345
2292
|
const result = await controller(context);
|
|
2346
2293
|
|
|
2347
2294
|
if (result instanceof Response) {
|
|
2348
|
-
return
|
|
2295
|
+
return result;
|
|
2349
2296
|
}
|
|
2350
2297
|
if (typeof result === "string") {
|
|
2351
2298
|
return new Response(result, {
|
|
2352
|
-
headers:
|
|
2299
|
+
headers: {
|
|
2300
|
+
"Content-Type": "text/plain",
|
|
2301
|
+
},
|
|
2353
2302
|
});
|
|
2354
2303
|
}
|
|
2355
|
-
|
|
2356
|
-
return new Response(JSON.stringify(result), {
|
|
2357
|
-
headers: corsHeaders("application/json"),
|
|
2358
|
-
});
|
|
2304
|
+
return Response.json(result);
|
|
2359
2305
|
}
|
|
2360
2306
|
|
|
2361
2307
|
// Serve UI for all other routes (SPA fallback)
|
|
@@ -2663,8 +2609,7 @@ import { DurableAgentBuilder as _BaseDurableAgentBuilder } from '@standardagents
|
|
|
2663
2609
|
|
|
2664
2610
|
// Import sip WASM module and initializer
|
|
2665
2611
|
// Static import allows workerd to pre-compile the WASM at bundle time
|
|
2666
|
-
|
|
2667
|
-
import _sipWasm from '@standardagents/builder/dist/sip.wasm';
|
|
2612
|
+
import _sipWasm from '@standardagents/sip/dist/sip.wasm';
|
|
2668
2613
|
import { initWithWasmModule as _initSipWasm } from '@standardagents/sip';
|
|
2669
2614
|
|
|
2670
2615
|
// Re-export router from virtual:@standardagents-routes
|
|
@@ -3219,13 +3164,6 @@ export class DurableAgentBuilder extends _BaseDurableAgentBuilder {
|
|
|
3219
3164
|
const items = match[1].match(/['"]([^'"]+)['"]/g);
|
|
3220
3165
|
return items ? items.map((s) => s.replace(/['"]/g, "")) : [];
|
|
3221
3166
|
};
|
|
3222
|
-
const getSidePrompt = (c, side) => {
|
|
3223
|
-
const sideRegex = new RegExp(`${side}:\\s*\\{([^}]+)\\}`, "s");
|
|
3224
|
-
const sideMatch = c.match(sideRegex);
|
|
3225
|
-
if (!sideMatch) return null;
|
|
3226
|
-
const promptMatch = sideMatch[1].match(/prompt:\s*['"]([^'"]+)['"]/);
|
|
3227
|
-
return promptMatch ? promptMatch[1] : null;
|
|
3228
|
-
};
|
|
3229
3167
|
const name = getName(content);
|
|
3230
3168
|
if (!name) return null;
|
|
3231
3169
|
return {
|
|
@@ -3236,8 +3174,6 @@ export class DurableAgentBuilder extends _BaseDurableAgentBuilder {
|
|
|
3236
3174
|
default_prompt: getDefaultPrompt(content) || "",
|
|
3237
3175
|
default_model: getDefaultModel(content) || "",
|
|
3238
3176
|
tools: getTools(content),
|
|
3239
|
-
side_a_agent_prompt: getSidePrompt(content, "sideA"),
|
|
3240
|
-
side_b_agent_prompt: getSidePrompt(content, "sideB"),
|
|
3241
3177
|
created_at: Math.floor(Date.now() / 1e3)
|
|
3242
3178
|
};
|
|
3243
3179
|
} catch (error) {
|