swixter 0.1.6 → 0.1.9
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.md +21 -0
- package/dist/cli/index.js +1314 -195
- package/package.json +3 -11
package/dist/cli/index.js
CHANGED
|
@@ -47,7 +47,7 @@ var __export = (target, all) => {
|
|
|
47
47
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
48
48
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
49
49
|
|
|
50
|
-
// node_modules/picocolors/picocolors.js
|
|
50
|
+
// ../../node_modules/picocolors/picocolors.js
|
|
51
51
|
var require_picocolors = __commonJS((exports, module) => {
|
|
52
52
|
var p = process || {};
|
|
53
53
|
var argv = p.argv || [];
|
|
@@ -117,7 +117,7 @@ var require_picocolors = __commonJS((exports, module) => {
|
|
|
117
117
|
module.exports.createColors = createColors;
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
-
// node_modules/sisteransi/src/index.js
|
|
120
|
+
// ../../node_modules/sisteransi/src/index.js
|
|
121
121
|
var require_src = __commonJS((exports, module) => {
|
|
122
122
|
var ESC = "\x1B";
|
|
123
123
|
var CSI = `${ESC}[`;
|
|
@@ -175,7 +175,7 @@ var require_src = __commonJS((exports, module) => {
|
|
|
175
175
|
module.exports = { cursor, scroll, erase, beep };
|
|
176
176
|
});
|
|
177
177
|
|
|
178
|
-
// node_modules/@clack/core/dist/index.mjs
|
|
178
|
+
// ../../node_modules/@clack/core/dist/index.mjs
|
|
179
179
|
import { stdin as j, stdout as M } from "node:process";
|
|
180
180
|
import * as g from "node:readline";
|
|
181
181
|
import O from "node:readline";
|
|
@@ -632,7 +632,7 @@ var init_dist = __esm(() => {
|
|
|
632
632
|
};
|
|
633
633
|
});
|
|
634
634
|
|
|
635
|
-
// node_modules/@clack/prompts/dist/index.mjs
|
|
635
|
+
// ../../node_modules/@clack/prompts/dist/index.mjs
|
|
636
636
|
import y2 from "node:process";
|
|
637
637
|
function ce() {
|
|
638
638
|
return y2.platform !== "win32" ? y2.env.TERM !== "linux" : !!y2.env.CI || !!y2.env.WT_SESSION || !!y2.env.TERMINUS_SUBLIME || y2.env.ConEmuTask === "{cmd::Cmder}" || y2.env.TERM_PROGRAM === "Terminus-Sublime" || y2.env.TERM_PROGRAM === "vscode" || y2.env.TERM === "xterm-256color" || y2.env.TERM === "alacritty" || y2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
@@ -880,7 +880,7 @@ var init_dist2 = __esm(() => {
|
|
|
880
880
|
J2 = `${import_picocolors2.default.gray(o)} `;
|
|
881
881
|
});
|
|
882
882
|
|
|
883
|
-
// node_modules/zod/v4/core/core.js
|
|
883
|
+
// ../../node_modules/zod/v4/core/core.js
|
|
884
884
|
function $constructor(name, initializer, params) {
|
|
885
885
|
function init(inst, def) {
|
|
886
886
|
var _a;
|
|
@@ -949,7 +949,7 @@ var init_core = __esm(() => {
|
|
|
949
949
|
globalConfig = {};
|
|
950
950
|
});
|
|
951
951
|
|
|
952
|
-
// node_modules/zod/v4/core/util.js
|
|
952
|
+
// ../../node_modules/zod/v4/core/util.js
|
|
953
953
|
var exports_util = {};
|
|
954
954
|
__export(exports_util, {
|
|
955
955
|
unwrapMessage: () => unwrapMessage,
|
|
@@ -1580,7 +1580,7 @@ var init_util = __esm(() => {
|
|
|
1580
1580
|
};
|
|
1581
1581
|
});
|
|
1582
1582
|
|
|
1583
|
-
// node_modules/zod/v4/core/errors.js
|
|
1583
|
+
// ../../node_modules/zod/v4/core/errors.js
|
|
1584
1584
|
function flattenError(error, mapper = (issue2) => issue2.message) {
|
|
1585
1585
|
const fieldErrors = {};
|
|
1586
1586
|
const formErrors = [];
|
|
@@ -1721,7 +1721,7 @@ var init_errors = __esm(() => {
|
|
|
1721
1721
|
$ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
|
|
1722
1722
|
});
|
|
1723
1723
|
|
|
1724
|
-
// node_modules/zod/v4/core/parse.js
|
|
1724
|
+
// ../../node_modules/zod/v4/core/parse.js
|
|
1725
1725
|
var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
1726
1726
|
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
1727
1727
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -1803,7 +1803,7 @@ var init_parse = __esm(() => {
|
|
|
1803
1803
|
safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
1804
1804
|
});
|
|
1805
1805
|
|
|
1806
|
-
// node_modules/zod/v4/core/regexes.js
|
|
1806
|
+
// ../../node_modules/zod/v4/core/regexes.js
|
|
1807
1807
|
var exports_regexes = {};
|
|
1808
1808
|
__export(exports_regexes, {
|
|
1809
1809
|
xid: () => xid,
|
|
@@ -1954,7 +1954,7 @@ var init_regexes = __esm(() => {
|
|
|
1954
1954
|
sha512_base64url = /* @__PURE__ */ fixedBase64url(86);
|
|
1955
1955
|
});
|
|
1956
1956
|
|
|
1957
|
-
// node_modules/zod/v4/core/checks.js
|
|
1957
|
+
// ../../node_modules/zod/v4/core/checks.js
|
|
1958
1958
|
function handleCheckPropertyResult(result, payload, property) {
|
|
1959
1959
|
if (result.issues.length) {
|
|
1960
1960
|
payload.issues.push(...prefixIssues(property, result.issues));
|
|
@@ -2501,7 +2501,7 @@ var init_checks = __esm(() => {
|
|
|
2501
2501
|
});
|
|
2502
2502
|
});
|
|
2503
2503
|
|
|
2504
|
-
// node_modules/zod/v4/core/doc.js
|
|
2504
|
+
// ../../node_modules/zod/v4/core/doc.js
|
|
2505
2505
|
class Doc {
|
|
2506
2506
|
constructor(args = []) {
|
|
2507
2507
|
this.content = [];
|
|
@@ -2539,7 +2539,7 @@ class Doc {
|
|
|
2539
2539
|
}
|
|
2540
2540
|
}
|
|
2541
2541
|
|
|
2542
|
-
// node_modules/zod/v4/core/versions.js
|
|
2542
|
+
// ../../node_modules/zod/v4/core/versions.js
|
|
2543
2543
|
var version;
|
|
2544
2544
|
var init_versions = __esm(() => {
|
|
2545
2545
|
version = {
|
|
@@ -2549,7 +2549,7 @@ var init_versions = __esm(() => {
|
|
|
2549
2549
|
};
|
|
2550
2550
|
});
|
|
2551
2551
|
|
|
2552
|
-
// node_modules/zod/v4/core/schemas.js
|
|
2552
|
+
// ../../node_modules/zod/v4/core/schemas.js
|
|
2553
2553
|
function isValidBase64(data) {
|
|
2554
2554
|
if (data === "")
|
|
2555
2555
|
return true;
|
|
@@ -4396,7 +4396,7 @@ var init_schemas = __esm(() => {
|
|
|
4396
4396
|
});
|
|
4397
4397
|
});
|
|
4398
4398
|
|
|
4399
|
-
// node_modules/zod/v4/locales/ar.js
|
|
4399
|
+
// ../../node_modules/zod/v4/locales/ar.js
|
|
4400
4400
|
function ar_default() {
|
|
4401
4401
|
return {
|
|
4402
4402
|
localeError: error()
|
|
@@ -4516,7 +4516,7 @@ var init_ar = __esm(() => {
|
|
|
4516
4516
|
init_util();
|
|
4517
4517
|
});
|
|
4518
4518
|
|
|
4519
|
-
// node_modules/zod/v4/locales/az.js
|
|
4519
|
+
// ../../node_modules/zod/v4/locales/az.js
|
|
4520
4520
|
function az_default() {
|
|
4521
4521
|
return {
|
|
4522
4522
|
localeError: error2()
|
|
@@ -4635,7 +4635,7 @@ var init_az = __esm(() => {
|
|
|
4635
4635
|
init_util();
|
|
4636
4636
|
});
|
|
4637
4637
|
|
|
4638
|
-
// node_modules/zod/v4/locales/be.js
|
|
4638
|
+
// ../../node_modules/zod/v4/locales/be.js
|
|
4639
4639
|
function getBelarusianPlural(count, one, few, many) {
|
|
4640
4640
|
const absCount = Math.abs(count);
|
|
4641
4641
|
const lastDigit = absCount % 10;
|
|
@@ -4803,7 +4803,7 @@ var init_be = __esm(() => {
|
|
|
4803
4803
|
init_util();
|
|
4804
4804
|
});
|
|
4805
4805
|
|
|
4806
|
-
// node_modules/zod/v4/locales/bg.js
|
|
4806
|
+
// ../../node_modules/zod/v4/locales/bg.js
|
|
4807
4807
|
function bg_default() {
|
|
4808
4808
|
return {
|
|
4809
4809
|
localeError: error4()
|
|
@@ -4934,7 +4934,7 @@ var init_bg = __esm(() => {
|
|
|
4934
4934
|
init_util();
|
|
4935
4935
|
});
|
|
4936
4936
|
|
|
4937
|
-
// node_modules/zod/v4/locales/ca.js
|
|
4937
|
+
// ../../node_modules/zod/v4/locales/ca.js
|
|
4938
4938
|
function ca_default() {
|
|
4939
4939
|
return {
|
|
4940
4940
|
localeError: error5()
|
|
@@ -5055,7 +5055,7 @@ var init_ca = __esm(() => {
|
|
|
5055
5055
|
init_util();
|
|
5056
5056
|
});
|
|
5057
5057
|
|
|
5058
|
-
// node_modules/zod/v4/locales/cs.js
|
|
5058
|
+
// ../../node_modules/zod/v4/locales/cs.js
|
|
5059
5059
|
function cs_default() {
|
|
5060
5060
|
return {
|
|
5061
5061
|
localeError: error6()
|
|
@@ -5194,7 +5194,7 @@ var init_cs = __esm(() => {
|
|
|
5194
5194
|
init_util();
|
|
5195
5195
|
});
|
|
5196
5196
|
|
|
5197
|
-
// node_modules/zod/v4/locales/da.js
|
|
5197
|
+
// ../../node_modules/zod/v4/locales/da.js
|
|
5198
5198
|
function da_default() {
|
|
5199
5199
|
return {
|
|
5200
5200
|
localeError: error7()
|
|
@@ -5329,7 +5329,7 @@ var init_da = __esm(() => {
|
|
|
5329
5329
|
init_util();
|
|
5330
5330
|
});
|
|
5331
5331
|
|
|
5332
|
-
// node_modules/zod/v4/locales/de.js
|
|
5332
|
+
// ../../node_modules/zod/v4/locales/de.js
|
|
5333
5333
|
function de_default() {
|
|
5334
5334
|
return {
|
|
5335
5335
|
localeError: error8()
|
|
@@ -5449,7 +5449,7 @@ var init_de = __esm(() => {
|
|
|
5449
5449
|
init_util();
|
|
5450
5450
|
});
|
|
5451
5451
|
|
|
5452
|
-
// node_modules/zod/v4/locales/en.js
|
|
5452
|
+
// ../../node_modules/zod/v4/locales/en.js
|
|
5453
5453
|
function en_default() {
|
|
5454
5454
|
return {
|
|
5455
5455
|
localeError: error9()
|
|
@@ -5569,7 +5569,7 @@ var init_en = __esm(() => {
|
|
|
5569
5569
|
init_util();
|
|
5570
5570
|
});
|
|
5571
5571
|
|
|
5572
|
-
// node_modules/zod/v4/locales/eo.js
|
|
5572
|
+
// ../../node_modules/zod/v4/locales/eo.js
|
|
5573
5573
|
function eo_default() {
|
|
5574
5574
|
return {
|
|
5575
5575
|
localeError: error10()
|
|
@@ -5688,7 +5688,7 @@ var init_eo = __esm(() => {
|
|
|
5688
5688
|
init_util();
|
|
5689
5689
|
});
|
|
5690
5690
|
|
|
5691
|
-
// node_modules/zod/v4/locales/es.js
|
|
5691
|
+
// ../../node_modules/zod/v4/locales/es.js
|
|
5692
5692
|
function es_default() {
|
|
5693
5693
|
return {
|
|
5694
5694
|
localeError: error11()
|
|
@@ -5840,7 +5840,7 @@ var init_es = __esm(() => {
|
|
|
5840
5840
|
init_util();
|
|
5841
5841
|
});
|
|
5842
5842
|
|
|
5843
|
-
// node_modules/zod/v4/locales/fa.js
|
|
5843
|
+
// ../../node_modules/zod/v4/locales/fa.js
|
|
5844
5844
|
function fa_default() {
|
|
5845
5845
|
return {
|
|
5846
5846
|
localeError: error12()
|
|
@@ -5966,7 +5966,7 @@ var init_fa = __esm(() => {
|
|
|
5966
5966
|
init_util();
|
|
5967
5967
|
});
|
|
5968
5968
|
|
|
5969
|
-
// node_modules/zod/v4/locales/fi.js
|
|
5969
|
+
// ../../node_modules/zod/v4/locales/fi.js
|
|
5970
5970
|
function fi_default() {
|
|
5971
5971
|
return {
|
|
5972
5972
|
localeError: error13()
|
|
@@ -6092,7 +6092,7 @@ var init_fi = __esm(() => {
|
|
|
6092
6092
|
init_util();
|
|
6093
6093
|
});
|
|
6094
6094
|
|
|
6095
|
-
// node_modules/zod/v4/locales/fr.js
|
|
6095
|
+
// ../../node_modules/zod/v4/locales/fr.js
|
|
6096
6096
|
function fr_default() {
|
|
6097
6097
|
return {
|
|
6098
6098
|
localeError: error14()
|
|
@@ -6212,7 +6212,7 @@ var init_fr = __esm(() => {
|
|
|
6212
6212
|
init_util();
|
|
6213
6213
|
});
|
|
6214
6214
|
|
|
6215
|
-
// node_modules/zod/v4/locales/fr-CA.js
|
|
6215
|
+
// ../../node_modules/zod/v4/locales/fr-CA.js
|
|
6216
6216
|
function fr_CA_default() {
|
|
6217
6217
|
return {
|
|
6218
6218
|
localeError: error15()
|
|
@@ -6333,7 +6333,7 @@ var init_fr_CA = __esm(() => {
|
|
|
6333
6333
|
init_util();
|
|
6334
6334
|
});
|
|
6335
6335
|
|
|
6336
|
-
// node_modules/zod/v4/locales/he.js
|
|
6336
|
+
// ../../node_modules/zod/v4/locales/he.js
|
|
6337
6337
|
function he_default() {
|
|
6338
6338
|
return {
|
|
6339
6339
|
localeError: error16()
|
|
@@ -6453,7 +6453,7 @@ var init_he = __esm(() => {
|
|
|
6453
6453
|
init_util();
|
|
6454
6454
|
});
|
|
6455
6455
|
|
|
6456
|
-
// node_modules/zod/v4/locales/hu.js
|
|
6456
|
+
// ../../node_modules/zod/v4/locales/hu.js
|
|
6457
6457
|
function hu_default() {
|
|
6458
6458
|
return {
|
|
6459
6459
|
localeError: error17()
|
|
@@ -6573,7 +6573,7 @@ var init_hu = __esm(() => {
|
|
|
6573
6573
|
init_util();
|
|
6574
6574
|
});
|
|
6575
6575
|
|
|
6576
|
-
// node_modules/zod/v4/locales/id.js
|
|
6576
|
+
// ../../node_modules/zod/v4/locales/id.js
|
|
6577
6577
|
function id_default() {
|
|
6578
6578
|
return {
|
|
6579
6579
|
localeError: error18()
|
|
@@ -6693,7 +6693,7 @@ var init_id = __esm(() => {
|
|
|
6693
6693
|
init_util();
|
|
6694
6694
|
});
|
|
6695
6695
|
|
|
6696
|
-
// node_modules/zod/v4/locales/is.js
|
|
6696
|
+
// ../../node_modules/zod/v4/locales/is.js
|
|
6697
6697
|
function is_default() {
|
|
6698
6698
|
return {
|
|
6699
6699
|
localeError: error19()
|
|
@@ -6813,7 +6813,7 @@ var init_is = __esm(() => {
|
|
|
6813
6813
|
init_util();
|
|
6814
6814
|
});
|
|
6815
6815
|
|
|
6816
|
-
// node_modules/zod/v4/locales/it.js
|
|
6816
|
+
// ../../node_modules/zod/v4/locales/it.js
|
|
6817
6817
|
function it_default() {
|
|
6818
6818
|
return {
|
|
6819
6819
|
localeError: error20()
|
|
@@ -6933,7 +6933,7 @@ var init_it = __esm(() => {
|
|
|
6933
6933
|
init_util();
|
|
6934
6934
|
});
|
|
6935
6935
|
|
|
6936
|
-
// node_modules/zod/v4/locales/ja.js
|
|
6936
|
+
// ../../node_modules/zod/v4/locales/ja.js
|
|
6937
6937
|
function ja_default() {
|
|
6938
6938
|
return {
|
|
6939
6939
|
localeError: error21()
|
|
@@ -7052,7 +7052,7 @@ var init_ja = __esm(() => {
|
|
|
7052
7052
|
init_util();
|
|
7053
7053
|
});
|
|
7054
7054
|
|
|
7055
|
-
// node_modules/zod/v4/locales/ka.js
|
|
7055
|
+
// ../../node_modules/zod/v4/locales/ka.js
|
|
7056
7056
|
function ka_default() {
|
|
7057
7057
|
return {
|
|
7058
7058
|
localeError: error22()
|
|
@@ -7180,7 +7180,7 @@ var init_ka = __esm(() => {
|
|
|
7180
7180
|
init_util();
|
|
7181
7181
|
});
|
|
7182
7182
|
|
|
7183
|
-
// node_modules/zod/v4/locales/km.js
|
|
7183
|
+
// ../../node_modules/zod/v4/locales/km.js
|
|
7184
7184
|
function km_default() {
|
|
7185
7185
|
return {
|
|
7186
7186
|
localeError: error23()
|
|
@@ -7301,7 +7301,7 @@ var init_km = __esm(() => {
|
|
|
7301
7301
|
init_util();
|
|
7302
7302
|
});
|
|
7303
7303
|
|
|
7304
|
-
// node_modules/zod/v4/locales/kh.js
|
|
7304
|
+
// ../../node_modules/zod/v4/locales/kh.js
|
|
7305
7305
|
function kh_default() {
|
|
7306
7306
|
return km_default();
|
|
7307
7307
|
}
|
|
@@ -7309,7 +7309,7 @@ var init_kh = __esm(() => {
|
|
|
7309
7309
|
init_km();
|
|
7310
7310
|
});
|
|
7311
7311
|
|
|
7312
|
-
// node_modules/zod/v4/locales/ko.js
|
|
7312
|
+
// ../../node_modules/zod/v4/locales/ko.js
|
|
7313
7313
|
function ko_default() {
|
|
7314
7314
|
return {
|
|
7315
7315
|
localeError: error24()
|
|
@@ -7434,7 +7434,7 @@ var init_ko = __esm(() => {
|
|
|
7434
7434
|
init_util();
|
|
7435
7435
|
});
|
|
7436
7436
|
|
|
7437
|
-
// node_modules/zod/v4/locales/lt.js
|
|
7437
|
+
// ../../node_modules/zod/v4/locales/lt.js
|
|
7438
7438
|
function getUnitTypeFromNumber(number2) {
|
|
7439
7439
|
const abs = Math.abs(number2);
|
|
7440
7440
|
const last = abs % 10;
|
|
@@ -7664,7 +7664,7 @@ var init_lt = __esm(() => {
|
|
|
7664
7664
|
init_util();
|
|
7665
7665
|
});
|
|
7666
7666
|
|
|
7667
|
-
// node_modules/zod/v4/locales/mk.js
|
|
7667
|
+
// ../../node_modules/zod/v4/locales/mk.js
|
|
7668
7668
|
function mk_default() {
|
|
7669
7669
|
return {
|
|
7670
7670
|
localeError: error26()
|
|
@@ -7785,7 +7785,7 @@ var init_mk = __esm(() => {
|
|
|
7785
7785
|
init_util();
|
|
7786
7786
|
});
|
|
7787
7787
|
|
|
7788
|
-
// node_modules/zod/v4/locales/ms.js
|
|
7788
|
+
// ../../node_modules/zod/v4/locales/ms.js
|
|
7789
7789
|
function ms_default() {
|
|
7790
7790
|
return {
|
|
7791
7791
|
localeError: error27()
|
|
@@ -7905,7 +7905,7 @@ var init_ms = __esm(() => {
|
|
|
7905
7905
|
init_util();
|
|
7906
7906
|
});
|
|
7907
7907
|
|
|
7908
|
-
// node_modules/zod/v4/locales/nl.js
|
|
7908
|
+
// ../../node_modules/zod/v4/locales/nl.js
|
|
7909
7909
|
function nl_default() {
|
|
7910
7910
|
return {
|
|
7911
7911
|
localeError: error28()
|
|
@@ -8026,7 +8026,7 @@ var init_nl = __esm(() => {
|
|
|
8026
8026
|
init_util();
|
|
8027
8027
|
});
|
|
8028
8028
|
|
|
8029
|
-
// node_modules/zod/v4/locales/no.js
|
|
8029
|
+
// ../../node_modules/zod/v4/locales/no.js
|
|
8030
8030
|
function no_default() {
|
|
8031
8031
|
return {
|
|
8032
8032
|
localeError: error29()
|
|
@@ -8146,7 +8146,7 @@ var init_no = __esm(() => {
|
|
|
8146
8146
|
init_util();
|
|
8147
8147
|
});
|
|
8148
8148
|
|
|
8149
|
-
// node_modules/zod/v4/locales/ota.js
|
|
8149
|
+
// ../../node_modules/zod/v4/locales/ota.js
|
|
8150
8150
|
function ota_default() {
|
|
8151
8151
|
return {
|
|
8152
8152
|
localeError: error30()
|
|
@@ -8266,7 +8266,7 @@ var init_ota = __esm(() => {
|
|
|
8266
8266
|
init_util();
|
|
8267
8267
|
});
|
|
8268
8268
|
|
|
8269
|
-
// node_modules/zod/v4/locales/ps.js
|
|
8269
|
+
// ../../node_modules/zod/v4/locales/ps.js
|
|
8270
8270
|
function ps_default() {
|
|
8271
8271
|
return {
|
|
8272
8272
|
localeError: error31()
|
|
@@ -8392,7 +8392,7 @@ var init_ps = __esm(() => {
|
|
|
8392
8392
|
init_util();
|
|
8393
8393
|
});
|
|
8394
8394
|
|
|
8395
|
-
// node_modules/zod/v4/locales/pl.js
|
|
8395
|
+
// ../../node_modules/zod/v4/locales/pl.js
|
|
8396
8396
|
function pl_default() {
|
|
8397
8397
|
return {
|
|
8398
8398
|
localeError: error32()
|
|
@@ -8513,7 +8513,7 @@ var init_pl = __esm(() => {
|
|
|
8513
8513
|
init_util();
|
|
8514
8514
|
});
|
|
8515
8515
|
|
|
8516
|
-
// node_modules/zod/v4/locales/pt.js
|
|
8516
|
+
// ../../node_modules/zod/v4/locales/pt.js
|
|
8517
8517
|
function pt_default() {
|
|
8518
8518
|
return {
|
|
8519
8519
|
localeError: error33()
|
|
@@ -8633,7 +8633,7 @@ var init_pt = __esm(() => {
|
|
|
8633
8633
|
init_util();
|
|
8634
8634
|
});
|
|
8635
8635
|
|
|
8636
|
-
// node_modules/zod/v4/locales/ru.js
|
|
8636
|
+
// ../../node_modules/zod/v4/locales/ru.js
|
|
8637
8637
|
function getRussianPlural(count, one, few, many) {
|
|
8638
8638
|
const absCount = Math.abs(count);
|
|
8639
8639
|
const lastDigit = absCount % 10;
|
|
@@ -8801,7 +8801,7 @@ var init_ru = __esm(() => {
|
|
|
8801
8801
|
init_util();
|
|
8802
8802
|
});
|
|
8803
8803
|
|
|
8804
|
-
// node_modules/zod/v4/locales/sl.js
|
|
8804
|
+
// ../../node_modules/zod/v4/locales/sl.js
|
|
8805
8805
|
function sl_default() {
|
|
8806
8806
|
return {
|
|
8807
8807
|
localeError: error35()
|
|
@@ -8922,7 +8922,7 @@ var init_sl = __esm(() => {
|
|
|
8922
8922
|
init_util();
|
|
8923
8923
|
});
|
|
8924
8924
|
|
|
8925
|
-
// node_modules/zod/v4/locales/sv.js
|
|
8925
|
+
// ../../node_modules/zod/v4/locales/sv.js
|
|
8926
8926
|
function sv_default() {
|
|
8927
8927
|
return {
|
|
8928
8928
|
localeError: error36()
|
|
@@ -9044,7 +9044,7 @@ var init_sv = __esm(() => {
|
|
|
9044
9044
|
init_util();
|
|
9045
9045
|
});
|
|
9046
9046
|
|
|
9047
|
-
// node_modules/zod/v4/locales/ta.js
|
|
9047
|
+
// ../../node_modules/zod/v4/locales/ta.js
|
|
9048
9048
|
function ta_default() {
|
|
9049
9049
|
return {
|
|
9050
9050
|
localeError: error37()
|
|
@@ -9165,7 +9165,7 @@ var init_ta = __esm(() => {
|
|
|
9165
9165
|
init_util();
|
|
9166
9166
|
});
|
|
9167
9167
|
|
|
9168
|
-
// node_modules/zod/v4/locales/th.js
|
|
9168
|
+
// ../../node_modules/zod/v4/locales/th.js
|
|
9169
9169
|
function th_default() {
|
|
9170
9170
|
return {
|
|
9171
9171
|
localeError: error38()
|
|
@@ -9286,7 +9286,7 @@ var init_th = __esm(() => {
|
|
|
9286
9286
|
init_util();
|
|
9287
9287
|
});
|
|
9288
9288
|
|
|
9289
|
-
// node_modules/zod/v4/locales/tr.js
|
|
9289
|
+
// ../../node_modules/zod/v4/locales/tr.js
|
|
9290
9290
|
function tr_default() {
|
|
9291
9291
|
return {
|
|
9292
9292
|
localeError: error39()
|
|
@@ -9404,7 +9404,7 @@ var init_tr = __esm(() => {
|
|
|
9404
9404
|
init_util();
|
|
9405
9405
|
});
|
|
9406
9406
|
|
|
9407
|
-
// node_modules/zod/v4/locales/uk.js
|
|
9407
|
+
// ../../node_modules/zod/v4/locales/uk.js
|
|
9408
9408
|
function uk_default() {
|
|
9409
9409
|
return {
|
|
9410
9410
|
localeError: error40()
|
|
@@ -9524,7 +9524,7 @@ var init_uk = __esm(() => {
|
|
|
9524
9524
|
init_util();
|
|
9525
9525
|
});
|
|
9526
9526
|
|
|
9527
|
-
// node_modules/zod/v4/locales/ua.js
|
|
9527
|
+
// ../../node_modules/zod/v4/locales/ua.js
|
|
9528
9528
|
function ua_default() {
|
|
9529
9529
|
return uk_default();
|
|
9530
9530
|
}
|
|
@@ -9532,7 +9532,7 @@ var init_ua = __esm(() => {
|
|
|
9532
9532
|
init_uk();
|
|
9533
9533
|
});
|
|
9534
9534
|
|
|
9535
|
-
// node_modules/zod/v4/locales/ur.js
|
|
9535
|
+
// ../../node_modules/zod/v4/locales/ur.js
|
|
9536
9536
|
function ur_default() {
|
|
9537
9537
|
return {
|
|
9538
9538
|
localeError: error41()
|
|
@@ -9653,7 +9653,7 @@ var init_ur = __esm(() => {
|
|
|
9653
9653
|
init_util();
|
|
9654
9654
|
});
|
|
9655
9655
|
|
|
9656
|
-
// node_modules/zod/v4/locales/vi.js
|
|
9656
|
+
// ../../node_modules/zod/v4/locales/vi.js
|
|
9657
9657
|
function vi_default() {
|
|
9658
9658
|
return {
|
|
9659
9659
|
localeError: error42()
|
|
@@ -9773,7 +9773,7 @@ var init_vi = __esm(() => {
|
|
|
9773
9773
|
init_util();
|
|
9774
9774
|
});
|
|
9775
9775
|
|
|
9776
|
-
// node_modules/zod/v4/locales/zh-CN.js
|
|
9776
|
+
// ../../node_modules/zod/v4/locales/zh-CN.js
|
|
9777
9777
|
function zh_CN_default() {
|
|
9778
9778
|
return {
|
|
9779
9779
|
localeError: error43()
|
|
@@ -9893,7 +9893,7 @@ var init_zh_CN = __esm(() => {
|
|
|
9893
9893
|
init_util();
|
|
9894
9894
|
});
|
|
9895
9895
|
|
|
9896
|
-
// node_modules/zod/v4/locales/zh-TW.js
|
|
9896
|
+
// ../../node_modules/zod/v4/locales/zh-TW.js
|
|
9897
9897
|
function zh_TW_default() {
|
|
9898
9898
|
return {
|
|
9899
9899
|
localeError: error44()
|
|
@@ -10014,7 +10014,7 @@ var init_zh_TW = __esm(() => {
|
|
|
10014
10014
|
init_util();
|
|
10015
10015
|
});
|
|
10016
10016
|
|
|
10017
|
-
// node_modules/zod/v4/locales/yo.js
|
|
10017
|
+
// ../../node_modules/zod/v4/locales/yo.js
|
|
10018
10018
|
function yo_default() {
|
|
10019
10019
|
return {
|
|
10020
10020
|
localeError: error45()
|
|
@@ -10133,7 +10133,7 @@ var init_yo = __esm(() => {
|
|
|
10133
10133
|
init_util();
|
|
10134
10134
|
});
|
|
10135
10135
|
|
|
10136
|
-
// node_modules/zod/v4/locales/index.js
|
|
10136
|
+
// ../../node_modules/zod/v4/locales/index.js
|
|
10137
10137
|
var exports_locales = {};
|
|
10138
10138
|
__export(exports_locales, {
|
|
10139
10139
|
zhTW: () => zh_TW_default,
|
|
@@ -10234,7 +10234,7 @@ var init_locales = __esm(() => {
|
|
|
10234
10234
|
init_yo();
|
|
10235
10235
|
});
|
|
10236
10236
|
|
|
10237
|
-
// node_modules/zod/v4/core/registries.js
|
|
10237
|
+
// ../../node_modules/zod/v4/core/registries.js
|
|
10238
10238
|
class $ZodRegistry {
|
|
10239
10239
|
constructor() {
|
|
10240
10240
|
this._map = new WeakMap;
|
|
@@ -10288,7 +10288,7 @@ var init_registries = __esm(() => {
|
|
|
10288
10288
|
globalRegistry = /* @__PURE__ */ registry();
|
|
10289
10289
|
});
|
|
10290
10290
|
|
|
10291
|
-
// node_modules/zod/v4/core/api.js
|
|
10291
|
+
// ../../node_modules/zod/v4/core/api.js
|
|
10292
10292
|
function _string(Class2, params) {
|
|
10293
10293
|
return new Class2({
|
|
10294
10294
|
type: "string",
|
|
@@ -11173,7 +11173,7 @@ var init_api = __esm(() => {
|
|
|
11173
11173
|
};
|
|
11174
11174
|
});
|
|
11175
11175
|
|
|
11176
|
-
// node_modules/zod/v4/core/to-json-schema.js
|
|
11176
|
+
// ../../node_modules/zod/v4/core/to-json-schema.js
|
|
11177
11177
|
class JSONSchemaGenerator {
|
|
11178
11178
|
constructor(params) {
|
|
11179
11179
|
this.counter = 0;
|
|
@@ -11511,7 +11511,7 @@ class JSONSchemaGenerator {
|
|
|
11511
11511
|
if (val === undefined) {
|
|
11512
11512
|
if (this.unrepresentable === "throw") {
|
|
11513
11513
|
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
11514
|
-
}
|
|
11514
|
+
}
|
|
11515
11515
|
} else if (typeof val === "bigint") {
|
|
11516
11516
|
if (this.unrepresentable === "throw") {
|
|
11517
11517
|
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
@@ -11982,11 +11982,11 @@ var init_to_json_schema = __esm(() => {
|
|
|
11982
11982
|
init_util();
|
|
11983
11983
|
});
|
|
11984
11984
|
|
|
11985
|
-
// node_modules/zod/v4/core/json-schema.js
|
|
11985
|
+
// ../../node_modules/zod/v4/core/json-schema.js
|
|
11986
11986
|
var exports_json_schema = {};
|
|
11987
11987
|
var init_json_schema = () => {};
|
|
11988
11988
|
|
|
11989
|
-
// node_modules/zod/v4/core/index.js
|
|
11989
|
+
// ../../node_modules/zod/v4/core/index.js
|
|
11990
11990
|
var exports_core2 = {};
|
|
11991
11991
|
__export(exports_core2, {
|
|
11992
11992
|
version: () => version,
|
|
@@ -12265,12 +12265,12 @@ var init_core2 = __esm(() => {
|
|
|
12265
12265
|
init_to_json_schema();
|
|
12266
12266
|
});
|
|
12267
12267
|
|
|
12268
|
-
// node_modules/zod/v4/classic/checks.js
|
|
12268
|
+
// ../../node_modules/zod/v4/classic/checks.js
|
|
12269
12269
|
var init_checks2 = __esm(() => {
|
|
12270
12270
|
init_core2();
|
|
12271
12271
|
});
|
|
12272
12272
|
|
|
12273
|
-
// node_modules/zod/v4/classic/iso.js
|
|
12273
|
+
// ../../node_modules/zod/v4/classic/iso.js
|
|
12274
12274
|
var exports_iso = {};
|
|
12275
12275
|
__export(exports_iso, {
|
|
12276
12276
|
time: () => time2,
|
|
@@ -12316,7 +12316,7 @@ var init_iso = __esm(() => {
|
|
|
12316
12316
|
});
|
|
12317
12317
|
});
|
|
12318
12318
|
|
|
12319
|
-
// node_modules/zod/v4/classic/errors.js
|
|
12319
|
+
// ../../node_modules/zod/v4/classic/errors.js
|
|
12320
12320
|
var initializer2 = (inst, issues) => {
|
|
12321
12321
|
$ZodError.init(inst, issues);
|
|
12322
12322
|
inst.name = "ZodError";
|
|
@@ -12356,7 +12356,7 @@ var init_errors2 = __esm(() => {
|
|
|
12356
12356
|
});
|
|
12357
12357
|
});
|
|
12358
12358
|
|
|
12359
|
-
// node_modules/zod/v4/classic/parse.js
|
|
12359
|
+
// ../../node_modules/zod/v4/classic/parse.js
|
|
12360
12360
|
var parse3, parseAsync2, safeParse2, safeParseAsync2, encode2, decode2, encodeAsync2, decodeAsync2, safeEncode2, safeDecode2, safeEncodeAsync2, safeDecodeAsync2;
|
|
12361
12361
|
var init_parse2 = __esm(() => {
|
|
12362
12362
|
init_core2();
|
|
@@ -12375,7 +12375,7 @@ var init_parse2 = __esm(() => {
|
|
|
12375
12375
|
safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
12376
12376
|
});
|
|
12377
12377
|
|
|
12378
|
-
// node_modules/zod/v4/classic/schemas.js
|
|
12378
|
+
// ../../node_modules/zod/v4/classic/schemas.js
|
|
12379
12379
|
function string2(params) {
|
|
12380
12380
|
return _string(ZodString, params);
|
|
12381
12381
|
}
|
|
@@ -13350,7 +13350,7 @@ var init_schemas2 = __esm(() => {
|
|
|
13350
13350
|
});
|
|
13351
13351
|
});
|
|
13352
13352
|
|
|
13353
|
-
// node_modules/zod/v4/classic/compat.js
|
|
13353
|
+
// ../../node_modules/zod/v4/classic/compat.js
|
|
13354
13354
|
function setErrorMap(map2) {
|
|
13355
13355
|
config({
|
|
13356
13356
|
customError: map2
|
|
@@ -13378,7 +13378,7 @@ var init_compat = __esm(() => {
|
|
|
13378
13378
|
(function(ZodFirstPartyTypeKind2) {})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
13379
13379
|
});
|
|
13380
13380
|
|
|
13381
|
-
// node_modules/zod/v4/classic/coerce.js
|
|
13381
|
+
// ../../node_modules/zod/v4/classic/coerce.js
|
|
13382
13382
|
var exports_coerce = {};
|
|
13383
13383
|
__export(exports_coerce, {
|
|
13384
13384
|
string: () => string3,
|
|
@@ -13407,7 +13407,7 @@ var init_coerce = __esm(() => {
|
|
|
13407
13407
|
init_schemas2();
|
|
13408
13408
|
});
|
|
13409
13409
|
|
|
13410
|
-
// node_modules/zod/v4/classic/external.js
|
|
13410
|
+
// ../../node_modules/zod/v4/classic/external.js
|
|
13411
13411
|
var exports_external = {};
|
|
13412
13412
|
__export(exports_external, {
|
|
13413
13413
|
xid: () => xid2,
|
|
@@ -13653,7 +13653,7 @@ var init_external = __esm(() => {
|
|
|
13653
13653
|
config(en_default());
|
|
13654
13654
|
});
|
|
13655
13655
|
|
|
13656
|
-
// node_modules/zod/index.js
|
|
13656
|
+
// ../../node_modules/zod/index.js
|
|
13657
13657
|
var init_zod = __esm(() => {
|
|
13658
13658
|
init_external();
|
|
13659
13659
|
init_external();
|
|
@@ -13674,10 +13674,17 @@ var init_types = __esm(() => {
|
|
|
13674
13674
|
});
|
|
13675
13675
|
|
|
13676
13676
|
// src/types.ts
|
|
13677
|
-
var ProviderPresetSchema, ClaudeCodeProfileSchema, CoderConfigSchema, SyncMetaSchema, ConfigFileSchema, ExportConfigSchema;
|
|
13677
|
+
var API_FORMATS, ProviderPresetSchema, ClaudeCodeProfileSchema, CoderConfigSchema, SyncMetaSchema, ConfigFileSchema, ExportConfigSchema;
|
|
13678
13678
|
var init_types2 = __esm(() => {
|
|
13679
13679
|
init_zod();
|
|
13680
13680
|
init_types();
|
|
13681
|
+
API_FORMATS = [
|
|
13682
|
+
"anthropic_messages",
|
|
13683
|
+
"anthropic_responses",
|
|
13684
|
+
"openai_chat",
|
|
13685
|
+
"openai_responses",
|
|
13686
|
+
"gemini_native"
|
|
13687
|
+
];
|
|
13681
13688
|
ProviderPresetSchema = exports_external.object({
|
|
13682
13689
|
id: exports_external.string(),
|
|
13683
13690
|
name: exports_external.string(),
|
|
@@ -13692,6 +13699,14 @@ var init_types2 = __esm(() => {
|
|
|
13692
13699
|
}).optional(),
|
|
13693
13700
|
docs: exports_external.string().url().optional(),
|
|
13694
13701
|
isChinese: exports_external.boolean().optional(),
|
|
13702
|
+
defaultApiFormat: exports_external.enum([
|
|
13703
|
+
"anthropic_messages",
|
|
13704
|
+
"anthropic_responses",
|
|
13705
|
+
"openai_chat",
|
|
13706
|
+
"openai_responses",
|
|
13707
|
+
"gemini_native"
|
|
13708
|
+
]).optional(),
|
|
13709
|
+
baseURLChat: exports_external.string().optional(),
|
|
13695
13710
|
wire_api: exports_external.enum(["chat", "responses"]).optional(),
|
|
13696
13711
|
env_key: exports_external.string().optional(),
|
|
13697
13712
|
modelFamilies: exports_external.array(exports_external.object({
|
|
@@ -13716,6 +13731,13 @@ var init_types2 = __esm(() => {
|
|
|
13716
13731
|
}).optional(),
|
|
13717
13732
|
envKey: exports_external.string().optional(),
|
|
13718
13733
|
headers: exports_external.record(exports_external.string(), exports_external.string()).optional(),
|
|
13734
|
+
apiFormat: exports_external.enum([
|
|
13735
|
+
"anthropic_messages",
|
|
13736
|
+
"anthropic_responses",
|
|
13737
|
+
"openai_chat",
|
|
13738
|
+
"openai_responses",
|
|
13739
|
+
"gemini_native"
|
|
13740
|
+
]).optional(),
|
|
13719
13741
|
createdAt: exports_external.string(),
|
|
13720
13742
|
updatedAt: exports_external.string()
|
|
13721
13743
|
});
|
|
@@ -13999,7 +14021,7 @@ var CONFIG_VERSION = "2.0.0", EXPORT_VERSION = "1.0.0";
|
|
|
13999
14021
|
var init_versions2 = () => {};
|
|
14000
14022
|
|
|
14001
14023
|
// src/constants/meta.ts
|
|
14002
|
-
var APP_VERSION = "0.1.
|
|
14024
|
+
var APP_VERSION = "0.1.9";
|
|
14003
14025
|
var init_meta = () => {};
|
|
14004
14026
|
|
|
14005
14027
|
// src/constants/install.ts
|
|
@@ -14320,6 +14342,7 @@ var init_presets = __esm(() => {
|
|
|
14320
14342
|
"anthropic-version": "2023-06-01"
|
|
14321
14343
|
},
|
|
14322
14344
|
docs: "https://docs.anthropic.com/",
|
|
14345
|
+
defaultApiFormat: "anthropic_messages",
|
|
14323
14346
|
wire_api: "responses",
|
|
14324
14347
|
env_key: "ANTHROPIC_API_KEY"
|
|
14325
14348
|
};
|
|
@@ -14337,6 +14360,7 @@ var init_presets = __esm(() => {
|
|
|
14337
14360
|
],
|
|
14338
14361
|
authType: "custom",
|
|
14339
14362
|
docs: "https://ollama.com/library",
|
|
14363
|
+
defaultApiFormat: "openai_chat",
|
|
14340
14364
|
wire_api: "chat",
|
|
14341
14365
|
env_key: "OLLAMA_API_KEY"
|
|
14342
14366
|
};
|
|
@@ -14352,6 +14376,7 @@ var init_presets = __esm(() => {
|
|
|
14352
14376
|
],
|
|
14353
14377
|
authType: "api-key",
|
|
14354
14378
|
docs: "https://console.groq.com/docs",
|
|
14379
|
+
defaultApiFormat: "openai_chat",
|
|
14355
14380
|
wire_api: "chat",
|
|
14356
14381
|
env_key: "GROQ_API_KEY"
|
|
14357
14382
|
};
|
|
@@ -14367,6 +14392,7 @@ var init_presets = __esm(() => {
|
|
|
14367
14392
|
],
|
|
14368
14393
|
authType: "api-key",
|
|
14369
14394
|
docs: "https://platform.deepseek.com/",
|
|
14395
|
+
defaultApiFormat: "anthropic_messages",
|
|
14370
14396
|
wire_api: "chat",
|
|
14371
14397
|
env_key: "DEEPSEEK_API_KEY"
|
|
14372
14398
|
};
|
|
@@ -14382,6 +14408,7 @@ var init_presets = __esm(() => {
|
|
|
14382
14408
|
],
|
|
14383
14409
|
authType: "api-key",
|
|
14384
14410
|
docs: "https://platform.moonshot.cn/",
|
|
14411
|
+
defaultApiFormat: "openai_chat",
|
|
14385
14412
|
wire_api: "chat",
|
|
14386
14413
|
env_key: "MOONSHOT_API_KEY"
|
|
14387
14414
|
};
|
|
@@ -14393,6 +14420,7 @@ var init_presets = __esm(() => {
|
|
|
14393
14420
|
defaultModels: [],
|
|
14394
14421
|
authType: "api-key",
|
|
14395
14422
|
docs: "https://docs.together.ai/",
|
|
14423
|
+
defaultApiFormat: "openai_chat",
|
|
14396
14424
|
wire_api: "chat",
|
|
14397
14425
|
env_key: "TOGETHER_API_KEY"
|
|
14398
14426
|
};
|
|
@@ -14407,6 +14435,7 @@ var init_presets = __esm(() => {
|
|
|
14407
14435
|
],
|
|
14408
14436
|
authType: "api-key",
|
|
14409
14437
|
docs: "https://docs.fireworks.ai/",
|
|
14438
|
+
defaultApiFormat: "openai_chat",
|
|
14410
14439
|
wire_api: "chat",
|
|
14411
14440
|
env_key: "FIREWORKS_API_KEY"
|
|
14412
14441
|
};
|
|
@@ -14421,6 +14450,7 @@ var init_presets = __esm(() => {
|
|
|
14421
14450
|
],
|
|
14422
14451
|
authType: "api-key",
|
|
14423
14452
|
docs: "https://platform.01.ai/",
|
|
14453
|
+
defaultApiFormat: "openai_chat",
|
|
14424
14454
|
wire_api: "chat",
|
|
14425
14455
|
env_key: "ZEROONE_API_KEY"
|
|
14426
14456
|
};
|
|
@@ -14434,6 +14464,7 @@ var init_presets = __esm(() => {
|
|
|
14434
14464
|
],
|
|
14435
14465
|
authType: "api-key",
|
|
14436
14466
|
docs: "https://platform.minimaxi.com/",
|
|
14467
|
+
defaultApiFormat: "anthropic_messages",
|
|
14437
14468
|
wire_api: "responses",
|
|
14438
14469
|
env_key: "ANTHROPIC_API_KEY",
|
|
14439
14470
|
isChinese: true
|
|
@@ -14448,6 +14479,7 @@ var init_presets = __esm(() => {
|
|
|
14448
14479
|
],
|
|
14449
14480
|
authType: "api-key",
|
|
14450
14481
|
docs: "https://platform.minimax.io/",
|
|
14482
|
+
defaultApiFormat: "anthropic_messages",
|
|
14451
14483
|
wire_api: "responses",
|
|
14452
14484
|
env_key: "ANTHROPIC_API_KEY"
|
|
14453
14485
|
};
|
|
@@ -14462,6 +14494,7 @@ var init_presets = __esm(() => {
|
|
|
14462
14494
|
],
|
|
14463
14495
|
authType: "api-key",
|
|
14464
14496
|
docs: "https://open.bigmodel.cn/",
|
|
14497
|
+
defaultApiFormat: "anthropic_messages",
|
|
14465
14498
|
wire_api: "responses",
|
|
14466
14499
|
env_key: "ANTHROPIC_API_KEY",
|
|
14467
14500
|
isChinese: true
|
|
@@ -14477,6 +14510,7 @@ var init_presets = __esm(() => {
|
|
|
14477
14510
|
],
|
|
14478
14511
|
authType: "api-key",
|
|
14479
14512
|
docs: "https://docs.z.ai/",
|
|
14513
|
+
defaultApiFormat: "anthropic_messages",
|
|
14480
14514
|
wire_api: "responses",
|
|
14481
14515
|
env_key: "ANTHROPIC_AUTH_TOKEN"
|
|
14482
14516
|
};
|
|
@@ -14491,6 +14525,7 @@ var init_presets = __esm(() => {
|
|
|
14491
14525
|
],
|
|
14492
14526
|
authType: "api-key",
|
|
14493
14527
|
docs: "https://bailian.console.aliyun.com/",
|
|
14528
|
+
defaultApiFormat: "openai_chat",
|
|
14494
14529
|
wire_api: "chat",
|
|
14495
14530
|
env_key: "DASHSCOPE_API_KEY",
|
|
14496
14531
|
isChinese: true
|
|
@@ -14514,6 +14549,7 @@ var init_presets = __esm(() => {
|
|
|
14514
14549
|
defaultModels: ["step-3.5-flash"],
|
|
14515
14550
|
authType: "api-key",
|
|
14516
14551
|
docs: "https://platform.stepfun.ai",
|
|
14552
|
+
defaultApiFormat: "openai_chat",
|
|
14517
14553
|
wire_api: "chat",
|
|
14518
14554
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14519
14555
|
isChinese: true
|
|
@@ -14526,6 +14562,7 @@ var init_presets = __esm(() => {
|
|
|
14526
14562
|
defaultModels: ["ZhipuAI/GLM-5"],
|
|
14527
14563
|
authType: "api-key",
|
|
14528
14564
|
docs: "https://modelscope.cn",
|
|
14565
|
+
defaultApiFormat: "anthropic_messages",
|
|
14529
14566
|
wire_api: "responses",
|
|
14530
14567
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14531
14568
|
isChinese: true
|
|
@@ -14538,6 +14575,7 @@ var init_presets = __esm(() => {
|
|
|
14538
14575
|
defaultModels: ["LongCat-Flash-Chat"],
|
|
14539
14576
|
authType: "api-key",
|
|
14540
14577
|
docs: "https://longcat.chat/platform",
|
|
14578
|
+
defaultApiFormat: "anthropic_messages",
|
|
14541
14579
|
wire_api: "responses",
|
|
14542
14580
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14543
14581
|
isChinese: true
|
|
@@ -14550,6 +14588,7 @@ var init_presets = __esm(() => {
|
|
|
14550
14588
|
defaultModels: ["Ling-2.5-1T"],
|
|
14551
14589
|
authType: "api-key",
|
|
14552
14590
|
docs: "https://alipaytbox.yuque.com/sxs0ba/ling/get_started",
|
|
14591
|
+
defaultApiFormat: "anthropic_messages",
|
|
14553
14592
|
wire_api: "responses",
|
|
14554
14593
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14555
14594
|
isChinese: true
|
|
@@ -14562,6 +14601,7 @@ var init_presets = __esm(() => {
|
|
|
14562
14601
|
defaultModels: ["Pro/MiniMaxAI/MiniMax-M2.7"],
|
|
14563
14602
|
authType: "api-key",
|
|
14564
14603
|
docs: "https://siliconflow.cn",
|
|
14604
|
+
defaultApiFormat: "anthropic_messages",
|
|
14565
14605
|
wire_api: "responses",
|
|
14566
14606
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14567
14607
|
isChinese: true
|
|
@@ -14574,6 +14614,7 @@ var init_presets = __esm(() => {
|
|
|
14574
14614
|
defaultModels: ["MiniMaxAI/MiniMax-M2.7"],
|
|
14575
14615
|
authType: "api-key",
|
|
14576
14616
|
docs: "https://siliconflow.com",
|
|
14617
|
+
defaultApiFormat: "anthropic_messages",
|
|
14577
14618
|
wire_api: "responses",
|
|
14578
14619
|
env_key: "ANTHROPIC_AUTH_TOKEN"
|
|
14579
14620
|
};
|
|
@@ -14585,6 +14626,7 @@ var init_presets = __esm(() => {
|
|
|
14585
14626
|
defaultModels: [],
|
|
14586
14627
|
authType: "api-key",
|
|
14587
14628
|
docs: "https://www.dmxapi.cn",
|
|
14629
|
+
defaultApiFormat: "anthropic_messages",
|
|
14588
14630
|
wire_api: "responses",
|
|
14589
14631
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14590
14632
|
isChinese: true
|
|
@@ -14597,6 +14639,7 @@ var init_presets = __esm(() => {
|
|
|
14597
14639
|
defaultModels: [],
|
|
14598
14640
|
authType: "api-key",
|
|
14599
14641
|
docs: "https://www.packyapi.com",
|
|
14642
|
+
defaultApiFormat: "anthropic_messages",
|
|
14600
14643
|
wire_api: "responses",
|
|
14601
14644
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14602
14645
|
isChinese: true
|
|
@@ -14609,6 +14652,7 @@ var init_presets = __esm(() => {
|
|
|
14609
14652
|
defaultModels: [],
|
|
14610
14653
|
authType: "api-key",
|
|
14611
14654
|
docs: "https://cubence.com",
|
|
14655
|
+
defaultApiFormat: "anthropic_messages",
|
|
14612
14656
|
wire_api: "responses",
|
|
14613
14657
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14614
14658
|
isChinese: true
|
|
@@ -14621,6 +14665,7 @@ var init_presets = __esm(() => {
|
|
|
14621
14665
|
defaultModels: [],
|
|
14622
14666
|
authType: "api-key",
|
|
14623
14667
|
docs: "https://aigocode.com",
|
|
14668
|
+
defaultApiFormat: "anthropic_messages",
|
|
14624
14669
|
wire_api: "responses",
|
|
14625
14670
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14626
14671
|
isChinese: true
|
|
@@ -14633,6 +14678,7 @@ var init_presets = __esm(() => {
|
|
|
14633
14678
|
defaultModels: [],
|
|
14634
14679
|
authType: "api-key",
|
|
14635
14680
|
docs: "https://www.right.codes",
|
|
14681
|
+
defaultApiFormat: "anthropic_messages",
|
|
14636
14682
|
wire_api: "responses",
|
|
14637
14683
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14638
14684
|
isChinese: true
|
|
@@ -14645,6 +14691,7 @@ var init_presets = __esm(() => {
|
|
|
14645
14691
|
defaultModels: [],
|
|
14646
14692
|
authType: "api-key",
|
|
14647
14693
|
docs: "https://www.aicodemirror.com",
|
|
14694
|
+
defaultApiFormat: "anthropic_messages",
|
|
14648
14695
|
wire_api: "responses",
|
|
14649
14696
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14650
14697
|
isChinese: true
|
|
@@ -14657,6 +14704,7 @@ var init_presets = __esm(() => {
|
|
|
14657
14704
|
defaultModels: [],
|
|
14658
14705
|
authType: "api-key",
|
|
14659
14706
|
docs: "https://aicoding.sh",
|
|
14707
|
+
defaultApiFormat: "anthropic_messages",
|
|
14660
14708
|
wire_api: "responses",
|
|
14661
14709
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14662
14710
|
isChinese: true
|
|
@@ -14669,6 +14717,7 @@ var init_presets = __esm(() => {
|
|
|
14669
14717
|
defaultModels: [],
|
|
14670
14718
|
authType: "api-key",
|
|
14671
14719
|
docs: "https://www.crazyrouter.com",
|
|
14720
|
+
defaultApiFormat: "anthropic_messages",
|
|
14672
14721
|
wire_api: "responses",
|
|
14673
14722
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14674
14723
|
isChinese: true
|
|
@@ -14681,6 +14730,7 @@ var init_presets = __esm(() => {
|
|
|
14681
14730
|
defaultModels: [],
|
|
14682
14731
|
authType: "api-key",
|
|
14683
14732
|
docs: "https://www.sssaicode.com",
|
|
14733
|
+
defaultApiFormat: "anthropic_messages",
|
|
14684
14734
|
wire_api: "responses",
|
|
14685
14735
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14686
14736
|
isChinese: true
|
|
@@ -14693,6 +14743,7 @@ var init_presets = __esm(() => {
|
|
|
14693
14743
|
defaultModels: [],
|
|
14694
14744
|
authType: "api-key",
|
|
14695
14745
|
docs: "https://www.compshare.cn",
|
|
14746
|
+
defaultApiFormat: "anthropic_messages",
|
|
14696
14747
|
wire_api: "responses",
|
|
14697
14748
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14698
14749
|
isChinese: true
|
|
@@ -14705,6 +14756,7 @@ var init_presets = __esm(() => {
|
|
|
14705
14756
|
defaultModels: [],
|
|
14706
14757
|
authType: "api-key",
|
|
14707
14758
|
docs: "https://www.openclaudecode.cn",
|
|
14759
|
+
defaultApiFormat: "anthropic_messages",
|
|
14708
14760
|
wire_api: "responses",
|
|
14709
14761
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14710
14762
|
isChinese: true
|
|
@@ -14717,6 +14769,7 @@ var init_presets = __esm(() => {
|
|
|
14717
14769
|
defaultModels: [],
|
|
14718
14770
|
authType: "api-key",
|
|
14719
14771
|
docs: "https://x-code.cc",
|
|
14772
|
+
defaultApiFormat: "anthropic_messages",
|
|
14720
14773
|
wire_api: "responses",
|
|
14721
14774
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14722
14775
|
isChinese: true
|
|
@@ -14729,6 +14782,7 @@ var init_presets = __esm(() => {
|
|
|
14729
14782
|
defaultModels: [],
|
|
14730
14783
|
authType: "api-key",
|
|
14731
14784
|
docs: "https://ctok.ai",
|
|
14785
|
+
defaultApiFormat: "anthropic_messages",
|
|
14732
14786
|
wire_api: "responses",
|
|
14733
14787
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14734
14788
|
isChinese: true
|
|
@@ -14742,6 +14796,7 @@ var init_presets = __esm(() => {
|
|
|
14742
14796
|
defaultModels: ["anthropic/claude-sonnet-4.6"],
|
|
14743
14797
|
authType: "api-key",
|
|
14744
14798
|
docs: "https://openrouter.ai",
|
|
14799
|
+
defaultApiFormat: "anthropic_messages",
|
|
14745
14800
|
wire_api: "chat",
|
|
14746
14801
|
env_key: "OPENAI_API_KEY"
|
|
14747
14802
|
};
|
|
@@ -14753,6 +14808,7 @@ var init_presets = __esm(() => {
|
|
|
14753
14808
|
defaultModels: ["zai-org/glm-5"],
|
|
14754
14809
|
authType: "api-key",
|
|
14755
14810
|
docs: "https://novita.ai",
|
|
14811
|
+
defaultApiFormat: "anthropic_messages",
|
|
14756
14812
|
wire_api: "responses",
|
|
14757
14813
|
env_key: "ANTHROPIC_AUTH_TOKEN"
|
|
14758
14814
|
};
|
|
@@ -14764,6 +14820,7 @@ var init_presets = __esm(() => {
|
|
|
14764
14820
|
defaultModels: ["claude-opus-4.6"],
|
|
14765
14821
|
authType: "api-key",
|
|
14766
14822
|
docs: "https://github.com/features/copilot",
|
|
14823
|
+
defaultApiFormat: "openai_chat",
|
|
14767
14824
|
wire_api: "chat",
|
|
14768
14825
|
env_key: "ANTHROPIC_AUTH_TOKEN"
|
|
14769
14826
|
};
|
|
@@ -14775,6 +14832,7 @@ var init_presets = __esm(() => {
|
|
|
14775
14832
|
defaultModels: ["moonshotai/kimi-k2.5"],
|
|
14776
14833
|
authType: "api-key",
|
|
14777
14834
|
docs: "https://build.nvidia.com",
|
|
14835
|
+
defaultApiFormat: "openai_chat",
|
|
14778
14836
|
wire_api: "chat",
|
|
14779
14837
|
env_key: "ANTHROPIC_AUTH_TOKEN"
|
|
14780
14838
|
};
|
|
@@ -14786,6 +14844,7 @@ var init_presets = __esm(() => {
|
|
|
14786
14844
|
defaultModels: ["mimo-v2-pro"],
|
|
14787
14845
|
authType: "api-key",
|
|
14788
14846
|
docs: "https://platform.xiaomimimo.com",
|
|
14847
|
+
defaultApiFormat: "anthropic_messages",
|
|
14789
14848
|
wire_api: "responses",
|
|
14790
14849
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14791
14850
|
isChinese: true
|
|
@@ -14798,6 +14857,7 @@ var init_presets = __esm(() => {
|
|
|
14798
14857
|
defaultModels: [],
|
|
14799
14858
|
authType: "api-key",
|
|
14800
14859
|
docs: "https://bailian.console.aliyun.com",
|
|
14860
|
+
defaultApiFormat: "anthropic_messages",
|
|
14801
14861
|
wire_api: "responses",
|
|
14802
14862
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14803
14863
|
isChinese: true
|
|
@@ -14810,6 +14870,7 @@ var init_presets = __esm(() => {
|
|
|
14810
14870
|
defaultModels: [],
|
|
14811
14871
|
authType: "api-key",
|
|
14812
14872
|
docs: "https://www.kimi.com/coding/docs/",
|
|
14873
|
+
defaultApiFormat: "anthropic_messages",
|
|
14813
14874
|
wire_api: "responses",
|
|
14814
14875
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14815
14876
|
isChinese: true
|
|
@@ -14822,6 +14883,7 @@ var init_presets = __esm(() => {
|
|
|
14822
14883
|
defaultModels: ["doubao-seed-2-0-code-preview-latest"],
|
|
14823
14884
|
authType: "api-key",
|
|
14824
14885
|
docs: "https://www.volcengine.com/product/doubao",
|
|
14886
|
+
defaultApiFormat: "anthropic_messages",
|
|
14825
14887
|
wire_api: "responses",
|
|
14826
14888
|
env_key: "ANTHROPIC_AUTH_TOKEN",
|
|
14827
14889
|
isChinese: true
|
|
@@ -14834,6 +14896,7 @@ var init_presets = __esm(() => {
|
|
|
14834
14896
|
defaultModels: [],
|
|
14835
14897
|
authType: "api-key",
|
|
14836
14898
|
docs: "https://aihubmix.com",
|
|
14899
|
+
defaultApiFormat: "anthropic_messages",
|
|
14837
14900
|
wire_api: "responses",
|
|
14838
14901
|
env_key: "ANTHROPIC_API_KEY",
|
|
14839
14902
|
isChinese: true
|
|
@@ -15026,7 +15089,7 @@ var init_claude = __esm(() => {
|
|
|
15026
15089
|
init_model_helper();
|
|
15027
15090
|
});
|
|
15028
15091
|
|
|
15029
|
-
// node_modules/js-yaml/dist/js-yaml.mjs
|
|
15092
|
+
// ../../node_modules/js-yaml/dist/js-yaml.mjs
|
|
15030
15093
|
function isNothing(subject) {
|
|
15031
15094
|
return typeof subject === "undefined" || subject === null;
|
|
15032
15095
|
}
|
|
@@ -17753,7 +17816,7 @@ var init_continue = __esm(() => {
|
|
|
17753
17816
|
};
|
|
17754
17817
|
});
|
|
17755
17818
|
|
|
17756
|
-
// node_modules/smol-toml/dist/error.js
|
|
17819
|
+
// ../../node_modules/smol-toml/dist/error.js
|
|
17757
17820
|
function getLineColFromPtr(string4, ptr) {
|
|
17758
17821
|
let lines = string4.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
17759
17822
|
return [lines.length, lines.pop().length + 1];
|
|
@@ -17825,7 +17888,7 @@ ${codeblock}`, options);
|
|
|
17825
17888
|
};
|
|
17826
17889
|
});
|
|
17827
17890
|
|
|
17828
|
-
// node_modules/smol-toml/dist/util.js
|
|
17891
|
+
// ../../node_modules/smol-toml/dist/util.js
|
|
17829
17892
|
function isEscaped(str2, ptr) {
|
|
17830
17893
|
let i2 = 0;
|
|
17831
17894
|
while (str2[ptr - ++i2] === "\\")
|
|
@@ -17936,7 +17999,7 @@ var init_util2 = __esm(() => {
|
|
|
17936
17999
|
*/
|
|
17937
18000
|
});
|
|
17938
18001
|
|
|
17939
|
-
// node_modules/smol-toml/dist/date.js
|
|
18002
|
+
// ../../node_modules/smol-toml/dist/date.js
|
|
17940
18003
|
var DATE_TIME_RE, TomlDate;
|
|
17941
18004
|
var init_date = __esm(() => {
|
|
17942
18005
|
/*!
|
|
@@ -18058,7 +18121,7 @@ var init_date = __esm(() => {
|
|
|
18058
18121
|
};
|
|
18059
18122
|
});
|
|
18060
18123
|
|
|
18061
|
-
// node_modules/smol-toml/dist/primitive.js
|
|
18124
|
+
// ../../node_modules/smol-toml/dist/primitive.js
|
|
18062
18125
|
function parseString(str2, ptr = 0, endPtr = str2.length) {
|
|
18063
18126
|
let isLiteral = str2[ptr] === "'";
|
|
18064
18127
|
let isMultiline = str2[ptr++] === str2[ptr] && str2[ptr] === str2[ptr + 1];
|
|
@@ -18235,7 +18298,7 @@ var init_primitive = __esm(() => {
|
|
|
18235
18298
|
};
|
|
18236
18299
|
});
|
|
18237
18300
|
|
|
18238
|
-
// node_modules/smol-toml/dist/extract.js
|
|
18301
|
+
// ../../node_modules/smol-toml/dist/extract.js
|
|
18239
18302
|
function sliceAndTrimEndOf(str2, startPtr, endPtr, allowNewLines) {
|
|
18240
18303
|
let value = str2.slice(startPtr, endPtr);
|
|
18241
18304
|
let commentIdx = value.indexOf("#");
|
|
@@ -18346,7 +18409,7 @@ var init_extract = __esm(() => {
|
|
|
18346
18409
|
*/
|
|
18347
18410
|
});
|
|
18348
18411
|
|
|
18349
|
-
// node_modules/smol-toml/dist/struct.js
|
|
18412
|
+
// ../../node_modules/smol-toml/dist/struct.js
|
|
18350
18413
|
function parseKey(str2, ptr, end = "=") {
|
|
18351
18414
|
let dot = ptr - 1;
|
|
18352
18415
|
let parsed = [];
|
|
@@ -18538,7 +18601,7 @@ var init_struct = __esm(() => {
|
|
|
18538
18601
|
KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
18539
18602
|
});
|
|
18540
18603
|
|
|
18541
|
-
// node_modules/smol-toml/dist/parse.js
|
|
18604
|
+
// ../../node_modules/smol-toml/dist/parse.js
|
|
18542
18605
|
function peekTable(key, table, meta2, type2) {
|
|
18543
18606
|
let t = table;
|
|
18544
18607
|
let m2 = meta2;
|
|
@@ -18685,7 +18748,7 @@ var init_parse3 = __esm(() => {
|
|
|
18685
18748
|
*/
|
|
18686
18749
|
});
|
|
18687
18750
|
|
|
18688
|
-
// node_modules/smol-toml/dist/stringify.js
|
|
18751
|
+
// ../../node_modules/smol-toml/dist/stringify.js
|
|
18689
18752
|
function extendedTypeOf(obj) {
|
|
18690
18753
|
let type2 = typeof obj;
|
|
18691
18754
|
if (type2 === "object") {
|
|
@@ -18862,7 +18925,7 @@ var init_stringify = __esm(() => {
|
|
|
18862
18925
|
BARE_KEY = /^[a-z0-9-_]+$/i;
|
|
18863
18926
|
});
|
|
18864
18927
|
|
|
18865
|
-
// node_modules/smol-toml/dist/index.js
|
|
18928
|
+
// ../../node_modules/smol-toml/dist/index.js
|
|
18866
18929
|
var init_dist3 = __esm(() => {
|
|
18867
18930
|
init_parse3();
|
|
18868
18931
|
init_stringify();
|
|
@@ -19811,7 +19874,7 @@ var init_install2 = __esm(() => {
|
|
|
19811
19874
|
import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
19812
19875
|
});
|
|
19813
19876
|
|
|
19814
|
-
// node_modules/semver/internal/constants.js
|
|
19877
|
+
// ../../node_modules/semver/internal/constants.js
|
|
19815
19878
|
var require_constants = __commonJS((exports, module) => {
|
|
19816
19879
|
var SEMVER_SPEC_VERSION = "2.0.0";
|
|
19817
19880
|
var MAX_LENGTH = 256;
|
|
@@ -19839,13 +19902,13 @@ var require_constants = __commonJS((exports, module) => {
|
|
|
19839
19902
|
};
|
|
19840
19903
|
});
|
|
19841
19904
|
|
|
19842
|
-
// node_modules/semver/internal/debug.js
|
|
19905
|
+
// ../../node_modules/semver/internal/debug.js
|
|
19843
19906
|
var require_debug = __commonJS((exports, module) => {
|
|
19844
19907
|
var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
19845
19908
|
module.exports = debug;
|
|
19846
19909
|
});
|
|
19847
19910
|
|
|
19848
|
-
// node_modules/semver/internal/re.js
|
|
19911
|
+
// ../../node_modules/semver/internal/re.js
|
|
19849
19912
|
var require_re = __commonJS((exports, module) => {
|
|
19850
19913
|
var {
|
|
19851
19914
|
MAX_SAFE_COMPONENT_LENGTH,
|
|
@@ -19930,7 +19993,7 @@ var require_re = __commonJS((exports, module) => {
|
|
|
19930
19993
|
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
19931
19994
|
});
|
|
19932
19995
|
|
|
19933
|
-
// node_modules/semver/internal/parse-options.js
|
|
19996
|
+
// ../../node_modules/semver/internal/parse-options.js
|
|
19934
19997
|
var require_parse_options = __commonJS((exports, module) => {
|
|
19935
19998
|
var looseOption = Object.freeze({ loose: true });
|
|
19936
19999
|
var emptyOpts = Object.freeze({});
|
|
@@ -19946,7 +20009,7 @@ var require_parse_options = __commonJS((exports, module) => {
|
|
|
19946
20009
|
module.exports = parseOptions;
|
|
19947
20010
|
});
|
|
19948
20011
|
|
|
19949
|
-
// node_modules/semver/internal/identifiers.js
|
|
20012
|
+
// ../../node_modules/semver/internal/identifiers.js
|
|
19950
20013
|
var require_identifiers = __commonJS((exports, module) => {
|
|
19951
20014
|
var numeric = /^[0-9]+$/;
|
|
19952
20015
|
var compareIdentifiers = (a, b3) => {
|
|
@@ -19968,7 +20031,7 @@ var require_identifiers = __commonJS((exports, module) => {
|
|
|
19968
20031
|
};
|
|
19969
20032
|
});
|
|
19970
20033
|
|
|
19971
|
-
// node_modules/semver/classes/semver.js
|
|
20034
|
+
// ../../node_modules/semver/classes/semver.js
|
|
19972
20035
|
var require_semver = __commonJS((exports, module) => {
|
|
19973
20036
|
var debug = require_debug();
|
|
19974
20037
|
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
@@ -20237,7 +20300,7 @@ var require_semver = __commonJS((exports, module) => {
|
|
|
20237
20300
|
module.exports = SemVer;
|
|
20238
20301
|
});
|
|
20239
20302
|
|
|
20240
|
-
// node_modules/semver/functions/parse.js
|
|
20303
|
+
// ../../node_modules/semver/functions/parse.js
|
|
20241
20304
|
var require_parse = __commonJS((exports, module) => {
|
|
20242
20305
|
var SemVer = require_semver();
|
|
20243
20306
|
var parse6 = (version2, options, throwErrors = false) => {
|
|
@@ -20256,7 +20319,7 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
20256
20319
|
module.exports = parse6;
|
|
20257
20320
|
});
|
|
20258
20321
|
|
|
20259
|
-
// node_modules/semver/functions/valid.js
|
|
20322
|
+
// ../../node_modules/semver/functions/valid.js
|
|
20260
20323
|
var require_valid = __commonJS((exports, module) => {
|
|
20261
20324
|
var parse6 = require_parse();
|
|
20262
20325
|
var valid = (version2, options) => {
|
|
@@ -20266,7 +20329,7 @@ var require_valid = __commonJS((exports, module) => {
|
|
|
20266
20329
|
module.exports = valid;
|
|
20267
20330
|
});
|
|
20268
20331
|
|
|
20269
|
-
// node_modules/semver/functions/clean.js
|
|
20332
|
+
// ../../node_modules/semver/functions/clean.js
|
|
20270
20333
|
var require_clean = __commonJS((exports, module) => {
|
|
20271
20334
|
var parse6 = require_parse();
|
|
20272
20335
|
var clean = (version2, options) => {
|
|
@@ -20276,7 +20339,7 @@ var require_clean = __commonJS((exports, module) => {
|
|
|
20276
20339
|
module.exports = clean;
|
|
20277
20340
|
});
|
|
20278
20341
|
|
|
20279
|
-
// node_modules/semver/functions/inc.js
|
|
20342
|
+
// ../../node_modules/semver/functions/inc.js
|
|
20280
20343
|
var require_inc = __commonJS((exports, module) => {
|
|
20281
20344
|
var SemVer = require_semver();
|
|
20282
20345
|
var inc = (version2, release, options, identifier, identifierBase) => {
|
|
@@ -20294,7 +20357,7 @@ var require_inc = __commonJS((exports, module) => {
|
|
|
20294
20357
|
module.exports = inc;
|
|
20295
20358
|
});
|
|
20296
20359
|
|
|
20297
|
-
// node_modules/semver/functions/diff.js
|
|
20360
|
+
// ../../node_modules/semver/functions/diff.js
|
|
20298
20361
|
var require_diff = __commonJS((exports, module) => {
|
|
20299
20362
|
var parse6 = require_parse();
|
|
20300
20363
|
var diff = (version1, version2) => {
|
|
@@ -20335,28 +20398,28 @@ var require_diff = __commonJS((exports, module) => {
|
|
|
20335
20398
|
module.exports = diff;
|
|
20336
20399
|
});
|
|
20337
20400
|
|
|
20338
|
-
// node_modules/semver/functions/major.js
|
|
20401
|
+
// ../../node_modules/semver/functions/major.js
|
|
20339
20402
|
var require_major = __commonJS((exports, module) => {
|
|
20340
20403
|
var SemVer = require_semver();
|
|
20341
20404
|
var major = (a, loose) => new SemVer(a, loose).major;
|
|
20342
20405
|
module.exports = major;
|
|
20343
20406
|
});
|
|
20344
20407
|
|
|
20345
|
-
// node_modules/semver/functions/minor.js
|
|
20408
|
+
// ../../node_modules/semver/functions/minor.js
|
|
20346
20409
|
var require_minor = __commonJS((exports, module) => {
|
|
20347
20410
|
var SemVer = require_semver();
|
|
20348
20411
|
var minor = (a, loose) => new SemVer(a, loose).minor;
|
|
20349
20412
|
module.exports = minor;
|
|
20350
20413
|
});
|
|
20351
20414
|
|
|
20352
|
-
// node_modules/semver/functions/patch.js
|
|
20415
|
+
// ../../node_modules/semver/functions/patch.js
|
|
20353
20416
|
var require_patch = __commonJS((exports, module) => {
|
|
20354
20417
|
var SemVer = require_semver();
|
|
20355
20418
|
var patch = (a, loose) => new SemVer(a, loose).patch;
|
|
20356
20419
|
module.exports = patch;
|
|
20357
20420
|
});
|
|
20358
20421
|
|
|
20359
|
-
// node_modules/semver/functions/prerelease.js
|
|
20422
|
+
// ../../node_modules/semver/functions/prerelease.js
|
|
20360
20423
|
var require_prerelease = __commonJS((exports, module) => {
|
|
20361
20424
|
var parse6 = require_parse();
|
|
20362
20425
|
var prerelease = (version2, options) => {
|
|
@@ -20366,28 +20429,28 @@ var require_prerelease = __commonJS((exports, module) => {
|
|
|
20366
20429
|
module.exports = prerelease;
|
|
20367
20430
|
});
|
|
20368
20431
|
|
|
20369
|
-
// node_modules/semver/functions/compare.js
|
|
20432
|
+
// ../../node_modules/semver/functions/compare.js
|
|
20370
20433
|
var require_compare = __commonJS((exports, module) => {
|
|
20371
20434
|
var SemVer = require_semver();
|
|
20372
20435
|
var compare = (a, b3, loose) => new SemVer(a, loose).compare(new SemVer(b3, loose));
|
|
20373
20436
|
module.exports = compare;
|
|
20374
20437
|
});
|
|
20375
20438
|
|
|
20376
|
-
// node_modules/semver/functions/rcompare.js
|
|
20439
|
+
// ../../node_modules/semver/functions/rcompare.js
|
|
20377
20440
|
var require_rcompare = __commonJS((exports, module) => {
|
|
20378
20441
|
var compare = require_compare();
|
|
20379
20442
|
var rcompare = (a, b3, loose) => compare(b3, a, loose);
|
|
20380
20443
|
module.exports = rcompare;
|
|
20381
20444
|
});
|
|
20382
20445
|
|
|
20383
|
-
// node_modules/semver/functions/compare-loose.js
|
|
20446
|
+
// ../../node_modules/semver/functions/compare-loose.js
|
|
20384
20447
|
var require_compare_loose = __commonJS((exports, module) => {
|
|
20385
20448
|
var compare = require_compare();
|
|
20386
20449
|
var compareLoose = (a, b3) => compare(a, b3, true);
|
|
20387
20450
|
module.exports = compareLoose;
|
|
20388
20451
|
});
|
|
20389
20452
|
|
|
20390
|
-
// node_modules/semver/functions/compare-build.js
|
|
20453
|
+
// ../../node_modules/semver/functions/compare-build.js
|
|
20391
20454
|
var require_compare_build = __commonJS((exports, module) => {
|
|
20392
20455
|
var SemVer = require_semver();
|
|
20393
20456
|
var compareBuild = (a, b3, loose) => {
|
|
@@ -20398,63 +20461,63 @@ var require_compare_build = __commonJS((exports, module) => {
|
|
|
20398
20461
|
module.exports = compareBuild;
|
|
20399
20462
|
});
|
|
20400
20463
|
|
|
20401
|
-
// node_modules/semver/functions/sort.js
|
|
20464
|
+
// ../../node_modules/semver/functions/sort.js
|
|
20402
20465
|
var require_sort = __commonJS((exports, module) => {
|
|
20403
20466
|
var compareBuild = require_compare_build();
|
|
20404
20467
|
var sort = (list, loose) => list.sort((a, b3) => compareBuild(a, b3, loose));
|
|
20405
20468
|
module.exports = sort;
|
|
20406
20469
|
});
|
|
20407
20470
|
|
|
20408
|
-
// node_modules/semver/functions/rsort.js
|
|
20471
|
+
// ../../node_modules/semver/functions/rsort.js
|
|
20409
20472
|
var require_rsort = __commonJS((exports, module) => {
|
|
20410
20473
|
var compareBuild = require_compare_build();
|
|
20411
20474
|
var rsort = (list, loose) => list.sort((a, b3) => compareBuild(b3, a, loose));
|
|
20412
20475
|
module.exports = rsort;
|
|
20413
20476
|
});
|
|
20414
20477
|
|
|
20415
|
-
// node_modules/semver/functions/gt.js
|
|
20478
|
+
// ../../node_modules/semver/functions/gt.js
|
|
20416
20479
|
var require_gt = __commonJS((exports, module) => {
|
|
20417
20480
|
var compare = require_compare();
|
|
20418
20481
|
var gt = (a, b3, loose) => compare(a, b3, loose) > 0;
|
|
20419
20482
|
module.exports = gt;
|
|
20420
20483
|
});
|
|
20421
20484
|
|
|
20422
|
-
// node_modules/semver/functions/lt.js
|
|
20485
|
+
// ../../node_modules/semver/functions/lt.js
|
|
20423
20486
|
var require_lt = __commonJS((exports, module) => {
|
|
20424
20487
|
var compare = require_compare();
|
|
20425
20488
|
var lt = (a, b3, loose) => compare(a, b3, loose) < 0;
|
|
20426
20489
|
module.exports = lt;
|
|
20427
20490
|
});
|
|
20428
20491
|
|
|
20429
|
-
// node_modules/semver/functions/eq.js
|
|
20492
|
+
// ../../node_modules/semver/functions/eq.js
|
|
20430
20493
|
var require_eq = __commonJS((exports, module) => {
|
|
20431
20494
|
var compare = require_compare();
|
|
20432
20495
|
var eq = (a, b3, loose) => compare(a, b3, loose) === 0;
|
|
20433
20496
|
module.exports = eq;
|
|
20434
20497
|
});
|
|
20435
20498
|
|
|
20436
|
-
// node_modules/semver/functions/neq.js
|
|
20499
|
+
// ../../node_modules/semver/functions/neq.js
|
|
20437
20500
|
var require_neq = __commonJS((exports, module) => {
|
|
20438
20501
|
var compare = require_compare();
|
|
20439
20502
|
var neq = (a, b3, loose) => compare(a, b3, loose) !== 0;
|
|
20440
20503
|
module.exports = neq;
|
|
20441
20504
|
});
|
|
20442
20505
|
|
|
20443
|
-
// node_modules/semver/functions/gte.js
|
|
20506
|
+
// ../../node_modules/semver/functions/gte.js
|
|
20444
20507
|
var require_gte = __commonJS((exports, module) => {
|
|
20445
20508
|
var compare = require_compare();
|
|
20446
20509
|
var gte = (a, b3, loose) => compare(a, b3, loose) >= 0;
|
|
20447
20510
|
module.exports = gte;
|
|
20448
20511
|
});
|
|
20449
20512
|
|
|
20450
|
-
// node_modules/semver/functions/lte.js
|
|
20513
|
+
// ../../node_modules/semver/functions/lte.js
|
|
20451
20514
|
var require_lte = __commonJS((exports, module) => {
|
|
20452
20515
|
var compare = require_compare();
|
|
20453
20516
|
var lte = (a, b3, loose) => compare(a, b3, loose) <= 0;
|
|
20454
20517
|
module.exports = lte;
|
|
20455
20518
|
});
|
|
20456
20519
|
|
|
20457
|
-
// node_modules/semver/functions/cmp.js
|
|
20520
|
+
// ../../node_modules/semver/functions/cmp.js
|
|
20458
20521
|
var require_cmp = __commonJS((exports, module) => {
|
|
20459
20522
|
var eq = require_eq();
|
|
20460
20523
|
var neq = require_neq();
|
|
@@ -20501,7 +20564,7 @@ var require_cmp = __commonJS((exports, module) => {
|
|
|
20501
20564
|
module.exports = cmp;
|
|
20502
20565
|
});
|
|
20503
20566
|
|
|
20504
|
-
// node_modules/semver/functions/coerce.js
|
|
20567
|
+
// ../../node_modules/semver/functions/coerce.js
|
|
20505
20568
|
var require_coerce = __commonJS((exports, module) => {
|
|
20506
20569
|
var SemVer = require_semver();
|
|
20507
20570
|
var parse6 = require_parse();
|
|
@@ -20544,7 +20607,7 @@ var require_coerce = __commonJS((exports, module) => {
|
|
|
20544
20607
|
module.exports = coerce;
|
|
20545
20608
|
});
|
|
20546
20609
|
|
|
20547
|
-
// node_modules/semver/internal/lrucache.js
|
|
20610
|
+
// ../../node_modules/semver/internal/lrucache.js
|
|
20548
20611
|
var require_lrucache = __commonJS((exports, module) => {
|
|
20549
20612
|
class LRUCache {
|
|
20550
20613
|
constructor() {
|
|
@@ -20579,7 +20642,7 @@ var require_lrucache = __commonJS((exports, module) => {
|
|
|
20579
20642
|
module.exports = LRUCache;
|
|
20580
20643
|
});
|
|
20581
20644
|
|
|
20582
|
-
// node_modules/semver/classes/range.js
|
|
20645
|
+
// ../../node_modules/semver/classes/range.js
|
|
20583
20646
|
var require_range = __commonJS((exports, module) => {
|
|
20584
20647
|
var SPACE_CHARACTERS = /\s+/g;
|
|
20585
20648
|
|
|
@@ -20953,7 +21016,7 @@ var require_range = __commonJS((exports, module) => {
|
|
|
20953
21016
|
};
|
|
20954
21017
|
});
|
|
20955
21018
|
|
|
20956
|
-
// node_modules/semver/classes/comparator.js
|
|
21019
|
+
// ../../node_modules/semver/classes/comparator.js
|
|
20957
21020
|
var require_comparator = __commonJS((exports, module) => {
|
|
20958
21021
|
var ANY = Symbol("SemVer ANY");
|
|
20959
21022
|
|
|
@@ -21064,7 +21127,7 @@ var require_comparator = __commonJS((exports, module) => {
|
|
|
21064
21127
|
var Range = require_range();
|
|
21065
21128
|
});
|
|
21066
21129
|
|
|
21067
|
-
// node_modules/semver/functions/satisfies.js
|
|
21130
|
+
// ../../node_modules/semver/functions/satisfies.js
|
|
21068
21131
|
var require_satisfies = __commonJS((exports, module) => {
|
|
21069
21132
|
var Range = require_range();
|
|
21070
21133
|
var satisfies = (version2, range, options) => {
|
|
@@ -21078,14 +21141,14 @@ var require_satisfies = __commonJS((exports, module) => {
|
|
|
21078
21141
|
module.exports = satisfies;
|
|
21079
21142
|
});
|
|
21080
21143
|
|
|
21081
|
-
// node_modules/semver/ranges/to-comparators.js
|
|
21144
|
+
// ../../node_modules/semver/ranges/to-comparators.js
|
|
21082
21145
|
var require_to_comparators = __commonJS((exports, module) => {
|
|
21083
21146
|
var Range = require_range();
|
|
21084
21147
|
var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
21085
21148
|
module.exports = toComparators;
|
|
21086
21149
|
});
|
|
21087
21150
|
|
|
21088
|
-
// node_modules/semver/ranges/max-satisfying.js
|
|
21151
|
+
// ../../node_modules/semver/ranges/max-satisfying.js
|
|
21089
21152
|
var require_max_satisfying = __commonJS((exports, module) => {
|
|
21090
21153
|
var SemVer = require_semver();
|
|
21091
21154
|
var Range = require_range();
|
|
@@ -21111,7 +21174,7 @@ var require_max_satisfying = __commonJS((exports, module) => {
|
|
|
21111
21174
|
module.exports = maxSatisfying;
|
|
21112
21175
|
});
|
|
21113
21176
|
|
|
21114
|
-
// node_modules/semver/ranges/min-satisfying.js
|
|
21177
|
+
// ../../node_modules/semver/ranges/min-satisfying.js
|
|
21115
21178
|
var require_min_satisfying = __commonJS((exports, module) => {
|
|
21116
21179
|
var SemVer = require_semver();
|
|
21117
21180
|
var Range = require_range();
|
|
@@ -21137,7 +21200,7 @@ var require_min_satisfying = __commonJS((exports, module) => {
|
|
|
21137
21200
|
module.exports = minSatisfying;
|
|
21138
21201
|
});
|
|
21139
21202
|
|
|
21140
|
-
// node_modules/semver/ranges/min-version.js
|
|
21203
|
+
// ../../node_modules/semver/ranges/min-version.js
|
|
21141
21204
|
var require_min_version = __commonJS((exports, module) => {
|
|
21142
21205
|
var SemVer = require_semver();
|
|
21143
21206
|
var Range = require_range();
|
|
@@ -21191,7 +21254,7 @@ var require_min_version = __commonJS((exports, module) => {
|
|
|
21191
21254
|
module.exports = minVersion;
|
|
21192
21255
|
});
|
|
21193
21256
|
|
|
21194
|
-
// node_modules/semver/ranges/valid.js
|
|
21257
|
+
// ../../node_modules/semver/ranges/valid.js
|
|
21195
21258
|
var require_valid2 = __commonJS((exports, module) => {
|
|
21196
21259
|
var Range = require_range();
|
|
21197
21260
|
var validRange = (range, options) => {
|
|
@@ -21204,7 +21267,7 @@ var require_valid2 = __commonJS((exports, module) => {
|
|
|
21204
21267
|
module.exports = validRange;
|
|
21205
21268
|
});
|
|
21206
21269
|
|
|
21207
|
-
// node_modules/semver/ranges/outside.js
|
|
21270
|
+
// ../../node_modules/semver/ranges/outside.js
|
|
21208
21271
|
var require_outside = __commonJS((exports, module) => {
|
|
21209
21272
|
var SemVer = require_semver();
|
|
21210
21273
|
var Comparator = require_comparator();
|
|
@@ -21270,21 +21333,21 @@ var require_outside = __commonJS((exports, module) => {
|
|
|
21270
21333
|
module.exports = outside;
|
|
21271
21334
|
});
|
|
21272
21335
|
|
|
21273
|
-
// node_modules/semver/ranges/gtr.js
|
|
21336
|
+
// ../../node_modules/semver/ranges/gtr.js
|
|
21274
21337
|
var require_gtr = __commonJS((exports, module) => {
|
|
21275
21338
|
var outside = require_outside();
|
|
21276
21339
|
var gtr = (version2, range, options) => outside(version2, range, ">", options);
|
|
21277
21340
|
module.exports = gtr;
|
|
21278
21341
|
});
|
|
21279
21342
|
|
|
21280
|
-
// node_modules/semver/ranges/ltr.js
|
|
21343
|
+
// ../../node_modules/semver/ranges/ltr.js
|
|
21281
21344
|
var require_ltr = __commonJS((exports, module) => {
|
|
21282
21345
|
var outside = require_outside();
|
|
21283
21346
|
var ltr = (version2, range, options) => outside(version2, range, "<", options);
|
|
21284
21347
|
module.exports = ltr;
|
|
21285
21348
|
});
|
|
21286
21349
|
|
|
21287
|
-
// node_modules/semver/ranges/intersects.js
|
|
21350
|
+
// ../../node_modules/semver/ranges/intersects.js
|
|
21288
21351
|
var require_intersects = __commonJS((exports, module) => {
|
|
21289
21352
|
var Range = require_range();
|
|
21290
21353
|
var intersects = (r1, r2, options) => {
|
|
@@ -21295,7 +21358,7 @@ var require_intersects = __commonJS((exports, module) => {
|
|
|
21295
21358
|
module.exports = intersects;
|
|
21296
21359
|
});
|
|
21297
21360
|
|
|
21298
|
-
// node_modules/semver/ranges/simplify.js
|
|
21361
|
+
// ../../node_modules/semver/ranges/simplify.js
|
|
21299
21362
|
var require_simplify = __commonJS((exports, module) => {
|
|
21300
21363
|
var satisfies = require_satisfies();
|
|
21301
21364
|
var compare = require_compare();
|
|
@@ -21342,7 +21405,7 @@ var require_simplify = __commonJS((exports, module) => {
|
|
|
21342
21405
|
};
|
|
21343
21406
|
});
|
|
21344
21407
|
|
|
21345
|
-
// node_modules/semver/ranges/subset.js
|
|
21408
|
+
// ../../node_modules/semver/ranges/subset.js
|
|
21346
21409
|
var require_subset = __commonJS((exports, module) => {
|
|
21347
21410
|
var Range = require_range();
|
|
21348
21411
|
var Comparator = require_comparator();
|
|
@@ -21502,7 +21565,7 @@ var require_subset = __commonJS((exports, module) => {
|
|
|
21502
21565
|
module.exports = subset;
|
|
21503
21566
|
});
|
|
21504
21567
|
|
|
21505
|
-
// node_modules/semver/index.js
|
|
21568
|
+
// ../../node_modules/semver/index.js
|
|
21506
21569
|
var require_semver2 = __commonJS((exports, module) => {
|
|
21507
21570
|
var internalRe = require_re();
|
|
21508
21571
|
var constants = require_constants();
|
|
@@ -21889,7 +21952,7 @@ ${import_picocolors8.default.bold("Create profile (interactive):")}
|
|
|
21889
21952
|
${import_picocolors8.default.green(`swixter ${CODER_NAME} create`)}
|
|
21890
21953
|
|
|
21891
21954
|
${import_picocolors8.default.bold("Create profile (non-interactive):")}
|
|
21892
|
-
${import_picocolors8.default.green(`swixter ${CODER_NAME} create --quiet --name <name> --provider <id> --api-key <key> [--base-url <url>] [--anthropic-model <model>] [--default-haiku-model <model>] [--default-opus-model <model>] [--default-sonnet-model <model>] [--apply]`)}
|
|
21955
|
+
${import_picocolors8.default.green(`swixter ${CODER_NAME} create --quiet --name <name> --provider <id> --api-key <key> [--base-url <url>] [--anthropic-model <model>] [--default-haiku-model <model>] [--default-opus-model <model>] [--default-sonnet-model <model>] [--api-format <format>] [--apply]`)}
|
|
21893
21956
|
|
|
21894
21957
|
${import_picocolors8.default.bold("Examples:")}
|
|
21895
21958
|
${import_picocolors8.default.dim("# Interactive profile creation")}
|
|
@@ -21983,6 +22046,23 @@ async function cmdCreateInteractive() {
|
|
|
21983
22046
|
xe(ERRORS.cancelled);
|
|
21984
22047
|
process.exit(EXIT_CODES.cancelled);
|
|
21985
22048
|
}
|
|
22049
|
+
let apiFormat = null;
|
|
22050
|
+
if (providerId === "custom") {
|
|
22051
|
+
apiFormat = await ve({
|
|
22052
|
+
message: "Select the API format for this provider",
|
|
22053
|
+
options: [
|
|
22054
|
+
{ value: "openai_chat", label: "OpenAI Chat", hint: "OpenAI-compatible /v1/chat/completions" },
|
|
22055
|
+
{ value: "anthropic_messages", label: "Anthropic Messages", hint: "Anthropic /v1/messages" },
|
|
22056
|
+
{ value: "openai_responses", label: "OpenAI Responses", hint: "OpenAI Responses API" },
|
|
22057
|
+
{ value: "anthropic_responses", label: "Anthropic Responses", hint: "Anthropic Responses API" },
|
|
22058
|
+
{ value: "gemini_native", label: "Gemini Native", hint: "Google Gemini API" }
|
|
22059
|
+
]
|
|
22060
|
+
});
|
|
22061
|
+
if (pD(apiFormat)) {
|
|
22062
|
+
xe(ERRORS.cancelled);
|
|
22063
|
+
process.exit(EXIT_CODES.cancelled);
|
|
22064
|
+
}
|
|
22065
|
+
}
|
|
21986
22066
|
let models = undefined;
|
|
21987
22067
|
const configureModels = await ye({
|
|
21988
22068
|
message: PROMPTS.configureModels,
|
|
@@ -22060,6 +22140,9 @@ async function cmdCreateInteractive() {
|
|
|
22060
22140
|
if (models) {
|
|
22061
22141
|
profile.models = models;
|
|
22062
22142
|
}
|
|
22143
|
+
if (apiFormat) {
|
|
22144
|
+
profile.apiFormat = apiFormat;
|
|
22145
|
+
}
|
|
22063
22146
|
await upsertProfile(profile, CODER_NAME);
|
|
22064
22147
|
spinner.stop("Profile created successfully!");
|
|
22065
22148
|
console.log();
|
|
@@ -22079,7 +22162,7 @@ async function cmdCreateInteractive() {
|
|
|
22079
22162
|
async function cmdCreateQuiet(params) {
|
|
22080
22163
|
if (!params.name || !params.provider) {
|
|
22081
22164
|
console.log(import_picocolors8.default.red("Error: Missing required parameters"));
|
|
22082
|
-
console.log(import_picocolors8.default.dim("Usage: swixter claude create --quiet --name <name> --provider <id> [--api-key <key>] [--auth-token <token>] [--base-url <url>] [--anthropic-model <model>] [--default-haiku-model <model>] [--default-opus-model <model>] [--default-sonnet-model <model>] [--apply]"));
|
|
22165
|
+
console.log(import_picocolors8.default.dim("Usage: swixter claude create --quiet --name <name> --provider <id> [--api-key <key>] [--auth-token <token>] [--base-url <url>] [--anthropic-model <model>] [--default-haiku-model <model>] [--default-opus-model <model>] [--default-sonnet-model <model>] [--api-format <format>] [--apply]"));
|
|
22083
22166
|
process.exit(1);
|
|
22084
22167
|
}
|
|
22085
22168
|
const preset = await getPresetByIdAsync(params.provider);
|
|
@@ -22088,6 +22171,12 @@ async function cmdCreateQuiet(params) {
|
|
|
22088
22171
|
console.log(import_picocolors8.default.dim("Run 'swixter providers' to see all supported providers"));
|
|
22089
22172
|
process.exit(1);
|
|
22090
22173
|
}
|
|
22174
|
+
const apiFormat = params["api-format"];
|
|
22175
|
+
if (apiFormat && !API_FORMATS.includes(apiFormat)) {
|
|
22176
|
+
console.log(import_picocolors8.default.red(`Invalid apiFormat: ${apiFormat}`));
|
|
22177
|
+
console.log(import_picocolors8.default.dim(`Valid values: ${API_FORMATS.join(", ")}`));
|
|
22178
|
+
process.exit(EXIT_CODES.invalidArguments);
|
|
22179
|
+
}
|
|
22091
22180
|
try {
|
|
22092
22181
|
const finalBaseURL = params["base-url"] || preset.baseURL;
|
|
22093
22182
|
const profile = {
|
|
@@ -22115,6 +22204,9 @@ async function cmdCreateQuiet(params) {
|
|
|
22115
22204
|
...defaultSonnetModel && { defaultSonnetModel }
|
|
22116
22205
|
};
|
|
22117
22206
|
}
|
|
22207
|
+
if (apiFormat) {
|
|
22208
|
+
profile.apiFormat = apiFormat;
|
|
22209
|
+
}
|
|
22118
22210
|
await upsertProfile(profile, CODER_NAME);
|
|
22119
22211
|
console.log();
|
|
22120
22212
|
console.log(import_picocolors8.default.green("✓") + " Profile created successfully!");
|
|
@@ -22309,6 +22401,21 @@ async function cmdEdit(profileName) {
|
|
|
22309
22401
|
xe(ERRORS.cancelled);
|
|
22310
22402
|
return;
|
|
22311
22403
|
}
|
|
22404
|
+
const currentApiFormat = profile.apiFormat || "auto-detect";
|
|
22405
|
+
const apiFormatOptions = [
|
|
22406
|
+
{ value: "", label: "Keep current" },
|
|
22407
|
+
{ value: "clear", label: "Auto-detect (clear explicit format)" },
|
|
22408
|
+
...API_FORMATS.map((f) => ({ value: f, label: f }))
|
|
22409
|
+
];
|
|
22410
|
+
const newApiFormat = await ve({
|
|
22411
|
+
message: `Select target API format (current: ${currentApiFormat})`,
|
|
22412
|
+
options: apiFormatOptions,
|
|
22413
|
+
initialValue: profile.apiFormat || ""
|
|
22414
|
+
});
|
|
22415
|
+
if (pD(newApiFormat)) {
|
|
22416
|
+
xe(ERRORS.cancelled);
|
|
22417
|
+
return;
|
|
22418
|
+
}
|
|
22312
22419
|
let models = undefined;
|
|
22313
22420
|
let editedModels = false;
|
|
22314
22421
|
const currentModelsInfo = profile.models ? `Current: ${Object.entries(profile.models).filter(([, v2]) => v2).map(([k3, v2]) => `${k3}=${v2}`).join(", ")}` : "No models configured";
|
|
@@ -22398,6 +22505,13 @@ async function cmdEdit(profileName) {
|
|
|
22398
22505
|
} else if (profile.models) {
|
|
22399
22506
|
updatedProfile.models = profile.models;
|
|
22400
22507
|
}
|
|
22508
|
+
if (newApiFormat === "clear") {} else if (newApiFormat) {
|
|
22509
|
+
updatedProfile.apiFormat = newApiFormat;
|
|
22510
|
+
} else {
|
|
22511
|
+
if (profile.apiFormat) {
|
|
22512
|
+
updatedProfile.apiFormat = profile.apiFormat;
|
|
22513
|
+
}
|
|
22514
|
+
}
|
|
22401
22515
|
const finalBaseURL = updatedProfile.baseURL || newPreset?.baseURL || "";
|
|
22402
22516
|
await upsertProfile(updatedProfile, CODER_NAME);
|
|
22403
22517
|
spinner.stop("Profile updated successfully!");
|
|
@@ -22681,6 +22795,7 @@ var init_claude2 = __esm(() => {
|
|
|
22681
22795
|
init_manager();
|
|
22682
22796
|
init_presets();
|
|
22683
22797
|
init_adapters();
|
|
22798
|
+
init_types2();
|
|
22684
22799
|
init_constants();
|
|
22685
22800
|
init_ui();
|
|
22686
22801
|
init_validation();
|
|
@@ -22694,7 +22809,7 @@ var init_claude2 = __esm(() => {
|
|
|
22694
22809
|
CODER_CONFIG = CODER_REGISTRY[CODER_NAME];
|
|
22695
22810
|
});
|
|
22696
22811
|
|
|
22697
|
-
// node_modules/ws/lib/constants.js
|
|
22812
|
+
// ../../node_modules/ws/lib/constants.js
|
|
22698
22813
|
var require_constants2 = __commonJS((exports, module) => {
|
|
22699
22814
|
var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
|
|
22700
22815
|
var hasBlob = typeof Blob !== "undefined";
|
|
@@ -22714,7 +22829,7 @@ var require_constants2 = __commonJS((exports, module) => {
|
|
|
22714
22829
|
};
|
|
22715
22830
|
});
|
|
22716
22831
|
|
|
22717
|
-
// node_modules/ws/lib/buffer-util.js
|
|
22832
|
+
// ../../node_modules/ws/lib/buffer-util.js
|
|
22718
22833
|
var require_buffer_util = __commonJS((exports, module) => {
|
|
22719
22834
|
var { EMPTY_BUFFER } = require_constants2();
|
|
22720
22835
|
var FastBuffer = Buffer[Symbol.species];
|
|
@@ -22792,7 +22907,7 @@ var require_buffer_util = __commonJS((exports, module) => {
|
|
|
22792
22907
|
}
|
|
22793
22908
|
});
|
|
22794
22909
|
|
|
22795
|
-
// node_modules/ws/lib/limiter.js
|
|
22910
|
+
// ../../node_modules/ws/lib/limiter.js
|
|
22796
22911
|
var require_limiter = __commonJS((exports, module) => {
|
|
22797
22912
|
var kDone = Symbol("kDone");
|
|
22798
22913
|
var kRun = Symbol("kRun");
|
|
@@ -22824,7 +22939,7 @@ var require_limiter = __commonJS((exports, module) => {
|
|
|
22824
22939
|
module.exports = Limiter;
|
|
22825
22940
|
});
|
|
22826
22941
|
|
|
22827
|
-
// node_modules/ws/lib/permessage-deflate.js
|
|
22942
|
+
// ../../node_modules/ws/lib/permessage-deflate.js
|
|
22828
22943
|
var require_permessage_deflate = __commonJS((exports, module) => {
|
|
22829
22944
|
var zlib = __require("zlib");
|
|
22830
22945
|
var bufferUtil = require_buffer_util();
|
|
@@ -23088,7 +23203,7 @@ var require_permessage_deflate = __commonJS((exports, module) => {
|
|
|
23088
23203
|
}
|
|
23089
23204
|
});
|
|
23090
23205
|
|
|
23091
|
-
// node_modules/ws/lib/validation.js
|
|
23206
|
+
// ../../node_modules/ws/lib/validation.js
|
|
23092
23207
|
var require_validation = __commonJS((exports, module) => {
|
|
23093
23208
|
var { isUtf8 } = __require("buffer");
|
|
23094
23209
|
var { hasBlob } = require_constants2();
|
|
@@ -23275,7 +23390,7 @@ var require_validation = __commonJS((exports, module) => {
|
|
|
23275
23390
|
}
|
|
23276
23391
|
});
|
|
23277
23392
|
|
|
23278
|
-
// node_modules/ws/lib/receiver.js
|
|
23393
|
+
// ../../node_modules/ws/lib/receiver.js
|
|
23279
23394
|
var require_receiver = __commonJS((exports, module) => {
|
|
23280
23395
|
var { Writable } = __require("stream");
|
|
23281
23396
|
var PerMessageDeflate = require_permessage_deflate();
|
|
@@ -23656,7 +23771,7 @@ var require_receiver = __commonJS((exports, module) => {
|
|
|
23656
23771
|
module.exports = Receiver;
|
|
23657
23772
|
});
|
|
23658
23773
|
|
|
23659
|
-
// node_modules/ws/lib/sender.js
|
|
23774
|
+
// ../../node_modules/ws/lib/sender.js
|
|
23660
23775
|
var require_sender = __commonJS((exports, module) => {
|
|
23661
23776
|
var { Duplex } = __require("stream");
|
|
23662
23777
|
var { randomFillSync } = __require("crypto");
|
|
@@ -24010,7 +24125,7 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
24010
24125
|
}
|
|
24011
24126
|
});
|
|
24012
24127
|
|
|
24013
|
-
// node_modules/ws/lib/event-target.js
|
|
24128
|
+
// ../../node_modules/ws/lib/event-target.js
|
|
24014
24129
|
var require_event_target = __commonJS((exports, module) => {
|
|
24015
24130
|
var { kForOnEventAttribute, kListener } = require_constants2();
|
|
24016
24131
|
var kCode = Symbol("kCode");
|
|
@@ -24161,7 +24276,7 @@ var require_event_target = __commonJS((exports, module) => {
|
|
|
24161
24276
|
}
|
|
24162
24277
|
});
|
|
24163
24278
|
|
|
24164
|
-
// node_modules/ws/lib/extension.js
|
|
24279
|
+
// ../../node_modules/ws/lib/extension.js
|
|
24165
24280
|
var require_extension = __commonJS((exports, module) => {
|
|
24166
24281
|
var { tokenChars } = require_validation();
|
|
24167
24282
|
function push(dest, name, elem) {
|
|
@@ -24326,7 +24441,7 @@ var require_extension = __commonJS((exports, module) => {
|
|
|
24326
24441
|
module.exports = { format, parse: parse6 };
|
|
24327
24442
|
});
|
|
24328
24443
|
|
|
24329
|
-
// node_modules/ws/lib/websocket.js
|
|
24444
|
+
// ../../node_modules/ws/lib/websocket.js
|
|
24330
24445
|
var require_websocket = __commonJS((exports, module) => {
|
|
24331
24446
|
var EventEmitter = __require("events");
|
|
24332
24447
|
var https = __require("https");
|
|
@@ -25092,7 +25207,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
25092
25207
|
}
|
|
25093
25208
|
});
|
|
25094
25209
|
|
|
25095
|
-
// node_modules/ws/lib/stream.js
|
|
25210
|
+
// ../../node_modules/ws/lib/stream.js
|
|
25096
25211
|
var require_stream = __commonJS((exports, module) => {
|
|
25097
25212
|
var WebSocket = require_websocket();
|
|
25098
25213
|
var { Duplex } = __require("stream");
|
|
@@ -25195,7 +25310,7 @@ var require_stream = __commonJS((exports, module) => {
|
|
|
25195
25310
|
module.exports = createWebSocketStream;
|
|
25196
25311
|
});
|
|
25197
25312
|
|
|
25198
|
-
// node_modules/ws/lib/subprotocol.js
|
|
25313
|
+
// ../../node_modules/ws/lib/subprotocol.js
|
|
25199
25314
|
var require_subprotocol = __commonJS((exports, module) => {
|
|
25200
25315
|
var { tokenChars } = require_validation();
|
|
25201
25316
|
function parse6(header) {
|
|
@@ -25240,7 +25355,7 @@ var require_subprotocol = __commonJS((exports, module) => {
|
|
|
25240
25355
|
module.exports = { parse: parse6 };
|
|
25241
25356
|
});
|
|
25242
25357
|
|
|
25243
|
-
// node_modules/ws/lib/websocket-server.js
|
|
25358
|
+
// ../../node_modules/ws/lib/websocket-server.js
|
|
25244
25359
|
var require_websocket_server = __commonJS((exports, module) => {
|
|
25245
25360
|
var EventEmitter = __require("events");
|
|
25246
25361
|
var http = __require("http");
|
|
@@ -25580,6 +25695,711 @@ var init_events = __esm(() => {
|
|
|
25580
25695
|
handlers = new Set;
|
|
25581
25696
|
});
|
|
25582
25697
|
|
|
25698
|
+
// src/proxy/transform/utils.ts
|
|
25699
|
+
function parseSSEEvents(chunk) {
|
|
25700
|
+
const events = [];
|
|
25701
|
+
const lines = chunk.split(`
|
|
25702
|
+
`);
|
|
25703
|
+
let currentEvent = "";
|
|
25704
|
+
let currentDataLines = [];
|
|
25705
|
+
function flushEvent() {
|
|
25706
|
+
if (currentDataLines.length > 0) {
|
|
25707
|
+
const dataStr = currentDataLines.join(`
|
|
25708
|
+
`);
|
|
25709
|
+
try {
|
|
25710
|
+
const data = JSON.parse(dataStr);
|
|
25711
|
+
events.push({ event: currentEvent, data });
|
|
25712
|
+
} catch {}
|
|
25713
|
+
}
|
|
25714
|
+
currentEvent = "";
|
|
25715
|
+
currentDataLines = [];
|
|
25716
|
+
}
|
|
25717
|
+
for (const line of lines) {
|
|
25718
|
+
if (line.startsWith("event: ")) {
|
|
25719
|
+
currentEvent = line.slice("event: ".length);
|
|
25720
|
+
} else if (line.startsWith("data: ")) {
|
|
25721
|
+
currentDataLines.push(line.slice("data: ".length));
|
|
25722
|
+
} else if (line === "") {
|
|
25723
|
+
flushEvent();
|
|
25724
|
+
}
|
|
25725
|
+
}
|
|
25726
|
+
return events;
|
|
25727
|
+
}
|
|
25728
|
+
function serializeSSEEvent(eventName, data) {
|
|
25729
|
+
const dataStr = typeof data === "string" ? data : JSON.stringify(data);
|
|
25730
|
+
if (eventName) {
|
|
25731
|
+
return `event: ${eventName}
|
|
25732
|
+
data: ${dataStr}
|
|
25733
|
+
|
|
25734
|
+
`;
|
|
25735
|
+
}
|
|
25736
|
+
return `data: ${dataStr}
|
|
25737
|
+
|
|
25738
|
+
`;
|
|
25739
|
+
}
|
|
25740
|
+
function convertAnthropicImageToOpenAI(imageBlock) {
|
|
25741
|
+
const source = imageBlock.source;
|
|
25742
|
+
if (!source) {
|
|
25743
|
+
return { type: "image_url", image_url: { url: "" } };
|
|
25744
|
+
}
|
|
25745
|
+
const mediaType = source.media_type || "image/png";
|
|
25746
|
+
const data = source.data || "";
|
|
25747
|
+
return {
|
|
25748
|
+
type: "image_url",
|
|
25749
|
+
image_url: {
|
|
25750
|
+
url: `data:${mediaType};base64,${data}`
|
|
25751
|
+
}
|
|
25752
|
+
};
|
|
25753
|
+
}
|
|
25754
|
+
function convertOpenAIToolCallsToAnthropic(toolCalls) {
|
|
25755
|
+
return toolCalls.map((tc) => {
|
|
25756
|
+
const func = tc.function;
|
|
25757
|
+
return {
|
|
25758
|
+
type: "tool_use",
|
|
25759
|
+
id: tc.id,
|
|
25760
|
+
name: func?.name || "",
|
|
25761
|
+
input: func?.arguments ? JSON.parse(func.arguments) : {}
|
|
25762
|
+
};
|
|
25763
|
+
});
|
|
25764
|
+
}
|
|
25765
|
+
function convertAnthropicToolUseToOpenAI(toolUses) {
|
|
25766
|
+
return toolUses.map((tu) => ({
|
|
25767
|
+
id: tu.id,
|
|
25768
|
+
type: "function",
|
|
25769
|
+
function: {
|
|
25770
|
+
name: tu.name,
|
|
25771
|
+
arguments: JSON.stringify(tu.input || {})
|
|
25772
|
+
}
|
|
25773
|
+
}));
|
|
25774
|
+
}
|
|
25775
|
+
function mergeSystemBlocks(system) {
|
|
25776
|
+
if (typeof system === "string") {
|
|
25777
|
+
return system;
|
|
25778
|
+
}
|
|
25779
|
+
if (Array.isArray(system)) {
|
|
25780
|
+
return system.filter((s) => s.type === "text").map((s) => s.text).filter(Boolean).join(`
|
|
25781
|
+
`);
|
|
25782
|
+
}
|
|
25783
|
+
return "";
|
|
25784
|
+
}
|
|
25785
|
+
|
|
25786
|
+
// src/proxy/transform/streaming/base.ts
|
|
25787
|
+
class SSEStreamTransformer {
|
|
25788
|
+
ctx;
|
|
25789
|
+
encoder = new TextEncoder;
|
|
25790
|
+
decoder = new TextDecoder("utf-8", { fatal: false });
|
|
25791
|
+
buffer = "";
|
|
25792
|
+
constructor(ctx) {
|
|
25793
|
+
this.ctx = ctx;
|
|
25794
|
+
}
|
|
25795
|
+
transformChunk(chunk) {
|
|
25796
|
+
const text = this.decoder.decode(chunk, { stream: true });
|
|
25797
|
+
this.buffer += text;
|
|
25798
|
+
const lastDoubleNewline = this.buffer.lastIndexOf(`
|
|
25799
|
+
|
|
25800
|
+
`);
|
|
25801
|
+
if (lastDoubleNewline === -1) {
|
|
25802
|
+
return new Uint8Array(0);
|
|
25803
|
+
}
|
|
25804
|
+
const completeText = this.buffer.slice(0, lastDoubleNewline + 2);
|
|
25805
|
+
this.buffer = this.buffer.slice(lastDoubleNewline + 2);
|
|
25806
|
+
const events = parseSSEEvents(completeText);
|
|
25807
|
+
const outputEvents = [];
|
|
25808
|
+
for (const event of events) {
|
|
25809
|
+
const converted = this.convertEvent(event);
|
|
25810
|
+
if (converted) {
|
|
25811
|
+
if (Array.isArray(converted)) {
|
|
25812
|
+
outputEvents.push(...converted);
|
|
25813
|
+
} else {
|
|
25814
|
+
outputEvents.push(converted);
|
|
25815
|
+
}
|
|
25816
|
+
}
|
|
25817
|
+
}
|
|
25818
|
+
if (outputEvents.length === 0) {
|
|
25819
|
+
return new Uint8Array(0);
|
|
25820
|
+
}
|
|
25821
|
+
const outputText = outputEvents.map((e2) => serializeSSEEvent(e2.event, e2.data)).join("");
|
|
25822
|
+
return this.encoder.encode(outputText);
|
|
25823
|
+
}
|
|
25824
|
+
flush() {
|
|
25825
|
+
if (this.buffer.trim().length > 0) {
|
|
25826
|
+
const events = parseSSEEvents(this.buffer + `
|
|
25827
|
+
|
|
25828
|
+
`);
|
|
25829
|
+
const outputEvents = [];
|
|
25830
|
+
for (const event of events) {
|
|
25831
|
+
const converted = this.convertEvent(event);
|
|
25832
|
+
if (converted) {
|
|
25833
|
+
if (Array.isArray(converted)) {
|
|
25834
|
+
outputEvents.push(...converted);
|
|
25835
|
+
} else {
|
|
25836
|
+
outputEvents.push(converted);
|
|
25837
|
+
}
|
|
25838
|
+
}
|
|
25839
|
+
}
|
|
25840
|
+
this.buffer = "";
|
|
25841
|
+
if (outputEvents.length > 0) {
|
|
25842
|
+
const outputText = outputEvents.map((e2) => serializeSSEEvent(e2.event, e2.data)).join("");
|
|
25843
|
+
return this.encoder.encode(outputText);
|
|
25844
|
+
}
|
|
25845
|
+
}
|
|
25846
|
+
return new Uint8Array(0);
|
|
25847
|
+
}
|
|
25848
|
+
}
|
|
25849
|
+
function createSSETransformStream(transformer) {
|
|
25850
|
+
return new TransformStream({
|
|
25851
|
+
transform(chunk, controller) {
|
|
25852
|
+
const output = transformer.transformChunk(chunk);
|
|
25853
|
+
if (output.length > 0) {
|
|
25854
|
+
controller.enqueue(output);
|
|
25855
|
+
}
|
|
25856
|
+
},
|
|
25857
|
+
flush(controller) {
|
|
25858
|
+
const output = transformer.flush();
|
|
25859
|
+
if (output.length > 0) {
|
|
25860
|
+
controller.enqueue(output);
|
|
25861
|
+
}
|
|
25862
|
+
}
|
|
25863
|
+
});
|
|
25864
|
+
}
|
|
25865
|
+
var init_base = () => {};
|
|
25866
|
+
|
|
25867
|
+
// src/proxy/transform/index.ts
|
|
25868
|
+
function registerTransformer(entry) {
|
|
25869
|
+
const existingIndex = TRANSFORMER_REGISTRY.findIndex((t) => t.clientFormat === entry.clientFormat && t.targetFormat === entry.targetFormat);
|
|
25870
|
+
if (existingIndex >= 0) {
|
|
25871
|
+
TRANSFORMER_REGISTRY.splice(existingIndex, 1);
|
|
25872
|
+
}
|
|
25873
|
+
TRANSFORMER_REGISTRY.push(entry);
|
|
25874
|
+
}
|
|
25875
|
+
function inferClientFormat(endpoint) {
|
|
25876
|
+
if (endpoint.includes("/v1/chat/completions")) {
|
|
25877
|
+
return "openai_chat";
|
|
25878
|
+
}
|
|
25879
|
+
if (endpoint.includes("/v1/responses")) {
|
|
25880
|
+
return "anthropic_responses";
|
|
25881
|
+
}
|
|
25882
|
+
if (endpoint.includes("/anthropic/") || endpoint.includes("/v1/messages")) {
|
|
25883
|
+
return "anthropic_messages";
|
|
25884
|
+
}
|
|
25885
|
+
return "anthropic_messages";
|
|
25886
|
+
}
|
|
25887
|
+
function inferApiFormatFromBaseURL(baseURL) {
|
|
25888
|
+
try {
|
|
25889
|
+
const url2 = new URL(baseURL);
|
|
25890
|
+
const path = url2.pathname.toLowerCase();
|
|
25891
|
+
if (path.includes("/anthropic"))
|
|
25892
|
+
return "anthropic_messages";
|
|
25893
|
+
if (path.includes("/responses"))
|
|
25894
|
+
return "anthropic_responses";
|
|
25895
|
+
if (path.includes("/openai"))
|
|
25896
|
+
return "openai_chat";
|
|
25897
|
+
return null;
|
|
25898
|
+
} catch {
|
|
25899
|
+
return null;
|
|
25900
|
+
}
|
|
25901
|
+
}
|
|
25902
|
+
function inferTargetApiFormat(profile, preset) {
|
|
25903
|
+
if (profile.apiFormat) {
|
|
25904
|
+
return profile.apiFormat;
|
|
25905
|
+
}
|
|
25906
|
+
const baseURL = profile.baseURL || preset?.baseURL || "";
|
|
25907
|
+
const fromURL = inferApiFormatFromBaseURL(baseURL);
|
|
25908
|
+
if (fromURL) {
|
|
25909
|
+
return fromURL;
|
|
25910
|
+
}
|
|
25911
|
+
if (preset?.defaultApiFormat) {
|
|
25912
|
+
return preset.defaultApiFormat;
|
|
25913
|
+
}
|
|
25914
|
+
switch (preset.wire_api) {
|
|
25915
|
+
case "chat":
|
|
25916
|
+
return "openai_chat";
|
|
25917
|
+
case "responses":
|
|
25918
|
+
return "anthropic_messages";
|
|
25919
|
+
default:
|
|
25920
|
+
return "openai_chat";
|
|
25921
|
+
}
|
|
25922
|
+
}
|
|
25923
|
+
function getTransformer(clientFormat, targetFormat) {
|
|
25924
|
+
if (clientFormat === targetFormat) {
|
|
25925
|
+
return null;
|
|
25926
|
+
}
|
|
25927
|
+
const entry = TRANSFORMER_REGISTRY.find((t) => t.clientFormat === clientFormat && t.targetFormat === targetFormat);
|
|
25928
|
+
return entry ?? null;
|
|
25929
|
+
}
|
|
25930
|
+
function transformRequest(body, ctx) {
|
|
25931
|
+
const transformer = getTransformer(ctx.clientFormat, ctx.targetFormat);
|
|
25932
|
+
if (!transformer) {
|
|
25933
|
+
return { body, targetEndpoint: ctx.endpoint };
|
|
25934
|
+
}
|
|
25935
|
+
return transformer.requestTransform(body, ctx);
|
|
25936
|
+
}
|
|
25937
|
+
function transformResponse(body, ctx) {
|
|
25938
|
+
const transformer = getTransformer(ctx.clientFormat, ctx.targetFormat);
|
|
25939
|
+
if (!transformer) {
|
|
25940
|
+
return body;
|
|
25941
|
+
}
|
|
25942
|
+
return transformer.responseTransform(body, ctx);
|
|
25943
|
+
}
|
|
25944
|
+
function transformStream(stream, ctx) {
|
|
25945
|
+
const transformer = getTransformer(ctx.clientFormat, ctx.targetFormat);
|
|
25946
|
+
if (!transformer) {
|
|
25947
|
+
return stream;
|
|
25948
|
+
}
|
|
25949
|
+
return transformer.streamTransform(stream, ctx);
|
|
25950
|
+
}
|
|
25951
|
+
var TRANSFORMER_REGISTRY;
|
|
25952
|
+
var init_transform = __esm(() => {
|
|
25953
|
+
TRANSFORMER_REGISTRY = [];
|
|
25954
|
+
});
|
|
25955
|
+
|
|
25956
|
+
// src/proxy/transform/request/anthropic-to-openai-chat.ts
|
|
25957
|
+
function anthropicToOpenAIChatRequest(body, _ctx) {
|
|
25958
|
+
const anthropic = body;
|
|
25959
|
+
const openaiBody = {
|
|
25960
|
+
model: anthropic.model,
|
|
25961
|
+
messages: convertMessages(anthropic.messages)
|
|
25962
|
+
};
|
|
25963
|
+
if (anthropic.system !== undefined) {
|
|
25964
|
+
const systemText = mergeSystemBlocks(anthropic.system);
|
|
25965
|
+
if (systemText) {
|
|
25966
|
+
const messages2 = openaiBody.messages;
|
|
25967
|
+
messages2.unshift({ role: "system", content: systemText });
|
|
25968
|
+
}
|
|
25969
|
+
}
|
|
25970
|
+
if (anthropic.max_tokens !== undefined) {
|
|
25971
|
+
openaiBody.max_tokens = anthropic.max_tokens;
|
|
25972
|
+
}
|
|
25973
|
+
if (anthropic.temperature !== undefined) {
|
|
25974
|
+
openaiBody.temperature = anthropic.temperature;
|
|
25975
|
+
}
|
|
25976
|
+
if (anthropic.top_p !== undefined) {
|
|
25977
|
+
openaiBody.top_p = anthropic.top_p;
|
|
25978
|
+
}
|
|
25979
|
+
if (anthropic.stream !== undefined) {
|
|
25980
|
+
openaiBody.stream = anthropic.stream;
|
|
25981
|
+
}
|
|
25982
|
+
if (anthropic.stop_sequences !== undefined) {
|
|
25983
|
+
openaiBody.stop = anthropic.stop_sequences;
|
|
25984
|
+
}
|
|
25985
|
+
if (anthropic.tools !== undefined) {
|
|
25986
|
+
const tools = anthropic.tools;
|
|
25987
|
+
openaiBody.tools = tools.map((tool) => ({
|
|
25988
|
+
type: "function",
|
|
25989
|
+
function: {
|
|
25990
|
+
name: tool.name,
|
|
25991
|
+
description: tool.description,
|
|
25992
|
+
parameters: tool.input_schema
|
|
25993
|
+
}
|
|
25994
|
+
}));
|
|
25995
|
+
}
|
|
25996
|
+
if (anthropic.tool_choice !== undefined) {
|
|
25997
|
+
openaiBody.tool_choice = convertToolChoice(anthropic.tool_choice);
|
|
25998
|
+
}
|
|
25999
|
+
if (anthropic.thinking !== undefined) {
|
|
26000
|
+
const thinking = anthropic.thinking;
|
|
26001
|
+
if (thinking.budget_tokens !== undefined) {
|
|
26002
|
+
openaiBody.reasoning_effort = mapThinkingBudgetToEffort(Number(thinking.budget_tokens));
|
|
26003
|
+
}
|
|
26004
|
+
}
|
|
26005
|
+
return {
|
|
26006
|
+
body: openaiBody,
|
|
26007
|
+
targetEndpoint: "/v1/chat/completions"
|
|
26008
|
+
};
|
|
26009
|
+
}
|
|
26010
|
+
function convertMessages(messages2) {
|
|
26011
|
+
if (!messages2)
|
|
26012
|
+
return [];
|
|
26013
|
+
return messages2.map((msg) => {
|
|
26014
|
+
const role = msg.role;
|
|
26015
|
+
const content = msg.content;
|
|
26016
|
+
if (Array.isArray(content)) {
|
|
26017
|
+
const convertedContent = content.map((block) => {
|
|
26018
|
+
switch (block.type) {
|
|
26019
|
+
case "text":
|
|
26020
|
+
return { type: "text", text: block.text };
|
|
26021
|
+
case "image":
|
|
26022
|
+
return convertAnthropicImageToOpenAI(block);
|
|
26023
|
+
case "tool_use":
|
|
26024
|
+
return null;
|
|
26025
|
+
case "tool_result":
|
|
26026
|
+
return null;
|
|
26027
|
+
default:
|
|
26028
|
+
return block;
|
|
26029
|
+
}
|
|
26030
|
+
}).filter(Boolean);
|
|
26031
|
+
const toolUses = content.filter((b3) => b3.type === "tool_use");
|
|
26032
|
+
if (toolUses.length > 0 && role === "assistant") {
|
|
26033
|
+
return {
|
|
26034
|
+
role: "assistant",
|
|
26035
|
+
content: convertedContent.length > 0 ? convertedContent : null,
|
|
26036
|
+
tool_calls: convertAnthropicToolUseToOpenAI(toolUses)
|
|
26037
|
+
};
|
|
26038
|
+
}
|
|
26039
|
+
const toolResults = content.filter((b3) => b3.type === "tool_result");
|
|
26040
|
+
if (toolResults.length > 0 && role === "user") {
|
|
26041
|
+
return toolResults.map((tr) => ({
|
|
26042
|
+
role: "tool",
|
|
26043
|
+
tool_call_id: tr.tool_use_id,
|
|
26044
|
+
content: typeof tr.content === "string" ? tr.content : JSON.stringify(tr.content)
|
|
26045
|
+
}));
|
|
26046
|
+
}
|
|
26047
|
+
return { role, content: convertedContent };
|
|
26048
|
+
}
|
|
26049
|
+
return { role, content };
|
|
26050
|
+
}).flat();
|
|
26051
|
+
}
|
|
26052
|
+
function convertToolChoice(toolChoice) {
|
|
26053
|
+
if (typeof toolChoice === "string") {
|
|
26054
|
+
switch (toolChoice) {
|
|
26055
|
+
case "any":
|
|
26056
|
+
return "required";
|
|
26057
|
+
case "none":
|
|
26058
|
+
return "none";
|
|
26059
|
+
case "auto":
|
|
26060
|
+
default:
|
|
26061
|
+
return "auto";
|
|
26062
|
+
}
|
|
26063
|
+
}
|
|
26064
|
+
if (typeof toolChoice === "object" && toolChoice !== null) {
|
|
26065
|
+
const tc = toolChoice;
|
|
26066
|
+
if (tc.type === "tool") {
|
|
26067
|
+
return {
|
|
26068
|
+
type: "function",
|
|
26069
|
+
function: { name: tc.name }
|
|
26070
|
+
};
|
|
26071
|
+
}
|
|
26072
|
+
}
|
|
26073
|
+
return toolChoice;
|
|
26074
|
+
}
|
|
26075
|
+
function mapThinkingBudgetToEffort(budgetTokens) {
|
|
26076
|
+
if (budgetTokens >= 32000)
|
|
26077
|
+
return "high";
|
|
26078
|
+
if (budgetTokens >= 16000)
|
|
26079
|
+
return "medium";
|
|
26080
|
+
return "low";
|
|
26081
|
+
}
|
|
26082
|
+
var init_anthropic_to_openai_chat = () => {};
|
|
26083
|
+
|
|
26084
|
+
// src/proxy/transform/response/openai-chat-to-anthropic.ts
|
|
26085
|
+
function openAIChatToAnthropicResponse(body, _ctx) {
|
|
26086
|
+
const openai = body;
|
|
26087
|
+
const choices = openai.choices;
|
|
26088
|
+
if (!choices || choices.length === 0) {
|
|
26089
|
+
return body;
|
|
26090
|
+
}
|
|
26091
|
+
const choice = choices[0];
|
|
26092
|
+
const message = choice.message;
|
|
26093
|
+
if (!message) {
|
|
26094
|
+
return body;
|
|
26095
|
+
}
|
|
26096
|
+
const content = [];
|
|
26097
|
+
if (message.reasoning_content) {
|
|
26098
|
+
content.push({
|
|
26099
|
+
type: "thinking",
|
|
26100
|
+
thinking: message.reasoning_content
|
|
26101
|
+
});
|
|
26102
|
+
}
|
|
26103
|
+
if (message.tool_calls) {
|
|
26104
|
+
const toolCalls = message.tool_calls;
|
|
26105
|
+
content.push(...convertOpenAIToolCallsToAnthropic(toolCalls));
|
|
26106
|
+
}
|
|
26107
|
+
if (message.content && message.content !== null) {
|
|
26108
|
+
const textContent = message.content;
|
|
26109
|
+
if (textContent.length > 0) {
|
|
26110
|
+
content.push({ type: "text", text: textContent });
|
|
26111
|
+
}
|
|
26112
|
+
}
|
|
26113
|
+
const usage = openai.usage;
|
|
26114
|
+
const anthropicUsage = {};
|
|
26115
|
+
if (usage) {
|
|
26116
|
+
anthropicUsage.input_tokens = usage.prompt_tokens || 0;
|
|
26117
|
+
anthropicUsage.output_tokens = usage.completion_tokens || 0;
|
|
26118
|
+
if (usage.prompt_tokens_details) {
|
|
26119
|
+
const details = usage.prompt_tokens_details;
|
|
26120
|
+
if (details.cached_tokens) {
|
|
26121
|
+
anthropicUsage.cache_read_input_tokens = details.cached_tokens;
|
|
26122
|
+
}
|
|
26123
|
+
}
|
|
26124
|
+
}
|
|
26125
|
+
return {
|
|
26126
|
+
id: openai.id || `msg_${Date.now()}`,
|
|
26127
|
+
type: "message",
|
|
26128
|
+
role: "assistant",
|
|
26129
|
+
model: openai.model || "unknown",
|
|
26130
|
+
content,
|
|
26131
|
+
stop_reason: mapFinishReason(choice.finish_reason),
|
|
26132
|
+
stop_sequence: null,
|
|
26133
|
+
usage: anthropicUsage
|
|
26134
|
+
};
|
|
26135
|
+
}
|
|
26136
|
+
function mapFinishReason(finishReason) {
|
|
26137
|
+
if (!finishReason)
|
|
26138
|
+
return null;
|
|
26139
|
+
switch (finishReason) {
|
|
26140
|
+
case "stop":
|
|
26141
|
+
return "end_turn";
|
|
26142
|
+
case "length":
|
|
26143
|
+
return "max_tokens";
|
|
26144
|
+
case "tool_calls":
|
|
26145
|
+
return "tool_use";
|
|
26146
|
+
case "function_call":
|
|
26147
|
+
return "tool_use";
|
|
26148
|
+
case "content_filter":
|
|
26149
|
+
return "end_turn";
|
|
26150
|
+
default:
|
|
26151
|
+
return finishReason;
|
|
26152
|
+
}
|
|
26153
|
+
}
|
|
26154
|
+
var init_openai_chat_to_anthropic = () => {};
|
|
26155
|
+
|
|
26156
|
+
// src/proxy/transform/streaming/openai-chat-to-anthropic.ts
|
|
26157
|
+
function createOpenAIChatToAnthropicStreamTransform(ctx) {
|
|
26158
|
+
const transformer = new OpenAIChatToAnthropicStreamTransformer(ctx);
|
|
26159
|
+
return createSSETransformStream(transformer);
|
|
26160
|
+
}
|
|
26161
|
+
var OpenAIChatToAnthropicStreamTransformer;
|
|
26162
|
+
var init_openai_chat_to_anthropic2 = __esm(() => {
|
|
26163
|
+
init_base();
|
|
26164
|
+
init_transform();
|
|
26165
|
+
init_anthropic_to_openai_chat();
|
|
26166
|
+
init_openai_chat_to_anthropic();
|
|
26167
|
+
OpenAIChatToAnthropicStreamTransformer = class OpenAIChatToAnthropicStreamTransformer extends SSEStreamTransformer {
|
|
26168
|
+
messageId = "";
|
|
26169
|
+
currentModel = "";
|
|
26170
|
+
hasSentMessageStart = false;
|
|
26171
|
+
contentBlockIndex = 0;
|
|
26172
|
+
currentTextBlockIndex = -1;
|
|
26173
|
+
currentThinkingBlockIndex = -1;
|
|
26174
|
+
hasStartedTextBlock = false;
|
|
26175
|
+
hasStartedThinkingBlock = false;
|
|
26176
|
+
toolBlockIndexMap = new Map;
|
|
26177
|
+
openToolBlockIndices = new Set;
|
|
26178
|
+
pendingToolData = new Map;
|
|
26179
|
+
lastEmittedArgsLength = new Map;
|
|
26180
|
+
hasEmittedMessageDelta = false;
|
|
26181
|
+
convertEvent(event) {
|
|
26182
|
+
if (event.data === "[DONE]") {
|
|
26183
|
+
return null;
|
|
26184
|
+
}
|
|
26185
|
+
const data = event.data;
|
|
26186
|
+
const choices = data.choices;
|
|
26187
|
+
if (!choices || choices.length === 0) {
|
|
26188
|
+
return null;
|
|
26189
|
+
}
|
|
26190
|
+
const choice = choices[0];
|
|
26191
|
+
const delta = choice.delta;
|
|
26192
|
+
const finishReason = choice.finish_reason;
|
|
26193
|
+
if (!this.hasSentMessageStart && data.id) {
|
|
26194
|
+
this.messageId = data.id;
|
|
26195
|
+
this.currentModel = data.model || "unknown";
|
|
26196
|
+
}
|
|
26197
|
+
const events = [];
|
|
26198
|
+
if (!this.hasSentMessageStart) {
|
|
26199
|
+
this.hasSentMessageStart = true;
|
|
26200
|
+
events.push({
|
|
26201
|
+
event: "message_start",
|
|
26202
|
+
data: {
|
|
26203
|
+
type: "message_start",
|
|
26204
|
+
message: {
|
|
26205
|
+
id: this.messageId || `msg_${Date.now()}`,
|
|
26206
|
+
type: "message",
|
|
26207
|
+
role: "assistant",
|
|
26208
|
+
model: this.currentModel,
|
|
26209
|
+
content: [],
|
|
26210
|
+
stop_reason: null,
|
|
26211
|
+
stop_sequence: null,
|
|
26212
|
+
usage: { input_tokens: 0, output_tokens: 0 }
|
|
26213
|
+
}
|
|
26214
|
+
}
|
|
26215
|
+
});
|
|
26216
|
+
}
|
|
26217
|
+
if (delta) {
|
|
26218
|
+
if (typeof delta.content === "string" && delta.content.length > 0) {
|
|
26219
|
+
const textBlockIndex = this.ensureTextBlock();
|
|
26220
|
+
if (!this.hasStartedTextBlock) {
|
|
26221
|
+
this.hasStartedTextBlock = true;
|
|
26222
|
+
events.push({
|
|
26223
|
+
event: "content_block_start",
|
|
26224
|
+
data: {
|
|
26225
|
+
type: "content_block_start",
|
|
26226
|
+
index: textBlockIndex,
|
|
26227
|
+
content_block: { type: "text" }
|
|
26228
|
+
}
|
|
26229
|
+
});
|
|
26230
|
+
}
|
|
26231
|
+
events.push({
|
|
26232
|
+
event: "content_block_delta",
|
|
26233
|
+
data: {
|
|
26234
|
+
type: "content_block_delta",
|
|
26235
|
+
index: textBlockIndex,
|
|
26236
|
+
delta: { type: "text_delta", text: delta.content }
|
|
26237
|
+
}
|
|
26238
|
+
});
|
|
26239
|
+
}
|
|
26240
|
+
if (typeof delta.reasoning_content === "string" && delta.reasoning_content.length > 0) {
|
|
26241
|
+
const thinkingBlockIndex = this.ensureThinkingBlock();
|
|
26242
|
+
if (!this.hasStartedThinkingBlock) {
|
|
26243
|
+
this.hasStartedThinkingBlock = true;
|
|
26244
|
+
events.push({
|
|
26245
|
+
event: "content_block_start",
|
|
26246
|
+
data: {
|
|
26247
|
+
type: "content_block_start",
|
|
26248
|
+
index: thinkingBlockIndex,
|
|
26249
|
+
content_block: { type: "thinking" }
|
|
26250
|
+
}
|
|
26251
|
+
});
|
|
26252
|
+
}
|
|
26253
|
+
events.push({
|
|
26254
|
+
event: "content_block_delta",
|
|
26255
|
+
data: {
|
|
26256
|
+
type: "content_block_delta",
|
|
26257
|
+
index: thinkingBlockIndex,
|
|
26258
|
+
delta: { type: "thinking_delta", thinking: delta.reasoning_content }
|
|
26259
|
+
}
|
|
26260
|
+
});
|
|
26261
|
+
}
|
|
26262
|
+
if (delta.tool_calls) {
|
|
26263
|
+
const toolCalls = delta.tool_calls;
|
|
26264
|
+
for (const tc of toolCalls) {
|
|
26265
|
+
const toolEvents = this.handleToolCallDelta(tc);
|
|
26266
|
+
events.push(...toolEvents);
|
|
26267
|
+
}
|
|
26268
|
+
}
|
|
26269
|
+
}
|
|
26270
|
+
if (finishReason && !this.hasEmittedMessageDelta) {
|
|
26271
|
+
this.hasEmittedMessageDelta = true;
|
|
26272
|
+
for (const idx of this.openToolBlockIndices) {
|
|
26273
|
+
events.push({
|
|
26274
|
+
event: "content_block_stop",
|
|
26275
|
+
data: { type: "content_block_stop", index: idx }
|
|
26276
|
+
});
|
|
26277
|
+
}
|
|
26278
|
+
this.openToolBlockIndices.clear();
|
|
26279
|
+
if (this.currentTextBlockIndex >= 0) {
|
|
26280
|
+
events.push({
|
|
26281
|
+
event: "content_block_stop",
|
|
26282
|
+
data: { type: "content_block_stop", index: this.currentTextBlockIndex }
|
|
26283
|
+
});
|
|
26284
|
+
this.currentTextBlockIndex = -1;
|
|
26285
|
+
}
|
|
26286
|
+
if (this.currentThinkingBlockIndex >= 0) {
|
|
26287
|
+
events.push({
|
|
26288
|
+
event: "content_block_stop",
|
|
26289
|
+
data: { type: "content_block_stop", index: this.currentThinkingBlockIndex }
|
|
26290
|
+
});
|
|
26291
|
+
this.currentThinkingBlockIndex = -1;
|
|
26292
|
+
}
|
|
26293
|
+
events.push({
|
|
26294
|
+
event: "message_delta",
|
|
26295
|
+
data: {
|
|
26296
|
+
type: "message_delta",
|
|
26297
|
+
delta: { stop_reason: this.mapStopReason(finishReason), stop_sequence: null },
|
|
26298
|
+
usage: { output_tokens: 0 }
|
|
26299
|
+
}
|
|
26300
|
+
});
|
|
26301
|
+
events.push({
|
|
26302
|
+
event: "message_stop",
|
|
26303
|
+
data: { type: "message_stop" }
|
|
26304
|
+
});
|
|
26305
|
+
}
|
|
26306
|
+
return events;
|
|
26307
|
+
}
|
|
26308
|
+
ensureTextBlock() {
|
|
26309
|
+
if (this.currentTextBlockIndex < 0) {
|
|
26310
|
+
this.currentTextBlockIndex = this.contentBlockIndex++;
|
|
26311
|
+
}
|
|
26312
|
+
return this.currentTextBlockIndex;
|
|
26313
|
+
}
|
|
26314
|
+
ensureThinkingBlock() {
|
|
26315
|
+
if (this.currentThinkingBlockIndex < 0) {
|
|
26316
|
+
this.currentThinkingBlockIndex = this.contentBlockIndex++;
|
|
26317
|
+
}
|
|
26318
|
+
return this.currentThinkingBlockIndex;
|
|
26319
|
+
}
|
|
26320
|
+
handleToolCallDelta(tc) {
|
|
26321
|
+
const index = tc.index;
|
|
26322
|
+
const toolIndex = this.getOrCreateToolBlockIndex(index);
|
|
26323
|
+
const events = [];
|
|
26324
|
+
let pending = this.pendingToolData.get(index);
|
|
26325
|
+
if (!pending) {
|
|
26326
|
+
pending = { id: "", name: "", args: "" };
|
|
26327
|
+
this.pendingToolData.set(index, pending);
|
|
26328
|
+
}
|
|
26329
|
+
if (tc.id)
|
|
26330
|
+
pending.id = tc.id;
|
|
26331
|
+
if (tc.function) {
|
|
26332
|
+
const func = tc.function;
|
|
26333
|
+
if (func.name)
|
|
26334
|
+
pending.name = func.name;
|
|
26335
|
+
if (func.arguments)
|
|
26336
|
+
pending.args += func.arguments;
|
|
26337
|
+
}
|
|
26338
|
+
if (pending.id && pending.name && !this.openToolBlockIndices.has(toolIndex)) {
|
|
26339
|
+
this.openToolBlockIndices.add(toolIndex);
|
|
26340
|
+
events.push({
|
|
26341
|
+
event: "content_block_start",
|
|
26342
|
+
data: {
|
|
26343
|
+
type: "content_block_start",
|
|
26344
|
+
index: toolIndex,
|
|
26345
|
+
content_block: { type: "tool_use", id: pending.id, name: pending.name, input: {} }
|
|
26346
|
+
}
|
|
26347
|
+
});
|
|
26348
|
+
}
|
|
26349
|
+
if (this.openToolBlockIndices.has(toolIndex) && pending.args.length > 0) {
|
|
26350
|
+
const lastEmitted = this.lastEmittedArgsLength.get(index) || 0;
|
|
26351
|
+
if (pending.args.length > lastEmitted) {
|
|
26352
|
+
const newArgs = pending.args.slice(lastEmitted);
|
|
26353
|
+
this.lastEmittedArgsLength.set(index, pending.args.length);
|
|
26354
|
+
events.push({
|
|
26355
|
+
event: "content_block_delta",
|
|
26356
|
+
data: {
|
|
26357
|
+
type: "content_block_delta",
|
|
26358
|
+
index: toolIndex,
|
|
26359
|
+
delta: { type: "input_json_delta", partial_json: newArgs }
|
|
26360
|
+
}
|
|
26361
|
+
});
|
|
26362
|
+
}
|
|
26363
|
+
}
|
|
26364
|
+
return events;
|
|
26365
|
+
}
|
|
26366
|
+
getOrCreateToolBlockIndex(openaiIndex) {
|
|
26367
|
+
let idx = this.toolBlockIndexMap.get(openaiIndex);
|
|
26368
|
+
if (idx === undefined) {
|
|
26369
|
+
idx = this.contentBlockIndex++;
|
|
26370
|
+
this.toolBlockIndexMap.set(openaiIndex, idx);
|
|
26371
|
+
}
|
|
26372
|
+
return idx;
|
|
26373
|
+
}
|
|
26374
|
+
mapStopReason(reason) {
|
|
26375
|
+
switch (reason) {
|
|
26376
|
+
case "stop":
|
|
26377
|
+
return "end_turn";
|
|
26378
|
+
case "length":
|
|
26379
|
+
return "max_tokens";
|
|
26380
|
+
case "tool_calls":
|
|
26381
|
+
return "tool_use";
|
|
26382
|
+
case "function_call":
|
|
26383
|
+
return "tool_use";
|
|
26384
|
+
case "content_filter":
|
|
26385
|
+
return "end_turn";
|
|
26386
|
+
default:
|
|
26387
|
+
return reason;
|
|
26388
|
+
}
|
|
26389
|
+
}
|
|
26390
|
+
};
|
|
26391
|
+
registerTransformer({
|
|
26392
|
+
clientFormat: "anthropic_messages",
|
|
26393
|
+
targetFormat: "openai_chat",
|
|
26394
|
+
requestTransform: anthropicToOpenAIChatRequest,
|
|
26395
|
+
responseTransform: openAIChatToAnthropicResponse,
|
|
26396
|
+
streamTransform: (stream, ctx) => {
|
|
26397
|
+
const transform2 = createOpenAIChatToAnthropicStreamTransform(ctx);
|
|
26398
|
+
return stream.pipeThrough(transform2);
|
|
26399
|
+
}
|
|
26400
|
+
});
|
|
26401
|
+
});
|
|
26402
|
+
|
|
25583
26403
|
// src/proxy/router.ts
|
|
25584
26404
|
class ProxyRouter {
|
|
25585
26405
|
routes = [];
|
|
@@ -25674,7 +26494,8 @@ class ProxyForwarder {
|
|
|
25674
26494
|
}));
|
|
25675
26495
|
const credential = profile.authToken || profile.apiKey || "";
|
|
25676
26496
|
if (credential) {
|
|
25677
|
-
|
|
26497
|
+
const targetFormat = inferTargetApiFormat(profile, preset || {});
|
|
26498
|
+
if (targetFormat === "anthropic_messages" || targetFormat === "anthropic_responses") {
|
|
25678
26499
|
headers["x-api-key"] = credential;
|
|
25679
26500
|
} else {
|
|
25680
26501
|
headers.authorization = `Bearer ${credential}`;
|
|
@@ -25724,6 +26545,7 @@ class ProxyForwarder {
|
|
|
25724
26545
|
var init_forwarder = __esm(() => {
|
|
25725
26546
|
init_presets();
|
|
25726
26547
|
init_logger();
|
|
26548
|
+
init_transform();
|
|
25727
26549
|
});
|
|
25728
26550
|
|
|
25729
26551
|
// src/proxy/circuit-breaker.ts
|
|
@@ -25920,14 +26742,16 @@ class ProxyHandler {
|
|
|
25920
26742
|
timeoutMs;
|
|
25921
26743
|
instanceId;
|
|
25922
26744
|
groupName;
|
|
26745
|
+
profileName;
|
|
25923
26746
|
logger;
|
|
25924
|
-
constructor(timeoutMs, instanceId, groupName) {
|
|
26747
|
+
constructor(timeoutMs, instanceId, groupName, profileName) {
|
|
25925
26748
|
this.router = new ProxyRouter;
|
|
25926
26749
|
this.forwarder = new ProxyForwarder;
|
|
25927
26750
|
this.circuitBreaker = new CircuitBreaker;
|
|
25928
26751
|
this.timeoutMs = timeoutMs;
|
|
25929
26752
|
this.instanceId = instanceId || "default";
|
|
25930
26753
|
this.groupName = groupName;
|
|
26754
|
+
this.profileName = profileName;
|
|
25931
26755
|
this.logger = createProxyLogger(this.instanceId);
|
|
25932
26756
|
this.setupRoutes();
|
|
25933
26757
|
}
|
|
@@ -26031,7 +26855,117 @@ class ProxyHandler {
|
|
|
26031
26855
|
return new Uint8Array(bodyBuffer);
|
|
26032
26856
|
}
|
|
26033
26857
|
}
|
|
26858
|
+
async forwardSingleProfile(request, profileName, _format) {
|
|
26859
|
+
const profile = await getProfile(profileName);
|
|
26860
|
+
if (!profile) {
|
|
26861
|
+
this.logger.warn("Profile not found", { profileName });
|
|
26862
|
+
return new Response(JSON.stringify({ error: `Profile not found: ${profileName}` }), {
|
|
26863
|
+
status: 503,
|
|
26864
|
+
headers: { "Content-Type": "application/json" }
|
|
26865
|
+
});
|
|
26866
|
+
}
|
|
26867
|
+
let bodyBuffer;
|
|
26868
|
+
try {
|
|
26869
|
+
bodyBuffer = await request.arrayBuffer();
|
|
26870
|
+
} catch (error46) {
|
|
26871
|
+
this.logger.error("Failed to read request body", error46);
|
|
26872
|
+
return new Response(JSON.stringify({ error: "Failed to read request body" }), {
|
|
26873
|
+
status: 400,
|
|
26874
|
+
headers: { "Content-Type": "application/json" }
|
|
26875
|
+
});
|
|
26876
|
+
}
|
|
26877
|
+
const preset = getPresetById(profile.providerId);
|
|
26878
|
+
const endpoint = new URL(request.url).pathname + new URL(request.url).search;
|
|
26879
|
+
const clientFormat = inferClientFormat(endpoint);
|
|
26880
|
+
const targetFormat = inferTargetApiFormat(profile, preset || {});
|
|
26881
|
+
let transformedBodyBuffer = bodyBuffer;
|
|
26882
|
+
let targetEndpoint = endpoint;
|
|
26883
|
+
let ctx = null;
|
|
26884
|
+
if (clientFormat !== targetFormat) {
|
|
26885
|
+
try {
|
|
26886
|
+
const bodyText = Buffer.from(bodyBuffer).toString("utf-8");
|
|
26887
|
+
const parsedBody = bodyText ? JSON.parse(bodyText) : {};
|
|
26888
|
+
ctx = {
|
|
26889
|
+
endpoint,
|
|
26890
|
+
clientFormat,
|
|
26891
|
+
targetFormat,
|
|
26892
|
+
profile,
|
|
26893
|
+
preset: preset || {},
|
|
26894
|
+
stream: parsedBody.stream === true
|
|
26895
|
+
};
|
|
26896
|
+
const transformed = transformRequest(parsedBody, ctx);
|
|
26897
|
+
transformedBodyBuffer = Buffer.from(JSON.stringify(transformed.body));
|
|
26898
|
+
targetEndpoint = transformed.targetEndpoint || endpoint;
|
|
26899
|
+
} catch (error46) {
|
|
26900
|
+
this.logger.error("Request transform failed, falling back to passthrough", error46);
|
|
26901
|
+
}
|
|
26902
|
+
}
|
|
26903
|
+
const rewrittenBody = this.rewriteRequestBodyForProfile(transformedBodyBuffer, profile);
|
|
26904
|
+
const clonedRequest = {
|
|
26905
|
+
method: request.method,
|
|
26906
|
+
path: targetEndpoint,
|
|
26907
|
+
headers: Object.fromEntries(request.headers.entries()),
|
|
26908
|
+
body: rewrittenBody
|
|
26909
|
+
};
|
|
26910
|
+
try {
|
|
26911
|
+
const forwardResponse = await this.forwarder.forward(clonedRequest, profile, this.timeoutMs);
|
|
26912
|
+
const isSuccess = forwardResponse.status >= 200 && forwardResponse.status < 300;
|
|
26913
|
+
if (!isSuccess) {
|
|
26914
|
+
this.logger.warn("Provider returned upstream status", {
|
|
26915
|
+
profileName,
|
|
26916
|
+
status: forwardResponse.status
|
|
26917
|
+
});
|
|
26918
|
+
return new Response(forwardResponse.body, {
|
|
26919
|
+
status: forwardResponse.status,
|
|
26920
|
+
headers: forwardResponse.headers
|
|
26921
|
+
});
|
|
26922
|
+
}
|
|
26923
|
+
if (ctx && clientFormat !== targetFormat) {
|
|
26924
|
+
if (forwardResponse.isStream && forwardResponse.body) {
|
|
26925
|
+
const transformedStream = transformStream(forwardResponse.body, ctx);
|
|
26926
|
+
return new Response(transformedStream, {
|
|
26927
|
+
status: forwardResponse.status,
|
|
26928
|
+
headers: forwardResponse.headers
|
|
26929
|
+
});
|
|
26930
|
+
}
|
|
26931
|
+
try {
|
|
26932
|
+
const responseText = forwardResponse.body;
|
|
26933
|
+
const responseParsed = responseText ? JSON.parse(responseText) : {};
|
|
26934
|
+
const transformedResponse = transformResponse(responseParsed, ctx);
|
|
26935
|
+
return new Response(JSON.stringify(transformedResponse), {
|
|
26936
|
+
status: forwardResponse.status,
|
|
26937
|
+
headers: forwardResponse.headers
|
|
26938
|
+
});
|
|
26939
|
+
} catch (error46) {
|
|
26940
|
+
this.logger.error("Response transform failed, returning raw response", error46);
|
|
26941
|
+
return new Response(forwardResponse.body, {
|
|
26942
|
+
status: forwardResponse.status,
|
|
26943
|
+
headers: forwardResponse.headers
|
|
26944
|
+
});
|
|
26945
|
+
}
|
|
26946
|
+
}
|
|
26947
|
+
if (forwardResponse.isStream) {
|
|
26948
|
+
return new Response(forwardResponse.body, {
|
|
26949
|
+
status: forwardResponse.status,
|
|
26950
|
+
headers: forwardResponse.headers
|
|
26951
|
+
});
|
|
26952
|
+
}
|
|
26953
|
+
return new Response(forwardResponse.body, {
|
|
26954
|
+
status: forwardResponse.status,
|
|
26955
|
+
headers: forwardResponse.headers
|
|
26956
|
+
});
|
|
26957
|
+
} catch (error46) {
|
|
26958
|
+
this.logger.error("Provider request failed", error46, { profileName });
|
|
26959
|
+
return new Response(JSON.stringify({ error: error46.message }), {
|
|
26960
|
+
status: 502,
|
|
26961
|
+
headers: { "Content-Type": "application/json" }
|
|
26962
|
+
});
|
|
26963
|
+
}
|
|
26964
|
+
}
|
|
26034
26965
|
async forwardToProvider(request, format) {
|
|
26966
|
+
if (this.profileName) {
|
|
26967
|
+
return this.forwardSingleProfile(request, this.profileName, format);
|
|
26968
|
+
}
|
|
26035
26969
|
const group = this.groupName ? await getGroup(this.groupName) : await getActiveGroup();
|
|
26036
26970
|
if (!group || group.profiles.length === 0) {
|
|
26037
26971
|
this.logger.warn("No active group or profiles");
|
|
@@ -26063,15 +26997,42 @@ class ProxyHandler {
|
|
|
26063
26997
|
continue;
|
|
26064
26998
|
}
|
|
26065
26999
|
const preset = getPresetById(profile.providerId);
|
|
26066
|
-
|
|
26067
|
-
|
|
26068
|
-
|
|
27000
|
+
const endpoint = new URL(request.url).pathname + new URL(request.url).search;
|
|
27001
|
+
const clientFormat = inferClientFormat(endpoint);
|
|
27002
|
+
const targetFormat = inferTargetApiFormat(profile, preset || {});
|
|
27003
|
+
if (clientFormat !== targetFormat) {
|
|
27004
|
+
if (!getTransformer(clientFormat, targetFormat)) {
|
|
27005
|
+
this.logger.info("Skipping provider: no transformer for format pair", { profileId, clientFormat, targetFormat });
|
|
27006
|
+
continue;
|
|
27007
|
+
}
|
|
27008
|
+
}
|
|
27009
|
+
let transformedBodyBuffer = bodyBuffer;
|
|
27010
|
+
let targetEndpoint = endpoint;
|
|
27011
|
+
let ctx = null;
|
|
27012
|
+
if (clientFormat !== targetFormat) {
|
|
27013
|
+
try {
|
|
27014
|
+
const bodyText = Buffer.from(bodyBuffer).toString("utf-8");
|
|
27015
|
+
const parsedBody = bodyText ? JSON.parse(bodyText) : {};
|
|
27016
|
+
ctx = {
|
|
27017
|
+
endpoint,
|
|
27018
|
+
clientFormat,
|
|
27019
|
+
targetFormat,
|
|
27020
|
+
profile,
|
|
27021
|
+
preset: preset || {},
|
|
27022
|
+
stream: parsedBody.stream === true
|
|
27023
|
+
};
|
|
27024
|
+
const transformed = transformRequest(parsedBody, ctx);
|
|
27025
|
+
transformedBodyBuffer = Buffer.from(JSON.stringify(transformed.body));
|
|
27026
|
+
targetEndpoint = transformed.targetEndpoint || endpoint;
|
|
27027
|
+
} catch (error46) {
|
|
27028
|
+
this.logger.error("Request transform failed, falling back to passthrough", error46);
|
|
27029
|
+
}
|
|
26069
27030
|
}
|
|
26070
27031
|
try {
|
|
26071
|
-
const rewrittenBody = this.rewriteRequestBodyForProfile(
|
|
27032
|
+
const rewrittenBody = this.rewriteRequestBodyForProfile(transformedBodyBuffer, profile);
|
|
26072
27033
|
const clonedRequest = {
|
|
26073
27034
|
method: request.method,
|
|
26074
|
-
path:
|
|
27035
|
+
path: targetEndpoint,
|
|
26075
27036
|
headers: Object.fromEntries(request.headers.entries()),
|
|
26076
27037
|
body: rewrittenBody
|
|
26077
27038
|
};
|
|
@@ -26095,6 +27056,30 @@ class ProxyHandler {
|
|
|
26095
27056
|
continue;
|
|
26096
27057
|
}
|
|
26097
27058
|
this.circuitBreaker.recordSuccess(profileId);
|
|
27059
|
+
if (ctx && clientFormat !== targetFormat) {
|
|
27060
|
+
if (forwardResponse.isStream && forwardResponse.body) {
|
|
27061
|
+
const transformedStream = transformStream(forwardResponse.body, ctx);
|
|
27062
|
+
return new Response(transformedStream, {
|
|
27063
|
+
status: forwardResponse.status,
|
|
27064
|
+
headers: forwardResponse.headers
|
|
27065
|
+
});
|
|
27066
|
+
}
|
|
27067
|
+
try {
|
|
27068
|
+
const responseText = forwardResponse.body;
|
|
27069
|
+
const responseParsed = responseText ? JSON.parse(responseText) : {};
|
|
27070
|
+
const transformedResponse = transformResponse(responseParsed, ctx);
|
|
27071
|
+
return new Response(JSON.stringify(transformedResponse), {
|
|
27072
|
+
status: forwardResponse.status,
|
|
27073
|
+
headers: forwardResponse.headers
|
|
27074
|
+
});
|
|
27075
|
+
} catch (error46) {
|
|
27076
|
+
this.logger.error("Response transform failed, returning raw response", error46);
|
|
27077
|
+
return new Response(forwardResponse.body, {
|
|
27078
|
+
status: forwardResponse.status,
|
|
27079
|
+
headers: forwardResponse.headers
|
|
27080
|
+
});
|
|
27081
|
+
}
|
|
27082
|
+
}
|
|
26098
27083
|
if (forwardResponse.isStream) {
|
|
26099
27084
|
return new Response(forwardResponse.body, {
|
|
26100
27085
|
status: forwardResponse.status,
|
|
@@ -26126,17 +27111,19 @@ class ProxyHandler {
|
|
|
26126
27111
|
}
|
|
26127
27112
|
}
|
|
26128
27113
|
var init_handler = __esm(() => {
|
|
27114
|
+
init_openai_chat_to_anthropic2();
|
|
26129
27115
|
init_model_helper();
|
|
26130
27116
|
init_forwarder();
|
|
26131
27117
|
init_manager2();
|
|
26132
27118
|
init_manager();
|
|
26133
27119
|
init_logger();
|
|
26134
27120
|
init_presets();
|
|
27121
|
+
init_transform();
|
|
26135
27122
|
});
|
|
26136
27123
|
|
|
26137
27124
|
// src/proxy/server.ts
|
|
26138
27125
|
import http from "node:http";
|
|
26139
|
-
import { existsSync as existsSync7, readFileSync, writeFileSync } from "node:fs";
|
|
27126
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync, writeFileSync } from "node:fs";
|
|
26140
27127
|
import { dirname as dirname7, join as join7 } from "node:path";
|
|
26141
27128
|
function getRegistryPath() {
|
|
26142
27129
|
return join7(dirname7(getConfigPath2()), "proxy-instances.json");
|
|
@@ -26153,7 +27140,9 @@ function loadRegistry() {
|
|
|
26153
27140
|
}
|
|
26154
27141
|
}
|
|
26155
27142
|
function saveRegistry(registry2) {
|
|
26156
|
-
|
|
27143
|
+
const path = getRegistryPath();
|
|
27144
|
+
mkdirSync2(dirname7(path), { recursive: true });
|
|
27145
|
+
writeFileSync(path, JSON.stringify(registry2, null, 2), "utf-8");
|
|
26157
27146
|
}
|
|
26158
27147
|
function updateInstanceInRegistry(status) {
|
|
26159
27148
|
const registry2 = loadRegistry();
|
|
@@ -26298,7 +27287,7 @@ async function startProxyServer(config2) {
|
|
|
26298
27287
|
if (existing) {
|
|
26299
27288
|
throw new Error(`Port ${config2.port} already in use by instance "${existing.instanceId}"`);
|
|
26300
27289
|
}
|
|
26301
|
-
const handler = new ProxyHandler(config2.timeout, config2.instanceId, config2.groupName);
|
|
27290
|
+
const handler = new ProxyHandler(config2.timeout, config2.instanceId, config2.groupName, config2.profileName);
|
|
26302
27291
|
const server = http.createServer(async (req, res) => {
|
|
26303
27292
|
const status2 = statuses.get(instanceId);
|
|
26304
27293
|
if (status2) {
|
|
@@ -26339,6 +27328,7 @@ async function startProxyServer(config2) {
|
|
|
26339
27328
|
port: config2.port,
|
|
26340
27329
|
groupName: config2.groupName,
|
|
26341
27330
|
activeGroup: config2.groupName,
|
|
27331
|
+
profileName: config2.profileName,
|
|
26342
27332
|
pid: process.pid,
|
|
26343
27333
|
startTime: new Date().toISOString(),
|
|
26344
27334
|
requestCount: 0,
|
|
@@ -26584,8 +27574,8 @@ var init_client = __esm(() => {
|
|
|
26584
27574
|
|
|
26585
27575
|
// src/auth/token.ts
|
|
26586
27576
|
import { existsSync as existsSync13 } from "node:fs";
|
|
26587
|
-
import { readFile as readFile10, writeFile as writeFile9, unlink as unlink4 } from "node:fs/promises";
|
|
26588
|
-
import { join as join11 } from "node:path";
|
|
27577
|
+
import { mkdir as mkdir7, readFile as readFile10, writeFile as writeFile9, unlink as unlink4 } from "node:fs/promises";
|
|
27578
|
+
import { dirname as dirname11, join as join11 } from "node:path";
|
|
26589
27579
|
function getAuthFilePath() {
|
|
26590
27580
|
return join11(getConfigDir("swixter"), AUTH_FILE);
|
|
26591
27581
|
}
|
|
@@ -26602,6 +27592,7 @@ async function loadAuthState() {
|
|
|
26602
27592
|
}
|
|
26603
27593
|
async function saveAuthState(state) {
|
|
26604
27594
|
const authPath = getAuthFilePath();
|
|
27595
|
+
await mkdir7(dirname11(authPath), { recursive: true });
|
|
26605
27596
|
await writeFile9(authPath, JSON.stringify(state, null, 2), { mode: 384, encoding: "utf-8" });
|
|
26606
27597
|
}
|
|
26607
27598
|
async function clearAuthState() {
|
|
@@ -27430,7 +28421,7 @@ function resolveProxyRuntimeBinding(input) {
|
|
|
27430
28421
|
reuseExisting: false
|
|
27431
28422
|
};
|
|
27432
28423
|
}
|
|
27433
|
-
const existing = input.allInstances.find((s) => s.running && s.groupName === input.groupName);
|
|
28424
|
+
const existing = input.allInstances.find((s) => s.running && (input.groupName && s.groupName === input.groupName || input.profileName && s.profileName === input.profileName));
|
|
27434
28425
|
if (existing) {
|
|
27435
28426
|
return {
|
|
27436
28427
|
host: existing.host,
|
|
@@ -27521,6 +28512,7 @@ async function handleProxyCommand(args) {
|
|
|
27521
28512
|
}
|
|
27522
28513
|
async function cmdStart(args) {
|
|
27523
28514
|
let groupName;
|
|
28515
|
+
let profileName;
|
|
27524
28516
|
let port;
|
|
27525
28517
|
let host = "127.0.0.1";
|
|
27526
28518
|
let timeout = 3000000;
|
|
@@ -27529,6 +28521,9 @@ async function cmdStart(args) {
|
|
|
27529
28521
|
if (args[i2] === "--group" && args[i2 + 1]) {
|
|
27530
28522
|
groupName = args[i2 + 1];
|
|
27531
28523
|
i2++;
|
|
28524
|
+
} else if (args[i2] === "--profile" && args[i2 + 1]) {
|
|
28525
|
+
profileName = args[i2 + 1];
|
|
28526
|
+
i2++;
|
|
27532
28527
|
} else if (args[i2] === "--port" && args[i2 + 1]) {
|
|
27533
28528
|
port = parseInt(args[i2 + 1], 10);
|
|
27534
28529
|
i2++;
|
|
@@ -27542,6 +28537,11 @@ async function cmdStart(args) {
|
|
|
27542
28537
|
daemon = true;
|
|
27543
28538
|
}
|
|
27544
28539
|
}
|
|
28540
|
+
if (groupName && profileName) {
|
|
28541
|
+
console.log(import_picocolors18.default.red("Cannot specify both --group and --profile"));
|
|
28542
|
+
process.exit(EXIT_CODES.invalidArguments);
|
|
28543
|
+
return;
|
|
28544
|
+
}
|
|
27545
28545
|
if (groupName) {
|
|
27546
28546
|
const group = await getGroup(groupName);
|
|
27547
28547
|
if (!group) {
|
|
@@ -27550,12 +28550,20 @@ async function cmdStart(args) {
|
|
|
27550
28550
|
return;
|
|
27551
28551
|
}
|
|
27552
28552
|
}
|
|
28553
|
+
if (profileName) {
|
|
28554
|
+
const profile = await getProfile(profileName);
|
|
28555
|
+
if (!profile) {
|
|
28556
|
+
console.log(import_picocolors18.default.red(`Profile "${profileName}" not found`));
|
|
28557
|
+
process.exit(EXIT_CODES.notFound);
|
|
28558
|
+
return;
|
|
28559
|
+
}
|
|
28560
|
+
}
|
|
27553
28561
|
const defaultStatus = getProxyStatus("default");
|
|
27554
28562
|
if (defaultStatus.running) {
|
|
27555
28563
|
console.log(import_picocolors18.default.yellow(`Default proxy already running on ${defaultStatus.host}:${defaultStatus.port}`));
|
|
27556
28564
|
return;
|
|
27557
28565
|
}
|
|
27558
|
-
if (!groupName) {
|
|
28566
|
+
if (!groupName && !profileName) {
|
|
27559
28567
|
const activeGroup = await getActiveGroup();
|
|
27560
28568
|
if (activeGroup) {
|
|
27561
28569
|
groupName = activeGroup.name;
|
|
@@ -27564,9 +28572,9 @@ async function cmdStart(args) {
|
|
|
27564
28572
|
}
|
|
27565
28573
|
const resolvedPort = port || DEFAULT_PROXY_PORT;
|
|
27566
28574
|
if (daemon) {
|
|
27567
|
-
await cmdStartDaemon({ host, port: resolvedPort, timeout, groupName });
|
|
28575
|
+
await cmdStartDaemon({ host, port: resolvedPort, timeout, groupName, profileName });
|
|
27568
28576
|
} else {
|
|
27569
|
-
await cmdStartBlocking({ host, port: resolvedPort, timeout, groupName });
|
|
28577
|
+
await cmdStartBlocking({ host, port: resolvedPort, timeout, groupName, profileName });
|
|
27570
28578
|
}
|
|
27571
28579
|
}
|
|
27572
28580
|
async function cmdStartBlocking(config2) {
|
|
@@ -27577,7 +28585,8 @@ async function cmdStartBlocking(config2) {
|
|
|
27577
28585
|
host: config2.host,
|
|
27578
28586
|
port: config2.port,
|
|
27579
28587
|
timeout: config2.timeout,
|
|
27580
|
-
groupName: config2.groupName
|
|
28588
|
+
groupName: config2.groupName,
|
|
28589
|
+
profileName: config2.profileName
|
|
27581
28590
|
});
|
|
27582
28591
|
console.log();
|
|
27583
28592
|
console.log(import_picocolors18.default.green("✓ Proxy server started"));
|
|
@@ -27585,6 +28594,7 @@ async function cmdStartBlocking(config2) {
|
|
|
27585
28594
|
console.log(` Address: ${config2.host}:${config2.port}`);
|
|
27586
28595
|
console.log(` Timeout: ${config2.timeout}ms`);
|
|
27587
28596
|
console.log(import_picocolors18.default.dim(` Group: ${config2.groupName || "none"}`));
|
|
28597
|
+
console.log(import_picocolors18.default.dim(` Profile: ${config2.profileName || "none"}`));
|
|
27588
28598
|
console.log(import_picocolors18.default.dim(` Endpoints:`));
|
|
27589
28599
|
console.log(import_picocolors18.default.dim(` - /v1/chat/completions (OpenAI)`));
|
|
27590
28600
|
console.log(import_picocolors18.default.dim(` - /v1/messages (Anthropic)`));
|
|
@@ -27614,6 +28624,9 @@ async function cmdStartDaemon(config2) {
|
|
|
27614
28624
|
if (config2.groupName) {
|
|
27615
28625
|
args.push("--group", config2.groupName);
|
|
27616
28626
|
}
|
|
28627
|
+
if (config2.profileName) {
|
|
28628
|
+
args.push("--profile", config2.profileName);
|
|
28629
|
+
}
|
|
27617
28630
|
const child = spawn4(process.execPath, [process.argv[1], ...args], {
|
|
27618
28631
|
detached: true,
|
|
27619
28632
|
stdio: "ignore"
|
|
@@ -27644,44 +28657,64 @@ async function cmdStop(args) {
|
|
|
27644
28657
|
}
|
|
27645
28658
|
async function cmdRun4(args) {
|
|
27646
28659
|
const doubleDash = args.indexOf("--");
|
|
27647
|
-
let
|
|
28660
|
+
let proxyArgs = [];
|
|
27648
28661
|
let coderArgs = [];
|
|
27649
28662
|
if (doubleDash >= 0) {
|
|
27650
|
-
|
|
28663
|
+
proxyArgs = args.slice(0, doubleDash);
|
|
27651
28664
|
coderArgs = args.slice(doubleDash + 1);
|
|
27652
28665
|
} else {
|
|
27653
|
-
|
|
28666
|
+
proxyArgs = args;
|
|
27654
28667
|
}
|
|
27655
28668
|
let groupName;
|
|
28669
|
+
let profileName;
|
|
27656
28670
|
let requestedPort;
|
|
27657
|
-
for (let i2 = 0;i2 <
|
|
27658
|
-
if (
|
|
27659
|
-
groupName =
|
|
28671
|
+
for (let i2 = 0;i2 < proxyArgs.length; i2++) {
|
|
28672
|
+
if (proxyArgs[i2] === "--group" && proxyArgs[i2 + 1]) {
|
|
28673
|
+
groupName = proxyArgs[i2 + 1];
|
|
28674
|
+
i2++;
|
|
28675
|
+
} else if (proxyArgs[i2] === "--profile" && proxyArgs[i2 + 1]) {
|
|
28676
|
+
profileName = proxyArgs[i2 + 1];
|
|
27660
28677
|
i2++;
|
|
27661
|
-
} else if (
|
|
27662
|
-
requestedPort = parseInt(
|
|
28678
|
+
} else if (proxyArgs[i2] === "--port" && proxyArgs[i2 + 1]) {
|
|
28679
|
+
requestedPort = parseInt(proxyArgs[i2 + 1], 10);
|
|
27663
28680
|
i2++;
|
|
27664
28681
|
}
|
|
27665
28682
|
}
|
|
27666
|
-
if (
|
|
28683
|
+
if (groupName && profileName) {
|
|
28684
|
+
console.log(import_picocolors18.default.red("Cannot specify both --group and --profile"));
|
|
28685
|
+
process.exit(EXIT_CODES.invalidArguments);
|
|
28686
|
+
return;
|
|
28687
|
+
}
|
|
28688
|
+
if (groupName) {
|
|
28689
|
+
const group = await getGroup(groupName);
|
|
28690
|
+
if (!group) {
|
|
28691
|
+
console.log(import_picocolors18.default.red(`Group "${groupName}" not found`));
|
|
28692
|
+
process.exit(EXIT_CODES.notFound);
|
|
28693
|
+
return;
|
|
28694
|
+
}
|
|
28695
|
+
}
|
|
28696
|
+
if (profileName) {
|
|
28697
|
+
const profile = await getProfile(profileName);
|
|
28698
|
+
if (!profile) {
|
|
28699
|
+
console.log(import_picocolors18.default.red(`Profile "${profileName}" not found`));
|
|
28700
|
+
process.exit(EXIT_CODES.notFound);
|
|
28701
|
+
return;
|
|
28702
|
+
}
|
|
28703
|
+
}
|
|
28704
|
+
if (!groupName && !profileName) {
|
|
27667
28705
|
const activeGroup = await getActiveGroup();
|
|
27668
28706
|
groupName = activeGroup?.name;
|
|
27669
28707
|
}
|
|
27670
|
-
if (!groupName) {
|
|
27671
|
-
console.log(import_picocolors18.default.red("No group specified and no default group set"));
|
|
27672
|
-
console.log(import_picocolors18.default.dim("Use --group or create a default group first"));
|
|
27673
|
-
return;
|
|
27674
|
-
}
|
|
27675
|
-
const group = await getGroup(groupName);
|
|
27676
|
-
if (!group) {
|
|
27677
|
-
console.log(import_picocolors18.default.red(`Group "${groupName}" not found`));
|
|
27678
|
-
process.exit(EXIT_CODES.notFound);
|
|
28708
|
+
if (!groupName && !profileName) {
|
|
28709
|
+
console.log(import_picocolors18.default.red("No group or profile specified, and no default group set"));
|
|
28710
|
+
console.log(import_picocolors18.default.dim("Use --group, --profile, or create a default group first"));
|
|
27679
28711
|
return;
|
|
27680
28712
|
}
|
|
27681
28713
|
console.log(import_picocolors18.default.cyan("Starting proxy server..."));
|
|
27682
28714
|
const allInstances = listProxyInstances();
|
|
27683
28715
|
const runtimeBinding = resolveProxyRuntimeBinding({
|
|
27684
28716
|
groupName,
|
|
28717
|
+
profileName,
|
|
27685
28718
|
requestedPort,
|
|
27686
28719
|
allInstances
|
|
27687
28720
|
});
|
|
@@ -27692,7 +28725,8 @@ async function cmdRun4(args) {
|
|
|
27692
28725
|
type: "run",
|
|
27693
28726
|
host: runtimeBinding.host,
|
|
27694
28727
|
port: runtimeBinding.port,
|
|
27695
|
-
groupName
|
|
28728
|
+
groupName,
|
|
28729
|
+
profileName
|
|
27696
28730
|
});
|
|
27697
28731
|
}
|
|
27698
28732
|
const coder = coderArgs[0];
|
|
@@ -27706,15 +28740,21 @@ async function cmdRun4(args) {
|
|
|
27706
28740
|
console.log(import_picocolors18.default.green(`✓ Running: ${coder} ${coderArgs.slice(1).join(" ")}`));
|
|
27707
28741
|
console.log(import_picocolors18.default.dim(` Instance: ${instanceId} (run)`));
|
|
27708
28742
|
console.log(import_picocolors18.default.dim(` Proxy: ${runtimeBinding.host}:${runtimeBinding.port}`));
|
|
28743
|
+
if (groupName) {
|
|
28744
|
+
console.log(import_picocolors18.default.dim(` Group: ${groupName}`));
|
|
28745
|
+
}
|
|
28746
|
+
if (profileName) {
|
|
28747
|
+
console.log(import_picocolors18.default.dim(` Profile: ${profileName}`));
|
|
28748
|
+
}
|
|
27709
28749
|
if (coder === "claude") {
|
|
27710
|
-
const
|
|
28750
|
+
const targetProfile = profileName ? await getProfile(profileName) : groupName ? (await getGroup(groupName))?.profiles[0] ? await getProfile((await getGroup(groupName)).profiles[0]) : null : null;
|
|
27711
28751
|
const proxyProfile = {
|
|
27712
|
-
name: `proxy-${groupName}`,
|
|
28752
|
+
name: profileName ? `proxy-${profileName}` : `proxy-${groupName}`,
|
|
27713
28753
|
providerId: "anthropic",
|
|
27714
28754
|
apiKey: "",
|
|
27715
28755
|
authToken: SWIXTER_PROXY_AUTH_TOKEN,
|
|
27716
28756
|
baseURL: `http://${runtimeBinding.host}:${runtimeBinding.port}`,
|
|
27717
|
-
models:
|
|
28757
|
+
models: targetProfile ? buildClaudeProxyMarkerModels(targetProfile) : undefined,
|
|
27718
28758
|
createdAt: new Date().toISOString(),
|
|
27719
28759
|
updatedAt: new Date().toISOString()
|
|
27720
28760
|
};
|
|
@@ -27757,6 +28797,7 @@ async function cmdStatus3() {
|
|
|
27757
28797
|
console.log(` ${import_picocolors18.default.green("●")} ${import_picocolors18.default.bold(status.instanceId)} (${typeLabel})`);
|
|
27758
28798
|
console.log(` Address: ${status.host}:${status.port}`);
|
|
27759
28799
|
console.log(` Group: ${status.groupName || "none"}`);
|
|
28800
|
+
console.log(` Profile: ${status.profileName || "none"}`);
|
|
27760
28801
|
console.log(` Requests: ${status.requestCount} | Errors: ${status.errorCount}`);
|
|
27761
28802
|
if (status.startTime) {
|
|
27762
28803
|
console.log(` Started: ${status.startTime}`);
|
|
@@ -27779,6 +28820,7 @@ ${import_picocolors18.default.bold("Commands:")}
|
|
|
27779
28820
|
|
|
27780
28821
|
${import_picocolors18.default.bold("Options:")}
|
|
27781
28822
|
${import_picocolors18.default.dim("--group <name>")} Use specified group
|
|
28823
|
+
${import_picocolors18.default.dim("--profile <name>")} Use specified profile (single-profile gateway mode)
|
|
27782
28824
|
${import_picocolors18.default.dim("--port <port>")} Proxy port (default: 15721)
|
|
27783
28825
|
${import_picocolors18.default.dim("--host <host>")} Proxy host (default: 127.0.0.1)
|
|
27784
28826
|
${import_picocolors18.default.dim("--timeout <ms>")} Request timeout in ms (default: 3000000)
|
|
@@ -27788,7 +28830,9 @@ ${import_picocolors18.default.bold("Examples:")}
|
|
|
27788
28830
|
${import_picocolors18.default.green("swixter proxy start")}
|
|
27789
28831
|
${import_picocolors18.default.green("swixter proxy start --daemon")}
|
|
27790
28832
|
${import_picocolors18.default.green("swixter proxy start --group my-group")}
|
|
28833
|
+
${import_picocolors18.default.green("swixter proxy start --profile my-profile")}
|
|
27791
28834
|
${import_picocolors18.default.green("swixter proxy run --group my-group -- claude")}
|
|
28835
|
+
${import_picocolors18.default.green("swixter proxy run --profile my-profile -- claude")}
|
|
27792
28836
|
${import_picocolors18.default.green("swixter proxy stop")}
|
|
27793
28837
|
${import_picocolors18.default.green("swixter proxy stop run-15722")}
|
|
27794
28838
|
${import_picocolors18.default.dim(" # Stop a specific run instance")}
|
|
@@ -28578,6 +29622,7 @@ init_dist2();
|
|
|
28578
29622
|
init_manager();
|
|
28579
29623
|
init_presets();
|
|
28580
29624
|
init_adapters();
|
|
29625
|
+
init_types2();
|
|
28581
29626
|
init_constants();
|
|
28582
29627
|
init_ui();
|
|
28583
29628
|
init_validation();
|
|
@@ -28667,7 +29712,7 @@ ${import_picocolors10.default.bold("Create profile (interactive):")}
|
|
|
28667
29712
|
${import_picocolors10.default.green(`swixter ${CODER_NAME3} create`)}
|
|
28668
29713
|
|
|
28669
29714
|
${import_picocolors10.default.bold("Create profile (non-interactive):")}
|
|
28670
|
-
${import_picocolors10.default.green(`swixter ${CODER_NAME3} create --quiet --name <name> --provider <id> --api-key <key> [--base-url <url>] [--model <model>] [--env-key <var>] [--apply]`)}
|
|
29715
|
+
${import_picocolors10.default.green(`swixter ${CODER_NAME3} create --quiet --name <name> --provider <id> --api-key <key> [--base-url <url>] [--model <model>] [--env-key <var>] [--api-format <format>] [--apply]`)}
|
|
28671
29716
|
|
|
28672
29717
|
${import_picocolors10.default.bold("Examples:")}
|
|
28673
29718
|
${import_picocolors10.default.dim("# Interactive profile creation")}
|
|
@@ -28761,6 +29806,23 @@ async function cmdCreateInteractive3() {
|
|
|
28761
29806
|
xe(ERRORS.cancelled);
|
|
28762
29807
|
process.exit(EXIT_CODES.cancelled);
|
|
28763
29808
|
}
|
|
29809
|
+
let apiFormat = null;
|
|
29810
|
+
if (providerId === "custom") {
|
|
29811
|
+
apiFormat = await ve({
|
|
29812
|
+
message: "Select the API format for this provider",
|
|
29813
|
+
options: [
|
|
29814
|
+
{ value: "openai_chat", label: "OpenAI Chat", hint: "OpenAI-compatible /v1/chat/completions" },
|
|
29815
|
+
{ value: "anthropic_messages", label: "Anthropic Messages", hint: "Anthropic /v1/messages" },
|
|
29816
|
+
{ value: "openai_responses", label: "OpenAI Responses", hint: "OpenAI Responses API" },
|
|
29817
|
+
{ value: "anthropic_responses", label: "Anthropic Responses", hint: "Anthropic Responses API" },
|
|
29818
|
+
{ value: "gemini_native", label: "Gemini Native", hint: "Google Gemini API" }
|
|
29819
|
+
]
|
|
29820
|
+
});
|
|
29821
|
+
if (pD(apiFormat)) {
|
|
29822
|
+
xe(ERRORS.cancelled);
|
|
29823
|
+
process.exit(EXIT_CODES.cancelled);
|
|
29824
|
+
}
|
|
29825
|
+
}
|
|
28764
29826
|
let modelName = "";
|
|
28765
29827
|
if (preset && preset.defaultModels && preset.defaultModels.length > 0) {
|
|
28766
29828
|
modelName = await ve({
|
|
@@ -28848,6 +29910,9 @@ async function cmdCreateInteractive3() {
|
|
|
28848
29910
|
if (customEnvKey && customEnvKey.trim() !== "") {
|
|
28849
29911
|
profile.envKey = customEnvKey.trim();
|
|
28850
29912
|
}
|
|
29913
|
+
if (apiFormat) {
|
|
29914
|
+
profile.apiFormat = apiFormat;
|
|
29915
|
+
}
|
|
28851
29916
|
await upsertProfile(profile, CODER_NAME3);
|
|
28852
29917
|
spinner.stop("Profile created successfully!");
|
|
28853
29918
|
console.log();
|
|
@@ -28870,7 +29935,7 @@ async function cmdCreateInteractive3() {
|
|
|
28870
29935
|
async function cmdCreateQuiet3(params) {
|
|
28871
29936
|
if (!params.name || !params.provider) {
|
|
28872
29937
|
console.log(import_picocolors10.default.red("Error: Missing required parameters"));
|
|
28873
|
-
console.log(import_picocolors10.default.dim(`Usage: swixter ${CODER_NAME3} create --quiet --name <name> --provider <id> [--api-key <key>] [--base-url <url>] [--model <model>] [--env-key <var>] [--apply]`));
|
|
29938
|
+
console.log(import_picocolors10.default.dim(`Usage: swixter ${CODER_NAME3} create --quiet --name <name> --provider <id> [--api-key <key>] [--base-url <url>] [--model <model>] [--env-key <var>] [--api-format <format>] [--apply]`));
|
|
28874
29939
|
process.exit(1);
|
|
28875
29940
|
}
|
|
28876
29941
|
const preset = await getPresetByIdAsync(params.provider);
|
|
@@ -28883,6 +29948,12 @@ async function cmdCreateQuiet3(params) {
|
|
|
28883
29948
|
console.log(import_picocolors10.default.red("Error: This provider requires --api-key parameter"));
|
|
28884
29949
|
process.exit(1);
|
|
28885
29950
|
}
|
|
29951
|
+
const apiFormat = params["api-format"];
|
|
29952
|
+
if (apiFormat && !API_FORMATS.includes(apiFormat)) {
|
|
29953
|
+
console.log(import_picocolors10.default.red(`Invalid apiFormat: ${apiFormat}`));
|
|
29954
|
+
console.log(import_picocolors10.default.dim(`Valid values: ${API_FORMATS.join(", ")}`));
|
|
29955
|
+
process.exit(EXIT_CODES.invalidArguments);
|
|
29956
|
+
}
|
|
28886
29957
|
try {
|
|
28887
29958
|
const finalBaseURL = params["base-url"] || preset.baseURLChat || preset.baseURL;
|
|
28888
29959
|
const finalModel = params.model;
|
|
@@ -28902,6 +29973,9 @@ async function cmdCreateQuiet3(params) {
|
|
|
28902
29973
|
if (params["env-key"]) {
|
|
28903
29974
|
profile.envKey = params["env-key"];
|
|
28904
29975
|
}
|
|
29976
|
+
if (apiFormat) {
|
|
29977
|
+
profile.apiFormat = apiFormat;
|
|
29978
|
+
}
|
|
28905
29979
|
await upsertProfile(profile, CODER_NAME3);
|
|
28906
29980
|
console.log();
|
|
28907
29981
|
console.log(import_picocolors10.default.green("✓") + " Profile created successfully!");
|
|
@@ -29153,6 +30227,21 @@ async function cmdEdit3(profileName) {
|
|
|
29153
30227
|
xe(ERRORS.cancelled);
|
|
29154
30228
|
return;
|
|
29155
30229
|
}
|
|
30230
|
+
const currentApiFormat = profile.apiFormat || "auto-detect";
|
|
30231
|
+
const apiFormatOptions = [
|
|
30232
|
+
{ value: "", label: "Keep current" },
|
|
30233
|
+
{ value: "clear", label: "Auto-detect (clear explicit format)" },
|
|
30234
|
+
...API_FORMATS.map((f) => ({ value: f, label: f }))
|
|
30235
|
+
];
|
|
30236
|
+
const newApiFormat = await ve({
|
|
30237
|
+
message: `Select target API format (current: ${currentApiFormat})`,
|
|
30238
|
+
options: apiFormatOptions,
|
|
30239
|
+
initialValue: profile.apiFormat || ""
|
|
30240
|
+
});
|
|
30241
|
+
if (pD(newApiFormat)) {
|
|
30242
|
+
xe(ERRORS.cancelled);
|
|
30243
|
+
return;
|
|
30244
|
+
}
|
|
29156
30245
|
const shouldApply = await ye({
|
|
29157
30246
|
message: `Apply this profile to ${CODER_CONFIG3.displayName} now?`,
|
|
29158
30247
|
initialValue: false
|
|
@@ -29192,6 +30281,13 @@ async function cmdEdit3(profileName) {
|
|
|
29192
30281
|
updatedProfile.envKey = profile.envKey;
|
|
29193
30282
|
}
|
|
29194
30283
|
}
|
|
30284
|
+
if (newApiFormat === "clear") {} else if (newApiFormat) {
|
|
30285
|
+
updatedProfile.apiFormat = newApiFormat;
|
|
30286
|
+
} else {
|
|
30287
|
+
if (profile.apiFormat) {
|
|
30288
|
+
updatedProfile.apiFormat = profile.apiFormat;
|
|
30289
|
+
}
|
|
30290
|
+
}
|
|
29195
30291
|
const finalBaseURL = updatedProfile.baseURL || newPreset?.baseURL || "";
|
|
29196
30292
|
await upsertProfile(updatedProfile, CODER_NAME3);
|
|
29197
30293
|
spinner.stop("Profile updated successfully!");
|
|
@@ -29476,7 +30572,7 @@ import { existsSync as existsSync11 } from "node:fs";
|
|
|
29476
30572
|
import { dirname as dirname9, join as join9 } from "node:path";
|
|
29477
30573
|
import { fileURLToPath } from "node:url";
|
|
29478
30574
|
|
|
29479
|
-
// node_modules/ws/wrapper.mjs
|
|
30575
|
+
// ../../node_modules/ws/wrapper.mjs
|
|
29480
30576
|
var import_stream = __toESM(require_stream(), 1);
|
|
29481
30577
|
var import_extension = __toESM(require_extension(), 1);
|
|
29482
30578
|
var import_permessage_deflate = __toESM(require_permessage_deflate(), 1);
|
|
@@ -30586,8 +31682,8 @@ async function startServer(portArg, options) {
|
|
|
30586
31682
|
// src/utils/daemon.ts
|
|
30587
31683
|
init_paths();
|
|
30588
31684
|
import { existsSync as existsSync12 } from "node:fs";
|
|
30589
|
-
import { readFile as readFile9, writeFile as writeFile8, unlink as unlink3 } from "node:fs/promises";
|
|
30590
|
-
import { join as join10 } from "node:path";
|
|
31685
|
+
import { mkdir as mkdir6, readFile as readFile9, writeFile as writeFile8, unlink as unlink3 } from "node:fs/promises";
|
|
31686
|
+
import { dirname as dirname10, join as join10 } from "node:path";
|
|
30591
31687
|
function getPidFilePath() {
|
|
30592
31688
|
return join10(getConfigDir("swixter"), "ui.pid");
|
|
30593
31689
|
}
|
|
@@ -30608,6 +31704,7 @@ async function readPidFile() {
|
|
|
30608
31704
|
async function writePidFile(pid, port) {
|
|
30609
31705
|
const path = getPidFilePath();
|
|
30610
31706
|
const data = { pid, port, startTime: new Date().toISOString() };
|
|
31707
|
+
await mkdir6(dirname10(path), { recursive: true });
|
|
30611
31708
|
await writeFile8(path, JSON.stringify(data, null, 2), "utf-8");
|
|
30612
31709
|
}
|
|
30613
31710
|
async function removePidFile() {
|
|
@@ -30653,12 +31750,22 @@ async function stopDaemon() {
|
|
|
30653
31750
|
}
|
|
30654
31751
|
try {
|
|
30655
31752
|
process.kill(data.pid, "SIGTERM");
|
|
30656
|
-
await removePidFile();
|
|
30657
|
-
return { success: true, message: `Daemon process ${data.pid} stopped.` };
|
|
30658
31753
|
} catch {
|
|
30659
31754
|
await removePidFile();
|
|
30660
31755
|
return { success: false, message: "Failed to stop daemon process (PID file removed)." };
|
|
30661
31756
|
}
|
|
31757
|
+
for (let i2 = 0;i2 < 50; i2++) {
|
|
31758
|
+
if (!isProcessAlive2(data.pid))
|
|
31759
|
+
break;
|
|
31760
|
+
await new Promise((r2) => setTimeout(r2, 100));
|
|
31761
|
+
}
|
|
31762
|
+
if (isProcessAlive2(data.pid)) {
|
|
31763
|
+
try {
|
|
31764
|
+
process.kill(data.pid, "SIGKILL");
|
|
31765
|
+
} catch {}
|
|
31766
|
+
}
|
|
31767
|
+
await removePidFile();
|
|
31768
|
+
return { success: true, message: `Daemon process ${data.pid} stopped.` };
|
|
30662
31769
|
}
|
|
30663
31770
|
|
|
30664
31771
|
// src/cli/ui.ts
|
|
@@ -30698,6 +31805,7 @@ async function showStatus() {
|
|
|
30698
31805
|
console.log(` URL: ${import_picocolors12.default.cyan(`http://127.0.0.1:${data.port}`)}`);
|
|
30699
31806
|
console.log(` Started: ${import_picocolors12.default.dim(data.startTime)}`);
|
|
30700
31807
|
} else {
|
|
31808
|
+
await removePidFile();
|
|
30701
31809
|
console.log(import_picocolors12.default.yellow("⚠ Swixter UI is not running (stale PID file removed)."));
|
|
30702
31810
|
}
|
|
30703
31811
|
console.log();
|
|
@@ -30724,18 +31832,19 @@ async function startDaemon(portArg) {
|
|
|
30724
31832
|
env: { ...process.env, SWIXTER_UI_DAEMON: "1" }
|
|
30725
31833
|
});
|
|
30726
31834
|
child.unref();
|
|
31835
|
+
await writePidFile(child.pid, port);
|
|
30727
31836
|
const url2 = `http://127.0.0.1:${port}`;
|
|
30728
31837
|
const started = await waitForServer(url2, 1e4);
|
|
30729
31838
|
if (!started) {
|
|
30730
31839
|
try {
|
|
30731
31840
|
process.kill(child.pid, "SIGTERM");
|
|
30732
31841
|
} catch {}
|
|
31842
|
+
await removePidFile();
|
|
30733
31843
|
console.log();
|
|
30734
31844
|
console.log(import_picocolors12.default.red("✗ Failed to start daemon (timed out waiting for server)."));
|
|
30735
31845
|
console.log();
|
|
30736
31846
|
process.exit(1);
|
|
30737
31847
|
}
|
|
30738
|
-
await writePidFile(child.pid, port);
|
|
30739
31848
|
console.log();
|
|
30740
31849
|
console.log(import_picocolors12.default.green("✓ Swixter UI daemon started"));
|
|
30741
31850
|
console.log(` PID: ${import_picocolors12.default.cyan(String(child.pid))}`);
|
|
@@ -30771,6 +31880,16 @@ async function runForeground(portArg) {
|
|
|
30771
31880
|
};
|
|
30772
31881
|
process.on("SIGINT", shutdown);
|
|
30773
31882
|
process.on("SIGTERM", shutdown);
|
|
31883
|
+
process.on("uncaughtException", async (err) => {
|
|
31884
|
+
console.error("Unexpected error:", err);
|
|
31885
|
+
await removePidFile();
|
|
31886
|
+
process.exit(1);
|
|
31887
|
+
});
|
|
31888
|
+
process.on("unhandledRejection", async (err) => {
|
|
31889
|
+
console.error("Unhandled rejection:", err);
|
|
31890
|
+
await removePidFile();
|
|
31891
|
+
process.exit(1);
|
|
31892
|
+
});
|
|
30774
31893
|
process.stdin.resume();
|
|
30775
31894
|
}
|
|
30776
31895
|
async function waitForServer(url2, timeoutMs) {
|