@bunny-agent/daemon 0.9.29-beta.0 → 0.9.29-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.mjs +28 -15
- package/dist/index.js +28 -15
- package/dist/nextjs.js +28 -15
- package/dist/routes/fs.d.ts +2 -0
- package/dist/routes/fs.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/bundle.mjs
CHANGED
|
@@ -206500,10 +206500,15 @@ async function fsStat(state, q2) {
|
|
|
206500
206500
|
const root2 = resolveVolumeRoot(state, q2.volume);
|
|
206501
206501
|
const target = resolveUnderRoot(root2, q2.path);
|
|
206502
206502
|
const stat6 = await fs2.stat(target);
|
|
206503
|
+
const created_at = msToIsoOrNull(stat6.birthtimeMs) ?? msToIsoOrNull(stat6.ctimeMs);
|
|
206503
206504
|
return ok({
|
|
206504
206505
|
path: target,
|
|
206505
206506
|
is_dir: stat6.isDirectory(),
|
|
206506
|
-
size: stat6.isFile() ? stat6.size : 0
|
|
206507
|
+
size: stat6.isFile() ? stat6.size : 0,
|
|
206508
|
+
created_at,
|
|
206509
|
+
modified_at: msToIsoOrNull(
|
|
206510
|
+
stat6.mtimeMs
|
|
206511
|
+
)
|
|
206507
206512
|
});
|
|
206508
206513
|
}
|
|
206509
206514
|
async function fsExists(state, q2) {
|
|
@@ -263528,7 +263533,7 @@ function buildImageGenerateTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
263528
263533
|
],
|
|
263529
263534
|
// biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
|
|
263530
263535
|
parameters: generateImageSchema,
|
|
263531
|
-
async execute(_toolCallId, params,
|
|
263536
|
+
async execute(_toolCallId, params, signal, _onUpdate) {
|
|
263532
263537
|
const p = params;
|
|
263533
263538
|
const prompt = p.prompt;
|
|
263534
263539
|
const size = p.size ?? "1024x1024";
|
|
@@ -263552,7 +263557,8 @@ function buildImageGenerateTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
263552
263557
|
quality,
|
|
263553
263558
|
response_format: "b64_json",
|
|
263554
263559
|
output_format: "png"
|
|
263555
|
-
})
|
|
263560
|
+
}),
|
|
263561
|
+
signal
|
|
263556
263562
|
});
|
|
263557
263563
|
if (!res.ok) {
|
|
263558
263564
|
throw new Error(`Image generation failed (${res.status}): ${await res.text()}`);
|
|
@@ -263657,7 +263663,7 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
263657
263663
|
],
|
|
263658
263664
|
// biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
|
|
263659
263665
|
parameters: editImageSchema,
|
|
263660
|
-
async execute(_toolCallId, params,
|
|
263666
|
+
async execute(_toolCallId, params, signal, _onUpdate) {
|
|
263661
263667
|
const { readFileSync: readFileSync24, existsSync: existsSync31 } = await import("node:fs");
|
|
263662
263668
|
const { resolve: resolve14, basename: basename12 } = await import("node:path");
|
|
263663
263669
|
const p = params;
|
|
@@ -263725,7 +263731,8 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
263725
263731
|
"Content-Type": type,
|
|
263726
263732
|
Authorization: `Bearer ${apiKey}`
|
|
263727
263733
|
},
|
|
263728
|
-
body
|
|
263734
|
+
body,
|
|
263735
|
+
signal
|
|
263729
263736
|
});
|
|
263730
263737
|
if (!res.ok) {
|
|
263731
263738
|
throw new Error(`Image edit failed (${res.status}): ${await res.text()}`);
|
|
@@ -263776,7 +263783,7 @@ var braveProvider = {
|
|
|
263776
263783
|
id: "brave",
|
|
263777
263784
|
label: "Brave Search",
|
|
263778
263785
|
envKeys: ["BRAVE_API_KEY"],
|
|
263779
|
-
async search({ apiKey, query, count, country, freshness }) {
|
|
263786
|
+
async search({ apiKey, query, count, country, freshness, signal }) {
|
|
263780
263787
|
const params = new URLSearchParams({
|
|
263781
263788
|
q: query,
|
|
263782
263789
|
count: String(Math.min(count, 20))
|
|
@@ -263790,7 +263797,8 @@ var braveProvider = {
|
|
|
263790
263797
|
Accept: "application/json",
|
|
263791
263798
|
"Accept-Encoding": "gzip",
|
|
263792
263799
|
"X-Subscription-Token": apiKey
|
|
263793
|
-
}
|
|
263800
|
+
},
|
|
263801
|
+
signal
|
|
263794
263802
|
});
|
|
263795
263803
|
if (!res.ok) {
|
|
263796
263804
|
const body = await res.text().catch(() => "");
|
|
@@ -263818,7 +263826,7 @@ var tavilyProvider = {
|
|
|
263818
263826
|
id: "tavily",
|
|
263819
263827
|
label: "Tavily",
|
|
263820
263828
|
envKeys: ["TAVILY_API_KEY"],
|
|
263821
|
-
async search({ apiKey, query, count }) {
|
|
263829
|
+
async search({ apiKey, query, count, signal }) {
|
|
263822
263830
|
const res = await fetch("https://api.tavily.com/search", {
|
|
263823
263831
|
method: "POST",
|
|
263824
263832
|
headers: { "Content-Type": "application/json" },
|
|
@@ -263827,7 +263835,8 @@ var tavilyProvider = {
|
|
|
263827
263835
|
query,
|
|
263828
263836
|
max_results: Math.min(count, 10),
|
|
263829
263837
|
include_answer: false
|
|
263830
|
-
})
|
|
263838
|
+
}),
|
|
263839
|
+
signal
|
|
263831
263840
|
});
|
|
263832
263841
|
if (!res.ok) {
|
|
263833
263842
|
const body = await res.text().catch(() => "");
|
|
@@ -263880,9 +263889,12 @@ var BROWSER_UA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/53
|
|
|
263880
263889
|
function htmlToText(html2) {
|
|
263881
263890
|
return html2.replace(/<(script|style|noscript)[^>]*>[\s\S]*?<\/\1>/gi, "").replace(/<br\s*\/?>/gi, "\n").replace(/<\/(p|div|h[1-6]|li|tr)>/gi, "\n").replace(/<(p|div|h[1-6]|li|tr)[^>]*>/gi, "\n").replace(/<[^>]+>/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/ /g, " ").replace(/[ \t]+/g, " ").replace(/\n{3,}/g, "\n\n").trim();
|
|
263882
263891
|
}
|
|
263883
|
-
async function fetchPageContent(url) {
|
|
263892
|
+
async function fetchPageContent(url, externalSignal) {
|
|
263884
263893
|
const controller = new AbortController();
|
|
263885
263894
|
const timeout = setTimeout(() => controller.abort(), 15e3);
|
|
263895
|
+
externalSignal?.addEventListener("abort", () => controller.abort(), {
|
|
263896
|
+
once: true
|
|
263897
|
+
});
|
|
263886
263898
|
try {
|
|
263887
263899
|
const res = await fetch(url, {
|
|
263888
263900
|
headers: {
|
|
@@ -263979,7 +263991,7 @@ function buildWebSearchTool(env2) {
|
|
|
263979
263991
|
],
|
|
263980
263992
|
// biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
|
|
263981
263993
|
parameters: webSearchSchema,
|
|
263982
|
-
async execute(_toolCallId, params,
|
|
263994
|
+
async execute(_toolCallId, params, signal, _onUpdate) {
|
|
263983
263995
|
const p = params;
|
|
263984
263996
|
const query = p.query;
|
|
263985
263997
|
const count = p.count ?? 5;
|
|
@@ -263994,11 +264006,12 @@ function buildWebSearchTool(env2) {
|
|
|
263994
264006
|
query,
|
|
263995
264007
|
count,
|
|
263996
264008
|
country,
|
|
263997
|
-
freshness
|
|
264009
|
+
freshness,
|
|
264010
|
+
signal
|
|
263998
264011
|
});
|
|
263999
264012
|
if (shouldFetchContent) {
|
|
264000
264013
|
for (const r2 of results) {
|
|
264001
|
-
r2.content = await fetchPageContent(r2.link);
|
|
264014
|
+
r2.content = await fetchPageContent(r2.link, signal);
|
|
264002
264015
|
}
|
|
264003
264016
|
}
|
|
264004
264017
|
return {
|
|
@@ -264044,11 +264057,11 @@ function buildWebFetchTool() {
|
|
|
264044
264057
|
],
|
|
264045
264058
|
// biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
|
|
264046
264059
|
parameters: webFetchSchema,
|
|
264047
|
-
async execute(_toolCallId, params,
|
|
264060
|
+
async execute(_toolCallId, params, signal, _onUpdate) {
|
|
264048
264061
|
const p = params;
|
|
264049
264062
|
const url = p.url;
|
|
264050
264063
|
try {
|
|
264051
|
-
const content = await fetchPageContent(url);
|
|
264064
|
+
const content = await fetchPageContent(url, signal);
|
|
264052
264065
|
return {
|
|
264053
264066
|
content: [{ type: "text", text: content }],
|
|
264054
264067
|
details: void 0
|
package/dist/index.js
CHANGED
|
@@ -206434,10 +206434,15 @@ async function fsStat(state, q2) {
|
|
|
206434
206434
|
const root = resolveVolumeRoot(state, q2.volume);
|
|
206435
206435
|
const target = resolveUnderRoot(root, q2.path);
|
|
206436
206436
|
const stat6 = await fs2.stat(target);
|
|
206437
|
+
const created_at = msToIsoOrNull(stat6.birthtimeMs) ?? msToIsoOrNull(stat6.ctimeMs);
|
|
206437
206438
|
return ok({
|
|
206438
206439
|
path: target,
|
|
206439
206440
|
is_dir: stat6.isDirectory(),
|
|
206440
|
-
size: stat6.isFile() ? stat6.size : 0
|
|
206441
|
+
size: stat6.isFile() ? stat6.size : 0,
|
|
206442
|
+
created_at,
|
|
206443
|
+
modified_at: msToIsoOrNull(
|
|
206444
|
+
stat6.mtimeMs
|
|
206445
|
+
)
|
|
206441
206446
|
});
|
|
206442
206447
|
}
|
|
206443
206448
|
async function fsExists(state, q2) {
|
|
@@ -263524,7 +263529,7 @@ function buildImageGenerateTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
263524
263529
|
],
|
|
263525
263530
|
// biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
|
|
263526
263531
|
parameters: generateImageSchema,
|
|
263527
|
-
async execute(_toolCallId, params,
|
|
263532
|
+
async execute(_toolCallId, params, signal, _onUpdate) {
|
|
263528
263533
|
const p = params;
|
|
263529
263534
|
const prompt = p.prompt;
|
|
263530
263535
|
const size = p.size ?? "1024x1024";
|
|
@@ -263548,7 +263553,8 @@ function buildImageGenerateTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
263548
263553
|
quality,
|
|
263549
263554
|
response_format: "b64_json",
|
|
263550
263555
|
output_format: "png"
|
|
263551
|
-
})
|
|
263556
|
+
}),
|
|
263557
|
+
signal
|
|
263552
263558
|
});
|
|
263553
263559
|
if (!res.ok) {
|
|
263554
263560
|
throw new Error(`Image generation failed (${res.status}): ${await res.text()}`);
|
|
@@ -263653,7 +263659,7 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
263653
263659
|
],
|
|
263654
263660
|
// biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
|
|
263655
263661
|
parameters: editImageSchema,
|
|
263656
|
-
async execute(_toolCallId, params,
|
|
263662
|
+
async execute(_toolCallId, params, signal, _onUpdate) {
|
|
263657
263663
|
const { readFileSync: readFileSync24, existsSync: existsSync31 } = await import("node:fs");
|
|
263658
263664
|
const { resolve: resolve14, basename: basename12 } = await import("node:path");
|
|
263659
263665
|
const p = params;
|
|
@@ -263721,7 +263727,8 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
263721
263727
|
"Content-Type": type,
|
|
263722
263728
|
Authorization: `Bearer ${apiKey}`
|
|
263723
263729
|
},
|
|
263724
|
-
body
|
|
263730
|
+
body,
|
|
263731
|
+
signal
|
|
263725
263732
|
});
|
|
263726
263733
|
if (!res.ok) {
|
|
263727
263734
|
throw new Error(`Image edit failed (${res.status}): ${await res.text()}`);
|
|
@@ -263772,7 +263779,7 @@ var braveProvider = {
|
|
|
263772
263779
|
id: "brave",
|
|
263773
263780
|
label: "Brave Search",
|
|
263774
263781
|
envKeys: ["BRAVE_API_KEY"],
|
|
263775
|
-
async search({ apiKey, query, count, country, freshness }) {
|
|
263782
|
+
async search({ apiKey, query, count, country, freshness, signal }) {
|
|
263776
263783
|
const params = new URLSearchParams({
|
|
263777
263784
|
q: query,
|
|
263778
263785
|
count: String(Math.min(count, 20))
|
|
@@ -263786,7 +263793,8 @@ var braveProvider = {
|
|
|
263786
263793
|
Accept: "application/json",
|
|
263787
263794
|
"Accept-Encoding": "gzip",
|
|
263788
263795
|
"X-Subscription-Token": apiKey
|
|
263789
|
-
}
|
|
263796
|
+
},
|
|
263797
|
+
signal
|
|
263790
263798
|
});
|
|
263791
263799
|
if (!res.ok) {
|
|
263792
263800
|
const body = await res.text().catch(() => "");
|
|
@@ -263814,7 +263822,7 @@ var tavilyProvider = {
|
|
|
263814
263822
|
id: "tavily",
|
|
263815
263823
|
label: "Tavily",
|
|
263816
263824
|
envKeys: ["TAVILY_API_KEY"],
|
|
263817
|
-
async search({ apiKey, query, count }) {
|
|
263825
|
+
async search({ apiKey, query, count, signal }) {
|
|
263818
263826
|
const res = await fetch("https://api.tavily.com/search", {
|
|
263819
263827
|
method: "POST",
|
|
263820
263828
|
headers: { "Content-Type": "application/json" },
|
|
@@ -263823,7 +263831,8 @@ var tavilyProvider = {
|
|
|
263823
263831
|
query,
|
|
263824
263832
|
max_results: Math.min(count, 10),
|
|
263825
263833
|
include_answer: false
|
|
263826
|
-
})
|
|
263834
|
+
}),
|
|
263835
|
+
signal
|
|
263827
263836
|
});
|
|
263828
263837
|
if (!res.ok) {
|
|
263829
263838
|
const body = await res.text().catch(() => "");
|
|
@@ -263876,9 +263885,12 @@ var BROWSER_UA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/53
|
|
|
263876
263885
|
function htmlToText(html2) {
|
|
263877
263886
|
return html2.replace(/<(script|style|noscript)[^>]*>[\s\S]*?<\/\1>/gi, "").replace(/<br\s*\/?>/gi, "\n").replace(/<\/(p|div|h[1-6]|li|tr)>/gi, "\n").replace(/<(p|div|h[1-6]|li|tr)[^>]*>/gi, "\n").replace(/<[^>]+>/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/ /g, " ").replace(/[ \t]+/g, " ").replace(/\n{3,}/g, "\n\n").trim();
|
|
263878
263887
|
}
|
|
263879
|
-
async function fetchPageContent(url) {
|
|
263888
|
+
async function fetchPageContent(url, externalSignal) {
|
|
263880
263889
|
const controller = new AbortController();
|
|
263881
263890
|
const timeout = setTimeout(() => controller.abort(), 15e3);
|
|
263891
|
+
externalSignal?.addEventListener("abort", () => controller.abort(), {
|
|
263892
|
+
once: true
|
|
263893
|
+
});
|
|
263882
263894
|
try {
|
|
263883
263895
|
const res = await fetch(url, {
|
|
263884
263896
|
headers: {
|
|
@@ -263975,7 +263987,7 @@ function buildWebSearchTool(env2) {
|
|
|
263975
263987
|
],
|
|
263976
263988
|
// biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
|
|
263977
263989
|
parameters: webSearchSchema,
|
|
263978
|
-
async execute(_toolCallId, params,
|
|
263990
|
+
async execute(_toolCallId, params, signal, _onUpdate) {
|
|
263979
263991
|
const p = params;
|
|
263980
263992
|
const query = p.query;
|
|
263981
263993
|
const count = p.count ?? 5;
|
|
@@ -263990,11 +264002,12 @@ function buildWebSearchTool(env2) {
|
|
|
263990
264002
|
query,
|
|
263991
264003
|
count,
|
|
263992
264004
|
country,
|
|
263993
|
-
freshness
|
|
264005
|
+
freshness,
|
|
264006
|
+
signal
|
|
263994
264007
|
});
|
|
263995
264008
|
if (shouldFetchContent) {
|
|
263996
264009
|
for (const r2 of results) {
|
|
263997
|
-
r2.content = await fetchPageContent(r2.link);
|
|
264010
|
+
r2.content = await fetchPageContent(r2.link, signal);
|
|
263998
264011
|
}
|
|
263999
264012
|
}
|
|
264000
264013
|
return {
|
|
@@ -264040,11 +264053,11 @@ function buildWebFetchTool() {
|
|
|
264040
264053
|
],
|
|
264041
264054
|
// biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
|
|
264042
264055
|
parameters: webFetchSchema,
|
|
264043
|
-
async execute(_toolCallId, params,
|
|
264056
|
+
async execute(_toolCallId, params, signal, _onUpdate) {
|
|
264044
264057
|
const p = params;
|
|
264045
264058
|
const url = p.url;
|
|
264046
264059
|
try {
|
|
264047
|
-
const content = await fetchPageContent(url);
|
|
264060
|
+
const content = await fetchPageContent(url, signal);
|
|
264048
264061
|
return {
|
|
264049
264062
|
content: [{ type: "text", text: content }],
|
|
264050
264063
|
details: void 0
|
package/dist/nextjs.js
CHANGED
|
@@ -206492,10 +206492,15 @@ async function fsStat(state, q2) {
|
|
|
206492
206492
|
const root = resolveVolumeRoot(state, q2.volume);
|
|
206493
206493
|
const target = resolveUnderRoot(root, q2.path);
|
|
206494
206494
|
const stat6 = await fs2.stat(target);
|
|
206495
|
+
const created_at = msToIsoOrNull(stat6.birthtimeMs) ?? msToIsoOrNull(stat6.ctimeMs);
|
|
206495
206496
|
return ok({
|
|
206496
206497
|
path: target,
|
|
206497
206498
|
is_dir: stat6.isDirectory(),
|
|
206498
|
-
size: stat6.isFile() ? stat6.size : 0
|
|
206499
|
+
size: stat6.isFile() ? stat6.size : 0,
|
|
206500
|
+
created_at,
|
|
206501
|
+
modified_at: msToIsoOrNull(
|
|
206502
|
+
stat6.mtimeMs
|
|
206503
|
+
)
|
|
206499
206504
|
});
|
|
206500
206505
|
}
|
|
206501
206506
|
async function fsExists(state, q2) {
|
|
@@ -263520,7 +263525,7 @@ function buildImageGenerateTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
263520
263525
|
],
|
|
263521
263526
|
// biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
|
|
263522
263527
|
parameters: generateImageSchema,
|
|
263523
|
-
async execute(_toolCallId, params,
|
|
263528
|
+
async execute(_toolCallId, params, signal, _onUpdate) {
|
|
263524
263529
|
const p = params;
|
|
263525
263530
|
const prompt = p.prompt;
|
|
263526
263531
|
const size = p.size ?? "1024x1024";
|
|
@@ -263544,7 +263549,8 @@ function buildImageGenerateTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
263544
263549
|
quality,
|
|
263545
263550
|
response_format: "b64_json",
|
|
263546
263551
|
output_format: "png"
|
|
263547
|
-
})
|
|
263552
|
+
}),
|
|
263553
|
+
signal
|
|
263548
263554
|
});
|
|
263549
263555
|
if (!res.ok) {
|
|
263550
263556
|
throw new Error(`Image generation failed (${res.status}): ${await res.text()}`);
|
|
@@ -263649,7 +263655,7 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
263649
263655
|
],
|
|
263650
263656
|
// biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
|
|
263651
263657
|
parameters: editImageSchema,
|
|
263652
|
-
async execute(_toolCallId, params,
|
|
263658
|
+
async execute(_toolCallId, params, signal, _onUpdate) {
|
|
263653
263659
|
const { readFileSync: readFileSync24, existsSync: existsSync31 } = await import("node:fs");
|
|
263654
263660
|
const { resolve: resolve14, basename: basename12 } = await import("node:path");
|
|
263655
263661
|
const p = params;
|
|
@@ -263717,7 +263723,8 @@ function buildImageEditTool(cwd, imageModelId, baseUrl, apiKey) {
|
|
|
263717
263723
|
"Content-Type": type,
|
|
263718
263724
|
Authorization: `Bearer ${apiKey}`
|
|
263719
263725
|
},
|
|
263720
|
-
body
|
|
263726
|
+
body,
|
|
263727
|
+
signal
|
|
263721
263728
|
});
|
|
263722
263729
|
if (!res.ok) {
|
|
263723
263730
|
throw new Error(`Image edit failed (${res.status}): ${await res.text()}`);
|
|
@@ -263768,7 +263775,7 @@ var braveProvider = {
|
|
|
263768
263775
|
id: "brave",
|
|
263769
263776
|
label: "Brave Search",
|
|
263770
263777
|
envKeys: ["BRAVE_API_KEY"],
|
|
263771
|
-
async search({ apiKey, query, count, country, freshness }) {
|
|
263778
|
+
async search({ apiKey, query, count, country, freshness, signal }) {
|
|
263772
263779
|
const params = new URLSearchParams({
|
|
263773
263780
|
q: query,
|
|
263774
263781
|
count: String(Math.min(count, 20))
|
|
@@ -263782,7 +263789,8 @@ var braveProvider = {
|
|
|
263782
263789
|
Accept: "application/json",
|
|
263783
263790
|
"Accept-Encoding": "gzip",
|
|
263784
263791
|
"X-Subscription-Token": apiKey
|
|
263785
|
-
}
|
|
263792
|
+
},
|
|
263793
|
+
signal
|
|
263786
263794
|
});
|
|
263787
263795
|
if (!res.ok) {
|
|
263788
263796
|
const body = await res.text().catch(() => "");
|
|
@@ -263810,7 +263818,7 @@ var tavilyProvider = {
|
|
|
263810
263818
|
id: "tavily",
|
|
263811
263819
|
label: "Tavily",
|
|
263812
263820
|
envKeys: ["TAVILY_API_KEY"],
|
|
263813
|
-
async search({ apiKey, query, count }) {
|
|
263821
|
+
async search({ apiKey, query, count, signal }) {
|
|
263814
263822
|
const res = await fetch("https://api.tavily.com/search", {
|
|
263815
263823
|
method: "POST",
|
|
263816
263824
|
headers: { "Content-Type": "application/json" },
|
|
@@ -263819,7 +263827,8 @@ var tavilyProvider = {
|
|
|
263819
263827
|
query,
|
|
263820
263828
|
max_results: Math.min(count, 10),
|
|
263821
263829
|
include_answer: false
|
|
263822
|
-
})
|
|
263830
|
+
}),
|
|
263831
|
+
signal
|
|
263823
263832
|
});
|
|
263824
263833
|
if (!res.ok) {
|
|
263825
263834
|
const body = await res.text().catch(() => "");
|
|
@@ -263872,9 +263881,12 @@ var BROWSER_UA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/53
|
|
|
263872
263881
|
function htmlToText(html2) {
|
|
263873
263882
|
return html2.replace(/<(script|style|noscript)[^>]*>[\s\S]*?<\/\1>/gi, "").replace(/<br\s*\/?>/gi, "\n").replace(/<\/(p|div|h[1-6]|li|tr)>/gi, "\n").replace(/<(p|div|h[1-6]|li|tr)[^>]*>/gi, "\n").replace(/<[^>]+>/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/ /g, " ").replace(/[ \t]+/g, " ").replace(/\n{3,}/g, "\n\n").trim();
|
|
263874
263883
|
}
|
|
263875
|
-
async function fetchPageContent(url) {
|
|
263884
|
+
async function fetchPageContent(url, externalSignal) {
|
|
263876
263885
|
const controller = new AbortController();
|
|
263877
263886
|
const timeout = setTimeout(() => controller.abort(), 15e3);
|
|
263887
|
+
externalSignal?.addEventListener("abort", () => controller.abort(), {
|
|
263888
|
+
once: true
|
|
263889
|
+
});
|
|
263878
263890
|
try {
|
|
263879
263891
|
const res = await fetch(url, {
|
|
263880
263892
|
headers: {
|
|
@@ -263971,7 +263983,7 @@ function buildWebSearchTool(env2) {
|
|
|
263971
263983
|
],
|
|
263972
263984
|
// biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
|
|
263973
263985
|
parameters: webSearchSchema,
|
|
263974
|
-
async execute(_toolCallId, params,
|
|
263986
|
+
async execute(_toolCallId, params, signal, _onUpdate) {
|
|
263975
263987
|
const p = params;
|
|
263976
263988
|
const query = p.query;
|
|
263977
263989
|
const count = p.count ?? 5;
|
|
@@ -263986,11 +263998,12 @@ function buildWebSearchTool(env2) {
|
|
|
263986
263998
|
query,
|
|
263987
263999
|
count,
|
|
263988
264000
|
country,
|
|
263989
|
-
freshness
|
|
264001
|
+
freshness,
|
|
264002
|
+
signal
|
|
263990
264003
|
});
|
|
263991
264004
|
if (shouldFetchContent) {
|
|
263992
264005
|
for (const r2 of results) {
|
|
263993
|
-
r2.content = await fetchPageContent(r2.link);
|
|
264006
|
+
r2.content = await fetchPageContent(r2.link, signal);
|
|
263994
264007
|
}
|
|
263995
264008
|
}
|
|
263996
264009
|
return {
|
|
@@ -264036,11 +264049,11 @@ function buildWebFetchTool() {
|
|
|
264036
264049
|
],
|
|
264037
264050
|
// biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
|
|
264038
264051
|
parameters: webFetchSchema,
|
|
264039
|
-
async execute(_toolCallId, params,
|
|
264052
|
+
async execute(_toolCallId, params, signal, _onUpdate) {
|
|
264040
264053
|
const p = params;
|
|
264041
264054
|
const url = p.url;
|
|
264042
264055
|
try {
|
|
264043
|
-
const content = await fetchPageContent(url);
|
|
264056
|
+
const content = await fetchPageContent(url, signal);
|
|
264044
264057
|
return {
|
|
264045
264058
|
content: [{ type: "text", text: content }],
|
|
264046
264059
|
details: void 0
|
package/dist/routes/fs.d.ts
CHANGED
|
@@ -61,6 +61,8 @@ export declare function fsStat(state: AppState, q: PathQuery): Promise<import(".
|
|
|
61
61
|
path: string;
|
|
62
62
|
is_dir: boolean;
|
|
63
63
|
size: number;
|
|
64
|
+
created_at: string | null;
|
|
65
|
+
modified_at: string | null;
|
|
64
66
|
}>>;
|
|
65
67
|
export declare function fsExists(state: AppState, q: PathQuery): Promise<import("../utils.js").ApiEnvelope<{
|
|
66
68
|
path: string;
|
package/dist/routes/fs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/routes/fs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAe5C,UAAU,SAAS;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,SAAS;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,SAAS;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAID,UAAU,SAAS;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,UAAU,UAAU;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,SAAS;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,YAAY;IACp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