@mmmbuto/qwen-code-termux 0.6.0-termux → 0.6.2-termux
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 +19 -190
- package/{dist/cli.js → cli.js} +669 -55
- package/locales/en.js +1073 -0
- package/locales/ru.js +1092 -0
- package/locales/zh.js +927 -0
- package/package.json +16 -130
- package/tiktoken_bg.wasm +0 -0
- /package/{dist/sandbox-macos-permissive-closed.sb → sandbox-macos-permissive-closed.sb} +0 -0
- /package/{dist/sandbox-macos-permissive-open.sb → sandbox-macos-permissive-open.sb} +0 -0
- /package/{dist/sandbox-macos-permissive-proxied.sb → sandbox-macos-permissive-proxied.sb} +0 -0
- /package/{dist/sandbox-macos-restrictive-closed.sb → sandbox-macos-restrictive-closed.sb} +0 -0
- /package/{dist/sandbox-macos-restrictive-open.sb → sandbox-macos-restrictive-open.sb} +0 -0
- /package/{dist/sandbox-macos-restrictive-proxied.sb → sandbox-macos-restrictive-proxied.sb} +0 -0
- /package/{dist/vendor → vendor}/ripgrep/COPYING +0 -0
- /package/{dist/vendor → vendor}/ripgrep/arm64-darwin/rg +0 -0
- /package/{dist/vendor → vendor}/ripgrep/arm64-linux/rg +0 -0
- /package/{dist/vendor → vendor}/ripgrep/x64-darwin/rg +0 -0
- /package/{dist/vendor → vendor}/ripgrep/x64-linux/rg +0 -0
- /package/{dist/vendor → vendor}/ripgrep/x64-win32/rg.exe +0 -0
package/{dist/cli.js → cli.js}
RENAMED
|
@@ -140494,13 +140494,492 @@ ${[...baseTips, ...streamingSpecificTips].join("\n")}`;
|
|
|
140494
140494
|
}
|
|
140495
140495
|
});
|
|
140496
140496
|
|
|
140497
|
+
// node_modules/tiktoken/tiktoken_bg.cjs
|
|
140498
|
+
var require_tiktoken_bg = __commonJS({
|
|
140499
|
+
"node_modules/tiktoken/tiktoken_bg.cjs"(exports2, module2) {
|
|
140500
|
+
init_esbuild_shims();
|
|
140501
|
+
var wasm2;
|
|
140502
|
+
module2.exports.__wbg_set_wasm = function(val) {
|
|
140503
|
+
wasm2 = val;
|
|
140504
|
+
};
|
|
140505
|
+
var lTextDecoder = typeof TextDecoder === "undefined" ? (0, module2.require)("util").TextDecoder : TextDecoder;
|
|
140506
|
+
var cachedTextDecoder = new lTextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
140507
|
+
cachedTextDecoder.decode();
|
|
140508
|
+
var cachedUint8ArrayMemory0 = null;
|
|
140509
|
+
function getUint8ArrayMemory0() {
|
|
140510
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
140511
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm2.memory.buffer);
|
|
140512
|
+
}
|
|
140513
|
+
return cachedUint8ArrayMemory0;
|
|
140514
|
+
}
|
|
140515
|
+
__name(getUint8ArrayMemory0, "getUint8ArrayMemory0");
|
|
140516
|
+
function getStringFromWasm0(ptr, len) {
|
|
140517
|
+
ptr = ptr >>> 0;
|
|
140518
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
140519
|
+
}
|
|
140520
|
+
__name(getStringFromWasm0, "getStringFromWasm0");
|
|
140521
|
+
var heap = new Array(128).fill(void 0);
|
|
140522
|
+
heap.push(void 0, null, true, false);
|
|
140523
|
+
var heap_next = heap.length;
|
|
140524
|
+
function addHeapObject(obj) {
|
|
140525
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
140526
|
+
const idx = heap_next;
|
|
140527
|
+
heap_next = heap[idx];
|
|
140528
|
+
heap[idx] = obj;
|
|
140529
|
+
return idx;
|
|
140530
|
+
}
|
|
140531
|
+
__name(addHeapObject, "addHeapObject");
|
|
140532
|
+
function handleError2(f5, args) {
|
|
140533
|
+
try {
|
|
140534
|
+
return f5.apply(this, args);
|
|
140535
|
+
} catch (e4) {
|
|
140536
|
+
wasm2.__wbindgen_export_0(addHeapObject(e4));
|
|
140537
|
+
}
|
|
140538
|
+
}
|
|
140539
|
+
__name(handleError2, "handleError");
|
|
140540
|
+
function getObject2(idx) {
|
|
140541
|
+
return heap[idx];
|
|
140542
|
+
}
|
|
140543
|
+
__name(getObject2, "getObject");
|
|
140544
|
+
function dropObject(idx) {
|
|
140545
|
+
if (idx < 132) return;
|
|
140546
|
+
heap[idx] = heap_next;
|
|
140547
|
+
heap_next = idx;
|
|
140548
|
+
}
|
|
140549
|
+
__name(dropObject, "dropObject");
|
|
140550
|
+
function takeObject(idx) {
|
|
140551
|
+
const ret = getObject2(idx);
|
|
140552
|
+
dropObject(idx);
|
|
140553
|
+
return ret;
|
|
140554
|
+
}
|
|
140555
|
+
__name(takeObject, "takeObject");
|
|
140556
|
+
var WASM_VECTOR_LEN = 0;
|
|
140557
|
+
var lTextEncoder = typeof TextEncoder === "undefined" ? (0, module2.require)("util").TextEncoder : TextEncoder;
|
|
140558
|
+
var cachedTextEncoder = new lTextEncoder("utf-8");
|
|
140559
|
+
var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
|
|
140560
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
140561
|
+
} : function(arg, view) {
|
|
140562
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
140563
|
+
view.set(buf);
|
|
140564
|
+
return {
|
|
140565
|
+
read: arg.length,
|
|
140566
|
+
written: buf.length
|
|
140567
|
+
};
|
|
140568
|
+
};
|
|
140569
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
140570
|
+
if (realloc === void 0) {
|
|
140571
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
140572
|
+
const ptr2 = malloc(buf.length, 1) >>> 0;
|
|
140573
|
+
getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
|
|
140574
|
+
WASM_VECTOR_LEN = buf.length;
|
|
140575
|
+
return ptr2;
|
|
140576
|
+
}
|
|
140577
|
+
let len = arg.length;
|
|
140578
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
140579
|
+
const mem = getUint8ArrayMemory0();
|
|
140580
|
+
let offset = 0;
|
|
140581
|
+
for (; offset < len; offset++) {
|
|
140582
|
+
const code2 = arg.charCodeAt(offset);
|
|
140583
|
+
if (code2 > 127) break;
|
|
140584
|
+
mem[ptr + offset] = code2;
|
|
140585
|
+
}
|
|
140586
|
+
if (offset !== len) {
|
|
140587
|
+
if (offset !== 0) {
|
|
140588
|
+
arg = arg.slice(offset);
|
|
140589
|
+
}
|
|
140590
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
140591
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
140592
|
+
const ret = encodeString(arg, view);
|
|
140593
|
+
offset += ret.written;
|
|
140594
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
140595
|
+
}
|
|
140596
|
+
WASM_VECTOR_LEN = offset;
|
|
140597
|
+
return ptr;
|
|
140598
|
+
}
|
|
140599
|
+
__name(passStringToWasm0, "passStringToWasm0");
|
|
140600
|
+
function isLikeNone(x3) {
|
|
140601
|
+
return x3 === void 0 || x3 === null;
|
|
140602
|
+
}
|
|
140603
|
+
__name(isLikeNone, "isLikeNone");
|
|
140604
|
+
var cachedDataViewMemory0 = null;
|
|
140605
|
+
function getDataViewMemory0() {
|
|
140606
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm2.memory.buffer) {
|
|
140607
|
+
cachedDataViewMemory0 = new DataView(wasm2.memory.buffer);
|
|
140608
|
+
}
|
|
140609
|
+
return cachedDataViewMemory0;
|
|
140610
|
+
}
|
|
140611
|
+
__name(getDataViewMemory0, "getDataViewMemory0");
|
|
140612
|
+
var cachedUint32ArrayMemory0 = null;
|
|
140613
|
+
function getUint32ArrayMemory0() {
|
|
140614
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
140615
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm2.memory.buffer);
|
|
140616
|
+
}
|
|
140617
|
+
return cachedUint32ArrayMemory0;
|
|
140618
|
+
}
|
|
140619
|
+
__name(getUint32ArrayMemory0, "getUint32ArrayMemory0");
|
|
140620
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
140621
|
+
ptr = ptr >>> 0;
|
|
140622
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
140623
|
+
}
|
|
140624
|
+
__name(getArrayU32FromWasm0, "getArrayU32FromWasm0");
|
|
140625
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
140626
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
140627
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
140628
|
+
WASM_VECTOR_LEN = arg.length;
|
|
140629
|
+
return ptr;
|
|
140630
|
+
}
|
|
140631
|
+
__name(passArray8ToWasm0, "passArray8ToWasm0");
|
|
140632
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
140633
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
140634
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
140635
|
+
WASM_VECTOR_LEN = arg.length;
|
|
140636
|
+
return ptr;
|
|
140637
|
+
}
|
|
140638
|
+
__name(passArray32ToWasm0, "passArray32ToWasm0");
|
|
140639
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
140640
|
+
ptr = ptr >>> 0;
|
|
140641
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
140642
|
+
}
|
|
140643
|
+
__name(getArrayU8FromWasm0, "getArrayU8FromWasm0");
|
|
140644
|
+
module2.exports.get_encoding = function(encoding, extend_special_tokens) {
|
|
140645
|
+
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
140646
|
+
try {
|
|
140647
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
140648
|
+
const ptr0 = passStringToWasm0(encoding, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
|
|
140649
|
+
const len0 = WASM_VECTOR_LEN;
|
|
140650
|
+
wasm2.get_encoding(retptr, ptr0, len0, addHeapObject(extend_special_tokens));
|
|
140651
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
140652
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
140653
|
+
var r22 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
140654
|
+
if (r22) {
|
|
140655
|
+
throw takeObject(r1);
|
|
140656
|
+
}
|
|
140657
|
+
return Tiktoken.__wrap(r0);
|
|
140658
|
+
} finally {
|
|
140659
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
140660
|
+
}
|
|
140661
|
+
};
|
|
140662
|
+
module2.exports.encoding_for_model = function(model, extend_special_tokens) {
|
|
140663
|
+
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
140664
|
+
try {
|
|
140665
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
140666
|
+
const ptr0 = passStringToWasm0(model, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
|
|
140667
|
+
const len0 = WASM_VECTOR_LEN;
|
|
140668
|
+
wasm2.encoding_for_model(retptr, ptr0, len0, addHeapObject(extend_special_tokens));
|
|
140669
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
140670
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
140671
|
+
var r22 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
140672
|
+
if (r22) {
|
|
140673
|
+
throw takeObject(r1);
|
|
140674
|
+
}
|
|
140675
|
+
return Tiktoken.__wrap(r0);
|
|
140676
|
+
} finally {
|
|
140677
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
140678
|
+
}
|
|
140679
|
+
};
|
|
140680
|
+
module2.exports.get_encoding_name_for_model = function(model) {
|
|
140681
|
+
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
140682
|
+
let deferred3_0;
|
|
140683
|
+
let deferred3_1;
|
|
140684
|
+
try {
|
|
140685
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
140686
|
+
const ptr0 = passStringToWasm0(model, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
|
|
140687
|
+
const len0 = WASM_VECTOR_LEN;
|
|
140688
|
+
wasm2.get_encoding_name_for_model(retptr, ptr0, len0);
|
|
140689
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
140690
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
140691
|
+
var r22 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
140692
|
+
var r32 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
140693
|
+
var ptr2 = r0;
|
|
140694
|
+
var len2 = r1;
|
|
140695
|
+
if (r32) {
|
|
140696
|
+
ptr2 = 0;
|
|
140697
|
+
len2 = 0;
|
|
140698
|
+
throw takeObject(r22);
|
|
140699
|
+
}
|
|
140700
|
+
deferred3_0 = ptr2;
|
|
140701
|
+
deferred3_1 = len2;
|
|
140702
|
+
return getStringFromWasm0(ptr2, len2);
|
|
140703
|
+
} finally {
|
|
140704
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
140705
|
+
wasm2.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
|
|
140706
|
+
}
|
|
140707
|
+
};
|
|
140708
|
+
var TiktokenFinalization = typeof FinalizationRegistry === "undefined" ? { register: /* @__PURE__ */ __name(() => {
|
|
140709
|
+
}, "register"), unregister: /* @__PURE__ */ __name(() => {
|
|
140710
|
+
}, "unregister") } : new FinalizationRegistry((ptr) => wasm2.__wbg_tiktoken_free(ptr >>> 0, 1));
|
|
140711
|
+
var Tiktoken = class _Tiktoken {
|
|
140712
|
+
static {
|
|
140713
|
+
__name(this, "Tiktoken");
|
|
140714
|
+
}
|
|
140715
|
+
/**
|
|
140716
|
+
* @param {string} tiktoken_bfe
|
|
140717
|
+
* @param {any} special_tokens
|
|
140718
|
+
* @param {string} pat_str
|
|
140719
|
+
*/
|
|
140720
|
+
constructor(tiktoken_bfe, special_tokens, pat_str) {
|
|
140721
|
+
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
140722
|
+
const ptr0 = passStringToWasm0(tiktoken_bfe, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
|
|
140723
|
+
const len0 = WASM_VECTOR_LEN;
|
|
140724
|
+
const ptr1 = passStringToWasm0(pat_str, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
|
|
140725
|
+
const len1 = WASM_VECTOR_LEN;
|
|
140726
|
+
const ret = wasm2.tiktoken_new(ptr0, len0, addHeapObject(special_tokens), ptr1, len1);
|
|
140727
|
+
this.__wbg_ptr = ret >>> 0;
|
|
140728
|
+
TiktokenFinalization.register(this, this.__wbg_ptr, this);
|
|
140729
|
+
return this;
|
|
140730
|
+
}
|
|
140731
|
+
/** @returns {string | undefined} */
|
|
140732
|
+
get name() {
|
|
140733
|
+
try {
|
|
140734
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
140735
|
+
wasm2.tiktoken_name(retptr, this.__wbg_ptr);
|
|
140736
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
140737
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
140738
|
+
let v1;
|
|
140739
|
+
if (r0 !== 0) {
|
|
140740
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
140741
|
+
wasm2.__wbindgen_export_3(r0, r1 * 1, 1);
|
|
140742
|
+
}
|
|
140743
|
+
return v1;
|
|
140744
|
+
} finally {
|
|
140745
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
140746
|
+
}
|
|
140747
|
+
}
|
|
140748
|
+
static __wrap(ptr) {
|
|
140749
|
+
ptr = ptr >>> 0;
|
|
140750
|
+
const obj = Object.create(_Tiktoken.prototype);
|
|
140751
|
+
obj.__wbg_ptr = ptr;
|
|
140752
|
+
TiktokenFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
140753
|
+
return obj;
|
|
140754
|
+
}
|
|
140755
|
+
__destroy_into_raw() {
|
|
140756
|
+
const ptr = this.__wbg_ptr;
|
|
140757
|
+
this.__wbg_ptr = 0;
|
|
140758
|
+
TiktokenFinalization.unregister(this);
|
|
140759
|
+
return ptr;
|
|
140760
|
+
}
|
|
140761
|
+
free() {
|
|
140762
|
+
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
140763
|
+
const ptr = this.__destroy_into_raw();
|
|
140764
|
+
wasm2.__wbg_tiktoken_free(ptr, 0);
|
|
140765
|
+
}
|
|
140766
|
+
/**
|
|
140767
|
+
* @param {string} text
|
|
140768
|
+
* @param {any} allowed_special
|
|
140769
|
+
* @param {any} disallowed_special
|
|
140770
|
+
* @returns {Uint32Array}
|
|
140771
|
+
*/
|
|
140772
|
+
encode(text, allowed_special, disallowed_special) {
|
|
140773
|
+
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
140774
|
+
try {
|
|
140775
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
140776
|
+
const ptr0 = passStringToWasm0(text, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
|
|
140777
|
+
const len0 = WASM_VECTOR_LEN;
|
|
140778
|
+
wasm2.tiktoken_encode(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
|
|
140779
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
140780
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
140781
|
+
var r22 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
140782
|
+
var r32 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
140783
|
+
if (r32) {
|
|
140784
|
+
throw takeObject(r22);
|
|
140785
|
+
}
|
|
140786
|
+
var v2 = getArrayU32FromWasm0(r0, r1).slice();
|
|
140787
|
+
wasm2.__wbindgen_export_3(r0, r1 * 4, 4);
|
|
140788
|
+
return v2;
|
|
140789
|
+
} finally {
|
|
140790
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
140791
|
+
}
|
|
140792
|
+
}
|
|
140793
|
+
/**
|
|
140794
|
+
* @param {string} text
|
|
140795
|
+
* @returns {Uint32Array}
|
|
140796
|
+
*/
|
|
140797
|
+
encode_ordinary(text) {
|
|
140798
|
+
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
140799
|
+
try {
|
|
140800
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
140801
|
+
const ptr0 = passStringToWasm0(text, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
|
|
140802
|
+
const len0 = WASM_VECTOR_LEN;
|
|
140803
|
+
wasm2.tiktoken_encode_ordinary(retptr, this.__wbg_ptr, ptr0, len0);
|
|
140804
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
140805
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
140806
|
+
var v2 = getArrayU32FromWasm0(r0, r1).slice();
|
|
140807
|
+
wasm2.__wbindgen_export_3(r0, r1 * 4, 4);
|
|
140808
|
+
return v2;
|
|
140809
|
+
} finally {
|
|
140810
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
140811
|
+
}
|
|
140812
|
+
}
|
|
140813
|
+
/**
|
|
140814
|
+
* @param {string} text
|
|
140815
|
+
* @param {any} allowed_special
|
|
140816
|
+
* @param {any} disallowed_special
|
|
140817
|
+
* @returns {any}
|
|
140818
|
+
*/
|
|
140819
|
+
encode_with_unstable(text, allowed_special, disallowed_special) {
|
|
140820
|
+
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
140821
|
+
try {
|
|
140822
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
140823
|
+
const ptr0 = passStringToWasm0(text, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
|
|
140824
|
+
const len0 = WASM_VECTOR_LEN;
|
|
140825
|
+
wasm2.tiktoken_encode_with_unstable(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
|
|
140826
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
140827
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
140828
|
+
var r22 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
140829
|
+
if (r22) {
|
|
140830
|
+
throw takeObject(r1);
|
|
140831
|
+
}
|
|
140832
|
+
return takeObject(r0);
|
|
140833
|
+
} finally {
|
|
140834
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
140835
|
+
}
|
|
140836
|
+
}
|
|
140837
|
+
/**
|
|
140838
|
+
* @param {Uint8Array} bytes
|
|
140839
|
+
* @returns {number}
|
|
140840
|
+
*/
|
|
140841
|
+
encode_single_token(bytes) {
|
|
140842
|
+
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
140843
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm2.__wbindgen_export_1);
|
|
140844
|
+
const len0 = WASM_VECTOR_LEN;
|
|
140845
|
+
const ret = wasm2.tiktoken_encode_single_token(this.__wbg_ptr, ptr0, len0);
|
|
140846
|
+
return ret >>> 0;
|
|
140847
|
+
}
|
|
140848
|
+
/**
|
|
140849
|
+
* @param {Uint32Array} tokens
|
|
140850
|
+
* @returns {Uint8Array}
|
|
140851
|
+
*/
|
|
140852
|
+
decode(tokens) {
|
|
140853
|
+
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
140854
|
+
try {
|
|
140855
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
140856
|
+
const ptr0 = passArray32ToWasm0(tokens, wasm2.__wbindgen_export_1);
|
|
140857
|
+
const len0 = WASM_VECTOR_LEN;
|
|
140858
|
+
wasm2.tiktoken_decode(retptr, this.__wbg_ptr, ptr0, len0);
|
|
140859
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
140860
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
140861
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
140862
|
+
wasm2.__wbindgen_export_3(r0, r1 * 1, 1);
|
|
140863
|
+
return v2;
|
|
140864
|
+
} finally {
|
|
140865
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
140866
|
+
}
|
|
140867
|
+
}
|
|
140868
|
+
/**
|
|
140869
|
+
* @param {number} token
|
|
140870
|
+
* @returns {Uint8Array}
|
|
140871
|
+
*/
|
|
140872
|
+
decode_single_token_bytes(token2) {
|
|
140873
|
+
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
140874
|
+
try {
|
|
140875
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
140876
|
+
wasm2.tiktoken_decode_single_token_bytes(retptr, this.__wbg_ptr, token2);
|
|
140877
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
140878
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
140879
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
140880
|
+
wasm2.__wbindgen_export_3(r0, r1 * 1, 1);
|
|
140881
|
+
return v1;
|
|
140882
|
+
} finally {
|
|
140883
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
140884
|
+
}
|
|
140885
|
+
}
|
|
140886
|
+
/** @returns {any} */
|
|
140887
|
+
token_byte_values() {
|
|
140888
|
+
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
140889
|
+
const ret = wasm2.tiktoken_token_byte_values(this.__wbg_ptr);
|
|
140890
|
+
return takeObject(ret);
|
|
140891
|
+
}
|
|
140892
|
+
};
|
|
140893
|
+
module2.exports.Tiktoken = Tiktoken;
|
|
140894
|
+
module2.exports.__wbg_parse_def2e24ef1252aff = function() {
|
|
140895
|
+
return handleError2(function(arg0, arg1) {
|
|
140896
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
140897
|
+
return addHeapObject(ret);
|
|
140898
|
+
}, arguments);
|
|
140899
|
+
};
|
|
140900
|
+
module2.exports.__wbg_stringify_f7ed6987935b4a24 = function() {
|
|
140901
|
+
return handleError2(function(arg0) {
|
|
140902
|
+
const ret = JSON.stringify(getObject2(arg0));
|
|
140903
|
+
return addHeapObject(ret);
|
|
140904
|
+
}, arguments);
|
|
140905
|
+
};
|
|
140906
|
+
module2.exports.__wbindgen_error_new = function(arg0, arg1) {
|
|
140907
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
140908
|
+
return addHeapObject(ret);
|
|
140909
|
+
};
|
|
140910
|
+
module2.exports.__wbindgen_is_undefined = function(arg0) {
|
|
140911
|
+
const ret = getObject2(arg0) === void 0;
|
|
140912
|
+
return ret;
|
|
140913
|
+
};
|
|
140914
|
+
module2.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
140915
|
+
takeObject(arg0);
|
|
140916
|
+
};
|
|
140917
|
+
module2.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
140918
|
+
if (wasm2 == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
140919
|
+
const obj = getObject2(arg1);
|
|
140920
|
+
const ret = typeof obj === "string" ? obj : void 0;
|
|
140921
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
|
|
140922
|
+
var len1 = WASM_VECTOR_LEN;
|
|
140923
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
140924
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
140925
|
+
};
|
|
140926
|
+
module2.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
140927
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
140928
|
+
};
|
|
140929
|
+
}
|
|
140930
|
+
});
|
|
140931
|
+
|
|
140932
|
+
// node_modules/tiktoken/tiktoken.cjs
|
|
140933
|
+
var require_tiktoken = __commonJS({
|
|
140934
|
+
"node_modules/tiktoken/tiktoken.cjs"(exports2) {
|
|
140935
|
+
init_esbuild_shims();
|
|
140936
|
+
var wasm2 = require_tiktoken_bg();
|
|
140937
|
+
var imports = {};
|
|
140938
|
+
imports["./tiktoken_bg.js"] = wasm2;
|
|
140939
|
+
var path112 = __require("path");
|
|
140940
|
+
var fs101 = __require("fs");
|
|
140941
|
+
var candidates = __dirname.split(path112.sep).reduce((memo, _2, index, array2) => {
|
|
140942
|
+
const prefix = array2.slice(0, index + 1).join(path112.sep) + path112.sep;
|
|
140943
|
+
if (!prefix.includes("node_modules" + path112.sep)) {
|
|
140944
|
+
memo.unshift(
|
|
140945
|
+
path112.join(
|
|
140946
|
+
prefix,
|
|
140947
|
+
"node_modules",
|
|
140948
|
+
"tiktoken",
|
|
140949
|
+
"",
|
|
140950
|
+
"./tiktoken_bg.wasm"
|
|
140951
|
+
)
|
|
140952
|
+
);
|
|
140953
|
+
}
|
|
140954
|
+
return memo;
|
|
140955
|
+
}, []);
|
|
140956
|
+
candidates.unshift(path112.join(__dirname, "./tiktoken_bg.wasm"));
|
|
140957
|
+
var bytes = null;
|
|
140958
|
+
for (const candidate of candidates) {
|
|
140959
|
+
try {
|
|
140960
|
+
bytes = fs101.readFileSync(candidate);
|
|
140961
|
+
break;
|
|
140962
|
+
} catch {
|
|
140963
|
+
}
|
|
140964
|
+
}
|
|
140965
|
+
if (bytes == null) throw new Error("Missing tiktoken_bg.wasm");
|
|
140966
|
+
var wasmModule = new WebAssembly.Module(bytes);
|
|
140967
|
+
var wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
140968
|
+
wasm2.__wbg_set_wasm(wasmInstance.exports);
|
|
140969
|
+
exports2["get_encoding"] = wasm2["get_encoding"];
|
|
140970
|
+
exports2["encoding_for_model"] = wasm2["encoding_for_model"];
|
|
140971
|
+
exports2["get_encoding_name_for_model"] = wasm2["get_encoding_name_for_model"];
|
|
140972
|
+
exports2["Tiktoken"] = wasm2["Tiktoken"];
|
|
140973
|
+
}
|
|
140974
|
+
});
|
|
140975
|
+
|
|
140497
140976
|
// packages/core/dist/src/utils/request-tokenizer/textTokenizer.js
|
|
140498
|
-
|
|
140499
|
-
var TextTokenizer;
|
|
140977
|
+
var import_tiktoken, TextTokenizer;
|
|
140500
140978
|
var init_textTokenizer = __esm({
|
|
140501
140979
|
"packages/core/dist/src/utils/request-tokenizer/textTokenizer.js"() {
|
|
140502
140980
|
"use strict";
|
|
140503
140981
|
init_esbuild_shims();
|
|
140982
|
+
import_tiktoken = __toESM(require_tiktoken(), 1);
|
|
140504
140983
|
TextTokenizer = class {
|
|
140505
140984
|
static {
|
|
140506
140985
|
__name(this, "TextTokenizer");
|
|
@@ -140517,7 +140996,7 @@ var init_textTokenizer = __esm({
|
|
|
140517
140996
|
if (this.encoding)
|
|
140518
140997
|
return;
|
|
140519
140998
|
try {
|
|
140520
|
-
this.encoding = get_encoding(this.encodingName);
|
|
140999
|
+
this.encoding = (0, import_tiktoken.get_encoding)(this.encodingName);
|
|
140521
141000
|
} catch (error2) {
|
|
140522
141001
|
console.warn(`Failed to load tiktoken with encoding ${this.encodingName}:`, error2);
|
|
140523
141002
|
this.encoding = null;
|
|
@@ -142473,8 +142952,42 @@ import crypto5 from "crypto";
|
|
|
142473
142952
|
import path9 from "node:path";
|
|
142474
142953
|
import { promises as fs13 } from "node:fs";
|
|
142475
142954
|
import * as os7 from "os";
|
|
142955
|
+
import { execSync } from "node:child_process";
|
|
142476
142956
|
import { EventEmitter as EventEmitter2 } from "events";
|
|
142477
142957
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
142958
|
+
function isTermux() {
|
|
142959
|
+
return process.platform === "android" || process.env["PREFIX"]?.includes("com.termux") || process.env["TERMUX_VERSION"] !== void 0;
|
|
142960
|
+
}
|
|
142961
|
+
async function openBrowserUrl(url2) {
|
|
142962
|
+
if (isTermux()) {
|
|
142963
|
+
try {
|
|
142964
|
+
const possiblePaths = [
|
|
142965
|
+
"/data/data/com.termux/files/usr/bin/termux-open-url",
|
|
142966
|
+
"/usr/bin/termux-open-url",
|
|
142967
|
+
"termux-open-url"
|
|
142968
|
+
];
|
|
142969
|
+
let termuxOpenUrl = "termux-open-url";
|
|
142970
|
+
for (const path112 of possiblePaths) {
|
|
142971
|
+
try {
|
|
142972
|
+
execSync(`test -x "${path112}"`, { stdio: "ignore" });
|
|
142973
|
+
termuxOpenUrl = path112;
|
|
142974
|
+
break;
|
|
142975
|
+
} catch {
|
|
142976
|
+
}
|
|
142977
|
+
}
|
|
142978
|
+
console.debug(`Opening URL with: ${termuxOpenUrl}`);
|
|
142979
|
+
execSync(`"${termuxOpenUrl}" "${url2}"`, {
|
|
142980
|
+
stdio: ["ignore", "ignore", "ignore"],
|
|
142981
|
+
env: { ...process.env, PATH: process.env["PATH"] }
|
|
142982
|
+
});
|
|
142983
|
+
} catch (error2) {
|
|
142984
|
+
console.error(`Failed to open URL with termux-open-url: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
142985
|
+
throw error2;
|
|
142986
|
+
}
|
|
142987
|
+
} else {
|
|
142988
|
+
await open_default(url2);
|
|
142989
|
+
}
|
|
142990
|
+
}
|
|
142478
142991
|
function generateCodeVerifier() {
|
|
142479
142992
|
return crypto5.randomBytes(32).toString("base64url");
|
|
142480
142993
|
}
|
|
@@ -142580,13 +143093,7 @@ ${deviceAuth.verification_uri_complete}
|
|
|
142580
143093
|
}, "showFallbackMessage");
|
|
142581
143094
|
if (!config2.isBrowserLaunchSuppressed()) {
|
|
142582
143095
|
try {
|
|
142583
|
-
|
|
142584
|
-
if (childProcess3) {
|
|
142585
|
-
childProcess3.on("error", () => {
|
|
142586
|
-
console.debug("Failed to open browser. Visit this URL to authorize:");
|
|
142587
|
-
showFallbackMessage();
|
|
142588
|
-
});
|
|
142589
|
-
}
|
|
143096
|
+
await openBrowserUrl(deviceAuth.verification_uri_complete);
|
|
142590
143097
|
} catch (_err) {
|
|
142591
143098
|
showFallbackMessage();
|
|
142592
143099
|
}
|
|
@@ -142758,6 +143265,8 @@ var init_qwenOAuth2 = __esm({
|
|
|
142758
143265
|
QWEN_OAUTH_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|
|
142759
143266
|
QWEN_DIR3 = ".qwen";
|
|
142760
143267
|
QWEN_CREDENTIAL_FILENAME2 = "oauth_creds.json";
|
|
143268
|
+
__name(isTermux, "isTermux");
|
|
143269
|
+
__name(openBrowserUrl, "openBrowserUrl");
|
|
142761
143270
|
__name(generateCodeVerifier, "generateCodeVerifier");
|
|
142762
143271
|
__name(generateCodeChallenge, "generateCodeChallenge");
|
|
142763
143272
|
__name(generatePKCEPair, "generatePKCEPair");
|
|
@@ -154418,7 +154927,7 @@ __export(geminiContentGenerator_exports, {
|
|
|
154418
154927
|
createGeminiContentGenerator: () => createGeminiContentGenerator
|
|
154419
154928
|
});
|
|
154420
154929
|
function createGeminiContentGenerator(config2, gcConfig) {
|
|
154421
|
-
const version2 = "0.6.
|
|
154930
|
+
const version2 = "0.6.2-termux";
|
|
154422
154931
|
const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
|
|
154423
154932
|
const baseHeaders = {
|
|
154424
154933
|
"User-Agent": userAgent2
|
|
@@ -155014,7 +155523,7 @@ var init_jsonl_utils = __esm({
|
|
|
155014
155523
|
// packages/core/dist/src/utils/gitUtils.js
|
|
155015
155524
|
import * as fs16 from "node:fs";
|
|
155016
155525
|
import * as path11 from "node:path";
|
|
155017
|
-
import { execSync } from "node:child_process";
|
|
155526
|
+
import { execSync as execSync2 } from "node:child_process";
|
|
155018
155527
|
function isGitRepository(directory) {
|
|
155019
155528
|
try {
|
|
155020
155529
|
let currentDir = path11.resolve(directory);
|
|
@@ -155042,7 +155551,7 @@ var init_gitUtils = __esm({
|
|
|
155042
155551
|
__name(isGitRepository, "isGitRepository");
|
|
155043
155552
|
getGitBranch = /* @__PURE__ */ __name((cwd7) => {
|
|
155044
155553
|
try {
|
|
155045
|
-
const branch =
|
|
155554
|
+
const branch = execSync2("git rev-parse --abbrev-ref HEAD", {
|
|
155046
155555
|
cwd: cwd7,
|
|
155047
155556
|
encoding: "utf8",
|
|
155048
155557
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -158959,7 +159468,7 @@ var init_types4 = __esm({
|
|
|
158959
159468
|
});
|
|
158960
159469
|
|
|
158961
159470
|
// packages/core/dist/src/utils/editor.js
|
|
158962
|
-
import { execSync as
|
|
159471
|
+
import { execSync as execSync3, spawn, spawnSync } from "node:child_process";
|
|
158963
159472
|
function isValidEditorType(editor) {
|
|
158964
159473
|
return [
|
|
158965
159474
|
"vscode",
|
|
@@ -158975,7 +159484,7 @@ function isValidEditorType(editor) {
|
|
|
158975
159484
|
}
|
|
158976
159485
|
function commandExists(cmd) {
|
|
158977
159486
|
try {
|
|
158978
|
-
|
|
159487
|
+
execSync3(process.platform === "win32" ? `where.exe ${cmd}` : `command -v ${cmd}`, { stdio: "ignore" });
|
|
158979
159488
|
return true;
|
|
158980
159489
|
} catch {
|
|
158981
159490
|
return false;
|
|
@@ -165238,7 +165747,7 @@ var require_lib3 = __commonJS({
|
|
|
165238
165747
|
});
|
|
165239
165748
|
|
|
165240
165749
|
// packages/core/dist/src/utils/systemEncoding.js
|
|
165241
|
-
import { execSync as
|
|
165750
|
+
import { execSync as execSync4 } from "node:child_process";
|
|
165242
165751
|
import os11 from "node:os";
|
|
165243
165752
|
function getCachedEncodingForBuffer(buffer) {
|
|
165244
165753
|
if (cachedSystemEncoding === void 0) {
|
|
@@ -165258,7 +165767,7 @@ function getCachedEncodingForBuffer(buffer) {
|
|
|
165258
165767
|
function getSystemEncoding() {
|
|
165259
165768
|
if (os11.platform() === "win32") {
|
|
165260
165769
|
try {
|
|
165261
|
-
const output =
|
|
165770
|
+
const output = execSync4("chcp", { encoding: "utf8" });
|
|
165262
165771
|
const match3 = output.match(/:\s*(\d+)/);
|
|
165263
165772
|
if (match3) {
|
|
165264
165773
|
const codePage = parseInt(match3[1], 10);
|
|
@@ -165276,7 +165785,7 @@ function getSystemEncoding() {
|
|
|
165276
165785
|
let locale = env7["LC_ALL"] || env7["LC_CTYPE"] || env7["LANG"] || "";
|
|
165277
165786
|
if (!locale) {
|
|
165278
165787
|
try {
|
|
165279
|
-
locale =
|
|
165788
|
+
locale = execSync4("locale charmap", { encoding: "utf8" }).toString().trim();
|
|
165280
165789
|
} catch (_e2) {
|
|
165281
165790
|
console.warn("Failed to get locale charmap.");
|
|
165282
165791
|
return null;
|
|
@@ -280837,7 +281346,7 @@ var require_command_exists = __commonJS({
|
|
|
280837
281346
|
"use strict";
|
|
280838
281347
|
init_esbuild_shims();
|
|
280839
281348
|
var exec5 = __require("child_process").exec;
|
|
280840
|
-
var
|
|
281349
|
+
var execSync10 = __require("child_process").execSync;
|
|
280841
281350
|
var fs101 = __require("fs");
|
|
280842
281351
|
var path112 = __require("path");
|
|
280843
281352
|
var access7 = fs101.access;
|
|
@@ -280911,7 +281420,7 @@ var require_command_exists = __commonJS({
|
|
|
280911
281420
|
var commandExistsUnixSync = /* @__PURE__ */ __name(function(commandName, cleanedCommandName) {
|
|
280912
281421
|
if (fileNotExistsSync(commandName)) {
|
|
280913
281422
|
try {
|
|
280914
|
-
var stdout =
|
|
281423
|
+
var stdout = execSync10(
|
|
280915
281424
|
"command -v " + cleanedCommandName + " 2>/dev/null && { echo >&1 " + cleanedCommandName + "; exit 0; }"
|
|
280916
281425
|
);
|
|
280917
281426
|
return !!stdout;
|
|
@@ -280926,7 +281435,7 @@ var require_command_exists = __commonJS({
|
|
|
280926
281435
|
return false;
|
|
280927
281436
|
}
|
|
280928
281437
|
try {
|
|
280929
|
-
var stdout =
|
|
281438
|
+
var stdout = execSync10("where " + cleanedCommandName, { stdio: [] });
|
|
280930
281439
|
return !!stdout;
|
|
280931
281440
|
} catch (error2) {
|
|
280932
281441
|
return false;
|
|
@@ -348852,6 +349361,7 @@ function getMergeStrategyForPath(path112) {
|
|
|
348852
349361
|
}
|
|
348853
349362
|
__name(getMergeStrategyForPath, "getMergeStrategyForPath");
|
|
348854
349363
|
var SETTINGS_DIRECTORY_NAME2 = ".qwen";
|
|
349364
|
+
var LEGACY_SETTINGS_FILENAME = "config.json";
|
|
348855
349365
|
var USER_SETTINGS_PATH = Storage.getGlobalSettingsPath();
|
|
348856
349366
|
var USER_SETTINGS_DIR2 = path72.dirname(USER_SETTINGS_PATH);
|
|
348857
349367
|
var DEFAULT_EXCLUDED_ENV_VARS = ["DEBUG", "DEBUG_MODE"];
|
|
@@ -348933,6 +349443,10 @@ var MIGRATION_MAP = {
|
|
|
348933
349443
|
vlmSwitchMode: "experimental.vlmSwitchMode",
|
|
348934
349444
|
visionModelPreview: "experimental.visionModelPreview"
|
|
348935
349445
|
};
|
|
349446
|
+
function isTermux2() {
|
|
349447
|
+
return process25.platform === "android" || !!process25.env["TERMUX_VERSION"] || !!(process25.env["PREFIX"] && process25.env["PREFIX"].includes("com.termux"));
|
|
349448
|
+
}
|
|
349449
|
+
__name(isTermux2, "isTermux");
|
|
348936
349450
|
function getSystemSettingsPath() {
|
|
348937
349451
|
if (process25.env["QWEN_CODE_SYSTEM_SETTINGS_PATH"]) {
|
|
348938
349452
|
return process25.env["QWEN_CODE_SYSTEM_SETTINGS_PATH"];
|
|
@@ -349252,6 +349766,11 @@ function loadSettings(workspaceDir = process25.cwd()) {
|
|
|
349252
349766
|
const systemSettingsPath = getSystemSettingsPath();
|
|
349253
349767
|
const systemDefaultsPath = getSystemDefaultsPath();
|
|
349254
349768
|
const migratedInMemorScopes = /* @__PURE__ */ new Set();
|
|
349769
|
+
const legacyUserSettingsPath = path72.join(
|
|
349770
|
+
homedir13(),
|
|
349771
|
+
SETTINGS_DIRECTORY_NAME2,
|
|
349772
|
+
LEGACY_SETTINGS_FILENAME
|
|
349773
|
+
);
|
|
349255
349774
|
const resolvedWorkspaceDir = path72.resolve(workspaceDir);
|
|
349256
349775
|
const resolvedHomeDir = path72.resolve(homedir13());
|
|
349257
349776
|
let realWorkspaceDir = resolvedWorkspaceDir;
|
|
@@ -349263,15 +349782,29 @@ function loadSettings(workspaceDir = process25.cwd()) {
|
|
|
349263
349782
|
const workspaceSettingsPath = new Storage(
|
|
349264
349783
|
workspaceDir
|
|
349265
349784
|
).getWorkspaceSettingsPath();
|
|
349266
|
-
const
|
|
349785
|
+
const legacyWorkspaceSettingsPath = path72.join(
|
|
349786
|
+
workspaceDir,
|
|
349787
|
+
SETTINGS_DIRECTORY_NAME2,
|
|
349788
|
+
LEGACY_SETTINGS_FILENAME
|
|
349789
|
+
);
|
|
349790
|
+
let warnedLegacySettings = false;
|
|
349791
|
+
const loadAndMigrate = /* @__PURE__ */ __name((filePath, scope, legacyFilePath) => {
|
|
349267
349792
|
try {
|
|
349268
|
-
|
|
349269
|
-
|
|
349793
|
+
let sourcePath = filePath;
|
|
349794
|
+
let usingLegacy = false;
|
|
349795
|
+
if (!fs70.existsSync(sourcePath) && legacyFilePath) {
|
|
349796
|
+
if (fs70.existsSync(legacyFilePath)) {
|
|
349797
|
+
sourcePath = legacyFilePath;
|
|
349798
|
+
usingLegacy = true;
|
|
349799
|
+
}
|
|
349800
|
+
}
|
|
349801
|
+
if (fs70.existsSync(sourcePath)) {
|
|
349802
|
+
const content = fs70.readFileSync(sourcePath, "utf-8");
|
|
349270
349803
|
const rawSettings = JSON.parse((0, import_strip_json_comments2.default)(content));
|
|
349271
349804
|
if (typeof rawSettings !== "object" || rawSettings === null || Array.isArray(rawSettings)) {
|
|
349272
349805
|
settingsErrors.push({
|
|
349273
349806
|
message: "Settings file is not a valid JSON object.",
|
|
349274
|
-
path:
|
|
349807
|
+
path: sourcePath
|
|
349275
349808
|
});
|
|
349276
349809
|
return { settings: {} };
|
|
349277
349810
|
}
|
|
@@ -349281,12 +349814,20 @@ function loadSettings(workspaceDir = process25.cwd()) {
|
|
|
349281
349814
|
if (migratedSettings) {
|
|
349282
349815
|
if (MIGRATE_V2_OVERWRITE) {
|
|
349283
349816
|
try {
|
|
349284
|
-
|
|
349285
|
-
|
|
349286
|
-
|
|
349287
|
-
|
|
349288
|
-
|
|
349289
|
-
|
|
349817
|
+
if (!usingLegacy) {
|
|
349818
|
+
fs70.renameSync(sourcePath, `${sourcePath}.orig`);
|
|
349819
|
+
fs70.writeFileSync(
|
|
349820
|
+
sourcePath,
|
|
349821
|
+
JSON.stringify(migratedSettings, null, 2),
|
|
349822
|
+
"utf-8"
|
|
349823
|
+
);
|
|
349824
|
+
} else {
|
|
349825
|
+
fs70.writeFileSync(
|
|
349826
|
+
filePath,
|
|
349827
|
+
JSON.stringify(migratedSettings, null, 2),
|
|
349828
|
+
"utf-8"
|
|
349829
|
+
);
|
|
349830
|
+
}
|
|
349290
349831
|
} catch (e4) {
|
|
349291
349832
|
console.error(
|
|
349292
349833
|
`Error migrating settings file on disk: ${getErrorMessage(
|
|
@@ -349303,8 +349844,9 @@ function loadSettings(workspaceDir = process25.cwd()) {
|
|
|
349303
349844
|
settingsObject[SETTINGS_VERSION_KEY] = SETTINGS_VERSION;
|
|
349304
349845
|
if (MIGRATE_V2_OVERWRITE) {
|
|
349305
349846
|
try {
|
|
349847
|
+
const targetPath = usingLegacy && sourcePath !== filePath ? filePath : sourcePath;
|
|
349306
349848
|
fs70.writeFileSync(
|
|
349307
|
-
|
|
349849
|
+
targetPath,
|
|
349308
349850
|
JSON.stringify(settingsObject, null, 2),
|
|
349309
349851
|
"utf-8"
|
|
349310
349852
|
);
|
|
@@ -349315,6 +349857,27 @@ function loadSettings(workspaceDir = process25.cwd()) {
|
|
|
349315
349857
|
}
|
|
349316
349858
|
}
|
|
349317
349859
|
}
|
|
349860
|
+
if (usingLegacy && !warnedLegacySettings) {
|
|
349861
|
+
console.warn(
|
|
349862
|
+
`Loaded legacy settings from ${sourcePath}. Please migrate to ${filePath}.`
|
|
349863
|
+
);
|
|
349864
|
+
warnedLegacySettings = true;
|
|
349865
|
+
}
|
|
349866
|
+
if (usingLegacy && MIGRATE_V2_OVERWRITE) {
|
|
349867
|
+
try {
|
|
349868
|
+
fs70.writeFileSync(
|
|
349869
|
+
filePath,
|
|
349870
|
+
JSON.stringify(settingsObject, null, 2),
|
|
349871
|
+
"utf-8"
|
|
349872
|
+
);
|
|
349873
|
+
} catch (e4) {
|
|
349874
|
+
console.error(
|
|
349875
|
+
`Error writing migrated settings to ${filePath}: ${getErrorMessage(
|
|
349876
|
+
e4
|
|
349877
|
+
)}`
|
|
349878
|
+
);
|
|
349879
|
+
}
|
|
349880
|
+
}
|
|
349318
349881
|
return { settings: settingsObject, rawJson: content };
|
|
349319
349882
|
}
|
|
349320
349883
|
} catch (error2) {
|
|
@@ -349330,7 +349893,11 @@ function loadSettings(workspaceDir = process25.cwd()) {
|
|
|
349330
349893
|
systemDefaultsPath,
|
|
349331
349894
|
"SystemDefaults" /* SystemDefaults */
|
|
349332
349895
|
);
|
|
349333
|
-
const userResult = loadAndMigrate(
|
|
349896
|
+
const userResult = loadAndMigrate(
|
|
349897
|
+
USER_SETTINGS_PATH,
|
|
349898
|
+
"User" /* User */,
|
|
349899
|
+
legacyUserSettingsPath
|
|
349900
|
+
);
|
|
349334
349901
|
let workspaceResult = {
|
|
349335
349902
|
settings: {},
|
|
349336
349903
|
rawJson: void 0
|
|
@@ -349338,7 +349905,8 @@ function loadSettings(workspaceDir = process25.cwd()) {
|
|
|
349338
349905
|
if (realWorkspaceDir !== realHomeDir) {
|
|
349339
349906
|
workspaceResult = loadAndMigrate(
|
|
349340
349907
|
workspaceSettingsPath,
|
|
349341
|
-
"Workspace" /* Workspace
|
|
349908
|
+
"Workspace" /* Workspace */,
|
|
349909
|
+
legacyWorkspaceSettingsPath
|
|
349342
349910
|
);
|
|
349343
349911
|
}
|
|
349344
349912
|
const systemOriginalSettings = structuredClone(systemResult.settings);
|
|
@@ -349351,6 +349919,39 @@ function loadSettings(workspaceDir = process25.cwd()) {
|
|
|
349351
349919
|
systemDefaultSettings = resolveEnvVarsInObject(systemDefaultsResult.settings);
|
|
349352
349920
|
userSettings = resolveEnvVarsInObject(userResult.settings);
|
|
349353
349921
|
workspaceSettings = resolveEnvVarsInObject(workspaceResult.settings);
|
|
349922
|
+
if (isTermux2()) {
|
|
349923
|
+
const hasHideBannerSetting = [
|
|
349924
|
+
systemSettings.ui?.hideBanner,
|
|
349925
|
+
systemDefaultSettings.ui?.hideBanner,
|
|
349926
|
+
userSettings.ui?.hideBanner,
|
|
349927
|
+
workspaceSettings.ui?.hideBanner
|
|
349928
|
+
].some((value) => typeof value === "boolean");
|
|
349929
|
+
if (!hasHideBannerSetting) {
|
|
349930
|
+
systemDefaultSettings = {
|
|
349931
|
+
...systemDefaultSettings,
|
|
349932
|
+
ui: {
|
|
349933
|
+
...systemDefaultSettings.ui ?? {},
|
|
349934
|
+
hideBanner: true
|
|
349935
|
+
}
|
|
349936
|
+
};
|
|
349937
|
+
}
|
|
349938
|
+
const hasUseRipgrepSetting = [
|
|
349939
|
+
systemSettings.tools?.useRipgrep,
|
|
349940
|
+
systemDefaultSettings.tools?.useRipgrep,
|
|
349941
|
+
userSettings.tools?.useRipgrep,
|
|
349942
|
+
workspaceSettings.tools?.useRipgrep
|
|
349943
|
+
].some((value) => typeof value === "boolean");
|
|
349944
|
+
if (!hasUseRipgrepSetting) {
|
|
349945
|
+
systemDefaultSettings = {
|
|
349946
|
+
...systemDefaultSettings,
|
|
349947
|
+
tools: {
|
|
349948
|
+
...systemDefaultSettings.tools ?? {},
|
|
349949
|
+
useRipgrep: false,
|
|
349950
|
+
useBuiltinRipgrep: false
|
|
349951
|
+
}
|
|
349952
|
+
};
|
|
349953
|
+
}
|
|
349954
|
+
}
|
|
349354
349955
|
if (userSettings.ui?.theme === "VS") {
|
|
349355
349956
|
userSettings.ui.theme = DefaultLight.name;
|
|
349356
349957
|
} else if (userSettings.ui?.theme === "VS2015") {
|
|
@@ -355401,7 +356002,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
355401
356002
|
// packages/cli/src/utils/version.ts
|
|
355402
356003
|
async function getCliVersion() {
|
|
355403
356004
|
const pkgJson = await getPackageJson();
|
|
355404
|
-
return "0.6.
|
|
356005
|
+
return "0.6.2-termux";
|
|
355405
356006
|
}
|
|
355406
356007
|
__name(getCliVersion, "getCliVersion");
|
|
355407
356008
|
|
|
@@ -363375,7 +363976,7 @@ var import_react26 = __toESM(require_react(), 1);
|
|
|
363375
363976
|
init_esbuild_shims();
|
|
363376
363977
|
import process28 from "node:process";
|
|
363377
363978
|
import os28 from "node:os";
|
|
363378
|
-
import { execSync as
|
|
363979
|
+
import { execSync as execSync6 } from "node:child_process";
|
|
363379
363980
|
|
|
363380
363981
|
// packages/cli/src/ui/utils/formatters.ts
|
|
363381
363982
|
init_esbuild_shims();
|
|
@@ -363449,12 +364050,12 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
|
|
|
363449
364050
|
|
|
363450
364051
|
// packages/cli/src/generated/git-commit.ts
|
|
363451
364052
|
init_esbuild_shims();
|
|
363452
|
-
var GIT_COMMIT_INFO2 = "
|
|
364053
|
+
var GIT_COMMIT_INFO2 = "6e378690";
|
|
363453
364054
|
|
|
363454
364055
|
// packages/cli/src/utils/systemInfo.ts
|
|
363455
364056
|
async function getNpmVersion() {
|
|
363456
364057
|
try {
|
|
363457
|
-
return
|
|
364058
|
+
return execSync6("npm --version", { encoding: "utf-8" }).trim();
|
|
363458
364059
|
} catch {
|
|
363459
364060
|
return "unknown";
|
|
363460
364061
|
}
|
|
@@ -366414,10 +367015,10 @@ import { Writable } from "node:stream";
|
|
|
366414
367015
|
// packages/cli/src/utils/gitUtils.ts
|
|
366415
367016
|
init_esbuild_shims();
|
|
366416
367017
|
var import_undici4 = __toESM(require_undici2(), 1);
|
|
366417
|
-
import { execSync as
|
|
367018
|
+
import { execSync as execSync7 } from "node:child_process";
|
|
366418
367019
|
var isGitHubRepository = /* @__PURE__ */ __name(() => {
|
|
366419
367020
|
try {
|
|
366420
|
-
const remotes = (
|
|
367021
|
+
const remotes = (execSync7("git remote -v", {
|
|
366421
367022
|
encoding: "utf-8"
|
|
366422
367023
|
}) || "").trim();
|
|
366423
367024
|
const pattern = /github\.com/;
|
|
@@ -366428,7 +367029,7 @@ var isGitHubRepository = /* @__PURE__ */ __name(() => {
|
|
|
366428
367029
|
}
|
|
366429
367030
|
}, "isGitHubRepository");
|
|
366430
367031
|
var getGitRepoRoot = /* @__PURE__ */ __name(() => {
|
|
366431
|
-
const gitRepoRoot = (
|
|
367032
|
+
const gitRepoRoot = (execSync7("git rev-parse --show-toplevel", {
|
|
366432
367033
|
encoding: "utf-8"
|
|
366433
367034
|
}) || "").trim();
|
|
366434
367035
|
if (!gitRepoRoot) {
|
|
@@ -366471,7 +367072,7 @@ var getLatestGitHubRelease = /* @__PURE__ */ __name(async (proxy) => {
|
|
|
366471
367072
|
}
|
|
366472
367073
|
}, "getLatestGitHubRelease");
|
|
366473
367074
|
function getGitHubRepoInfo() {
|
|
366474
|
-
const remoteUrl =
|
|
367075
|
+
const remoteUrl = execSync7("git remote get-url origin", {
|
|
366475
367076
|
encoding: "utf-8"
|
|
366476
367077
|
}).trim();
|
|
366477
367078
|
let urlToParse = remoteUrl;
|
|
@@ -395048,7 +395649,9 @@ var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1);
|
|
|
395048
395649
|
var Notifications = /* @__PURE__ */ __name(() => {
|
|
395049
395650
|
const { startupWarnings } = useAppContext();
|
|
395050
395651
|
const { initError, streamingState, updateInfo } = useUIState();
|
|
395051
|
-
const
|
|
395652
|
+
const settings = useSettings();
|
|
395653
|
+
const config2 = useConfig();
|
|
395654
|
+
const showStartupWarnings = !settings.merged.ui?.hideBanner && !config2.getScreenReader() && startupWarnings.length > 0;
|
|
395052
395655
|
const showInitError = initError && streamingState !== "responding" /* Responding */;
|
|
395053
395656
|
if (!showStartupWarnings && !showInitError && !updateInfo) {
|
|
395054
395657
|
return null;
|
|
@@ -411274,7 +411877,7 @@ __name(relaunchAppInChildProcess, "relaunchAppInChildProcess");
|
|
|
411274
411877
|
// packages/cli/src/utils/sandbox.ts
|
|
411275
411878
|
init_esbuild_shims();
|
|
411276
411879
|
var import_shell_quote5 = __toESM(require_shell_quote(), 1);
|
|
411277
|
-
import { exec as exec4, execSync as
|
|
411880
|
+
import { exec as exec4, execSync as execSync9, spawn as spawn10 } from "node:child_process";
|
|
411278
411881
|
import os39 from "node:os";
|
|
411279
411882
|
import path109 from "node:path";
|
|
411280
411883
|
import fs97 from "node:fs";
|
|
@@ -411433,7 +412036,7 @@ async function start_sandbox(config2, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
411433
412036
|
"-D",
|
|
411434
412037
|
`HOME_DIR=${fs97.realpathSync(os39.homedir())}`,
|
|
411435
412038
|
"-D",
|
|
411436
|
-
`CACHE_DIR=${fs97.realpathSync(
|
|
412039
|
+
`CACHE_DIR=${fs97.realpathSync(execSync9(`getconf DARWIN_USER_CACHE_DIR`).toString().trim())}`
|
|
411437
412040
|
];
|
|
411438
412041
|
const MAX_INCLUDE_DIRS = 5;
|
|
411439
412042
|
const targetDir = fs97.realpathSync(cliConfig?.getTargetDir() || "");
|
|
@@ -411551,7 +412154,7 @@ async function start_sandbox(config2, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
411551
412154
|
console.error(`using ${projectSandboxDockerfile2} for sandbox`);
|
|
411552
412155
|
buildArgs += `-f ${path109.resolve(projectSandboxDockerfile2)} -i ${image2}`;
|
|
411553
412156
|
}
|
|
411554
|
-
|
|
412157
|
+
execSync9(
|
|
411555
412158
|
`cd ${gcRoot} && node scripts/build_sandbox.js -s ${buildArgs}`,
|
|
411556
412159
|
{
|
|
411557
412160
|
stdio: "inherit",
|
|
@@ -411660,12 +412263,12 @@ async function start_sandbox(config2, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
411660
412263
|
args.push("--env", `no_proxy=${noProxy}`);
|
|
411661
412264
|
}
|
|
411662
412265
|
if (proxy) {
|
|
411663
|
-
|
|
412266
|
+
execSync9(
|
|
411664
412267
|
`${config2.command} network inspect ${SANDBOX_NETWORK_NAME} || ${config2.command} network create --internal ${SANDBOX_NETWORK_NAME}`
|
|
411665
412268
|
);
|
|
411666
412269
|
args.push("--network", SANDBOX_NETWORK_NAME);
|
|
411667
412270
|
if (proxyCommand) {
|
|
411668
|
-
|
|
412271
|
+
execSync9(
|
|
411669
412272
|
`${config2.command} network inspect ${SANDBOX_PROXY_NAME} || ${config2.command} network create ${SANDBOX_PROXY_NAME}`
|
|
411670
412273
|
);
|
|
411671
412274
|
}
|
|
@@ -411681,7 +412284,7 @@ async function start_sandbox(config2, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
411681
412284
|
console.log(`ContainerName: ${containerName}`);
|
|
411682
412285
|
} else {
|
|
411683
412286
|
let index = 0;
|
|
411684
|
-
const containerNameCheck =
|
|
412287
|
+
const containerNameCheck = execSync9(
|
|
411685
412288
|
`${config2.command} ps -a --format "{{.Names}}"`
|
|
411686
412289
|
).toString().trim();
|
|
411687
412290
|
while (containerNameCheck.includes(`${imageName}-${index}`)) {
|
|
@@ -411809,8 +412412,8 @@ async function start_sandbox(config2, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
411809
412412
|
userFlag = "--user root";
|
|
411810
412413
|
} else if (await shouldUseCurrentUserInSandbox()) {
|
|
411811
412414
|
args.push("--user", "root");
|
|
411812
|
-
const uid =
|
|
411813
|
-
const gid =
|
|
412415
|
+
const uid = execSync9("id -u").toString().trim();
|
|
412416
|
+
const gid = execSync9("id -g").toString().trim();
|
|
411814
412417
|
const username = "gemini";
|
|
411815
412418
|
const homeDir = getContainerPath(os39.homedir());
|
|
411816
412419
|
const setupUserCommands = [
|
|
@@ -411839,7 +412442,7 @@ async function start_sandbox(config2, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
411839
412442
|
});
|
|
411840
412443
|
const stopProxy = /* @__PURE__ */ __name(() => {
|
|
411841
412444
|
console.log("stopping proxy container ...");
|
|
411842
|
-
|
|
412445
|
+
execSync9(`${config2.command} rm -f ${SANDBOX_PROXY_NAME}`);
|
|
411843
412446
|
}, "stopProxy");
|
|
411844
412447
|
process.on("exit", stopProxy);
|
|
411845
412448
|
process.on("SIGINT", stopProxy);
|
|
@@ -412029,6 +412632,11 @@ init_esbuild_shims();
|
|
|
412029
412632
|
import fs99 from "node:fs/promises";
|
|
412030
412633
|
import * as os41 from "node:os";
|
|
412031
412634
|
import path110 from "node:path";
|
|
412635
|
+
function isTermux3() {
|
|
412636
|
+
return process.platform === "android" || !!process.env["TERMUX_VERSION"] || !!(process.env["PREFIX"] && process.env["PREFIX"].includes("com.termux"));
|
|
412637
|
+
}
|
|
412638
|
+
__name(isTermux3, "isTermux");
|
|
412639
|
+
var IS_TERMUX = isTermux3();
|
|
412032
412640
|
var homeDirectoryCheck = {
|
|
412033
412641
|
id: "home-directory",
|
|
412034
412642
|
check: /* @__PURE__ */ __name(async (options2) => {
|
|
@@ -412064,6 +412672,9 @@ var rootDirectoryCheck = {
|
|
|
412064
412672
|
var ripgrepAvailabilityCheck = {
|
|
412065
412673
|
id: "ripgrep-availability",
|
|
412066
412674
|
check: /* @__PURE__ */ __name(async (options2) => {
|
|
412675
|
+
if (IS_TERMUX) {
|
|
412676
|
+
return null;
|
|
412677
|
+
}
|
|
412067
412678
|
if (!options2.useRipgrep) {
|
|
412068
412679
|
return null;
|
|
412069
412680
|
}
|
|
@@ -412079,7 +412690,7 @@ var ripgrepAvailabilityCheck = {
|
|
|
412079
412690
|
}, "check")
|
|
412080
412691
|
};
|
|
412081
412692
|
var WARNING_CHECKS = [
|
|
412082
|
-
homeDirectoryCheck,
|
|
412693
|
+
...IS_TERMUX ? [] : [homeDirectoryCheck],
|
|
412083
412694
|
rootDirectoryCheck,
|
|
412084
412695
|
ripgrepAvailabilityCheck
|
|
412085
412696
|
];
|
|
@@ -414564,7 +415175,7 @@ var GeminiAgent = class {
|
|
|
414564
415175
|
name: APPROVAL_MODE_INFO[mode].name,
|
|
414565
415176
|
description: APPROVAL_MODE_INFO[mode].description
|
|
414566
415177
|
}));
|
|
414567
|
-
const version2 = "0.6.
|
|
415178
|
+
const version2 = "0.6.2-termux";
|
|
414568
415179
|
return {
|
|
414569
415180
|
protocolVersion: PROTOCOL_VERSION,
|
|
414570
415181
|
agentInfo: {
|
|
@@ -415022,7 +415633,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
415022
415633
|
return runAcpAgent(config2, settings, extensions, argv);
|
|
415023
415634
|
}
|
|
415024
415635
|
let input = config2.getQuestion();
|
|
415025
|
-
|
|
415636
|
+
let startupWarnings = [
|
|
415026
415637
|
...await getStartupWarnings(),
|
|
415027
415638
|
...await getUserStartupWarnings({
|
|
415028
415639
|
workspaceRoot: process.cwd(),
|
|
@@ -415030,6 +415641,9 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
415030
415641
|
useBuiltinRipgrep: settings.merged.tools?.useBuiltinRipgrep ?? true
|
|
415031
415642
|
})
|
|
415032
415643
|
];
|
|
415644
|
+
if (settings.merged.ui?.hideBanner || config2.getScreenReader()) {
|
|
415645
|
+
startupWarnings = [];
|
|
415646
|
+
}
|
|
415033
415647
|
if (config2.isInteractive()) {
|
|
415034
415648
|
await kittyProtocolDetectionComplete;
|
|
415035
415649
|
await startInteractiveUI(
|