binary-collections 2.0.13 → 2.0.15
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/.opencode/plugins/opencode-request-logger/README.md +44 -0
- package/.venv/Lib/site-packages/pyarrow/tests/data/orc/README.md +22 -0
- package/binaries/binary-executor.cjs +307 -238
- package/binaries/clean-nodemodule.cjs +307 -238
- package/binaries/clean-nodemodules.cjs +307 -238
- package/binaries/composer.cjs +323 -0
- package/binaries/composer.cmd +2 -0
- package/binaries/composer.phar +0 -0
- package/binaries/dev.cjs +307 -238
- package/binaries/empty.cjs +307 -238
- package/binaries/git-reduce-size.cjs +307 -238
- package/binaries/javakill.cjs +307 -238
- package/binaries/kill-process.cjs +307 -238
- package/binaries/nodekill.cjs +307 -238
- package/binaries/prod.cjs +307 -238
- package/binaries/py.cjs +307 -238
- package/binaries/rmfind.cjs +307 -238
- package/binaries/rmx.cjs +307 -238
- package/binaries/submodule-token.cjs +307 -238
- package/binaries/test-cjs.cjs +307 -238
- package/binaries/test-esm.cjs +307 -238
- package/binaries/yarn-clean.cjs +307 -238
- package/binaries/yc.cjs +307 -238
- package/binaries/ycw.cjs +307 -238
- package/docs-src/binary-collections.md +1 -1
- package/docs-src/clean-github-actions-caches.md +1 -1
- package/docs-src/copy-move-file.md +1 -4
- package/docs-src/del-ps.md +1 -1
- package/docs-src/find-node-modules.md +1 -1
- package/docs-src/generate-test-ci.md +56 -0
- package/docs-src/get-latest-workflow-status.md +100 -0
- package/docs-src/git-diff.md +1 -1
- package/docs-src/git-fix.md +1 -1
- package/docs-src/git-purge.md +1 -1
- package/docs-src/install-opencode-plugins.md +86 -0
- package/docs-src/kill-night-crows.md +1 -1
- package/docs-src/node-cache-cleaner.md +2 -2
- package/docs-src/node-package-packer.md +1 -1
- package/docs-src/opencode-cli.md +155 -0
- package/docs-src/package-resolutions-updater.md +1 -1
- package/docs-src/rmpath.md +1 -1
- package/docs-src/run-by-checksum.md +1 -1
- package/docs-src/submodule-remove.md +1 -1
- package/docs-src/upload-backend.md +29 -0
- package/docs-src/vscode-cli.md +84 -0
- package/docs-src/workflow-badge.md +120 -0
- package/lib/binary-collections/config-types.cjs +17 -0
- package/lib/binary-collections/config-types.d.ts +12 -0
- package/lib/binary-collections/config-types.js +2 -0
- package/lib/binary-collections/config-types.mjs +7 -0
- package/lib/binary-collections/config.cjs +28 -8
- package/lib/binary-collections/config.d.cts +26 -8
- package/lib/binary-collections/config.mjs +2 -2
- package/lib/binary-collections/findScript.cjs +49 -25
- package/lib/binary-collections/findScript.mjs +2 -2
- package/lib/binary-collections/listScript.cjs +49 -25
- package/lib/binary-collections/listScript.mjs +2 -2
- package/lib/binary-collections.cjs +49 -25
- package/lib/binary-collections.mjs +6 -6
- package/lib/changelog.cjs +142 -4
- package/lib/changelog.mjs +9 -5
- package/lib/chunk-3T6AMFI3.mjs +52 -0
- package/lib/{chunk-2MN4VPV2.mjs → chunk-3ZF2QMDK.mjs} +4 -4
- package/lib/chunk-56BVU63B.mjs +86 -0
- package/lib/chunk-7N52Z4IJ.mjs +39 -0
- package/lib/chunk-B77D3SR4.mjs +28 -0
- package/lib/chunk-BPED62FN.mjs +115 -0
- package/lib/{chunk-RDN6HF5Z.mjs → chunk-DHFRWM2W.mjs} +1 -1
- package/lib/chunk-DPEE3FBB.mjs +146 -0
- package/lib/{chunk-MGPYPKIE.mjs → chunk-H7AE4IO3.mjs} +5 -1
- package/lib/{chunk-H44UWUFY.mjs → chunk-J4M5EL5P.mjs} +3 -0
- package/lib/chunk-KCJYREA2.mjs +67 -0
- package/lib/chunk-LACQTD5V.mjs +225 -0
- package/lib/{chunk-TBWXE7ST.mjs → chunk-NHD4HLSU.mjs} +24 -31
- package/lib/{chunk-RDGDLSPD.mjs → chunk-OWNVMKAA.mjs} +6 -5
- package/lib/chunk-SKVF4TMD.mjs +59 -0
- package/lib/{chunk-BZWVHODJ.mjs → chunk-TDUUOAQD.mjs} +5 -5
- package/lib/chunk-TP3O2JGW.mjs +88 -0
- package/lib/{chunk-FLYSZFLW.mjs → chunk-UAEKSLAX.mjs} +1 -1
- package/lib/chunk-UDZBVKXH.mjs +94 -0
- package/lib/chunk-UEOWRYAN.mjs +32 -0
- package/lib/chunk-V6PTSDW5.mjs +82 -0
- package/lib/{chunk-NQXUYO67.mjs → chunk-WNUEY6VJ.mjs} +49 -25
- package/lib/chunk-X7UVQ6ZC.mjs +183 -0
- package/lib/chunk-XW5NZAKI.mjs +82 -0
- package/lib/{chunk-LVSPEFU2.mjs → chunk-Z53IUBUN.mjs} +6 -5
- package/lib/{chunk-CD3HF3LK.mjs → chunk-Z7RM46Q4.mjs} +5 -11
- package/lib/chunk-ZB4IQ6VJ.mjs +46 -0
- package/lib/del-gradle.cjs +1 -1
- package/lib/del-gradle.mjs +22 -16
- package/lib/del-node-modules.cjs +1 -1
- package/lib/del-node-modules.mjs +148 -142
- package/lib/find-node-modules-cli.cjs +1 -1
- package/lib/find-node-modules-cli.mjs +10 -4
- package/lib/{git-diff-cli.cjs → git/git-diff-cli.cjs} +32 -12
- package/lib/{git-diff-cli.mjs → git/git-diff-cli.mjs} +7 -7
- package/lib/{git-diff.cjs → git/git-diff.cjs} +30 -10
- package/lib/{git-diff.js → git/git-diff.js} +3 -3
- package/lib/{git-diff.mjs → git/git-diff.mjs} +6 -6
- package/lib/{git-fix.cjs → git/git-fix.cjs} +142 -3
- package/lib/{git-fix.mjs → git/git-fix.mjs} +19 -14
- package/lib/{git-purge.cjs → git/git-purge.cjs} +1 -1
- package/lib/{git-purge.mjs → git/git-purge.mjs} +4 -4
- package/lib/git/user-config.cjs +139 -1
- package/lib/git/user-config.mjs +3 -1
- package/lib/{clean-github-actions-caches-cli.cjs → github-workflows/clean-github-actions-caches-cli.cjs} +46 -10
- package/lib/{clean-github-actions-caches-cli.mjs → github-workflows/clean-github-actions-caches-cli.mjs} +7 -6
- package/lib/{clean-github-actions-caches.cjs → github-workflows/clean-github-actions-caches.cjs} +46 -10
- package/lib/{clean-github-actions-caches.mjs → github-workflows/clean-github-actions-caches.mjs} +5 -4
- package/lib/github-workflows/generate-test-ci-step-cli.cjs +240 -0
- package/lib/github-workflows/generate-test-ci-step-cli.d.mts +2 -0
- package/lib/github-workflows/generate-test-ci-step-cli.mjs +132 -0
- package/lib/github-workflows/get-latest-workflow-status-cli.cjs +549 -0
- package/lib/github-workflows/get-latest-workflow-status-cli.d.mts +2 -0
- package/lib/github-workflows/get-latest-workflow-status-cli.mjs +61 -0
- package/lib/github-workflows/get-latest-workflow-status.cjs +56 -0
- package/lib/github-workflows/get-latest-workflow-status.d.mts +1 -0
- package/lib/github-workflows/get-latest-workflow-status.mjs +8 -0
- package/lib/github-workflows/utils.cjs +279 -0
- package/lib/github-workflows/utils.d.cts +76 -0
- package/lib/github-workflows/utils.mjs +8 -0
- package/lib/github-workflows/workflow-badge-cli.cjs +730 -0
- package/lib/github-workflows/workflow-badge-cli.d.mts +2 -0
- package/lib/github-workflows/workflow-badge-cli.mjs +98 -0
- package/lib/github-workflows/workflow-badge-generator.cjs +200 -0
- package/lib/github-workflows/workflow-badge-generator.d.mts +14 -0
- package/lib/github-workflows/workflow-badge-generator.mjs +8 -0
- package/lib/github-workflows/workflow-test-data.cjs +73 -0
- package/lib/github-workflows/workflow-test-data.d.cts +63 -0
- package/lib/github-workflows/workflow-test-data.mjs +6 -0
- package/lib/node-cache-cleaner-cli.mjs +3 -3
- package/lib/opencode/cli/auth-rotate.cjs +458 -0
- package/lib/opencode/cli/auth-rotate.d.ts +3 -0
- package/lib/opencode/cli/auth-rotate.js +65 -0
- package/lib/opencode/cli/auth-rotate.mjs +14 -0
- package/lib/opencode/cli/auth-rotate.runner.cjs +454 -0
- package/lib/opencode/cli/auth-rotate.runner.d.ts +1 -0
- package/lib/opencode/cli/auth-rotate.runner.js +8 -0
- package/lib/opencode/cli/auth-rotate.runner.mjs +21 -0
- package/lib/opencode/cli/list-projects.cjs +184 -0
- package/lib/opencode/cli/list-projects.d.ts +1 -0
- package/lib/opencode/cli/list-projects.js +32 -0
- package/lib/opencode/cli/list-projects.mjs +11 -0
- package/lib/opencode/cli/list-sessions.cjs +215 -0
- package/lib/opencode/cli/list-sessions.d.ts +1 -0
- package/lib/opencode/cli/list-sessions.js +45 -0
- package/lib/opencode/cli/list-sessions.mjs +11 -0
- package/lib/opencode/database.cjs +349 -0
- package/lib/opencode/database.d.ts +91 -0
- package/lib/opencode/database.js +252 -0
- package/lib/opencode/database.mjs +28 -0
- package/lib/opencode/database.runner.cjs +145 -0
- package/lib/opencode/database.runner.d.ts +1 -0
- package/lib/opencode/database.runner.js +56 -0
- package/lib/opencode/database.runner.mjs +37 -0
- package/lib/opencode/install-opencode-plugins-cli.cjs +82 -0
- package/lib/opencode/install-opencode-plugins-cli.d.ts +1 -0
- package/lib/opencode/install-opencode-plugins-cli.js +78 -0
- package/lib/opencode/install-opencode-plugins-cli.mjs +65 -0
- package/lib/opencode/opencode-zen.runner.cjs +48 -0
- package/lib/opencode/opencode-zen.runner.d.mts +1 -0
- package/lib/opencode/opencode-zen.runner.mjs +31 -0
- package/lib/opencode/sqlite.cjs +114 -0
- package/lib/opencode/sqlite.d.ts +18 -0
- package/lib/opencode/sqlite.js +82 -0
- package/lib/opencode/sqlite.mjs +10 -0
- package/lib/opencode/storage.cjs +124 -0
- package/lib/opencode/storage.d.ts +27 -0
- package/lib/opencode/storage.js +101 -0
- package/lib/opencode/storage.mjs +38 -0
- package/lib/opencode/storage.runner.cjs +50 -0
- package/lib/opencode/storage.runner.d.ts +1 -0
- package/lib/opencode/storage.runner.js +13 -0
- package/lib/opencode/storage.runner.mjs +29 -0
- package/lib/opencode/types.cjs +17 -0
- package/lib/opencode/types.d.ts +31 -0
- package/lib/opencode/types.js +2 -0
- package/lib/opencode/types.mjs +7 -0
- package/lib/opencode/utils/check-api.cjs +373 -0
- package/lib/opencode/utils/check-api.d.ts +16 -0
- package/lib/opencode/utils/check-api.js +132 -0
- package/lib/opencode/utils/check-api.mjs +12 -0
- package/lib/opencode/utils/check-api.runner.cjs +0 -0
- package/lib/opencode/utils/check-api.runner.d.ts +0 -0
- package/lib/opencode/utils/check-api.runner.js +1 -0
- package/lib/opencode/utils/check-api.runner.mjs +7 -0
- package/lib/opencode-cli.cjs +796 -0
- package/lib/opencode-cli.d.ts +2 -0
- package/lib/opencode-cli.js +116 -0
- package/lib/opencode-cli.mjs +116 -0
- package/lib/package-resolutions-updater-cli.cjs +189 -154
- package/lib/package-resolutions-updater-cli.mjs +3 -2
- package/lib/package-resolutions-updater.cjs +189 -154
- package/lib/package-resolutions-updater.d.mts +12 -3
- package/lib/package-resolutions-updater.mjs +3 -2
- package/lib/print-directory-tree.cjs +139 -3
- package/lib/print-directory-tree.mjs +6 -3
- package/lib/print-tarball-tree-cli.cjs +305 -0
- package/lib/print-tarball-tree-cli.d.mts +2 -0
- package/lib/print-tarball-tree-cli.mjs +54 -0
- package/lib/print-tarball-tree.cjs +43 -216
- package/lib/print-tarball-tree.d.mts +4 -1
- package/lib/print-tarball-tree.mjs +12 -66
- package/lib/rmpath-cli.cjs +139 -5
- package/lib/rmpath-cli.mjs +3 -1
- package/lib/rmpath.cjs +155 -11
- package/lib/rmpath.mjs +3 -1
- package/lib/run-by-checksum/hash.cjs +50 -56
- package/lib/run-by-checksum/hash.d.cts +24 -0
- package/lib/run-by-checksum/hash.mjs +3 -7
- package/lib/run-by-checksum/run.cjs +95 -42
- package/lib/run-by-checksum/run.js +3 -3
- package/lib/run-by-checksum/run.mjs +2 -2
- package/lib/run-by-checksum-cli.cjs +96 -58
- package/lib/run-by-checksum-cli.mjs +2 -2
- package/lib/submodule-install.cjs +138 -4
- package/lib/submodule-install.mjs +5 -4
- package/lib/submodule-remove-cli.cjs +139 -5
- package/lib/submodule-remove-cli.mjs +3 -1
- package/lib/submodule-remove.cjs +154 -5
- package/lib/submodule-remove.mjs +3 -1
- package/lib/utils/findEnvFiles.cjs +3 -0
- package/lib/utils/findEnvFiles.d.cts +2 -2
- package/lib/utils/findEnvFiles.mjs +1 -1
- package/lib/utils/isDebug.cjs +13 -0
- package/lib/utils/isDebug.d.cts +9 -0
- package/lib/utils/isDebug.mjs +6 -0
- package/lib/vscode/project.cjs +0 -0
- package/lib/vscode/project.d.ts +0 -0
- package/lib/vscode/project.js +1 -0
- package/lib/vscode/project.mjs +7 -0
- package/lib/vscode/storage.cjs +138 -0
- package/lib/vscode/storage.d.ts +51 -0
- package/lib/vscode/storage.js +169 -0
- package/lib/vscode/storage.mjs +42 -0
- package/lib/vscode/storage.runner.cjs +125 -0
- package/lib/vscode/storage.runner.d.ts +1 -0
- package/lib/vscode/storage.runner.js +47 -0
- package/lib/vscode/storage.runner.mjs +60 -0
- package/lib/vscode-cli.cjs +155 -0
- package/lib/vscode-cli.d.ts +2 -0
- package/lib/vscode-cli.js +80 -0
- package/lib/vscode-cli.mjs +71 -0
- package/package.json +50 -26
- package/readme.md +104 -8
- package/releases/readme.md +1 -1
- package/src/github-workflows/generate-test-ci-step-cli.mjs +126 -0
- package/vendor/clue/ndjson-react/README.md +365 -0
- package/vendor/composer/pcre/README.md +189 -0
- package/vendor/composer/semver/README.md +99 -0
- package/vendor/composer/xdebug-handler/README.md +305 -0
- package/vendor/ergebnis/agent-detector/README.md +107 -0
- package/vendor/evenement/evenement/README.md +64 -0
- package/vendor/fidry/cpu-core-counter/README.md +138 -0
- package/vendor/friendsofphp/php-cs-fixer/README.md +97 -0
- package/vendor/psr/container/README.md +13 -0
- package/vendor/psr/event-dispatcher/README.md +6 -0
- package/vendor/psr/log/README.md +58 -0
- package/vendor/react/cache/README.md +367 -0
- package/vendor/react/child-process/README.md +619 -0
- package/vendor/react/dns/README.md +453 -0
- package/vendor/react/event-loop/README.md +930 -0
- package/vendor/react/promise/README.md +722 -0
- package/vendor/react/socket/README.md +1564 -0
- package/vendor/react/stream/README.md +1249 -0
- package/vendor/sebastian/diff/README.md +151 -0
- package/vendor/symfony/console/README.md +30 -0
- package/vendor/symfony/deprecation-contracts/README.md +26 -0
- package/vendor/symfony/event-dispatcher/README.md +25 -0
- package/vendor/symfony/event-dispatcher-contracts/README.md +9 -0
- package/vendor/symfony/filesystem/README.md +23 -0
- package/vendor/symfony/finder/README.md +24 -0
- package/vendor/symfony/options-resolver/README.md +25 -0
- package/vendor/symfony/polyfill-ctype/README.md +12 -0
- package/vendor/symfony/polyfill-intl-grapheme/README.md +32 -0
- package/vendor/symfony/polyfill-intl-normalizer/README.md +14 -0
- package/vendor/symfony/polyfill-mbstring/README.md +13 -0
- package/vendor/symfony/polyfill-php80/README.md +25 -0
- package/vendor/symfony/polyfill-php81/README.md +18 -0
- package/vendor/symfony/polyfill-php84/README.md +23 -0
- package/vendor/symfony/polyfill-php85/README.md +20 -0
- package/vendor/symfony/process/README.md +23 -0
- package/vendor/symfony/service-contracts/README.md +9 -0
- package/vendor/symfony/stopwatch/README.md +52 -0
- package/vendor/symfony/string/README.md +24 -0
- package/lib/chunk-WSHVPGNM.mjs +0 -44
- package/lib/chunk-X2B3X7D4.mjs +0 -35
- package/lib/del-gradle.js +0 -16
- package/lib/del-node-modules.js +0 -211
- package/lib/find-node-modules-cli.js +0 -4
- package/lib/run-by-checksum/hash.d.ts +0 -14
- package/lib/run-by-checksum/hash.js +0 -85
- package/readme.html +0 -784
- /package/lib/{clean-github-actions-caches-cli.d.cts → del-gradle.d.cts} +0 -0
- /package/lib/{del-gradle.d.ts → del-node-modules.d.cts} +0 -0
- /package/lib/{find-node-modules-cli.d.ts → find-node-modules-cli.d.cts} +0 -0
- /package/lib/{git-diff-cli.d.ts → git/git-diff-cli.d.ts} +0 -0
- /package/lib/{git-diff-cli.js → git/git-diff-cli.js} +0 -0
- /package/lib/{git-diff.d.ts → git/git-diff.d.ts} +0 -0
- /package/lib/{git-fix.d.cts → git/git-fix.d.cts} +0 -0
- /package/lib/{git-purge.d.cts → git/git-purge.d.cts} +0 -0
- /package/lib/{del-node-modules.d.ts → github-workflows/clean-github-actions-caches-cli.d.cts} +0 -0
- /package/lib/{clean-github-actions-caches.d.cts → github-workflows/clean-github-actions-caches.d.cts} +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether the OpenCode API returns a non-empty response for a given prompt.
|
|
3
|
+
*
|
|
4
|
+
* Sends a chat completion request and returns `true` when the model produces
|
|
5
|
+
* meaningful output (non-empty `content` or `reasoning_content`).
|
|
6
|
+
*
|
|
7
|
+
* @param prompt - The user message to send to the model.
|
|
8
|
+
* @param apiKey - Bearer token for API authentication.
|
|
9
|
+
* @param model - Model identifier (defaults to `'deepseek-v4-flash-free'`).
|
|
10
|
+
* @param proxyUrl - Optional proxy URL. e.g: `http://127.0.0.1:8080, https://127.0.0.1:8443, socks4://127.0.0.1:1080, socks5://127.0.0.1:1080, socks5://user:pass@127.0.0.1:1080`
|
|
11
|
+
* @returns `true` if the response contains non-empty content, `false` otherwise.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* await checkOpenCodeApi('Hello', apiKey, 'deepseek-v4-flash-free', 'socks5://127.0.0.1:1080');
|
|
15
|
+
*/
|
|
16
|
+
export declare function checkOpenCodeApi(prompt: string, apiKey: string, model?: string, proxyUrl?: string): Promise<boolean>;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.checkOpenCodeApi = checkOpenCodeApi;
|
|
16
|
+
const axios_1 = __importDefault(require("axios"));
|
|
17
|
+
const sbg_utility_1 = require("sbg-utility");
|
|
18
|
+
const config_cjs_1 = require("../../binary-collections/config.cjs");
|
|
19
|
+
const isDebug_cjs_1 = require("../../utils/isDebug.cjs");
|
|
20
|
+
const hash_cjs_1 = require("../../run-by-checksum/hash.cjs");
|
|
21
|
+
const proxy_agent_1 = require("proxy-agent");
|
|
22
|
+
function getProxyUrl(proxyUrl) {
|
|
23
|
+
return (proxyUrl ||
|
|
24
|
+
process.env.OPENCODE_PROXY ||
|
|
25
|
+
process.env.ALL_PROXY ||
|
|
26
|
+
process.env.all_proxy ||
|
|
27
|
+
process.env.HTTPS_PROXY ||
|
|
28
|
+
process.env.https_proxy ||
|
|
29
|
+
process.env.HTTP_PROXY ||
|
|
30
|
+
process.env.http_proxy);
|
|
31
|
+
}
|
|
32
|
+
function maskProxyUrl(proxyUrl) {
|
|
33
|
+
try {
|
|
34
|
+
const url = new URL(proxyUrl);
|
|
35
|
+
if (url.username || url.password) {
|
|
36
|
+
url.username = '***';
|
|
37
|
+
url.password = '***';
|
|
38
|
+
}
|
|
39
|
+
return url.toString();
|
|
40
|
+
}
|
|
41
|
+
catch (_a) {
|
|
42
|
+
return proxyUrl.replace(/:\/\/.*@/, '://***@');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Checks whether the OpenCode API returns a non-empty response for a given prompt.
|
|
47
|
+
*
|
|
48
|
+
* Sends a chat completion request and returns `true` when the model produces
|
|
49
|
+
* meaningful output (non-empty `content` or `reasoning_content`).
|
|
50
|
+
*
|
|
51
|
+
* @param prompt - The user message to send to the model.
|
|
52
|
+
* @param apiKey - Bearer token for API authentication.
|
|
53
|
+
* @param model - Model identifier (defaults to `'deepseek-v4-flash-free'`).
|
|
54
|
+
* @param proxyUrl - Optional proxy URL. e.g: `http://127.0.0.1:8080, https://127.0.0.1:8443, socks4://127.0.0.1:1080, socks5://127.0.0.1:1080, socks5://user:pass@127.0.0.1:1080`
|
|
55
|
+
* @returns `true` if the response contains non-empty content, `false` otherwise.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* await checkOpenCodeApi('Hello', apiKey, 'deepseek-v4-flash-free', 'socks5://127.0.0.1:1080');
|
|
59
|
+
*/
|
|
60
|
+
function checkOpenCodeApi(prompt_1, apiKey_1) {
|
|
61
|
+
return __awaiter(this, arguments, void 0, function* (prompt, apiKey, model = 'deepseek-v4-flash-free', proxyUrl) {
|
|
62
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
63
|
+
const debug = (0, isDebug_cjs_1.isDebug)();
|
|
64
|
+
const resolvedProxyUrl = getProxyUrl(proxyUrl);
|
|
65
|
+
let proxyAgent;
|
|
66
|
+
if (resolvedProxyUrl) {
|
|
67
|
+
const proxyUrlValue = resolvedProxyUrl;
|
|
68
|
+
proxyAgent = new proxy_agent_1.ProxyAgent({
|
|
69
|
+
getProxyForUrl: () => proxyUrlValue
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
if (debug && resolvedProxyUrl) {
|
|
74
|
+
console.log(`Using proxy: ${maskProxyUrl(resolvedProxyUrl)}`);
|
|
75
|
+
}
|
|
76
|
+
const res = yield axios_1.default.post('https://opencode.ai/zen/v1/chat/completions', {
|
|
77
|
+
model,
|
|
78
|
+
messages: [{ role: 'user', content: prompt }],
|
|
79
|
+
max_tokens: 512
|
|
80
|
+
}, {
|
|
81
|
+
headers: {
|
|
82
|
+
Authorization: `Bearer ${apiKey}`,
|
|
83
|
+
'Content-Type': 'application/json'
|
|
84
|
+
},
|
|
85
|
+
validateStatus: () => true,
|
|
86
|
+
timeout: 30000,
|
|
87
|
+
proxy: false,
|
|
88
|
+
httpAgent: proxyAgent,
|
|
89
|
+
httpsAgent: proxyAgent
|
|
90
|
+
});
|
|
91
|
+
if (debug) {
|
|
92
|
+
console.log('OpenCode status:', res.status);
|
|
93
|
+
}
|
|
94
|
+
const filePath = (0, config_cjs_1.getTempPath)('logs', `opencode-api-check-${(0, hash_cjs_1.sha256)(apiKey)}.json`);
|
|
95
|
+
if (debug) {
|
|
96
|
+
(0, sbg_utility_1.writefile)(filePath, JSON.stringify(res.data, null, 2));
|
|
97
|
+
console.log(`OpenCode API check response dumped to: ${filePath}`);
|
|
98
|
+
}
|
|
99
|
+
const errorType = (_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.type;
|
|
100
|
+
if (res.status === 429 && errorType === 'FreeUsageLimitError') {
|
|
101
|
+
if (debug) {
|
|
102
|
+
console.warn('OpenCode API rate limit exceeded. Skipping this key.');
|
|
103
|
+
}
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if (res.status < 200 || res.status >= 300) {
|
|
107
|
+
if (debug) {
|
|
108
|
+
console.error('OpenCode API returned non-2xx response:', res.data);
|
|
109
|
+
}
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
const message = (_e = (_d = (_c = res.data) === null || _c === void 0 ? void 0 : _c.choices) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.message;
|
|
113
|
+
const output = (message === null || message === void 0 ? void 0 : message.content) || (message === null || message === void 0 ? void 0 : message.reasoning_content);
|
|
114
|
+
return Boolean(output && output.trim().length > 0);
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
if (debug) {
|
|
118
|
+
console.error('OpenCode API check failed');
|
|
119
|
+
if (axios_1.default.isAxiosError(err)) {
|
|
120
|
+
console.error('Message:', err.message);
|
|
121
|
+
console.error('Code:', err.code);
|
|
122
|
+
console.error('Status:', (_f = err.response) === null || _f === void 0 ? void 0 : _f.status);
|
|
123
|
+
console.error('Response:', (_g = err.response) === null || _g === void 0 ? void 0 : _g.data);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
console.error(err);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
checkOpenCodeApi
|
|
4
|
+
} from "../../chunk-BPED62FN.mjs";
|
|
5
|
+
import "../../chunk-B77D3SR4.mjs";
|
|
6
|
+
import "../../chunk-V6PTSDW5.mjs";
|
|
7
|
+
import "../../chunk-3T6AMFI3.mjs";
|
|
8
|
+
import "../../chunk-J4M5EL5P.mjs";
|
|
9
|
+
import "../../chunk-QQ4A6DLD.mjs";
|
|
10
|
+
export {
|
|
11
|
+
checkOpenCodeApi
|
|
12
|
+
};
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|