vibes-diy 14.3.461 → 14.3.463
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.
|
@@ -562,7 +562,7 @@ var init_write_stream = __esm({
|
|
|
562
562
|
getColorDepth(env3) {
|
|
563
563
|
return 1;
|
|
564
564
|
}
|
|
565
|
-
hasColors(
|
|
565
|
+
hasColors(count4, env3) {
|
|
566
566
|
return false;
|
|
567
567
|
}
|
|
568
568
|
getWindowSize() {
|
|
@@ -1691,8 +1691,8 @@ var init_Node = __esm({
|
|
|
1691
1691
|
};
|
|
1692
1692
|
const res = toJS(this, "", ctx);
|
|
1693
1693
|
if (typeof onAnchor === "function")
|
|
1694
|
-
for (const { count:
|
|
1695
|
-
onAnchor(res2,
|
|
1694
|
+
for (const { count: count4, res: res2 } of ctx.anchors.values())
|
|
1695
|
+
onAnchor(res2, count4);
|
|
1696
1696
|
return typeof reviver === "function" ? applyReviver(reviver, { "": res }, "", res) : res;
|
|
1697
1697
|
}
|
|
1698
1698
|
};
|
|
@@ -1706,13 +1706,13 @@ function getAliasCount(doc, node3, anchors) {
|
|
|
1706
1706
|
const anchor2 = anchors && source && anchors.get(source);
|
|
1707
1707
|
return anchor2 ? anchor2.count * anchor2.aliasCount : 0;
|
|
1708
1708
|
} else if (isCollection(node3)) {
|
|
1709
|
-
let
|
|
1709
|
+
let count4 = 0;
|
|
1710
1710
|
for (const item of node3.items) {
|
|
1711
1711
|
const c2 = getAliasCount(doc, item, anchors);
|
|
1712
|
-
if (c2 >
|
|
1713
|
-
|
|
1712
|
+
if (c2 > count4)
|
|
1713
|
+
count4 = c2;
|
|
1714
1714
|
}
|
|
1715
|
-
return
|
|
1715
|
+
return count4;
|
|
1716
1716
|
} else if (isPair(node3)) {
|
|
1717
1717
|
const kc = getAliasCount(doc, node3.key, anchors);
|
|
1718
1718
|
const vc = getAliasCount(doc, node3.value, anchors);
|
|
@@ -4864,8 +4864,8 @@ var init_Document = __esm({
|
|
|
4864
4864
|
};
|
|
4865
4865
|
const res = toJS(this.contents, jsonArg ?? "", ctx);
|
|
4866
4866
|
if (typeof onAnchor === "function")
|
|
4867
|
-
for (const { count:
|
|
4868
|
-
onAnchor(res2,
|
|
4867
|
+
for (const { count: count4, res: res2 } of ctx.anchors.values())
|
|
4868
|
+
onAnchor(res2, count4);
|
|
4869
4869
|
return typeof reviver === "function" ? applyReviver(reviver, { "": res }, "", res) : res;
|
|
4870
4870
|
}
|
|
4871
4871
|
/**
|
|
@@ -4949,12 +4949,12 @@ var init_errors = __esm({
|
|
|
4949
4949
|
lineStr = prev + lineStr;
|
|
4950
4950
|
}
|
|
4951
4951
|
if (/[^ ]/.test(lineStr)) {
|
|
4952
|
-
let
|
|
4952
|
+
let count4 = 1;
|
|
4953
4953
|
const end = error64.linePos[1];
|
|
4954
4954
|
if (end?.line === line2 && end.col > col) {
|
|
4955
|
-
|
|
4955
|
+
count4 = Math.max(1, Math.min(end.col - col, 80 - ci2));
|
|
4956
4956
|
}
|
|
4957
|
-
const pointer = " ".repeat(ci2) + "^".repeat(
|
|
4957
|
+
const pointer = " ".repeat(ci2) + "^".repeat(count4);
|
|
4958
4958
|
error64.message += `:
|
|
4959
4959
|
|
|
4960
4960
|
${lineStr}
|
|
@@ -10507,9 +10507,9 @@ function splitPath(path) {
|
|
|
10507
10507
|
if (path === "") {
|
|
10508
10508
|
return p3;
|
|
10509
10509
|
}
|
|
10510
|
-
for (let
|
|
10510
|
+
for (let count4 = 0; path.length; count4++) {
|
|
10511
10511
|
if (path.match(/^\/+/)) {
|
|
10512
|
-
if (
|
|
10512
|
+
if (count4 === 0) {
|
|
10513
10513
|
p3.add(PartType.Root);
|
|
10514
10514
|
} else {
|
|
10515
10515
|
p3.add(PartType.Slash);
|
|
@@ -15429,8 +15429,8 @@ var init_scanner = __esm({
|
|
|
15429
15429
|
jumpToIndex(i3) {
|
|
15430
15430
|
this.i = i3 < 0 ? this.length + i3 : i3;
|
|
15431
15431
|
}
|
|
15432
|
-
jumpForward(
|
|
15433
|
-
this.i +=
|
|
15432
|
+
jumpForward(count4) {
|
|
15433
|
+
this.i += count4;
|
|
15434
15434
|
}
|
|
15435
15435
|
get location() {
|
|
15436
15436
|
return this.i;
|
|
@@ -23038,8 +23038,8 @@ var init_dynamic = __esm({
|
|
|
23038
23038
|
previousOperator() {
|
|
23039
23039
|
return this.branches.leftBound?.comparator ?? this.branches.prefixes[this.branches.prefixes.length - 1] ?? (this.branches.intersection ? "&" : this.branches.union ? "|" : this.branches.pipe ? "|>" : void 0);
|
|
23040
23040
|
}
|
|
23041
|
-
shiftedBy(
|
|
23042
|
-
this.scanner.jumpForward(
|
|
23041
|
+
shiftedBy(count4) {
|
|
23042
|
+
this.scanner.jumpForward(count4);
|
|
23043
23043
|
return this;
|
|
23044
23044
|
}
|
|
23045
23045
|
};
|
|
@@ -41322,14 +41322,14 @@ function codePointLength(str3) {
|
|
|
41322
41322
|
const units = str3.length;
|
|
41323
41323
|
if (!highSurrogate.test(str3))
|
|
41324
41324
|
return units;
|
|
41325
|
-
let
|
|
41325
|
+
let count4 = units;
|
|
41326
41326
|
for (let i3 = 0; i3 < units - 1; i3++) {
|
|
41327
41327
|
if ((str3.charCodeAt(i3) & 64512) === 55296 && (str3.charCodeAt(i3 + 1) & 64512) === 56320) {
|
|
41328
|
-
|
|
41328
|
+
count4--;
|
|
41329
41329
|
i3++;
|
|
41330
41330
|
}
|
|
41331
41331
|
}
|
|
41332
|
-
return
|
|
41332
|
+
return count4;
|
|
41333
41333
|
}
|
|
41334
41334
|
function getLengthableOrigin(input3) {
|
|
41335
41335
|
if (Array.isArray(input3))
|
|
@@ -46035,8 +46035,8 @@ var init_az = __esm({
|
|
|
46035
46035
|
});
|
|
46036
46036
|
|
|
46037
46037
|
// ../../home/runner/work/vibes.diy/vibes.diy/node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/be.js
|
|
46038
|
-
function getBelarusianPlural(
|
|
46039
|
-
const absCount = Math.abs(
|
|
46038
|
+
function getBelarusianPlural(count4, one, few, many) {
|
|
46039
|
+
const absCount = Math.abs(count4);
|
|
46040
46040
|
const lastDigit = absCount % 10;
|
|
46041
46041
|
const lastTwoDigits = absCount % 100;
|
|
46042
46042
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -48915,8 +48915,8 @@ var init_hu = __esm({
|
|
|
48915
48915
|
});
|
|
48916
48916
|
|
|
48917
48917
|
// ../../home/runner/work/vibes.diy/vibes.diy/node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/hy.js
|
|
48918
|
-
function getArmenianPlural(
|
|
48919
|
-
return Math.abs(
|
|
48918
|
+
function getArmenianPlural(count4, one, many) {
|
|
48919
|
+
return Math.abs(count4) === 1 ? one : many;
|
|
48920
48920
|
}
|
|
48921
48921
|
function withDefiniteArticle(word) {
|
|
48922
48922
|
if (!word)
|
|
@@ -51910,8 +51910,8 @@ var init_ro = __esm({
|
|
|
51910
51910
|
});
|
|
51911
51911
|
|
|
51912
51912
|
// ../../home/runner/work/vibes.diy/vibes.diy/node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ru.js
|
|
51913
|
-
function getRussianPlural(
|
|
51914
|
-
const absCount = Math.abs(
|
|
51913
|
+
function getRussianPlural(count4, one, few, many) {
|
|
51914
|
+
const absCount = Math.abs(count4);
|
|
51915
51915
|
const lastDigit = absCount % 10;
|
|
51916
51916
|
const lastTwoDigits = absCount % 100;
|
|
51917
51917
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -89786,9 +89786,9 @@ var require_seedrandom = __commonJS({
|
|
|
89786
89786
|
s2[i3] = s2[j3 = mask & j3 + key[i3 % keylen] + (t3 = s2[i3])];
|
|
89787
89787
|
s2[j3] = t3;
|
|
89788
89788
|
}
|
|
89789
|
-
(me2.g = function(
|
|
89789
|
+
(me2.g = function(count4) {
|
|
89790
89790
|
var t4, r2 = 0, i4 = me2.i, j4 = me2.j, s3 = me2.S;
|
|
89791
|
-
while (
|
|
89791
|
+
while (count4--) {
|
|
89792
89792
|
t4 = s3[i4 = mask & i4 + 1];
|
|
89793
89793
|
r2 = r2 * width + s3[mask & (s3[i4] = s3[j4 = mask & j4 + t4]) + (s3[j4] = t4)];
|
|
89794
89794
|
}
|
|
@@ -100640,7 +100640,7 @@ var init_parse_backend_config = __esm({
|
|
|
100640
100640
|
subject: "config.github",
|
|
100641
100641
|
shadowable: ["github", "bind", "why", "permissions"]
|
|
100642
100642
|
};
|
|
100643
|
-
duplicateKeyError = /* @__PURE__ */ __name(({ lane, where, key, count:
|
|
100643
|
+
duplicateKeyError = /* @__PURE__ */ __name(({ lane, where, key, count: count4 }) => `${lane.subject} is ambiguous: ${where} declares a duplicate \`${key}\` key (${count4} times) \u2014 JavaScript keeps only the LAST one, so the declaration in the source is not the declaration that runs. Remove the extra \`${key}\` key(s) so exactly one remains, then push again`, "duplicateKeyError");
|
|
100644
100644
|
ambiguousKeyError = /* @__PURE__ */ __name((lane, where) => `${lane.subject} is ambiguous: ${where} has a property key this push-time parser cannot read statically \u2014 a computed \`[key]\`, a spread, an accessor/generator, or a quoted name with escapes. Any of those could shadow ${lane.shadowable.map((k2) => `\`${k2}\``).join("/")}, so write those keys literally (bare or plainly quoted) alongside no unreadable siblings, then push again`, "ambiguousKeyError");
|
|
100645
100645
|
__name(readableTopLevelKeys, "readableTopLevelKeys");
|
|
100646
100646
|
__name(extractFetchUnfilteredReads, "extractFetchUnfilteredReads");
|
|
@@ -118805,7 +118805,7 @@ function formatJSXStringValueLiteral(text3) {
|
|
|
118805
118805
|
}
|
|
118806
118806
|
function processEntity(text3, indexAfterAmpersand) {
|
|
118807
118807
|
let str3 = "";
|
|
118808
|
-
let
|
|
118808
|
+
let count4 = 0;
|
|
118809
118809
|
let entity;
|
|
118810
118810
|
let i3 = indexAfterAmpersand;
|
|
118811
118811
|
if (text3[i3] === "#") {
|
|
@@ -118833,7 +118833,7 @@ function processEntity(text3, indexAfterAmpersand) {
|
|
|
118833
118833
|
}
|
|
118834
118834
|
}
|
|
118835
118835
|
} else {
|
|
118836
|
-
while (i3 < text3.length &&
|
|
118836
|
+
while (i3 < text3.length && count4++ < 10) {
|
|
118837
118837
|
const ch = text3[i3];
|
|
118838
118838
|
i3++;
|
|
118839
118839
|
if (ch === ";") {
|
|
@@ -151057,11 +151057,11 @@ var init_acorn = __esm({
|
|
|
151057
151057
|
return result;
|
|
151058
151058
|
};
|
|
151059
151059
|
pp$1.regexp_classString = function(state2) {
|
|
151060
|
-
var
|
|
151060
|
+
var count4 = 0;
|
|
151061
151061
|
while (this.regexp_eatClassSetCharacter(state2)) {
|
|
151062
|
-
|
|
151062
|
+
count4++;
|
|
151063
151063
|
}
|
|
151064
|
-
return
|
|
151064
|
+
return count4 === 1 ? CharSetOk : CharSetString;
|
|
151065
151065
|
};
|
|
151066
151066
|
pp$1.regexp_eatClassSetCharacter = function(state2) {
|
|
151067
151067
|
var start = state2.pos;
|
|
@@ -156503,6 +156503,8 @@ function buildBackendWorkerCode(input3) {
|
|
|
156503
156503
|
BACKEND_NOTIFY_SHIM,
|
|
156504
156504
|
// ctx.agent.run — the agent loop over the ai-op transport.
|
|
156505
156505
|
BACKEND_AGENT_SHIM,
|
|
156506
|
+
// ctx.webSearch — a capped, metered web search over the ai-op transport.
|
|
156507
|
+
BACKEND_WEB_SEARCH_SHIM,
|
|
156506
156508
|
// ctx.log (#4500 tranche 1, closes #4305) — the first-class diagnostic
|
|
156507
156509
|
// lane, generated from BACKEND_LOG_SHIM so its BEHAVIOR is unit-testable.
|
|
156508
156510
|
BACKEND_LOG_SHIM,
|
|
@@ -156573,6 +156575,8 @@ function buildBackendWorkerCode(input3) {
|
|
|
156573
156575
|
// ctx.agent.run: a model tool-calling loop over the vibe's own `tools`,
|
|
156574
156576
|
// each tool run under THIS ctx (the lane's acting identity), billed like callAI.
|
|
156575
156577
|
` agent: makeAgent(aiNonce, () => handlers.tools, () => ctx),`,
|
|
156578
|
+
// ctx.webSearch: titles, links and excerpts from the web, billed like callAI.
|
|
156579
|
+
` webSearch: makeWebSearch(aiNonce),`,
|
|
156576
156580
|
// ctx.notify — the vibe-callable notification primitive, billed to no one
|
|
156577
156581
|
// (it's a platform notification, not an LLM call); gated purely on
|
|
156578
156582
|
// participant membership host-side.
|
|
@@ -156793,7 +156797,7 @@ ${JSON.stringify(code2.modules)}`;
|
|
|
156793
156797
|
const digest2 = await crypto.subtle.digest("SHA-256", TxtEnDecoderSingleton().encode(payload));
|
|
156794
156798
|
return Array.from(new Uint8Array(digest2)).map((b4) => b4.toString(16).padStart(2, "0")).join("");
|
|
156795
156799
|
}
|
|
156796
|
-
var MAIN_MODULE, BACKEND_MODULE, HOOK_GUARD_MODULE, LOG_BODY_MAX_CHARS2, COMPATIBILITY_DATE, BINDING_SCHEMA_VERSION, BACKEND_QUERY_RESULT_SHIM, BACKEND_DB_OP_URL, BACKEND_AI_OP_URL, BACKEND_AGENT_SHIM, BACKEND_NOTIFY_OP_URL, BACKEND_LOG_OP_URL, BACKEND_GITHUB_OP_URL, BACKEND_CONNECTIONS_OP_URL, BACKEND_STRIPE_OP_URL, BACKEND_YOUTUBE_OP_URL, LOG_ISOLATE_DISPATCH_CAP, BACKEND_NOTIFY_SHIM, BACKEND_LOG_SHIM, BACKEND_GITHUB_SHIM, BACKEND_CONNECTIONS_SHIM, dbCallbackRegistry, aiCallbackRegistry, notifyCallbackRegistry, logCallbackRegistry, BACKEND_STRIPE_SHIM, BACKEND_YOUTUBE_SHIM, githubCallbackRegistry, connectionsCallbackRegistry, stripeCallbackRegistry, youtubeCallbackRegistry, HOOK_READ_ONLY_MESSAGE, BACKEND_HOOK_GUARD_SHIM, BACKEND_HOOK_CTX_SHIM, BACKEND_REQUEST_URL, HANDLER_THREW_HEADER, WorkerLoaderBackendExecutor;
|
|
156800
|
+
var MAIN_MODULE, BACKEND_MODULE, HOOK_GUARD_MODULE, LOG_BODY_MAX_CHARS2, COMPATIBILITY_DATE, BINDING_SCHEMA_VERSION, BACKEND_QUERY_RESULT_SHIM, BACKEND_DB_OP_URL, BACKEND_AI_OP_URL, BACKEND_AGENT_SHIM, BACKEND_NOTIFY_OP_URL, BACKEND_LOG_OP_URL, BACKEND_GITHUB_OP_URL, BACKEND_CONNECTIONS_OP_URL, BACKEND_STRIPE_OP_URL, BACKEND_YOUTUBE_OP_URL, LOG_ISOLATE_DISPATCH_CAP, BACKEND_NOTIFY_SHIM, BACKEND_LOG_SHIM, BACKEND_GITHUB_SHIM, BACKEND_CONNECTIONS_SHIM, dbCallbackRegistry, aiCallbackRegistry, notifyCallbackRegistry, logCallbackRegistry, BACKEND_STRIPE_SHIM, BACKEND_WEB_SEARCH_SHIM, BACKEND_YOUTUBE_SHIM, githubCallbackRegistry, connectionsCallbackRegistry, stripeCallbackRegistry, youtubeCallbackRegistry, HOOK_READ_ONLY_MESSAGE, BACKEND_HOOK_GUARD_SHIM, BACKEND_HOOK_CTX_SHIM, BACKEND_REQUEST_URL, HANDLER_THREW_HEADER, WorkerLoaderBackendExecutor;
|
|
156797
156801
|
var init_backend_worker_loader_executor = __esm({
|
|
156798
156802
|
"../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/vibe/runtime/backend-worker-loader-executor.ts"() {
|
|
156799
156803
|
"use strict";
|
|
@@ -156812,7 +156816,7 @@ var init_backend_worker_loader_executor = __esm({
|
|
|
156812
156816
|
HOOK_GUARD_MODULE = "hook-guard.js";
|
|
156813
156817
|
LOG_BODY_MAX_CHARS2 = 4096;
|
|
156814
156818
|
COMPATIBILITY_DATE = "2025-05-01";
|
|
156815
|
-
BINDING_SCHEMA_VERSION = "
|
|
156819
|
+
BINDING_SCHEMA_VERSION = "v19";
|
|
156816
156820
|
BACKEND_QUERY_RESULT_SHIM = [
|
|
156817
156821
|
`function toQueryResult(docs, next) {`,
|
|
156818
156822
|
` const out = Array.isArray(docs) ? docs : [];`,
|
|
@@ -157106,6 +157110,25 @@ var init_backend_worker_loader_executor = __esm({
|
|
|
157106
157110
|
` return { fetch: stripeFetch, status: stripeStatus };`,
|
|
157107
157111
|
`}`
|
|
157108
157112
|
].join("\n");
|
|
157113
|
+
BACKEND_WEB_SEARCH_SHIM = [
|
|
157114
|
+
`function makeWebSearch(aiNonce) {`,
|
|
157115
|
+
` return async function webSearch(query, opts) {`,
|
|
157116
|
+
` if (!aiNonce) throw new Error("ctx.webSearch is not available (no host ai binding wired)");`,
|
|
157117
|
+
` if (typeof query !== "string" || query.trim() === "") { const e = new Error("ctx.webSearch needs a non-empty query string"); e.reason = "invalid"; throw e; }`,
|
|
157118
|
+
` const o = opts || {};`,
|
|
157119
|
+
` const op = { query: query };`,
|
|
157120
|
+
` if (typeof o.maxResults === "number") op.maxResults = o.maxResults;`,
|
|
157121
|
+
` const r = await fetch(${JSON.stringify(BACKEND_AI_OP_URL)}, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ nonce: aiNonce, op: { prompt: query, webSearch: op } }) });`,
|
|
157122
|
+
` const out = await r.json();`,
|
|
157123
|
+
` if (!out || out.ok !== true || !out.webSearch) {`,
|
|
157124
|
+
` const e = new Error((out && out.error) || "ctx.webSearch failed");`,
|
|
157125
|
+
` if (out && typeof out.reason === "string") e.reason = out.reason;`,
|
|
157126
|
+
` throw e;`,
|
|
157127
|
+
` }`,
|
|
157128
|
+
` return { results: Array.isArray(out.webSearch.results) ? out.webSearch.results : [], summary: typeof out.webSearch.summary === "string" ? out.webSearch.summary : "" };`,
|
|
157129
|
+
` };`,
|
|
157130
|
+
`}`
|
|
157131
|
+
].join("\n");
|
|
157109
157132
|
BACKEND_YOUTUBE_SHIM = [
|
|
157110
157133
|
`function makeYoutube(youtubeNonce) {`,
|
|
157111
157134
|
` function refuse(reason) {`,
|
|
@@ -157196,6 +157219,7 @@ var init_backend_worker_loader_executor = __esm({
|
|
|
157196
157219
|
` fetch: refuse("ctx.fetch"),`,
|
|
157197
157220
|
` callAI: refuse("ctx.callAI"),`,
|
|
157198
157221
|
` agent: { run: refuse("ctx.agent") },`,
|
|
157222
|
+
` webSearch: refuse("ctx.webSearch"),`,
|
|
157199
157223
|
` notify: refuse("ctx.notify"),`,
|
|
157200
157224
|
` log: full.log,`,
|
|
157201
157225
|
` github: { fetch: refuse("ctx.github"), routes: refuse("ctx.github") },`,
|
|
@@ -157935,8 +157959,8 @@ var require_number = __commonJS({
|
|
|
157935
157959
|
return flipped;
|
|
157936
157960
|
}
|
|
157937
157961
|
__name(flip, "flip");
|
|
157938
|
-
function padStart(str3,
|
|
157939
|
-
return " ".repeat(
|
|
157962
|
+
function padStart(str3, count4) {
|
|
157963
|
+
return " ".repeat(count4 - str3.length).substr(0, count4) + str3;
|
|
157940
157964
|
}
|
|
157941
157965
|
__name(padStart, "padStart");
|
|
157942
157966
|
}
|
|
@@ -171376,6 +171400,250 @@ var init_backend_agent_step = __esm({
|
|
|
171376
171400
|
}
|
|
171377
171401
|
});
|
|
171378
171402
|
|
|
171403
|
+
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/egress-floor.ts
|
|
171404
|
+
function hostMatchesPattern(host, pattern) {
|
|
171405
|
+
const h4 = host.toLowerCase();
|
|
171406
|
+
const p3 = pattern.toLowerCase();
|
|
171407
|
+
if (p3.startsWith("*.")) {
|
|
171408
|
+
return h4.endsWith(p3.slice(1)) && h4.length > p3.length - 1;
|
|
171409
|
+
}
|
|
171410
|
+
return h4 === p3;
|
|
171411
|
+
}
|
|
171412
|
+
function isEvalFixtureUrl(url3) {
|
|
171413
|
+
if (url3.protocol !== "https:") return false;
|
|
171414
|
+
if (url3.port !== "" && url3.port !== "443") return false;
|
|
171415
|
+
if (url3.username !== "" || url3.password !== "") return false;
|
|
171416
|
+
if (url3.hostname !== "vibes.diy") return false;
|
|
171417
|
+
if (url3.search !== "") return false;
|
|
171418
|
+
const match4 = EVAL_FIXTURE_PATH_RE.exec(url3.pathname);
|
|
171419
|
+
if (match4 === null) return false;
|
|
171420
|
+
const rest = match4[1].split("/");
|
|
171421
|
+
return rest.every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
171422
|
+
}
|
|
171423
|
+
function checkEgressFloor(url3) {
|
|
171424
|
+
if (url3.protocol !== "https:") return { ok: false, reason: `scheme ${url3.protocol} denied` };
|
|
171425
|
+
if (url3.port !== "" && url3.port !== "443") return { ok: false, reason: `port ${url3.port} denied` };
|
|
171426
|
+
const host = url3.hostname;
|
|
171427
|
+
if (host.startsWith("[") || host.includes(":")) return { ok: false, reason: "IPv6 literal denied" };
|
|
171428
|
+
if (IPV4_RE.test(host)) return { ok: false, reason: "IPv4 literal denied" };
|
|
171429
|
+
if (isEvalFixtureUrl(url3)) return { ok: true, exemption: EVAL_FIXTURE_FLOOR_EXEMPTION };
|
|
171430
|
+
for (const pattern of FLOOR_DENY_PATTERNS) {
|
|
171431
|
+
if (hostMatchesPattern(host, pattern)) return { ok: false, reason: `host ${host} is floor-denied` };
|
|
171432
|
+
}
|
|
171433
|
+
return { ok: true };
|
|
171434
|
+
}
|
|
171435
|
+
var PLATFORM_HOST_PATTERNS, FLOOR_DENY_PATTERNS, IPV4_RE, EVAL_FIXTURE_FLOOR_EXEMPTION, EVAL_FIXTURE_PATH_RE;
|
|
171436
|
+
var init_egress_floor = __esm({
|
|
171437
|
+
"../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/egress-floor.ts"() {
|
|
171438
|
+
"use strict";
|
|
171439
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
171440
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
171441
|
+
init_performance2();
|
|
171442
|
+
__name(hostMatchesPattern, "hostMatchesPattern");
|
|
171443
|
+
PLATFORM_HOST_PATTERNS = [
|
|
171444
|
+
"vibes.diy",
|
|
171445
|
+
"*.vibes.diy",
|
|
171446
|
+
// good.vibes.diy and any future platform subdomain
|
|
171447
|
+
"vibesdiy.net",
|
|
171448
|
+
"*.vibesdiy.net",
|
|
171449
|
+
"vibespreview.dev",
|
|
171450
|
+
"*.vibespreview.dev"
|
|
171451
|
+
// PR preview surfaces, incl. deep labels (AC-FLOOR-01)
|
|
171452
|
+
];
|
|
171453
|
+
FLOOR_DENY_PATTERNS = [
|
|
171454
|
+
...PLATFORM_HOST_PATTERNS,
|
|
171455
|
+
"*.workers.dev",
|
|
171456
|
+
"localhost",
|
|
171457
|
+
"*.localhost",
|
|
171458
|
+
"metadata.google.internal"
|
|
171459
|
+
];
|
|
171460
|
+
IPV4_RE = /^\d{1,3}(\.\d{1,3}){3}$/;
|
|
171461
|
+
EVAL_FIXTURE_FLOOR_EXEMPTION = "eval-fixture";
|
|
171462
|
+
EVAL_FIXTURE_PATH_RE = /^\/vibe\/eval\/[a-z0-9-]+\/_api\/(.+)$/;
|
|
171463
|
+
__name(isEvalFixtureUrl, "isEvalFixtureUrl");
|
|
171464
|
+
__name(checkEgressFloor, "checkEgressFloor");
|
|
171465
|
+
}
|
|
171466
|
+
});
|
|
171467
|
+
|
|
171468
|
+
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/url-activation.ts
|
|
171469
|
+
function activateUrlCandidates(input3) {
|
|
171470
|
+
if (input3.isInitialTurn === false) return [];
|
|
171471
|
+
const candidates = [input3.currentUserText ?? "", input3.enrichedPrompt ?? ""];
|
|
171472
|
+
const seen = /* @__PURE__ */ new Set();
|
|
171473
|
+
const activated = [];
|
|
171474
|
+
for (const source of candidates) {
|
|
171475
|
+
for (const token of source.match(/https:\/\/[^\s<>"'`]+/gi) ?? []) {
|
|
171476
|
+
if (activated.length >= MAX_ACTIVATED_URLS) return activated;
|
|
171477
|
+
const normalized = normalizeCandidate(token);
|
|
171478
|
+
if (normalized !== void 0 && seen.has(normalized) === false) {
|
|
171479
|
+
seen.add(normalized);
|
|
171480
|
+
activated.push(normalized);
|
|
171481
|
+
}
|
|
171482
|
+
}
|
|
171483
|
+
}
|
|
171484
|
+
return activated;
|
|
171485
|
+
}
|
|
171486
|
+
function normalizeCandidate(token) {
|
|
171487
|
+
let candidate = token;
|
|
171488
|
+
for (; ; ) {
|
|
171489
|
+
const last = candidate.at(-1);
|
|
171490
|
+
if (last === void 0 || ".,!?;:".includes(last) === false) return parseCandidate(candidate);
|
|
171491
|
+
const withoutPunctuation = candidate.slice(0, -1);
|
|
171492
|
+
if (parseCandidate(withoutPunctuation) === void 0) return parseCandidate(candidate);
|
|
171493
|
+
candidate = withoutPunctuation;
|
|
171494
|
+
}
|
|
171495
|
+
}
|
|
171496
|
+
function parseCandidate(candidate) {
|
|
171497
|
+
if (candidate.length === 0 || candidate.length > MAX_ACTIVATED_URL_LENGTH) return void 0;
|
|
171498
|
+
const bracketTrimmed = trimUnmatchedClosingPunctuation(candidate);
|
|
171499
|
+
const parsed2 = URI.fromResult(bracketTrimmed);
|
|
171500
|
+
if (parsed2.isErr()) return void 0;
|
|
171501
|
+
const uri = parsed2.Ok();
|
|
171502
|
+
if (uri.protocol !== "https:" || uri.port !== "" && uri.port !== "443") return void 0;
|
|
171503
|
+
const url3 = uri.asURL();
|
|
171504
|
+
if (url3.username !== "" || url3.password !== "") return void 0;
|
|
171505
|
+
if (checkEgressFloor(url3).ok === false) return void 0;
|
|
171506
|
+
const builder = BuildURI.from(uri.toString()).hash("");
|
|
171507
|
+
if (uri.port === "443") builder.port("");
|
|
171508
|
+
const normalized = builder.toString();
|
|
171509
|
+
return normalized.length <= MAX_ACTIVATED_URL_LENGTH ? normalized : void 0;
|
|
171510
|
+
}
|
|
171511
|
+
function trimUnmatchedClosingPunctuation(candidate) {
|
|
171512
|
+
let result = candidate;
|
|
171513
|
+
for (; ; ) {
|
|
171514
|
+
const last = result.at(-1);
|
|
171515
|
+
if (last === ")" && count3(result, "(") < count3(result, ")")) {
|
|
171516
|
+
result = result.slice(0, -1);
|
|
171517
|
+
continue;
|
|
171518
|
+
}
|
|
171519
|
+
if (last === "]" && count3(result, "[") < count3(result, "]")) {
|
|
171520
|
+
result = result.slice(0, -1);
|
|
171521
|
+
continue;
|
|
171522
|
+
}
|
|
171523
|
+
if (last === "}" && count3(result, "{") < count3(result, "}")) {
|
|
171524
|
+
result = result.slice(0, -1);
|
|
171525
|
+
continue;
|
|
171526
|
+
}
|
|
171527
|
+
return result;
|
|
171528
|
+
}
|
|
171529
|
+
}
|
|
171530
|
+
function count3(value2, needle) {
|
|
171531
|
+
return [...value2].filter((character) => character === needle).length;
|
|
171532
|
+
}
|
|
171533
|
+
var MAX_ACTIVATED_URLS, MAX_ACTIVATED_URL_LENGTH;
|
|
171534
|
+
var init_url_activation = __esm({
|
|
171535
|
+
"../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/url-activation.ts"() {
|
|
171536
|
+
"use strict";
|
|
171537
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
171538
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
171539
|
+
init_performance2();
|
|
171540
|
+
init_esm();
|
|
171541
|
+
init_egress_floor();
|
|
171542
|
+
MAX_ACTIVATED_URLS = 3;
|
|
171543
|
+
MAX_ACTIVATED_URL_LENGTH = 2048;
|
|
171544
|
+
__name(activateUrlCandidates, "activateUrlCandidates");
|
|
171545
|
+
__name(normalizeCandidate, "normalizeCandidate");
|
|
171546
|
+
__name(parseCandidate, "parseCandidate");
|
|
171547
|
+
__name(trimUnmatchedClosingPunctuation, "trimUnmatchedClosingPunctuation");
|
|
171548
|
+
__name(count3, "count");
|
|
171549
|
+
}
|
|
171550
|
+
});
|
|
171551
|
+
|
|
171552
|
+
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/openrouter-image.ts
|
|
171553
|
+
var imageReply;
|
|
171554
|
+
var init_openrouter_image = __esm({
|
|
171555
|
+
"../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/openrouter-image.ts"() {
|
|
171556
|
+
"use strict";
|
|
171557
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
171558
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
171559
|
+
init_performance2();
|
|
171560
|
+
init_esm();
|
|
171561
|
+
init_out4();
|
|
171562
|
+
init_lazy_type();
|
|
171563
|
+
imageReply = lazyType(
|
|
171564
|
+
() => type({
|
|
171565
|
+
choices: type({
|
|
171566
|
+
message: { "images?": type({ image_url: { url: "string" } }).array() }
|
|
171567
|
+
}).array()
|
|
171568
|
+
})
|
|
171569
|
+
);
|
|
171570
|
+
}
|
|
171571
|
+
});
|
|
171572
|
+
|
|
171573
|
+
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/agent-web-search-tool.ts
|
|
171574
|
+
function webSearchRequest(query, today, maxResults = WEB_SEARCH_MAX_RESULTS) {
|
|
171575
|
+
return {
|
|
171576
|
+
model: WEB_SEARCH_MODEL,
|
|
171577
|
+
stream: false,
|
|
171578
|
+
max_tokens: 800,
|
|
171579
|
+
// Off, so all 800 tokens are answer room (#9395): a thinking model spent them all.
|
|
171580
|
+
reasoning: { effort: "none" },
|
|
171581
|
+
plugins: [{ id: "web", engine: "exa", max_results: maxResults }],
|
|
171582
|
+
messages: [
|
|
171583
|
+
{
|
|
171584
|
+
role: "system",
|
|
171585
|
+
content: [
|
|
171586
|
+
{
|
|
171587
|
+
type: "text",
|
|
171588
|
+
text: `Today is ${today}. Answer the query from the web search results only, in at most 150 words of plain sentences with no markdown. Give the specific facts (names, numbers, dates, times, places) and name the site each comes from. Say when results disagree or look out of date. If the results do not answer it, say so.`
|
|
171589
|
+
}
|
|
171590
|
+
]
|
|
171591
|
+
},
|
|
171592
|
+
{ role: "user", content: [{ type: "text", text: query }] }
|
|
171593
|
+
]
|
|
171594
|
+
};
|
|
171595
|
+
}
|
|
171596
|
+
function parseSearchReply(json5) {
|
|
171597
|
+
const choice = json5?.choices?.[0];
|
|
171598
|
+
const message2 = choice?.message;
|
|
171599
|
+
if (message2 === void 0 || typeof message2.content !== "string") return void 0;
|
|
171600
|
+
const finishReason = typeof choice?.finish_reason === "string" ? choice.finish_reason : void 0;
|
|
171601
|
+
const seen = /* @__PURE__ */ new Set();
|
|
171602
|
+
const sources = [];
|
|
171603
|
+
for (const a4 of Array.isArray(message2.annotations) ? message2.annotations : []) {
|
|
171604
|
+
const cite = a4.url_citation;
|
|
171605
|
+
if (typeof cite?.url !== "string") continue;
|
|
171606
|
+
const url3 = activateUrlCandidates({ currentUserText: cite.url })[0];
|
|
171607
|
+
if (url3 === void 0 || seen.has(url3)) continue;
|
|
171608
|
+
seen.add(url3);
|
|
171609
|
+
const snippet = typeof cite.content === "string" ? cite.content.replace(/\s+/g, " ").trim().slice(0, SNIPPET_MAX_CHARS) : "";
|
|
171610
|
+
sources.push({
|
|
171611
|
+
url: url3,
|
|
171612
|
+
...typeof cite.title === "string" && cite.title !== "" ? { title: cite.title.slice(0, 200) } : {},
|
|
171613
|
+
...snippet === "" ? {} : { snippet }
|
|
171614
|
+
});
|
|
171615
|
+
}
|
|
171616
|
+
const text3 = message2.content.replace(/\[([^\]\n]+)\]\((?:https?:)?[^)\s]+\)/g, "$1").trim();
|
|
171617
|
+
return { text: text3, sources, ...finishReason === void 0 ? {} : { finishReason } };
|
|
171618
|
+
}
|
|
171619
|
+
var WEB_SEARCH_MODEL, WEB_SEARCH_MAX_RESULTS, WEB_SEARCH_DEADLINE_MS, WEB_SEARCH_QUERY_MAX, webSearchInput, SNIPPET_MAX_CHARS;
|
|
171620
|
+
var init_agent_web_search_tool = __esm({
|
|
171621
|
+
"../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/agent-web-search-tool.ts"() {
|
|
171622
|
+
"use strict";
|
|
171623
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
171624
|
+
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
171625
|
+
init_performance2();
|
|
171626
|
+
init_esm();
|
|
171627
|
+
init_out4();
|
|
171628
|
+
init_lazy_type();
|
|
171629
|
+
init_billing();
|
|
171630
|
+
init_llm_tool_loop();
|
|
171631
|
+
init_distill_url();
|
|
171632
|
+
init_url_activation();
|
|
171633
|
+
init_openrouter_image();
|
|
171634
|
+
init_client_attribution();
|
|
171635
|
+
init_agent_turn_allowance();
|
|
171636
|
+
WEB_SEARCH_MODEL = "google/gemini-3.1-flash-lite";
|
|
171637
|
+
WEB_SEARCH_MAX_RESULTS = 5;
|
|
171638
|
+
WEB_SEARCH_DEADLINE_MS = 25e3;
|
|
171639
|
+
WEB_SEARCH_QUERY_MAX = 300;
|
|
171640
|
+
webSearchInput = lazyType(() => type({ query: "string > 0" }).onUndeclaredKey("reject"));
|
|
171641
|
+
SNIPPET_MAX_CHARS = 500;
|
|
171642
|
+
__name(webSearchRequest, "webSearchRequest");
|
|
171643
|
+
__name(parseSearchReply, "parseSearchReply");
|
|
171644
|
+
}
|
|
171645
|
+
});
|
|
171646
|
+
|
|
171379
171647
|
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/backend-ai-callback.ts
|
|
171380
171648
|
async function loadAgentTools(vctx, base2, actingUserId) {
|
|
171381
171649
|
const [{ loadSelectedBackend: loadSelectedBackend2 }, { toolOfferedTo: toolOfferedTo2 }] = await Promise.all([
|
|
@@ -171444,12 +171712,12 @@ function makeBackendAiCallback(vctx, base2) {
|
|
|
171444
171712
|
);
|
|
171445
171713
|
return billedUserIdP;
|
|
171446
171714
|
}, "billedUserId");
|
|
171447
|
-
const gate = /* @__PURE__ */ __name(async () => {
|
|
171715
|
+
const gate = /* @__PURE__ */ __name(async (what = "ctx.callAI") => {
|
|
171448
171716
|
const userId = await billedUserId();
|
|
171449
171717
|
let creditCheck;
|
|
171450
171718
|
if (vctx.billing.enforceEnabled) {
|
|
171451
171719
|
if (userId === null) {
|
|
171452
|
-
return { ok: false, result: { ok: false, error:
|
|
171720
|
+
return { ok: false, result: { ok: false, error: `${what} denied: no billable identity for this invocation` } };
|
|
171453
171721
|
}
|
|
171454
171722
|
const rCheck = await vctx.billing.checkCredits({ userId });
|
|
171455
171723
|
if (rCheck.isOk()) creditCheck = rCheck.Ok();
|
|
@@ -171468,7 +171736,10 @@ function makeBackendAiCallback(vctx, base2) {
|
|
|
171468
171736
|
const json5 = m2.body;
|
|
171469
171737
|
const usage = json5.usage && typeof json5.usage.total_tokens === "number" ? json5.usage : void 0;
|
|
171470
171738
|
const totalTokens = usage?.total_tokens ?? Math.ceil(m2.estimateChars / 4);
|
|
171471
|
-
const costCents =
|
|
171739
|
+
const costCents = Math.max(
|
|
171740
|
+
costCentsFromUsage({ given: usage ? [usage] : [], calculated: { total_tokens: totalTokens } }),
|
|
171741
|
+
m2.minCostCents ?? 0
|
|
171742
|
+
);
|
|
171472
171743
|
const userId = m2.userId;
|
|
171473
171744
|
if (userId !== null && costCents > 0) {
|
|
171474
171745
|
const rTrack = await vctx.billing.trackUsage({
|
|
@@ -171548,7 +171819,55 @@ function makeBackendAiCallback(vctx, base2) {
|
|
|
171548
171819
|
if (reply === void 0) return { ok: false, error: "ctx.agent.run: ai gateway returned no completion" };
|
|
171549
171820
|
return { ok: true, text: reply.text ?? "", agent: reply };
|
|
171550
171821
|
}, "agentStep");
|
|
171822
|
+
let searches = 0;
|
|
171823
|
+
const webSearch = /* @__PURE__ */ __name(async (op) => {
|
|
171824
|
+
const query = typeof op.query === "string" ? op.query.trim() : "";
|
|
171825
|
+
if (query === "") return { ok: false, reason: "invalid", error: "ctx.webSearch needs a non-empty query string" };
|
|
171826
|
+
if (query.length > MAX_WEB_SEARCH_QUERY_CHARS) {
|
|
171827
|
+
return { ok: false, reason: "invalid", error: `ctx.webSearch query too long (max ${MAX_WEB_SEARCH_QUERY_CHARS} chars)` };
|
|
171828
|
+
}
|
|
171829
|
+
if (searches >= MAX_WEB_SEARCHES_PER_INVOCATION) {
|
|
171830
|
+
return {
|
|
171831
|
+
ok: false,
|
|
171832
|
+
reason: "budget",
|
|
171833
|
+
error: `ctx.webSearch limit reached: at most ${MAX_WEB_SEARCHES_PER_INVOCATION} searches per handler run`
|
|
171834
|
+
};
|
|
171835
|
+
}
|
|
171836
|
+
searches++;
|
|
171837
|
+
const maxResults = typeof op.maxResults === "number" && Number.isFinite(op.maxResults) ? Math.min(Math.max(1, Math.floor(op.maxResults)), WEB_SEARCH_MAX_RESULTS) : WEB_SEARCH_MAX_RESULTS;
|
|
171838
|
+
const g2 = await gate("ctx.webSearch");
|
|
171839
|
+
if (!g2.ok) return g2.result;
|
|
171840
|
+
const req = webSearchRequest(query, (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), maxResults);
|
|
171841
|
+
const rRes = await exception2Result(
|
|
171842
|
+
() => vctx.llmRequest({ ...req, headers: vctx.params.llm.headers }, { signal: AbortSignal.timeout(WEB_SEARCH_DEADLINE_MS) })
|
|
171843
|
+
);
|
|
171844
|
+
if (rRes.isErr()) return { ok: false, error: "ctx.webSearch: search unreachable" };
|
|
171845
|
+
const res = rRes.Ok();
|
|
171846
|
+
if (!res.ok) {
|
|
171847
|
+
await res.body?.cancel().catch(() => void 0);
|
|
171848
|
+
return { ok: false, error: `ctx.webSearch: search error (status ${res.status})` };
|
|
171849
|
+
}
|
|
171850
|
+
const rBody = await exception2Result(() => res.json());
|
|
171851
|
+
if (rBody.isErr()) return { ok: false, error: "ctx.webSearch: search returned malformed JSON" };
|
|
171852
|
+
const reply = parseSearchReply(rBody.Ok());
|
|
171853
|
+
await meter({
|
|
171854
|
+
userId: g2.userId,
|
|
171855
|
+
creditCheck: g2.creditCheck,
|
|
171856
|
+
body: rBody.Ok(),
|
|
171857
|
+
model: WEB_SEARCH_MODEL,
|
|
171858
|
+
estimateChars: query.length + (reply?.text.length ?? 0),
|
|
171859
|
+
kind: "web-search",
|
|
171860
|
+
minCostCents: WEB_SEARCH_MIN_COST_CENTS
|
|
171861
|
+
});
|
|
171862
|
+
if (reply === void 0) return { ok: false, error: "ctx.webSearch: search returned no results" };
|
|
171863
|
+
const results = reply.sources.filter((s2) => /^https?:\/\//i.test(s2.url)).slice(0, maxResults).map((s2) => ({ title: s2.title ?? s2.url, url: s2.url, snippet: s2.snippet ?? "" }));
|
|
171864
|
+
if (results.length === 0 && reply.text === "") {
|
|
171865
|
+
return { ok: false, reason: "empty", error: "ctx.webSearch: the search found nothing this time" };
|
|
171866
|
+
}
|
|
171867
|
+
return { ok: true, text: "", webSearch: { results, summary: reply.text.slice(0, MAX_WEB_SEARCH_SUMMARY_CHARS) } };
|
|
171868
|
+
}, "webSearch");
|
|
171551
171869
|
return async (op) => {
|
|
171870
|
+
if (op.webSearch !== void 0 && op.webSearch !== null) return webSearch(op.webSearch);
|
|
171552
171871
|
if (op.agent !== void 0 && op.agent !== null) return agentStep(op.agent);
|
|
171553
171872
|
if (calls >= MAX_AI_CALLS_PER_INVOCATION) {
|
|
171554
171873
|
return { ok: false, error: `ctx.callAI call budget exceeded (max ${MAX_AI_CALLS_PER_INVOCATION} per invocation)` };
|
|
@@ -171615,7 +171934,7 @@ function makeBackendAiCallback(vctx, base2) {
|
|
|
171615
171934
|
return { ok: true, text: text3 };
|
|
171616
171935
|
};
|
|
171617
171936
|
}
|
|
171618
|
-
var MAX_AI_CALLS_PER_INVOCATION, MAX_PROMPT_CHARS, DEFAULT_MAX_TOKENS, MAX_MAX_TOKENS, DEFAULT_MODEL, AI_TIMEOUT_MS, MAX_SCHEMA_CHARS;
|
|
171937
|
+
var MAX_AI_CALLS_PER_INVOCATION, MAX_PROMPT_CHARS, DEFAULT_MAX_TOKENS, MAX_MAX_TOKENS, DEFAULT_MODEL, AI_TIMEOUT_MS, MAX_SCHEMA_CHARS, MAX_WEB_SEARCHES_PER_INVOCATION, MAX_WEB_SEARCH_QUERY_CHARS, WEB_SEARCH_MIN_COST_CENTS, MAX_WEB_SEARCH_SUMMARY_CHARS;
|
|
171619
171938
|
var init_backend_ai_callback = __esm({
|
|
171620
171939
|
"../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/backend-ai-callback.ts"() {
|
|
171621
171940
|
"use strict";
|
|
@@ -171632,6 +171951,7 @@ var init_backend_ai_callback = __esm({
|
|
|
171632
171951
|
init_access_helpers();
|
|
171633
171952
|
init_pkg3();
|
|
171634
171953
|
init_backend_agent_step();
|
|
171954
|
+
init_agent_web_search_tool();
|
|
171635
171955
|
MAX_AI_CALLS_PER_INVOCATION = 5;
|
|
171636
171956
|
MAX_PROMPT_CHARS = 64e3;
|
|
171637
171957
|
DEFAULT_MAX_TOKENS = 1500;
|
|
@@ -171639,6 +171959,10 @@ var init_backend_ai_callback = __esm({
|
|
|
171639
171959
|
DEFAULT_MODEL = "openrouter/auto";
|
|
171640
171960
|
AI_TIMEOUT_MS = 45e3;
|
|
171641
171961
|
MAX_SCHEMA_CHARS = 16e3;
|
|
171962
|
+
MAX_WEB_SEARCHES_PER_INVOCATION = 10;
|
|
171963
|
+
MAX_WEB_SEARCH_QUERY_CHARS = WEB_SEARCH_QUERY_MAX;
|
|
171964
|
+
WEB_SEARCH_MIN_COST_CENTS = 1;
|
|
171965
|
+
MAX_WEB_SEARCH_SUMMARY_CHARS = 1500;
|
|
171642
171966
|
__name(loadAgentTools, "loadAgentTools");
|
|
171643
171967
|
__name(agentActingIdentity, "agentActingIdentity");
|
|
171644
171968
|
__name(validateSchema, "validateSchema");
|
|
@@ -177563,65 +177887,7 @@ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
|
177563
177887
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
177564
177888
|
init_performance2();
|
|
177565
177889
|
init_esm();
|
|
177566
|
-
|
|
177567
|
-
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/egress-floor.ts
|
|
177568
|
-
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
177569
|
-
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
177570
|
-
init_performance2();
|
|
177571
|
-
function hostMatchesPattern(host, pattern) {
|
|
177572
|
-
const h4 = host.toLowerCase();
|
|
177573
|
-
const p3 = pattern.toLowerCase();
|
|
177574
|
-
if (p3.startsWith("*.")) {
|
|
177575
|
-
return h4.endsWith(p3.slice(1)) && h4.length > p3.length - 1;
|
|
177576
|
-
}
|
|
177577
|
-
return h4 === p3;
|
|
177578
|
-
}
|
|
177579
|
-
__name(hostMatchesPattern, "hostMatchesPattern");
|
|
177580
|
-
var PLATFORM_HOST_PATTERNS = [
|
|
177581
|
-
"vibes.diy",
|
|
177582
|
-
"*.vibes.diy",
|
|
177583
|
-
// good.vibes.diy and any future platform subdomain
|
|
177584
|
-
"vibesdiy.net",
|
|
177585
|
-
"*.vibesdiy.net",
|
|
177586
|
-
"vibespreview.dev",
|
|
177587
|
-
"*.vibespreview.dev"
|
|
177588
|
-
// PR preview surfaces, incl. deep labels (AC-FLOOR-01)
|
|
177589
|
-
];
|
|
177590
|
-
var FLOOR_DENY_PATTERNS = [
|
|
177591
|
-
...PLATFORM_HOST_PATTERNS,
|
|
177592
|
-
"*.workers.dev",
|
|
177593
|
-
"localhost",
|
|
177594
|
-
"*.localhost",
|
|
177595
|
-
"metadata.google.internal"
|
|
177596
|
-
];
|
|
177597
|
-
var IPV4_RE = /^\d{1,3}(\.\d{1,3}){3}$/;
|
|
177598
|
-
var EVAL_FIXTURE_FLOOR_EXEMPTION = "eval-fixture";
|
|
177599
|
-
var EVAL_FIXTURE_PATH_RE = /^\/vibe\/eval\/[a-z0-9-]+\/_api\/(.+)$/;
|
|
177600
|
-
function isEvalFixtureUrl(url3) {
|
|
177601
|
-
if (url3.protocol !== "https:") return false;
|
|
177602
|
-
if (url3.port !== "" && url3.port !== "443") return false;
|
|
177603
|
-
if (url3.username !== "" || url3.password !== "") return false;
|
|
177604
|
-
if (url3.hostname !== "vibes.diy") return false;
|
|
177605
|
-
if (url3.search !== "") return false;
|
|
177606
|
-
const match4 = EVAL_FIXTURE_PATH_RE.exec(url3.pathname);
|
|
177607
|
-
if (match4 === null) return false;
|
|
177608
|
-
const rest = match4[1].split("/");
|
|
177609
|
-
return rest.every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
177610
|
-
}
|
|
177611
|
-
__name(isEvalFixtureUrl, "isEvalFixtureUrl");
|
|
177612
|
-
function checkEgressFloor(url3) {
|
|
177613
|
-
if (url3.protocol !== "https:") return { ok: false, reason: `scheme ${url3.protocol} denied` };
|
|
177614
|
-
if (url3.port !== "" && url3.port !== "443") return { ok: false, reason: `port ${url3.port} denied` };
|
|
177615
|
-
const host = url3.hostname;
|
|
177616
|
-
if (host.startsWith("[") || host.includes(":")) return { ok: false, reason: "IPv6 literal denied" };
|
|
177617
|
-
if (IPV4_RE.test(host)) return { ok: false, reason: "IPv4 literal denied" };
|
|
177618
|
-
if (isEvalFixtureUrl(url3)) return { ok: true, exemption: EVAL_FIXTURE_FLOOR_EXEMPTION };
|
|
177619
|
-
for (const pattern of FLOOR_DENY_PATTERNS) {
|
|
177620
|
-
if (hostMatchesPattern(host, pattern)) return { ok: false, reason: `host ${host} is floor-denied` };
|
|
177621
|
-
}
|
|
177622
|
-
return { ok: true };
|
|
177623
|
-
}
|
|
177624
|
-
__name(checkEgressFloor, "checkEgressFloor");
|
|
177890
|
+
init_egress_floor();
|
|
177625
177891
|
|
|
177626
177892
|
// ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/egress-platform-list.ts
|
|
177627
177893
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|