@xiaoso/dsh-tool-plus 0.1.0-beta.5 → 0.1.0-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/README.en.md +1 -1
- package/README.md +2 -2
- package/THIRD_PARTY_NOTICES.md +42 -42
- package/lib/{abort-dIkZBV7Q.mjs → abort-CsjZitYv.mjs} +1 -1
- package/lib/{amazon-bedrock-WQhvjHYu.mjs → amazon-bedrock-CfNIDi5k.mjs} +7 -7
- package/lib/{anthropic-CJCauvYz.mjs → anthropic-BVfZdnMp.mjs} +12 -12
- package/lib/{anthropic-tTntD8BD.mjs → anthropic-DGXmmg43.mjs} +2 -2
- package/lib/{api-key-login-BzqNdM2y.mjs → api-key-login-BikQAfD-.mjs} +1 -1
- package/lib/{aws-credentials-CXryMobh.mjs → aws-credentials-DrssNMn_.mjs} +4 -4
- package/lib/{azure-openai-responses-DuukbD0F.mjs → azure-openai-responses-C-5q-5K2.mjs} +8 -8
- package/lib/browser-render-z6b8Ljo9.mjs +183 -0
- package/lib/{bundled-references-Cavaffah.mjs → bundled-references-D71z7_T3.mjs} +2 -2
- package/lib/{callback-server-CQ5Jo8F-.mjs → callback-server-Di6C4RqI.mjs} +1 -1
- package/lib/client.js +327 -4
- package/lib/{cursor-B6TUEmgP.mjs → cursor-CQQtygwl.mjs} +1 -1
- package/lib/{cursor-DkSX2h3H.mjs → cursor-DXJxwdcg.mjs} +7 -7
- package/lib/{cursor-aJrXeYCb.mjs → cursor-Hr5Zw1gt.mjs} +3 -3
- package/lib/{device-code-DBo3B5nh.mjs → device-code-wZUbgPdB.mjs} +1 -1
- package/lib/{devin-BHZZyMhO.mjs → devin-CF6UhCFw.mjs} +2 -2
- package/lib/{devin-BK7DHeca.mjs → devin-DXJoDlW2.mjs} +1 -1
- package/lib/{devin-vNZTNUON.mjs → devin-P37gURs_.mjs} +5 -5
- package/lib/{dom-DGdYAVTv.mjs → dom-CawWi8fa.mjs} +14 -1
- package/lib/{error-Dd8DIqs-.mjs → error-DoHuatWw.mjs} +1 -1
- package/lib/{event-stream-BbFZJy-z.mjs → event-stream-C-FmBYUt.mjs} +1 -1
- package/lib/{github-copilot-CYkjeTi3.mjs → github-copilot-C2dTonBX.mjs} +3 -3
- package/lib/{github-copilot-B1yiyVRh.mjs → github-copilot-qETlj_bD.mjs} +1 -1
- package/lib/{gitlab-duo-CM7Ref1H.mjs → gitlab-duo-FQZiFRQe.mjs} +3 -3
- package/lib/{gitlab-duo-workflow-BGAF6JDw.mjs → gitlab-duo-workflow-DLTabzOy.mjs} +2 -2
- package/lib/{google-BS4T25Pn.mjs → google-BilwFSzx.mjs} +3 -3
- package/lib/{google-antigravity-DGmwC2KV.mjs → google-antigravity-BfBiINdu.mjs} +2 -2
- package/lib/{google-auth-B6gjsZvg.mjs → google-auth-CWlKXJ-H.mjs} +3 -3
- package/lib/{google-gemini-cli-Dsztq0N5.mjs → google-gemini-cli-CB89ljNz.mjs} +3 -3
- package/lib/{google-gemini-cli-Cqds_Q5T.mjs → google-gemini-cli-CygFcR6N.mjs} +8 -8
- package/lib/{google-oauth-shared-CuEHaDDj.mjs → google-oauth-shared-Cn82h1o2.mjs} +2 -2
- package/lib/{google-shared-Dr-VG-ap.mjs → google-shared-CF1JrqTM.mjs} +6 -6
- package/lib/{google-vertex-BDN2tLaD.mjs → google-vertex-DgMhhFw8.mjs} +5 -5
- package/lib/{identity-Da1GPU9a.mjs → identity-C0SPVyIZ.mjs} +1 -1
- package/lib/{idle-iterator-DUjKQEGT.mjs → idle-iterator-HzbbfXP4.mjs} +2 -2
- package/lib/index.mjs +310 -29
- package/lib/{kimi-Dh0pv3WZ.mjs → kimi-DHDO6Fde.mjs} +3 -3
- package/lib/launch-DwpE70Pv.mjs +148 -0
- package/lib/{markit-BL3cH47U.mjs → markit-B9exZ0ZV.mjs} +1 -1
- package/lib/{minimax-code-Uq8Qu9LW.mjs → minimax-code-vAhEXhev.mjs} +1 -1
- package/lib/{models-SGASygJ3.mjs → models-Cp3PzU3l.mjs} +1 -1
- package/lib/{ollama-DPzBmq89.mjs → ollama-TrkXTNqE.mjs} +8 -8
- package/lib/{openai-codex-Ch8CkT3p.mjs → openai-codex-CrjHtSH4.mjs} +3 -3
- package/lib/{openai-codex-responses-pejZgdZo.mjs → openai-codex-responses-C4uMpWNy.mjs} +10 -10
- package/lib/{openai-completions-DIf361kF.mjs → openai-completions-1ydXm5vF.mjs} +13 -13
- package/lib/{openai-reasoning-fallback-Nj6yB2rY.mjs → openai-reasoning-fallback-CigKCyzc.mjs} +2 -2
- package/lib/{openai-responses-Db_a-U4-.mjs → openai-responses-CN79gRGQ.mjs} +10 -10
- package/lib/{opencode-Rq_Q2vAO.mjs → opencode-CEGlimzL.mjs} +1 -1
- package/lib/{perplexity-C4iLVMUj.mjs → perplexity-BLJN-8dM.mjs} +2 -2
- package/lib/{proxy-pM_NIv-H.mjs → proxy-XOYi58TM.mjs} +1 -1
- package/lib/readability-Cpm-ocau.mjs +455 -0
- package/lib/{scrapers-1FTlHNQV.mjs → scrapers-BlWQMGjU.mjs} +11 -10
- package/lib/{src-BgpusnsB.mjs → src-D_e1qMwi.mjs} +5 -1
- package/lib/{stream-CRtexYLe.mjs → stream-DveNFWSN.mjs} +56 -56
- package/lib/{stream-markup-healing-KMkiAA00.mjs → stream-markup-healing-C9eC7Gf8.mjs} +3 -3
- package/lib/tool-errors-DoyxivAR.mjs +47 -0
- package/lib/types-BUO0JXO-.mjs +251 -0
- package/lib/{utils-D2YknRk4.mjs → utils-B-mTYQBc.mjs} +1 -1
- package/lib/{utils-C616y7eF.mjs → utils-D1QPFbRk.mjs} +28 -268
- package/lib/{utils-Cp76gCyk.mjs → utils-fnV2zzp3.mjs} +3 -3
- package/lib/{vision-guard-01qSwFpf.mjs → vision-guard-BsvOWmfB.mjs} +2 -2
- package/lib/{wafer-CgtPHerf.mjs → wafer-Dpy7tL3l.mjs} +1 -1
- package/lib/{xai-oauth-Buk8XVvM.mjs → xai-oauth-BkPNQS-q.mjs} +2 -2
- package/lib/{xiaomi-D2qT5cAC.mjs → xiaomi-CG3TsYRz.mjs} +1 -1
- package/lib/{zai-C59YnomG.mjs → zai--cewobzN.mjs} +2 -2
- package/lib/{zip-Cg9ANN_U.mjs → zip-CqKW2-TK.mjs} +3 -46
- package/package.json +147 -145
- package/presets/package.json +1 -1
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
3
|
import { n as fs_promises_shim_exports } from "./fs-promises-shim-Bx0fpxuk.mjs";
|
|
4
|
-
import { B as USER_AGENT, I as $flag, K as getDocumentConversionCacheDir, P as $env, R as isBunTestRuntime, S as debug, T as warn, W as getDebugLogPath,
|
|
5
|
-
import { V as ProviderHttpError, a as isTransientStatus } from "./error-
|
|
6
|
-
import "./utils-
|
|
4
|
+
import { B as USER_AGENT, I as $flag, K as getDocumentConversionCacheDir, P as $env, R as isBunTestRuntime, S as debug, T as warn, W as getDebugLogPath, Z as getToolsDir, c as combineSignals, d as $which, l as exec, r as TempDir, tt as untilAborted, y as isEnoent, z as isTerminalHeadless } from "./src-D_e1qMwi.mjs";
|
|
5
|
+
import { V as ProviderHttpError, a as isTransientStatus } from "./error-DoHuatWw.mjs";
|
|
6
|
+
import "./utils-fnV2zzp3.mjs";
|
|
7
7
|
import { n as isRecord } from "./type-guards-B9VVjRDK.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import "./
|
|
12
|
-
import
|
|
13
|
-
import "./
|
|
14
|
-
import "./
|
|
15
|
-
import
|
|
8
|
+
import { t as ToolAbortError } from "./tool-errors-DoyxivAR.mjs";
|
|
9
|
+
import { n as extractArchive } from "./zip-CqKW2-TK.mjs";
|
|
10
|
+
import { Et as parseAlibabaTokenPlanCredential, Tt as ALIBABA_TOKEN_PLAN_CN_BASE_URL, n as getEnvApiKey } from "./stream-DveNFWSN.mjs";
|
|
11
|
+
import { a as toNumber, i as toBoolean$1 } from "./utils-B-mTYQBc.mjs";
|
|
12
|
+
import "./identity-C0SPVyIZ.mjs";
|
|
13
|
+
import { n as OPENCODE_HEADERS } from "./github-copilot-qETlj_bD.mjs";
|
|
14
|
+
import "./vision-guard-BsvOWmfB.mjs";
|
|
15
|
+
import "./event-stream-C-FmBYUt.mjs";
|
|
16
|
+
import { i as claudeCodeVersion } from "./anthropic-DGXmmg43.mjs";
|
|
16
17
|
import { i as getGeminiCliHeaders, n as getAntigravityUserAgent } from "./gemini-headers-DKUShltF.mjs";
|
|
17
18
|
import { t as CODEX_BASE_URL } from "./codex-P1dGpX7G.mjs";
|
|
18
|
-
import { t as getKimiCommonHeaders } from "./kimi-
|
|
19
|
-
import "./anthropic-
|
|
20
|
-
import { n as extractCursorAccessTokenUserId } from "./cursor-
|
|
21
|
-
import { i as getXAICliBillingHeaders, n as extractXAIAccessTokenSubject, r as fetchXAIOAuthIdentity, t as buildXAICliBillingUrl } from "./xai-oauth-
|
|
22
|
-
import "./openai-codex-responses-
|
|
23
|
-
import "./azure-openai-responses-
|
|
24
|
-
import "./ollama-
|
|
25
|
-
import "./openai-completions-
|
|
26
|
-
import "./openai-responses-
|
|
19
|
+
import { t as getKimiCommonHeaders } from "./kimi-DHDO6Fde.mjs";
|
|
20
|
+
import "./anthropic-BVfZdnMp.mjs";
|
|
21
|
+
import { n as extractCursorAccessTokenUserId } from "./cursor-CQQtygwl.mjs";
|
|
22
|
+
import { i as getXAICliBillingHeaders, n as extractXAIAccessTokenSubject, r as fetchXAIOAuthIdentity, t as buildXAICliBillingUrl } from "./xai-oauth-BkPNQS-q.mjs";
|
|
23
|
+
import "./openai-codex-responses-C4uMpWNy.mjs";
|
|
24
|
+
import "./azure-openai-responses-C-5q-5K2.mjs";
|
|
25
|
+
import "./ollama-TrkXTNqE.mjs";
|
|
26
|
+
import "./openai-completions-1ydXm5vF.mjs";
|
|
27
|
+
import "./openai-responses-CN79gRGQ.mjs";
|
|
28
|
+
import { t as MAX_BYTES } from "./types-BUO0JXO-.mjs";
|
|
27
29
|
import * as path from "node:path";
|
|
28
30
|
import * as fs from "node:fs";
|
|
29
31
|
import { Ellipsis, Ellipsis as Ellipsis$1, extractSegments, matchesKey, sliceWithWidth, truncateToWidth } from "@oh-my-pi/pi-natives";
|
|
@@ -7096,6 +7098,8 @@ const OMP_KEY_TO_FIELD = {
|
|
|
7096
7098
|
"astGrep.enabled": "astGrepEnabled",
|
|
7097
7099
|
"astEdit.enabled": "astEditEnabled",
|
|
7098
7100
|
"fetch.enabled": "fetchEnabled",
|
|
7101
|
+
"providers.fetch": "fetchReader",
|
|
7102
|
+
"browser.readerEnabled": "browserReaderEnabled",
|
|
7099
7103
|
"tools.maxTimeout": "fetchMaxTimeoutSeconds",
|
|
7100
7104
|
"images.autoResize": "imagesAutoResize",
|
|
7101
7105
|
"images.blockImages": "imagesBlockImages",
|
|
@@ -7144,6 +7148,7 @@ const OMP_DEFAULTS = {
|
|
|
7144
7148
|
"images.resizeJpegQuality": 80,
|
|
7145
7149
|
"memory.backend": "off",
|
|
7146
7150
|
"providers.fetch": "auto",
|
|
7151
|
+
"browser.readerEnabled": true,
|
|
7147
7152
|
"searxng.endpoint": void 0,
|
|
7148
7153
|
"dev.autoqa": true,
|
|
7149
7154
|
"dev.autoqaConsent": void 0
|
|
@@ -7197,7 +7202,7 @@ const settings = {
|
|
|
7197
7202
|
};
|
|
7198
7203
|
//#endregion
|
|
7199
7204
|
//#region package.json
|
|
7200
|
-
var version = "0.1.0-beta.
|
|
7205
|
+
var version = "0.1.0-beta.6";
|
|
7201
7206
|
/** `.tmp` files older than this are treated as orphaned writes and swept. */
|
|
7202
7207
|
const TMP_ORPHAN_MAX_AGE_MS = 3e5;
|
|
7203
7208
|
function markitConversionCacheKey(bytes, extension) {
|
|
@@ -7331,7 +7336,7 @@ const CONVERTIBLE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
7331
7336
|
".epub"
|
|
7332
7337
|
]);
|
|
7333
7338
|
let markit = async () => {
|
|
7334
|
-
const promise = import("./markit-
|
|
7339
|
+
const promise = import("./markit-B9exZ0ZV.mjs").then(({ Markit }) => {
|
|
7335
7340
|
const instance = new Markit();
|
|
7336
7341
|
markit = () => instance;
|
|
7337
7342
|
return instance;
|
|
@@ -11981,251 +11986,6 @@ async function extractWithParallel(urls, options, storage) {
|
|
|
11981
11986
|
return parseExtractPayload(await parseParallelJsonResponse(response, "extract"));
|
|
11982
11987
|
}
|
|
11983
11988
|
//#endregion
|
|
11984
|
-
//#region src/tools/omp/web/scrapers/types.ts
|
|
11985
|
-
/**
|
|
11986
|
-
* Shared types and utilities for web-fetch handlers
|
|
11987
|
-
*/
|
|
11988
|
-
const MAX_OUTPUT_CHARS = 5e5;
|
|
11989
|
-
const MAX_BYTES = 52428800;
|
|
11990
|
-
const USER_AGENTS = [
|
|
11991
|
-
"curl/8.0",
|
|
11992
|
-
"Mozilla/5.0 (compatible; TextBot/1.0)",
|
|
11993
|
-
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
|
|
11994
|
-
];
|
|
11995
|
-
function isBotBlocked(status, content) {
|
|
11996
|
-
if (status === 403 || status === 503) {
|
|
11997
|
-
const lower = content.toLowerCase();
|
|
11998
|
-
return lower.includes("cloudflare") || lower.includes("captcha") || lower.includes("challenge") || lower.includes("blocked") || lower.includes("access denied") || lower.includes("bot detection");
|
|
11999
|
-
}
|
|
12000
|
-
return false;
|
|
12001
|
-
}
|
|
12002
|
-
/**
|
|
12003
|
-
* Truncate and cleanup output
|
|
12004
|
-
*/
|
|
12005
|
-
function finalizeOutput(content) {
|
|
12006
|
-
const cleaned = content.replace(/\n{3,}/g, "\n\n").trim();
|
|
12007
|
-
const truncated = cleaned.length > MAX_OUTPUT_CHARS;
|
|
12008
|
-
return {
|
|
12009
|
-
content: cleaned.slice(0, MAX_OUTPUT_CHARS),
|
|
12010
|
-
truncated
|
|
12011
|
-
};
|
|
12012
|
-
}
|
|
12013
|
-
const RETRY_AFTER_MAX_MS = 1e4;
|
|
12014
|
-
/** Parse a Retry-After header (seconds or HTTP-date) into a bounded delay. */
|
|
12015
|
-
function parseRetryAfterMs(value) {
|
|
12016
|
-
if (!value) return 1e3;
|
|
12017
|
-
const seconds = Number(value);
|
|
12018
|
-
if (Number.isFinite(seconds)) return Math.min(Math.max(seconds, 0) * 1e3, RETRY_AFTER_MAX_MS);
|
|
12019
|
-
const date = Date.parse(value);
|
|
12020
|
-
if (!Number.isNaN(date)) return Math.min(Math.max(date - Date.now(), 0), RETRY_AFTER_MAX_MS);
|
|
12021
|
-
return 1e3;
|
|
12022
|
-
}
|
|
12023
|
-
function charsetFromContentType(header) {
|
|
12024
|
-
return /charset\s*=\s*"?([\w-]+)"?/i.exec(header)?.[1];
|
|
12025
|
-
}
|
|
12026
|
-
/**
|
|
12027
|
-
* Decode a response body honoring the declared charset (Content-Type header,
|
|
12028
|
-
* then a cheap <meta charset> sniff), falling back to UTF-8.
|
|
12029
|
-
*/
|
|
12030
|
-
function decodeBody(bytes, contentTypeHeader) {
|
|
12031
|
-
let label = charsetFromContentType(contentTypeHeader);
|
|
12032
|
-
if (!label) label = /<meta[^>]+charset\s*=\s*["']?([\w-]+)/i.exec(bytes.subarray(0, 2048).toString("latin1"))?.[1];
|
|
12033
|
-
if (label && !/^utf-?8$/i.test(label)) try {
|
|
12034
|
-
return new TextDecoder(label).decode(bytes);
|
|
12035
|
-
} catch {}
|
|
12036
|
-
return bytes.toString("utf-8");
|
|
12037
|
-
}
|
|
12038
|
-
/**
|
|
12039
|
-
* Fetch a page with timeout and size limit
|
|
12040
|
-
*/
|
|
12041
|
-
async function loadPage(url, options = {}) {
|
|
12042
|
-
const { timeout = 20, headers = {}, maxBytes = MAX_BYTES, signal, method = "GET", body } = options;
|
|
12043
|
-
let lastError;
|
|
12044
|
-
let retried429 = false;
|
|
12045
|
-
for (let attempt = 0; attempt < USER_AGENTS.length; attempt++) {
|
|
12046
|
-
if (signal?.aborted) throw new ToolAbortError();
|
|
12047
|
-
const userAgent = USER_AGENTS[attempt];
|
|
12048
|
-
const requestSignal = combineSignals(signal, timeout * 1e3);
|
|
12049
|
-
try {
|
|
12050
|
-
const requestInit = {
|
|
12051
|
-
signal: requestSignal,
|
|
12052
|
-
method,
|
|
12053
|
-
headers: {
|
|
12054
|
-
"User-Agent": userAgent,
|
|
12055
|
-
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
|
12056
|
-
"Accept-Language": "en-US,en;q=0.5",
|
|
12057
|
-
"Accept-Encoding": "identity",
|
|
12058
|
-
...headers
|
|
12059
|
-
},
|
|
12060
|
-
redirect: "follow"
|
|
12061
|
-
};
|
|
12062
|
-
if (body !== void 0) requestInit.body = body;
|
|
12063
|
-
const response = await fetch(url, requestInit);
|
|
12064
|
-
const rawContentType = response.headers.get("content-type") ?? "";
|
|
12065
|
-
const contentType = rawContentType.split(";")[0]?.trim().toLowerCase() ?? "";
|
|
12066
|
-
const finalUrl = response.url;
|
|
12067
|
-
if (response.status === 429 && !retried429) {
|
|
12068
|
-
retried429 = true;
|
|
12069
|
-
const delayMs = parseRetryAfterMs(response.headers.get("retry-after"));
|
|
12070
|
-
response.body?.cancel().catch(() => {});
|
|
12071
|
-
try {
|
|
12072
|
-
await scheduler.wait(delayMs, { signal });
|
|
12073
|
-
} catch {
|
|
12074
|
-
throw new ToolAbortError();
|
|
12075
|
-
}
|
|
12076
|
-
attempt--;
|
|
12077
|
-
continue;
|
|
12078
|
-
}
|
|
12079
|
-
if (response.ok && options.skipBodyForContentType?.(contentType)) {
|
|
12080
|
-
response.body?.cancel().catch(() => {});
|
|
12081
|
-
return {
|
|
12082
|
-
content: "",
|
|
12083
|
-
contentType,
|
|
12084
|
-
finalUrl,
|
|
12085
|
-
ok: true,
|
|
12086
|
-
status: response.status,
|
|
12087
|
-
bodySkipped: true
|
|
12088
|
-
};
|
|
12089
|
-
}
|
|
12090
|
-
const reader = response.body?.getReader();
|
|
12091
|
-
if (!reader) return {
|
|
12092
|
-
content: "",
|
|
12093
|
-
contentType,
|
|
12094
|
-
finalUrl,
|
|
12095
|
-
ok: false,
|
|
12096
|
-
status: response.status
|
|
12097
|
-
};
|
|
12098
|
-
const chunks = [];
|
|
12099
|
-
let totalSize = 0;
|
|
12100
|
-
let truncated = false;
|
|
12101
|
-
while (true) {
|
|
12102
|
-
const { done, value } = await reader.read();
|
|
12103
|
-
if (done) break;
|
|
12104
|
-
chunks.push(value);
|
|
12105
|
-
totalSize += value.length;
|
|
12106
|
-
if (totalSize > maxBytes) {
|
|
12107
|
-
truncated = true;
|
|
12108
|
-
reader.cancel().catch(() => {});
|
|
12109
|
-
break;
|
|
12110
|
-
}
|
|
12111
|
-
}
|
|
12112
|
-
const content = decodeBody(Buffer.concat(chunks), rawContentType);
|
|
12113
|
-
if (isBotBlocked(response.status, content) && attempt < USER_AGENTS.length - 1) continue;
|
|
12114
|
-
if (!response.ok) return {
|
|
12115
|
-
content,
|
|
12116
|
-
contentType,
|
|
12117
|
-
finalUrl,
|
|
12118
|
-
ok: false,
|
|
12119
|
-
status: response.status,
|
|
12120
|
-
truncated
|
|
12121
|
-
};
|
|
12122
|
-
return {
|
|
12123
|
-
content,
|
|
12124
|
-
contentType,
|
|
12125
|
-
finalUrl,
|
|
12126
|
-
ok: true,
|
|
12127
|
-
status: response.status,
|
|
12128
|
-
truncated
|
|
12129
|
-
};
|
|
12130
|
-
} catch (error) {
|
|
12131
|
-
if (signal?.aborted) throw new ToolAbortError();
|
|
12132
|
-
lastError = error instanceof Error ? error.message : String(error);
|
|
12133
|
-
if (attempt === USER_AGENTS.length - 1) return {
|
|
12134
|
-
content: "",
|
|
12135
|
-
contentType: "",
|
|
12136
|
-
finalUrl: url,
|
|
12137
|
-
ok: false,
|
|
12138
|
-
error: lastError
|
|
12139
|
-
};
|
|
12140
|
-
}
|
|
12141
|
-
}
|
|
12142
|
-
return {
|
|
12143
|
-
content: "",
|
|
12144
|
-
contentType: "",
|
|
12145
|
-
finalUrl: url,
|
|
12146
|
-
ok: false,
|
|
12147
|
-
error: lastError
|
|
12148
|
-
};
|
|
12149
|
-
}
|
|
12150
|
-
/** Module-level Turndown instance — built lazily on first use. */
|
|
12151
|
-
let turndownPromise;
|
|
12152
|
-
function getTurndown() {
|
|
12153
|
-
turndownPromise ||= initTurndown();
|
|
12154
|
-
return turndownPromise;
|
|
12155
|
-
}
|
|
12156
|
-
async function initTurndown() {
|
|
12157
|
-
const { createTurndown } = await import("./turndown-DN7ByzEI.mjs").then((n) => n.r);
|
|
12158
|
-
return createTurndown();
|
|
12159
|
-
}
|
|
12160
|
-
/**
|
|
12161
|
-
* Convert HTML to markdown using Turndown with GFM support.
|
|
12162
|
-
* Strips script/style tags before conversion.
|
|
12163
|
-
*/
|
|
12164
|
-
async function htmlToBasicMarkdown(html) {
|
|
12165
|
-
const cleaned = html.replace(/<script[\s\S]*?<\/script>/gi, "").replace(/<style[\s\S]*?<\/style>/gi, "");
|
|
12166
|
-
return (await getTurndown()).turndown(cleaned).trim();
|
|
12167
|
-
}
|
|
12168
|
-
/**
|
|
12169
|
-
* Build a RenderResult from markdown content. Calls finalizeOutput internally.
|
|
12170
|
-
*/
|
|
12171
|
-
function buildResult(md, opts) {
|
|
12172
|
-
const output = finalizeOutput(md);
|
|
12173
|
-
return {
|
|
12174
|
-
url: opts.url,
|
|
12175
|
-
finalUrl: opts.finalUrl ?? opts.url,
|
|
12176
|
-
contentType: opts.contentType ?? "text/markdown",
|
|
12177
|
-
method: opts.method,
|
|
12178
|
-
content: output.content,
|
|
12179
|
-
fetchedAt: opts.fetchedAt,
|
|
12180
|
-
truncated: output.truncated,
|
|
12181
|
-
notes: opts.notes ?? []
|
|
12182
|
-
};
|
|
12183
|
-
}
|
|
12184
|
-
/**
|
|
12185
|
-
* Format a date value as YYYY-MM-DD. Returns empty string on invalid input.
|
|
12186
|
-
*/
|
|
12187
|
-
function formatIsoDate(value) {
|
|
12188
|
-
if (value == null) return "";
|
|
12189
|
-
if (typeof value === "string") {
|
|
12190
|
-
const datePrefix = value.match(/^\d{4}-\d{2}-\d{2}/);
|
|
12191
|
-
if (datePrefix) return datePrefix[0];
|
|
12192
|
-
}
|
|
12193
|
-
try {
|
|
12194
|
-
return new Date(value).toISOString().split("T")[0];
|
|
12195
|
-
} catch {
|
|
12196
|
-
return "";
|
|
12197
|
-
}
|
|
12198
|
-
}
|
|
12199
|
-
/**
|
|
12200
|
-
* Decode common HTML entities.
|
|
12201
|
-
*/
|
|
12202
|
-
function decodeHtmlEntities(text) {
|
|
12203
|
-
return text.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, "\"").replace(/�?39;/g, "'").replace(/'/g, "'").replace(///g, "/").replace(/ /g, " ");
|
|
12204
|
-
}
|
|
12205
|
-
/**
|
|
12206
|
-
* Format seconds into HH:MM:SS or MM:SS.
|
|
12207
|
-
*/
|
|
12208
|
-
function formatMediaDuration(totalSeconds) {
|
|
12209
|
-
const hours = Math.floor(totalSeconds / 3600);
|
|
12210
|
-
const minutes = Math.floor(totalSeconds % 3600 / 60);
|
|
12211
|
-
const secs = Math.floor(totalSeconds % 60);
|
|
12212
|
-
if (hours > 0) return `${hours}:${String(minutes).padStart(2, "0")}:${String(secs).padStart(2, "0")}`;
|
|
12213
|
-
return `${minutes}:${String(secs).padStart(2, "0")}`;
|
|
12214
|
-
}
|
|
12215
|
-
function getLocalizedText(value, defaultLocale) {
|
|
12216
|
-
if (value == null) return void 0;
|
|
12217
|
-
if (typeof value === "string") return value;
|
|
12218
|
-
if (defaultLocale && value[defaultLocale]) return value[defaultLocale];
|
|
12219
|
-
return value["en-US"] ?? value.en_US ?? value.en ?? Object.values(value).find((v) => typeof v === "string") ?? void 0;
|
|
12220
|
-
}
|
|
12221
|
-
/**
|
|
12222
|
-
* Check if content looks like HTML by inspecting the leading tag.
|
|
12223
|
-
*/
|
|
12224
|
-
function looksLikeHtml(content) {
|
|
12225
|
-
const trimmed = content.trim().toLowerCase();
|
|
12226
|
-
return trimmed.startsWith("<!doctype") || trimmed.startsWith("<html") || trimmed.startsWith("<head") || trimmed.startsWith("<body");
|
|
12227
|
-
}
|
|
12228
|
-
//#endregion
|
|
12229
11989
|
//#region src/tools/omp/web/scrapers/utils.ts
|
|
12230
11990
|
function asRecord(value) {
|
|
12231
11991
|
return isRecord(value) ? value : null;
|
|
@@ -12312,4 +12072,4 @@ async function convertWithMarkit(buffer, extension, timeout = 20, signal) {
|
|
|
12312
12072
|
return convertBufferWithMarkit(buffer, extension, combineSignals(signal, timeout * 1e3));
|
|
12313
12073
|
}
|
|
12314
12074
|
//#endregion
|
|
12315
|
-
export {
|
|
12075
|
+
export { truncateToWidth$1 as C, replaceTabs as S, formatCodeFrameLine as _, fetchBinary as a, LRUCache as b, getParallelExtractContent as c, convertFileWithMarkit as d, Settings as f, capParseErrors as g, OMP_DEFAULTS as h, convertWithMarkit as i, ensureTool as l, settings as m, asRecord as n, extractWithParallel as o, isSettingsInitialized as p, asString as r, findParallelApiKey as s, asNumber as t, CONVERTIBLE_EXTENSIONS as u, formatParseErrors as v, padding as x, shortenPath as y };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
|
-
import { I as $flag, P as $env, S as debug, g as parseStreamingJson, h as parseJsonWithRepair } from "./src-
|
|
4
|
-
import { r as ValidationError } from "./error-
|
|
5
|
-
import { t as preferredDialect } from "./identity-
|
|
3
|
+
import { I as $flag, P as $env, S as debug, g as parseStreamingJson, h as parseJsonWithRepair } from "./src-D_e1qMwi.mjs";
|
|
4
|
+
import { r as ValidationError } from "./error-DoHuatWw.mjs";
|
|
5
|
+
import { t as preferredDialect } from "./identity-C0SPVyIZ.mjs";
|
|
6
6
|
//#region node_modules/.pnpm/@oh-my-pi+pi-utils@17.3.5/node_modules/@oh-my-pi/pi-utils/src/json.ts
|
|
7
7
|
/**
|
|
8
8
|
* Try to parse JSON, returning null on failure.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
|
-
import { M as isDashscopeCompatibleModeUrl, S as isQwenModelId, x as isOpenAIModelId } from "./models-
|
|
4
|
-
import "./identity-
|
|
3
|
+
import { M as isDashscopeCompatibleModeUrl, S as isQwenModelId, x as isOpenAIModelId } from "./models-Cp3PzU3l.mjs";
|
|
4
|
+
import "./identity-C0SPVyIZ.mjs";
|
|
5
5
|
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@17.3.5/node_modules/@oh-my-pi/pi-ai/src/types.ts
|
|
6
6
|
/**
|
|
7
7
|
* Ceiling on the output-token count omp requests from any OpenAI-family endpoint
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
|
-
import { t as createApiKeyLogin } from "./api-key-login-
|
|
3
|
+
import { t as createApiKeyLogin } from "./api-key-login-BikQAfD-.mjs";
|
|
4
4
|
const loginWaferServerless = createApiKeyLogin({
|
|
5
5
|
providerLabel: "Wafer Serverless",
|
|
6
6
|
authUrl: "https://app.wafer.ai/usage",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
3
|
import { r as __exportAll } from "./fs-promises-shim-Bx0fpxuk.mjs";
|
|
4
|
-
import { c as OAuthError, h as LoginCancelledError } from "./error-
|
|
5
|
-
import { t as pollOAuthDeviceCodeFlow } from "./device-code-
|
|
4
|
+
import { c as OAuthError, h as LoginCancelledError } from "./error-DoHuatWw.mjs";
|
|
5
|
+
import { t as pollOAuthDeviceCodeFlow } from "./device-code-wZUbgPdB.mjs";
|
|
6
6
|
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@17.3.5/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/xai-oauth.ts
|
|
7
7
|
/**
|
|
8
8
|
* xAI Grok OAuth device authorization flow.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
|
-
import { _ as OnPromptRequiredError, c as OAuthError, h as LoginCancelledError, m as ApiKeyRequiredError } from "./error-
|
|
3
|
+
import { _ as OnPromptRequiredError, c as OAuthError, h as LoginCancelledError, m as ApiKeyRequiredError } from "./error-DoHuatWw.mjs";
|
|
4
4
|
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@17.3.5/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/xiaomi.ts
|
|
5
5
|
/**
|
|
6
6
|
* Xiaomi MiMo login flow.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
|
-
import { V as ProviderHttpError, c as OAuthError, h as LoginCancelledError } from "./error-
|
|
4
|
-
import { t as OAuthCallbackFlow } from "./callback-server-
|
|
3
|
+
import { V as ProviderHttpError, c as OAuthError, h as LoginCancelledError } from "./error-DoHuatWw.mjs";
|
|
4
|
+
import { t as OAuthCallbackFlow } from "./callback-server-Di6C4RqI.mjs";
|
|
5
5
|
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@17.3.5/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/zai.ts
|
|
6
6
|
/**
|
|
7
7
|
* Z.ai / GLM OAuth flow (GLM Coding Plan · Sign in)
|
|
@@ -1,52 +1,9 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
|
-
import { j as formatBytes } from "./src-
|
|
3
|
+
import { j as formatBytes } from "./src-D_e1qMwi.mjs";
|
|
4
|
+
import { n as ToolError } from "./tool-errors-DoyxivAR.mjs";
|
|
4
5
|
import * as path from "node:path";
|
|
5
6
|
import * as zlib from "node:zlib";
|
|
6
|
-
//#region src/tools/omp/tools/tool-errors.ts
|
|
7
|
-
/**
|
|
8
|
-
* Standardized error types for tool execution.
|
|
9
|
-
*
|
|
10
|
-
* Tools should throw these instead of returning error text.
|
|
11
|
-
* The agent loop catches and renders them appropriately.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Base error for tool execution failures.
|
|
15
|
-
* Override render() for custom LLM-facing formatting.
|
|
16
|
-
*/
|
|
17
|
-
var ToolError = class extends Error {
|
|
18
|
-
context;
|
|
19
|
-
constructor(message, context) {
|
|
20
|
-
super(message);
|
|
21
|
-
this.context = context;
|
|
22
|
-
this.name = "ToolError";
|
|
23
|
-
}
|
|
24
|
-
/** Render error for LLM consumption. Override for custom formatting. */
|
|
25
|
-
render() {
|
|
26
|
-
return this.message;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Error thrown when a tool operation is aborted (e.g., via AbortSignal).
|
|
31
|
-
*/
|
|
32
|
-
var ToolAbortError = class ToolAbortError extends Error {
|
|
33
|
-
static MESSAGE = "Operation aborted";
|
|
34
|
-
constructor(message = ToolAbortError.MESSAGE, options) {
|
|
35
|
-
super(message, options);
|
|
36
|
-
this.name = "ToolAbortError";
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Throw ToolAbortError if the signal is aborted.
|
|
41
|
-
* Use this instead of signal?.throwIfAborted() to get consistent error types.
|
|
42
|
-
*/
|
|
43
|
-
function throwIfAborted(signal) {
|
|
44
|
-
if (signal?.aborted) {
|
|
45
|
-
const reason = signal.reason instanceof Error ? signal.reason : void 0;
|
|
46
|
-
throw reason instanceof ToolAbortError ? reason : new ToolAbortError(void 0, { cause: signal.reason });
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
//#endregion
|
|
50
7
|
//#region src/tools/omp/utils/zip.ts
|
|
51
8
|
const ENCODER = new TextEncoder();
|
|
52
9
|
const UTF8_DECODER = new TextDecoder();
|
|
@@ -1313,4 +1270,4 @@ function extractZipMember(bytes, storage, uncompressedSize) {
|
|
|
1313
1270
|
return decodeZipMember(readMemoryRange(bytes, dataStart, dataStart + storage.compressedSize), storage.compression, uncompressedSize);
|
|
1314
1271
|
}
|
|
1315
1272
|
//#endregion
|
|
1316
|
-
export { openArchive as a, sniffArchiveFormat as c, writeArchive as d,
|
|
1273
|
+
export { openArchive as a, sniffArchiveFormat as c, writeArchive as d, listArchiveRoot as i, unzip as l, extractArchive as n, parseArchivePathCandidates as o, formatArchiveEntryLines as r, readArchiveEntries as s, archiveFormatFromPath as t, unzipText as u };
|