@standardagents/builder 0.40.4 → 0.40.5-next.3b25e2a

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.
@@ -68899,7 +68899,7 @@ var config_get_default = defineController2(async ({ config, env: env2, req }) =>
68899
68899
  });
68900
68900
 
68901
68901
  // src/version.ts
68902
- var BUILDER_VERSION = "0.40.4".length > 0 ? "0.40.4" : "dev";
68902
+ var BUILDER_VERSION = "0.40.5-next.3b25e2a".length > 0 ? "0.40.5-next.3b25e2a" : "dev";
68903
68903
 
68904
68904
  // src/api/diagnostics.get.ts
68905
68905
  init_LLMRequest();
@@ -76361,16 +76361,29 @@ async function resolveDeviceApprovalBrand(env2, config) {
76361
76361
  }
76362
76362
  return configured ?? BUILT_IN_DEVICE_APPROVAL_BRAND;
76363
76363
  }
76364
- function approvalCsp(req, brand) {
76364
+ function deviceOutcomeOrigin(env2) {
76365
+ const raw = env2.STANDARD_AGENTS_DEVICE_OUTCOME_URL_BASE;
76366
+ if (typeof raw !== "string" || !raw.trim()) return null;
76367
+ try {
76368
+ const target = new URL(raw.trim());
76369
+ if (target.protocol !== "https:" || target.username || target.password) return null;
76370
+ return target.origin;
76371
+ } catch {
76372
+ return null;
76373
+ }
76374
+ }
76375
+ function approvalCsp(req, brand, env2) {
76365
76376
  let imageSource = "";
76366
76377
  if (brand.logoUrl) {
76367
76378
  const requestOrigin = new URL(req.url).origin;
76368
76379
  const logoOrigin = new URL(brand.logoUrl, requestOrigin).origin;
76369
76380
  imageSource = `; img-src ${logoOrigin === requestOrigin ? "'self'" : logoOrigin}`;
76370
76381
  }
76371
- return `default-src 'none'; style-src 'unsafe-inline'; form-action 'self'; base-uri 'none'; frame-ancestors 'none'${imageSource}`;
76382
+ const outcomeOrigin = deviceOutcomeOrigin(env2);
76383
+ const formAction = outcomeOrigin ? `'self' ${outcomeOrigin}` : "'self'";
76384
+ return `default-src 'none'; style-src 'unsafe-inline'; form-action ${formAction}; base-uri 'none'; frame-ancestors 'none'${imageSource}`;
76372
76385
  }
76373
- function confirmationPage(req, confirmationToken, handoff, brand, identity) {
76386
+ function confirmationPage(req, confirmationToken, handoff, brand, identity, env2) {
76374
76387
  const handoffInput = handoff ? `<input type="hidden" name="handoff" value="${escapeHtml(handoff)}">` : "";
76375
76388
  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
76389
  const description = brand.description ? `<p class="description">${escapeHtml(brand.description)}</p>` : "";
@@ -76384,7 +76397,7 @@ function confirmationPage(req, confirmationToken, handoff, brand, identity) {
76384
76397
  "Cache-Control": "no-store",
76385
76398
  "Referrer-Policy": "no-referrer",
76386
76399
  "X-Content-Type-Options": "nosniff",
76387
- "Content-Security-Policy": approvalCsp(req, brand)
76400
+ "Content-Security-Policy": approvalCsp(req, brand, env2)
76388
76401
  }
76389
76402
  });
76390
76403
  }
@@ -76534,7 +76547,14 @@ var approve_get_default = defineController2(async ({ req, env: env2, params, con
76534
76547
  });
76535
76548
  }
76536
76549
  const brand = await resolveDeviceApprovalBrand(env2, config);
76537
- return confirmationPage(req, confirmationToken, identity.handoff, brand, identity);
76550
+ return confirmationPage(
76551
+ req,
76552
+ confirmationToken,
76553
+ identity.handoff,
76554
+ brand,
76555
+ identity,
76556
+ env2
76557
+ );
76538
76558
  });
76539
76559
 
76540
76560
  // src/api/auth/device/[code]/approve.post.ts