@standardagents/builder 0.15.3 → 0.17.0-next.a4b7340
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 +362 -281
- package/dist/built-in-routes.js.map +1 -1
- package/dist/client/ApiKeysView.js +1 -1
- package/dist/client/CenteredContentView.js +1 -1
- package/dist/client/CompositionView.js +1 -1
- package/dist/client/ConfirmDialog.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/client/CopyButton.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/client/DataTable.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/client/JsonViewer.js +1 -1
- package/dist/client/LoginView.js +1 -1
- package/dist/client/Modal.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/client/ModelModal.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/client/ModelsView.js +1 -1
- package/dist/client/PromptEditView.js +1 -1
- package/dist/client/PromptModal.js +1 -1
- package/dist/client/PromptsView.js +1 -1
- package/dist/client/ProvidersView.js +2 -2
- package/dist/client/ThreadInspectorPane.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/client/ToolsView.js +1 -1
- package/dist/client/UsersView.js +1 -1
- package/dist/client/VariablesView.js +1 -1
- package/dist/client/assets/index.css +1 -1
- package/dist/client/index.js +3 -3
- package/dist/{discovery-DVviz3By.d.ts → discovery-DiMJWisl.d.ts} +1 -1
- package/dist/{index-BwqQtJ4r.d.ts → index-EaxysUHv.d.ts} +2 -5
- package/dist/index.d.ts +116 -3402
- package/dist/index.js +190 -324
- package/dist/index.js.map +1 -1
- package/dist/packing.d.ts +3 -3
- package/dist/plugin.d.ts +5 -4
- package/dist/plugin.js +143 -78
- package/dist/plugin.js.map +1 -1
- package/dist/runtime.d.ts +3124 -0
- package/dist/runtime.js +21218 -0
- package/dist/runtime.js.map +1 -0
- package/dist/test.d.ts +2 -2
- package/dist/{types-DH3Egc5l.d.ts → types-Bpe7IANZ.d.ts} +1 -1
- package/package.json +10 -9
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { fileURLToPath } from 'url';
|
|
|
10
10
|
import MagicString from 'magic-string';
|
|
11
11
|
import { exec } from 'child_process';
|
|
12
12
|
import { promisify } from 'util';
|
|
13
|
+
import { cloudflare } from '@cloudflare/vite-plugin';
|
|
13
14
|
import { DurableObject, WorkerEntrypoint } from 'cloudflare:workers';
|
|
14
15
|
|
|
15
16
|
var __defProp = Object.defineProperty;
|
|
@@ -865,11 +866,38 @@ var init_TestProvider = __esm({
|
|
|
865
866
|
}
|
|
866
867
|
});
|
|
867
868
|
|
|
869
|
+
// src/agents/providers/platform-routing.ts
|
|
870
|
+
function stringEnv(value) {
|
|
871
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
872
|
+
}
|
|
873
|
+
function resolvePlatformRouting(providerName, env) {
|
|
874
|
+
const apiKey = stringEnv(env.STANDARD_AGENTS_API_KEY) ?? stringEnv(env.PLATFORM_API_KEY);
|
|
875
|
+
if (!apiKey) return null;
|
|
876
|
+
const origin = (stringEnv(env.STANDARD_AGENTS_PROXY_URL) ?? stringEnv(env.PLATFORM_ENDPOINT) ?? stringEnv(env.STANDARD_AGENTS_API_URL) ?? DEFAULT_PLATFORM_PROXY_ORIGIN).replace(/\/+$/, "");
|
|
877
|
+
const provider = providerName.toLowerCase();
|
|
878
|
+
const basePath = PROVIDER_BASE_PATHS[provider] ?? "";
|
|
879
|
+
return {
|
|
880
|
+
apiKey,
|
|
881
|
+
origin,
|
|
882
|
+
baseUrl: `${origin}/v1/proxy/${encodeURIComponent(provider)}${basePath}`
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
var DEFAULT_PLATFORM_PROXY_ORIGIN, PROVIDER_BASE_PATHS;
|
|
886
|
+
var init_platform_routing = __esm({
|
|
887
|
+
"src/agents/providers/platform-routing.ts"() {
|
|
888
|
+
DEFAULT_PLATFORM_PROXY_ORIGIN = "https://proxy.standardagents.ai";
|
|
889
|
+
PROVIDER_BASE_PATHS = {
|
|
890
|
+
cloudflare: "/ai/v1"
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
});
|
|
894
|
+
|
|
868
895
|
// src/agents/providers/ProviderRegistry.ts
|
|
869
896
|
var ProviderRegistryImpl, ProviderRegistry;
|
|
870
897
|
var init_ProviderRegistry = __esm({
|
|
871
898
|
"src/agents/providers/ProviderRegistry.ts"() {
|
|
872
899
|
init_TestProvider();
|
|
900
|
+
init_platform_routing();
|
|
873
901
|
ProviderRegistryImpl = class {
|
|
874
902
|
providerCache = /* @__PURE__ */ new Map();
|
|
875
903
|
providerOverrideFn = null;
|
|
@@ -941,6 +969,19 @@ var init_ProviderRegistry = __esm({
|
|
|
941
969
|
return this.cacheAndReturn(modelName, overrideProvider, modelDef, overrideFingerprint);
|
|
942
970
|
}
|
|
943
971
|
}
|
|
972
|
+
const routing = resolvePlatformRouting(providerName, env);
|
|
973
|
+
if (routing) {
|
|
974
|
+
const config = {
|
|
975
|
+
apiKey: routing.apiKey,
|
|
976
|
+
baseUrl: routing.baseUrl
|
|
977
|
+
};
|
|
978
|
+
const fingerprint = this.getProviderFingerprint(`platform:${providerName}`, modelDef, config);
|
|
979
|
+
const cached = this.providerCache.get(modelName);
|
|
980
|
+
if (cached?.fingerprint === fingerprint) {
|
|
981
|
+
return this.buildResult(cached.provider, modelDef);
|
|
982
|
+
}
|
|
983
|
+
return this.cacheAndReturn(modelName, providerFactory(config), modelDef, fingerprint);
|
|
984
|
+
}
|
|
944
985
|
throw new Error(`No API key found for provider: ${providerName}. Set the provider key or STANDARD_AGENTS_API_KEY.`);
|
|
945
986
|
}
|
|
946
987
|
buildResult(provider, modelDef) {
|
|
@@ -953,7 +994,7 @@ var init_ProviderRegistry = __esm({
|
|
|
953
994
|
getProviderFingerprint(providerName, modelDef, config) {
|
|
954
995
|
return JSON.stringify({
|
|
955
996
|
providerName,
|
|
956
|
-
baseUrl: modelDef.providerOptions?.baseUrl ?? null,
|
|
997
|
+
baseUrl: config?.baseUrl ?? modelDef.providerOptions?.baseUrl ?? null,
|
|
957
998
|
apiKey: config?.apiKey ?? null,
|
|
958
999
|
accountId: config?.accountId ?? null
|
|
959
1000
|
});
|
|
@@ -9506,7 +9547,7 @@ function runCodeInDynamicWorker(params) {
|
|
|
9506
9547
|
durationMs: Date.now() - startedAt,
|
|
9507
9548
|
error: {
|
|
9508
9549
|
name: "MissingWorkerLoader",
|
|
9509
|
-
message: `ThreadState.runCode requires the ${WORKER_LOADER_BINDING} Worker Loader binding. Run the AgentBuilder scaffold/init step or
|
|
9550
|
+
message: `ThreadState.runCode requires the ${WORKER_LOADER_BINDING} Worker Loader binding. Run the AgentBuilder scaffold/init step or use builder(), which injects the worker_loaders binding.`
|
|
9510
9551
|
}
|
|
9511
9552
|
};
|
|
9512
9553
|
}
|
|
@@ -12639,14 +12680,9 @@ declare module 'virtual:@standardagents/builder' {
|
|
|
12639
12680
|
|
|
12640
12681
|
/**
|
|
12641
12682
|
* DurableThread with all virtual module methods pre-implemented.
|
|
12642
|
-
*
|
|
12643
|
-
*
|
|
12644
|
-
*
|
|
12645
|
-
* \`\`\`typescript
|
|
12646
|
-
* import { DurableThread } from 'virtual:@standardagents/builder'
|
|
12647
|
-
*
|
|
12648
|
-
* export class Thread extends DurableThread {}
|
|
12649
|
-
* \`\`\`
|
|
12683
|
+
* The generated AgentBuilder Worker entry exports this class automatically;
|
|
12684
|
+
* projects should not create agents/Thread.ts unless they are intentionally
|
|
12685
|
+
* taking over the Worker surface.
|
|
12650
12686
|
*/
|
|
12651
12687
|
export class DurableThread extends BaseDurableThread {
|
|
12652
12688
|
// Virtual module registry methods
|
|
@@ -12817,14 +12853,9 @@ declare module 'virtual:@standardagents/builder' {
|
|
|
12817
12853
|
|
|
12818
12854
|
/**
|
|
12819
12855
|
* DurableAgentBuilder with all virtual module methods pre-implemented.
|
|
12820
|
-
*
|
|
12821
|
-
*
|
|
12822
|
-
*
|
|
12823
|
-
* \`\`\`typescript
|
|
12824
|
-
* import { DurableAgentBuilder } from 'virtual:@standardagents/builder'
|
|
12825
|
-
*
|
|
12826
|
-
* export class AgentBuilder extends DurableAgentBuilder {}
|
|
12827
|
-
* \`\`\`
|
|
12856
|
+
* The generated AgentBuilder Worker entry exports this class automatically;
|
|
12857
|
+
* projects should not create agents/AgentBuilder.ts unless they are
|
|
12858
|
+
* intentionally taking over the Worker surface.
|
|
12828
12859
|
*/
|
|
12829
12860
|
export class DurableAgentBuilder extends BaseDurableAgentBuilder {
|
|
12830
12861
|
// Virtual module registry methods
|
|
@@ -12982,7 +13013,7 @@ declare module 'virtual:@standardagents/builder' {
|
|
|
12982
13013
|
providerUserId: string
|
|
12983
13014
|
): Promise<User | null>;
|
|
12984
13015
|
|
|
12985
|
-
// Edit lock methods
|
|
13016
|
+
// Edit lock methods
|
|
12986
13017
|
acquireEditLock(params: {
|
|
12987
13018
|
locked_by: string;
|
|
12988
13019
|
lock_reason: string;
|
|
@@ -18812,14 +18843,12 @@ function readRawRequestBody(req) {
|
|
|
18812
18843
|
req.on("error", reject);
|
|
18813
18844
|
});
|
|
18814
18845
|
}
|
|
18815
|
-
function injectUiConfigIntoHtml(htmlContent
|
|
18816
|
-
const configScript = `<script>window.__AGENTBUILDER_CONFIG__ = {
|
|
18817
|
-
|
|
18818
|
-
return htmlContent.replace(/\/agents\//g, assetPrefix).replace("</head>", `${configScript}</head>`);
|
|
18846
|
+
function injectUiConfigIntoHtml(htmlContent) {
|
|
18847
|
+
const configScript = `<script>window.__AGENTBUILDER_CONFIG__ = { devMode: true };</script>`;
|
|
18848
|
+
return htmlContent.replace(/\/agents\//g, "/").replace("</head>", `${configScript}</head>`);
|
|
18819
18849
|
}
|
|
18820
18850
|
function createDevMiddleware(server, context) {
|
|
18821
18851
|
const {
|
|
18822
|
-
mountPoint,
|
|
18823
18852
|
toolsDir,
|
|
18824
18853
|
hooksDir,
|
|
18825
18854
|
modelsDir,
|
|
@@ -18839,17 +18868,14 @@ function createDevMiddleware(server, context) {
|
|
|
18839
18868
|
});
|
|
18840
18869
|
server.middlewares.use(async (req, res, next) => {
|
|
18841
18870
|
const url = req.url;
|
|
18842
|
-
if (!url || !url.startsWith(
|
|
18871
|
+
if (!url || !url.startsWith("/")) {
|
|
18843
18872
|
next();
|
|
18844
18873
|
return;
|
|
18845
18874
|
}
|
|
18846
|
-
let pathWithoutMount = url
|
|
18847
|
-
if (!pathWithoutMount.startsWith("/")) {
|
|
18848
|
-
pathWithoutMount = "/" + pathWithoutMount;
|
|
18849
|
-
}
|
|
18875
|
+
let pathWithoutMount = url;
|
|
18850
18876
|
const method = req.method?.toUpperCase();
|
|
18851
18877
|
const legacyMountPoint = "/agentbuilder";
|
|
18852
|
-
if (
|
|
18878
|
+
if (pathWithoutMount === legacyMountPoint || pathWithoutMount.startsWith(`${legacyMountPoint}/`)) {
|
|
18853
18879
|
const normalizedPath = pathWithoutMount.slice(legacyMountPoint.length) || "/";
|
|
18854
18880
|
if (normalizedPath.startsWith("/api/")) {
|
|
18855
18881
|
req.url = normalizedPath;
|
|
@@ -18934,7 +18960,7 @@ function createDevMiddleware(server, context) {
|
|
|
18934
18960
|
const contentType = proxyRes.headers.get("content-type") || "";
|
|
18935
18961
|
if (contentType.includes("text/html")) {
|
|
18936
18962
|
const htmlBody = await proxyRes.text();
|
|
18937
|
-
const injectedHtml = Buffer.from(injectUiConfigIntoHtml(htmlBody
|
|
18963
|
+
const injectedHtml = Buffer.from(injectUiConfigIntoHtml(htmlBody));
|
|
18938
18964
|
res.setHeader("content-length", String(injectedHtml.byteLength));
|
|
18939
18965
|
res.end(injectedHtml);
|
|
18940
18966
|
return;
|
|
@@ -18946,7 +18972,7 @@ function createDevMiddleware(server, context) {
|
|
|
18946
18972
|
console.error("[agentbuilder] Failed to proxy to UI dev server:", error);
|
|
18947
18973
|
}
|
|
18948
18974
|
}
|
|
18949
|
-
const clientPath =
|
|
18975
|
+
const clientPath = pathWithoutMount.startsWith("/agents/") ? pathWithoutMount.slice("/agents".length) || "/" : pathWithoutMount;
|
|
18950
18976
|
const isStaticAsset = clientPath.startsWith("/assets/") || clientPath.startsWith("/vendor.js") || clientPath.startsWith("/vue.js") || clientPath.startsWith("/monaco.js") || clientPath.startsWith("/index.js") || clientPath.startsWith("/index.css") || clientPath.match(/\.(js|css|png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot|ico)$/);
|
|
18951
18977
|
{
|
|
18952
18978
|
const currentDir = path8__default.dirname(fileURLToPath(import.meta.url));
|
|
@@ -18968,7 +18994,7 @@ function createDevMiddleware(server, context) {
|
|
|
18968
18994
|
const ext = path8__default.extname(filePath).toLowerCase();
|
|
18969
18995
|
if (ext === ".html") {
|
|
18970
18996
|
content = Buffer.from(
|
|
18971
|
-
injectUiConfigIntoHtml(content.toString()
|
|
18997
|
+
injectUiConfigIntoHtml(content.toString())
|
|
18972
18998
|
);
|
|
18973
18999
|
}
|
|
18974
19000
|
const mimeTypes = {
|
|
@@ -19144,7 +19170,8 @@ ${effectsCode}
|
|
|
19144
19170
|
|
|
19145
19171
|
/**
|
|
19146
19172
|
* DurableThread with all virtual module methods already implemented.
|
|
19147
|
-
*
|
|
19173
|
+
* Exported by the generated AgentBuilder Worker entry; user projects do not
|
|
19174
|
+
* need an agents/Thread.ts file for the standard hosted/runtime path.
|
|
19148
19175
|
*/
|
|
19149
19176
|
export class DurableThread extends _BaseDurableThread {
|
|
19150
19177
|
constructor(ctx, env) {
|
|
@@ -19188,7 +19215,8 @@ export class DurableThread extends _BaseDurableThread {
|
|
|
19188
19215
|
|
|
19189
19216
|
/**
|
|
19190
19217
|
* DurableAgentBuilder with all virtual module methods already implemented.
|
|
19191
|
-
*
|
|
19218
|
+
* Exported by the generated AgentBuilder Worker entry; user projects do not
|
|
19219
|
+
* need an agents/AgentBuilder.ts file for the standard hosted/runtime path.
|
|
19192
19220
|
*/
|
|
19193
19221
|
export class DurableAgentBuilder extends _BaseDurableAgentBuilder {
|
|
19194
19222
|
tools() {
|
|
@@ -19394,7 +19422,7 @@ export function getVisibleToolNames() {
|
|
|
19394
19422
|
`;
|
|
19395
19423
|
}
|
|
19396
19424
|
async function loadRoutesVirtualModule(context) {
|
|
19397
|
-
const {
|
|
19425
|
+
const { threadApiDir, rou3Code, hmr } = context;
|
|
19398
19426
|
const threadRoutes = scanApiDirectory(threadApiDir);
|
|
19399
19427
|
const toAbsolutePath = (inputPath) => path8__default.resolve(process.cwd(), inputPath).replace(/\\/g, "/");
|
|
19400
19428
|
const threadRouteCode = threadRoutes.map(({ method, route, importPath }) => {
|
|
@@ -19456,8 +19484,6 @@ import { registry } from "virtual:@standardagents-registry";
|
|
|
19456
19484
|
import { requireAuth, createThreadEndpointHandler } from "@standardagents/builder/runtime";
|
|
19457
19485
|
import { isThreadEndpoint } from "@standardagents/spec";
|
|
19458
19486
|
|
|
19459
|
-
const MOUNT_POINT = "${mountPoint}";
|
|
19460
|
-
|
|
19461
19487
|
// Routes that don't require authentication
|
|
19462
19488
|
const PUBLIC_ROUTES = [
|
|
19463
19489
|
'/api/auth/bootstrap',
|
|
@@ -19556,11 +19582,6 @@ export async function router(request, env) {
|
|
|
19556
19582
|
const url = new URL(request.url);
|
|
19557
19583
|
const pathname = url.pathname;
|
|
19558
19584
|
|
|
19559
|
-
// Check if request is under mount point
|
|
19560
|
-
if (!pathname.startsWith(MOUNT_POINT)) {
|
|
19561
|
-
return null;
|
|
19562
|
-
}
|
|
19563
|
-
|
|
19564
19585
|
// Handle CORS preflight requests
|
|
19565
19586
|
if (request.method === "OPTIONS") {
|
|
19566
19587
|
return new Response(null, {
|
|
@@ -19569,11 +19590,7 @@ export async function router(request, env) {
|
|
|
19569
19590
|
});
|
|
19570
19591
|
}
|
|
19571
19592
|
|
|
19572
|
-
|
|
19573
|
-
let routePath = pathname.slice(MOUNT_POINT.length) || "/";
|
|
19574
|
-
if (!routePath.startsWith('/')) {
|
|
19575
|
-
routePath = '/' + routePath;
|
|
19576
|
-
}
|
|
19593
|
+
const routePath = pathname || "/";
|
|
19577
19594
|
|
|
19578
19595
|
// Handle API routes
|
|
19579
19596
|
const router = createRouter();
|
|
@@ -19651,32 +19668,29 @@ ${packedThreadRouteCode}
|
|
|
19651
19668
|
|
|
19652
19669
|
async function serveUI(pathname, env) {
|
|
19653
19670
|
try {
|
|
19654
|
-
const clientPath =
|
|
19655
|
-
|
|
19656
|
-
|
|
19657
|
-
: pathname;
|
|
19671
|
+
const clientPath = pathname.startsWith("/agents/")
|
|
19672
|
+
? pathname.slice("/agents".length) || "/"
|
|
19673
|
+
: pathname;
|
|
19658
19674
|
|
|
19659
|
-
// Use Cloudflare Workers Assets binding
|
|
19675
|
+
// Use the Cloudflare Workers Assets binding created by builder()'s generated
|
|
19676
|
+
// Cloudflare Vite plugin config.
|
|
19660
19677
|
if (env.ASSETS) {
|
|
19661
19678
|
try {
|
|
19662
19679
|
// Create a proper request for the asset path
|
|
19663
19680
|
// Use a dummy origin since we only care about the path
|
|
19664
|
-
|
|
19665
|
-
// Handle root mountPoint "/" specially to avoid double slashes
|
|
19666
|
-
const mountPrefix = MOUNT_POINT === "/" ? "" : MOUNT_POINT;
|
|
19667
|
-
const assetUrl = \`http://localhost\${mountPrefix}\${clientPath}\`;
|
|
19681
|
+
const assetUrl = \`http://localhost\${clientPath}\`;
|
|
19668
19682
|
let response = await env.ASSETS.fetch(assetUrl);
|
|
19669
19683
|
|
|
19670
19684
|
// If not found, fall back to index.html for SPA routing
|
|
19671
19685
|
const isIndexHtml = response.status === 404 || clientPath === "/" || !clientPath.includes(".");
|
|
19672
19686
|
if (isIndexHtml) {
|
|
19673
|
-
response = await env.ASSETS.fetch(\`http://localhost
|
|
19687
|
+
response = await env.ASSETS.fetch(\`http://localhost/index.html\`);
|
|
19674
19688
|
|
|
19675
|
-
// Transform
|
|
19689
|
+
// Transform standalone UI asset URLs to root. AgentBuilder owns the
|
|
19690
|
+
// entire Worker surface and has no configurable mount point.
|
|
19676
19691
|
if (response.status === 200) {
|
|
19677
19692
|
const html = await response.text();
|
|
19678
|
-
|
|
19679
|
-
const modifiedHtml = html.replace(/\\/agents\\//g, \`\${MOUNT_POINT}/\`);
|
|
19693
|
+
const modifiedHtml = html.replace(/\\/agents\\//g, "/");
|
|
19680
19694
|
return new Response(modifiedHtml, {
|
|
19681
19695
|
headers: {
|
|
19682
19696
|
"Content-Type": "text/html; charset=utf-8",
|
|
@@ -19713,7 +19727,6 @@ async function serveUI(pathname, env) {
|
|
|
19713
19727
|
// src/plugin/virtual-modules.ts
|
|
19714
19728
|
async function loadVirtualModule(id, context) {
|
|
19715
19729
|
const {
|
|
19716
|
-
mountPoint,
|
|
19717
19730
|
toolsDir,
|
|
19718
19731
|
hooksDir,
|
|
19719
19732
|
threadApiDir,
|
|
@@ -19785,7 +19798,6 @@ export const config = {
|
|
|
19785
19798
|
modelsDir: "${relativeModelsDir}",
|
|
19786
19799
|
promptsDir: "${relativePromptsDir}",
|
|
19787
19800
|
agentsDir: "${relativeAgentsDir}",
|
|
19788
|
-
mountPoint: "${mountPoint}",
|
|
19789
19801
|
};`;
|
|
19790
19802
|
}
|
|
19791
19803
|
if (id === RESOLVED_VIRTUAL_MODELS_ID) {
|
|
@@ -19910,6 +19922,7 @@ ${allProviders.map((p) => ` "${p.name}": async () => (await import("${p.package
|
|
|
19910
19922
|
return loadBuilderVirtualModule(context);
|
|
19911
19923
|
}
|
|
19912
19924
|
}
|
|
19925
|
+
var DEFAULT_AGENTBUILDER_COMPATIBILITY_DATE = "2025-08-13";
|
|
19913
19926
|
var depsToExclude = [
|
|
19914
19927
|
"@standardagents/builder",
|
|
19915
19928
|
"@standardagents/builder/runtime",
|
|
@@ -19977,6 +19990,77 @@ function createPluginViteConfig(pluginModuleUrl) {
|
|
|
19977
19990
|
}
|
|
19978
19991
|
};
|
|
19979
19992
|
}
|
|
19993
|
+
function createAgentBuilderWorkerConfig(options) {
|
|
19994
|
+
const compatibilityDate = options.compatibilityDate ?? DEFAULT_AGENTBUILDER_COMPATIBILITY_DATE;
|
|
19995
|
+
return {
|
|
19996
|
+
// This object is the generated Cloudflare Worker config for customer apps.
|
|
19997
|
+
// Future agents: update this instead of reintroducing wrangler.jsonc in the
|
|
19998
|
+
// generated project template. Customer repos should only need builder()
|
|
19999
|
+
// in vite.config.ts plus their agents/ source tree.
|
|
20000
|
+
main: options.workerEntry,
|
|
20001
|
+
compatibility_date: compatibilityDate,
|
|
20002
|
+
compatibility_flags: ["nodejs_compat", "enable_ctx_exports"],
|
|
20003
|
+
observability: {
|
|
20004
|
+
enabled: true
|
|
20005
|
+
},
|
|
20006
|
+
worker_loaders: [
|
|
20007
|
+
{
|
|
20008
|
+
binding: "AGENT_BUILDER_CODE_LOADER"
|
|
20009
|
+
}
|
|
20010
|
+
],
|
|
20011
|
+
vars: {
|
|
20012
|
+
// Future agents: keep this aligned with compatibility_date unless code
|
|
20013
|
+
// execution needs a deliberately different Dynamic Worker date.
|
|
20014
|
+
AGENT_BUILDER_CODE_COMPATIBILITY_DATE: compatibilityDate
|
|
20015
|
+
},
|
|
20016
|
+
assets: {
|
|
20017
|
+
// The builder's client UI is emitted as Vite assets and then wrapped by
|
|
20018
|
+
// the hosted platform when deploying through Workers for Platforms.
|
|
20019
|
+
directory: "dist/client",
|
|
20020
|
+
not_found_handling: "single-page-application",
|
|
20021
|
+
binding: "ASSETS",
|
|
20022
|
+
run_worker_first: ["/**"]
|
|
20023
|
+
},
|
|
20024
|
+
durable_objects: {
|
|
20025
|
+
bindings: [
|
|
20026
|
+
{
|
|
20027
|
+
name: "AGENT_BUILDER_THREAD",
|
|
20028
|
+
class_name: "DurableThread"
|
|
20029
|
+
},
|
|
20030
|
+
{
|
|
20031
|
+
name: "AGENT_BUILDER",
|
|
20032
|
+
class_name: "DurableAgentBuilder"
|
|
20033
|
+
}
|
|
20034
|
+
]
|
|
20035
|
+
},
|
|
20036
|
+
migrations: [
|
|
20037
|
+
{
|
|
20038
|
+
tag: "v1",
|
|
20039
|
+
new_sqlite_classes: ["DurableThread"]
|
|
20040
|
+
},
|
|
20041
|
+
{
|
|
20042
|
+
tag: "v2",
|
|
20043
|
+
new_sqlite_classes: ["DurableAgentBuilder"]
|
|
20044
|
+
}
|
|
20045
|
+
]
|
|
20046
|
+
};
|
|
20047
|
+
}
|
|
20048
|
+
function applyAgentBuilderWorkerConfig(config, options) {
|
|
20049
|
+
const generated = createAgentBuilderWorkerConfig(options);
|
|
20050
|
+
const existingVars = config.vars && typeof config.vars === "object" ? config.vars : {};
|
|
20051
|
+
Object.assign(config, generated);
|
|
20052
|
+
config.vars = {
|
|
20053
|
+
...existingVars,
|
|
20054
|
+
...generated.vars ?? {}
|
|
20055
|
+
};
|
|
20056
|
+
}
|
|
20057
|
+
function createAgentBuilderCloudflarePlugins(options) {
|
|
20058
|
+
return cloudflare({
|
|
20059
|
+
config(config) {
|
|
20060
|
+
applyAgentBuilderWorkerConfig(config, options);
|
|
20061
|
+
}
|
|
20062
|
+
});
|
|
20063
|
+
}
|
|
19980
20064
|
function applyPluginEnvironmentConfig(config) {
|
|
19981
20065
|
config.optimizeDeps = config.optimizeDeps || {};
|
|
19982
20066
|
config.optimizeDeps.exclude = [
|
|
@@ -20003,13 +20087,6 @@ function applyPluginEnvironmentConfig(config) {
|
|
|
20003
20087
|
|
|
20004
20088
|
// src/plugin.ts
|
|
20005
20089
|
function agentbuilder(options = {}) {
|
|
20006
|
-
let mountPoint = options.mountPoint || "/agents";
|
|
20007
|
-
if (!mountPoint.startsWith("/")) {
|
|
20008
|
-
mountPoint = "/" + mountPoint;
|
|
20009
|
-
}
|
|
20010
|
-
if (mountPoint.endsWith("/") && mountPoint.length > 1) {
|
|
20011
|
-
mountPoint = mountPoint.slice(0, -1);
|
|
20012
|
-
}
|
|
20013
20090
|
const toolsDir = options.toolsDir ? path8__default.resolve(process.cwd(), options.toolsDir) : path8__default.resolve(process.cwd(), "agents/tools");
|
|
20014
20091
|
const hooksDir = options.hooksDir ? path8__default.resolve(process.cwd(), options.hooksDir) : path8__default.resolve(process.cwd(), "agents/hooks");
|
|
20015
20092
|
const threadApiDir = options.apiDir ? path8__default.resolve(process.cwd(), options.apiDir) : path8__default.resolve(process.cwd(), "agents/api");
|
|
@@ -20018,6 +20095,7 @@ function agentbuilder(options = {}) {
|
|
|
20018
20095
|
const agentsDir = options.agentsDir ? path8__default.resolve(process.cwd(), options.agentsDir) : path8__default.resolve(process.cwd(), "agents/agents");
|
|
20019
20096
|
const effectsDir = options.effectsDir ? path8__default.resolve(process.cwd(), options.effectsDir) : path8__default.resolve(process.cwd(), "agents/effects");
|
|
20020
20097
|
const outputDir = path8__default.resolve(process.cwd(), ".agents");
|
|
20098
|
+
const generatedWorkerEntry = path8__default.join(outputDir, "worker.ts");
|
|
20021
20099
|
const installedProviders = buildInstalledProviderCatalog(options.providers || []);
|
|
20022
20100
|
const installedProviderPackageMap = buildProviderPackageMap(options.providers || []);
|
|
20023
20101
|
const typeGenConfig = {
|
|
@@ -20033,6 +20111,25 @@ function agentbuilder(options = {}) {
|
|
|
20033
20111
|
generateTypes(typeGenConfig);
|
|
20034
20112
|
}
|
|
20035
20113
|
}
|
|
20114
|
+
function writeGeneratedWorkerEntry() {
|
|
20115
|
+
const content = `// Generated by @standardagents/builder.
|
|
20116
|
+
// Future agents: update builder/src/plugin.ts when changing this entrypoint.
|
|
20117
|
+
import { CodeExecutionBridge, DurableAgentBuilder, DurableThread, router } from "virtual:@standardagents/builder";
|
|
20118
|
+
|
|
20119
|
+
export default {
|
|
20120
|
+
async fetch(request: Request, env: Parameters<typeof router>[1]) {
|
|
20121
|
+
const response = await router(request, env);
|
|
20122
|
+
return response ?? new Response(null, { status: 404 });
|
|
20123
|
+
},
|
|
20124
|
+
};
|
|
20125
|
+
|
|
20126
|
+
export { CodeExecutionBridge, DurableAgentBuilder, DurableThread };
|
|
20127
|
+
`;
|
|
20128
|
+
fs8__default.mkdirSync(outputDir, { recursive: true });
|
|
20129
|
+
if (!fs8__default.existsSync(generatedWorkerEntry) || fs8__default.readFileSync(generatedWorkerEntry, "utf-8") !== content) {
|
|
20130
|
+
fs8__default.writeFileSync(generatedWorkerEntry, content);
|
|
20131
|
+
}
|
|
20132
|
+
}
|
|
20036
20133
|
const __filename = fileURLToPath(import.meta.url);
|
|
20037
20134
|
const __dirname = path8__default.dirname(__filename);
|
|
20038
20135
|
const rou3Path = path8__default.join(__dirname, "../dist/rou3.js");
|
|
@@ -20053,7 +20150,6 @@ function agentbuilder(options = {}) {
|
|
|
20053
20150
|
effectsDir
|
|
20054
20151
|
};
|
|
20055
20152
|
const virtualModuleContext = {
|
|
20056
|
-
mountPoint,
|
|
20057
20153
|
toolsDir,
|
|
20058
20154
|
hooksDir,
|
|
20059
20155
|
threadApiDir,
|
|
@@ -20066,7 +20162,6 @@ function agentbuilder(options = {}) {
|
|
|
20066
20162
|
hmr
|
|
20067
20163
|
};
|
|
20068
20164
|
const devMiddlewareContext = {
|
|
20069
|
-
mountPoint,
|
|
20070
20165
|
toolsDir,
|
|
20071
20166
|
hooksDir,
|
|
20072
20167
|
modelsDir,
|
|
@@ -20078,11 +20173,14 @@ function agentbuilder(options = {}) {
|
|
|
20078
20173
|
sourceDirs,
|
|
20079
20174
|
regenerateTypes
|
|
20080
20175
|
};
|
|
20081
|
-
|
|
20176
|
+
const workerEntry = path8__default.relative(process.cwd(), generatedWorkerEntry).split(path8__default.sep).join("/");
|
|
20177
|
+
const corePlugin = {
|
|
20082
20178
|
name: "vite-plugin-agent",
|
|
20083
20179
|
enforce: "pre",
|
|
20084
20180
|
config() {
|
|
20085
|
-
|
|
20181
|
+
writeGeneratedWorkerEntry();
|
|
20182
|
+
const viteConfig = createPluginViteConfig(import.meta.url);
|
|
20183
|
+
return viteConfig;
|
|
20086
20184
|
},
|
|
20087
20185
|
// Apply exclusions and inclusions to ALL environments including Cloudflare worker
|
|
20088
20186
|
configEnvironment(_name, config) {
|
|
@@ -20130,6 +20228,7 @@ function agentbuilder(options = {}) {
|
|
|
20130
20228
|
return loadVirtualModule(id, virtualModuleContext);
|
|
20131
20229
|
},
|
|
20132
20230
|
buildStart() {
|
|
20231
|
+
writeGeneratedWorkerEntry();
|
|
20133
20232
|
regenerateTypes();
|
|
20134
20233
|
this.addWatchFile(toolsDir);
|
|
20135
20234
|
this.addWatchFile(threadApiDir);
|
|
@@ -20147,8 +20246,7 @@ function agentbuilder(options = {}) {
|
|
|
20147
20246
|
},
|
|
20148
20247
|
writeBundle(options2, bundle) {
|
|
20149
20248
|
const outDir = options2.dir || "dist";
|
|
20150
|
-
const
|
|
20151
|
-
const mountDir = mountPath ? path8__default.join(outDir, "../client", mountPath) : path8__default.join(outDir, "../client");
|
|
20249
|
+
const mountDir = path8__default.join(outDir, "../client");
|
|
20152
20250
|
const currentDir = path8__default.dirname(fileURLToPath(import.meta.url));
|
|
20153
20251
|
const isInDist = currentDir.endsWith("dist");
|
|
20154
20252
|
const clientDir = path8__default.resolve(
|
|
@@ -20171,10 +20269,9 @@ function agentbuilder(options = {}) {
|
|
|
20171
20269
|
} else {
|
|
20172
20270
|
let content = fs8__default.readFileSync(srcPath);
|
|
20173
20271
|
if (entry.name === "index.html") {
|
|
20174
|
-
const configScript = `<script>window.__AGENTBUILDER_CONFIG__ = {
|
|
20272
|
+
const configScript = `<script>window.__AGENTBUILDER_CONFIG__ = {};</script>`;
|
|
20175
20273
|
let htmlContent = content.toString();
|
|
20176
|
-
|
|
20177
|
-
htmlContent = htmlContent.replace(/\/agents\//g, assetPrefix);
|
|
20274
|
+
htmlContent = htmlContent.replace(/\/agents\//g, "/");
|
|
20178
20275
|
htmlContent = htmlContent.replace("</head>", `${configScript}</head>`);
|
|
20179
20276
|
content = Buffer.from(htmlContent);
|
|
20180
20277
|
}
|
|
@@ -20185,7 +20282,15 @@ function agentbuilder(options = {}) {
|
|
|
20185
20282
|
copyRecursive(clientDir, mountDir);
|
|
20186
20283
|
}
|
|
20187
20284
|
};
|
|
20285
|
+
return [
|
|
20286
|
+
corePlugin,
|
|
20287
|
+
...createAgentBuilderCloudflarePlugins({
|
|
20288
|
+
workerEntry,
|
|
20289
|
+
compatibilityDate: options.compatibilityDate ?? DEFAULT_AGENTBUILDER_COMPATIBILITY_DATE
|
|
20290
|
+
})
|
|
20291
|
+
];
|
|
20188
20292
|
}
|
|
20293
|
+
var builder = agentbuilder;
|
|
20189
20294
|
|
|
20190
20295
|
// src/router/index.ts
|
|
20191
20296
|
init_ThreadStateImpl();
|
|
@@ -22846,14 +22951,14 @@ var DurableThread = class extends DurableObject {
|
|
|
22846
22951
|
}
|
|
22847
22952
|
try {
|
|
22848
22953
|
const builderId = this.env.AGENT_BUILDER.idFromName("singleton");
|
|
22849
|
-
const
|
|
22850
|
-
if (typeof
|
|
22954
|
+
const builder2 = this.env.AGENT_BUILDER.get(builderId);
|
|
22955
|
+
if (typeof builder2.getThread !== "function") {
|
|
22851
22956
|
return projections;
|
|
22852
22957
|
}
|
|
22853
22958
|
await Promise.all(
|
|
22854
22959
|
unresolved.map(async (subagentId) => {
|
|
22855
22960
|
try {
|
|
22856
|
-
const thread = await
|
|
22961
|
+
const thread = await builder2.getThread(subagentId);
|
|
22857
22962
|
if (!thread) {
|
|
22858
22963
|
return;
|
|
22859
22964
|
}
|
|
@@ -28560,10 +28665,10 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
|
|
|
28560
28665
|
return this.getUserById(rows[0].user_id);
|
|
28561
28666
|
}
|
|
28562
28667
|
// ============================================================
|
|
28563
|
-
// Edit Lock Methods
|
|
28668
|
+
// Edit Lock Methods
|
|
28564
28669
|
// ============================================================
|
|
28565
28670
|
/**
|
|
28566
|
-
* Acquire edit lock for
|
|
28671
|
+
* Acquire edit lock for coordinated edits.
|
|
28567
28672
|
*/
|
|
28568
28673
|
async acquireEditLock(params) {
|
|
28569
28674
|
await this.ensureMigrated();
|
|
@@ -29090,248 +29195,9 @@ function enhanceFlowState(flow) {
|
|
|
29090
29195
|
|
|
29091
29196
|
// src/index.ts
|
|
29092
29197
|
init_context();
|
|
29093
|
-
|
|
29094
|
-
// src/github/GitHubClient.ts
|
|
29095
|
-
var GITHUB_API_BASE = "https://api.github.com";
|
|
29096
|
-
var GitHubClient = class _GitHubClient {
|
|
29097
|
-
config;
|
|
29098
|
-
constructor(config) {
|
|
29099
|
-
this.config = config;
|
|
29100
|
-
}
|
|
29101
|
-
/**
|
|
29102
|
-
* Create a GitHubClient from environment variables.
|
|
29103
|
-
* Returns null if required env vars are missing.
|
|
29104
|
-
*/
|
|
29105
|
-
static fromEnv(env) {
|
|
29106
|
-
const token = env.GITHUB_TOKEN;
|
|
29107
|
-
const repo = env.GITHUB_REPO;
|
|
29108
|
-
const branch = env.GITHUB_BRANCH || "main";
|
|
29109
|
-
if (!token || !repo) {
|
|
29110
|
-
return null;
|
|
29111
|
-
}
|
|
29112
|
-
const parts = repo.split("/");
|
|
29113
|
-
if (parts.length !== 2) {
|
|
29114
|
-
console.error('GITHUB_REPO must be in format "owner/repo"');
|
|
29115
|
-
return null;
|
|
29116
|
-
}
|
|
29117
|
-
return new _GitHubClient({
|
|
29118
|
-
token,
|
|
29119
|
-
owner: parts[0],
|
|
29120
|
-
repo: parts[1],
|
|
29121
|
-
branch
|
|
29122
|
-
});
|
|
29123
|
-
}
|
|
29124
|
-
/**
|
|
29125
|
-
* Check if GitHub integration is properly configured.
|
|
29126
|
-
*/
|
|
29127
|
-
isConfigured() {
|
|
29128
|
-
return !!(this.config.token && this.config.owner && this.config.repo && this.config.branch);
|
|
29129
|
-
}
|
|
29130
|
-
/**
|
|
29131
|
-
* Make an authenticated request to GitHub API.
|
|
29132
|
-
*/
|
|
29133
|
-
async request(method, path20, body) {
|
|
29134
|
-
const url = `${GITHUB_API_BASE}${path20}`;
|
|
29135
|
-
const response = await fetch(url, {
|
|
29136
|
-
method,
|
|
29137
|
-
headers: {
|
|
29138
|
-
Authorization: `Bearer ${this.config.token}`,
|
|
29139
|
-
Accept: "application/vnd.github+json",
|
|
29140
|
-
"X-GitHub-Api-Version": "2022-11-28",
|
|
29141
|
-
"Content-Type": "application/json",
|
|
29142
|
-
"User-Agent": "AgentBuilder/1.0"
|
|
29143
|
-
},
|
|
29144
|
-
body: body ? JSON.stringify(body) : void 0
|
|
29145
|
-
});
|
|
29146
|
-
if (!response.ok) {
|
|
29147
|
-
const errorData = await response.json().catch(() => ({ message: "Unknown error" }));
|
|
29148
|
-
throw new GitHubApiError(
|
|
29149
|
-
errorData.message || `GitHub API error: ${response.status}`,
|
|
29150
|
-
response.status,
|
|
29151
|
-
errorData
|
|
29152
|
-
);
|
|
29153
|
-
}
|
|
29154
|
-
return response.json();
|
|
29155
|
-
}
|
|
29156
|
-
/**
|
|
29157
|
-
* Get the current branch reference.
|
|
29158
|
-
*/
|
|
29159
|
-
async getBranchRef() {
|
|
29160
|
-
return this.request(
|
|
29161
|
-
"GET",
|
|
29162
|
-
`/repos/${this.config.owner}/${this.config.repo}/git/ref/heads/${this.config.branch}`
|
|
29163
|
-
);
|
|
29164
|
-
}
|
|
29165
|
-
/**
|
|
29166
|
-
* Get a commit by SHA.
|
|
29167
|
-
*/
|
|
29168
|
-
async getCommit(sha) {
|
|
29169
|
-
return this.request(
|
|
29170
|
-
"GET",
|
|
29171
|
-
`/repos/${this.config.owner}/${this.config.repo}/git/commits/${sha}`
|
|
29172
|
-
);
|
|
29173
|
-
}
|
|
29174
|
-
/**
|
|
29175
|
-
* Get a tree by SHA.
|
|
29176
|
-
*/
|
|
29177
|
-
async getTree(sha) {
|
|
29178
|
-
return this.request(
|
|
29179
|
-
"GET",
|
|
29180
|
-
`/repos/${this.config.owner}/${this.config.repo}/git/trees/${sha}`
|
|
29181
|
-
);
|
|
29182
|
-
}
|
|
29183
|
-
/**
|
|
29184
|
-
* Create a blob (file content).
|
|
29185
|
-
*/
|
|
29186
|
-
async createBlob(content) {
|
|
29187
|
-
return this.request(
|
|
29188
|
-
"POST",
|
|
29189
|
-
`/repos/${this.config.owner}/${this.config.repo}/git/blobs`,
|
|
29190
|
-
{
|
|
29191
|
-
content: btoa(content),
|
|
29192
|
-
// Base64 encode
|
|
29193
|
-
encoding: "base64"
|
|
29194
|
-
}
|
|
29195
|
-
);
|
|
29196
|
-
}
|
|
29197
|
-
/**
|
|
29198
|
-
* Create a tree with file changes.
|
|
29199
|
-
*/
|
|
29200
|
-
async createTree(baseTreeSha, files) {
|
|
29201
|
-
return this.request(
|
|
29202
|
-
"POST",
|
|
29203
|
-
`/repos/${this.config.owner}/${this.config.repo}/git/trees`,
|
|
29204
|
-
{
|
|
29205
|
-
base_tree: baseTreeSha,
|
|
29206
|
-
tree: files.map((f) => ({
|
|
29207
|
-
path: f.path,
|
|
29208
|
-
mode: f.mode,
|
|
29209
|
-
type: "blob",
|
|
29210
|
-
sha: f.sha
|
|
29211
|
-
}))
|
|
29212
|
-
}
|
|
29213
|
-
);
|
|
29214
|
-
}
|
|
29215
|
-
/**
|
|
29216
|
-
* Create a commit.
|
|
29217
|
-
*/
|
|
29218
|
-
async createCommit(message, treeSha, parentSha) {
|
|
29219
|
-
return this.request(
|
|
29220
|
-
"POST",
|
|
29221
|
-
`/repos/${this.config.owner}/${this.config.repo}/git/commits`,
|
|
29222
|
-
{
|
|
29223
|
-
message,
|
|
29224
|
-
tree: treeSha,
|
|
29225
|
-
parents: [parentSha]
|
|
29226
|
-
}
|
|
29227
|
-
);
|
|
29228
|
-
}
|
|
29229
|
-
/**
|
|
29230
|
-
* Update a branch reference to point to a new commit.
|
|
29231
|
-
*/
|
|
29232
|
-
async updateRef(sha) {
|
|
29233
|
-
return this.request(
|
|
29234
|
-
"PATCH",
|
|
29235
|
-
`/repos/${this.config.owner}/${this.config.repo}/git/refs/heads/${this.config.branch}`,
|
|
29236
|
-
{
|
|
29237
|
-
sha,
|
|
29238
|
-
force: false
|
|
29239
|
-
}
|
|
29240
|
-
);
|
|
29241
|
-
}
|
|
29242
|
-
/**
|
|
29243
|
-
* Commit multiple file changes atomically.
|
|
29244
|
-
*
|
|
29245
|
-
* @param message - Commit message
|
|
29246
|
-
* @param files - Array of files to add/modify
|
|
29247
|
-
* @returns The commit result with SHA
|
|
29248
|
-
*/
|
|
29249
|
-
async commitFiles(message, files) {
|
|
29250
|
-
if (files.length === 0) {
|
|
29251
|
-
throw new Error("No files to commit");
|
|
29252
|
-
}
|
|
29253
|
-
const branchRef = await this.getBranchRef();
|
|
29254
|
-
const headSha = branchRef.object.sha;
|
|
29255
|
-
const headCommit = await this.getCommit(headSha);
|
|
29256
|
-
const baseTreeSha = headCommit.tree.sha;
|
|
29257
|
-
const blobPromises = files.map(async (file) => {
|
|
29258
|
-
const blob = await this.createBlob(file.content);
|
|
29259
|
-
return {
|
|
29260
|
-
path: file.path,
|
|
29261
|
-
sha: blob.sha,
|
|
29262
|
-
mode: file.mode || "100644"
|
|
29263
|
-
};
|
|
29264
|
-
});
|
|
29265
|
-
const blobs = await Promise.all(blobPromises);
|
|
29266
|
-
const newTree = await this.createTree(baseTreeSha, blobs);
|
|
29267
|
-
const commit = await this.createCommit(message, newTree.sha, headSha);
|
|
29268
|
-
await this.updateRef(commit.sha);
|
|
29269
|
-
return {
|
|
29270
|
-
sha: commit.sha,
|
|
29271
|
-
url: commit.html_url,
|
|
29272
|
-
message: commit.message
|
|
29273
|
-
};
|
|
29274
|
-
}
|
|
29275
|
-
/**
|
|
29276
|
-
* Delete files from the repository.
|
|
29277
|
-
*
|
|
29278
|
-
* @param message - Commit message
|
|
29279
|
-
* @param paths - Array of file paths to delete
|
|
29280
|
-
* @returns The commit result with SHA
|
|
29281
|
-
*/
|
|
29282
|
-
async deleteFiles(message, paths) {
|
|
29283
|
-
if (paths.length === 0) {
|
|
29284
|
-
throw new Error("No files to delete");
|
|
29285
|
-
}
|
|
29286
|
-
const branchRef = await this.getBranchRef();
|
|
29287
|
-
const headSha = branchRef.object.sha;
|
|
29288
|
-
const headCommit = await this.getCommit(headSha);
|
|
29289
|
-
const baseTreeSha = headCommit.tree.sha;
|
|
29290
|
-
const tree = paths.map((path20) => ({
|
|
29291
|
-
path: path20,
|
|
29292
|
-
mode: "100644",
|
|
29293
|
-
type: "blob",
|
|
29294
|
-
sha: null
|
|
29295
|
-
}));
|
|
29296
|
-
const newTree = await this.request(
|
|
29297
|
-
"POST",
|
|
29298
|
-
`/repos/${this.config.owner}/${this.config.repo}/git/trees`,
|
|
29299
|
-
{
|
|
29300
|
-
base_tree: baseTreeSha,
|
|
29301
|
-
tree
|
|
29302
|
-
}
|
|
29303
|
-
);
|
|
29304
|
-
const commit = await this.createCommit(message, newTree.sha, headSha);
|
|
29305
|
-
await this.updateRef(commit.sha);
|
|
29306
|
-
return {
|
|
29307
|
-
sha: commit.sha,
|
|
29308
|
-
url: commit.html_url,
|
|
29309
|
-
message: commit.message
|
|
29310
|
-
};
|
|
29311
|
-
}
|
|
29312
|
-
/**
|
|
29313
|
-
* Get the current HEAD commit SHA.
|
|
29314
|
-
*/
|
|
29315
|
-
async getHeadSha() {
|
|
29316
|
-
const ref = await this.getBranchRef();
|
|
29317
|
-
return ref.object.sha;
|
|
29318
|
-
}
|
|
29319
|
-
};
|
|
29320
|
-
var GitHubApiError = class extends Error {
|
|
29321
|
-
status;
|
|
29322
|
-
details;
|
|
29323
|
-
constructor(message, status, details) {
|
|
29324
|
-
super(message);
|
|
29325
|
-
this.name = "GitHubApiError";
|
|
29326
|
-
this.status = status;
|
|
29327
|
-
this.details = details;
|
|
29328
|
-
}
|
|
29329
|
-
};
|
|
29330
|
-
|
|
29331
|
-
// src/index.ts
|
|
29332
29198
|
init_ProviderRegistry();
|
|
29333
29199
|
init_types2();
|
|
29334
29200
|
|
|
29335
|
-
export { CodeExecutionBridge, DurableAgentBuilder, DurableThread, FlowStateSdk,
|
|
29201
|
+
export { CodeExecutionBridge, DurableAgentBuilder, DurableThread, FlowStateSdk, NamespaceResolutionError, PackageDiscoveryService, ProviderRegistry, agentbuilder, authenticate, buildImageDescription, builder, cat, createNamespaceContext, createThreadEndpointHandler, defineController2 as defineController, discoverPackages, emitThreadEvent, enhanceFlowState, exists, find, forceTurn, generateAgentFile, generateImageDescription, generateModelFile, generatePromptFile, getFileStats, getMessages, getMessagesToSummarize, getShortName, getThumbnail, getUnsummarizedImageAttachments, getVisibleAgentNames, getVisibleModelNames, getVisiblePromptNames, getVisibleToolNames, grep, hasImageAttachments, head, injectMessage, isQualifiedName, linkFile, mkdir, optimizeImageContext, parseQualifiedName, qualifyName, queueTool, readFile, readdir, reloadHistory, replaceImagesWithDescriptions, requireAdmin, requireAuth, resolveAgent, resolveHook, resolveModel, resolvePrompt, resolveTool, rmdir, stat, tail, unlink, updateThread, writeFile, writeImage };
|
|
29336
29202
|
//# sourceMappingURL=index.js.map
|
|
29337
29203
|
//# sourceMappingURL=index.js.map
|