vibes-diy 14.3.431 → 14.3.432

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.
@@ -31237,6 +31237,7 @@ __name(isActiveDbAcl, "isActiveDbAcl");
31237
31237
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
31238
31238
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
31239
31239
  init_performance2();
31240
+ init_esm();
31240
31241
  var cachedSuggestionRecord = lazyType(
31241
31242
  () => type({
31242
31243
  fsId: "string",
@@ -35555,6 +35556,7 @@ var BY_BARE = new Map(AGENT_REACTIONS.map((r2) => [bare(r2), r2]));
35555
35556
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
35556
35557
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
35557
35558
  init_performance2();
35559
+ init_esm();
35558
35560
  var AGENT_PICTURE_MAX_BYTES = 20 * 1024 * 1024;
35559
35561
  var pictureReceipt = lazyType(
35560
35562
  () => type({
@@ -89205,10 +89207,9 @@ function createLinqClient(opts) {
89205
89207
  map: map3
89206
89208
  }) {
89207
89209
  const signal = AbortSignal.timeout(timeoutMs);
89208
- let res;
89209
- try {
89210
+ const rRes = await exception2Result(() => {
89210
89211
  const doFetch = opts.fetch ?? fetch.bind(globalThis);
89211
- res = await untilAborted(
89212
+ return untilAborted(
89212
89213
  doFetch(`${baseUrl}${path}`, {
89213
89214
  method,
89214
89215
  headers: {
@@ -89220,17 +89221,15 @@ function createLinqClient(opts) {
89220
89221
  }),
89221
89222
  signal
89222
89223
  );
89223
- } catch {
89224
- return { ok: false, kind: "retry", status: 0 };
89225
- }
89226
- let json5;
89227
- try {
89224
+ });
89225
+ if (rRes.isErr()) return { ok: false, kind: "retry", status: 0 };
89226
+ const res = rRes.Ok();
89227
+ const rJson = await exception2Result(async () => {
89228
89228
  const text3 = await untilAborted(res.text(), signal);
89229
- json5 = text3 ? JSON.parse(text3) : {};
89230
- } catch {
89231
- if (signal.aborted) return { ok: false, kind: "retry", status: 0 };
89232
- json5 = {};
89233
- }
89229
+ return text3 ? JSON.parse(text3) : {};
89230
+ });
89231
+ if (rJson.isErr() && signal.aborted) return { ok: false, kind: "retry", status: 0 };
89232
+ const json5 = rJson.isOk() ? rJson.Ok() : {};
89234
89233
  if (!res.ok) {
89235
89234
  const code2 = errorCode(json5);
89236
89235
  const ra = retryAfterMs(res);
@@ -93960,6 +93959,7 @@ init_performance2();
93960
93959
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
93961
93960
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
93962
93961
  init_performance2();
93962
+ init_esm();
93963
93963
 
93964
93964
  // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/public/platform-db-registry.ts
93965
93965
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
@@ -94171,14 +94171,13 @@ function inheritChannelKey(db, docId) {
94171
94171
  __name(inheritChannelKey, "inheritChannelKey");
94172
94172
  function inheritRefFromChannel(ch) {
94173
94173
  if (ch.startsWith(INHERIT_CHANNEL_PREFIX) === false) return void 0;
94174
- try {
94174
+ const rRef = exception2Result(() => {
94175
94175
  const parsed2 = JSON.parse(ch.slice(INHERIT_CHANNEL_PREFIX.length));
94176
94176
  if (Array.isArray(parsed2) === false || parsed2.length !== 2) return void 0;
94177
94177
  const [db, docId] = parsed2;
94178
94178
  return presentInheritRead({ db, docId }) ? { db, docId } : void 0;
94179
- } catch {
94180
- return void 0;
94181
- }
94179
+ });
94180
+ return rRef.isOk() ? rRef.Ok() : void 0;
94182
94181
  }
94183
94182
  __name(inheritRefFromChannel, "inheritRefFromChannel");
94184
94183
  function hasInheritChannel(channels) {
@@ -94759,6 +94758,7 @@ init_performance2();
94759
94758
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
94760
94759
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
94761
94760
  init_performance2();
94761
+ init_esm();
94762
94762
 
94763
94763
  // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/vibe/runtime/notify-path.ts
94764
94764
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
@@ -94828,8 +94828,8 @@ async function emitNotification(qctx, input3) {
94828
94828
  appSlug: input3.appSlug
94829
94829
  });
94830
94830
  if (deliver && qctx.postQueue && isInstantEmailNotificationType(input3.notificationType)) {
94831
- try {
94832
- await qctx.postQueue({
94831
+ const rEnqueue = await exception2Result(
94832
+ () => qctx.postQueue?.({
94833
94833
  payload: {
94834
94834
  type: "vibes.diy.evt-notification-email",
94835
94835
  userId: input3.userId,
@@ -94839,10 +94839,9 @@ async function emitNotification(qctx, input3) {
94839
94839
  src: "emit-notification",
94840
94840
  dst: "vibes-service",
94841
94841
  ttl: 1
94842
- });
94843
- } catch (e2) {
94844
- console.error("[notification-email] enqueue failed for", id, e2);
94845
- }
94842
+ })
94843
+ );
94844
+ if (rEnqueue.isErr()) console.error("[notification-email] enqueue failed for", id, rEnqueue.Err());
94846
94845
  }
94847
94846
  if (deliver === false) return { inserted: true, id };
94848
94847
  const livePath = input3.notificationType === "app-message" && typeof input3.targetRef === "object" && input3.targetRef !== null ? input3.targetRef.path : void 0;
@@ -133551,6 +133550,7 @@ init_esm();
133551
133550
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
133552
133551
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
133553
133552
  init_performance2();
133553
+ init_esm();
133554
133554
  var FEED_TABLE = sql.raw(`"SyncFeed"`);
133555
133555
  function partitionLockKey(ownerHandle, appSlug, dbName) {
133556
133556
  return JSON.stringify(["syncfeed", ownerHandle, appSlug, dbName]);
@@ -133611,11 +133611,8 @@ async function loadDocChannels(vctx, part) {
133611
133611
  __name(loadDocChannels, "loadDocChannels");
133612
133612
  function channelSetOfStoredOutput(output2) {
133613
133613
  if (!output2) return [];
133614
- try {
133615
- return channelSetOfDescriptor(JSON.parse(output2));
133616
- } catch {
133617
- return [];
133618
- }
133614
+ const rSet = exception2Result(() => channelSetOfDescriptor(JSON.parse(output2)));
133615
+ return rSet.isOk() ? rSet.Ok() : [];
133619
133616
  }
133620
133617
  __name(channelSetOfStoredOutput, "channelSetOfStoredOutput");
133621
133618
  async function lockFeedPartitionInTransaction(exec, p3) {
@@ -133670,21 +133667,17 @@ async function emitChannelChangeFeed(p3) {
133670
133667
  }
133671
133668
  __name(emitChannelChangeFeed, "emitChannelChangeFeed");
133672
133669
  async function bestEffortChannelChange(p3) {
133673
- try {
133674
- return await emitChannelChangeFeed(p3);
133675
- } catch (err) {
133676
- console.warn(`sync feed append (put/evict) failed for ${p3.ownerHandle}/${p3.appSlug}/${p3.dbName}/${p3.docId}:`, err);
133677
- return void 0;
133678
- }
133670
+ const rSeq = await exception2Result(() => emitChannelChangeFeed(p3));
133671
+ if (rSeq.isOk()) return rSeq.Ok();
133672
+ console.warn(`sync feed append (put/evict) failed for ${p3.ownerHandle}/${p3.appSlug}/${p3.dbName}/${p3.docId}:`, rSeq.Err());
133673
+ return void 0;
133679
133674
  }
133680
133675
  __name(bestEffortChannelChange, "bestEffortChannelChange");
133681
133676
  async function bestEffortAppendDelete(p3) {
133682
- try {
133683
- return await appendFeedEntry({ ...p3, kind: "delete" });
133684
- } catch (err) {
133685
- console.warn(`sync feed append (delete) failed for ${p3.ownerHandle}/${p3.appSlug}/${p3.dbName}/${p3.docId}:`, err);
133686
- return void 0;
133687
- }
133677
+ const rSeq = await exception2Result(() => appendFeedEntry({ ...p3, kind: "delete" }));
133678
+ if (rSeq.isOk()) return rSeq.Ok();
133679
+ console.warn(`sync feed append (delete) failed for ${p3.ownerHandle}/${p3.appSlug}/${p3.dbName}/${p3.docId}:`, rSeq.Err());
133680
+ return void 0;
133688
133681
  }
133689
133682
  __name(bestEffortAppendDelete, "bestEffortAppendDelete");
133690
133683
 
@@ -136305,6 +136298,7 @@ init_esm();
136305
136298
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
136306
136299
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
136307
136300
  init_performance2();
136301
+ init_esm();
136308
136302
 
136309
136303
  // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/agent-stop-note.ts
136310
136304
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
@@ -151407,6 +151401,7 @@ init_performance2();
151407
151401
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
151408
151402
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
151409
151403
  init_performance2();
151404
+ init_esm();
151410
151405
  var cache3 = /* @__PURE__ */ new Map();
151411
151406
  var invalidatedAt = /* @__PURE__ */ new Map();
151412
151407
  var refreshing = /* @__PURE__ */ new Set();
@@ -151514,10 +151509,8 @@ function estimateGenerationBytes(outputRows, liveDocs) {
151514
151509
  for (let i3 = 0; i3 < samples; i3++) {
151515
151510
  const doc = liveDocs[Math.min(liveDocs.length - 1, Math.floor(i3 * stride))];
151516
151511
  if (doc === void 0) continue;
151517
- try {
151518
- sampledBytes += JSON.stringify(doc.doc).length;
151519
- } catch {
151520
- }
151512
+ const rBytes = exception2Result(() => JSON.stringify(doc.doc).length);
151513
+ if (rBytes.isOk()) sampledBytes += rBytes.Ok();
151521
151514
  sampled += 1;
151522
151515
  }
151523
151516
  if (sampled === 0) return bytes;
@@ -151941,6 +151934,7 @@ __name(emitBackendOnChange, "emitBackendOnChange");
151941
151934
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
151942
151935
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
151943
151936
  init_performance2();
151937
+ init_esm();
151944
151938
 
151945
151939
  // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/public/access-function.ts
151946
151940
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
@@ -152127,9 +152121,9 @@ async function runPutAccessGate(vctx, input3) {
152127
152121
  if ("forbidden" in invokeResult) {
152128
152122
  return { kind: "deny", code: "access-denied", message: invokeResult.forbidden, fnRefusal: true };
152129
152123
  }
152130
- try {
152131
- enforceAllowAnonymous(invokeResult, input3.userContext);
152132
- } catch (err) {
152124
+ const rAnonymous = exception2Result(() => enforceAllowAnonymous(invokeResult, input3.userContext));
152125
+ if (rAnonymous.isErr()) {
152126
+ const err = rAnonymous.Err();
152133
152127
  const reason = err instanceof ForbiddenError ? err.forbidden : String(err);
152134
152128
  return { kind: "deny", code: "access-denied", message: reason };
152135
152129
  }
@@ -153584,12 +153578,9 @@ function validateSchema(raw) {
153584
153578
  if (properties === null || typeof properties !== "object" || Array.isArray(properties) || Object.keys(properties).length === 0) {
153585
153579
  return { ok: false, error: "ctx.callAI schema must be an object with a non-empty properties map" };
153586
153580
  }
153587
- let serialized;
153588
- try {
153589
- serialized = JSON.stringify(raw);
153590
- } catch {
153591
- return { ok: false, error: "ctx.callAI schema is not serializable" };
153592
- }
153581
+ const rSerialized = exception2Result(() => JSON.stringify(raw));
153582
+ if (rSerialized.isErr()) return { ok: false, error: "ctx.callAI schema is not serializable" };
153583
+ const serialized = rSerialized.Ok();
153593
153584
  if (serialized.length > MAX_SCHEMA_CHARS) {
153594
153585
  return { ok: false, error: `ctx.callAI schema too large (max ${MAX_SCHEMA_CHARS} chars)` };
153595
153586
  }
@@ -153670,29 +153661,22 @@ function makeBackendAiCallback(vctx, base2) {
153670
153661
  messages: [{ role: "user", content: [{ type: "text", text: op.prompt }] }],
153671
153662
  ...schemaFields
153672
153663
  };
153673
- let res;
153674
- try {
153675
- res = await vctx.llmRequest({ ...req, headers: vctx.params.llm.headers }, { signal: AbortSignal.timeout(AI_TIMEOUT_MS) });
153676
- } catch {
153677
- return { ok: false, error: "ctx.callAI: ai gateway unreachable" };
153678
- }
153664
+ const rRes = await exception2Result(
153665
+ () => vctx.llmRequest({ ...req, headers: vctx.params.llm.headers }, { signal: AbortSignal.timeout(AI_TIMEOUT_MS) })
153666
+ );
153667
+ if (rRes.isErr()) return { ok: false, error: "ctx.callAI: ai gateway unreachable" };
153668
+ const res = rRes.Ok();
153679
153669
  if (!res.ok) {
153680
153670
  await res.body?.cancel().catch(() => void 0);
153681
153671
  return { ok: false, error: `ctx.callAI: ai gateway error (status ${res.status})` };
153682
153672
  }
153683
- let body;
153684
- try {
153685
- body = await res.json();
153686
- } catch {
153687
- return { ok: false, error: "ctx.callAI: ai gateway returned malformed JSON" };
153688
- }
153673
+ const rBody = await exception2Result(() => res.json());
153674
+ if (rBody.isErr()) return { ok: false, error: "ctx.callAI: ai gateway returned malformed JSON" };
153675
+ const body = rBody.Ok();
153689
153676
  const json5 = body;
153690
- let text3;
153691
- try {
153692
- text3 = extractContent(body, strategy);
153693
- } catch {
153694
- return { ok: false, error: "ctx.callAI: ai gateway returned no completion" };
153695
- }
153677
+ const rText = exception2Result(() => extractContent(body, strategy));
153678
+ if (rText.isErr()) return { ok: false, error: "ctx.callAI: ai gateway returned no completion" };
153679
+ const text3 = rText.Ok();
153696
153680
  if (text3.length === 0) {
153697
153681
  return { ok: false, error: "ctx.callAI: ai gateway returned no completion" };
153698
153682
  }
@@ -156528,12 +156512,9 @@ function normalizeGithubUrl(path) {
156528
156512
  if (path.startsWith("/") === false) return void 0;
156529
156513
  if (path.startsWith("//")) return void 0;
156530
156514
  if (path.includes("\\")) return void 0;
156531
- let u3;
156532
- try {
156533
- u3 = new URL(path, GITHUB_API2);
156534
- } catch {
156535
- return void 0;
156536
- }
156515
+ const rU = exception2Result(() => new URL(path, GITHUB_API2));
156516
+ if (rU.isErr()) return void 0;
156517
+ const u3 = rU.Ok();
156537
156518
  if (u3.origin !== GITHUB_ORIGIN) return void 0;
156538
156519
  return u3;
156539
156520
  }
@@ -156964,12 +156945,9 @@ function answer(status, payload) {
156964
156945
  __name(answer, "answer");
156965
156946
  function publicImageUrl(raw) {
156966
156947
  if (typeof raw !== "string" || raw === "") return void 0;
156967
- let u3;
156968
- try {
156969
- u3 = new URL(raw);
156970
- } catch {
156971
- return void 0;
156972
- }
156948
+ const rU = exception2Result(() => new URL(raw));
156949
+ if (rU.isErr()) return void 0;
156950
+ const u3 = rU.Ok();
156973
156951
  if (u3.protocol !== "https:") return void 0;
156974
156952
  if (u3.username !== "" || u3.password !== "") return void 0;
156975
156953
  if (u3.port !== "") return void 0;
@@ -156984,12 +156962,9 @@ function publicImageUrl(raw) {
156984
156962
  __name(publicImageUrl, "publicImageUrl");
156985
156963
  function linkedinUploadUrl(raw) {
156986
156964
  if (typeof raw !== "string") return void 0;
156987
- let u3;
156988
- try {
156989
- u3 = new URL(raw);
156990
- } catch {
156991
- return void 0;
156992
- }
156965
+ const rU = exception2Result(() => new URL(raw));
156966
+ if (rU.isErr()) return void 0;
156967
+ const u3 = rU.Ok();
156993
156968
  if (u3.protocol !== "https:" || u3.hostname !== "www.linkedin.com" || u3.port !== "") return void 0;
156994
156969
  if (u3.pathname.startsWith("/dms-uploads/") === false) return void 0;
156995
156970
  return u3;
@@ -157052,11 +157027,8 @@ async function fetchPublicImage(fetchImpl, first) {
157052
157027
  __name(fetchPublicImage, "fetchPublicImage");
157053
157028
  function resolveLocation(location, base2) {
157054
157029
  if (location === null || location === "") return void 0;
157055
- try {
157056
- return new URL(location, base2).toString();
157057
- } catch {
157058
- return void 0;
157059
- }
157030
+ const rLocation = exception2Result(() => new URL(location, base2).toString());
157031
+ return rLocation.isOk() ? rLocation.Ok() : void 0;
157060
157032
  }
157061
157033
  __name(resolveLocation, "resolveLocation");
157062
157034
  var PERSON_URN = /^urn:li:person:[A-Za-z0-9_-]+$/;
@@ -157143,6 +157115,7 @@ __name(hostActionFor, "hostActionFor");
157143
157115
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
157144
157116
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
157145
157117
  init_performance2();
157118
+ init_esm();
157146
157119
  var DRIVE_FILE_ID = "[A-Za-z0-9_-]{1,256}";
157147
157120
  var DRIVE_FILE_PATH = new RegExp(`^/drive/v3/files/(${DRIVE_FILE_ID})$`);
157148
157121
  var DRIVE_FILE_EXPORT_PATH = new RegExp(`^/drive/v3/files/(${DRIVE_FILE_ID})/export$`);
@@ -157226,12 +157199,9 @@ var DRIVE_TEXT_EXPORTS = /* @__PURE__ */ new Set([
157226
157199
  ]);
157227
157200
  function parseObject2(json5) {
157228
157201
  if (json5.trim() === "") return {};
157229
- let v3;
157230
- try {
157231
- v3 = JSON.parse(json5);
157232
- } catch {
157233
- return void 0;
157234
- }
157202
+ const rV = exception2Result(() => JSON.parse(json5));
157203
+ if (rV.isErr()) return void 0;
157204
+ const v3 = rV.Ok();
157235
157205
  if (v3 === null || typeof v3 !== "object" || Array.isArray(v3)) return void 0;
157236
157206
  return v3;
157237
157207
  }
@@ -158242,18 +158212,12 @@ function normalizeProviderUrl(provider, path) {
158242
158212
  if (path.startsWith("/") === false) return void 0;
158243
158213
  if (path.startsWith("//")) return void 0;
158244
158214
  if (path.includes("\\")) return void 0;
158245
- let u3;
158246
- try {
158247
- u3 = new URL(path, provider.apiOrigin);
158248
- } catch {
158249
- return void 0;
158250
- }
158251
- let origin;
158252
- try {
158253
- origin = new URL(provider.apiOrigin).origin;
158254
- } catch {
158255
- return void 0;
158256
- }
158215
+ const rU = exception2Result(() => new URL(path, provider.apiOrigin));
158216
+ if (rU.isErr()) return void 0;
158217
+ const u3 = rU.Ok();
158218
+ const rOrigin = exception2Result(() => new URL(provider.apiOrigin).origin);
158219
+ if (rOrigin.isErr()) return void 0;
158220
+ const origin = rOrigin.Ok();
158257
158221
  if (u3.origin !== origin) return void 0;
158258
158222
  return u3;
158259
158223
  }
@@ -159547,12 +159511,9 @@ __name(youtubeKey, "youtubeKey");
159547
159511
  function resolveYoutubeTarget(pathOrUrl) {
159548
159512
  let path;
159549
159513
  if (/^https?:\/\//i.test(pathOrUrl)) {
159550
- let u3;
159551
- try {
159552
- u3 = new URL(pathOrUrl);
159553
- } catch {
159554
- return { ok: false, reason: "invalid_path" };
159555
- }
159514
+ const rU = exception2Result(() => new URL(pathOrUrl));
159515
+ if (rU.isErr()) return { ok: false, reason: "invalid_path" };
159516
+ const u3 = rU.Ok();
159556
159517
  if (u3.protocol !== "https:" || YOUTUBE_API_HOSTS.has(u3.hostname) === false) return { ok: false, reason: "invalid_path" };
159557
159518
  if (u3.port !== "" || u3.username !== "" || u3.password !== "") return { ok: false, reason: "invalid_path" };
159558
159519
  path = `${u3.pathname}${u3.search}`;
@@ -163370,6 +163331,7 @@ var EgressRateWindow = class {
163370
163331
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
163371
163332
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
163372
163333
  init_performance2();
163334
+ init_esm();
163373
163335
  var READ_CACHE_DEFAULT_TTL_MS = 3e5;
163374
163336
  var READ_CACHE_MIN_TTL_MS = 6e4;
163375
163337
  var READ_CACHE_MAX_TTL_MS = 36e5;
@@ -163542,12 +163504,9 @@ var EgressReadCache = class {
163542
163504
  }
163543
163505
  };
163544
163506
  function signatureFromNames(storedSignature, requestHeaders) {
163545
- let names;
163546
- try {
163547
- names = JSON.parse(storedSignature);
163548
- } catch {
163549
- return "";
163550
- }
163507
+ const rNames = exception2Result(() => JSON.parse(storedSignature));
163508
+ if (rNames.isErr()) return "";
163509
+ const names = rNames.Ok();
163551
163510
  return JSON.stringify(names.map(([n2]) => [n2, requestHeaders.get(n2)]));
163552
163511
  }
163553
163512
  __name(signatureFromNames, "signatureFromNames");
@@ -163706,12 +163665,9 @@ async function attemptBackendEgress(input3) {
163706
163665
  const runtimeInput = { ...input3, signal };
163707
163666
  const fetcher = input3.fetcher ?? ((req) => fetch(req));
163708
163667
  const now2 = input3.now ?? (() => Date.now());
163709
- let url3;
163710
- try {
163711
- url3 = new URL(input3.request.url);
163712
- } catch {
163713
- return egressDenial("floor", "");
163714
- }
163668
+ const rUrl = exception2Result(() => new URL(input3.request.url));
163669
+ if (rUrl.isErr()) return egressDenial("floor", "");
163670
+ const url3 = rUrl.Ok();
163715
163671
  const method = input3.request.method.toUpperCase();
163716
163672
  if (!floorAdmits(url3, method)) return egressDenial("floor", url3.hostname);
163717
163673
  if (input3.ownerStatus === "blocked") return egressDenial("owner-blocked", url3.hostname);
@@ -163752,12 +163708,9 @@ async function attemptBackendEgress(input3) {
163752
163708
  preflight.headers.set("access-control-request-method", method);
163753
163709
  if (requested.length > 0) preflight.headers.set("access-control-request-headers", requested.join(", "));
163754
163710
  preflight.headers.set("user-agent", egressUserAgent(input3));
163755
- let pfRes;
163756
- try {
163757
- pfRes = await fetcher(preflight);
163758
- } catch {
163759
- return egressDenial("cors", url3.hostname);
163760
- }
163711
+ const rPfRes = await exception2Result(() => fetcher(preflight));
163712
+ if (rPfRes.isErr()) return egressDenial("cors", url3.hostname);
163713
+ const pfRes = rPfRes.Ok();
163761
163714
  admitted = pfRes.status < 300 || pfRes.status >= 400 ? preflightAdmits({ res: pfRes, vibeOrigin: input3.vibeOrigin, method, requestedHeaders: requested }) : false;
163762
163715
  await pfRes.body?.cancel().catch(() => void 0);
163763
163716
  input3.corsCache.set({ key, ok: admitted, maxAgeSeconds: preflightMaxAgeSeconds(pfRes), now: now2() });
@@ -163890,13 +163843,14 @@ async function forward({ input: input3, fetcher, url: url3, headers, revalidate,
163890
163843
  duplex: "half",
163891
163844
  signal: input3.signal
163892
163845
  });
163893
- try {
163894
- res = await fetcher(outbound);
163895
- } catch (e2) {
163846
+ const rRes = await exception2Result(() => fetcher(outbound));
163847
+ if (rRes.isErr()) {
163848
+ const e2 = rRes.Err();
163896
163849
  const res2 = syntheticEgressError(target.hostname, String(e2?.message ?? e2));
163897
163850
  finalUrls.set(res2, target.toString());
163898
163851
  return { kind: "synthetic", res: res2, transmitted: true };
163899
163852
  }
163853
+ res = rRes.Ok();
163900
163854
  const location = REDIRECT_STATUSES3.has(res.status) ? res.headers.get("location") : null;
163901
163855
  if (!location) break;
163902
163856
  if (hop >= MAX_REDIRECTS2) {
@@ -163905,12 +163859,9 @@ async function forward({ input: input3, fetcher, url: url3, headers, revalidate,
163905
163859
  finalUrls.set(tooMany, target.toString());
163906
163860
  return { kind: "synthetic", res: tooMany, transmitted: true };
163907
163861
  }
163908
- let next3;
163909
- try {
163910
- next3 = new URL(location, target);
163911
- } catch {
163912
- break;
163913
- }
163862
+ const rNext = exception2Result(() => new URL(location, target));
163863
+ if (rNext.isErr()) break;
163864
+ const next3 = rNext.Ok();
163914
163865
  await res.body?.cancel().catch(() => void 0);
163915
163866
  const rewriteToGet = (res.status === 301 || res.status === 302) && method === "POST" || res.status === 303 && method !== "GET" && method !== "HEAD";
163916
163867
  const nextMethod = rewriteToGet ? "GET" : method;