@clawos-dev/clawd 0.2.133-beta.269.64cd75d → 0.2.133-beta.270.8f65d4e
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/cli.cjs +328 -155
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -6850,10 +6850,10 @@ var require_redaction = __commonJS({
|
|
|
6850
6850
|
var strict = false;
|
|
6851
6851
|
function redaction(opts, serialize) {
|
|
6852
6852
|
const { paths, censor, remove } = handle(opts);
|
|
6853
|
-
const shape = paths.reduce((o,
|
|
6853
|
+
const shape = paths.reduce((o, str3) => {
|
|
6854
6854
|
rx.lastIndex = 0;
|
|
6855
|
-
const first = rx.exec(
|
|
6856
|
-
const next = rx.exec(
|
|
6855
|
+
const first = rx.exec(str3);
|
|
6856
|
+
const next = rx.exec(str3);
|
|
6857
6857
|
let ns = first[1] !== void 0 ? first[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/, "$1") : first[0];
|
|
6858
6858
|
if (ns === "*") {
|
|
6859
6859
|
ns = wildcardFirstSym;
|
|
@@ -6866,7 +6866,7 @@ var require_redaction = __commonJS({
|
|
|
6866
6866
|
return o;
|
|
6867
6867
|
}
|
|
6868
6868
|
const { index } = next;
|
|
6869
|
-
const nextPath = `${
|
|
6869
|
+
const nextPath = `${str3.substr(index, str3.length - 1)}`;
|
|
6870
6870
|
o[ns] = o[ns] || [];
|
|
6871
6871
|
if (ns !== wildcardFirstSym && o[ns].length === 0) {
|
|
6872
6872
|
o[ns].push(...o[wildcardFirstSym] || []);
|
|
@@ -6982,7 +6982,7 @@ var require_quick_format_unescaped = __commonJS({
|
|
|
6982
6982
|
}
|
|
6983
6983
|
var argLen = args.length;
|
|
6984
6984
|
if (argLen === 0) return f;
|
|
6985
|
-
var
|
|
6985
|
+
var str3 = "";
|
|
6986
6986
|
var a = 1 - offset;
|
|
6987
6987
|
var lastPos = -1;
|
|
6988
6988
|
var flen = f && f.length || 0;
|
|
@@ -6997,8 +6997,8 @@ var require_quick_format_unescaped = __commonJS({
|
|
|
6997
6997
|
break;
|
|
6998
6998
|
if (args[a] == null) break;
|
|
6999
6999
|
if (lastPos < i)
|
|
7000
|
-
|
|
7001
|
-
|
|
7000
|
+
str3 += f.slice(lastPos, i);
|
|
7001
|
+
str3 += Number(args[a]);
|
|
7002
7002
|
lastPos = i + 2;
|
|
7003
7003
|
i++;
|
|
7004
7004
|
break;
|
|
@@ -7007,8 +7007,8 @@ var require_quick_format_unescaped = __commonJS({
|
|
|
7007
7007
|
break;
|
|
7008
7008
|
if (args[a] == null) break;
|
|
7009
7009
|
if (lastPos < i)
|
|
7010
|
-
|
|
7011
|
-
|
|
7010
|
+
str3 += f.slice(lastPos, i);
|
|
7011
|
+
str3 += Math.floor(Number(args[a]));
|
|
7012
7012
|
lastPos = i + 2;
|
|
7013
7013
|
i++;
|
|
7014
7014
|
break;
|
|
@@ -7021,21 +7021,21 @@ var require_quick_format_unescaped = __commonJS({
|
|
|
7021
7021
|
break;
|
|
7022
7022
|
if (args[a] === void 0) break;
|
|
7023
7023
|
if (lastPos < i)
|
|
7024
|
-
|
|
7024
|
+
str3 += f.slice(lastPos, i);
|
|
7025
7025
|
var type = typeof args[a];
|
|
7026
7026
|
if (type === "string") {
|
|
7027
|
-
|
|
7027
|
+
str3 += "'" + args[a] + "'";
|
|
7028
7028
|
lastPos = i + 2;
|
|
7029
7029
|
i++;
|
|
7030
7030
|
break;
|
|
7031
7031
|
}
|
|
7032
7032
|
if (type === "function") {
|
|
7033
|
-
|
|
7033
|
+
str3 += args[a].name || "<anonymous>";
|
|
7034
7034
|
lastPos = i + 2;
|
|
7035
7035
|
i++;
|
|
7036
7036
|
break;
|
|
7037
7037
|
}
|
|
7038
|
-
|
|
7038
|
+
str3 += ss(args[a]);
|
|
7039
7039
|
lastPos = i + 2;
|
|
7040
7040
|
i++;
|
|
7041
7041
|
break;
|
|
@@ -7043,15 +7043,15 @@ var require_quick_format_unescaped = __commonJS({
|
|
|
7043
7043
|
if (a >= argLen)
|
|
7044
7044
|
break;
|
|
7045
7045
|
if (lastPos < i)
|
|
7046
|
-
|
|
7047
|
-
|
|
7046
|
+
str3 += f.slice(lastPos, i);
|
|
7047
|
+
str3 += String(args[a]);
|
|
7048
7048
|
lastPos = i + 2;
|
|
7049
7049
|
i++;
|
|
7050
7050
|
break;
|
|
7051
7051
|
case 37:
|
|
7052
7052
|
if (lastPos < i)
|
|
7053
|
-
|
|
7054
|
-
|
|
7053
|
+
str3 += f.slice(lastPos, i);
|
|
7054
|
+
str3 += "%";
|
|
7055
7055
|
lastPos = i + 2;
|
|
7056
7056
|
i++;
|
|
7057
7057
|
a--;
|
|
@@ -7064,9 +7064,9 @@ var require_quick_format_unescaped = __commonJS({
|
|
|
7064
7064
|
if (lastPos === -1)
|
|
7065
7065
|
return f;
|
|
7066
7066
|
else if (lastPos < flen) {
|
|
7067
|
-
|
|
7067
|
+
str3 += f.slice(lastPos);
|
|
7068
7068
|
}
|
|
7069
|
-
return
|
|
7069
|
+
return str3;
|
|
7070
7070
|
}
|
|
7071
7071
|
}
|
|
7072
7072
|
});
|
|
@@ -8552,38 +8552,38 @@ var require_tools = __commonJS({
|
|
|
8552
8552
|
}
|
|
8553
8553
|
}
|
|
8554
8554
|
}
|
|
8555
|
-
function asString(
|
|
8555
|
+
function asString(str3) {
|
|
8556
8556
|
let result = "";
|
|
8557
8557
|
let last = 0;
|
|
8558
8558
|
let found = false;
|
|
8559
8559
|
let point = 255;
|
|
8560
|
-
const l =
|
|
8560
|
+
const l = str3.length;
|
|
8561
8561
|
if (l > 100) {
|
|
8562
|
-
return JSON.stringify(
|
|
8562
|
+
return JSON.stringify(str3);
|
|
8563
8563
|
}
|
|
8564
8564
|
for (var i = 0; i < l && point >= 32; i++) {
|
|
8565
|
-
point =
|
|
8565
|
+
point = str3.charCodeAt(i);
|
|
8566
8566
|
if (point === 34 || point === 92) {
|
|
8567
|
-
result +=
|
|
8567
|
+
result += str3.slice(last, i) + "\\";
|
|
8568
8568
|
last = i;
|
|
8569
8569
|
found = true;
|
|
8570
8570
|
}
|
|
8571
8571
|
}
|
|
8572
8572
|
if (!found) {
|
|
8573
|
-
result =
|
|
8573
|
+
result = str3;
|
|
8574
8574
|
} else {
|
|
8575
|
-
result +=
|
|
8575
|
+
result += str3.slice(last);
|
|
8576
8576
|
}
|
|
8577
|
-
return point < 32 ? JSON.stringify(
|
|
8577
|
+
return point < 32 ? JSON.stringify(str3) : '"' + result + '"';
|
|
8578
8578
|
}
|
|
8579
|
-
function asJson(obj, msg,
|
|
8579
|
+
function asJson(obj, msg, num3, time) {
|
|
8580
8580
|
if (asJsonChan.hasSubscribers === false) {
|
|
8581
|
-
return _asJson.call(this, obj, msg,
|
|
8581
|
+
return _asJson.call(this, obj, msg, num3, time);
|
|
8582
8582
|
}
|
|
8583
8583
|
const store = { instance: this, arguments };
|
|
8584
|
-
return asJsonChan.traceSync(_asJson, store, this, obj, msg,
|
|
8584
|
+
return asJsonChan.traceSync(_asJson, store, this, obj, msg, num3, time);
|
|
8585
8585
|
}
|
|
8586
|
-
function _asJson(obj, msg,
|
|
8586
|
+
function _asJson(obj, msg, num3, time) {
|
|
8587
8587
|
const stringify2 = this[stringifySym];
|
|
8588
8588
|
const stringifySafe = this[stringifySafeSym];
|
|
8589
8589
|
const stringifiers = this[stringifiersSym];
|
|
@@ -8593,7 +8593,7 @@ var require_tools = __commonJS({
|
|
|
8593
8593
|
const formatters = this[formattersSym];
|
|
8594
8594
|
const messageKey = this[messageKeySym];
|
|
8595
8595
|
const errorKey = this[errorKeySym];
|
|
8596
|
-
let data = this[lsCacheSym][
|
|
8596
|
+
let data = this[lsCacheSym][num3] + time;
|
|
8597
8597
|
data = data + chindings;
|
|
8598
8598
|
let value;
|
|
8599
8599
|
if (formatters.log) {
|
|
@@ -9220,7 +9220,7 @@ var require_proto = __commonJS({
|
|
|
9220
9220
|
function defaultMixinMergeStrategy(mergeObject, mixinObject) {
|
|
9221
9221
|
return Object.assign(mixinObject, mergeObject);
|
|
9222
9222
|
}
|
|
9223
|
-
function write(_obj, msg,
|
|
9223
|
+
function write(_obj, msg, num3) {
|
|
9224
9224
|
const t = this[timeSym]();
|
|
9225
9225
|
const mixin = this[mixinSym];
|
|
9226
9226
|
const errorKey = this[errorKeySym];
|
|
@@ -9242,12 +9242,12 @@ var require_proto = __commonJS({
|
|
|
9242
9242
|
}
|
|
9243
9243
|
}
|
|
9244
9244
|
if (mixin) {
|
|
9245
|
-
obj = mixinMergeStrategy(obj, mixin(obj,
|
|
9245
|
+
obj = mixinMergeStrategy(obj, mixin(obj, num3, this));
|
|
9246
9246
|
}
|
|
9247
|
-
const s = this[asJsonSym](obj, msg,
|
|
9247
|
+
const s = this[asJsonSym](obj, msg, num3, t);
|
|
9248
9248
|
const stream = this[streamSym];
|
|
9249
9249
|
if (stream[needsMetadataGsym] === true) {
|
|
9250
|
-
stream.lastLevel =
|
|
9250
|
+
stream.lastLevel = num3;
|
|
9251
9251
|
stream.lastObj = obj;
|
|
9252
9252
|
stream.lastMsg = msg;
|
|
9253
9253
|
stream.lastTime = t.slice(this[timeSliceIndexSym]);
|
|
@@ -9280,11 +9280,11 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
9280
9280
|
exports2.configure = configure;
|
|
9281
9281
|
module2.exports = stringify;
|
|
9282
9282
|
var strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;
|
|
9283
|
-
function strEscape(
|
|
9284
|
-
if (
|
|
9285
|
-
return `"${
|
|
9283
|
+
function strEscape(str3) {
|
|
9284
|
+
if (str3.length < 5e3 && !strEscapeSequencesRegExp.test(str3)) {
|
|
9285
|
+
return `"${str3}"`;
|
|
9286
9286
|
}
|
|
9287
|
-
return JSON.stringify(
|
|
9287
|
+
return JSON.stringify(str3);
|
|
9288
9288
|
}
|
|
9289
9289
|
function sort(array, comparator) {
|
|
9290
9290
|
if (array.length > 200 || comparator) {
|
|
@@ -10318,22 +10318,22 @@ function buildValues(diff2, lastComponent, newString, oldString, useLongestToken
|
|
|
10318
10318
|
}
|
|
10319
10319
|
return components;
|
|
10320
10320
|
}
|
|
10321
|
-
function longestCommonPrefix(str1,
|
|
10321
|
+
function longestCommonPrefix(str1, str22) {
|
|
10322
10322
|
var i;
|
|
10323
|
-
for (i = 0; i < str1.length && i <
|
|
10324
|
-
if (str1[i] !=
|
|
10323
|
+
for (i = 0; i < str1.length && i < str22.length; i++) {
|
|
10324
|
+
if (str1[i] != str22[i]) {
|
|
10325
10325
|
return str1.slice(0, i);
|
|
10326
10326
|
}
|
|
10327
10327
|
}
|
|
10328
10328
|
return str1.slice(0, i);
|
|
10329
10329
|
}
|
|
10330
|
-
function longestCommonSuffix(str1,
|
|
10330
|
+
function longestCommonSuffix(str1, str22) {
|
|
10331
10331
|
var i;
|
|
10332
|
-
if (!str1 || !
|
|
10332
|
+
if (!str1 || !str22 || str1[str1.length - 1] != str22[str22.length - 1]) {
|
|
10333
10333
|
return "";
|
|
10334
10334
|
}
|
|
10335
|
-
for (i = 0; i < str1.length && i <
|
|
10336
|
-
if (str1[str1.length - (i + 1)] !=
|
|
10335
|
+
for (i = 0; i < str1.length && i < str22.length; i++) {
|
|
10336
|
+
if (str1[str1.length - (i + 1)] != str22[str22.length - (i + 1)]) {
|
|
10337
10337
|
return str1.slice(-i);
|
|
10338
10338
|
}
|
|
10339
10339
|
}
|
|
@@ -11265,12 +11265,12 @@ function attachmentToHistoryMessage(o, ts) {
|
|
|
11265
11265
|
const raw = Array.isArray(a.memories) ? a.memories : [];
|
|
11266
11266
|
const memories = raw.map((m2) => {
|
|
11267
11267
|
if (!m2 || typeof m2 !== "object") return null;
|
|
11268
|
-
const
|
|
11269
|
-
const path59 = typeof
|
|
11270
|
-
const content = typeof
|
|
11268
|
+
const rec3 = m2;
|
|
11269
|
+
const path59 = typeof rec3.path === "string" ? rec3.path : null;
|
|
11270
|
+
const content = typeof rec3.content === "string" ? rec3.content : null;
|
|
11271
11271
|
if (!path59 || content == null) return null;
|
|
11272
11272
|
const entry = { path: path59, content };
|
|
11273
|
-
if (typeof
|
|
11273
|
+
if (typeof rec3.mtimeMs === "number") entry.mtimeMs = rec3.mtimeMs;
|
|
11274
11274
|
return entry;
|
|
11275
11275
|
}).filter((m2) => m2 !== null);
|
|
11276
11276
|
if (memories.length === 0) return null;
|
|
@@ -12080,12 +12080,12 @@ function parseAttachment(obj) {
|
|
|
12080
12080
|
const raw = Array.isArray(a.memories) ? a.memories : [];
|
|
12081
12081
|
const memories = raw.map((m2) => {
|
|
12082
12082
|
if (!m2 || typeof m2 !== "object") return null;
|
|
12083
|
-
const
|
|
12084
|
-
const path59 = typeof
|
|
12085
|
-
const content = typeof
|
|
12083
|
+
const rec3 = m2;
|
|
12084
|
+
const path59 = typeof rec3.path === "string" ? rec3.path : null;
|
|
12085
|
+
const content = typeof rec3.content === "string" ? rec3.content : null;
|
|
12086
12086
|
if (!path59 || content == null) return null;
|
|
12087
12087
|
const out = { path: path59, content };
|
|
12088
|
-
if (typeof
|
|
12088
|
+
if (typeof rec3.mtimeMs === "number") out.mtimeMs = rec3.mtimeMs;
|
|
12089
12089
|
return out;
|
|
12090
12090
|
}).filter((m2) => m2 !== null);
|
|
12091
12091
|
if (memories.length === 0) return null;
|
|
@@ -17721,26 +17721,26 @@ var require_permessage_deflate = __commonJS({
|
|
|
17721
17721
|
value = value[0];
|
|
17722
17722
|
if (key === "client_max_window_bits") {
|
|
17723
17723
|
if (value !== true) {
|
|
17724
|
-
const
|
|
17725
|
-
if (!Number.isInteger(
|
|
17724
|
+
const num3 = +value;
|
|
17725
|
+
if (!Number.isInteger(num3) || num3 < 8 || num3 > 15) {
|
|
17726
17726
|
throw new TypeError(
|
|
17727
17727
|
`Invalid value for parameter "${key}": ${value}`
|
|
17728
17728
|
);
|
|
17729
17729
|
}
|
|
17730
|
-
value =
|
|
17730
|
+
value = num3;
|
|
17731
17731
|
} else if (!this._isServer) {
|
|
17732
17732
|
throw new TypeError(
|
|
17733
17733
|
`Invalid value for parameter "${key}": ${value}`
|
|
17734
17734
|
);
|
|
17735
17735
|
}
|
|
17736
17736
|
} else if (key === "server_max_window_bits") {
|
|
17737
|
-
const
|
|
17738
|
-
if (!Number.isInteger(
|
|
17737
|
+
const num3 = +value;
|
|
17738
|
+
if (!Number.isInteger(num3) || num3 < 8 || num3 > 15) {
|
|
17739
17739
|
throw new TypeError(
|
|
17740
17740
|
`Invalid value for parameter "${key}": ${value}`
|
|
17741
17741
|
);
|
|
17742
17742
|
}
|
|
17743
|
-
value =
|
|
17743
|
+
value = num3;
|
|
17744
17744
|
} else if (key === "client_no_context_takeover" || key === "server_no_context_takeover") {
|
|
17745
17745
|
if (value !== true) {
|
|
17746
17746
|
throw new TypeError(
|
|
@@ -18435,8 +18435,8 @@ var require_receiver = __commonJS({
|
|
|
18435
18435
|
return;
|
|
18436
18436
|
}
|
|
18437
18437
|
const buf = this.consume(8);
|
|
18438
|
-
const
|
|
18439
|
-
if (
|
|
18438
|
+
const num3 = buf.readUInt32BE(0);
|
|
18439
|
+
if (num3 > Math.pow(2, 53 - 32) - 1) {
|
|
18440
18440
|
const error = this.createError(
|
|
18441
18441
|
RangeError,
|
|
18442
18442
|
"Unsupported WebSocket frame: payload length > 2^53 - 1",
|
|
@@ -18447,7 +18447,7 @@ var require_receiver = __commonJS({
|
|
|
18447
18447
|
cb(error);
|
|
18448
18448
|
return;
|
|
18449
18449
|
}
|
|
18450
|
-
this._payloadLength =
|
|
18450
|
+
this._payloadLength = num3 * Math.pow(2, 32) + buf.readUInt32BE(4);
|
|
18451
18451
|
this.haveLength(cb);
|
|
18452
18452
|
}
|
|
18453
18453
|
/**
|
|
@@ -22761,19 +22761,19 @@ var require_stream_readable = __commonJS({
|
|
|
22761
22761
|
var ret = p2.data;
|
|
22762
22762
|
n -= ret.length;
|
|
22763
22763
|
while (p2 = p2.next) {
|
|
22764
|
-
var
|
|
22765
|
-
var nb = n >
|
|
22766
|
-
if (nb ===
|
|
22767
|
-
else ret +=
|
|
22764
|
+
var str3 = p2.data;
|
|
22765
|
+
var nb = n > str3.length ? str3.length : n;
|
|
22766
|
+
if (nb === str3.length) ret += str3;
|
|
22767
|
+
else ret += str3.slice(0, n);
|
|
22768
22768
|
n -= nb;
|
|
22769
22769
|
if (n === 0) {
|
|
22770
|
-
if (nb ===
|
|
22770
|
+
if (nb === str3.length) {
|
|
22771
22771
|
++c;
|
|
22772
22772
|
if (p2.next) list.head = p2.next;
|
|
22773
22773
|
else list.head = list.tail = null;
|
|
22774
22774
|
} else {
|
|
22775
22775
|
list.head = p2;
|
|
22776
|
-
p2.data =
|
|
22776
|
+
p2.data = str3.slice(nb);
|
|
22777
22777
|
}
|
|
22778
22778
|
break;
|
|
22779
22779
|
}
|
|
@@ -23669,14 +23669,14 @@ var require_utils = __commonJS({
|
|
|
23669
23669
|
var nodejsUtils = require_nodejsUtils();
|
|
23670
23670
|
var external = require_external();
|
|
23671
23671
|
require_setImmediate();
|
|
23672
|
-
function string2binary(
|
|
23672
|
+
function string2binary(str3) {
|
|
23673
23673
|
var result = null;
|
|
23674
23674
|
if (support.uint8array) {
|
|
23675
|
-
result = new Uint8Array(
|
|
23675
|
+
result = new Uint8Array(str3.length);
|
|
23676
23676
|
} else {
|
|
23677
|
-
result = new Array(
|
|
23677
|
+
result = new Array(str3.length);
|
|
23678
23678
|
}
|
|
23679
|
-
return stringToArrayLike(
|
|
23679
|
+
return stringToArrayLike(str3, result);
|
|
23680
23680
|
}
|
|
23681
23681
|
exports2.newBlob = function(part, type) {
|
|
23682
23682
|
exports2.checkSupport("blob");
|
|
@@ -23698,9 +23698,9 @@ var require_utils = __commonJS({
|
|
|
23698
23698
|
function identity(input) {
|
|
23699
23699
|
return input;
|
|
23700
23700
|
}
|
|
23701
|
-
function stringToArrayLike(
|
|
23702
|
-
for (var i = 0; i <
|
|
23703
|
-
array[i] =
|
|
23701
|
+
function stringToArrayLike(str3, array) {
|
|
23702
|
+
for (var i = 0; i < str3.length; ++i) {
|
|
23703
|
+
array[i] = str3.charCodeAt(i) & 255;
|
|
23704
23704
|
}
|
|
23705
23705
|
return array;
|
|
23706
23706
|
}
|
|
@@ -23913,10 +23913,10 @@ var require_utils = __commonJS({
|
|
|
23913
23913
|
};
|
|
23914
23914
|
exports2.MAX_VALUE_16BITS = 65535;
|
|
23915
23915
|
exports2.MAX_VALUE_32BITS = -1;
|
|
23916
|
-
exports2.pretty = function(
|
|
23916
|
+
exports2.pretty = function(str3) {
|
|
23917
23917
|
var res = "", code, i;
|
|
23918
|
-
for (i = 0; i < (
|
|
23919
|
-
code =
|
|
23918
|
+
for (i = 0; i < (str3 || "").length; i++) {
|
|
23919
|
+
code = str3.charCodeAt(i);
|
|
23920
23920
|
res += "\\x" + (code < 16 ? "0" : "") + code.toString(16).toUpperCase();
|
|
23921
23921
|
}
|
|
23922
23922
|
return res;
|
|
@@ -24226,12 +24226,12 @@ var require_utf8 = __commonJS({
|
|
|
24226
24226
|
}
|
|
24227
24227
|
var i;
|
|
24228
24228
|
_utf8len[254] = _utf8len[254] = 1;
|
|
24229
|
-
var string2buf = function(
|
|
24230
|
-
var buf, c, c2, m_pos, i2, str_len =
|
|
24229
|
+
var string2buf = function(str3) {
|
|
24230
|
+
var buf, c, c2, m_pos, i2, str_len = str3.length, buf_len = 0;
|
|
24231
24231
|
for (m_pos = 0; m_pos < str_len; m_pos++) {
|
|
24232
|
-
c =
|
|
24232
|
+
c = str3.charCodeAt(m_pos);
|
|
24233
24233
|
if ((c & 64512) === 55296 && m_pos + 1 < str_len) {
|
|
24234
|
-
c2 =
|
|
24234
|
+
c2 = str3.charCodeAt(m_pos + 1);
|
|
24235
24235
|
if ((c2 & 64512) === 56320) {
|
|
24236
24236
|
c = 65536 + (c - 55296 << 10) + (c2 - 56320);
|
|
24237
24237
|
m_pos++;
|
|
@@ -24245,9 +24245,9 @@ var require_utf8 = __commonJS({
|
|
|
24245
24245
|
buf = new Array(buf_len);
|
|
24246
24246
|
}
|
|
24247
24247
|
for (i2 = 0, m_pos = 0; i2 < buf_len; m_pos++) {
|
|
24248
|
-
c =
|
|
24248
|
+
c = str3.charCodeAt(m_pos);
|
|
24249
24249
|
if ((c & 64512) === 55296 && m_pos + 1 < str_len) {
|
|
24250
|
-
c2 =
|
|
24250
|
+
c2 = str3.charCodeAt(m_pos + 1);
|
|
24251
24251
|
if ((c2 & 64512) === 56320) {
|
|
24252
24252
|
c = 65536 + (c - 55296 << 10) + (c2 - 56320);
|
|
24253
24253
|
m_pos++;
|
|
@@ -24331,11 +24331,11 @@ var require_utf8 = __commonJS({
|
|
|
24331
24331
|
}
|
|
24332
24332
|
return utils.applyFromCharCode(utf16buf);
|
|
24333
24333
|
};
|
|
24334
|
-
exports2.utf8encode = function utf8encode(
|
|
24334
|
+
exports2.utf8encode = function utf8encode(str3) {
|
|
24335
24335
|
if (support.nodebuffer) {
|
|
24336
|
-
return nodejsUtils.newBufferFrom(
|
|
24336
|
+
return nodejsUtils.newBufferFrom(str3, "utf-8");
|
|
24337
24337
|
}
|
|
24338
|
-
return string2buf(
|
|
24338
|
+
return string2buf(str3);
|
|
24339
24339
|
};
|
|
24340
24340
|
exports2.utf8decode = function utf8decode(buf) {
|
|
24341
24341
|
if (support.nodebuffer) {
|
|
@@ -24744,11 +24744,11 @@ var require_crc32 = __commonJS({
|
|
|
24744
24744
|
}
|
|
24745
24745
|
return crc ^ -1;
|
|
24746
24746
|
}
|
|
24747
|
-
function crc32str(crc,
|
|
24747
|
+
function crc32str(crc, str3, len, pos) {
|
|
24748
24748
|
var t = crcTable, end = pos + len;
|
|
24749
24749
|
crc = crc ^ -1;
|
|
24750
24750
|
for (var i = pos; i < end; i++) {
|
|
24751
|
-
crc = crc >>> 8 ^ t[(crc ^
|
|
24751
|
+
crc = crc >>> 8 ^ t[(crc ^ str3.charCodeAt(i)) & 255];
|
|
24752
24752
|
}
|
|
24753
24753
|
return crc ^ -1;
|
|
24754
24754
|
}
|
|
@@ -25945,7 +25945,7 @@ var require_deflate = __commonJS({
|
|
|
25945
25945
|
}
|
|
25946
25946
|
function fill_window(s) {
|
|
25947
25947
|
var _w_size = s.w_size;
|
|
25948
|
-
var p2, n, m2, more,
|
|
25948
|
+
var p2, n, m2, more, str3;
|
|
25949
25949
|
do {
|
|
25950
25950
|
more = s.window_size - s.lookahead - s.strstart;
|
|
25951
25951
|
if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {
|
|
@@ -25973,14 +25973,14 @@ var require_deflate = __commonJS({
|
|
|
25973
25973
|
n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);
|
|
25974
25974
|
s.lookahead += n;
|
|
25975
25975
|
if (s.lookahead + s.insert >= MIN_MATCH) {
|
|
25976
|
-
|
|
25977
|
-
s.ins_h = s.window[
|
|
25978
|
-
s.ins_h = (s.ins_h << s.hash_shift ^ s.window[
|
|
25976
|
+
str3 = s.strstart - s.insert;
|
|
25977
|
+
s.ins_h = s.window[str3];
|
|
25978
|
+
s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str3 + 1]) & s.hash_mask;
|
|
25979
25979
|
while (s.insert) {
|
|
25980
|
-
s.ins_h = (s.ins_h << s.hash_shift ^ s.window[
|
|
25981
|
-
s.prev[
|
|
25982
|
-
s.head[s.ins_h] =
|
|
25983
|
-
|
|
25980
|
+
s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str3 + MIN_MATCH - 1]) & s.hash_mask;
|
|
25981
|
+
s.prev[str3 & s.w_mask] = s.head[s.ins_h];
|
|
25982
|
+
s.head[s.ins_h] = str3;
|
|
25983
|
+
str3++;
|
|
25984
25984
|
s.insert--;
|
|
25985
25985
|
if (s.lookahead + s.insert < MIN_MATCH) {
|
|
25986
25986
|
break;
|
|
@@ -26756,7 +26756,7 @@ var require_deflate = __commonJS({
|
|
|
26756
26756
|
function deflateSetDictionary(strm, dictionary) {
|
|
26757
26757
|
var dictLength = dictionary.length;
|
|
26758
26758
|
var s;
|
|
26759
|
-
var
|
|
26759
|
+
var str3, n;
|
|
26760
26760
|
var wrap2;
|
|
26761
26761
|
var avail;
|
|
26762
26762
|
var next;
|
|
@@ -26794,15 +26794,15 @@ var require_deflate = __commonJS({
|
|
|
26794
26794
|
strm.input = dictionary;
|
|
26795
26795
|
fill_window(s);
|
|
26796
26796
|
while (s.lookahead >= MIN_MATCH) {
|
|
26797
|
-
|
|
26797
|
+
str3 = s.strstart;
|
|
26798
26798
|
n = s.lookahead - (MIN_MATCH - 1);
|
|
26799
26799
|
do {
|
|
26800
|
-
s.ins_h = (s.ins_h << s.hash_shift ^ s.window[
|
|
26801
|
-
s.prev[
|
|
26802
|
-
s.head[s.ins_h] =
|
|
26803
|
-
|
|
26800
|
+
s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str3 + MIN_MATCH - 1]) & s.hash_mask;
|
|
26801
|
+
s.prev[str3 & s.w_mask] = s.head[s.ins_h];
|
|
26802
|
+
s.head[s.ins_h] = str3;
|
|
26803
|
+
str3++;
|
|
26804
26804
|
} while (--n);
|
|
26805
|
-
s.strstart =
|
|
26805
|
+
s.strstart = str3;
|
|
26806
26806
|
s.lookahead = MIN_MATCH - 1;
|
|
26807
26807
|
fill_window(s);
|
|
26808
26808
|
}
|
|
@@ -26853,12 +26853,12 @@ var require_strings = __commonJS({
|
|
|
26853
26853
|
}
|
|
26854
26854
|
var q;
|
|
26855
26855
|
_utf8len[254] = _utf8len[254] = 1;
|
|
26856
|
-
exports2.string2buf = function(
|
|
26857
|
-
var buf, c, c2, m_pos, i, str_len =
|
|
26856
|
+
exports2.string2buf = function(str3) {
|
|
26857
|
+
var buf, c, c2, m_pos, i, str_len = str3.length, buf_len = 0;
|
|
26858
26858
|
for (m_pos = 0; m_pos < str_len; m_pos++) {
|
|
26859
|
-
c =
|
|
26859
|
+
c = str3.charCodeAt(m_pos);
|
|
26860
26860
|
if ((c & 64512) === 55296 && m_pos + 1 < str_len) {
|
|
26861
|
-
c2 =
|
|
26861
|
+
c2 = str3.charCodeAt(m_pos + 1);
|
|
26862
26862
|
if ((c2 & 64512) === 56320) {
|
|
26863
26863
|
c = 65536 + (c - 55296 << 10) + (c2 - 56320);
|
|
26864
26864
|
m_pos++;
|
|
@@ -26868,9 +26868,9 @@ var require_strings = __commonJS({
|
|
|
26868
26868
|
}
|
|
26869
26869
|
buf = new utils.Buf8(buf_len);
|
|
26870
26870
|
for (i = 0, m_pos = 0; i < buf_len; m_pos++) {
|
|
26871
|
-
c =
|
|
26871
|
+
c = str3.charCodeAt(m_pos);
|
|
26872
26872
|
if ((c & 64512) === 55296 && m_pos + 1 < str_len) {
|
|
26873
|
-
c2 =
|
|
26873
|
+
c2 = str3.charCodeAt(m_pos + 1);
|
|
26874
26874
|
if ((c2 & 64512) === 56320) {
|
|
26875
26875
|
c = 65536 + (c - 55296 << 10) + (c2 - 56320);
|
|
26876
26876
|
m_pos++;
|
|
@@ -26909,10 +26909,10 @@ var require_strings = __commonJS({
|
|
|
26909
26909
|
exports2.buf2binstring = function(buf) {
|
|
26910
26910
|
return buf2binstring(buf, buf.length);
|
|
26911
26911
|
};
|
|
26912
|
-
exports2.binstring2buf = function(
|
|
26913
|
-
var buf = new utils.Buf8(
|
|
26912
|
+
exports2.binstring2buf = function(str3) {
|
|
26913
|
+
var buf = new utils.Buf8(str3.length);
|
|
26914
26914
|
for (var i = 0, len = buf.length; i < len; i++) {
|
|
26915
|
-
buf[i] =
|
|
26915
|
+
buf[i] = str3.charCodeAt(i);
|
|
26916
26916
|
}
|
|
26917
26917
|
return buf;
|
|
26918
26918
|
};
|
|
@@ -35565,12 +35565,15 @@ async function probeCodex(env = process.env) {
|
|
|
35565
35565
|
}
|
|
35566
35566
|
var CodexAdapter = class {
|
|
35567
35567
|
id = "codex";
|
|
35568
|
+
// 历史读取器:history:read 按 session.tool 路由到这里(thread/read)。
|
|
35569
|
+
historyReader;
|
|
35568
35570
|
probeCache = null;
|
|
35569
35571
|
logger;
|
|
35570
35572
|
probeOverride;
|
|
35571
35573
|
constructor(opts = {}) {
|
|
35572
35574
|
this.logger = opts.logger;
|
|
35573
35575
|
this.probeOverride = opts.probeOverride;
|
|
35576
|
+
this.historyReader = opts.historyReader;
|
|
35574
35577
|
}
|
|
35575
35578
|
async probe() {
|
|
35576
35579
|
if (this.probeCache) return this.probeCache;
|
|
@@ -36593,6 +36596,174 @@ function jsonlExistsForCtx(ctx) {
|
|
|
36593
36596
|
// src/index.ts
|
|
36594
36597
|
init_claude_history();
|
|
36595
36598
|
|
|
36599
|
+
// src/tools/codex-history.ts
|
|
36600
|
+
var import_node_child_process5 = require("child_process");
|
|
36601
|
+
var DEFAULT_TIMEOUT_MS = 8e3;
|
|
36602
|
+
function rec2(v2) {
|
|
36603
|
+
return v2 && typeof v2 === "object" && !Array.isArray(v2) ? v2 : void 0;
|
|
36604
|
+
}
|
|
36605
|
+
function str2(v2) {
|
|
36606
|
+
return typeof v2 === "string" ? v2 : void 0;
|
|
36607
|
+
}
|
|
36608
|
+
function num2(v2) {
|
|
36609
|
+
return typeof v2 === "number" && Number.isFinite(v2) ? v2 : void 0;
|
|
36610
|
+
}
|
|
36611
|
+
function userInputText(content) {
|
|
36612
|
+
if (!Array.isArray(content)) return "";
|
|
36613
|
+
return content.map((c) => {
|
|
36614
|
+
const r = rec2(c);
|
|
36615
|
+
return r && r.type === "text" ? str2(r.text) ?? "" : "";
|
|
36616
|
+
}).filter(Boolean).join("");
|
|
36617
|
+
}
|
|
36618
|
+
function threadItemToHistoryMessages(item) {
|
|
36619
|
+
const it = rec2(item);
|
|
36620
|
+
if (!it) return [];
|
|
36621
|
+
switch (it.type) {
|
|
36622
|
+
case "userMessage": {
|
|
36623
|
+
const text = userInputText(it.content);
|
|
36624
|
+
return text ? [{ kind: "user-text", text, raw: item }] : [];
|
|
36625
|
+
}
|
|
36626
|
+
case "agentMessage": {
|
|
36627
|
+
const text = str2(it.text);
|
|
36628
|
+
return text ? [{ kind: "assistant-text", text, raw: item }] : [];
|
|
36629
|
+
}
|
|
36630
|
+
case "commandExecution": {
|
|
36631
|
+
const id = str2(it.id);
|
|
36632
|
+
if (!id) return [];
|
|
36633
|
+
const msgs = [
|
|
36634
|
+
{
|
|
36635
|
+
kind: "tool_call",
|
|
36636
|
+
tool: "commandExecution",
|
|
36637
|
+
toolUseId: id,
|
|
36638
|
+
input: { command: str2(it.command) ?? "" },
|
|
36639
|
+
raw: item
|
|
36640
|
+
}
|
|
36641
|
+
];
|
|
36642
|
+
if (it.status === "completed" || it.aggregatedOutput != null || it.exitCode != null) {
|
|
36643
|
+
const exit = num2(it.exitCode);
|
|
36644
|
+
const result = {
|
|
36645
|
+
kind: "tool_result",
|
|
36646
|
+
toolUseId: id,
|
|
36647
|
+
output: str2(it.aggregatedOutput) ?? "",
|
|
36648
|
+
raw: item
|
|
36649
|
+
};
|
|
36650
|
+
if (exit !== void 0 && exit !== 0) result.output = `${result.output ?? ""}
|
|
36651
|
+
(exit ${exit})`;
|
|
36652
|
+
msgs.push(result);
|
|
36653
|
+
}
|
|
36654
|
+
return msgs;
|
|
36655
|
+
}
|
|
36656
|
+
default:
|
|
36657
|
+
return [];
|
|
36658
|
+
}
|
|
36659
|
+
}
|
|
36660
|
+
async function queryCodexAppServer(cwd, method, params, deps) {
|
|
36661
|
+
const cmd = process.env.CODEX_BIN ?? "codex";
|
|
36662
|
+
const args = ["app-server", "--listen", "stdio://"];
|
|
36663
|
+
const proc = deps.spawnOverride ? deps.spawnOverride(cmd, args, cwd) : (0, import_node_child_process5.spawn)(cmd, args, { cwd, env: process.env, stdio: ["pipe", "pipe", "pipe"] });
|
|
36664
|
+
const client = new CodexAppServerClient(proc, {});
|
|
36665
|
+
const timeoutMs = deps.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
36666
|
+
let timer;
|
|
36667
|
+
const timeout = new Promise((_2, reject) => {
|
|
36668
|
+
timer = setTimeout(() => reject(new Error(`codex app-server ${method} timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
36669
|
+
});
|
|
36670
|
+
try {
|
|
36671
|
+
await Promise.race([
|
|
36672
|
+
(async () => {
|
|
36673
|
+
await client.request("initialize", {
|
|
36674
|
+
clientInfo: { name: "clawd", title: "clawd", version: "0" },
|
|
36675
|
+
capabilities: null
|
|
36676
|
+
});
|
|
36677
|
+
client.notify("initialized", {});
|
|
36678
|
+
})(),
|
|
36679
|
+
timeout
|
|
36680
|
+
]);
|
|
36681
|
+
return await Promise.race([client.request(method, params), timeout]);
|
|
36682
|
+
} finally {
|
|
36683
|
+
if (timer) clearTimeout(timer);
|
|
36684
|
+
if (proc.exitCode === null && proc.signalCode === null) proc.kill("SIGTERM");
|
|
36685
|
+
}
|
|
36686
|
+
}
|
|
36687
|
+
var CodexHistoryReader = class {
|
|
36688
|
+
deps;
|
|
36689
|
+
constructor(deps = {}) {
|
|
36690
|
+
this.deps = deps;
|
|
36691
|
+
}
|
|
36692
|
+
// v1 先返回 []:projects/list 非 session-scoped、不知 tool,跨-tool 项目浏览器合并排后续。
|
|
36693
|
+
// codex 旧会话仍能经 clawd 活跃列表(session:list, tool-agnostic) + read 打开。
|
|
36694
|
+
async listProjects() {
|
|
36695
|
+
return [];
|
|
36696
|
+
}
|
|
36697
|
+
async listSessions(args) {
|
|
36698
|
+
const res = rec2(
|
|
36699
|
+
await queryCodexAppServer(
|
|
36700
|
+
args.projectPath,
|
|
36701
|
+
"thread/list",
|
|
36702
|
+
{
|
|
36703
|
+
limit: 100,
|
|
36704
|
+
sortKey: "updated_at",
|
|
36705
|
+
sortDirection: "desc",
|
|
36706
|
+
archived: false,
|
|
36707
|
+
cwd: args.projectPath,
|
|
36708
|
+
useStateDbOnly: true
|
|
36709
|
+
},
|
|
36710
|
+
this.deps
|
|
36711
|
+
)
|
|
36712
|
+
);
|
|
36713
|
+
const data = res && Array.isArray(res.data) ? res.data : [];
|
|
36714
|
+
const out = [];
|
|
36715
|
+
for (const entry of data) {
|
|
36716
|
+
const e = rec2(entry);
|
|
36717
|
+
const id = e && str2(e.id);
|
|
36718
|
+
if (!e || !id) continue;
|
|
36719
|
+
const updatedAtMs = Math.round((num2(e.updatedAt) ?? 0) * 1e3);
|
|
36720
|
+
out.push({
|
|
36721
|
+
toolSessionId: id,
|
|
36722
|
+
summary: str2(e.preview) || "(\u7A7A\u4F1A\u8BDD)",
|
|
36723
|
+
messageCount: 0,
|
|
36724
|
+
// thread/list 不提供条数;活跃/read 时才知
|
|
36725
|
+
updatedAt: new Date(updatedAtMs).toISOString()
|
|
36726
|
+
});
|
|
36727
|
+
}
|
|
36728
|
+
return out;
|
|
36729
|
+
}
|
|
36730
|
+
async read(args) {
|
|
36731
|
+
const res = rec2(
|
|
36732
|
+
await queryCodexAppServer(
|
|
36733
|
+
args.cwd,
|
|
36734
|
+
"thread/read",
|
|
36735
|
+
{ threadId: args.toolSessionId, includeTurns: true },
|
|
36736
|
+
this.deps
|
|
36737
|
+
)
|
|
36738
|
+
);
|
|
36739
|
+
const thread = res && rec2(res.thread);
|
|
36740
|
+
const turns = thread && Array.isArray(thread.turns) ? thread.turns : [];
|
|
36741
|
+
const messages = [];
|
|
36742
|
+
for (const turn of turns) {
|
|
36743
|
+
const t = rec2(turn);
|
|
36744
|
+
const items = t && Array.isArray(t.items) ? t.items : [];
|
|
36745
|
+
for (const item of items) messages.push(...threadItemToHistoryMessages(item));
|
|
36746
|
+
}
|
|
36747
|
+
const total = messages.length;
|
|
36748
|
+
const limit = args.limit ?? total;
|
|
36749
|
+
const offset = typeof args.offset === "number" ? Math.min(Math.max(0, args.offset), total) : Math.max(0, total - limit);
|
|
36750
|
+
return { messages: messages.slice(offset, offset + limit), total, offset };
|
|
36751
|
+
}
|
|
36752
|
+
// codex 无 sidechain 子 agent / file-history-snapshot → 全 stub 空(对齐 claude-history 同方法空返回)
|
|
36753
|
+
async listSubagents() {
|
|
36754
|
+
return [];
|
|
36755
|
+
}
|
|
36756
|
+
async readSubagent() {
|
|
36757
|
+
return { messages: [] };
|
|
36758
|
+
}
|
|
36759
|
+
computeRewindDiff() {
|
|
36760
|
+
return { canRewind: false, files: [], totalInsertions: 0, totalDeletions: 0 };
|
|
36761
|
+
}
|
|
36762
|
+
listRewindableUserMessageIds() {
|
|
36763
|
+
return [];
|
|
36764
|
+
}
|
|
36765
|
+
};
|
|
36766
|
+
|
|
36596
36767
|
// src/workspace/browser.ts
|
|
36597
36768
|
var import_node_fs12 = __toESM(require("fs"), 1);
|
|
36598
36769
|
var import_node_os6 = __toESM(require("os"), 1);
|
|
@@ -39592,7 +39763,7 @@ var StateFileManager = class {
|
|
|
39592
39763
|
var import_node_fs24 = __toESM(require("fs"), 1);
|
|
39593
39764
|
var import_node_path25 = __toESM(require("path"), 1);
|
|
39594
39765
|
var import_node_crypto7 = __toESM(require("crypto"), 1);
|
|
39595
|
-
var
|
|
39766
|
+
var import_node_child_process8 = require("child_process");
|
|
39596
39767
|
|
|
39597
39768
|
// src/tunnel/tunnel-store.ts
|
|
39598
39769
|
var import_node_fs21 = __toESM(require("fs"), 1);
|
|
@@ -39728,7 +39899,7 @@ function escape(v2) {
|
|
|
39728
39899
|
var import_node_fs22 = __toESM(require("fs"), 1);
|
|
39729
39900
|
var import_node_os11 = __toESM(require("os"), 1);
|
|
39730
39901
|
var import_node_path23 = __toESM(require("path"), 1);
|
|
39731
|
-
var
|
|
39902
|
+
var import_node_child_process6 = require("child_process");
|
|
39732
39903
|
var import_node_stream2 = require("stream");
|
|
39733
39904
|
var import_promises3 = require("stream/promises");
|
|
39734
39905
|
var FRPC_VERSION = "0.68.0";
|
|
@@ -39828,7 +39999,7 @@ async function extractFrpcFromTarball(tarball, binDir, version2, platform, destB
|
|
|
39828
39999
|
import_node_fs22.default.mkdirSync(work, { recursive: true });
|
|
39829
40000
|
try {
|
|
39830
40001
|
await new Promise((resolve6, reject) => {
|
|
39831
|
-
const proc = (0,
|
|
40002
|
+
const proc = (0, import_node_child_process6.spawn)("tar", ["xzf", tarball, "-C", work], { stdio: "pipe" });
|
|
39832
40003
|
proc.on("error", reject);
|
|
39833
40004
|
proc.on("exit", (code) => code === 0 ? resolve6() : reject(new Error(`tar exited ${code}`)));
|
|
39834
40005
|
});
|
|
@@ -39846,7 +40017,7 @@ async function extractFrpcFromTarball(tarball, binDir, version2, platform, destB
|
|
|
39846
40017
|
// src/tunnel/frpc-process.ts
|
|
39847
40018
|
var import_node_fs23 = __toESM(require("fs"), 1);
|
|
39848
40019
|
var import_node_path24 = __toESM(require("path"), 1);
|
|
39849
|
-
var
|
|
40020
|
+
var import_node_child_process7 = require("child_process");
|
|
39850
40021
|
function frpcPidFilePath(dataDir) {
|
|
39851
40022
|
return import_node_path24.default.join(dataDir, "frpc.pid");
|
|
39852
40023
|
}
|
|
@@ -39932,7 +40103,7 @@ async function killStaleFrpc(deps) {
|
|
|
39932
40103
|
async function defaultScanFrpcPidsByCmdline(tomlPath, logger) {
|
|
39933
40104
|
if (process.platform === "win32") return [];
|
|
39934
40105
|
return new Promise((resolve6) => {
|
|
39935
|
-
const ps = (0,
|
|
40106
|
+
const ps = (0, import_node_child_process7.spawn)("ps", ["-axo", "pid=,command="], { stdio: ["ignore", "pipe", "ignore"] });
|
|
39936
40107
|
let buf = "";
|
|
39937
40108
|
ps.stdout.on("data", (c) => {
|
|
39938
40109
|
buf += c.toString();
|
|
@@ -40101,7 +40272,7 @@ var TunnelManager = class {
|
|
|
40101
40272
|
logLevel: "info"
|
|
40102
40273
|
});
|
|
40103
40274
|
await import_node_fs24.default.promises.writeFile(tomlPath, toml, { mode: 384 });
|
|
40104
|
-
const proc = (this.deps.spawnImpl ??
|
|
40275
|
+
const proc = (this.deps.spawnImpl ?? import_node_child_process8.spawn)(frpcBin, ["-c", tomlPath], {
|
|
40105
40276
|
stdio: ["ignore", "pipe", "pipe"]
|
|
40106
40277
|
});
|
|
40107
40278
|
const logFilePath = import_node_path25.default.join(this.deps.dataDir, "frpc.log");
|
|
@@ -41158,7 +41329,7 @@ function assertGuestPath(ctx, absPath, personaRoot, method, usersRoot) {
|
|
|
41158
41329
|
}
|
|
41159
41330
|
}
|
|
41160
41331
|
function buildHistoryHandlers(deps) {
|
|
41161
|
-
const { manager, history, store, personaRoot, usersRoot } = deps;
|
|
41332
|
+
const { manager, history, getHistoryReader, store, personaRoot, usersRoot } = deps;
|
|
41162
41333
|
const projects = async (_frame, _client, ctx) => {
|
|
41163
41334
|
const list2 = await history.listProjects();
|
|
41164
41335
|
if (ctx?.principal.kind === "guest" && personaRoot) {
|
|
@@ -41202,7 +41373,7 @@ function buildHistoryHandlers(deps) {
|
|
|
41202
41373
|
response: { type: "history:read", messages: [], total: 0, offset: 0 }
|
|
41203
41374
|
};
|
|
41204
41375
|
}
|
|
41205
|
-
const res = await
|
|
41376
|
+
const res = await getHistoryReader(f.tool ?? "claude").read({
|
|
41206
41377
|
cwd: f.cwd,
|
|
41207
41378
|
toolSessionId: f.toolSessionId,
|
|
41208
41379
|
limit: args.limit,
|
|
@@ -41337,11 +41508,11 @@ init_protocol();
|
|
|
41337
41508
|
init_protocol();
|
|
41338
41509
|
|
|
41339
41510
|
// src/workspace/git.ts
|
|
41340
|
-
var
|
|
41511
|
+
var import_node_child_process9 = require("child_process");
|
|
41341
41512
|
var import_node_fs29 = __toESM(require("fs"), 1);
|
|
41342
41513
|
var import_node_path31 = __toESM(require("path"), 1);
|
|
41343
41514
|
var import_node_util = require("util");
|
|
41344
|
-
var pexec = (0, import_node_util.promisify)(
|
|
41515
|
+
var pexec = (0, import_node_util.promisify)(import_node_child_process9.execFile);
|
|
41345
41516
|
function normalizePath(p2) {
|
|
41346
41517
|
const resolved = import_node_path31.default.resolve(p2);
|
|
41347
41518
|
try {
|
|
@@ -42535,22 +42706,22 @@ function pickExtId(frame) {
|
|
|
42535
42706
|
}
|
|
42536
42707
|
return extId;
|
|
42537
42708
|
}
|
|
42538
|
-
function composeState(
|
|
42539
|
-
if (
|
|
42540
|
-
if (manifestMode(
|
|
42709
|
+
function composeState(rec3, running, crashed, getPort) {
|
|
42710
|
+
if (rec3.state === "invalid") return rec3;
|
|
42711
|
+
if (manifestMode(rec3.manifest) === "hosted") {
|
|
42541
42712
|
return {
|
|
42542
|
-
...
|
|
42713
|
+
...rec3,
|
|
42543
42714
|
state: "running",
|
|
42544
|
-
target: { kind: "hosted", url:
|
|
42715
|
+
target: { kind: "hosted", url: rec3.manifest.entry.url }
|
|
42545
42716
|
};
|
|
42546
42717
|
}
|
|
42547
|
-
if (running.has(
|
|
42548
|
-
const port = getPort(
|
|
42549
|
-
if (port == null) return
|
|
42550
|
-
return { ...
|
|
42718
|
+
if (running.has(rec3.extId)) {
|
|
42719
|
+
const port = getPort(rec3.extId);
|
|
42720
|
+
if (port == null) return rec3;
|
|
42721
|
+
return { ...rec3, state: "running", target: { kind: "local", port } };
|
|
42551
42722
|
}
|
|
42552
|
-
if (crashed.has(
|
|
42553
|
-
return
|
|
42723
|
+
if (crashed.has(rec3.extId)) return { ...rec3, state: "crashed" };
|
|
42724
|
+
return rec3;
|
|
42554
42725
|
}
|
|
42555
42726
|
function buildExtensionHandlers(deps) {
|
|
42556
42727
|
const list = async (_frame, _client, ctx) => {
|
|
@@ -42767,7 +42938,7 @@ function buildExtensionHandlers(deps) {
|
|
|
42767
42938
|
}
|
|
42768
42939
|
|
|
42769
42940
|
// src/app-builder/kill-port.ts
|
|
42770
|
-
var
|
|
42941
|
+
var import_node_child_process10 = require("child_process");
|
|
42771
42942
|
async function killPortOccupants(port, ownedPids, logger) {
|
|
42772
42943
|
let pids;
|
|
42773
42944
|
try {
|
|
@@ -42809,7 +42980,7 @@ async function killPortOccupants(port, ownedPids, logger) {
|
|
|
42809
42980
|
}
|
|
42810
42981
|
function listPidsOnPort(port) {
|
|
42811
42982
|
return new Promise((resolve6, reject) => {
|
|
42812
|
-
(0,
|
|
42983
|
+
(0, import_node_child_process10.execFile)(
|
|
42813
42984
|
"lsof",
|
|
42814
42985
|
["-ti", `:${port}`],
|
|
42815
42986
|
{ timeout: 3e3 },
|
|
@@ -42881,7 +43052,7 @@ var PublishJobRegistry = class {
|
|
|
42881
43052
|
};
|
|
42882
43053
|
|
|
42883
43054
|
// src/app-builder/publish-job-runner.ts
|
|
42884
|
-
var
|
|
43055
|
+
var import_node_child_process11 = require("child_process");
|
|
42885
43056
|
var import_node_fs30 = require("fs");
|
|
42886
43057
|
var import_node_path38 = require("path");
|
|
42887
43058
|
|
|
@@ -42910,7 +43081,7 @@ function tailStderrLines(buf, n) {
|
|
|
42910
43081
|
// src/app-builder/publish-job-runner.ts
|
|
42911
43082
|
async function startPublishJob(deps, args) {
|
|
42912
43083
|
const { registry: registry2, projectDir } = deps;
|
|
42913
|
-
const
|
|
43084
|
+
const spawn11 = deps.spawnImpl ?? import_node_child_process11.spawn;
|
|
42914
43085
|
if (registry2.has(args.name)) {
|
|
42915
43086
|
return { jobId: registry2.get(args.name).jobId, status: "already-publishing" };
|
|
42916
43087
|
}
|
|
@@ -42922,7 +43093,7 @@ async function startPublishJob(deps, args) {
|
|
|
42922
43093
|
} catch {
|
|
42923
43094
|
logStream = null;
|
|
42924
43095
|
}
|
|
42925
|
-
const child =
|
|
43096
|
+
const child = spawn11("bash", [args.scriptPath, projDir], {
|
|
42926
43097
|
cwd: projDir,
|
|
42927
43098
|
env: process.env,
|
|
42928
43099
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -43799,7 +43970,7 @@ function buildMethodHandlers(deps) {
|
|
|
43799
43970
|
|
|
43800
43971
|
// src/app-builder/project-store.ts
|
|
43801
43972
|
var import_node_fs32 = require("fs");
|
|
43802
|
-
var
|
|
43973
|
+
var import_node_child_process12 = require("child_process");
|
|
43803
43974
|
var import_node_path42 = require("path");
|
|
43804
43975
|
init_protocol();
|
|
43805
43976
|
var PROJECTS_DIR = "projects";
|
|
@@ -43906,7 +44077,7 @@ var ProjectStore = class {
|
|
|
43906
44077
|
const scriptPath = (0, import_node_path42.join)(personaRoot, SCAFFOLD_SCRIPT_REL);
|
|
43907
44078
|
const destDir = this.projectDir(name);
|
|
43908
44079
|
return await new Promise((resolve6, reject) => {
|
|
43909
|
-
const child = (0,
|
|
44080
|
+
const child = (0, import_node_child_process12.spawn)("bash", [scriptPath, name, template, destDir], {
|
|
43910
44081
|
cwd: personaRoot,
|
|
43911
44082
|
env: { ...process.env, PATH: process.env.PATH ?? "" },
|
|
43912
44083
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -44011,7 +44182,7 @@ var ProjectStore = class {
|
|
|
44011
44182
|
};
|
|
44012
44183
|
|
|
44013
44184
|
// src/app-builder/dev-server-supervisor.ts
|
|
44014
|
-
var
|
|
44185
|
+
var import_node_child_process13 = require("child_process");
|
|
44015
44186
|
var import_node_events2 = require("events");
|
|
44016
44187
|
var DEFAULT_READY_PATTERN = /Local:\s+https?:\/\/|Nest application successfully started|server listening on/i;
|
|
44017
44188
|
var DevServerSupervisor = class extends import_node_events2.EventEmitter {
|
|
@@ -44048,7 +44219,7 @@ var DevServerSupervisor = class extends import_node_events2.EventEmitter {
|
|
|
44048
44219
|
tunnelHost: args.tunnelHost,
|
|
44049
44220
|
devCommand: cmd
|
|
44050
44221
|
});
|
|
44051
|
-
const child = (0,
|
|
44222
|
+
const child = (0, import_node_child_process13.spawn)("sh", ["-c", cmd], {
|
|
44052
44223
|
cwd: args.cwd,
|
|
44053
44224
|
env,
|
|
44054
44225
|
stdio: "pipe",
|
|
@@ -44440,7 +44611,7 @@ function computeGrantForFrame(method, frame) {
|
|
|
44440
44611
|
}
|
|
44441
44612
|
|
|
44442
44613
|
// src/extension/runtime.ts
|
|
44443
|
-
var
|
|
44614
|
+
var import_node_child_process14 = require("child_process");
|
|
44444
44615
|
var import_node_path43 = __toESM(require("path"), 1);
|
|
44445
44616
|
var import_promises10 = require("timers/promises");
|
|
44446
44617
|
|
|
@@ -44527,17 +44698,17 @@ var Runtime = class {
|
|
|
44527
44698
|
const existing = this.handles.get(extId);
|
|
44528
44699
|
if (existing) return { kind: "local", port: existing.port };
|
|
44529
44700
|
const records = await loadAll(this.root);
|
|
44530
|
-
const
|
|
44531
|
-
if (!
|
|
44532
|
-
if (
|
|
44533
|
-
throw new RuntimeError("INVALID_MANIFEST",
|
|
44534
|
-
if (manifestMode(
|
|
44535
|
-
return { kind: "hosted", url:
|
|
44701
|
+
const rec3 = records.find((r) => r.extId === extId);
|
|
44702
|
+
if (!rec3) throw new RuntimeError("NOT_FOUND", `extension ${extId} not installed`);
|
|
44703
|
+
if (rec3.state === "invalid")
|
|
44704
|
+
throw new RuntimeError("INVALID_MANIFEST", rec3.invalidReason);
|
|
44705
|
+
if (manifestMode(rec3.manifest) === "hosted") {
|
|
44706
|
+
return { kind: "hosted", url: rec3.manifest.entry.url };
|
|
44536
44707
|
}
|
|
44537
44708
|
const port = await this.allocator.allocate().catch(() => {
|
|
44538
44709
|
throw new RuntimeError("PORT_EXHAUSTED", "no free port in configured range");
|
|
44539
44710
|
});
|
|
44540
|
-
const startCommand =
|
|
44711
|
+
const startCommand = rec3.manifest.runtime.startCommand;
|
|
44541
44712
|
const cmd = startCommand.replace(
|
|
44542
44713
|
/\$CLAWOS_EXT_PORT/g,
|
|
44543
44714
|
String(port)
|
|
@@ -44548,7 +44719,7 @@ var Runtime = class {
|
|
|
44548
44719
|
CLAWOS_EXT_PORT: String(port),
|
|
44549
44720
|
CLAWOS_EXT_ID: extId
|
|
44550
44721
|
};
|
|
44551
|
-
const child = (0,
|
|
44722
|
+
const child = (0, import_node_child_process14.spawn)("sh", ["-c", cmd], {
|
|
44552
44723
|
cwd: dir,
|
|
44553
44724
|
env,
|
|
44554
44725
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -45054,7 +45225,7 @@ async function startDaemon(config) {
|
|
|
45054
45225
|
onReady: (tsid) => manager.dispatchReadyDetected(tsid)
|
|
45055
45226
|
}) : new ClaudeAdapter({ logger, historyReader: new ClaudeHistoryReader() });
|
|
45056
45227
|
registerAdapter("claude", claudeAdapter);
|
|
45057
|
-
registerAdapter("codex", new CodexAdapter({ logger }));
|
|
45228
|
+
registerAdapter("codex", new CodexAdapter({ logger, historyReader: new CodexHistoryReader() }));
|
|
45058
45229
|
const personaRegistry = new PersonaRegistry(personaStore);
|
|
45059
45230
|
const personaManager = new PersonaManager({
|
|
45060
45231
|
store: personaStore,
|
|
@@ -45134,6 +45305,8 @@ async function startDaemon(config) {
|
|
|
45134
45305
|
skills,
|
|
45135
45306
|
agents,
|
|
45136
45307
|
history,
|
|
45308
|
+
// history:read 按 session.tool 路由:codex → adapter.historyReader(CodexHistoryReader);缺省 claude。
|
|
45309
|
+
getHistoryReader: (tool) => getAdapter(tool).historyReader ?? history,
|
|
45137
45310
|
observer,
|
|
45138
45311
|
getAdapter,
|
|
45139
45312
|
store,
|
package/package.json
CHANGED