vibes-diy 14.3.430 → 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({
@@ -37452,6 +37454,22 @@ var resTermsAck = lazyType(
37452
37454
  })
37453
37455
  );
37454
37456
 
37457
+ // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/types/app-secret-rules.ts
37458
+ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
37459
+ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
37460
+ init_performance2();
37461
+ var SECRET_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]{0,63}$/;
37462
+ var SECRET_KEY_MAX = 64;
37463
+ var SECRET_VALUE_MAX = 8192;
37464
+ var SECRET_COUNT_MAX = 32;
37465
+ var SECRET_REFUSAL = {
37466
+ key: `Key names use letters, numbers and _, like MY_API_KEY, and start with a letter or _ (up to ${SECRET_KEY_MAX} characters).`,
37467
+ size: `A secret holds up to ${SECRET_VALUE_MAX} bytes.`,
37468
+ cap: `A vibe holds up to ${SECRET_COUNT_MAX} secrets. Remove one you no longer use to make room for this one.`,
37469
+ owner: "owner-only:secret-op",
37470
+ exclusive: "secret-op-not-exclusive"
37471
+ };
37472
+
37455
37473
  // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/types/invite-flow.ts
37456
37474
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
37457
37475
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
@@ -89189,10 +89207,9 @@ function createLinqClient(opts) {
89189
89207
  map: map3
89190
89208
  }) {
89191
89209
  const signal = AbortSignal.timeout(timeoutMs);
89192
- let res;
89193
- try {
89210
+ const rRes = await exception2Result(() => {
89194
89211
  const doFetch = opts.fetch ?? fetch.bind(globalThis);
89195
- res = await untilAborted(
89212
+ return untilAborted(
89196
89213
  doFetch(`${baseUrl}${path}`, {
89197
89214
  method,
89198
89215
  headers: {
@@ -89204,17 +89221,15 @@ function createLinqClient(opts) {
89204
89221
  }),
89205
89222
  signal
89206
89223
  );
89207
- } catch {
89208
- return { ok: false, kind: "retry", status: 0 };
89209
- }
89210
- let json5;
89211
- try {
89224
+ });
89225
+ if (rRes.isErr()) return { ok: false, kind: "retry", status: 0 };
89226
+ const res = rRes.Ok();
89227
+ const rJson = await exception2Result(async () => {
89212
89228
  const text3 = await untilAborted(res.text(), signal);
89213
- json5 = text3 ? JSON.parse(text3) : {};
89214
- } catch {
89215
- if (signal.aborted) return { ok: false, kind: "retry", status: 0 };
89216
- json5 = {};
89217
- }
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() : {};
89218
89233
  if (!res.ok) {
89219
89234
  const code2 = errorCode(json5);
89220
89235
  const ra = retryAfterMs(res);
@@ -93944,6 +93959,7 @@ init_performance2();
93944
93959
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
93945
93960
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
93946
93961
  init_performance2();
93962
+ init_esm();
93947
93963
 
93948
93964
  // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/public/platform-db-registry.ts
93949
93965
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
@@ -94155,14 +94171,13 @@ function inheritChannelKey(db, docId) {
94155
94171
  __name(inheritChannelKey, "inheritChannelKey");
94156
94172
  function inheritRefFromChannel(ch) {
94157
94173
  if (ch.startsWith(INHERIT_CHANNEL_PREFIX) === false) return void 0;
94158
- try {
94174
+ const rRef = exception2Result(() => {
94159
94175
  const parsed2 = JSON.parse(ch.slice(INHERIT_CHANNEL_PREFIX.length));
94160
94176
  if (Array.isArray(parsed2) === false || parsed2.length !== 2) return void 0;
94161
94177
  const [db, docId] = parsed2;
94162
94178
  return presentInheritRead({ db, docId }) ? { db, docId } : void 0;
94163
- } catch {
94164
- return void 0;
94165
- }
94179
+ });
94180
+ return rRef.isOk() ? rRef.Ok() : void 0;
94166
94181
  }
94167
94182
  __name(inheritRefFromChannel, "inheritRefFromChannel");
94168
94183
  function hasInheritChannel(channels) {
@@ -94743,6 +94758,7 @@ init_performance2();
94743
94758
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
94744
94759
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
94745
94760
  init_performance2();
94761
+ init_esm();
94746
94762
 
94747
94763
  // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/vibe/runtime/notify-path.ts
94748
94764
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
@@ -94812,8 +94828,8 @@ async function emitNotification(qctx, input3) {
94812
94828
  appSlug: input3.appSlug
94813
94829
  });
94814
94830
  if (deliver && qctx.postQueue && isInstantEmailNotificationType(input3.notificationType)) {
94815
- try {
94816
- await qctx.postQueue({
94831
+ const rEnqueue = await exception2Result(
94832
+ () => qctx.postQueue?.({
94817
94833
  payload: {
94818
94834
  type: "vibes.diy.evt-notification-email",
94819
94835
  userId: input3.userId,
@@ -94823,10 +94839,9 @@ async function emitNotification(qctx, input3) {
94823
94839
  src: "emit-notification",
94824
94840
  dst: "vibes-service",
94825
94841
  ttl: 1
94826
- });
94827
- } catch (e2) {
94828
- console.error("[notification-email] enqueue failed for", id, e2);
94829
- }
94842
+ })
94843
+ );
94844
+ if (rEnqueue.isErr()) console.error("[notification-email] enqueue failed for", id, rEnqueue.Err());
94830
94845
  }
94831
94846
  if (deliver === false) return { inserted: true, id };
94832
94847
  const livePath = input3.notificationType === "app-message" && typeof input3.targetRef === "object" && input3.targetRef !== null ? input3.targetRef.path : void 0;
@@ -133535,6 +133550,7 @@ init_esm();
133535
133550
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
133536
133551
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
133537
133552
  init_performance2();
133553
+ init_esm();
133538
133554
  var FEED_TABLE = sql.raw(`"SyncFeed"`);
133539
133555
  function partitionLockKey(ownerHandle, appSlug, dbName) {
133540
133556
  return JSON.stringify(["syncfeed", ownerHandle, appSlug, dbName]);
@@ -133595,11 +133611,8 @@ async function loadDocChannels(vctx, part) {
133595
133611
  __name(loadDocChannels, "loadDocChannels");
133596
133612
  function channelSetOfStoredOutput(output2) {
133597
133613
  if (!output2) return [];
133598
- try {
133599
- return channelSetOfDescriptor(JSON.parse(output2));
133600
- } catch {
133601
- return [];
133602
- }
133614
+ const rSet = exception2Result(() => channelSetOfDescriptor(JSON.parse(output2)));
133615
+ return rSet.isOk() ? rSet.Ok() : [];
133603
133616
  }
133604
133617
  __name(channelSetOfStoredOutput, "channelSetOfStoredOutput");
133605
133618
  async function lockFeedPartitionInTransaction(exec, p3) {
@@ -133654,21 +133667,17 @@ async function emitChannelChangeFeed(p3) {
133654
133667
  }
133655
133668
  __name(emitChannelChangeFeed, "emitChannelChangeFeed");
133656
133669
  async function bestEffortChannelChange(p3) {
133657
- try {
133658
- return await emitChannelChangeFeed(p3);
133659
- } catch (err) {
133660
- console.warn(`sync feed append (put/evict) failed for ${p3.ownerHandle}/${p3.appSlug}/${p3.dbName}/${p3.docId}:`, err);
133661
- return void 0;
133662
- }
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;
133663
133674
  }
133664
133675
  __name(bestEffortChannelChange, "bestEffortChannelChange");
133665
133676
  async function bestEffortAppendDelete(p3) {
133666
- try {
133667
- return await appendFeedEntry({ ...p3, kind: "delete" });
133668
- } catch (err) {
133669
- console.warn(`sync feed append (delete) failed for ${p3.ownerHandle}/${p3.appSlug}/${p3.dbName}/${p3.docId}:`, err);
133670
- return void 0;
133671
- }
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;
133672
133681
  }
133673
133682
  __name(bestEffortAppendDelete, "bestEffortAppendDelete");
133674
133683
 
@@ -133820,7 +133829,7 @@ init_esm();
133820
133829
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
133821
133830
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
133822
133831
  init_performance2();
133823
- var AGENT_SESSION_INSTRUCTION_VERSION = "2026-11-22.2";
133832
+ var AGENT_SESSION_INSTRUCTION_VERSION = "2026-11-23.2";
133824
133833
  var BROWSER_APP_ASK_LINE = 'When the ask names a desktop program, a phone app or software to install (an iPhone, iPad or Android app, or a mobile app, is a phone app), the app is made as one that opens from its own link, and those words say so in a clause: "Making your <app> as an app that opens in your browser", or for a phone app "Making your <app> as an app that opens on your phone from its own link".';
133825
133834
  var FIRST_BUILD_SAYS_WHAT_IS_MADE = `On a first build, the words before create_vibe say what will be made in the person's terms, and a control they mention is one the brief asks for. ${BROWSER_APP_ASK_LINE}`;
133826
133835
  var REPLY_FOLD = `A reply that runs past about three short sentences, as one often does after tool calls or a build, opens with a summary of one or two plain sentences that stands on its own: what happened, and the one link or question that matters most. Then comes a line holding only ${AGENT_FOLD_MARKER}, then the full reply, shaped by every rule here. The summary is what a phone receives as a text message, and the web page shows the full reply under a More button, so the summary carries that link or question itself. A reply of three short sentences or fewer is its own summary and goes out whole, just as it is. Words written before a tool call go out as their own text the moment the call starts, so keep them to one short sentence of what you are about to do; the result comes in the reply after.`;
@@ -134423,9 +134432,6 @@ __name(stampEveryKnownWriter, "stampEveryKnownWriter");
134423
134432
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
134424
134433
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
134425
134434
  init_performance2();
134426
- var SECRET_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]{0,63}$/;
134427
- var SECRET_VALUE_MAX = 8192;
134428
- var SECRET_COUNT_MAX = 32;
134429
134435
  var SECRET_LAST4_MIN = 8;
134430
134436
  function secretMeta(e2) {
134431
134437
  return {
@@ -134503,7 +134509,7 @@ async function applySecretOp({
134503
134509
  setBy
134504
134510
  }) {
134505
134511
  if (OTHER_OP_FIELDS.some((f3) => f3 in req)) {
134506
- return [buildEnsureEntryResult(settings), "secret-op-not-exclusive"];
134512
+ return [buildEnsureEntryResult(settings), SECRET_REFUSAL.exclusive];
134507
134513
  }
134508
134514
  if (isReqEnsureAppSettingsSecretRemove(req)) {
134509
134515
  const key2 = req.secretRemove.key;
@@ -134511,17 +134517,14 @@ async function applySecretOp({
134511
134517
  }
134512
134518
  const { key, value: value2 } = req.secretSet;
134513
134519
  if (!SECRET_KEY_RE.test(key)) {
134514
- return [
134515
- buildEnsureEntryResult(settings),
134516
- `secret key must match [A-Za-z_][A-Za-z0-9_]* (max 64 chars), got ${JSON.stringify(key)}`
134517
- ];
134520
+ return [buildEnsureEntryResult(settings), SECRET_REFUSAL.key];
134518
134521
  }
134519
134522
  if (value2.length > SECRET_VALUE_MAX) {
134520
- return [buildEnsureEntryResult(settings), `secret value exceeds ${SECRET_VALUE_MAX} bytes`];
134523
+ return [buildEnsureEntryResult(settings), SECRET_REFUSAL.size];
134521
134524
  }
134522
134525
  const existingKeys = new Set(settings.filter((e2) => isActiveSecret(e2)).map((e2) => e2.key));
134523
134526
  if (!existingKeys.has(key) && existingKeys.size >= SECRET_COUNT_MAX) {
134524
- return [buildEnsureEntryResult(settings), `secret cap reached (${SECRET_COUNT_MAX} per vibe)`];
134527
+ return [buildEnsureEntryResult(settings), SECRET_REFUSAL.cap];
134525
134528
  }
134526
134529
  return await sqlUpsert({
134527
134530
  vctx,
@@ -134932,7 +134935,7 @@ async function ensureAppSettings(vctx, req, userId, opts) {
134932
134935
  ledger: record2?.AppSlugBindings.ledger ?? req.appSlug,
134933
134936
  ownerHandle: req.ownerHandle,
134934
134937
  tenant: record2?.UserSlugBindings.tenant ?? req.ownerHandle,
134935
- error: "owner-only:secret-op",
134938
+ error: SECRET_REFUSAL.owner,
134936
134939
  settings: buildEnsureEntryResult([]),
134937
134940
  updated: now2,
134938
134941
  created: now2
@@ -136295,6 +136298,7 @@ init_esm();
136295
136298
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
136296
136299
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
136297
136300
  init_performance2();
136301
+ init_esm();
136298
136302
 
136299
136303
  // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/agent-stop-note.ts
136300
136304
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
@@ -151397,6 +151401,7 @@ init_performance2();
151397
151401
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
151398
151402
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
151399
151403
  init_performance2();
151404
+ init_esm();
151400
151405
  var cache3 = /* @__PURE__ */ new Map();
151401
151406
  var invalidatedAt = /* @__PURE__ */ new Map();
151402
151407
  var refreshing = /* @__PURE__ */ new Set();
@@ -151504,10 +151509,8 @@ function estimateGenerationBytes(outputRows, liveDocs) {
151504
151509
  for (let i3 = 0; i3 < samples; i3++) {
151505
151510
  const doc = liveDocs[Math.min(liveDocs.length - 1, Math.floor(i3 * stride))];
151506
151511
  if (doc === void 0) continue;
151507
- try {
151508
- sampledBytes += JSON.stringify(doc.doc).length;
151509
- } catch {
151510
- }
151512
+ const rBytes = exception2Result(() => JSON.stringify(doc.doc).length);
151513
+ if (rBytes.isOk()) sampledBytes += rBytes.Ok();
151511
151514
  sampled += 1;
151512
151515
  }
151513
151516
  if (sampled === 0) return bytes;
@@ -151931,6 +151934,7 @@ __name(emitBackendOnChange, "emitBackendOnChange");
151931
151934
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
151932
151935
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
151933
151936
  init_performance2();
151937
+ init_esm();
151934
151938
 
151935
151939
  // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/public/access-function.ts
151936
151940
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
@@ -152117,9 +152121,9 @@ async function runPutAccessGate(vctx, input3) {
152117
152121
  if ("forbidden" in invokeResult) {
152118
152122
  return { kind: "deny", code: "access-denied", message: invokeResult.forbidden, fnRefusal: true };
152119
152123
  }
152120
- try {
152121
- enforceAllowAnonymous(invokeResult, input3.userContext);
152122
- } catch (err) {
152124
+ const rAnonymous = exception2Result(() => enforceAllowAnonymous(invokeResult, input3.userContext));
152125
+ if (rAnonymous.isErr()) {
152126
+ const err = rAnonymous.Err();
152123
152127
  const reason = err instanceof ForbiddenError ? err.forbidden : String(err);
152124
152128
  return { kind: "deny", code: "access-denied", message: reason };
152125
152129
  }
@@ -153574,12 +153578,9 @@ function validateSchema(raw) {
153574
153578
  if (properties === null || typeof properties !== "object" || Array.isArray(properties) || Object.keys(properties).length === 0) {
153575
153579
  return { ok: false, error: "ctx.callAI schema must be an object with a non-empty properties map" };
153576
153580
  }
153577
- let serialized;
153578
- try {
153579
- serialized = JSON.stringify(raw);
153580
- } catch {
153581
- return { ok: false, error: "ctx.callAI schema is not serializable" };
153582
- }
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();
153583
153584
  if (serialized.length > MAX_SCHEMA_CHARS) {
153584
153585
  return { ok: false, error: `ctx.callAI schema too large (max ${MAX_SCHEMA_CHARS} chars)` };
153585
153586
  }
@@ -153660,29 +153661,22 @@ function makeBackendAiCallback(vctx, base2) {
153660
153661
  messages: [{ role: "user", content: [{ type: "text", text: op.prompt }] }],
153661
153662
  ...schemaFields
153662
153663
  };
153663
- let res;
153664
- try {
153665
- res = await vctx.llmRequest({ ...req, headers: vctx.params.llm.headers }, { signal: AbortSignal.timeout(AI_TIMEOUT_MS) });
153666
- } catch {
153667
- return { ok: false, error: "ctx.callAI: ai gateway unreachable" };
153668
- }
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();
153669
153669
  if (!res.ok) {
153670
153670
  await res.body?.cancel().catch(() => void 0);
153671
153671
  return { ok: false, error: `ctx.callAI: ai gateway error (status ${res.status})` };
153672
153672
  }
153673
- let body;
153674
- try {
153675
- body = await res.json();
153676
- } catch {
153677
- return { ok: false, error: "ctx.callAI: ai gateway returned malformed JSON" };
153678
- }
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();
153679
153676
  const json5 = body;
153680
- let text3;
153681
- try {
153682
- text3 = extractContent(body, strategy);
153683
- } catch {
153684
- return { ok: false, error: "ctx.callAI: ai gateway returned no completion" };
153685
- }
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();
153686
153680
  if (text3.length === 0) {
153687
153681
  return { ok: false, error: "ctx.callAI: ai gateway returned no completion" };
153688
153682
  }
@@ -156518,12 +156512,9 @@ function normalizeGithubUrl(path) {
156518
156512
  if (path.startsWith("/") === false) return void 0;
156519
156513
  if (path.startsWith("//")) return void 0;
156520
156514
  if (path.includes("\\")) return void 0;
156521
- let u3;
156522
- try {
156523
- u3 = new URL(path, GITHUB_API2);
156524
- } catch {
156525
- return void 0;
156526
- }
156515
+ const rU = exception2Result(() => new URL(path, GITHUB_API2));
156516
+ if (rU.isErr()) return void 0;
156517
+ const u3 = rU.Ok();
156527
156518
  if (u3.origin !== GITHUB_ORIGIN) return void 0;
156528
156519
  return u3;
156529
156520
  }
@@ -156954,12 +156945,9 @@ function answer(status, payload) {
156954
156945
  __name(answer, "answer");
156955
156946
  function publicImageUrl(raw) {
156956
156947
  if (typeof raw !== "string" || raw === "") return void 0;
156957
- let u3;
156958
- try {
156959
- u3 = new URL(raw);
156960
- } catch {
156961
- return void 0;
156962
- }
156948
+ const rU = exception2Result(() => new URL(raw));
156949
+ if (rU.isErr()) return void 0;
156950
+ const u3 = rU.Ok();
156963
156951
  if (u3.protocol !== "https:") return void 0;
156964
156952
  if (u3.username !== "" || u3.password !== "") return void 0;
156965
156953
  if (u3.port !== "") return void 0;
@@ -156974,12 +156962,9 @@ function publicImageUrl(raw) {
156974
156962
  __name(publicImageUrl, "publicImageUrl");
156975
156963
  function linkedinUploadUrl(raw) {
156976
156964
  if (typeof raw !== "string") return void 0;
156977
- let u3;
156978
- try {
156979
- u3 = new URL(raw);
156980
- } catch {
156981
- return void 0;
156982
- }
156965
+ const rU = exception2Result(() => new URL(raw));
156966
+ if (rU.isErr()) return void 0;
156967
+ const u3 = rU.Ok();
156983
156968
  if (u3.protocol !== "https:" || u3.hostname !== "www.linkedin.com" || u3.port !== "") return void 0;
156984
156969
  if (u3.pathname.startsWith("/dms-uploads/") === false) return void 0;
156985
156970
  return u3;
@@ -157042,11 +157027,8 @@ async function fetchPublicImage(fetchImpl, first) {
157042
157027
  __name(fetchPublicImage, "fetchPublicImage");
157043
157028
  function resolveLocation(location, base2) {
157044
157029
  if (location === null || location === "") return void 0;
157045
- try {
157046
- return new URL(location, base2).toString();
157047
- } catch {
157048
- return void 0;
157049
- }
157030
+ const rLocation = exception2Result(() => new URL(location, base2).toString());
157031
+ return rLocation.isOk() ? rLocation.Ok() : void 0;
157050
157032
  }
157051
157033
  __name(resolveLocation, "resolveLocation");
157052
157034
  var PERSON_URN = /^urn:li:person:[A-Za-z0-9_-]+$/;
@@ -157133,6 +157115,7 @@ __name(hostActionFor, "hostActionFor");
157133
157115
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
157134
157116
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
157135
157117
  init_performance2();
157118
+ init_esm();
157136
157119
  var DRIVE_FILE_ID = "[A-Za-z0-9_-]{1,256}";
157137
157120
  var DRIVE_FILE_PATH = new RegExp(`^/drive/v3/files/(${DRIVE_FILE_ID})$`);
157138
157121
  var DRIVE_FILE_EXPORT_PATH = new RegExp(`^/drive/v3/files/(${DRIVE_FILE_ID})/export$`);
@@ -157216,12 +157199,9 @@ var DRIVE_TEXT_EXPORTS = /* @__PURE__ */ new Set([
157216
157199
  ]);
157217
157200
  function parseObject2(json5) {
157218
157201
  if (json5.trim() === "") return {};
157219
- let v3;
157220
- try {
157221
- v3 = JSON.parse(json5);
157222
- } catch {
157223
- return void 0;
157224
- }
157202
+ const rV = exception2Result(() => JSON.parse(json5));
157203
+ if (rV.isErr()) return void 0;
157204
+ const v3 = rV.Ok();
157225
157205
  if (v3 === null || typeof v3 !== "object" || Array.isArray(v3)) return void 0;
157226
157206
  return v3;
157227
157207
  }
@@ -158232,18 +158212,12 @@ function normalizeProviderUrl(provider, path) {
158232
158212
  if (path.startsWith("/") === false) return void 0;
158233
158213
  if (path.startsWith("//")) return void 0;
158234
158214
  if (path.includes("\\")) return void 0;
158235
- let u3;
158236
- try {
158237
- u3 = new URL(path, provider.apiOrigin);
158238
- } catch {
158239
- return void 0;
158240
- }
158241
- let origin;
158242
- try {
158243
- origin = new URL(provider.apiOrigin).origin;
158244
- } catch {
158245
- return void 0;
158246
- }
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();
158247
158221
  if (u3.origin !== origin) return void 0;
158248
158222
  return u3;
158249
158223
  }
@@ -159537,12 +159511,9 @@ __name(youtubeKey, "youtubeKey");
159537
159511
  function resolveYoutubeTarget(pathOrUrl) {
159538
159512
  let path;
159539
159513
  if (/^https?:\/\//i.test(pathOrUrl)) {
159540
- let u3;
159541
- try {
159542
- u3 = new URL(pathOrUrl);
159543
- } catch {
159544
- return { ok: false, reason: "invalid_path" };
159545
- }
159514
+ const rU = exception2Result(() => new URL(pathOrUrl));
159515
+ if (rU.isErr()) return { ok: false, reason: "invalid_path" };
159516
+ const u3 = rU.Ok();
159546
159517
  if (u3.protocol !== "https:" || YOUTUBE_API_HOSTS.has(u3.hostname) === false) return { ok: false, reason: "invalid_path" };
159547
159518
  if (u3.port !== "" || u3.username !== "" || u3.password !== "") return { ok: false, reason: "invalid_path" };
159548
159519
  path = `${u3.pathname}${u3.search}`;
@@ -163360,6 +163331,7 @@ var EgressRateWindow = class {
163360
163331
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
163361
163332
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
163362
163333
  init_performance2();
163334
+ init_esm();
163363
163335
  var READ_CACHE_DEFAULT_TTL_MS = 3e5;
163364
163336
  var READ_CACHE_MIN_TTL_MS = 6e4;
163365
163337
  var READ_CACHE_MAX_TTL_MS = 36e5;
@@ -163532,12 +163504,9 @@ var EgressReadCache = class {
163532
163504
  }
163533
163505
  };
163534
163506
  function signatureFromNames(storedSignature, requestHeaders) {
163535
- let names;
163536
- try {
163537
- names = JSON.parse(storedSignature);
163538
- } catch {
163539
- return "";
163540
- }
163507
+ const rNames = exception2Result(() => JSON.parse(storedSignature));
163508
+ if (rNames.isErr()) return "";
163509
+ const names = rNames.Ok();
163541
163510
  return JSON.stringify(names.map(([n2]) => [n2, requestHeaders.get(n2)]));
163542
163511
  }
163543
163512
  __name(signatureFromNames, "signatureFromNames");
@@ -163696,12 +163665,9 @@ async function attemptBackendEgress(input3) {
163696
163665
  const runtimeInput = { ...input3, signal };
163697
163666
  const fetcher = input3.fetcher ?? ((req) => fetch(req));
163698
163667
  const now2 = input3.now ?? (() => Date.now());
163699
- let url3;
163700
- try {
163701
- url3 = new URL(input3.request.url);
163702
- } catch {
163703
- return egressDenial("floor", "");
163704
- }
163668
+ const rUrl = exception2Result(() => new URL(input3.request.url));
163669
+ if (rUrl.isErr()) return egressDenial("floor", "");
163670
+ const url3 = rUrl.Ok();
163705
163671
  const method = input3.request.method.toUpperCase();
163706
163672
  if (!floorAdmits(url3, method)) return egressDenial("floor", url3.hostname);
163707
163673
  if (input3.ownerStatus === "blocked") return egressDenial("owner-blocked", url3.hostname);
@@ -163742,12 +163708,9 @@ async function attemptBackendEgress(input3) {
163742
163708
  preflight.headers.set("access-control-request-method", method);
163743
163709
  if (requested.length > 0) preflight.headers.set("access-control-request-headers", requested.join(", "));
163744
163710
  preflight.headers.set("user-agent", egressUserAgent(input3));
163745
- let pfRes;
163746
- try {
163747
- pfRes = await fetcher(preflight);
163748
- } catch {
163749
- return egressDenial("cors", url3.hostname);
163750
- }
163711
+ const rPfRes = await exception2Result(() => fetcher(preflight));
163712
+ if (rPfRes.isErr()) return egressDenial("cors", url3.hostname);
163713
+ const pfRes = rPfRes.Ok();
163751
163714
  admitted = pfRes.status < 300 || pfRes.status >= 400 ? preflightAdmits({ res: pfRes, vibeOrigin: input3.vibeOrigin, method, requestedHeaders: requested }) : false;
163752
163715
  await pfRes.body?.cancel().catch(() => void 0);
163753
163716
  input3.corsCache.set({ key, ok: admitted, maxAgeSeconds: preflightMaxAgeSeconds(pfRes), now: now2() });
@@ -163880,13 +163843,14 @@ async function forward({ input: input3, fetcher, url: url3, headers, revalidate,
163880
163843
  duplex: "half",
163881
163844
  signal: input3.signal
163882
163845
  });
163883
- try {
163884
- res = await fetcher(outbound);
163885
- } catch (e2) {
163846
+ const rRes = await exception2Result(() => fetcher(outbound));
163847
+ if (rRes.isErr()) {
163848
+ const e2 = rRes.Err();
163886
163849
  const res2 = syntheticEgressError(target.hostname, String(e2?.message ?? e2));
163887
163850
  finalUrls.set(res2, target.toString());
163888
163851
  return { kind: "synthetic", res: res2, transmitted: true };
163889
163852
  }
163853
+ res = rRes.Ok();
163890
163854
  const location = REDIRECT_STATUSES3.has(res.status) ? res.headers.get("location") : null;
163891
163855
  if (!location) break;
163892
163856
  if (hop >= MAX_REDIRECTS2) {
@@ -163895,12 +163859,9 @@ async function forward({ input: input3, fetcher, url: url3, headers, revalidate,
163895
163859
  finalUrls.set(tooMany, target.toString());
163896
163860
  return { kind: "synthetic", res: tooMany, transmitted: true };
163897
163861
  }
163898
- let next3;
163899
- try {
163900
- next3 = new URL(location, target);
163901
- } catch {
163902
- break;
163903
- }
163862
+ const rNext = exception2Result(() => new URL(location, target));
163863
+ if (rNext.isErr()) break;
163864
+ const next3 = rNext.Ok();
163904
163865
  await res.body?.cancel().catch(() => void 0);
163905
163866
  const rewriteToGet = (res.status === 301 || res.status === 302) && method === "POST" || res.status === 303 && method !== "GET" && method !== "HEAD";
163906
163867
  const nextMethod = rewriteToGet ? "GET" : method;
@@ -337,6 +337,7 @@
337
337
  "vibes.diy/api/types/app-clip.ts",
338
338
  "vibes.diy/api/types/app-documents.ts",
339
339
  "vibes.diy/api/types/app-name.ts",
340
+ "vibes.diy/api/types/app-secret-rules.ts",
340
341
  "vibes.diy/api/types/app-speech.ts",
341
342
  "vibes.diy/api/types/app.ts",
342
343
  "vibes.diy/api/types/asset-extensions.ts",
@@ -2174,6 +2175,7 @@
2174
2175
  "vibes.diy/api/svc/intern/agent-notifications.ts",
2175
2176
  "vibes.diy/api/svc/intern/agent-own-vibe-tools.ts",
2176
2177
  "vibes.diy/api/svc/intern/agent-pane-app.ts",
2178
+ "vibes.diy/api/svc/intern/agent-picture-file-tool.ts",
2177
2179
  "vibes.diy/api/svc/intern/agent-picture-links.ts",
2178
2180
  "vibes.diy/api/svc/intern/agent-reaction-classifier.ts",
2179
2181
  "vibes.diy/api/svc/intern/agent-read-tools.ts",
@@ -2773,6 +2775,7 @@
2773
2775
  "vibes.diy/api/types/app-clip.ts",
2774
2776
  "vibes.diy/api/types/app-documents.ts",
2775
2777
  "vibes.diy/api/types/app-name.ts",
2778
+ "vibes.diy/api/types/app-secret-rules.ts",
2776
2779
  "vibes.diy/api/types/app-speech.ts",
2777
2780
  "vibes.diy/api/types/app.ts",
2778
2781
  "vibes.diy/api/types/asset-extensions.ts",