@standardagents/builder 0.40.4 → 0.40.5
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 +42 -32
- package/dist/built-in-routes.js.map +1 -1
- package/dist/index.js +152 -94
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +9 -0
- package/dist/plugin.js +105 -21
- package/dist/plugin.js.map +1 -1
- package/dist/runtime.d.ts +3 -4
- package/dist/runtime.js +324 -341
- package/dist/runtime.js.map +1 -1
- package/package.json +8 -8
package/dist/built-in-routes.js
CHANGED
|
@@ -5047,9 +5047,7 @@ Message one with subagent_message(referenceId, message).`
|
|
|
5047
5047
|
if (resumable) {
|
|
5048
5048
|
await this.settleResumableChildAfterRun(
|
|
5049
5049
|
state,
|
|
5050
|
-
|
|
5051
|
-
childThreadId,
|
|
5052
|
-
childResult
|
|
5050
|
+
childThreadId
|
|
5053
5051
|
);
|
|
5054
5052
|
} else if (stub.terminateThread) {
|
|
5055
5053
|
await stub.terminateThread(childThreadId);
|
|
@@ -5061,7 +5059,7 @@ Message one with subagent_message(referenceId, message).`
|
|
|
5061
5059
|
attachments: copiedAttachments,
|
|
5062
5060
|
subagent_id: childThreadId
|
|
5063
5061
|
};
|
|
5064
|
-
return resumable
|
|
5062
|
+
return resumable ? this.withReferenceInToolResult(toolResult, childThreadId) : toolResult;
|
|
5065
5063
|
}
|
|
5066
5064
|
const backgroundRun = (async () => {
|
|
5067
5065
|
try {
|
|
@@ -5096,9 +5094,7 @@ Message one with subagent_message(referenceId, message).`
|
|
|
5096
5094
|
if (resumable) {
|
|
5097
5095
|
await this.settleResumableChildAfterRun(
|
|
5098
5096
|
state,
|
|
5099
|
-
|
|
5100
|
-
childThreadId,
|
|
5101
|
-
childResult
|
|
5097
|
+
childThreadId
|
|
5102
5098
|
);
|
|
5103
5099
|
} else if (stub.terminateThread) {
|
|
5104
5100
|
await stub.terminateThread(childThreadId);
|
|
@@ -5493,18 +5489,8 @@ Message one with subagent_message(referenceId, message).`
|
|
|
5493
5489
|
JSON.stringify(next)
|
|
5494
5490
|
);
|
|
5495
5491
|
}
|
|
5496
|
-
static
|
|
5497
|
-
|
|
5498
|
-
}
|
|
5499
|
-
static async settleResumableChildAfterRun(state, childThread, reference, result) {
|
|
5500
|
-
if (!this.isTerminalSubagentResult(result)) {
|
|
5501
|
-
await this.updateChildStatus(state, reference, "idle");
|
|
5502
|
-
return;
|
|
5503
|
-
}
|
|
5504
|
-
await this.updateChildStatus(state, reference, "terminated");
|
|
5505
|
-
if (typeof childThread.terminateThread === "function") {
|
|
5506
|
-
await childThread.terminateThread(reference);
|
|
5507
|
-
}
|
|
5492
|
+
static async settleResumableChildAfterRun(state, reference) {
|
|
5493
|
+
await this.updateChildStatus(state, reference, "idle");
|
|
5508
5494
|
}
|
|
5509
5495
|
static async buildChildInvocationMessages(state, childThread, content, receivesMessages, parentAttachments, initialArguments) {
|
|
5510
5496
|
const copiedAttachments = await this.copyAttachmentsBetweenThreads(
|
|
@@ -68027,7 +68013,14 @@ function isHostedInstance(env2) {
|
|
|
68027
68013
|
}
|
|
68028
68014
|
return Boolean(value);
|
|
68029
68015
|
}
|
|
68030
|
-
function
|
|
68016
|
+
function compiledTrustedDevHosts() {
|
|
68017
|
+
try {
|
|
68018
|
+
return typeof __STANDARD_AGENTS_TRUSTED_DEV_HOSTS__ !== "undefined" && Array.isArray(__STANDARD_AGENTS_TRUSTED_DEV_HOSTS__) ? __STANDARD_AGENTS_TRUSTED_DEV_HOSTS__ : [];
|
|
68019
|
+
} catch {
|
|
68020
|
+
return [];
|
|
68021
|
+
}
|
|
68022
|
+
}
|
|
68023
|
+
function isTrustedLocalDevelopmentRequest(request, env2, trustedDevHosts = compiledTrustedDevHosts()) {
|
|
68031
68024
|
if (isHostedInstance(env2)) return false;
|
|
68032
68025
|
let hostname;
|
|
68033
68026
|
try {
|
|
@@ -68035,7 +68028,7 @@ function isTrustedLocalDevelopmentRequest(request, env2) {
|
|
|
68035
68028
|
} catch {
|
|
68036
68029
|
return false;
|
|
68037
68030
|
}
|
|
68038
|
-
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname.endsWith(".localhost") || hostname.endsWith(".orb.local");
|
|
68031
|
+
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname.endsWith(".localhost") || hostname.endsWith(".orb.local") || trustedDevHosts.some((trusted) => trusted.trim().toLowerCase() === hostname);
|
|
68039
68032
|
}
|
|
68040
68033
|
function requestObservedOrigins(request) {
|
|
68041
68034
|
const origins = /* @__PURE__ */ new Set();
|
|
@@ -68899,7 +68892,7 @@ var config_get_default = defineController2(async ({ config, env: env2, req }) =>
|
|
|
68899
68892
|
});
|
|
68900
68893
|
|
|
68901
68894
|
// src/version.ts
|
|
68902
|
-
var BUILDER_VERSION = "0.40.
|
|
68895
|
+
var BUILDER_VERSION = "0.40.5".length > 0 ? "0.40.5" : "dev";
|
|
68903
68896
|
|
|
68904
68897
|
// src/api/diagnostics.get.ts
|
|
68905
68898
|
init_LLMRequest();
|
|
@@ -75494,11 +75487,8 @@ var tool_result_post_default = defineController2(async ({ req, params, env: env2
|
|
|
75494
75487
|
if (!delivered) {
|
|
75495
75488
|
return Response.json({ status: "ignored" }, { status: 200 });
|
|
75496
75489
|
}
|
|
75497
|
-
|
|
75498
|
-
|
|
75499
|
-
return Response.json({ status: "resumed", side: delivered.side }, { status: 200 });
|
|
75500
|
-
}
|
|
75501
|
-
return Response.json({ status: "delivered", side: delivered.side }, { status: 200 });
|
|
75490
|
+
await stub.continueExecution(threadId, delivered.side);
|
|
75491
|
+
return Response.json({ status: "resumed", side: delivered.side }, { status: 200 });
|
|
75502
75492
|
} catch (error) {
|
|
75503
75493
|
console.error(`Error delivering tool result for thread ${threadId}:`, error);
|
|
75504
75494
|
return Response.json(
|
|
@@ -76361,16 +76351,29 @@ async function resolveDeviceApprovalBrand(env2, config) {
|
|
|
76361
76351
|
}
|
|
76362
76352
|
return configured ?? BUILT_IN_DEVICE_APPROVAL_BRAND;
|
|
76363
76353
|
}
|
|
76364
|
-
function
|
|
76354
|
+
function deviceOutcomeOrigin(env2) {
|
|
76355
|
+
const raw = env2.STANDARD_AGENTS_DEVICE_OUTCOME_URL_BASE;
|
|
76356
|
+
if (typeof raw !== "string" || !raw.trim()) return null;
|
|
76357
|
+
try {
|
|
76358
|
+
const target = new URL(raw.trim());
|
|
76359
|
+
if (target.protocol !== "https:" || target.username || target.password) return null;
|
|
76360
|
+
return target.origin;
|
|
76361
|
+
} catch {
|
|
76362
|
+
return null;
|
|
76363
|
+
}
|
|
76364
|
+
}
|
|
76365
|
+
function approvalCsp(req, brand, env2) {
|
|
76365
76366
|
let imageSource = "";
|
|
76366
76367
|
if (brand.logoUrl) {
|
|
76367
76368
|
const requestOrigin = new URL(req.url).origin;
|
|
76368
76369
|
const logoOrigin = new URL(brand.logoUrl, requestOrigin).origin;
|
|
76369
76370
|
imageSource = `; img-src ${logoOrigin === requestOrigin ? "'self'" : logoOrigin}`;
|
|
76370
76371
|
}
|
|
76371
|
-
|
|
76372
|
+
const outcomeOrigin = deviceOutcomeOrigin(env2);
|
|
76373
|
+
const formAction = outcomeOrigin ? `'self' ${outcomeOrigin}` : "'self'";
|
|
76374
|
+
return `default-src 'none'; style-src 'unsafe-inline'; form-action ${formAction}; base-uri 'none'; frame-ancestors 'none'${imageSource}`;
|
|
76372
76375
|
}
|
|
76373
|
-
function confirmationPage(req, confirmationToken, handoff, brand, identity) {
|
|
76376
|
+
function confirmationPage(req, confirmationToken, handoff, brand, identity, env2) {
|
|
76374
76377
|
const handoffInput = handoff ? `<input type="hidden" name="handoff" value="${escapeHtml(handoff)}">` : "";
|
|
76375
76378
|
const logo = brand.logoUrl ? `<img class="logo" src="${escapeHtml(brand.logoUrl)}" alt="">` : `<span class="logo-fallback" aria-hidden="true">${escapeHtml(brand.name.slice(0, 1).toUpperCase())}</span>`;
|
|
76376
76379
|
const description = brand.description ? `<p class="description">${escapeHtml(brand.description)}</p>` : "";
|
|
@@ -76384,7 +76387,7 @@ function confirmationPage(req, confirmationToken, handoff, brand, identity) {
|
|
|
76384
76387
|
"Cache-Control": "no-store",
|
|
76385
76388
|
"Referrer-Policy": "no-referrer",
|
|
76386
76389
|
"X-Content-Type-Options": "nosniff",
|
|
76387
|
-
"Content-Security-Policy": approvalCsp(req, brand)
|
|
76390
|
+
"Content-Security-Policy": approvalCsp(req, brand, env2)
|
|
76388
76391
|
}
|
|
76389
76392
|
});
|
|
76390
76393
|
}
|
|
@@ -76534,7 +76537,14 @@ var approve_get_default = defineController2(async ({ req, env: env2, params, con
|
|
|
76534
76537
|
});
|
|
76535
76538
|
}
|
|
76536
76539
|
const brand = await resolveDeviceApprovalBrand(env2, config);
|
|
76537
|
-
return confirmationPage(
|
|
76540
|
+
return confirmationPage(
|
|
76541
|
+
req,
|
|
76542
|
+
confirmationToken,
|
|
76543
|
+
identity.handoff,
|
|
76544
|
+
brand,
|
|
76545
|
+
identity,
|
|
76546
|
+
env2
|
|
76547
|
+
);
|
|
76538
76548
|
});
|
|
76539
76549
|
|
|
76540
76550
|
// src/api/auth/device/[code]/approve.post.ts
|