@hasna/assistants 0.6.26 → 0.6.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +487 -765
- package/dist/index.js.map +16 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17773,434 +17773,6 @@ var init_src = __esm(() => {
|
|
|
17773
17773
|
init_utils();
|
|
17774
17774
|
});
|
|
17775
17775
|
|
|
17776
|
-
// node_modules/.pnpm/tiktoken@1.0.22/node_modules/tiktoken/tiktoken_bg.cjs
|
|
17777
|
-
var require_tiktoken_bg = __commonJS((exports, module) => {
|
|
17778
|
-
var wasm;
|
|
17779
|
-
exports.__wbg_set_wasm = function(val) {
|
|
17780
|
-
wasm = val;
|
|
17781
|
-
};
|
|
17782
|
-
var lTextDecoder = typeof TextDecoder === "undefined" ? (0, module.require)("util").TextDecoder : TextDecoder;
|
|
17783
|
-
var cachedTextDecoder = new lTextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
17784
|
-
cachedTextDecoder.decode();
|
|
17785
|
-
var cachedUint8ArrayMemory0 = null;
|
|
17786
|
-
function getUint8ArrayMemory0() {
|
|
17787
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
17788
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
17789
|
-
}
|
|
17790
|
-
return cachedUint8ArrayMemory0;
|
|
17791
|
-
}
|
|
17792
|
-
function getStringFromWasm0(ptr, len) {
|
|
17793
|
-
ptr = ptr >>> 0;
|
|
17794
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
17795
|
-
}
|
|
17796
|
-
var heap = new Array(128).fill(undefined);
|
|
17797
|
-
heap.push(undefined, null, true, false);
|
|
17798
|
-
var heap_next = heap.length;
|
|
17799
|
-
function addHeapObject(obj) {
|
|
17800
|
-
if (heap_next === heap.length)
|
|
17801
|
-
heap.push(heap.length + 1);
|
|
17802
|
-
const idx = heap_next;
|
|
17803
|
-
heap_next = heap[idx];
|
|
17804
|
-
heap[idx] = obj;
|
|
17805
|
-
return idx;
|
|
17806
|
-
}
|
|
17807
|
-
function handleError(f, args) {
|
|
17808
|
-
try {
|
|
17809
|
-
return f.apply(this, args);
|
|
17810
|
-
} catch (e) {
|
|
17811
|
-
wasm.__wbindgen_export_0(addHeapObject(e));
|
|
17812
|
-
}
|
|
17813
|
-
}
|
|
17814
|
-
function getObject(idx) {
|
|
17815
|
-
return heap[idx];
|
|
17816
|
-
}
|
|
17817
|
-
function dropObject(idx) {
|
|
17818
|
-
if (idx < 132)
|
|
17819
|
-
return;
|
|
17820
|
-
heap[idx] = heap_next;
|
|
17821
|
-
heap_next = idx;
|
|
17822
|
-
}
|
|
17823
|
-
function takeObject(idx) {
|
|
17824
|
-
const ret = getObject(idx);
|
|
17825
|
-
dropObject(idx);
|
|
17826
|
-
return ret;
|
|
17827
|
-
}
|
|
17828
|
-
var WASM_VECTOR_LEN = 0;
|
|
17829
|
-
var lTextEncoder = typeof TextEncoder === "undefined" ? (0, module.require)("util").TextEncoder : TextEncoder;
|
|
17830
|
-
var cachedTextEncoder = new lTextEncoder("utf-8");
|
|
17831
|
-
var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
|
|
17832
|
-
return cachedTextEncoder.encodeInto(arg, view);
|
|
17833
|
-
} : function(arg, view) {
|
|
17834
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
17835
|
-
view.set(buf);
|
|
17836
|
-
return {
|
|
17837
|
-
read: arg.length,
|
|
17838
|
-
written: buf.length
|
|
17839
|
-
};
|
|
17840
|
-
};
|
|
17841
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
17842
|
-
if (realloc === undefined) {
|
|
17843
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
17844
|
-
const ptr2 = malloc(buf.length, 1) >>> 0;
|
|
17845
|
-
getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
|
|
17846
|
-
WASM_VECTOR_LEN = buf.length;
|
|
17847
|
-
return ptr2;
|
|
17848
|
-
}
|
|
17849
|
-
let len = arg.length;
|
|
17850
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
17851
|
-
const mem = getUint8ArrayMemory0();
|
|
17852
|
-
let offset = 0;
|
|
17853
|
-
for (;offset < len; offset++) {
|
|
17854
|
-
const code = arg.charCodeAt(offset);
|
|
17855
|
-
if (code > 127)
|
|
17856
|
-
break;
|
|
17857
|
-
mem[ptr + offset] = code;
|
|
17858
|
-
}
|
|
17859
|
-
if (offset !== len) {
|
|
17860
|
-
if (offset !== 0) {
|
|
17861
|
-
arg = arg.slice(offset);
|
|
17862
|
-
}
|
|
17863
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
17864
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
17865
|
-
const ret = encodeString(arg, view);
|
|
17866
|
-
offset += ret.written;
|
|
17867
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
17868
|
-
}
|
|
17869
|
-
WASM_VECTOR_LEN = offset;
|
|
17870
|
-
return ptr;
|
|
17871
|
-
}
|
|
17872
|
-
function isLikeNone(x) {
|
|
17873
|
-
return x === undefined || x === null;
|
|
17874
|
-
}
|
|
17875
|
-
var cachedDataViewMemory0 = null;
|
|
17876
|
-
function getDataViewMemory0() {
|
|
17877
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
|
|
17878
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
17879
|
-
}
|
|
17880
|
-
return cachedDataViewMemory0;
|
|
17881
|
-
}
|
|
17882
|
-
var cachedUint32ArrayMemory0 = null;
|
|
17883
|
-
function getUint32ArrayMemory0() {
|
|
17884
|
-
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
17885
|
-
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
17886
|
-
}
|
|
17887
|
-
return cachedUint32ArrayMemory0;
|
|
17888
|
-
}
|
|
17889
|
-
function getArrayU32FromWasm0(ptr, len) {
|
|
17890
|
-
ptr = ptr >>> 0;
|
|
17891
|
-
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
17892
|
-
}
|
|
17893
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
17894
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
17895
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
17896
|
-
WASM_VECTOR_LEN = arg.length;
|
|
17897
|
-
return ptr;
|
|
17898
|
-
}
|
|
17899
|
-
function passArray32ToWasm0(arg, malloc) {
|
|
17900
|
-
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
17901
|
-
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
17902
|
-
WASM_VECTOR_LEN = arg.length;
|
|
17903
|
-
return ptr;
|
|
17904
|
-
}
|
|
17905
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
17906
|
-
ptr = ptr >>> 0;
|
|
17907
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
17908
|
-
}
|
|
17909
|
-
exports.get_encoding = function(encoding, extend_special_tokens) {
|
|
17910
|
-
if (wasm == null)
|
|
17911
|
-
throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
17912
|
-
try {
|
|
17913
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
17914
|
-
const ptr0 = passStringToWasm0(encoding, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
17915
|
-
const len0 = WASM_VECTOR_LEN;
|
|
17916
|
-
wasm.get_encoding(retptr, ptr0, len0, addHeapObject(extend_special_tokens));
|
|
17917
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
17918
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
17919
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
17920
|
-
if (r2) {
|
|
17921
|
-
throw takeObject(r1);
|
|
17922
|
-
}
|
|
17923
|
-
return Tiktoken.__wrap(r0);
|
|
17924
|
-
} finally {
|
|
17925
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
17926
|
-
}
|
|
17927
|
-
};
|
|
17928
|
-
exports.encoding_for_model = function(model, extend_special_tokens) {
|
|
17929
|
-
if (wasm == null)
|
|
17930
|
-
throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
17931
|
-
try {
|
|
17932
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
17933
|
-
const ptr0 = passStringToWasm0(model, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
17934
|
-
const len0 = WASM_VECTOR_LEN;
|
|
17935
|
-
wasm.encoding_for_model(retptr, ptr0, len0, addHeapObject(extend_special_tokens));
|
|
17936
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
17937
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
17938
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
17939
|
-
if (r2) {
|
|
17940
|
-
throw takeObject(r1);
|
|
17941
|
-
}
|
|
17942
|
-
return Tiktoken.__wrap(r0);
|
|
17943
|
-
} finally {
|
|
17944
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
17945
|
-
}
|
|
17946
|
-
};
|
|
17947
|
-
exports.get_encoding_name_for_model = function(model) {
|
|
17948
|
-
if (wasm == null)
|
|
17949
|
-
throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
17950
|
-
let deferred3_0;
|
|
17951
|
-
let deferred3_1;
|
|
17952
|
-
try {
|
|
17953
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
17954
|
-
const ptr0 = passStringToWasm0(model, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
17955
|
-
const len0 = WASM_VECTOR_LEN;
|
|
17956
|
-
wasm.get_encoding_name_for_model(retptr, ptr0, len0);
|
|
17957
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
17958
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
17959
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
17960
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
17961
|
-
var ptr2 = r0;
|
|
17962
|
-
var len2 = r1;
|
|
17963
|
-
if (r3) {
|
|
17964
|
-
ptr2 = 0;
|
|
17965
|
-
len2 = 0;
|
|
17966
|
-
throw takeObject(r2);
|
|
17967
|
-
}
|
|
17968
|
-
deferred3_0 = ptr2;
|
|
17969
|
-
deferred3_1 = len2;
|
|
17970
|
-
return getStringFromWasm0(ptr2, len2);
|
|
17971
|
-
} finally {
|
|
17972
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
17973
|
-
wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
|
|
17974
|
-
}
|
|
17975
|
-
};
|
|
17976
|
-
var TiktokenFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((ptr) => wasm.__wbg_tiktoken_free(ptr >>> 0, 1));
|
|
17977
|
-
|
|
17978
|
-
class Tiktoken {
|
|
17979
|
-
constructor(tiktoken_bfe, special_tokens, pat_str) {
|
|
17980
|
-
if (wasm == null)
|
|
17981
|
-
throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
17982
|
-
const ptr0 = passStringToWasm0(tiktoken_bfe, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
17983
|
-
const len0 = WASM_VECTOR_LEN;
|
|
17984
|
-
const ptr1 = passStringToWasm0(pat_str, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
17985
|
-
const len1 = WASM_VECTOR_LEN;
|
|
17986
|
-
const ret = wasm.tiktoken_new(ptr0, len0, addHeapObject(special_tokens), ptr1, len1);
|
|
17987
|
-
this.__wbg_ptr = ret >>> 0;
|
|
17988
|
-
TiktokenFinalization.register(this, this.__wbg_ptr, this);
|
|
17989
|
-
return this;
|
|
17990
|
-
}
|
|
17991
|
-
get name() {
|
|
17992
|
-
try {
|
|
17993
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
17994
|
-
wasm.tiktoken_name(retptr, this.__wbg_ptr);
|
|
17995
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
17996
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
17997
|
-
let v1;
|
|
17998
|
-
if (r0 !== 0) {
|
|
17999
|
-
v1 = getStringFromWasm0(r0, r1).slice();
|
|
18000
|
-
wasm.__wbindgen_export_3(r0, r1 * 1, 1);
|
|
18001
|
-
}
|
|
18002
|
-
return v1;
|
|
18003
|
-
} finally {
|
|
18004
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
18005
|
-
}
|
|
18006
|
-
}
|
|
18007
|
-
static __wrap(ptr) {
|
|
18008
|
-
ptr = ptr >>> 0;
|
|
18009
|
-
const obj = Object.create(Tiktoken.prototype);
|
|
18010
|
-
obj.__wbg_ptr = ptr;
|
|
18011
|
-
TiktokenFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
18012
|
-
return obj;
|
|
18013
|
-
}
|
|
18014
|
-
__destroy_into_raw() {
|
|
18015
|
-
const ptr = this.__wbg_ptr;
|
|
18016
|
-
this.__wbg_ptr = 0;
|
|
18017
|
-
TiktokenFinalization.unregister(this);
|
|
18018
|
-
return ptr;
|
|
18019
|
-
}
|
|
18020
|
-
free() {
|
|
18021
|
-
if (wasm == null)
|
|
18022
|
-
throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
18023
|
-
const ptr = this.__destroy_into_raw();
|
|
18024
|
-
wasm.__wbg_tiktoken_free(ptr, 0);
|
|
18025
|
-
}
|
|
18026
|
-
encode(text, allowed_special, disallowed_special) {
|
|
18027
|
-
if (wasm == null)
|
|
18028
|
-
throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
18029
|
-
try {
|
|
18030
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
18031
|
-
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
18032
|
-
const len0 = WASM_VECTOR_LEN;
|
|
18033
|
-
wasm.tiktoken_encode(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
|
|
18034
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
18035
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
18036
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
18037
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
18038
|
-
if (r3) {
|
|
18039
|
-
throw takeObject(r2);
|
|
18040
|
-
}
|
|
18041
|
-
var v2 = getArrayU32FromWasm0(r0, r1).slice();
|
|
18042
|
-
wasm.__wbindgen_export_3(r0, r1 * 4, 4);
|
|
18043
|
-
return v2;
|
|
18044
|
-
} finally {
|
|
18045
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
18046
|
-
}
|
|
18047
|
-
}
|
|
18048
|
-
encode_ordinary(text) {
|
|
18049
|
-
if (wasm == null)
|
|
18050
|
-
throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
18051
|
-
try {
|
|
18052
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
18053
|
-
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
18054
|
-
const len0 = WASM_VECTOR_LEN;
|
|
18055
|
-
wasm.tiktoken_encode_ordinary(retptr, this.__wbg_ptr, ptr0, len0);
|
|
18056
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
18057
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
18058
|
-
var v2 = getArrayU32FromWasm0(r0, r1).slice();
|
|
18059
|
-
wasm.__wbindgen_export_3(r0, r1 * 4, 4);
|
|
18060
|
-
return v2;
|
|
18061
|
-
} finally {
|
|
18062
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
18063
|
-
}
|
|
18064
|
-
}
|
|
18065
|
-
encode_with_unstable(text, allowed_special, disallowed_special) {
|
|
18066
|
-
if (wasm == null)
|
|
18067
|
-
throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
18068
|
-
try {
|
|
18069
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
18070
|
-
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
18071
|
-
const len0 = WASM_VECTOR_LEN;
|
|
18072
|
-
wasm.tiktoken_encode_with_unstable(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
|
|
18073
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
18074
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
18075
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
18076
|
-
if (r2) {
|
|
18077
|
-
throw takeObject(r1);
|
|
18078
|
-
}
|
|
18079
|
-
return takeObject(r0);
|
|
18080
|
-
} finally {
|
|
18081
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
18082
|
-
}
|
|
18083
|
-
}
|
|
18084
|
-
encode_single_token(bytes) {
|
|
18085
|
-
if (wasm == null)
|
|
18086
|
-
throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
18087
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export_1);
|
|
18088
|
-
const len0 = WASM_VECTOR_LEN;
|
|
18089
|
-
const ret = wasm.tiktoken_encode_single_token(this.__wbg_ptr, ptr0, len0);
|
|
18090
|
-
return ret >>> 0;
|
|
18091
|
-
}
|
|
18092
|
-
decode(tokens) {
|
|
18093
|
-
if (wasm == null)
|
|
18094
|
-
throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
18095
|
-
try {
|
|
18096
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
18097
|
-
const ptr0 = passArray32ToWasm0(tokens, wasm.__wbindgen_export_1);
|
|
18098
|
-
const len0 = WASM_VECTOR_LEN;
|
|
18099
|
-
wasm.tiktoken_decode(retptr, this.__wbg_ptr, ptr0, len0);
|
|
18100
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
18101
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
18102
|
-
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
18103
|
-
wasm.__wbindgen_export_3(r0, r1 * 1, 1);
|
|
18104
|
-
return v2;
|
|
18105
|
-
} finally {
|
|
18106
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
18107
|
-
}
|
|
18108
|
-
}
|
|
18109
|
-
decode_single_token_bytes(token) {
|
|
18110
|
-
if (wasm == null)
|
|
18111
|
-
throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
18112
|
-
try {
|
|
18113
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
18114
|
-
wasm.tiktoken_decode_single_token_bytes(retptr, this.__wbg_ptr, token);
|
|
18115
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
18116
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
18117
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
18118
|
-
wasm.__wbindgen_export_3(r0, r1 * 1, 1);
|
|
18119
|
-
return v1;
|
|
18120
|
-
} finally {
|
|
18121
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
18122
|
-
}
|
|
18123
|
-
}
|
|
18124
|
-
token_byte_values() {
|
|
18125
|
-
if (wasm == null)
|
|
18126
|
-
throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
18127
|
-
const ret = wasm.tiktoken_token_byte_values(this.__wbg_ptr);
|
|
18128
|
-
return takeObject(ret);
|
|
18129
|
-
}
|
|
18130
|
-
}
|
|
18131
|
-
exports.Tiktoken = Tiktoken;
|
|
18132
|
-
exports.__wbg_parse_def2e24ef1252aff = function() {
|
|
18133
|
-
return handleError(function(arg0, arg1) {
|
|
18134
|
-
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
18135
|
-
return addHeapObject(ret);
|
|
18136
|
-
}, arguments);
|
|
18137
|
-
};
|
|
18138
|
-
exports.__wbg_stringify_f7ed6987935b4a24 = function() {
|
|
18139
|
-
return handleError(function(arg0) {
|
|
18140
|
-
const ret = JSON.stringify(getObject(arg0));
|
|
18141
|
-
return addHeapObject(ret);
|
|
18142
|
-
}, arguments);
|
|
18143
|
-
};
|
|
18144
|
-
exports.__wbindgen_error_new = function(arg0, arg1) {
|
|
18145
|
-
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
18146
|
-
return addHeapObject(ret);
|
|
18147
|
-
};
|
|
18148
|
-
exports.__wbindgen_is_undefined = function(arg0) {
|
|
18149
|
-
const ret = getObject(arg0) === undefined;
|
|
18150
|
-
return ret;
|
|
18151
|
-
};
|
|
18152
|
-
exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
18153
|
-
takeObject(arg0);
|
|
18154
|
-
};
|
|
18155
|
-
exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
18156
|
-
if (wasm == null)
|
|
18157
|
-
throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
18158
|
-
const obj = getObject(arg1);
|
|
18159
|
-
const ret = typeof obj === "string" ? obj : undefined;
|
|
18160
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
18161
|
-
var len1 = WASM_VECTOR_LEN;
|
|
18162
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
18163
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
18164
|
-
};
|
|
18165
|
-
exports.__wbindgen_throw = function(arg0, arg1) {
|
|
18166
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
18167
|
-
};
|
|
18168
|
-
});
|
|
18169
|
-
|
|
18170
|
-
// node_modules/.pnpm/tiktoken@1.0.22/node_modules/tiktoken/tiktoken.cjs
|
|
18171
|
-
var require_tiktoken = __commonJS((exports) => {
|
|
18172
|
-
var __dirname = "/Users/hasna/Workspace/dev/hasna/opensource/opensourcedev/opensource-oldpal/node_modules/.pnpm/tiktoken@1.0.22/node_modules/tiktoken";
|
|
18173
|
-
var wasm = require_tiktoken_bg();
|
|
18174
|
-
var imports = {};
|
|
18175
|
-
imports["./tiktoken_bg.js"] = wasm;
|
|
18176
|
-
var path = __require("path");
|
|
18177
|
-
var fs2 = __require("fs");
|
|
18178
|
-
var candidates = __dirname.split(path.sep).reduce((memo, _, index, array) => {
|
|
18179
|
-
const prefix = array.slice(0, index + 1).join(path.sep) + path.sep;
|
|
18180
|
-
if (!prefix.includes("node_modules" + path.sep)) {
|
|
18181
|
-
memo.unshift(path.join(prefix, "node_modules", "tiktoken", "", "./tiktoken_bg.wasm"));
|
|
18182
|
-
}
|
|
18183
|
-
return memo;
|
|
18184
|
-
}, []);
|
|
18185
|
-
candidates.unshift(path.join(__dirname, "./tiktoken_bg.wasm"));
|
|
18186
|
-
var bytes = null;
|
|
18187
|
-
for (const candidate of candidates) {
|
|
18188
|
-
try {
|
|
18189
|
-
bytes = fs2.readFileSync(candidate);
|
|
18190
|
-
break;
|
|
18191
|
-
} catch {}
|
|
18192
|
-
}
|
|
18193
|
-
if (bytes == null)
|
|
18194
|
-
throw new Error("Missing tiktoken_bg.wasm");
|
|
18195
|
-
var wasmModule = new WebAssembly.Module(bytes);
|
|
18196
|
-
var wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
18197
|
-
wasm.__wbg_set_wasm(wasmInstance.exports);
|
|
18198
|
-
exports.get_encoding = wasm["get_encoding"];
|
|
18199
|
-
exports.encoding_for_model = wasm["encoding_for_model"];
|
|
18200
|
-
exports.get_encoding_name_for_model = wasm["get_encoding_name_for_model"];
|
|
18201
|
-
exports.Tiktoken = wasm["Tiktoken"];
|
|
18202
|
-
});
|
|
18203
|
-
|
|
18204
17776
|
// packages/core/src/errors/codes.ts
|
|
18205
17777
|
var ErrorCodes;
|
|
18206
17778
|
var init_codes = __esm(() => {
|
|
@@ -37166,45 +36738,18 @@ init_src();
|
|
|
37166
36738
|
// packages/core/src/context/token-counter.ts
|
|
37167
36739
|
var MESSAGE_OVERHEAD_TOKENS = 4;
|
|
37168
36740
|
var CHARS_PER_TOKEN = 4;
|
|
37169
|
-
var tiktokenEncoder = null;
|
|
37170
|
-
var tiktokenLoadAttempted = false;
|
|
37171
|
-
function loadTiktoken() {
|
|
37172
|
-
if (tiktokenLoadAttempted)
|
|
37173
|
-
return tiktokenEncoder;
|
|
37174
|
-
tiktokenLoadAttempted = true;
|
|
37175
|
-
try {
|
|
37176
|
-
const tiktoken = require_tiktoken();
|
|
37177
|
-
try {
|
|
37178
|
-
tiktokenEncoder = tiktoken.encoding_for_model("gpt-4");
|
|
37179
|
-
} catch {
|
|
37180
|
-
tiktokenEncoder = tiktoken.get_encoding("cl100k_base");
|
|
37181
|
-
}
|
|
37182
|
-
} catch (error) {
|
|
37183
|
-
console.warn("Token counting using estimation (tiktoken unavailable)");
|
|
37184
|
-
tiktokenEncoder = null;
|
|
37185
|
-
}
|
|
37186
|
-
return tiktokenEncoder;
|
|
37187
|
-
}
|
|
37188
36741
|
|
|
37189
36742
|
class TokenCounter {
|
|
37190
36743
|
cache = new Map;
|
|
37191
36744
|
maxCacheEntries = 1e4;
|
|
37192
|
-
constructor(_model) {
|
|
37193
|
-
loadTiktoken();
|
|
37194
|
-
}
|
|
36745
|
+
constructor(_model) {}
|
|
37195
36746
|
count(text) {
|
|
37196
36747
|
if (!text)
|
|
37197
36748
|
return 0;
|
|
37198
36749
|
const cached = this.cache.get(text);
|
|
37199
36750
|
if (cached !== undefined)
|
|
37200
36751
|
return cached;
|
|
37201
|
-
|
|
37202
|
-
const encoder = loadTiktoken();
|
|
37203
|
-
if (encoder) {
|
|
37204
|
-
tokens = encoder.encode(text).length;
|
|
37205
|
-
} else {
|
|
37206
|
-
tokens = Math.ceil(text.length / CHARS_PER_TOKEN);
|
|
37207
|
-
}
|
|
36752
|
+
const tokens = Math.ceil(text.length / CHARS_PER_TOKEN);
|
|
37208
36753
|
if (text.length < 1e4) {
|
|
37209
36754
|
this.cache.set(text, tokens);
|
|
37210
36755
|
if (this.cache.size > this.maxCacheEntries) {
|
|
@@ -38163,7 +37708,7 @@ function isErrorResult(result) {
|
|
|
38163
37708
|
// packages/core/src/tools/connector.ts
|
|
38164
37709
|
init_errors();
|
|
38165
37710
|
import { homedir as homedir2 } from "os";
|
|
38166
|
-
import { join as join3, delimiter } from "path";
|
|
37711
|
+
import { join as join3, delimiter, dirname as dirname2 } from "path";
|
|
38167
37712
|
import { readdirSync, statSync, existsSync as existsSync2, mkdirSync, writeFileSync, readFileSync as readFileSync2 } from "fs";
|
|
38168
37713
|
function resolveTimeout(resolve) {
|
|
38169
37714
|
resolve({ exitCode: 1 });
|
|
@@ -38210,7 +37755,7 @@ class ConnectorBridge {
|
|
|
38210
37755
|
static saveDiskCache() {
|
|
38211
37756
|
try {
|
|
38212
37757
|
const cachePath = ConnectorBridge.getCachePath();
|
|
38213
|
-
const cacheDir =
|
|
37758
|
+
const cacheDir = dirname2(cachePath);
|
|
38214
37759
|
if (!existsSync2(cacheDir)) {
|
|
38215
37760
|
mkdirSync(cacheDir, { recursive: true });
|
|
38216
37761
|
}
|
|
@@ -38261,6 +37806,7 @@ class ConnectorBridge {
|
|
|
38261
37806
|
return Array.from(connectorNames);
|
|
38262
37807
|
}
|
|
38263
37808
|
fastDiscover(connectorNames) {
|
|
37809
|
+
this.connectors.clear();
|
|
38264
37810
|
if (ConnectorBridge.cache.size > 0) {
|
|
38265
37811
|
const connectors2 = [];
|
|
38266
37812
|
const allowList2 = connectorNames && connectorNames.length > 0 ? new Set(connectorNames) : null;
|
|
@@ -38321,13 +37867,15 @@ class ConnectorBridge {
|
|
|
38321
37867
|
ConnectorBridge.saveDiskCache();
|
|
38322
37868
|
}
|
|
38323
37869
|
const discovered = [];
|
|
37870
|
+
const nextConnectors = new Map;
|
|
38324
37871
|
for (const name of names) {
|
|
38325
37872
|
const connector = ConnectorBridge.cache.get(name);
|
|
38326
37873
|
if (connector) {
|
|
38327
37874
|
discovered.push(connector);
|
|
38328
|
-
|
|
37875
|
+
nextConnectors.set(connector.name, connector);
|
|
38329
37876
|
}
|
|
38330
37877
|
}
|
|
37878
|
+
this.connectors = nextConnectors;
|
|
38331
37879
|
return discovered;
|
|
38332
37880
|
}
|
|
38333
37881
|
createMinimalConnector(name, cli) {
|
|
@@ -38906,7 +38454,7 @@ ${stderr || stdout}`.trim(), {
|
|
|
38906
38454
|
}
|
|
38907
38455
|
|
|
38908
38456
|
// packages/core/src/tools/filesystem.ts
|
|
38909
|
-
import { join as join4, resolve as resolve3, dirname as
|
|
38457
|
+
import { join as join4, resolve as resolve3, dirname as dirname3, sep } from "path";
|
|
38910
38458
|
init_errors();
|
|
38911
38459
|
var {Glob } = globalThis.Bun;
|
|
38912
38460
|
|
|
@@ -39211,7 +38759,7 @@ class FilesystemTools {
|
|
|
39211
38759
|
retryable: false
|
|
39212
38760
|
});
|
|
39213
38761
|
}
|
|
39214
|
-
const dir =
|
|
38762
|
+
const dir = dirname3(validated.resolved);
|
|
39215
38763
|
await Bun.$`mkdir -p ${dir}`.quiet();
|
|
39216
38764
|
await Bun.write(validated.resolved, content);
|
|
39217
38765
|
return `Successfully wrote ${content.length} characters to ${validated.resolved}`;
|
|
@@ -40795,7 +40343,7 @@ Respond with ALLOW or DENY on the first line, followed by a short reason.`,
|
|
|
40795
40343
|
|
|
40796
40344
|
// packages/core/src/skills/loader.ts
|
|
40797
40345
|
init_src();
|
|
40798
|
-
import { join as join8, basename, dirname as
|
|
40346
|
+
import { join as join8, basename, dirname as dirname4 } from "path";
|
|
40799
40347
|
import { homedir as homedir5 } from "os";
|
|
40800
40348
|
var {Glob: Glob2 } = globalThis.Bun;
|
|
40801
40349
|
|
|
@@ -40846,7 +40394,7 @@ class SkillLoader {
|
|
|
40846
40394
|
try {
|
|
40847
40395
|
const content = await Bun.file(filePath).text();
|
|
40848
40396
|
const { frontmatter, content: markdownContent } = parseFrontmatter(content);
|
|
40849
|
-
const dirName = basename(
|
|
40397
|
+
const dirName = basename(dirname4(filePath));
|
|
40850
40398
|
const name = frontmatter.name || dirName;
|
|
40851
40399
|
let description = frontmatter.description || "";
|
|
40852
40400
|
if (!description && markdownContent) {
|
|
@@ -40933,7 +40481,7 @@ class SkillLoader {
|
|
|
40933
40481
|
|
|
40934
40482
|
// packages/core/src/skills/executor.ts
|
|
40935
40483
|
init_src();
|
|
40936
|
-
import { dirname as
|
|
40484
|
+
import { dirname as dirname5 } from "path";
|
|
40937
40485
|
|
|
40938
40486
|
class SkillExecutor {
|
|
40939
40487
|
constructor() {}
|
|
@@ -40954,7 +40502,7 @@ ARGUMENTS: ${args.join(" ")}`;
|
|
|
40954
40502
|
if (matches.length === 0) {
|
|
40955
40503
|
return content;
|
|
40956
40504
|
}
|
|
40957
|
-
const skillDir =
|
|
40505
|
+
const skillDir = dirname5(skillFilePath);
|
|
40958
40506
|
let result = content;
|
|
40959
40507
|
for (const match of matches) {
|
|
40960
40508
|
const fullMatch = match[0];
|
|
@@ -42227,14 +41775,24 @@ function splitArgs(input) {
|
|
|
42227
41775
|
const args = [];
|
|
42228
41776
|
let current = "";
|
|
42229
41777
|
let quote = null;
|
|
41778
|
+
let escaped = false;
|
|
42230
41779
|
for (let i = 0;i < input.length; i += 1) {
|
|
42231
41780
|
const char = input[i];
|
|
42232
41781
|
if (quote) {
|
|
41782
|
+
if (escaped) {
|
|
41783
|
+
current += char;
|
|
41784
|
+
escaped = false;
|
|
41785
|
+
continue;
|
|
41786
|
+
}
|
|
41787
|
+
if (char === "\\") {
|
|
41788
|
+
escaped = true;
|
|
41789
|
+
continue;
|
|
41790
|
+
}
|
|
42233
41791
|
if (char === quote) {
|
|
42234
41792
|
quote = null;
|
|
42235
|
-
|
|
42236
|
-
current += char;
|
|
41793
|
+
continue;
|
|
42237
41794
|
}
|
|
41795
|
+
current += char;
|
|
42238
41796
|
continue;
|
|
42239
41797
|
}
|
|
42240
41798
|
if (char === '"' || char === "'") {
|
|
@@ -42254,6 +41812,9 @@ function splitArgs(input) {
|
|
|
42254
41812
|
args.push(current);
|
|
42255
41813
|
return args;
|
|
42256
41814
|
}
|
|
41815
|
+
function singleLine(value) {
|
|
41816
|
+
return value.replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").trim();
|
|
41817
|
+
}
|
|
42257
41818
|
|
|
42258
41819
|
class BuiltinCommands {
|
|
42259
41820
|
tokenUsage = {
|
|
@@ -42976,7 +42537,8 @@ Suggestions:
|
|
|
42976
42537
|
content: "",
|
|
42977
42538
|
handler: async (args, context) => {
|
|
42978
42539
|
const usage = this.tokenUsage;
|
|
42979
|
-
const
|
|
42540
|
+
const rawPercent = usage.maxContextTokens > 0 ? Math.round(usage.totalTokens / usage.maxContextTokens * 100) : 0;
|
|
42541
|
+
const usedPercent = Math.max(0, Math.min(100, rawPercent));
|
|
42980
42542
|
let message = `
|
|
42981
42543
|
**Token Usage**
|
|
42982
42544
|
|
|
@@ -42988,8 +42550,8 @@ Suggestions:
|
|
|
42988
42550
|
message += `Total: ${usage.totalTokens.toLocaleString()} / ${usage.maxContextTokens.toLocaleString()} (${usedPercent}%)
|
|
42989
42551
|
`;
|
|
42990
42552
|
const barLength = 30;
|
|
42991
|
-
const filledLength = Math.round(usedPercent / 100 * barLength);
|
|
42992
|
-
const bar = "\u2588".repeat(filledLength) + "\u2591".repeat(barLength - filledLength);
|
|
42553
|
+
const filledLength = Math.max(0, Math.min(barLength, Math.round(usedPercent / 100 * barLength)));
|
|
42554
|
+
const bar = "\u2588".repeat(filledLength) + "\u2591".repeat(Math.max(0, barLength - filledLength));
|
|
42993
42555
|
message += `
|
|
42994
42556
|
[${bar}] ${usedPercent}%
|
|
42995
42557
|
`;
|
|
@@ -43039,7 +42601,8 @@ Context summarization is not available.
|
|
|
43039
42601
|
return { handled: true };
|
|
43040
42602
|
}
|
|
43041
42603
|
const { config, state } = info;
|
|
43042
|
-
const
|
|
42604
|
+
const rawPercent = config.maxContextTokens > 0 ? Math.round(state.totalTokens / config.maxContextTokens * 100) : 0;
|
|
42605
|
+
const usedPercent = Math.max(0, Math.min(100, rawPercent));
|
|
43043
42606
|
let message = `
|
|
43044
42607
|
**Context Status**
|
|
43045
42608
|
|
|
@@ -43063,8 +42626,8 @@ Context summarization is not available.
|
|
|
43063
42626
|
}
|
|
43064
42627
|
}
|
|
43065
42628
|
const barLength = 30;
|
|
43066
|
-
const filledLength = Math.round(usedPercent / 100 * barLength);
|
|
43067
|
-
const bar = "\u2588".repeat(filledLength) + "\u2591".repeat(barLength - filledLength);
|
|
42629
|
+
const filledLength = Math.max(0, Math.min(barLength, Math.round(usedPercent / 100 * barLength)));
|
|
42630
|
+
const bar = "\u2588".repeat(filledLength) + "\u2591".repeat(Math.max(0, barLength - filledLength));
|
|
43068
42631
|
message += `
|
|
43069
42632
|
[${bar}] ${usedPercent}%
|
|
43070
42633
|
`;
|
|
@@ -43088,12 +42651,12 @@ No context entries for project "${project.name}".
|
|
|
43088
42651
|
return { handled: true };
|
|
43089
42652
|
}
|
|
43090
42653
|
let output = `
|
|
43091
|
-
**Context Entries (${project.name})**
|
|
42654
|
+
**Context Entries (${singleLine(project.name)})**
|
|
43092
42655
|
|
|
43093
42656
|
`;
|
|
43094
42657
|
for (const entry of project.context) {
|
|
43095
|
-
const label = entry.label ? ` (${entry.label})` : "";
|
|
43096
|
-
output += `- ${entry.id} [${entry.type}] ${entry.value}${label}
|
|
42658
|
+
const label = entry.label ? ` (${singleLine(entry.label)})` : "";
|
|
42659
|
+
output += `- ${entry.id} [${entry.type}] ${singleLine(entry.value)}${label}
|
|
43097
42660
|
`;
|
|
43098
42661
|
}
|
|
43099
42662
|
context.emit("text", output);
|
|
@@ -43240,7 +42803,7 @@ No projects found. Use /projects new <name>.
|
|
|
43240
42803
|
`;
|
|
43241
42804
|
for (const project of projects) {
|
|
43242
42805
|
const marker = project.id === activeId ? "*" : " ";
|
|
43243
|
-
output += `${marker} ${project.name} (${project.id})
|
|
42806
|
+
output += `${marker} ${singleLine(project.name)} (${project.id})
|
|
43244
42807
|
`;
|
|
43245
42808
|
}
|
|
43246
42809
|
context.emit("text", output);
|
|
@@ -43302,13 +42865,13 @@ No projects found. Use /projects new <name>.
|
|
|
43302
42865
|
return { handled: true };
|
|
43303
42866
|
}
|
|
43304
42867
|
let output = `
|
|
43305
|
-
**Project: ${project.name}**
|
|
42868
|
+
**Project: ${singleLine(project.name)}**
|
|
43306
42869
|
|
|
43307
42870
|
`;
|
|
43308
42871
|
output += `ID: ${project.id}
|
|
43309
42872
|
`;
|
|
43310
42873
|
if (project.description) {
|
|
43311
|
-
output += `Description: ${project.description}
|
|
42874
|
+
output += `Description: ${singleLine(project.description)}
|
|
43312
42875
|
`;
|
|
43313
42876
|
}
|
|
43314
42877
|
output += `Context entries: ${project.context.length}
|
|
@@ -43434,11 +42997,11 @@ No plans for project "${project.name}".
|
|
|
43434
42997
|
return { handled: true };
|
|
43435
42998
|
}
|
|
43436
42999
|
let output = `
|
|
43437
|
-
**Plans (${project.name})**
|
|
43000
|
+
**Plans (${singleLine(project.name)})**
|
|
43438
43001
|
|
|
43439
43002
|
`;
|
|
43440
43003
|
for (const plan of project.plans) {
|
|
43441
|
-
output += `- ${plan.id} ${plan.title} (${plan.steps.length} steps)
|
|
43004
|
+
output += `- ${plan.id} ${singleLine(plan.title)} (${plan.steps.length} steps)
|
|
43442
43005
|
`;
|
|
43443
43006
|
}
|
|
43444
43007
|
context.emit("text", output);
|
|
@@ -43473,6 +43036,10 @@ No plans for project "${project.name}".
|
|
|
43473
43036
|
context.emit("done");
|
|
43474
43037
|
return { handled: true };
|
|
43475
43038
|
}
|
|
43039
|
+
context.emit("text", `Failed to create plan "${plan.title}".
|
|
43040
|
+
`);
|
|
43041
|
+
context.emit("done");
|
|
43042
|
+
return { handled: true };
|
|
43476
43043
|
}
|
|
43477
43044
|
if (sub === "show") {
|
|
43478
43045
|
const id = parts[1];
|
|
@@ -43490,7 +43057,7 @@ No plans for project "${project.name}".
|
|
|
43490
43057
|
return { handled: true };
|
|
43491
43058
|
}
|
|
43492
43059
|
let output = `
|
|
43493
|
-
**Plan: ${plan.title}**
|
|
43060
|
+
**Plan: ${singleLine(plan.title)}**
|
|
43494
43061
|
|
|
43495
43062
|
`;
|
|
43496
43063
|
output += `ID: ${plan.id}
|
|
@@ -43500,7 +43067,7 @@ No plans for project "${project.name}".
|
|
|
43500
43067
|
`;
|
|
43501
43068
|
} else {
|
|
43502
43069
|
for (const step of plan.steps) {
|
|
43503
|
-
output += `- ${step.id} [${step.status}] ${step.text}
|
|
43070
|
+
output += `- ${step.id} [${step.status}] ${singleLine(step.text)}
|
|
43504
43071
|
`;
|
|
43505
43072
|
}
|
|
43506
43073
|
}
|
|
@@ -43543,6 +43110,10 @@ No plans for project "${project.name}".
|
|
|
43543
43110
|
context.emit("done");
|
|
43544
43111
|
return { handled: true };
|
|
43545
43112
|
}
|
|
43113
|
+
context.emit("text", `Failed to add step to plan ${planId}.
|
|
43114
|
+
`);
|
|
43115
|
+
context.emit("done");
|
|
43116
|
+
return { handled: true };
|
|
43546
43117
|
}
|
|
43547
43118
|
if (sub === "set") {
|
|
43548
43119
|
const planId = parts[1];
|
|
@@ -43591,6 +43162,10 @@ No plans for project "${project.name}".
|
|
|
43591
43162
|
context.emit("done");
|
|
43592
43163
|
return { handled: true };
|
|
43593
43164
|
}
|
|
43165
|
+
context.emit("text", `Failed to update step ${stepId}.
|
|
43166
|
+
`);
|
|
43167
|
+
context.emit("done");
|
|
43168
|
+
return { handled: true };
|
|
43594
43169
|
}
|
|
43595
43170
|
if (sub === "remove") {
|
|
43596
43171
|
const planId = parts[1];
|
|
@@ -43627,6 +43202,10 @@ No plans for project "${project.name}".
|
|
|
43627
43202
|
context.emit("done");
|
|
43628
43203
|
return { handled: true };
|
|
43629
43204
|
}
|
|
43205
|
+
context.emit("text", `Failed to remove step ${stepId} from plan ${planId}.
|
|
43206
|
+
`);
|
|
43207
|
+
context.emit("done");
|
|
43208
|
+
return { handled: true };
|
|
43630
43209
|
}
|
|
43631
43210
|
if (sub === "delete" || sub === "rm") {
|
|
43632
43211
|
const planId = parts[1];
|
|
@@ -43655,6 +43234,10 @@ No plans for project "${project.name}".
|
|
|
43655
43234
|
context.emit("done");
|
|
43656
43235
|
return { handled: true };
|
|
43657
43236
|
}
|
|
43237
|
+
context.emit("text", `Failed to delete plan ${planId}.
|
|
43238
|
+
`);
|
|
43239
|
+
context.emit("done");
|
|
43240
|
+
return { handled: true };
|
|
43658
43241
|
}
|
|
43659
43242
|
context.emit("text", `Unknown /plans command. Use /plans help.
|
|
43660
43243
|
`);
|
|
@@ -43758,7 +43341,7 @@ Energy restored.
|
|
|
43758
43341
|
message += `No skills loaded.
|
|
43759
43342
|
`;
|
|
43760
43343
|
message += `
|
|
43761
|
-
Add skills to ~/.assistants/
|
|
43344
|
+
Add skills to ~/.assistants/shared/skills/ or .assistants/skills/
|
|
43762
43345
|
`;
|
|
43763
43346
|
} else {
|
|
43764
43347
|
for (const skill of context.skills) {
|
|
@@ -43785,7 +43368,8 @@ ${context.skills.length} skill(s) available.
|
|
|
43785
43368
|
content: "",
|
|
43786
43369
|
handler: async (args, context) => {
|
|
43787
43370
|
const usage = this.tokenUsage;
|
|
43788
|
-
const
|
|
43371
|
+
const rawPercent = usage.maxContextTokens > 0 ? Math.round(usage.totalTokens / usage.maxContextTokens * 100) : 0;
|
|
43372
|
+
const usedPercent = Math.max(0, Math.min(100, rawPercent));
|
|
43789
43373
|
let message = `
|
|
43790
43374
|
**Session Status**
|
|
43791
43375
|
|
|
@@ -43849,14 +43433,15 @@ ${context.skills.length} skill(s) available.
|
|
|
43849
43433
|
`;
|
|
43850
43434
|
}
|
|
43851
43435
|
const barLength = 30;
|
|
43852
|
-
const filledLength = Math.round(usedPercent / 100 * barLength);
|
|
43853
|
-
const bar = "\u2588".repeat(filledLength) + "\u2591".repeat(barLength - filledLength);
|
|
43436
|
+
const filledLength = Math.max(0, Math.min(barLength, Math.round(usedPercent / 100 * barLength)));
|
|
43437
|
+
const bar = "\u2588".repeat(filledLength) + "\u2591".repeat(Math.max(0, barLength - filledLength));
|
|
43854
43438
|
message += `
|
|
43855
43439
|
[${bar}] ${usedPercent}%
|
|
43856
43440
|
`;
|
|
43857
43441
|
const contextInfo = context.getContextInfo?.();
|
|
43858
43442
|
if (contextInfo) {
|
|
43859
|
-
const
|
|
43443
|
+
const contextRawPercent = contextInfo.config.maxContextTokens > 0 ? Math.round(contextInfo.state.totalTokens / contextInfo.config.maxContextTokens * 100) : 0;
|
|
43444
|
+
const contextUsedPercent = Math.max(0, Math.min(100, contextRawPercent));
|
|
43860
43445
|
message += `
|
|
43861
43446
|
**Context Summary:**
|
|
43862
43447
|
`;
|
|
@@ -44085,6 +43670,7 @@ Keep it concise but comprehensive.`
|
|
|
44085
43670
|
description: "Schedule a command (ISO time or cron)",
|
|
44086
43671
|
builtin: true,
|
|
44087
43672
|
selfHandled: true,
|
|
43673
|
+
content: "",
|
|
44088
43674
|
handler: async (args, context) => {
|
|
44089
43675
|
const parts = splitArgs(args);
|
|
44090
43676
|
if (parts.length < 2) {
|
|
@@ -44107,6 +43693,13 @@ Keep it concise but comprehensive.`
|
|
|
44107
43693
|
} else {
|
|
44108
43694
|
at = parts[0];
|
|
44109
43695
|
}
|
|
43696
|
+
if (kind === "cron" && !cron) {
|
|
43697
|
+
context.emit("text", `Usage:
|
|
43698
|
+
/schedule cron "<expr>" <command>
|
|
43699
|
+
`);
|
|
43700
|
+
context.emit("done");
|
|
43701
|
+
return { handled: true };
|
|
43702
|
+
}
|
|
44110
43703
|
const command = parts.slice(commandStart).join(" ").trim();
|
|
44111
43704
|
if (!command) {
|
|
44112
43705
|
context.emit("text", `Error: command is required.
|
|
@@ -44131,6 +43724,12 @@ Keep it concise but comprehensive.`
|
|
|
44131
43724
|
schedule.nextRunAt = computeNextRun(schedule, now2);
|
|
44132
43725
|
if (!schedule.nextRunAt) {
|
|
44133
43726
|
context.emit("text", `Error: unable to compute next run time.
|
|
43727
|
+
`);
|
|
43728
|
+
context.emit("done");
|
|
43729
|
+
return { handled: true };
|
|
43730
|
+
}
|
|
43731
|
+
if (schedule.nextRunAt <= now2) {
|
|
43732
|
+
context.emit("text", `Error: scheduled time must be in the future.
|
|
44134
43733
|
`);
|
|
44135
43734
|
context.emit("done");
|
|
44136
43735
|
return { handled: true };
|
|
@@ -44151,6 +43750,7 @@ Keep it concise but comprehensive.`
|
|
|
44151
43750
|
description: "List scheduled commands",
|
|
44152
43751
|
builtin: true,
|
|
44153
43752
|
selfHandled: true,
|
|
43753
|
+
content: "",
|
|
44154
43754
|
handler: async (_args, context) => {
|
|
44155
43755
|
const schedules = await listSchedules(context.cwd);
|
|
44156
43756
|
if (schedules.length === 0) {
|
|
@@ -44159,6 +43759,7 @@ Keep it concise but comprehensive.`
|
|
|
44159
43759
|
context.emit("done");
|
|
44160
43760
|
return { handled: true };
|
|
44161
43761
|
}
|
|
43762
|
+
const escapeCell = (value) => value.replace(/\|/g, "\\|").replace(/\s+/g, " ").trim();
|
|
44162
43763
|
let output = `
|
|
44163
43764
|
| ID | Status | Next Run | Command |
|
|
44164
43765
|
`;
|
|
@@ -44166,7 +43767,7 @@ Keep it concise but comprehensive.`
|
|
|
44166
43767
|
`;
|
|
44167
43768
|
for (const schedule of schedules.sort((a, b) => (a.nextRunAt || 0) - (b.nextRunAt || 0))) {
|
|
44168
43769
|
const next = schedule.nextRunAt ? new Date(schedule.nextRunAt).toISOString() : "n/a";
|
|
44169
|
-
output += `| ${schedule.id} | ${schedule.status} | ${next} | ${schedule.command} |
|
|
43770
|
+
output += `| ${schedule.id} | ${schedule.status} | ${next} | ${escapeCell(schedule.command)} |
|
|
44170
43771
|
`;
|
|
44171
43772
|
}
|
|
44172
43773
|
context.emit("text", output);
|
|
@@ -44181,6 +43782,7 @@ Keep it concise but comprehensive.`
|
|
|
44181
43782
|
description: "Delete a scheduled command",
|
|
44182
43783
|
builtin: true,
|
|
44183
43784
|
selfHandled: true,
|
|
43785
|
+
content: "",
|
|
44184
43786
|
handler: async (args, context) => {
|
|
44185
43787
|
const id = args.trim();
|
|
44186
43788
|
if (!id) {
|
|
@@ -44204,6 +43806,7 @@ Keep it concise but comprehensive.`
|
|
|
44204
43806
|
description: "Pause a scheduled command",
|
|
44205
43807
|
builtin: true,
|
|
44206
43808
|
selfHandled: true,
|
|
43809
|
+
content: "",
|
|
44207
43810
|
handler: async (args, context) => {
|
|
44208
43811
|
const id = args.trim();
|
|
44209
43812
|
if (!id) {
|
|
@@ -44242,6 +43845,7 @@ ${lines.join(`
|
|
|
44242
43845
|
description: "Resume a scheduled command",
|
|
44243
43846
|
builtin: true,
|
|
44244
43847
|
selfHandled: true,
|
|
43848
|
+
content: "",
|
|
44245
43849
|
handler: async (args, context) => {
|
|
44246
43850
|
const id = args.trim();
|
|
44247
43851
|
if (!id) {
|
|
@@ -44261,14 +43865,32 @@ ${lines.join(`
|
|
|
44261
43865
|
context.emit("done");
|
|
44262
43866
|
return { handled: true };
|
|
44263
43867
|
}
|
|
44264
|
-
|
|
44265
|
-
|
|
44266
|
-
|
|
44267
|
-
|
|
44268
|
-
|
|
44269
|
-
|
|
44270
|
-
|
|
44271
|
-
|
|
43868
|
+
let computedNext;
|
|
43869
|
+
const updated = await updateSchedule(context.cwd, id, (schedule) => {
|
|
43870
|
+
computedNext = computeNextRun(schedule, Date.now());
|
|
43871
|
+
if (!computedNext) {
|
|
43872
|
+
return schedule;
|
|
43873
|
+
}
|
|
43874
|
+
return {
|
|
43875
|
+
...schedule,
|
|
43876
|
+
status: "active",
|
|
43877
|
+
updatedAt: Date.now(),
|
|
43878
|
+
nextRunAt: computedNext
|
|
43879
|
+
};
|
|
43880
|
+
});
|
|
43881
|
+
if (!updated) {
|
|
43882
|
+
context.emit("text", `Schedule ${id} not found.
|
|
43883
|
+
`);
|
|
43884
|
+
context.emit("done");
|
|
43885
|
+
return { handled: true };
|
|
43886
|
+
}
|
|
43887
|
+
if (!computedNext) {
|
|
43888
|
+
context.emit("text", `Failed to compute next run for schedule ${id}.
|
|
43889
|
+
`);
|
|
43890
|
+
context.emit("done");
|
|
43891
|
+
return { handled: true };
|
|
43892
|
+
}
|
|
43893
|
+
context.emit("text", `Resumed schedule ${id}.
|
|
44272
43894
|
`);
|
|
44273
43895
|
context.emit("done");
|
|
44274
43896
|
return { handled: true };
|
|
@@ -44301,13 +43923,15 @@ Connector "${connectorName}" not found.
|
|
|
44301
43923
|
context.emit("done");
|
|
44302
43924
|
return { handled: true };
|
|
44303
43925
|
}
|
|
43926
|
+
const cli = connector.cli || `connect-${connector.name}`;
|
|
43927
|
+
const description = connector.description?.trim() || "No description provided.";
|
|
44304
43928
|
let message2 = `
|
|
44305
43929
|
**${connector.name}** Connector
|
|
44306
43930
|
|
|
44307
43931
|
`;
|
|
44308
|
-
message2 += `CLI: \`${
|
|
43932
|
+
message2 += `CLI: \`${cli}\`
|
|
44309
43933
|
`;
|
|
44310
|
-
message2 += `Description: ${
|
|
43934
|
+
message2 += `Description: ${description}
|
|
44311
43935
|
|
|
44312
43936
|
`;
|
|
44313
43937
|
try {
|
|
@@ -44341,9 +43965,15 @@ Connector "${connectorName}" not found.
|
|
|
44341
43965
|
message2 += `
|
|
44342
43966
|
**Available Commands:**
|
|
44343
43967
|
`;
|
|
44344
|
-
|
|
44345
|
-
|
|
43968
|
+
const commands = connector.commands || [];
|
|
43969
|
+
if (commands.length === 0) {
|
|
43970
|
+
message2 += ` (no commands discovered)
|
|
44346
43971
|
`;
|
|
43972
|
+
} else {
|
|
43973
|
+
for (const cmd of commands) {
|
|
43974
|
+
message2 += ` ${cmd.name} - ${cmd.description}
|
|
43975
|
+
`;
|
|
43976
|
+
}
|
|
44347
43977
|
}
|
|
44348
43978
|
message2 += `
|
|
44349
43979
|
**Usage:**
|
|
@@ -44370,21 +44000,18 @@ Connector "${connectorName}" not found.
|
|
|
44370
44000
|
message += " `bun add -g connect-<name>`\n\n";
|
|
44371
44001
|
message += "Then run `/connectors` again to verify it is detected.\n";
|
|
44372
44002
|
} else {
|
|
44373
|
-
const
|
|
44374
|
-
for (const connector of context.connectors) {
|
|
44003
|
+
const checkAuth = async (connector) => {
|
|
44375
44004
|
let status = "\u25CB";
|
|
44376
44005
|
let timeoutId = null;
|
|
44377
44006
|
try {
|
|
44007
|
+
const cli = connector.cli || `connect-${connector.name}`;
|
|
44378
44008
|
const timeoutPromise = new Promise((resolve5) => {
|
|
44379
44009
|
timeoutId = setTimeout(resolveAuthTimeout, 1000, resolve5);
|
|
44380
44010
|
});
|
|
44381
44011
|
const result = await Promise.race([
|
|
44382
|
-
Bun.$`${
|
|
44012
|
+
Bun.$`${cli} auth status --format json`.quiet().nothrow(),
|
|
44383
44013
|
timeoutPromise
|
|
44384
44014
|
]);
|
|
44385
|
-
if (timeoutId) {
|
|
44386
|
-
clearTimeout(timeoutId);
|
|
44387
|
-
}
|
|
44388
44015
|
if (result.exitCode === 0) {
|
|
44389
44016
|
try {
|
|
44390
44017
|
const parsed = JSON.parse(result.stdout.toString());
|
|
@@ -44400,8 +44027,10 @@ Connector "${connectorName}" not found.
|
|
|
44400
44027
|
clearTimeout(timeoutId);
|
|
44401
44028
|
}
|
|
44402
44029
|
}
|
|
44403
|
-
|
|
44404
|
-
}
|
|
44030
|
+
return status;
|
|
44031
|
+
};
|
|
44032
|
+
const statuses = await Promise.all(context.connectors.map((connector) => checkAuth(connector)));
|
|
44033
|
+
const escapeCell = (value) => value.replace(/\|/g, "\\|").replace(/\s+/g, " ").trim();
|
|
44405
44034
|
message += `| Status | Connector | Commands |
|
|
44406
44035
|
`;
|
|
44407
44036
|
message += `|--------|-----------|----------|
|
|
@@ -44409,8 +44038,8 @@ Connector "${connectorName}" not found.
|
|
|
44409
44038
|
for (let i = 0;i < context.connectors.length; i++) {
|
|
44410
44039
|
const connector = context.connectors[i];
|
|
44411
44040
|
const status = statuses[i];
|
|
44412
|
-
const cmdCount = connector.commands
|
|
44413
|
-
message += `| ${status} | ${connector.name
|
|
44041
|
+
const cmdCount = connector.commands?.length ?? 0;
|
|
44042
|
+
message += `| ${status} | ${escapeCell(connector.name)} | ${cmdCount} commands |
|
|
44414
44043
|
`;
|
|
44415
44044
|
}
|
|
44416
44045
|
message += `
|
|
@@ -44477,7 +44106,8 @@ No security events recorded.
|
|
|
44477
44106
|
message += `| --- | --- | --- | --- |
|
|
44478
44107
|
`;
|
|
44479
44108
|
for (const event of events) {
|
|
44480
|
-
const
|
|
44109
|
+
const rawDetail = event.details?.reason || event.details?.path || event.details?.command || event.details?.tool || "n/a";
|
|
44110
|
+
const detail = String(rawDetail).replace(/\|/g, "\\|").replace(/\s+/g, " ").trim();
|
|
44481
44111
|
message += `| ${event.timestamp} | ${event.severity} | ${event.eventType} | ${detail} |
|
|
44482
44112
|
`;
|
|
44483
44113
|
}
|
|
@@ -44548,10 +44178,10 @@ No security events recorded.
|
|
|
44548
44178
|
`;
|
|
44549
44179
|
let issueTitle = "";
|
|
44550
44180
|
let labels = "";
|
|
44551
|
-
if (feedbackType === "bug"
|
|
44181
|
+
if (feedbackType === "bug") {
|
|
44552
44182
|
issueTitle = "[Bug] ";
|
|
44553
44183
|
labels = "bug";
|
|
44554
|
-
} else if (feedbackType === "feature"
|
|
44184
|
+
} else if (feedbackType === "feature") {
|
|
44555
44185
|
issueTitle = "[Feature Request] ";
|
|
44556
44186
|
labels = "enhancement";
|
|
44557
44187
|
} else {
|
|
@@ -44691,7 +44321,7 @@ async function createLLMClient(config) {
|
|
|
44691
44321
|
}
|
|
44692
44322
|
|
|
44693
44323
|
// packages/core/src/heartbeat/manager.ts
|
|
44694
|
-
import { dirname as
|
|
44324
|
+
import { dirname as dirname6 } from "path";
|
|
44695
44325
|
import { mkdirSync as mkdirSync5 } from "fs";
|
|
44696
44326
|
import { readFile as readFile4, writeFile as writeFile3 } from "fs/promises";
|
|
44697
44327
|
|
|
@@ -44713,7 +44343,7 @@ class HeartbeatManager {
|
|
|
44713
44343
|
errorsEncountered: 0,
|
|
44714
44344
|
uptimeSeconds: 0
|
|
44715
44345
|
};
|
|
44716
|
-
const dir =
|
|
44346
|
+
const dir = dirname6(config.persistPath);
|
|
44717
44347
|
mkdirSync5(dir, { recursive: true });
|
|
44718
44348
|
}
|
|
44719
44349
|
start(sessionId) {
|
|
@@ -44787,7 +44417,7 @@ class HeartbeatManager {
|
|
|
44787
44417
|
}
|
|
44788
44418
|
}
|
|
44789
44419
|
// packages/core/src/heartbeat/persistence.ts
|
|
44790
|
-
import { dirname as
|
|
44420
|
+
import { dirname as dirname7 } from "path";
|
|
44791
44421
|
import { mkdirSync as mkdirSync6 } from "fs";
|
|
44792
44422
|
import { readFile as readFile5, writeFile as writeFile4, unlink as unlink3 } from "fs/promises";
|
|
44793
44423
|
|
|
@@ -44795,7 +44425,7 @@ class StatePersistence {
|
|
|
44795
44425
|
path;
|
|
44796
44426
|
constructor(path2) {
|
|
44797
44427
|
this.path = path2;
|
|
44798
|
-
mkdirSync6(
|
|
44428
|
+
mkdirSync6(dirname7(path2), { recursive: true });
|
|
44799
44429
|
}
|
|
44800
44430
|
async save(state) {
|
|
44801
44431
|
try {
|
|
@@ -45014,7 +44644,7 @@ class EnergyManager {
|
|
|
45014
44644
|
}
|
|
45015
44645
|
}
|
|
45016
44646
|
// packages/core/src/energy/storage.ts
|
|
45017
|
-
import { dirname as
|
|
44647
|
+
import { dirname as dirname8 } from "path";
|
|
45018
44648
|
import { mkdirSync as mkdirSync7 } from "fs";
|
|
45019
44649
|
import { readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
|
|
45020
44650
|
|
|
@@ -45022,7 +44652,7 @@ class EnergyStorage {
|
|
|
45022
44652
|
path;
|
|
45023
44653
|
constructor(path2) {
|
|
45024
44654
|
this.path = path2;
|
|
45025
|
-
mkdirSync7(
|
|
44655
|
+
mkdirSync7(dirname8(path2), { recursive: true });
|
|
45026
44656
|
}
|
|
45027
44657
|
async save(state) {
|
|
45028
44658
|
try {
|
|
@@ -46226,7 +45856,7 @@ class AgentLoop {
|
|
|
46226
45856
|
this.currentAllowedTools = null;
|
|
46227
45857
|
this.isRunning = false;
|
|
46228
45858
|
this.setHeartbeatState("idle");
|
|
46229
|
-
this.drainScheduledQueue();
|
|
45859
|
+
await this.drainScheduledQueue();
|
|
46230
45860
|
}
|
|
46231
45861
|
}
|
|
46232
45862
|
async handleExplicitToolCommand(userMessage) {
|
|
@@ -46250,7 +45880,6 @@ class AgentLoop {
|
|
|
46250
45880
|
const toolCall = {
|
|
46251
45881
|
id: generateId(),
|
|
46252
45882
|
name: "bash",
|
|
46253
|
-
type: "tool",
|
|
46254
45883
|
input: {
|
|
46255
45884
|
command,
|
|
46256
45885
|
cwd: this.cwd,
|
|
@@ -47754,9 +47383,6 @@ class SessionRegistry {
|
|
|
47754
47383
|
// packages/core/src/index.ts
|
|
47755
47384
|
init_errors();
|
|
47756
47385
|
init_retry();
|
|
47757
|
-
init_errors();
|
|
47758
|
-
init_src();
|
|
47759
|
-
|
|
47760
47386
|
// packages/terminal/src/components/App.tsx
|
|
47761
47387
|
init_src();
|
|
47762
47388
|
|
|
@@ -47982,11 +47608,9 @@ function Input({ onSubmit, isProcessing, queueLength = 0, commands, skills = []
|
|
|
47982
47608
|
setValue("");
|
|
47983
47609
|
setSelectedIndex(0);
|
|
47984
47610
|
};
|
|
47985
|
-
let prompt = "\u276F";
|
|
47986
47611
|
let placeholder = "Type a message...";
|
|
47987
47612
|
if (isProcessing) {
|
|
47988
|
-
|
|
47989
|
-
placeholder = queueLength > 0 ? "Type to send (Enter) or queue (Tab) \xB7 Shift+Enter to interrupt..." : "Type to send (Enter) or queue (Tab) \xB7 Shift+Enter to interrupt...";
|
|
47613
|
+
placeholder = queueLength > 0 ? "Type to queue (Tab) or interrupt (Shift+Enter)..." : "Type to interrupt (Shift+Enter)...";
|
|
47990
47614
|
}
|
|
47991
47615
|
const truncateDescription = (desc, maxLen = 60) => {
|
|
47992
47616
|
if (desc.length <= maxLen)
|
|
@@ -48007,29 +47631,56 @@ function Input({ onSubmit, isProcessing, queueLength = 0, commands, skills = []
|
|
|
48007
47631
|
};
|
|
48008
47632
|
const visibleSkills = getVisibleItems(filteredSkills);
|
|
48009
47633
|
const visibleCommands = getVisibleItems(filteredCommands);
|
|
47634
|
+
const lines = value.split(`
|
|
47635
|
+
`);
|
|
47636
|
+
const lineCount = lines.length;
|
|
48010
47637
|
return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
48011
47638
|
flexDirection: "column",
|
|
48012
47639
|
marginTop: 1,
|
|
48013
47640
|
children: [
|
|
48014
47641
|
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
47642
|
+
children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
47643
|
+
dimColor: true,
|
|
47644
|
+
children: "\u2500".repeat(80)
|
|
47645
|
+
}, undefined, false, undefined, this)
|
|
47646
|
+
}, undefined, false, undefined, this),
|
|
47647
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
47648
|
+
paddingY: 0,
|
|
48015
47649
|
children: [
|
|
48016
47650
|
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
48017
47651
|
dimColor: isProcessing,
|
|
48018
|
-
|
|
48019
|
-
|
|
48020
|
-
|
|
48021
|
-
|
|
48022
|
-
|
|
48023
|
-
|
|
48024
|
-
|
|
48025
|
-
|
|
48026
|
-
|
|
48027
|
-
|
|
47652
|
+
color: isProcessing ? undefined : "cyan",
|
|
47653
|
+
children: "> "
|
|
47654
|
+
}, undefined, false, undefined, this),
|
|
47655
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
47656
|
+
flexGrow: 1,
|
|
47657
|
+
children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(build_default, {
|
|
47658
|
+
value,
|
|
47659
|
+
onChange: handleChange,
|
|
47660
|
+
onSubmit: handleSubmit,
|
|
47661
|
+
placeholder
|
|
47662
|
+
}, undefined, false, undefined, this)
|
|
48028
47663
|
}, undefined, false, undefined, this)
|
|
48029
47664
|
]
|
|
48030
47665
|
}, undefined, true, undefined, this),
|
|
47666
|
+
lineCount > 1 && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
47667
|
+
marginLeft: 2,
|
|
47668
|
+
children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
47669
|
+
dimColor: true,
|
|
47670
|
+
children: [
|
|
47671
|
+
"(",
|
|
47672
|
+
lineCount,
|
|
47673
|
+
" lines)"
|
|
47674
|
+
]
|
|
47675
|
+
}, undefined, true, undefined, this)
|
|
47676
|
+
}, undefined, false, undefined, this),
|
|
47677
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
47678
|
+
children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
47679
|
+
dimColor: true,
|
|
47680
|
+
children: "\u2500".repeat(80)
|
|
47681
|
+
}, undefined, false, undefined, this)
|
|
47682
|
+
}, undefined, false, undefined, this),
|
|
48031
47683
|
isProcessing && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
48032
|
-
marginTop: 1,
|
|
48033
47684
|
marginLeft: 2,
|
|
48034
47685
|
children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
48035
47686
|
dimColor: true,
|
|
@@ -48133,8 +47784,9 @@ function Markdown({ content, preRendered = false }) {
|
|
|
48133
47784
|
children: content
|
|
48134
47785
|
}, undefined, false, undefined, this);
|
|
48135
47786
|
}
|
|
48136
|
-
const {
|
|
48137
|
-
const
|
|
47787
|
+
const { stdout } = use_stdout_default();
|
|
47788
|
+
const columns = stdout?.columns ?? 80;
|
|
47789
|
+
const maxWidth = Math.max(20, columns - 2);
|
|
48138
47790
|
const rendered = parseMarkdown(content, { maxWidth });
|
|
48139
47791
|
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
48140
47792
|
children: rendered
|
|
@@ -48270,6 +47922,15 @@ function extractBlockSections(text, blocks) {
|
|
|
48270
47922
|
i = parsed.nextIndex;
|
|
48271
47923
|
continue;
|
|
48272
47924
|
}
|
|
47925
|
+
const cardMatch = line.match(/^(\s*):::card(.*)$/);
|
|
47926
|
+
if (cardMatch) {
|
|
47927
|
+
const indent = cardMatch[1] ?? "";
|
|
47928
|
+
const parsed = parseDelimitedBlock(lines, i, indent);
|
|
47929
|
+
const warning = parsed?.warning || "Card blocks must be inside :::grid.";
|
|
47930
|
+
output.push(createMalformedBlock(blocks, indent, "block", warning));
|
|
47931
|
+
i = parsed ? parsed.nextIndex : i + 1;
|
|
47932
|
+
continue;
|
|
47933
|
+
}
|
|
48273
47934
|
output.push(line);
|
|
48274
47935
|
i += 1;
|
|
48275
47936
|
}
|
|
@@ -48290,7 +47951,18 @@ function extractCards(body) {
|
|
|
48290
47951
|
}
|
|
48291
47952
|
const indent = match[1] ?? "";
|
|
48292
47953
|
const attrs = parseAttributes(match[2] ?? "");
|
|
48293
|
-
|
|
47954
|
+
let type = String(attrs.type || "note");
|
|
47955
|
+
const normalizedType = type.toLowerCase();
|
|
47956
|
+
if (!ALLOWED_BLOCK_TYPES.has(normalizedType)) {
|
|
47957
|
+
cards.push({
|
|
47958
|
+
type: "warning",
|
|
47959
|
+
title: "Malformed card",
|
|
47960
|
+
body: `Unknown card type "${type}". Using note.`
|
|
47961
|
+
});
|
|
47962
|
+
type = "note";
|
|
47963
|
+
} else {
|
|
47964
|
+
type = normalizedType;
|
|
47965
|
+
}
|
|
48294
47966
|
const title = attrs.title ? String(attrs.title) : undefined;
|
|
48295
47967
|
const bodyLines = [];
|
|
48296
47968
|
let closed = false;
|
|
@@ -48395,7 +48067,8 @@ function renderBlockSection(section, maxWidth) {
|
|
|
48395
48067
|
if (section.kind === "grid") {
|
|
48396
48068
|
const adjustedWidth2 = maxWidth ? Math.max(20, maxWidth - section.indent.length) : undefined;
|
|
48397
48069
|
if (section.cards.length === 0) {
|
|
48398
|
-
return renderCard({ type: "note", title: "Grid", body: section.body }, adjustedWidth2, section.indent)
|
|
48070
|
+
return renderCard({ type: "note", title: "Grid", body: section.body }, adjustedWidth2, section.indent).join(`
|
|
48071
|
+
`);
|
|
48399
48072
|
}
|
|
48400
48073
|
return renderCardGrid(section.cards, section.columns, adjustedWidth2, section.indent);
|
|
48401
48074
|
}
|
|
@@ -48422,7 +48095,7 @@ function renderCard(card, maxWidth, indent = "", forceWidth = false) {
|
|
|
48422
48095
|
}
|
|
48423
48096
|
function renderCardGrid(cards, columns, maxWidth, indent = "") {
|
|
48424
48097
|
const gap = 2;
|
|
48425
|
-
const totalWidth = maxWidth
|
|
48098
|
+
const totalWidth = maxWidth;
|
|
48426
48099
|
let effectiveColumns = columns;
|
|
48427
48100
|
if (totalWidth) {
|
|
48428
48101
|
const minCardWidth = 18;
|
|
@@ -48482,7 +48155,7 @@ function renderBox(header, lines, type, maxWidth, indent = "", forceWidth = fals
|
|
|
48482
48155
|
}
|
|
48483
48156
|
function renderBoxLines(header, lines, type, maxWidth, indent = "", forceWidth = false) {
|
|
48484
48157
|
const headerStyled = styleHeader(header, type);
|
|
48485
|
-
const maxInnerWidth = maxWidth ? Math.max(
|
|
48158
|
+
const maxInnerWidth = maxWidth ? Math.max(1, maxWidth - 4) : undefined;
|
|
48486
48159
|
const headerLine = maxInnerWidth ? truncateAnsi(headerStyled, maxInnerWidth) : headerStyled;
|
|
48487
48160
|
const wrappedLines = maxInnerWidth ? wrapAnsiLines(lines, maxInnerWidth) : lines;
|
|
48488
48161
|
const contentWidth = Math.max(stripAnsi2(headerLine).length, ...wrappedLines.map((line) => stripAnsi2(line).length), 0);
|
|
@@ -48567,8 +48240,7 @@ function renderTable(header, rows, maxWidth) {
|
|
|
48567
48240
|
widths[i] = len;
|
|
48568
48241
|
}
|
|
48569
48242
|
}
|
|
48570
|
-
const
|
|
48571
|
-
const availableCellWidth = maxWidth ? Math.max(colCount * minCellWidth, maxWidth - (colCount - 1) * 3 - 4) : undefined;
|
|
48243
|
+
const availableCellWidth = maxWidth ? Math.max(colCount, maxWidth - (colCount - 1) * 3 - 4) : undefined;
|
|
48572
48244
|
if (availableCellWidth) {
|
|
48573
48245
|
const total = widths.reduce((sum, width) => sum + width, 0);
|
|
48574
48246
|
if (total > availableCellWidth) {
|
|
@@ -48657,8 +48329,9 @@ function renderReport(body, maxWidth, indent = "") {
|
|
|
48657
48329
|
output.push(indent + source_default.bold("Progress Overview"));
|
|
48658
48330
|
const parsed = progressLines.map((line) => line.trim().replace(/^-/, "").trim()).map((line) => line.match(/^(.+?):\s*(\d{1,3})%?$/)).filter((match) => Boolean(match)).map((match) => ({ label: match[1].trim(), value: Math.max(0, Math.min(100, Number(match[2]))) }));
|
|
48659
48331
|
if (parsed.length > 0) {
|
|
48660
|
-
const
|
|
48661
|
-
const
|
|
48332
|
+
const maxLabelWidth = maxWidth ? Math.max(4, maxWidth - 14) : 24;
|
|
48333
|
+
const labelWidth = Math.min(maxLabelWidth, Math.max(...parsed.map((p) => p.label.length), 10));
|
|
48334
|
+
const barWidth = maxWidth ? Math.max(4, Math.min(30, maxWidth - labelWidth - 8)) : 24;
|
|
48662
48335
|
for (const entry of parsed) {
|
|
48663
48336
|
output.push(indent + renderProgressLine(entry.label, entry.value, labelWidth, barWidth));
|
|
48664
48337
|
}
|
|
@@ -48827,6 +48500,156 @@ function truncateAnsi(line, width) {
|
|
|
48827
48500
|
return current + suffix;
|
|
48828
48501
|
}
|
|
48829
48502
|
|
|
48503
|
+
// packages/terminal/src/components/toolDisplay.ts
|
|
48504
|
+
function truncateToolResult(toolResult, maxLines = 15, maxChars = 3000) {
|
|
48505
|
+
const toolName = toolResult.toolName || "tool";
|
|
48506
|
+
let content = String(toolResult.content || "");
|
|
48507
|
+
const formatted = formatToolResultNicely(toolName, content, toolResult.isError);
|
|
48508
|
+
if (formatted) {
|
|
48509
|
+
return formatted;
|
|
48510
|
+
}
|
|
48511
|
+
const prefix = toolResult.isError ? `Error: ` : "";
|
|
48512
|
+
content = stripAnsi3(content);
|
|
48513
|
+
content = content.replace(/\t/g, " ");
|
|
48514
|
+
const lines = content.split(`
|
|
48515
|
+
`);
|
|
48516
|
+
if (lines.length > maxLines) {
|
|
48517
|
+
content = lines.slice(0, maxLines).join(`
|
|
48518
|
+
`) + `
|
|
48519
|
+
... (${lines.length - maxLines} more lines)`;
|
|
48520
|
+
}
|
|
48521
|
+
if (content.length > maxChars) {
|
|
48522
|
+
content = content.slice(0, maxChars) + "...";
|
|
48523
|
+
}
|
|
48524
|
+
return prefix + content.trim();
|
|
48525
|
+
}
|
|
48526
|
+
function formatToolResultNicely(toolName, content, isError) {
|
|
48527
|
+
if (isError) {
|
|
48528
|
+
if (content.includes("ENOENT") || content.includes("no such file")) {
|
|
48529
|
+
return "\u26A0 File not found";
|
|
48530
|
+
}
|
|
48531
|
+
if (content.includes("EACCES") || content.includes("permission denied")) {
|
|
48532
|
+
return "\u26A0 Permission denied";
|
|
48533
|
+
}
|
|
48534
|
+
if (content.includes("ETIMEDOUT") || content.includes("timeout")) {
|
|
48535
|
+
return "\u26A0 Request timed out";
|
|
48536
|
+
}
|
|
48537
|
+
return null;
|
|
48538
|
+
}
|
|
48539
|
+
switch (toolName) {
|
|
48540
|
+
case "schedule":
|
|
48541
|
+
return formatScheduleResult(content);
|
|
48542
|
+
case "submit_feedback":
|
|
48543
|
+
return formatFeedbackResult(content);
|
|
48544
|
+
case "read":
|
|
48545
|
+
return formatReadResult(content);
|
|
48546
|
+
case "write":
|
|
48547
|
+
return formatWriteResult(content);
|
|
48548
|
+
case "glob":
|
|
48549
|
+
return formatGlobResult(content);
|
|
48550
|
+
case "grep":
|
|
48551
|
+
return formatGrepResult(content);
|
|
48552
|
+
case "bash":
|
|
48553
|
+
return formatBashResult(content);
|
|
48554
|
+
case "web_search":
|
|
48555
|
+
return formatSearchResult(content);
|
|
48556
|
+
default:
|
|
48557
|
+
return null;
|
|
48558
|
+
}
|
|
48559
|
+
}
|
|
48560
|
+
function formatScheduleResult(content) {
|
|
48561
|
+
const trimmed = content.trim().toLowerCase();
|
|
48562
|
+
if (trimmed === "no schedules found." || trimmed.includes("no schedules")) {
|
|
48563
|
+
return "\uD83D\uDCC5 No scheduled tasks";
|
|
48564
|
+
}
|
|
48565
|
+
if (trimmed.includes("created") || trimmed.includes("scheduled")) {
|
|
48566
|
+
return "\u2713 Schedule created";
|
|
48567
|
+
}
|
|
48568
|
+
if (trimmed.includes("deleted") || trimmed.includes("removed")) {
|
|
48569
|
+
return "\u2713 Schedule deleted";
|
|
48570
|
+
}
|
|
48571
|
+
if (trimmed.includes("paused")) {
|
|
48572
|
+
return "\u23F8 Schedule paused";
|
|
48573
|
+
}
|
|
48574
|
+
if (trimmed.includes("resumed")) {
|
|
48575
|
+
return "\u25B6 Schedule resumed";
|
|
48576
|
+
}
|
|
48577
|
+
if (content.includes("id:") || content.includes("command:")) {
|
|
48578
|
+
const lines = content.split(`
|
|
48579
|
+
`).filter((line) => line.trim());
|
|
48580
|
+
return `\uD83D\uDCC5 ${lines.length} scheduled task${lines.length !== 1 ? "s" : ""}`;
|
|
48581
|
+
}
|
|
48582
|
+
return null;
|
|
48583
|
+
}
|
|
48584
|
+
function formatFeedbackResult(content) {
|
|
48585
|
+
if (content.includes("submitted") || content.includes("created")) {
|
|
48586
|
+
return "\u2713 Feedback submitted";
|
|
48587
|
+
}
|
|
48588
|
+
return null;
|
|
48589
|
+
}
|
|
48590
|
+
function formatReadResult(content) {
|
|
48591
|
+
const lines = content.split(`
|
|
48592
|
+
`).length;
|
|
48593
|
+
if (lines > 20) {
|
|
48594
|
+
return `\uD83D\uDCC4 Read ${lines} lines`;
|
|
48595
|
+
}
|
|
48596
|
+
return null;
|
|
48597
|
+
}
|
|
48598
|
+
function formatWriteResult(content) {
|
|
48599
|
+
if (content.includes("written") || content.includes("saved") || content.includes("created")) {
|
|
48600
|
+
return "\u2713 File saved";
|
|
48601
|
+
}
|
|
48602
|
+
return null;
|
|
48603
|
+
}
|
|
48604
|
+
function formatGlobResult(content) {
|
|
48605
|
+
const lines = content.split(`
|
|
48606
|
+
`).filter((line) => line.trim());
|
|
48607
|
+
if (lines.length === 0) {
|
|
48608
|
+
return "\uD83D\uDD0D No files found";
|
|
48609
|
+
}
|
|
48610
|
+
if (lines.length > 10) {
|
|
48611
|
+
return `\uD83D\uDD0D Found ${lines.length} files`;
|
|
48612
|
+
}
|
|
48613
|
+
return null;
|
|
48614
|
+
}
|
|
48615
|
+
function formatGrepResult(content) {
|
|
48616
|
+
const lines = content.split(`
|
|
48617
|
+
`).filter((line) => line.trim());
|
|
48618
|
+
if (lines.length === 0) {
|
|
48619
|
+
return "\uD83D\uDD0D No matches found";
|
|
48620
|
+
}
|
|
48621
|
+
if (lines.length > 10) {
|
|
48622
|
+
return `\uD83D\uDD0D Found ${lines.length} matches`;
|
|
48623
|
+
}
|
|
48624
|
+
return null;
|
|
48625
|
+
}
|
|
48626
|
+
function formatBashResult(content) {
|
|
48627
|
+
const trimmed = content.trim();
|
|
48628
|
+
if (!trimmed) {
|
|
48629
|
+
return "\u2713 Command completed";
|
|
48630
|
+
}
|
|
48631
|
+
if (trimmed.length < 100 && !trimmed.includes(`
|
|
48632
|
+
`)) {
|
|
48633
|
+
return null;
|
|
48634
|
+
}
|
|
48635
|
+
const lines = trimmed.split(`
|
|
48636
|
+
`).length;
|
|
48637
|
+
if (lines > 20) {
|
|
48638
|
+
return `\u2713 Output: ${lines} lines`;
|
|
48639
|
+
}
|
|
48640
|
+
return null;
|
|
48641
|
+
}
|
|
48642
|
+
function formatSearchResult(content) {
|
|
48643
|
+
const resultCount = (content.match(/https?:\/\//g) || []).length;
|
|
48644
|
+
if (resultCount > 0) {
|
|
48645
|
+
return `\uD83D\uDD0D Found ${resultCount} result${resultCount !== 1 ? "s" : ""}`;
|
|
48646
|
+
}
|
|
48647
|
+
return null;
|
|
48648
|
+
}
|
|
48649
|
+
function stripAnsi3(text) {
|
|
48650
|
+
return text.replace(/\x1B\[[0-9;]*m/g, "");
|
|
48651
|
+
}
|
|
48652
|
+
|
|
48830
48653
|
// packages/terminal/src/components/messageLines.ts
|
|
48831
48654
|
function estimateToolPanelLines(toolCalls, toolResults, hasContent) {
|
|
48832
48655
|
if (!toolCalls || toolCalls.length === 0) {
|
|
@@ -48850,14 +48673,12 @@ function estimateToolPanelLines(toolCalls, toolResults, hasContent) {
|
|
|
48850
48673
|
return lines;
|
|
48851
48674
|
}
|
|
48852
48675
|
function estimateToolResultLines(result, maxLines = 4) {
|
|
48853
|
-
const content =
|
|
48676
|
+
const content = truncateToolResult(result, maxLines, 400);
|
|
48854
48677
|
if (!content)
|
|
48855
48678
|
return 1;
|
|
48856
|
-
const lines = content
|
|
48679
|
+
const lines = stripAnsi4(content).split(`
|
|
48857
48680
|
`);
|
|
48858
|
-
|
|
48859
|
-
return Math.max(1, lines.length);
|
|
48860
|
-
return maxLines + 1;
|
|
48681
|
+
return Math.max(1, lines.length);
|
|
48861
48682
|
}
|
|
48862
48683
|
function estimateMessageLines(message, maxWidth) {
|
|
48863
48684
|
if (message.role === "system") {
|
|
@@ -48872,6 +48693,11 @@ function estimateMessageLines(message, maxWidth) {
|
|
|
48872
48693
|
if (message.role === "assistant" && message.toolCalls?.length) {
|
|
48873
48694
|
lines += estimateToolPanelLines(message.toolCalls, message.toolResults, hasContent);
|
|
48874
48695
|
}
|
|
48696
|
+
if (message.role === "user" || message.role === "assistant") {
|
|
48697
|
+
if (!isContinuationChunk(message.id)) {
|
|
48698
|
+
lines += 2;
|
|
48699
|
+
}
|
|
48700
|
+
}
|
|
48875
48701
|
return lines;
|
|
48876
48702
|
}
|
|
48877
48703
|
function countWrappedLines(lines, maxWidth) {
|
|
@@ -48880,15 +48706,48 @@ function countWrappedLines(lines, maxWidth) {
|
|
|
48880
48706
|
}
|
|
48881
48707
|
let total = 0;
|
|
48882
48708
|
for (const line of lines) {
|
|
48883
|
-
const visible =
|
|
48709
|
+
const visible = stripAnsi4(line).length;
|
|
48884
48710
|
const wrapped = Math.max(1, Math.ceil(visible / maxWidth));
|
|
48885
48711
|
total += wrapped;
|
|
48886
48712
|
}
|
|
48887
48713
|
return total;
|
|
48888
48714
|
}
|
|
48889
|
-
function
|
|
48715
|
+
function stripAnsi4(text) {
|
|
48890
48716
|
return text.replace(/\x1B\[[0-9;]*m/g, "");
|
|
48891
48717
|
}
|
|
48718
|
+
function estimateActivityEntryLines(entry, wrapWidth, renderWidth) {
|
|
48719
|
+
if (entry.type === "text") {
|
|
48720
|
+
const content = entry.content ?? "";
|
|
48721
|
+
if (!content.trim())
|
|
48722
|
+
return 0;
|
|
48723
|
+
const rendered = renderMarkdown(content, { maxWidth: renderWidth });
|
|
48724
|
+
const lines = stripAnsi4(rendered).split(`
|
|
48725
|
+
`);
|
|
48726
|
+
const wrapped = countWrappedLines(lines, wrapWidth);
|
|
48727
|
+
return Math.max(1, wrapped) + 2;
|
|
48728
|
+
}
|
|
48729
|
+
if (entry.type === "tool_call") {
|
|
48730
|
+
return 4;
|
|
48731
|
+
}
|
|
48732
|
+
if (entry.type === "tool_result") {
|
|
48733
|
+
const content = entry.toolResult ? truncateToolResult(entry.toolResult) : "";
|
|
48734
|
+
const lines = content.split(`
|
|
48735
|
+
`);
|
|
48736
|
+
const wrapped = countWrappedLines(lines, wrapWidth);
|
|
48737
|
+
return Math.max(1, wrapped) + 2;
|
|
48738
|
+
}
|
|
48739
|
+
return 0;
|
|
48740
|
+
}
|
|
48741
|
+
function estimateActivityLogLines(entries, wrapWidth, renderWidth) {
|
|
48742
|
+
return entries.reduce((sum, entry) => sum + estimateActivityEntryLines(entry, wrapWidth, renderWidth), 0);
|
|
48743
|
+
}
|
|
48744
|
+
function isContinuationChunk(id) {
|
|
48745
|
+
const match = id.match(/::chunk-(\d+)$/);
|
|
48746
|
+
if (!match)
|
|
48747
|
+
return false;
|
|
48748
|
+
const idx = Number(match[1]);
|
|
48749
|
+
return Number.isFinite(idx) && idx > 0;
|
|
48750
|
+
}
|
|
48892
48751
|
|
|
48893
48752
|
// packages/terminal/src/components/Messages.tsx
|
|
48894
48753
|
var jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
|
|
@@ -48904,25 +48763,39 @@ function Messages3({
|
|
|
48904
48763
|
queuedMessageIds
|
|
48905
48764
|
}) {
|
|
48906
48765
|
const [now2, setNow] = import_react24.useState(Date.now());
|
|
48907
|
-
const {
|
|
48908
|
-
const
|
|
48909
|
-
const
|
|
48766
|
+
const { stdout } = use_stdout_default();
|
|
48767
|
+
const columns = stdout?.columns ?? 80;
|
|
48768
|
+
const messageWidth = Math.max(1, columns - 2);
|
|
48769
|
+
const wrapWidth = messageWidth;
|
|
48770
|
+
const items = import_react24.useMemo(() => {
|
|
48771
|
+
const output = [];
|
|
48772
|
+
for (const message of messages) {
|
|
48773
|
+
output.push({ kind: "message", message });
|
|
48774
|
+
}
|
|
48775
|
+
for (const entry of activityLog) {
|
|
48776
|
+
output.push({ kind: "activity", entry });
|
|
48777
|
+
}
|
|
48778
|
+
for (const message of streamingMessages) {
|
|
48779
|
+
output.push({ kind: "streaming", message });
|
|
48780
|
+
}
|
|
48781
|
+
return output;
|
|
48782
|
+
}, [messages, activityLog, streamingMessages]);
|
|
48910
48783
|
const lineSpans = import_react24.useMemo(() => {
|
|
48911
48784
|
let cursor = 0;
|
|
48912
|
-
return
|
|
48913
|
-
const lines = estimateMessageLines(message, messageWidth);
|
|
48785
|
+
return items.map((item, index) => {
|
|
48786
|
+
const lines = item.kind === "activity" ? estimateActivityEntryLines(item.entry, wrapWidth, messageWidth) : estimateMessageLines(item.message, messageWidth);
|
|
48914
48787
|
const start = cursor;
|
|
48915
48788
|
cursor += lines;
|
|
48916
|
-
return {
|
|
48789
|
+
return { item, index, start, end: cursor, lines };
|
|
48917
48790
|
});
|
|
48918
|
-
}, [
|
|
48791
|
+
}, [items, wrapWidth, messageWidth]);
|
|
48919
48792
|
const totalLines = lineSpans.length > 0 ? lineSpans[lineSpans.length - 1].end : 0;
|
|
48920
48793
|
const endLine = Math.max(0, totalLines - scrollOffsetLines);
|
|
48921
48794
|
const startLine = Math.max(0, endLine - maxVisibleLines);
|
|
48922
48795
|
const visibleSpans = lineSpans.filter((span) => span.end > startLine && span.start < endLine);
|
|
48923
|
-
const
|
|
48924
|
-
const
|
|
48925
|
-
const visibleStreaming = visibleSpans.filter((span) => span.
|
|
48796
|
+
const visibleMessages = visibleSpans.filter((span) => span.item.kind === "message").map((span) => span.item.message);
|
|
48797
|
+
const visibleActivity = visibleSpans.filter((span) => span.item.kind === "activity").map((span) => span.item.entry);
|
|
48798
|
+
const visibleStreaming = visibleSpans.filter((span) => span.item.kind === "streaming").map((span) => span.item.message);
|
|
48926
48799
|
const showCurrentResponse = Boolean(currentResponse) && streamingMessages.length === 0;
|
|
48927
48800
|
const groupedMessages = groupConsecutiveToolMessages(visibleMessages);
|
|
48928
48801
|
const historicalItems = groupedMessages.map((group) => {
|
|
@@ -48973,7 +48846,7 @@ function Messages3({
|
|
|
48973
48846
|
messages: item.group.messages
|
|
48974
48847
|
}, item.id, false, undefined, this);
|
|
48975
48848
|
}),
|
|
48976
|
-
|
|
48849
|
+
visibleActivity.map((entry) => {
|
|
48977
48850
|
if (entry.type === "text" && entry.content) {
|
|
48978
48851
|
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
48979
48852
|
marginY: 1,
|
|
@@ -49059,7 +48932,7 @@ function Messages3({
|
|
|
49059
48932
|
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
49060
48933
|
flexGrow: 1,
|
|
49061
48934
|
children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Markdown, {
|
|
49062
|
-
content: currentResponse
|
|
48935
|
+
content: currentResponse ?? ""
|
|
49063
48936
|
}, undefined, false, undefined, this)
|
|
49064
48937
|
}, undefined, false, undefined, this)
|
|
49065
48938
|
]
|
|
@@ -49146,10 +49019,10 @@ function MessageBubble({ message, queuedMessageIds }) {
|
|
|
49146
49019
|
dimColor: true,
|
|
49147
49020
|
children: [
|
|
49148
49021
|
"\u23F3 ",
|
|
49149
|
-
message.content
|
|
49022
|
+
message.content ?? ""
|
|
49150
49023
|
]
|
|
49151
49024
|
}, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
49152
|
-
children: message.content
|
|
49025
|
+
children: message.content ?? ""
|
|
49153
49026
|
}, undefined, false, undefined, this)
|
|
49154
49027
|
]
|
|
49155
49028
|
}, undefined, true, undefined, this);
|
|
@@ -49193,7 +49066,7 @@ function startsWithListOrTable(content) {
|
|
|
49193
49066
|
const lines = content.split(`
|
|
49194
49067
|
`);
|
|
49195
49068
|
for (const line of lines) {
|
|
49196
|
-
const trimmed = line.trimStart();
|
|
49069
|
+
const trimmed = stripAnsi5(line).trimStart();
|
|
49197
49070
|
if (!trimmed)
|
|
49198
49071
|
continue;
|
|
49199
49072
|
if (/^[-*\u2022]\s+/.test(trimmed))
|
|
@@ -49202,18 +49075,31 @@ function startsWithListOrTable(content) {
|
|
|
49202
49075
|
return true;
|
|
49203
49076
|
if (trimmed.startsWith("|"))
|
|
49204
49077
|
return true;
|
|
49078
|
+
if (trimmed.startsWith("```"))
|
|
49079
|
+
return true;
|
|
49080
|
+
if (trimmed.startsWith(":::"))
|
|
49081
|
+
return true;
|
|
49082
|
+
if (/^[\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2502]/.test(trimmed))
|
|
49083
|
+
return true;
|
|
49084
|
+
if (/^[\u256D\u256E\u2570\u256F\u2502]/.test(trimmed))
|
|
49085
|
+
return true;
|
|
49205
49086
|
return false;
|
|
49206
49087
|
}
|
|
49207
49088
|
return false;
|
|
49208
49089
|
}
|
|
49090
|
+
function stripAnsi5(text) {
|
|
49091
|
+
return text.replace(/\x1B\[[0-9;]*m/g, "");
|
|
49092
|
+
}
|
|
49209
49093
|
function ToolCallPanel({
|
|
49210
49094
|
toolCalls,
|
|
49211
49095
|
toolResults
|
|
49212
49096
|
}) {
|
|
49213
49097
|
if (toolCalls.length === 0)
|
|
49214
49098
|
return null;
|
|
49215
|
-
const {
|
|
49216
|
-
const
|
|
49099
|
+
const { stdout } = use_stdout_default();
|
|
49100
|
+
const columns = stdout?.columns ?? 80;
|
|
49101
|
+
const panelWidth = Math.max(1, columns - 2);
|
|
49102
|
+
const innerWidth = Math.max(1, panelWidth - 4);
|
|
49217
49103
|
const resultMap = new Map;
|
|
49218
49104
|
for (const result of toolResults || []) {
|
|
49219
49105
|
resultMap.set(result.toolCallId, result);
|
|
@@ -49226,7 +49112,7 @@ function ToolCallPanel({
|
|
|
49226
49112
|
borderStyle: "round",
|
|
49227
49113
|
borderColor,
|
|
49228
49114
|
paddingX: 1,
|
|
49229
|
-
width:
|
|
49115
|
+
width: panelWidth,
|
|
49230
49116
|
children: [
|
|
49231
49117
|
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
49232
49118
|
justifyContent: "space-between",
|
|
@@ -49252,8 +49138,9 @@ function ToolCallPanel({
|
|
|
49252
49138
|
const statusColor = result ? result.isError ? "red" : "green" : "yellow";
|
|
49253
49139
|
const displayName = getToolDisplayName(toolCall);
|
|
49254
49140
|
const context2 = getToolContext(toolCall);
|
|
49255
|
-
const maxLine =
|
|
49141
|
+
const maxLine = Math.max(16, innerWidth - 2);
|
|
49256
49142
|
const summaryLine = truncate(formatToolCall(toolCall), maxLine);
|
|
49143
|
+
const resultText = result ? indentMultiline(truncateToolResult(result, 4, 400), " ") : "";
|
|
49257
49144
|
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
49258
49145
|
flexDirection: "column",
|
|
49259
49146
|
marginTop: 1,
|
|
@@ -49291,7 +49178,7 @@ function ToolCallPanel({
|
|
|
49291
49178
|
dimColor: true,
|
|
49292
49179
|
children: [
|
|
49293
49180
|
"\u21B3 ",
|
|
49294
|
-
|
|
49181
|
+
resultText
|
|
49295
49182
|
]
|
|
49296
49183
|
}, undefined, true, undefined, this)
|
|
49297
49184
|
}, undefined, false, undefined, this)
|
|
@@ -49451,150 +49338,13 @@ function truncate(text, maxLength) {
|
|
|
49451
49338
|
return text;
|
|
49452
49339
|
return text.slice(0, maxLength - 3) + "...";
|
|
49453
49340
|
}
|
|
49454
|
-
function
|
|
49455
|
-
const
|
|
49456
|
-
|
|
49457
|
-
|
|
49458
|
-
|
|
49459
|
-
|
|
49460
|
-
}
|
|
49461
|
-
const prefix = toolResult.isError ? `Error: ` : "";
|
|
49462
|
-
content = content.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, "");
|
|
49463
|
-
content = content.replace(/\t/g, " ");
|
|
49464
|
-
const lines = content.split(`
|
|
49341
|
+
function indentMultiline(text, padding) {
|
|
49342
|
+
const parts = text.split(`
|
|
49343
|
+
`);
|
|
49344
|
+
if (parts.length <= 1)
|
|
49345
|
+
return text;
|
|
49346
|
+
return [parts[0], ...parts.slice(1).map((line) => `${padding}${line}`)].join(`
|
|
49465
49347
|
`);
|
|
49466
|
-
if (lines.length > maxLines) {
|
|
49467
|
-
content = lines.slice(0, maxLines).join(`
|
|
49468
|
-
`) + `
|
|
49469
|
-
... (${lines.length - maxLines} more lines)`;
|
|
49470
|
-
}
|
|
49471
|
-
if (content.length > maxChars) {
|
|
49472
|
-
content = content.slice(0, maxChars) + "...";
|
|
49473
|
-
}
|
|
49474
|
-
return prefix + content.trim();
|
|
49475
|
-
}
|
|
49476
|
-
function formatToolResultNicely(toolName, content, isError) {
|
|
49477
|
-
if (isError) {
|
|
49478
|
-
if (content.includes("ENOENT") || content.includes("no such file")) {
|
|
49479
|
-
return "\u26A0 File not found";
|
|
49480
|
-
}
|
|
49481
|
-
if (content.includes("EACCES") || content.includes("permission denied")) {
|
|
49482
|
-
return "\u26A0 Permission denied";
|
|
49483
|
-
}
|
|
49484
|
-
if (content.includes("ETIMEDOUT") || content.includes("timeout")) {
|
|
49485
|
-
return "\u26A0 Request timed out";
|
|
49486
|
-
}
|
|
49487
|
-
return null;
|
|
49488
|
-
}
|
|
49489
|
-
switch (toolName) {
|
|
49490
|
-
case "schedule":
|
|
49491
|
-
return formatScheduleResult(content);
|
|
49492
|
-
case "submit_feedback":
|
|
49493
|
-
return formatFeedbackResult(content);
|
|
49494
|
-
case "read":
|
|
49495
|
-
return formatReadResult(content);
|
|
49496
|
-
case "write":
|
|
49497
|
-
return formatWriteResult(content);
|
|
49498
|
-
case "glob":
|
|
49499
|
-
return formatGlobResult(content);
|
|
49500
|
-
case "grep":
|
|
49501
|
-
return formatGrepResult(content);
|
|
49502
|
-
case "bash":
|
|
49503
|
-
return formatBashResult(content);
|
|
49504
|
-
case "web_search":
|
|
49505
|
-
return formatSearchResult(content);
|
|
49506
|
-
default:
|
|
49507
|
-
return null;
|
|
49508
|
-
}
|
|
49509
|
-
}
|
|
49510
|
-
function formatScheduleResult(content) {
|
|
49511
|
-
const trimmed = content.trim().toLowerCase();
|
|
49512
|
-
if (trimmed === "no schedules found." || trimmed.includes("no schedules")) {
|
|
49513
|
-
return "\uD83D\uDCC5 No scheduled tasks";
|
|
49514
|
-
}
|
|
49515
|
-
if (trimmed.includes("created") || trimmed.includes("scheduled")) {
|
|
49516
|
-
return "\u2713 Schedule created";
|
|
49517
|
-
}
|
|
49518
|
-
if (trimmed.includes("deleted") || trimmed.includes("removed")) {
|
|
49519
|
-
return "\u2713 Schedule deleted";
|
|
49520
|
-
}
|
|
49521
|
-
if (trimmed.includes("paused")) {
|
|
49522
|
-
return "\u23F8 Schedule paused";
|
|
49523
|
-
}
|
|
49524
|
-
if (trimmed.includes("resumed")) {
|
|
49525
|
-
return "\u25B6 Schedule resumed";
|
|
49526
|
-
}
|
|
49527
|
-
if (content.includes("id:") || content.includes("command:")) {
|
|
49528
|
-
const lines = content.split(`
|
|
49529
|
-
`).filter((l) => l.trim());
|
|
49530
|
-
return `\uD83D\uDCC5 ${lines.length} scheduled task${lines.length !== 1 ? "s" : ""}`;
|
|
49531
|
-
}
|
|
49532
|
-
return null;
|
|
49533
|
-
}
|
|
49534
|
-
function formatFeedbackResult(content) {
|
|
49535
|
-
if (content.includes("submitted") || content.includes("created")) {
|
|
49536
|
-
return "\u2713 Feedback submitted";
|
|
49537
|
-
}
|
|
49538
|
-
return null;
|
|
49539
|
-
}
|
|
49540
|
-
function formatReadResult(content) {
|
|
49541
|
-
const lines = content.split(`
|
|
49542
|
-
`).length;
|
|
49543
|
-
if (lines > 20) {
|
|
49544
|
-
return `\uD83D\uDCC4 Read ${lines} lines`;
|
|
49545
|
-
}
|
|
49546
|
-
return null;
|
|
49547
|
-
}
|
|
49548
|
-
function formatWriteResult(content) {
|
|
49549
|
-
if (content.includes("written") || content.includes("saved") || content.includes("created")) {
|
|
49550
|
-
return "\u2713 File saved";
|
|
49551
|
-
}
|
|
49552
|
-
return null;
|
|
49553
|
-
}
|
|
49554
|
-
function formatGlobResult(content) {
|
|
49555
|
-
const lines = content.split(`
|
|
49556
|
-
`).filter((l) => l.trim());
|
|
49557
|
-
if (lines.length === 0) {
|
|
49558
|
-
return "\uD83D\uDD0D No files found";
|
|
49559
|
-
}
|
|
49560
|
-
if (lines.length > 10) {
|
|
49561
|
-
return `\uD83D\uDD0D Found ${lines.length} files`;
|
|
49562
|
-
}
|
|
49563
|
-
return null;
|
|
49564
|
-
}
|
|
49565
|
-
function formatGrepResult(content) {
|
|
49566
|
-
const lines = content.split(`
|
|
49567
|
-
`).filter((l) => l.trim());
|
|
49568
|
-
if (lines.length === 0) {
|
|
49569
|
-
return "\uD83D\uDD0D No matches found";
|
|
49570
|
-
}
|
|
49571
|
-
if (lines.length > 10) {
|
|
49572
|
-
return `\uD83D\uDD0D Found ${lines.length} matches`;
|
|
49573
|
-
}
|
|
49574
|
-
return null;
|
|
49575
|
-
}
|
|
49576
|
-
function formatBashResult(content) {
|
|
49577
|
-
const trimmed = content.trim();
|
|
49578
|
-
if (!trimmed) {
|
|
49579
|
-
return "\u2713 Command completed";
|
|
49580
|
-
}
|
|
49581
|
-
if (trimmed.length < 100 && !trimmed.includes(`
|
|
49582
|
-
`)) {
|
|
49583
|
-
return null;
|
|
49584
|
-
}
|
|
49585
|
-
const lines = trimmed.split(`
|
|
49586
|
-
`).length;
|
|
49587
|
-
if (lines > 20) {
|
|
49588
|
-
return `\u2713 Output: ${lines} lines`;
|
|
49589
|
-
}
|
|
49590
|
-
return null;
|
|
49591
|
-
}
|
|
49592
|
-
function formatSearchResult(content) {
|
|
49593
|
-
const resultCount = (content.match(/https?:\/\//g) || []).length;
|
|
49594
|
-
if (resultCount > 0) {
|
|
49595
|
-
return `\uD83D\uDD0D Found ${resultCount} result${resultCount !== 1 ? "s" : ""}`;
|
|
49596
|
-
}
|
|
49597
|
-
return null;
|
|
49598
49348
|
}
|
|
49599
49349
|
|
|
49600
49350
|
// packages/terminal/src/components/Status.tsx
|
|
@@ -49636,7 +49386,8 @@ function Status({
|
|
|
49636
49386
|
};
|
|
49637
49387
|
let contextInfo = "";
|
|
49638
49388
|
if (tokenUsage && tokenUsage.maxContextTokens > 0) {
|
|
49639
|
-
const
|
|
49389
|
+
const rawPercent = Math.round(tokenUsage.totalTokens / tokenUsage.maxContextTokens * 100);
|
|
49390
|
+
const percent = Math.max(0, Math.min(100, rawPercent));
|
|
49640
49391
|
contextInfo = `${percent}%`;
|
|
49641
49392
|
}
|
|
49642
49393
|
const sessionInfo = sessionIndex && sessionCount && sessionCount > 1 ? `${sessionIndex}/${sessionCount}` : "";
|
|
@@ -49918,6 +49669,9 @@ function SessionSelector({
|
|
|
49918
49669
|
onCancel
|
|
49919
49670
|
}) {
|
|
49920
49671
|
const [selectedIndex, setSelectedIndex] = import_react28.useState(0);
|
|
49672
|
+
import_react28.useEffect(() => {
|
|
49673
|
+
setSelectedIndex((prev) => Math.min(prev, sessions.length));
|
|
49674
|
+
}, [sessions.length]);
|
|
49921
49675
|
use_input_default((input, key) => {
|
|
49922
49676
|
if (input === "n" || input === "N") {
|
|
49923
49677
|
onNew();
|
|
@@ -50055,30 +49809,15 @@ function wrapTextLines(text, wrapChars) {
|
|
|
50055
49809
|
}
|
|
50056
49810
|
return lines;
|
|
50057
49811
|
}
|
|
50058
|
-
function
|
|
49812
|
+
function stripAnsi6(text) {
|
|
50059
49813
|
return text.replace(/\x1B\[[0-9;]*m/g, "");
|
|
50060
49814
|
}
|
|
50061
|
-
function truncateActivityContent(content, maxLines = 15, maxChars = 3000) {
|
|
50062
|
-
let output = content.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, "");
|
|
50063
|
-
output = output.replace(/\t/g, " ");
|
|
50064
|
-
const lines = output.split(`
|
|
50065
|
-
`);
|
|
50066
|
-
if (lines.length > maxLines) {
|
|
50067
|
-
output = lines.slice(0, maxLines).join(`
|
|
50068
|
-
`) + `
|
|
50069
|
-
... (${lines.length - maxLines} more lines)`;
|
|
50070
|
-
}
|
|
50071
|
-
if (output.length > maxChars) {
|
|
50072
|
-
output = output.slice(0, maxChars) + "...";
|
|
50073
|
-
}
|
|
50074
|
-
return output;
|
|
50075
|
-
}
|
|
50076
49815
|
function chunkRenderedLines(lines, chunkLines) {
|
|
50077
49816
|
const chunks = [];
|
|
50078
49817
|
let current = [];
|
|
50079
49818
|
let i = 0;
|
|
50080
|
-
const isBoxStart = (line) =>
|
|
50081
|
-
const isBoxEnd = (line) =>
|
|
49819
|
+
const isBoxStart = (line) => stripAnsi6(line).trimStart().startsWith("\u250C");
|
|
49820
|
+
const isBoxEnd = (line) => stripAnsi6(line).trimStart().startsWith("\u2514");
|
|
50082
49821
|
while (i < lines.length) {
|
|
50083
49822
|
const line = lines[i];
|
|
50084
49823
|
if (isBoxStart(line)) {
|
|
@@ -50157,7 +49896,9 @@ function buildDisplayMessages(messages, chunkLines, wrapChars, options) {
|
|
|
50157
49896
|
}
|
|
50158
49897
|
function App2({ cwd: cwd2, version }) {
|
|
50159
49898
|
const { exit } = use_app_default();
|
|
50160
|
-
const {
|
|
49899
|
+
const { stdout } = use_stdout_default();
|
|
49900
|
+
const rows = stdout?.rows ?? 24;
|
|
49901
|
+
const columns = stdout?.columns ?? 80;
|
|
50161
49902
|
const [registry] = import_react29.useState(() => new SessionRegistry);
|
|
50162
49903
|
const registryRef = import_react29.useRef(registry);
|
|
50163
49904
|
const [activeSessionId, setActiveSessionId] = import_react29.useState(null);
|
|
@@ -50557,36 +50298,17 @@ function App2({ cwd: cwd2, version }) {
|
|
|
50557
50298
|
const queuedCount = activeQueue.filter((msg) => msg.mode === "queued").length;
|
|
50558
50299
|
const inlineCount = activeInline.length;
|
|
50559
50300
|
const showWelcome = messages.length === 0 && !isProcessing;
|
|
50560
|
-
const
|
|
50561
|
-
const
|
|
50301
|
+
const renderWidth = columns ? Math.max(1, columns - 2) : undefined;
|
|
50302
|
+
const wrapChars = renderWidth ?? MESSAGE_WRAP_CHARS;
|
|
50562
50303
|
const activityLogLineCount = import_react29.useMemo(() => {
|
|
50563
50304
|
if (activityLog.length === 0)
|
|
50564
50305
|
return 0;
|
|
50565
|
-
|
|
50566
|
-
for (const entry of activityLog) {
|
|
50567
|
-
if (entry.type === "text" && entry.content) {
|
|
50568
|
-
const rendered = renderMarkdown(entry.content, { maxWidth: renderWidth });
|
|
50569
|
-
const entryLines = wrapTextLines(stripAnsi4(rendered), wrapChars).length;
|
|
50570
|
-
lines += entryLines + 2;
|
|
50571
|
-
continue;
|
|
50572
|
-
}
|
|
50573
|
-
if (entry.type === "tool_call" && entry.toolCall) {
|
|
50574
|
-
lines += 4;
|
|
50575
|
-
continue;
|
|
50576
|
-
}
|
|
50577
|
-
if (entry.type === "tool_result" && entry.toolResult) {
|
|
50578
|
-
const truncated = truncateActivityContent(String(entry.toolResult.content ?? ""));
|
|
50579
|
-
const entryLines = wrapTextLines(truncated, wrapChars).length;
|
|
50580
|
-
lines += entryLines + 2;
|
|
50581
|
-
continue;
|
|
50582
|
-
}
|
|
50583
|
-
}
|
|
50584
|
-
return lines;
|
|
50306
|
+
return estimateActivityLogLines(activityLog, wrapChars, renderWidth);
|
|
50585
50307
|
}, [activityLog, renderWidth, wrapChars]);
|
|
50586
50308
|
const reservedLines = import_react29.useMemo(() => {
|
|
50587
50309
|
let lines = 0;
|
|
50588
50310
|
if (showWelcome) {
|
|
50589
|
-
lines +=
|
|
50311
|
+
lines += 4;
|
|
50590
50312
|
}
|
|
50591
50313
|
if (backgroundProcessingCount > 0) {
|
|
50592
50314
|
lines += 1;
|
|
@@ -50666,7 +50388,7 @@ function App2({ cwd: cwd2, version }) {
|
|
|
50666
50388
|
}
|
|
50667
50389
|
prevDisplayLineCountRef.current = totalLineCount;
|
|
50668
50390
|
}, [totalLineCount, autoScroll]);
|
|
50669
|
-
const maxVisibleLines = rows ? Math.max(
|
|
50391
|
+
const maxVisibleLines = rows ? Math.max(1, rows - reservedLines) : 20;
|
|
50670
50392
|
import_react29.useEffect(() => {
|
|
50671
50393
|
const maxOffset = Math.max(0, totalLineCount - maxVisibleLines);
|
|
50672
50394
|
setScrollOffset((prev) => Math.min(prev, maxOffset));
|
|
@@ -51383,4 +51105,4 @@ if (options.print !== null) {
|
|
|
51383
51105
|
});
|
|
51384
51106
|
}
|
|
51385
51107
|
|
|
51386
|
-
//# debugId=
|
|
51108
|
+
//# debugId=635A1CBC05837E5664756E2164756E21
|