mcp-agents-memory 0.9.12 → 0.9.14
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/.env.example +3 -0
- package/README.ko.md +298 -0
- package/README.md +158 -190
- package/build/index.js +524 -291
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -1655,11 +1655,11 @@ var require_pg_connection_string = __commonJS({
|
|
|
1655
1655
|
config2.client_encoding = result.searchParams.get("encoding");
|
|
1656
1656
|
return config2;
|
|
1657
1657
|
}
|
|
1658
|
-
const
|
|
1658
|
+
const hostname11 = dummyHost ? "" : result.hostname;
|
|
1659
1659
|
if (!config2.host) {
|
|
1660
|
-
config2.host = decodeURIComponent(
|
|
1661
|
-
} else if (
|
|
1662
|
-
result.pathname =
|
|
1660
|
+
config2.host = decodeURIComponent(hostname11);
|
|
1661
|
+
} else if (hostname11 && /^%2f/i.test(hostname11)) {
|
|
1662
|
+
result.pathname = hostname11 + result.pathname;
|
|
1663
1663
|
}
|
|
1664
1664
|
if (!config2.port) {
|
|
1665
1665
|
config2.port = result.port;
|
|
@@ -1675,15 +1675,15 @@ var require_pg_connection_string = __commonJS({
|
|
|
1675
1675
|
if (config2.sslcert || config2.sslkey || config2.sslrootcert || config2.sslmode) {
|
|
1676
1676
|
config2.ssl = {};
|
|
1677
1677
|
}
|
|
1678
|
-
const
|
|
1678
|
+
const fs11 = config2.sslcert || config2.sslkey || config2.sslrootcert ? __require("fs") : null;
|
|
1679
1679
|
if (config2.sslcert) {
|
|
1680
|
-
config2.ssl.cert =
|
|
1680
|
+
config2.ssl.cert = fs11.readFileSync(config2.sslcert).toString();
|
|
1681
1681
|
}
|
|
1682
1682
|
if (config2.sslkey) {
|
|
1683
|
-
config2.ssl.key =
|
|
1683
|
+
config2.ssl.key = fs11.readFileSync(config2.sslkey).toString();
|
|
1684
1684
|
}
|
|
1685
1685
|
if (config2.sslrootcert) {
|
|
1686
|
-
config2.ssl.ca =
|
|
1686
|
+
config2.ssl.ca = fs11.readFileSync(config2.sslrootcert).toString();
|
|
1687
1687
|
}
|
|
1688
1688
|
if (options.useLibpqCompat && config2.uselibpqcompat) {
|
|
1689
1689
|
throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");
|
|
@@ -3378,7 +3378,7 @@ var require_split2 = __commonJS({
|
|
|
3378
3378
|
}
|
|
3379
3379
|
cb();
|
|
3380
3380
|
}
|
|
3381
|
-
function
|
|
3381
|
+
function flush2(cb) {
|
|
3382
3382
|
this[kLast] += this[kDecoder].end();
|
|
3383
3383
|
if (this[kLast]) {
|
|
3384
3384
|
try {
|
|
@@ -3424,7 +3424,7 @@ var require_split2 = __commonJS({
|
|
|
3424
3424
|
options = Object.assign({}, options);
|
|
3425
3425
|
options.autoDestroy = true;
|
|
3426
3426
|
options.transform = transform2;
|
|
3427
|
-
options.flush =
|
|
3427
|
+
options.flush = flush2;
|
|
3428
3428
|
options.readableObjectMode = true;
|
|
3429
3429
|
const stream = new Transform(options);
|
|
3430
3430
|
stream[kLast] = "";
|
|
@@ -3448,7 +3448,7 @@ var require_split2 = __commonJS({
|
|
|
3448
3448
|
var require_helper = __commonJS({
|
|
3449
3449
|
"node_modules/pgpass/lib/helper.js"(exports, module) {
|
|
3450
3450
|
"use strict";
|
|
3451
|
-
var
|
|
3451
|
+
var path11 = __require("path");
|
|
3452
3452
|
var Stream2 = __require("stream").Stream;
|
|
3453
3453
|
var split = require_split2();
|
|
3454
3454
|
var util2 = __require("util");
|
|
@@ -3487,7 +3487,7 @@ var require_helper = __commonJS({
|
|
|
3487
3487
|
};
|
|
3488
3488
|
module.exports.getFileName = function(rawEnv) {
|
|
3489
3489
|
var env = rawEnv || process.env;
|
|
3490
|
-
var file = env.PGPASSFILE || (isWin ?
|
|
3490
|
+
var file = env.PGPASSFILE || (isWin ? path11.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path11.join(env.HOME || "./", ".pgpass"));
|
|
3491
3491
|
return file;
|
|
3492
3492
|
};
|
|
3493
3493
|
module.exports.usePgPass = function(stats, fname) {
|
|
@@ -3619,16 +3619,16 @@ var require_helper = __commonJS({
|
|
|
3619
3619
|
var require_lib = __commonJS({
|
|
3620
3620
|
"node_modules/pgpass/lib/index.js"(exports, module) {
|
|
3621
3621
|
"use strict";
|
|
3622
|
-
var
|
|
3623
|
-
var
|
|
3622
|
+
var path11 = __require("path");
|
|
3623
|
+
var fs11 = __require("fs");
|
|
3624
3624
|
var helper = require_helper();
|
|
3625
3625
|
module.exports = function(connInfo, cb) {
|
|
3626
3626
|
var file = helper.getFileName();
|
|
3627
|
-
|
|
3627
|
+
fs11.stat(file, function(err2, stat) {
|
|
3628
3628
|
if (err2 || !helper.usePgPass(stat, file)) {
|
|
3629
3629
|
return cb(void 0);
|
|
3630
3630
|
}
|
|
3631
|
-
var st =
|
|
3631
|
+
var st = fs11.createReadStream(file);
|
|
3632
3632
|
helper.getPassword(connInfo, st, cb);
|
|
3633
3633
|
});
|
|
3634
3634
|
};
|
|
@@ -13224,11 +13224,11 @@ var require_agent = __commonJS({
|
|
|
13224
13224
|
};
|
|
13225
13225
|
})();
|
|
13226
13226
|
var WINDOWS_PIPE_REGEX = /^[/\\][/\\]\.[/\\]pipe[/\\].+/;
|
|
13227
|
-
function createAgent(
|
|
13228
|
-
if (process.platform === "win32" && !WINDOWS_PIPE_REGEX.test(
|
|
13229
|
-
return
|
|
13227
|
+
function createAgent(path11) {
|
|
13228
|
+
if (process.platform === "win32" && !WINDOWS_PIPE_REGEX.test(path11)) {
|
|
13229
|
+
return path11 === "pageant" ? new PageantAgent() : new CygwinAgent(path11);
|
|
13230
13230
|
}
|
|
13231
|
-
return new OpenSSHAgent(
|
|
13231
|
+
return new OpenSSHAgent(path11);
|
|
13232
13232
|
}
|
|
13233
13233
|
var AgentProtocol = (() => {
|
|
13234
13234
|
const SSH_AGENTC_REQUEST_IDENTITIES = 11;
|
|
@@ -17103,7 +17103,7 @@ var require_Protocol = __commonJS({
|
|
|
17103
17103
|
sendPacket(this, this._packetRW.write.finalize(packet));
|
|
17104
17104
|
});
|
|
17105
17105
|
}
|
|
17106
|
-
authHostbased(username, pubKey,
|
|
17106
|
+
authHostbased(username, pubKey, hostname11, userlocal, keyAlgo, cbSign) {
|
|
17107
17107
|
if (this._server)
|
|
17108
17108
|
throw new Error("Client-only method called in server mode");
|
|
17109
17109
|
pubKey = parseKey(pubKey);
|
|
@@ -17122,7 +17122,7 @@ var require_Protocol = __commonJS({
|
|
|
17122
17122
|
const pubKeyLen = pubKey.length;
|
|
17123
17123
|
const sessionID = this._kex.sessionID;
|
|
17124
17124
|
const sesLen = sessionID.length;
|
|
17125
|
-
const hostnameLen = Buffer.byteLength(
|
|
17125
|
+
const hostnameLen = Buffer.byteLength(hostname11);
|
|
17126
17126
|
const userlocalLen = Buffer.byteLength(userlocal);
|
|
17127
17127
|
const data = Buffer.allocUnsafe(
|
|
17128
17128
|
4 + sesLen + 1 + 4 + userLen + 4 + 14 + 4 + 9 + 4 + algoLen + 4 + pubKeyLen + 4 + hostnameLen + 4 + userlocalLen
|
|
@@ -17142,7 +17142,7 @@ var require_Protocol = __commonJS({
|
|
|
17142
17142
|
writeUInt32BE(data, pubKeyLen, p += algoLen);
|
|
17143
17143
|
data.set(pubKey, p += 4);
|
|
17144
17144
|
writeUInt32BE(data, hostnameLen, p += pubKeyLen);
|
|
17145
|
-
data.utf8Write(
|
|
17145
|
+
data.utf8Write(hostname11, p += 4, hostnameLen);
|
|
17146
17146
|
writeUInt32BE(data, userlocalLen, p += hostnameLen);
|
|
17147
17147
|
data.utf8Write(userlocal, p += 4, userlocalLen);
|
|
17148
17148
|
cbSign(data, (signature) => {
|
|
@@ -18203,8 +18203,8 @@ var require_SFTP = __commonJS({
|
|
|
18203
18203
|
"node_modules/ssh2/lib/protocol/SFTP.js"(exports, module) {
|
|
18204
18204
|
"use strict";
|
|
18205
18205
|
var EventEmitter = __require("events");
|
|
18206
|
-
var
|
|
18207
|
-
var { constants } =
|
|
18206
|
+
var fs11 = __require("fs");
|
|
18207
|
+
var { constants } = fs11;
|
|
18208
18208
|
var {
|
|
18209
18209
|
Readable: ReadableStream2,
|
|
18210
18210
|
Writable: WritableStream
|
|
@@ -18472,17 +18472,17 @@ var require_SFTP = __commonJS({
|
|
|
18472
18472
|
// ===========================================================================
|
|
18473
18473
|
// Client-specific ===========================================================
|
|
18474
18474
|
// ===========================================================================
|
|
18475
|
-
createReadStream(
|
|
18475
|
+
createReadStream(path11, options) {
|
|
18476
18476
|
if (this.server)
|
|
18477
18477
|
throw new Error("Client-only method called in server mode");
|
|
18478
|
-
return new ReadStream(this,
|
|
18478
|
+
return new ReadStream(this, path11, options);
|
|
18479
18479
|
}
|
|
18480
|
-
createWriteStream(
|
|
18480
|
+
createWriteStream(path11, options) {
|
|
18481
18481
|
if (this.server)
|
|
18482
18482
|
throw new Error("Client-only method called in server mode");
|
|
18483
|
-
return new WriteStream(this,
|
|
18483
|
+
return new WriteStream(this, path11, options);
|
|
18484
18484
|
}
|
|
18485
|
-
open(
|
|
18485
|
+
open(path11, flags_, attrs, cb) {
|
|
18486
18486
|
if (this.server)
|
|
18487
18487
|
throw new Error("Client-only method called in server mode");
|
|
18488
18488
|
if (typeof attrs === "function") {
|
|
@@ -18501,7 +18501,7 @@ var require_SFTP = __commonJS({
|
|
|
18501
18501
|
attrsFlags = attrs.flags;
|
|
18502
18502
|
attrsLen = attrs.nb;
|
|
18503
18503
|
}
|
|
18504
|
-
const pathLen = Buffer.byteLength(
|
|
18504
|
+
const pathLen = Buffer.byteLength(path11);
|
|
18505
18505
|
let p = 9;
|
|
18506
18506
|
const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen + 4 + 4 + attrsLen);
|
|
18507
18507
|
writeUInt32BE(buf, buf.length - 4, 0);
|
|
@@ -18509,7 +18509,7 @@ var require_SFTP = __commonJS({
|
|
|
18509
18509
|
const reqid = this._writeReqid = this._writeReqid + 1 & MAX_REQID;
|
|
18510
18510
|
writeUInt32BE(buf, reqid, 5);
|
|
18511
18511
|
writeUInt32BE(buf, pathLen, p);
|
|
18512
|
-
buf.utf8Write(
|
|
18512
|
+
buf.utf8Write(path11, p += 4, pathLen);
|
|
18513
18513
|
writeUInt32BE(buf, flags, p += pathLen);
|
|
18514
18514
|
writeUInt32BE(buf, attrsFlags, p += 4);
|
|
18515
18515
|
if (attrsLen) {
|
|
@@ -18633,14 +18633,14 @@ var require_SFTP = __commonJS({
|
|
|
18633
18633
|
fastGet(remotePath, localPath, opts, cb) {
|
|
18634
18634
|
if (this.server)
|
|
18635
18635
|
throw new Error("Client-only method called in server mode");
|
|
18636
|
-
fastXfer(this,
|
|
18636
|
+
fastXfer(this, fs11, remotePath, localPath, opts, cb);
|
|
18637
18637
|
}
|
|
18638
18638
|
fastPut(localPath, remotePath, opts, cb) {
|
|
18639
18639
|
if (this.server)
|
|
18640
18640
|
throw new Error("Client-only method called in server mode");
|
|
18641
|
-
fastXfer(
|
|
18641
|
+
fastXfer(fs11, this, localPath, remotePath, opts, cb);
|
|
18642
18642
|
}
|
|
18643
|
-
readFile(
|
|
18643
|
+
readFile(path11, options, callback_) {
|
|
18644
18644
|
if (this.server)
|
|
18645
18645
|
throw new Error("Client-only method called in server mode");
|
|
18646
18646
|
let callback;
|
|
@@ -18713,13 +18713,13 @@ var require_SFTP = __commonJS({
|
|
|
18713
18713
|
return callback && callback(er, buffer);
|
|
18714
18714
|
});
|
|
18715
18715
|
};
|
|
18716
|
-
this.open(
|
|
18716
|
+
this.open(path11, flag, 438, (er, handle_) => {
|
|
18717
18717
|
if (er)
|
|
18718
18718
|
return callback && callback(er);
|
|
18719
18719
|
handle = handle_;
|
|
18720
18720
|
const tryStat = (er2, st) => {
|
|
18721
18721
|
if (er2) {
|
|
18722
|
-
this.stat(
|
|
18722
|
+
this.stat(path11, (er_, st_) => {
|
|
18723
18723
|
if (er_) {
|
|
18724
18724
|
return this.close(handle, () => {
|
|
18725
18725
|
callback && callback(er2);
|
|
@@ -18740,7 +18740,7 @@ var require_SFTP = __commonJS({
|
|
|
18740
18740
|
this.fstat(handle, tryStat);
|
|
18741
18741
|
});
|
|
18742
18742
|
}
|
|
18743
|
-
writeFile(
|
|
18743
|
+
writeFile(path11, data, options, callback_) {
|
|
18744
18744
|
if (this.server)
|
|
18745
18745
|
throw new Error("Client-only method called in server mode");
|
|
18746
18746
|
let callback;
|
|
@@ -18759,7 +18759,7 @@ var require_SFTP = __commonJS({
|
|
|
18759
18759
|
if (options.encoding && !Buffer.isEncoding(options.encoding))
|
|
18760
18760
|
throw new Error(`Unknown encoding: ${options.encoding}`);
|
|
18761
18761
|
const flag = options.flag || "w";
|
|
18762
|
-
this.open(
|
|
18762
|
+
this.open(path11, flag, options.mode, (openErr, handle) => {
|
|
18763
18763
|
if (openErr) {
|
|
18764
18764
|
callback && callback(openErr);
|
|
18765
18765
|
} else {
|
|
@@ -18768,7 +18768,7 @@ var require_SFTP = __commonJS({
|
|
|
18768
18768
|
if (position === null) {
|
|
18769
18769
|
const tryStat = (er, st) => {
|
|
18770
18770
|
if (er) {
|
|
18771
|
-
this.stat(
|
|
18771
|
+
this.stat(path11, (er_, st_) => {
|
|
18772
18772
|
if (er_) {
|
|
18773
18773
|
return this.close(handle, () => {
|
|
18774
18774
|
callback && callback(er);
|
|
@@ -18787,7 +18787,7 @@ var require_SFTP = __commonJS({
|
|
|
18787
18787
|
}
|
|
18788
18788
|
});
|
|
18789
18789
|
}
|
|
18790
|
-
appendFile(
|
|
18790
|
+
appendFile(path11, data, options, callback_) {
|
|
18791
18791
|
if (this.server)
|
|
18792
18792
|
throw new Error("Client-only method called in server mode");
|
|
18793
18793
|
let callback;
|
|
@@ -18805,12 +18805,12 @@ var require_SFTP = __commonJS({
|
|
|
18805
18805
|
throw new TypeError("Bad arguments");
|
|
18806
18806
|
if (!options.flag)
|
|
18807
18807
|
options = Object.assign({ flag: "a" }, options);
|
|
18808
|
-
this.writeFile(
|
|
18808
|
+
this.writeFile(path11, data, options, callback);
|
|
18809
18809
|
}
|
|
18810
|
-
exists(
|
|
18810
|
+
exists(path11, cb) {
|
|
18811
18811
|
if (this.server)
|
|
18812
18812
|
throw new Error("Client-only method called in server mode");
|
|
18813
|
-
this.stat(
|
|
18813
|
+
this.stat(path11, (err2) => {
|
|
18814
18814
|
cb && cb(err2 ? false : true);
|
|
18815
18815
|
});
|
|
18816
18816
|
}
|
|
@@ -18853,7 +18853,7 @@ var require_SFTP = __commonJS({
|
|
|
18853
18853
|
`SFTP: Outbound: ${isBuffered ? "Buffered" : "Sending"} RENAME`
|
|
18854
18854
|
);
|
|
18855
18855
|
}
|
|
18856
|
-
mkdir(
|
|
18856
|
+
mkdir(path11, attrs, cb) {
|
|
18857
18857
|
if (this.server)
|
|
18858
18858
|
throw new Error("Client-only method called in server mode");
|
|
18859
18859
|
let flags = 0;
|
|
@@ -18867,7 +18867,7 @@ var require_SFTP = __commonJS({
|
|
|
18867
18867
|
flags = attrs.flags;
|
|
18868
18868
|
attrsLen = attrs.nb;
|
|
18869
18869
|
}
|
|
18870
|
-
const pathLen = Buffer.byteLength(
|
|
18870
|
+
const pathLen = Buffer.byteLength(path11);
|
|
18871
18871
|
let p = 9;
|
|
18872
18872
|
const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen + 4 + attrsLen);
|
|
18873
18873
|
writeUInt32BE(buf, buf.length - 4, 0);
|
|
@@ -18875,7 +18875,7 @@ var require_SFTP = __commonJS({
|
|
|
18875
18875
|
const reqid = this._writeReqid = this._writeReqid + 1 & MAX_REQID;
|
|
18876
18876
|
writeUInt32BE(buf, reqid, 5);
|
|
18877
18877
|
writeUInt32BE(buf, pathLen, p);
|
|
18878
|
-
buf.utf8Write(
|
|
18878
|
+
buf.utf8Write(path11, p += 4, pathLen);
|
|
18879
18879
|
writeUInt32BE(buf, flags, p += pathLen);
|
|
18880
18880
|
if (attrsLen) {
|
|
18881
18881
|
p += 4;
|
|
@@ -18891,10 +18891,10 @@ var require_SFTP = __commonJS({
|
|
|
18891
18891
|
`SFTP: Outbound: ${isBuffered ? "Buffered" : "Sending"} MKDIR`
|
|
18892
18892
|
);
|
|
18893
18893
|
}
|
|
18894
|
-
rmdir(
|
|
18894
|
+
rmdir(path11, cb) {
|
|
18895
18895
|
if (this.server)
|
|
18896
18896
|
throw new Error("Client-only method called in server mode");
|
|
18897
|
-
const pathLen = Buffer.byteLength(
|
|
18897
|
+
const pathLen = Buffer.byteLength(path11);
|
|
18898
18898
|
let p = 9;
|
|
18899
18899
|
const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen);
|
|
18900
18900
|
writeUInt32BE(buf, buf.length - 4, 0);
|
|
@@ -18902,7 +18902,7 @@ var require_SFTP = __commonJS({
|
|
|
18902
18902
|
const reqid = this._writeReqid = this._writeReqid + 1 & MAX_REQID;
|
|
18903
18903
|
writeUInt32BE(buf, reqid, 5);
|
|
18904
18904
|
writeUInt32BE(buf, pathLen, p);
|
|
18905
|
-
buf.utf8Write(
|
|
18905
|
+
buf.utf8Write(path11, p += 4, pathLen);
|
|
18906
18906
|
this._requests[reqid] = { cb };
|
|
18907
18907
|
const isBuffered = sendOrBuffer(this, buf);
|
|
18908
18908
|
this._debug && this._debug(
|
|
@@ -18992,10 +18992,10 @@ var require_SFTP = __commonJS({
|
|
|
18992
18992
|
`SFTP: Outbound: ${isBuffered ? "Buffered" : "Sending"} FSTAT`
|
|
18993
18993
|
);
|
|
18994
18994
|
}
|
|
18995
|
-
stat(
|
|
18995
|
+
stat(path11, cb) {
|
|
18996
18996
|
if (this.server)
|
|
18997
18997
|
throw new Error("Client-only method called in server mode");
|
|
18998
|
-
const pathLen = Buffer.byteLength(
|
|
18998
|
+
const pathLen = Buffer.byteLength(path11);
|
|
18999
18999
|
let p = 9;
|
|
19000
19000
|
const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen);
|
|
19001
19001
|
writeUInt32BE(buf, buf.length - 4, 0);
|
|
@@ -19003,17 +19003,17 @@ var require_SFTP = __commonJS({
|
|
|
19003
19003
|
const reqid = this._writeReqid = this._writeReqid + 1 & MAX_REQID;
|
|
19004
19004
|
writeUInt32BE(buf, reqid, 5);
|
|
19005
19005
|
writeUInt32BE(buf, pathLen, p);
|
|
19006
|
-
buf.utf8Write(
|
|
19006
|
+
buf.utf8Write(path11, p += 4, pathLen);
|
|
19007
19007
|
this._requests[reqid] = { cb };
|
|
19008
19008
|
const isBuffered = sendOrBuffer(this, buf);
|
|
19009
19009
|
this._debug && this._debug(
|
|
19010
19010
|
`SFTP: Outbound: ${isBuffered ? "Buffered" : "Sending"} STAT`
|
|
19011
19011
|
);
|
|
19012
19012
|
}
|
|
19013
|
-
lstat(
|
|
19013
|
+
lstat(path11, cb) {
|
|
19014
19014
|
if (this.server)
|
|
19015
19015
|
throw new Error("Client-only method called in server mode");
|
|
19016
|
-
const pathLen = Buffer.byteLength(
|
|
19016
|
+
const pathLen = Buffer.byteLength(path11);
|
|
19017
19017
|
let p = 9;
|
|
19018
19018
|
const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen);
|
|
19019
19019
|
writeUInt32BE(buf, buf.length - 4, 0);
|
|
@@ -19021,17 +19021,17 @@ var require_SFTP = __commonJS({
|
|
|
19021
19021
|
const reqid = this._writeReqid = this._writeReqid + 1 & MAX_REQID;
|
|
19022
19022
|
writeUInt32BE(buf, reqid, 5);
|
|
19023
19023
|
writeUInt32BE(buf, pathLen, p);
|
|
19024
|
-
buf.utf8Write(
|
|
19024
|
+
buf.utf8Write(path11, p += 4, pathLen);
|
|
19025
19025
|
this._requests[reqid] = { cb };
|
|
19026
19026
|
const isBuffered = sendOrBuffer(this, buf);
|
|
19027
19027
|
this._debug && this._debug(
|
|
19028
19028
|
`SFTP: Outbound: ${isBuffered ? "Buffered" : "Sending"} LSTAT`
|
|
19029
19029
|
);
|
|
19030
19030
|
}
|
|
19031
|
-
opendir(
|
|
19031
|
+
opendir(path11, cb) {
|
|
19032
19032
|
if (this.server)
|
|
19033
19033
|
throw new Error("Client-only method called in server mode");
|
|
19034
|
-
const pathLen = Buffer.byteLength(
|
|
19034
|
+
const pathLen = Buffer.byteLength(path11);
|
|
19035
19035
|
let p = 9;
|
|
19036
19036
|
const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen);
|
|
19037
19037
|
writeUInt32BE(buf, buf.length - 4, 0);
|
|
@@ -19039,14 +19039,14 @@ var require_SFTP = __commonJS({
|
|
|
19039
19039
|
const reqid = this._writeReqid = this._writeReqid + 1 & MAX_REQID;
|
|
19040
19040
|
writeUInt32BE(buf, reqid, 5);
|
|
19041
19041
|
writeUInt32BE(buf, pathLen, p);
|
|
19042
|
-
buf.utf8Write(
|
|
19042
|
+
buf.utf8Write(path11, p += 4, pathLen);
|
|
19043
19043
|
this._requests[reqid] = { cb };
|
|
19044
19044
|
const isBuffered = sendOrBuffer(this, buf);
|
|
19045
19045
|
this._debug && this._debug(
|
|
19046
19046
|
`SFTP: Outbound: ${isBuffered ? "Buffered" : "Sending"} OPENDIR`
|
|
19047
19047
|
);
|
|
19048
19048
|
}
|
|
19049
|
-
setstat(
|
|
19049
|
+
setstat(path11, attrs, cb) {
|
|
19050
19050
|
if (this.server)
|
|
19051
19051
|
throw new Error("Client-only method called in server mode");
|
|
19052
19052
|
let flags = 0;
|
|
@@ -19058,7 +19058,7 @@ var require_SFTP = __commonJS({
|
|
|
19058
19058
|
} else if (typeof attrs === "function") {
|
|
19059
19059
|
cb = attrs;
|
|
19060
19060
|
}
|
|
19061
|
-
const pathLen = Buffer.byteLength(
|
|
19061
|
+
const pathLen = Buffer.byteLength(path11);
|
|
19062
19062
|
let p = 9;
|
|
19063
19063
|
const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen + 4 + attrsLen);
|
|
19064
19064
|
writeUInt32BE(buf, buf.length - 4, 0);
|
|
@@ -19066,7 +19066,7 @@ var require_SFTP = __commonJS({
|
|
|
19066
19066
|
const reqid = this._writeReqid = this._writeReqid + 1 & MAX_REQID;
|
|
19067
19067
|
writeUInt32BE(buf, reqid, 5);
|
|
19068
19068
|
writeUInt32BE(buf, pathLen, p);
|
|
19069
|
-
buf.utf8Write(
|
|
19069
|
+
buf.utf8Write(path11, p += 4, pathLen);
|
|
19070
19070
|
writeUInt32BE(buf, flags, p += pathLen);
|
|
19071
19071
|
if (attrsLen) {
|
|
19072
19072
|
p += 4;
|
|
@@ -19126,8 +19126,8 @@ var require_SFTP = __commonJS({
|
|
|
19126
19126
|
mtime: toUnixTimestamp(mtime)
|
|
19127
19127
|
}, cb);
|
|
19128
19128
|
}
|
|
19129
|
-
utimes(
|
|
19130
|
-
return this.setstat(
|
|
19129
|
+
utimes(path11, atime, mtime, cb) {
|
|
19130
|
+
return this.setstat(path11, {
|
|
19131
19131
|
atime: toUnixTimestamp(atime),
|
|
19132
19132
|
mtime: toUnixTimestamp(mtime)
|
|
19133
19133
|
}, cb);
|
|
@@ -19138,8 +19138,8 @@ var require_SFTP = __commonJS({
|
|
|
19138
19138
|
gid
|
|
19139
19139
|
}, cb);
|
|
19140
19140
|
}
|
|
19141
|
-
chown(
|
|
19142
|
-
return this.setstat(
|
|
19141
|
+
chown(path11, uid, gid, cb) {
|
|
19142
|
+
return this.setstat(path11, {
|
|
19143
19143
|
uid,
|
|
19144
19144
|
gid
|
|
19145
19145
|
}, cb);
|
|
@@ -19149,15 +19149,15 @@ var require_SFTP = __commonJS({
|
|
|
19149
19149
|
mode
|
|
19150
19150
|
}, cb);
|
|
19151
19151
|
}
|
|
19152
|
-
chmod(
|
|
19153
|
-
return this.setstat(
|
|
19152
|
+
chmod(path11, mode, cb) {
|
|
19153
|
+
return this.setstat(path11, {
|
|
19154
19154
|
mode
|
|
19155
19155
|
}, cb);
|
|
19156
19156
|
}
|
|
19157
|
-
readlink(
|
|
19157
|
+
readlink(path11, cb) {
|
|
19158
19158
|
if (this.server)
|
|
19159
19159
|
throw new Error("Client-only method called in server mode");
|
|
19160
|
-
const pathLen = Buffer.byteLength(
|
|
19160
|
+
const pathLen = Buffer.byteLength(path11);
|
|
19161
19161
|
let p = 9;
|
|
19162
19162
|
const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen);
|
|
19163
19163
|
writeUInt32BE(buf, buf.length - 4, 0);
|
|
@@ -19165,7 +19165,7 @@ var require_SFTP = __commonJS({
|
|
|
19165
19165
|
const reqid = this._writeReqid = this._writeReqid + 1 & MAX_REQID;
|
|
19166
19166
|
writeUInt32BE(buf, reqid, 5);
|
|
19167
19167
|
writeUInt32BE(buf, pathLen, p);
|
|
19168
|
-
buf.utf8Write(
|
|
19168
|
+
buf.utf8Write(path11, p += 4, pathLen);
|
|
19169
19169
|
this._requests[reqid] = {
|
|
19170
19170
|
cb: (err2, names) => {
|
|
19171
19171
|
if (typeof cb !== "function")
|
|
@@ -19210,10 +19210,10 @@ var require_SFTP = __commonJS({
|
|
|
19210
19210
|
`SFTP: Outbound: ${isBuffered ? "Buffered" : "Sending"} SYMLINK`
|
|
19211
19211
|
);
|
|
19212
19212
|
}
|
|
19213
|
-
realpath(
|
|
19213
|
+
realpath(path11, cb) {
|
|
19214
19214
|
if (this.server)
|
|
19215
19215
|
throw new Error("Client-only method called in server mode");
|
|
19216
|
-
const pathLen = Buffer.byteLength(
|
|
19216
|
+
const pathLen = Buffer.byteLength(path11);
|
|
19217
19217
|
let p = 9;
|
|
19218
19218
|
const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen);
|
|
19219
19219
|
writeUInt32BE(buf, buf.length - 4, 0);
|
|
@@ -19221,7 +19221,7 @@ var require_SFTP = __commonJS({
|
|
|
19221
19221
|
const reqid = this._writeReqid = this._writeReqid + 1 & MAX_REQID;
|
|
19222
19222
|
writeUInt32BE(buf, reqid, 5);
|
|
19223
19223
|
writeUInt32BE(buf, pathLen, p);
|
|
19224
|
-
buf.utf8Write(
|
|
19224
|
+
buf.utf8Write(path11, p += 4, pathLen);
|
|
19225
19225
|
this._requests[reqid] = {
|
|
19226
19226
|
cb: (err2, names) => {
|
|
19227
19227
|
if (typeof cb !== "function")
|
|
@@ -19266,13 +19266,13 @@ var require_SFTP = __commonJS({
|
|
|
19266
19266
|
this._debug(`SFTP: Outbound: ${which} posix-rename@openssh.com`);
|
|
19267
19267
|
}
|
|
19268
19268
|
}
|
|
19269
|
-
ext_openssh_statvfs(
|
|
19269
|
+
ext_openssh_statvfs(path11, cb) {
|
|
19270
19270
|
if (this.server)
|
|
19271
19271
|
throw new Error("Client-only method called in server mode");
|
|
19272
19272
|
const ext = this._extensions["statvfs@openssh.com"];
|
|
19273
19273
|
if (!ext || ext !== "2")
|
|
19274
19274
|
throw new Error("Server does not support this extended request");
|
|
19275
|
-
const pathLen = Buffer.byteLength(
|
|
19275
|
+
const pathLen = Buffer.byteLength(path11);
|
|
19276
19276
|
let p = 9;
|
|
19277
19277
|
const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + 19 + 4 + pathLen);
|
|
19278
19278
|
writeUInt32BE(buf, buf.length - 4, 0);
|
|
@@ -19282,7 +19282,7 @@ var require_SFTP = __commonJS({
|
|
|
19282
19282
|
writeUInt32BE(buf, 19, p);
|
|
19283
19283
|
buf.utf8Write("statvfs@openssh.com", p += 4, 19);
|
|
19284
19284
|
writeUInt32BE(buf, pathLen, p += 19);
|
|
19285
|
-
buf.utf8Write(
|
|
19285
|
+
buf.utf8Write(path11, p += 4, pathLen);
|
|
19286
19286
|
this._requests[reqid] = { extended: "statvfs@openssh.com", cb };
|
|
19287
19287
|
const isBuffered = sendOrBuffer(this, buf);
|
|
19288
19288
|
if (this._debug) {
|
|
@@ -19368,7 +19368,7 @@ var require_SFTP = __commonJS({
|
|
|
19368
19368
|
`SFTP: Outbound: ${isBuffered ? "Buffered" : "Sending"} fsync@openssh.com`
|
|
19369
19369
|
);
|
|
19370
19370
|
}
|
|
19371
|
-
ext_openssh_lsetstat(
|
|
19371
|
+
ext_openssh_lsetstat(path11, attrs, cb) {
|
|
19372
19372
|
if (this.server)
|
|
19373
19373
|
throw new Error("Client-only method called in server mode");
|
|
19374
19374
|
const ext = this._extensions["lsetstat@openssh.com"];
|
|
@@ -19383,7 +19383,7 @@ var require_SFTP = __commonJS({
|
|
|
19383
19383
|
} else if (typeof attrs === "function") {
|
|
19384
19384
|
cb = attrs;
|
|
19385
19385
|
}
|
|
19386
|
-
const pathLen = Buffer.byteLength(
|
|
19386
|
+
const pathLen = Buffer.byteLength(path11);
|
|
19387
19387
|
let p = 9;
|
|
19388
19388
|
const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + 20 + 4 + pathLen + 4 + attrsLen);
|
|
19389
19389
|
writeUInt32BE(buf, buf.length - 4, 0);
|
|
@@ -19393,7 +19393,7 @@ var require_SFTP = __commonJS({
|
|
|
19393
19393
|
writeUInt32BE(buf, 20, p);
|
|
19394
19394
|
buf.utf8Write("lsetstat@openssh.com", p += 4, 20);
|
|
19395
19395
|
writeUInt32BE(buf, pathLen, p += 20);
|
|
19396
|
-
buf.utf8Write(
|
|
19396
|
+
buf.utf8Write(path11, p += 4, pathLen);
|
|
19397
19397
|
writeUInt32BE(buf, flags, p += pathLen);
|
|
19398
19398
|
if (attrsLen) {
|
|
19399
19399
|
p += 4;
|
|
@@ -19410,13 +19410,13 @@ var require_SFTP = __commonJS({
|
|
|
19410
19410
|
this._debug(`SFTP: Outbound: ${status} lsetstat@openssh.com`);
|
|
19411
19411
|
}
|
|
19412
19412
|
}
|
|
19413
|
-
ext_openssh_expandPath(
|
|
19413
|
+
ext_openssh_expandPath(path11, cb) {
|
|
19414
19414
|
if (this.server)
|
|
19415
19415
|
throw new Error("Client-only method called in server mode");
|
|
19416
19416
|
const ext = this._extensions["expand-path@openssh.com"];
|
|
19417
19417
|
if (ext !== "1")
|
|
19418
19418
|
throw new Error("Server does not support this extended request");
|
|
19419
|
-
const pathLen = Buffer.byteLength(
|
|
19419
|
+
const pathLen = Buffer.byteLength(path11);
|
|
19420
19420
|
let p = 9;
|
|
19421
19421
|
const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + 23 + 4 + pathLen);
|
|
19422
19422
|
writeUInt32BE(buf, buf.length - 4, 0);
|
|
@@ -19426,7 +19426,7 @@ var require_SFTP = __commonJS({
|
|
|
19426
19426
|
writeUInt32BE(buf, 23, p);
|
|
19427
19427
|
buf.utf8Write("expand-path@openssh.com", p += 4, 23);
|
|
19428
19428
|
writeUInt32BE(buf, pathLen, p += 20);
|
|
19429
|
-
buf.utf8Write(
|
|
19429
|
+
buf.utf8Write(path11, p += 4, pathLen);
|
|
19430
19430
|
this._requests[reqid] = {
|
|
19431
19431
|
cb: (err2, names) => {
|
|
19432
19432
|
if (typeof cb !== "function")
|
|
@@ -19899,13 +19899,13 @@ var require_SFTP = __commonJS({
|
|
|
19899
19899
|
if (--left === 0)
|
|
19900
19900
|
cb(err2);
|
|
19901
19901
|
};
|
|
19902
|
-
if (srcHandle && (src ===
|
|
19902
|
+
if (srcHandle && (src === fs11 || src.outgoing.state === "open"))
|
|
19903
19903
|
++left;
|
|
19904
|
-
if (dstHandle && (dst ===
|
|
19904
|
+
if (dstHandle && (dst === fs11 || dst.outgoing.state === "open"))
|
|
19905
19905
|
++left;
|
|
19906
|
-
if (srcHandle && (src ===
|
|
19906
|
+
if (srcHandle && (src === fs11 || src.outgoing.state === "open"))
|
|
19907
19907
|
src.close(srcHandle, cbfinal);
|
|
19908
|
-
if (dstHandle && (dst ===
|
|
19908
|
+
if (dstHandle && (dst === fs11 || dst.outgoing.state === "open"))
|
|
19909
19909
|
dst.close(dstHandle, cbfinal);
|
|
19910
19910
|
} else {
|
|
19911
19911
|
cb(err2);
|
|
@@ -19921,7 +19921,7 @@ var require_SFTP = __commonJS({
|
|
|
19921
19921
|
tryStat(null, { size: fileSize });
|
|
19922
19922
|
function tryStat(err3, attrs) {
|
|
19923
19923
|
if (err3) {
|
|
19924
|
-
if (src !==
|
|
19924
|
+
if (src !== fs11) {
|
|
19925
19925
|
src.stat(srcPath, (err_, attrs_) => {
|
|
19926
19926
|
if (err_)
|
|
19927
19927
|
return onerror(err3);
|
|
@@ -20704,12 +20704,12 @@ var require_SFTP = __commonJS({
|
|
|
20704
20704
|
[REQUEST.LSTAT]: (sftp, payload) => {
|
|
20705
20705
|
bufferParser.init(payload, 1);
|
|
20706
20706
|
const reqID = bufferParser.readUInt32BE();
|
|
20707
|
-
const
|
|
20707
|
+
const path11 = bufferParser.readString(true);
|
|
20708
20708
|
bufferParser.clear();
|
|
20709
|
-
if (
|
|
20709
|
+
if (path11 === void 0)
|
|
20710
20710
|
return doFatalSFTPError(sftp, "Malformed LSTAT packet");
|
|
20711
20711
|
sftp._debug && sftp._debug(`SFTP: Inbound: Received LSTAT (id:${reqID})`);
|
|
20712
|
-
if (!sftp.emit("LSTAT", reqID,
|
|
20712
|
+
if (!sftp.emit("LSTAT", reqID, path11)) {
|
|
20713
20713
|
sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED);
|
|
20714
20714
|
}
|
|
20715
20715
|
},
|
|
@@ -20728,13 +20728,13 @@ var require_SFTP = __commonJS({
|
|
|
20728
20728
|
[REQUEST.SETSTAT]: (sftp, payload) => {
|
|
20729
20729
|
bufferParser.init(payload, 1);
|
|
20730
20730
|
const reqID = bufferParser.readUInt32BE();
|
|
20731
|
-
const
|
|
20731
|
+
const path11 = bufferParser.readString(true);
|
|
20732
20732
|
const attrs = readAttrs(sftp._biOpt);
|
|
20733
20733
|
bufferParser.clear();
|
|
20734
20734
|
if (attrs === void 0)
|
|
20735
20735
|
return doFatalSFTPError(sftp, "Malformed SETSTAT packet");
|
|
20736
20736
|
sftp._debug && sftp._debug(`SFTP: Inbound: Received SETSTAT (id:${reqID})`);
|
|
20737
|
-
if (!sftp.emit("SETSTAT", reqID,
|
|
20737
|
+
if (!sftp.emit("SETSTAT", reqID, path11, attrs)) {
|
|
20738
20738
|
sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED);
|
|
20739
20739
|
}
|
|
20740
20740
|
},
|
|
@@ -20756,12 +20756,12 @@ var require_SFTP = __commonJS({
|
|
|
20756
20756
|
[REQUEST.OPENDIR]: (sftp, payload) => {
|
|
20757
20757
|
bufferParser.init(payload, 1);
|
|
20758
20758
|
const reqID = bufferParser.readUInt32BE();
|
|
20759
|
-
const
|
|
20759
|
+
const path11 = bufferParser.readString(true);
|
|
20760
20760
|
bufferParser.clear();
|
|
20761
|
-
if (
|
|
20761
|
+
if (path11 === void 0)
|
|
20762
20762
|
return doFatalSFTPError(sftp, "Malformed OPENDIR packet");
|
|
20763
20763
|
sftp._debug && sftp._debug(`SFTP: Inbound: Received OPENDIR (id:${reqID})`);
|
|
20764
|
-
if (!sftp.emit("OPENDIR", reqID,
|
|
20764
|
+
if (!sftp.emit("OPENDIR", reqID, path11)) {
|
|
20765
20765
|
sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED);
|
|
20766
20766
|
}
|
|
20767
20767
|
},
|
|
@@ -20780,63 +20780,63 @@ var require_SFTP = __commonJS({
|
|
|
20780
20780
|
[REQUEST.REMOVE]: (sftp, payload) => {
|
|
20781
20781
|
bufferParser.init(payload, 1);
|
|
20782
20782
|
const reqID = bufferParser.readUInt32BE();
|
|
20783
|
-
const
|
|
20783
|
+
const path11 = bufferParser.readString(true);
|
|
20784
20784
|
bufferParser.clear();
|
|
20785
|
-
if (
|
|
20785
|
+
if (path11 === void 0)
|
|
20786
20786
|
return doFatalSFTPError(sftp, "Malformed REMOVE packet");
|
|
20787
20787
|
sftp._debug && sftp._debug(`SFTP: Inbound: Received REMOVE (id:${reqID})`);
|
|
20788
|
-
if (!sftp.emit("REMOVE", reqID,
|
|
20788
|
+
if (!sftp.emit("REMOVE", reqID, path11)) {
|
|
20789
20789
|
sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED);
|
|
20790
20790
|
}
|
|
20791
20791
|
},
|
|
20792
20792
|
[REQUEST.MKDIR]: (sftp, payload) => {
|
|
20793
20793
|
bufferParser.init(payload, 1);
|
|
20794
20794
|
const reqID = bufferParser.readUInt32BE();
|
|
20795
|
-
const
|
|
20795
|
+
const path11 = bufferParser.readString(true);
|
|
20796
20796
|
const attrs = readAttrs(sftp._biOpt);
|
|
20797
20797
|
bufferParser.clear();
|
|
20798
20798
|
if (attrs === void 0)
|
|
20799
20799
|
return doFatalSFTPError(sftp, "Malformed MKDIR packet");
|
|
20800
20800
|
sftp._debug && sftp._debug(`SFTP: Inbound: Received MKDIR (id:${reqID})`);
|
|
20801
|
-
if (!sftp.emit("MKDIR", reqID,
|
|
20801
|
+
if (!sftp.emit("MKDIR", reqID, path11, attrs)) {
|
|
20802
20802
|
sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED);
|
|
20803
20803
|
}
|
|
20804
20804
|
},
|
|
20805
20805
|
[REQUEST.RMDIR]: (sftp, payload) => {
|
|
20806
20806
|
bufferParser.init(payload, 1);
|
|
20807
20807
|
const reqID = bufferParser.readUInt32BE();
|
|
20808
|
-
const
|
|
20808
|
+
const path11 = bufferParser.readString(true);
|
|
20809
20809
|
bufferParser.clear();
|
|
20810
|
-
if (
|
|
20810
|
+
if (path11 === void 0)
|
|
20811
20811
|
return doFatalSFTPError(sftp, "Malformed RMDIR packet");
|
|
20812
20812
|
sftp._debug && sftp._debug(`SFTP: Inbound: Received RMDIR (id:${reqID})`);
|
|
20813
|
-
if (!sftp.emit("RMDIR", reqID,
|
|
20813
|
+
if (!sftp.emit("RMDIR", reqID, path11)) {
|
|
20814
20814
|
sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED);
|
|
20815
20815
|
}
|
|
20816
20816
|
},
|
|
20817
20817
|
[REQUEST.REALPATH]: (sftp, payload) => {
|
|
20818
20818
|
bufferParser.init(payload, 1);
|
|
20819
20819
|
const reqID = bufferParser.readUInt32BE();
|
|
20820
|
-
const
|
|
20820
|
+
const path11 = bufferParser.readString(true);
|
|
20821
20821
|
bufferParser.clear();
|
|
20822
|
-
if (
|
|
20822
|
+
if (path11 === void 0)
|
|
20823
20823
|
return doFatalSFTPError(sftp, "Malformed REALPATH packet");
|
|
20824
20824
|
sftp._debug && sftp._debug(
|
|
20825
20825
|
`SFTP: Inbound: Received REALPATH (id:${reqID})`
|
|
20826
20826
|
);
|
|
20827
|
-
if (!sftp.emit("REALPATH", reqID,
|
|
20827
|
+
if (!sftp.emit("REALPATH", reqID, path11)) {
|
|
20828
20828
|
sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED);
|
|
20829
20829
|
}
|
|
20830
20830
|
},
|
|
20831
20831
|
[REQUEST.STAT]: (sftp, payload) => {
|
|
20832
20832
|
bufferParser.init(payload, 1);
|
|
20833
20833
|
const reqID = bufferParser.readUInt32BE();
|
|
20834
|
-
const
|
|
20834
|
+
const path11 = bufferParser.readString(true);
|
|
20835
20835
|
bufferParser.clear();
|
|
20836
|
-
if (
|
|
20836
|
+
if (path11 === void 0)
|
|
20837
20837
|
return doFatalSFTPError(sftp, "Malformed STAT packet");
|
|
20838
20838
|
sftp._debug && sftp._debug(`SFTP: Inbound: Received STAT (id:${reqID})`);
|
|
20839
|
-
if (!sftp.emit("STAT", reqID,
|
|
20839
|
+
if (!sftp.emit("STAT", reqID, path11)) {
|
|
20840
20840
|
sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED);
|
|
20841
20841
|
}
|
|
20842
20842
|
},
|
|
@@ -20856,14 +20856,14 @@ var require_SFTP = __commonJS({
|
|
|
20856
20856
|
[REQUEST.READLINK]: (sftp, payload) => {
|
|
20857
20857
|
bufferParser.init(payload, 1);
|
|
20858
20858
|
const reqID = bufferParser.readUInt32BE();
|
|
20859
|
-
const
|
|
20859
|
+
const path11 = bufferParser.readString(true);
|
|
20860
20860
|
bufferParser.clear();
|
|
20861
|
-
if (
|
|
20861
|
+
if (path11 === void 0)
|
|
20862
20862
|
return doFatalSFTPError(sftp, "Malformed READLINK packet");
|
|
20863
20863
|
sftp._debug && sftp._debug(
|
|
20864
20864
|
`SFTP: Inbound: Received READLINK (id:${reqID})`
|
|
20865
20865
|
);
|
|
20866
|
-
if (!sftp.emit("READLINK", reqID,
|
|
20866
|
+
if (!sftp.emit("READLINK", reqID, path11)) {
|
|
20867
20867
|
sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED);
|
|
20868
20868
|
}
|
|
20869
20869
|
},
|
|
@@ -20934,7 +20934,7 @@ var require_SFTP = __commonJS({
|
|
|
20934
20934
|
function roundUpToMultipleOf8(n) {
|
|
20935
20935
|
return n + 7 & ~7;
|
|
20936
20936
|
}
|
|
20937
|
-
function ReadStream(sftp,
|
|
20937
|
+
function ReadStream(sftp, path11, options) {
|
|
20938
20938
|
if (options === void 0)
|
|
20939
20939
|
options = {};
|
|
20940
20940
|
else if (typeof options === "string")
|
|
@@ -20948,7 +20948,7 @@ var require_SFTP = __commonJS({
|
|
|
20948
20948
|
options.emitClose = false;
|
|
20949
20949
|
options.autoDestroy = false;
|
|
20950
20950
|
ReadableStream2.call(this, options);
|
|
20951
|
-
this.path =
|
|
20951
|
+
this.path = path11;
|
|
20952
20952
|
this.flags = options.flags === void 0 ? "r" : options.flags;
|
|
20953
20953
|
this.mode = options.mode === void 0 ? 438 : options.mode;
|
|
20954
20954
|
this.start = options.start;
|
|
@@ -21079,7 +21079,7 @@ var require_SFTP = __commonJS({
|
|
|
21079
21079
|
},
|
|
21080
21080
|
configurable: true
|
|
21081
21081
|
});
|
|
21082
|
-
function WriteStream(sftp,
|
|
21082
|
+
function WriteStream(sftp, path11, options) {
|
|
21083
21083
|
if (options === void 0)
|
|
21084
21084
|
options = {};
|
|
21085
21085
|
else if (typeof options === "string")
|
|
@@ -21091,7 +21091,7 @@ var require_SFTP = __commonJS({
|
|
|
21091
21091
|
options.emitClose = false;
|
|
21092
21092
|
options.autoDestroy = false;
|
|
21093
21093
|
WritableStream.call(this, options);
|
|
21094
|
-
this.path =
|
|
21094
|
+
this.path = path11;
|
|
21095
21095
|
this.flags = options.flags === void 0 ? "w" : options.flags;
|
|
21096
21096
|
this.mode = options.mode === void 0 ? 438 : options.mode;
|
|
21097
21097
|
this.start = options.start;
|
|
@@ -25300,7 +25300,7 @@ var require_tunnel_ssh = __commonJS({
|
|
|
25300
25300
|
"node_modules/tunnel-ssh/index.js"(exports) {
|
|
25301
25301
|
var net = __require("net");
|
|
25302
25302
|
var { Client: Client2 } = require_lib4();
|
|
25303
|
-
var
|
|
25303
|
+
var os12 = __require("os");
|
|
25304
25304
|
function autoClose(server, connection) {
|
|
25305
25305
|
connection.on("close", () => {
|
|
25306
25306
|
server.getConnections((error2, count) => {
|
|
@@ -25485,9 +25485,9 @@ var require_package2 = __commonJS({
|
|
|
25485
25485
|
// node_modules/dotenv/lib/main.js
|
|
25486
25486
|
var require_main = __commonJS({
|
|
25487
25487
|
"node_modules/dotenv/lib/main.js"(exports, module) {
|
|
25488
|
-
var
|
|
25489
|
-
var
|
|
25490
|
-
var
|
|
25488
|
+
var fs11 = __require("fs");
|
|
25489
|
+
var path11 = __require("path");
|
|
25490
|
+
var os12 = __require("os");
|
|
25491
25491
|
var crypto3 = __require("crypto");
|
|
25492
25492
|
var packageJson2 = require_package2();
|
|
25493
25493
|
var version2 = packageJson2.version;
|
|
@@ -25594,7 +25594,7 @@ var require_main = __commonJS({
|
|
|
25594
25594
|
if (options && options.path && options.path.length > 0) {
|
|
25595
25595
|
if (Array.isArray(options.path)) {
|
|
25596
25596
|
for (const filepath of options.path) {
|
|
25597
|
-
if (
|
|
25597
|
+
if (fs11.existsSync(filepath)) {
|
|
25598
25598
|
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
25599
25599
|
}
|
|
25600
25600
|
}
|
|
@@ -25602,15 +25602,15 @@ var require_main = __commonJS({
|
|
|
25602
25602
|
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
25603
25603
|
}
|
|
25604
25604
|
} else {
|
|
25605
|
-
possibleVaultPath =
|
|
25605
|
+
possibleVaultPath = path11.resolve(process.cwd(), ".env.vault");
|
|
25606
25606
|
}
|
|
25607
|
-
if (
|
|
25607
|
+
if (fs11.existsSync(possibleVaultPath)) {
|
|
25608
25608
|
return possibleVaultPath;
|
|
25609
25609
|
}
|
|
25610
25610
|
return null;
|
|
25611
25611
|
}
|
|
25612
25612
|
function _resolveHome(envPath) {
|
|
25613
|
-
return envPath[0] === "~" ?
|
|
25613
|
+
return envPath[0] === "~" ? path11.join(os12.homedir(), envPath.slice(1)) : envPath;
|
|
25614
25614
|
}
|
|
25615
25615
|
function _configVault(options) {
|
|
25616
25616
|
const debug = Boolean(options && options.debug);
|
|
@@ -25627,7 +25627,7 @@ var require_main = __commonJS({
|
|
|
25627
25627
|
return { parsed };
|
|
25628
25628
|
}
|
|
25629
25629
|
function configDotenv(options) {
|
|
25630
|
-
const dotenvPath =
|
|
25630
|
+
const dotenvPath = path11.resolve(process.cwd(), ".env");
|
|
25631
25631
|
let encoding = "utf8";
|
|
25632
25632
|
const debug = Boolean(options && options.debug);
|
|
25633
25633
|
const quiet = options && "quiet" in options ? options.quiet : true;
|
|
@@ -25651,13 +25651,13 @@ var require_main = __commonJS({
|
|
|
25651
25651
|
}
|
|
25652
25652
|
let lastError;
|
|
25653
25653
|
const parsedAll = {};
|
|
25654
|
-
for (const
|
|
25654
|
+
for (const path12 of optionPaths) {
|
|
25655
25655
|
try {
|
|
25656
|
-
const parsed = DotenvModule.parse(
|
|
25656
|
+
const parsed = DotenvModule.parse(fs11.readFileSync(path12, { encoding }));
|
|
25657
25657
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
25658
25658
|
} catch (e) {
|
|
25659
25659
|
if (debug) {
|
|
25660
|
-
_debug(`Failed to load ${
|
|
25660
|
+
_debug(`Failed to load ${path12} ${e.message}`);
|
|
25661
25661
|
}
|
|
25662
25662
|
lastError = e;
|
|
25663
25663
|
}
|
|
@@ -25672,7 +25672,7 @@ var require_main = __commonJS({
|
|
|
25672
25672
|
const shortPaths = [];
|
|
25673
25673
|
for (const filePath of optionPaths) {
|
|
25674
25674
|
try {
|
|
25675
|
-
const relative =
|
|
25675
|
+
const relative = path11.relative(process.cwd(), filePath);
|
|
25676
25676
|
shortPaths.push(relative);
|
|
25677
25677
|
} catch (e) {
|
|
25678
25678
|
if (debug) {
|
|
@@ -29163,8 +29163,8 @@ var require_utils5 = __commonJS({
|
|
|
29163
29163
|
}
|
|
29164
29164
|
return ind;
|
|
29165
29165
|
}
|
|
29166
|
-
function removeDotSegments(
|
|
29167
|
-
let input =
|
|
29166
|
+
function removeDotSegments(path11) {
|
|
29167
|
+
let input = path11;
|
|
29168
29168
|
const output = [];
|
|
29169
29169
|
let nextSlash = -1;
|
|
29170
29170
|
let len = 0;
|
|
@@ -29363,8 +29363,8 @@ var require_schemes = __commonJS({
|
|
|
29363
29363
|
wsComponent.secure = void 0;
|
|
29364
29364
|
}
|
|
29365
29365
|
if (wsComponent.resourceName) {
|
|
29366
|
-
const [
|
|
29367
|
-
wsComponent.path =
|
|
29366
|
+
const [path11, query] = wsComponent.resourceName.split("?");
|
|
29367
|
+
wsComponent.path = path11 && path11 !== "/" ? path11 : void 0;
|
|
29368
29368
|
wsComponent.query = query;
|
|
29369
29369
|
wsComponent.resourceName = void 0;
|
|
29370
29370
|
}
|
|
@@ -32726,12 +32726,12 @@ var require_dist2 = __commonJS({
|
|
|
32726
32726
|
throw new Error(`Unknown format "${name}"`);
|
|
32727
32727
|
return f;
|
|
32728
32728
|
};
|
|
32729
|
-
function addFormats(ajv, list,
|
|
32729
|
+
function addFormats(ajv, list, fs11, exportName) {
|
|
32730
32730
|
var _a3;
|
|
32731
32731
|
var _b;
|
|
32732
32732
|
(_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
32733
32733
|
for (const f of list)
|
|
32734
|
-
ajv.addFormat(f,
|
|
32734
|
+
ajv.addFormat(f, fs11[f]);
|
|
32735
32735
|
}
|
|
32736
32736
|
module.exports = exports = formatsPlugin;
|
|
32737
32737
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -32770,12 +32770,12 @@ __export(runner_exports, {
|
|
|
32770
32770
|
runAllMigrations: () => runAllMigrations
|
|
32771
32771
|
});
|
|
32772
32772
|
import { spawn } from "child_process";
|
|
32773
|
-
import
|
|
32774
|
-
import
|
|
32773
|
+
import fs9 from "fs";
|
|
32774
|
+
import path10 from "path";
|
|
32775
32775
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
32776
32776
|
function listMigrationFiles() {
|
|
32777
|
-
if (!
|
|
32778
|
-
return
|
|
32777
|
+
if (!fs9.existsSync(migrationsDir)) return [];
|
|
32778
|
+
return fs9.readdirSync(migrationsDir).filter((f) => MIGRATION_FILE_RE.test(f)).sort();
|
|
32779
32779
|
}
|
|
32780
32780
|
function runOne(file) {
|
|
32781
32781
|
return new Promise((resolve, reject) => {
|
|
@@ -32785,7 +32785,7 @@ function runOne(file) {
|
|
|
32785
32785
|
});
|
|
32786
32786
|
child.on("exit", (code) => {
|
|
32787
32787
|
if (code === 0) return resolve();
|
|
32788
|
-
reject(new Error(`Migration ${
|
|
32788
|
+
reject(new Error(`Migration ${path10.basename(file)} exited with code ${code}`));
|
|
32789
32789
|
});
|
|
32790
32790
|
child.on("error", reject);
|
|
32791
32791
|
});
|
|
@@ -32798,7 +32798,7 @@ async function runAllMigrations() {
|
|
|
32798
32798
|
}
|
|
32799
32799
|
console.log(`\u{1F4E6} Running ${files.length} migration(s) from ${migrationsDir}`);
|
|
32800
32800
|
for (const f of files) {
|
|
32801
|
-
await runOne(
|
|
32801
|
+
await runOne(path10.join(migrationsDir, f));
|
|
32802
32802
|
}
|
|
32803
32803
|
console.log(`\u2705 Migration runner complete \u2014 ${files.length} file(s) processed.`);
|
|
32804
32804
|
return { ran: files.length, files };
|
|
@@ -32807,8 +32807,8 @@ var __dirname4, migrationsDir, MIGRATION_FILE_RE;
|
|
|
32807
32807
|
var init_runner = __esm({
|
|
32808
32808
|
"src/migrations/runner.ts"() {
|
|
32809
32809
|
"use strict";
|
|
32810
|
-
__dirname4 =
|
|
32811
|
-
migrationsDir =
|
|
32810
|
+
__dirname4 = path10.dirname(fileURLToPath3(import.meta.url));
|
|
32811
|
+
migrationsDir = fs9.existsSync(path10.join(__dirname4, "migrations")) ? path10.join(__dirname4, "migrations") : __dirname4;
|
|
32812
32812
|
MIGRATION_FILE_RE = /^\d{3}_.+\.js$/;
|
|
32813
32813
|
}
|
|
32814
32814
|
});
|
|
@@ -33294,8 +33294,8 @@ function getErrorMap() {
|
|
|
33294
33294
|
|
|
33295
33295
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
33296
33296
|
var makeIssue = (params) => {
|
|
33297
|
-
const { data, path:
|
|
33298
|
-
const fullPath = [...
|
|
33297
|
+
const { data, path: path11, errorMaps, issueData } = params;
|
|
33298
|
+
const fullPath = [...path11, ...issueData.path || []];
|
|
33299
33299
|
const fullIssue = {
|
|
33300
33300
|
...issueData,
|
|
33301
33301
|
path: fullPath
|
|
@@ -33411,11 +33411,11 @@ var errorUtil;
|
|
|
33411
33411
|
|
|
33412
33412
|
// node_modules/zod/v3/types.js
|
|
33413
33413
|
var ParseInputLazyPath = class {
|
|
33414
|
-
constructor(parent, value,
|
|
33414
|
+
constructor(parent, value, path11, key) {
|
|
33415
33415
|
this._cachedPath = [];
|
|
33416
33416
|
this.parent = parent;
|
|
33417
33417
|
this.data = value;
|
|
33418
|
-
this._path =
|
|
33418
|
+
this._path = path11;
|
|
33419
33419
|
this._key = key;
|
|
33420
33420
|
}
|
|
33421
33421
|
get path() {
|
|
@@ -37052,10 +37052,10 @@ function assignProp(target, prop, value) {
|
|
|
37052
37052
|
configurable: true
|
|
37053
37053
|
});
|
|
37054
37054
|
}
|
|
37055
|
-
function getElementAtPath(obj,
|
|
37056
|
-
if (!
|
|
37055
|
+
function getElementAtPath(obj, path11) {
|
|
37056
|
+
if (!path11)
|
|
37057
37057
|
return obj;
|
|
37058
|
-
return
|
|
37058
|
+
return path11.reduce((acc, key) => acc?.[key], obj);
|
|
37059
37059
|
}
|
|
37060
37060
|
function promiseAllObject(promisesObj) {
|
|
37061
37061
|
const keys = Object.keys(promisesObj);
|
|
@@ -37375,11 +37375,11 @@ function aborted(x, startIndex = 0) {
|
|
|
37375
37375
|
}
|
|
37376
37376
|
return false;
|
|
37377
37377
|
}
|
|
37378
|
-
function prefixIssues(
|
|
37378
|
+
function prefixIssues(path11, issues) {
|
|
37379
37379
|
return issues.map((iss) => {
|
|
37380
37380
|
var _a3;
|
|
37381
37381
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
37382
|
-
iss.path.unshift(
|
|
37382
|
+
iss.path.unshift(path11);
|
|
37383
37383
|
return iss;
|
|
37384
37384
|
});
|
|
37385
37385
|
}
|
|
@@ -48903,12 +48903,12 @@ function encodeURIPath(str2) {
|
|
|
48903
48903
|
return str2.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
|
|
48904
48904
|
}
|
|
48905
48905
|
var EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
48906
|
-
var createPathTagFunction = (pathEncoder = encodeURIPath) => function
|
|
48906
|
+
var createPathTagFunction = (pathEncoder = encodeURIPath) => function path11(statics, ...params) {
|
|
48907
48907
|
if (statics.length === 1)
|
|
48908
48908
|
return statics[0];
|
|
48909
48909
|
let postPath = false;
|
|
48910
48910
|
const invalidSegments = [];
|
|
48911
|
-
const
|
|
48911
|
+
const path12 = statics.reduce((previousValue, currentValue, index) => {
|
|
48912
48912
|
if (/[?#]/.test(currentValue)) {
|
|
48913
48913
|
postPath = true;
|
|
48914
48914
|
}
|
|
@@ -48925,7 +48925,7 @@ var createPathTagFunction = (pathEncoder = encodeURIPath) => function path10(sta
|
|
|
48925
48925
|
}
|
|
48926
48926
|
return previousValue + currentValue + (index === params.length ? "" : encoded);
|
|
48927
48927
|
}, "");
|
|
48928
|
-
const pathOnly =
|
|
48928
|
+
const pathOnly = path12.split(/[?#]/, 1)[0];
|
|
48929
48929
|
const invalidSegmentPattern = /(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
|
|
48930
48930
|
let match;
|
|
48931
48931
|
while ((match = invalidSegmentPattern.exec(pathOnly)) !== null) {
|
|
@@ -48946,10 +48946,10 @@ var createPathTagFunction = (pathEncoder = encodeURIPath) => function path10(sta
|
|
|
48946
48946
|
}, "");
|
|
48947
48947
|
throw new OpenAIError(`Path parameters result in path with invalid segments:
|
|
48948
48948
|
${invalidSegments.map((e) => e.error).join("\n")}
|
|
48949
|
-
${
|
|
48949
|
+
${path12}
|
|
48950
48950
|
${underline}`);
|
|
48951
48951
|
}
|
|
48952
|
-
return
|
|
48952
|
+
return path12;
|
|
48953
48953
|
};
|
|
48954
48954
|
var path2 = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
|
|
48955
48955
|
|
|
@@ -53922,9 +53922,9 @@ var OpenAI = class {
|
|
|
53922
53922
|
this.apiKey = token;
|
|
53923
53923
|
return true;
|
|
53924
53924
|
}
|
|
53925
|
-
buildURL(
|
|
53925
|
+
buildURL(path11, query, defaultBaseURL) {
|
|
53926
53926
|
const baseURL = !__classPrivateFieldGet(this, _OpenAI_instances, "m", _OpenAI_baseURLOverridden).call(this) && defaultBaseURL || this.baseURL;
|
|
53927
|
-
const url = isAbsoluteURL(
|
|
53927
|
+
const url = isAbsoluteURL(path11) ? new URL(path11) : new URL(baseURL + (baseURL.endsWith("/") && path11.startsWith("/") ? path11.slice(1) : path11));
|
|
53928
53928
|
const defaultQuery = this.defaultQuery();
|
|
53929
53929
|
const pathQuery = Object.fromEntries(url.searchParams);
|
|
53930
53930
|
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
|
|
@@ -53949,24 +53949,24 @@ var OpenAI = class {
|
|
|
53949
53949
|
*/
|
|
53950
53950
|
async prepareRequest(request, { url, options }) {
|
|
53951
53951
|
}
|
|
53952
|
-
get(
|
|
53953
|
-
return this.methodRequest("get",
|
|
53952
|
+
get(path11, opts) {
|
|
53953
|
+
return this.methodRequest("get", path11, opts);
|
|
53954
53954
|
}
|
|
53955
|
-
post(
|
|
53956
|
-
return this.methodRequest("post",
|
|
53955
|
+
post(path11, opts) {
|
|
53956
|
+
return this.methodRequest("post", path11, opts);
|
|
53957
53957
|
}
|
|
53958
|
-
patch(
|
|
53959
|
-
return this.methodRequest("patch",
|
|
53958
|
+
patch(path11, opts) {
|
|
53959
|
+
return this.methodRequest("patch", path11, opts);
|
|
53960
53960
|
}
|
|
53961
|
-
put(
|
|
53962
|
-
return this.methodRequest("put",
|
|
53961
|
+
put(path11, opts) {
|
|
53962
|
+
return this.methodRequest("put", path11, opts);
|
|
53963
53963
|
}
|
|
53964
|
-
delete(
|
|
53965
|
-
return this.methodRequest("delete",
|
|
53964
|
+
delete(path11, opts) {
|
|
53965
|
+
return this.methodRequest("delete", path11, opts);
|
|
53966
53966
|
}
|
|
53967
|
-
methodRequest(method,
|
|
53967
|
+
methodRequest(method, path11, opts) {
|
|
53968
53968
|
return this.request(Promise.resolve(opts).then((opts2) => {
|
|
53969
|
-
return { method, path:
|
|
53969
|
+
return { method, path: path11, ...opts2 };
|
|
53970
53970
|
}));
|
|
53971
53971
|
}
|
|
53972
53972
|
request(options, remainingRetries = null) {
|
|
@@ -54084,8 +54084,8 @@ var OpenAI = class {
|
|
|
54084
54084
|
}));
|
|
54085
54085
|
return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
|
|
54086
54086
|
}
|
|
54087
|
-
getAPIList(
|
|
54088
|
-
return this.requestAPIList(Page2, opts && "then" in opts ? opts.then((opts2) => ({ method: "get", path:
|
|
54087
|
+
getAPIList(path11, Page2, opts) {
|
|
54088
|
+
return this.requestAPIList(Page2, opts && "then" in opts ? opts.then((opts2) => ({ method: "get", path: path11, ...opts2 })) : { method: "get", path: path11, ...opts });
|
|
54089
54089
|
}
|
|
54090
54090
|
requestAPIList(Page2, options) {
|
|
54091
54091
|
const request = this.makeRequest(options, null, void 0);
|
|
@@ -54176,8 +54176,8 @@ var OpenAI = class {
|
|
|
54176
54176
|
}
|
|
54177
54177
|
async buildRequest(inputOptions, { retryCount = 0 } = {}) {
|
|
54178
54178
|
const options = { ...inputOptions };
|
|
54179
|
-
const { method, path:
|
|
54180
|
-
const url = this.buildURL(
|
|
54179
|
+
const { method, path: path11, query, defaultBaseURL } = options;
|
|
54180
|
+
const url = this.buildURL(path11, query, defaultBaseURL);
|
|
54181
54181
|
if ("timeout" in options)
|
|
54182
54182
|
validatePositiveInteger("timeout", options.timeout);
|
|
54183
54183
|
options.timeout = options.timeout ?? this.timeout;
|
|
@@ -56800,16 +56800,19 @@ async function judgePair(pair, tagsById, memoriesByTag) {
|
|
|
56800
56800
|
const sourceMemories = memoriesByTag.get(source.id) ?? [];
|
|
56801
56801
|
const targetMemories = memoriesByTag.get(target.id) ?? [];
|
|
56802
56802
|
const allowedIds = collectAllowedMemoryIds(pair, sourceMemories, targetMemories);
|
|
56803
|
+
const promptSignals = { ...pair.signals };
|
|
56804
|
+
delete promptSignals.explicit_statement_previews;
|
|
56805
|
+
const explicitPromptCap = envInt("PROJECT_ALIAS_EXPLICIT_PROMPT_CAP", 5);
|
|
56803
56806
|
const userPrompt = JSON.stringify(
|
|
56804
56807
|
{
|
|
56805
56808
|
task: "Judge whether Tag A and Tag B are the same project identity.",
|
|
56806
56809
|
candidate_sources: Array.from(pair.sources),
|
|
56807
|
-
signals:
|
|
56810
|
+
signals: promptSignals,
|
|
56808
56811
|
tag_a_source_candidate: tagPayload(source),
|
|
56809
56812
|
tag_b_target_candidate: tagPayload(target),
|
|
56810
56813
|
tag_a_representative_memories: sourceMemories.map(formatMemoryForPrompt),
|
|
56811
56814
|
tag_b_representative_memories: targetMemories.map(formatMemoryForPrompt),
|
|
56812
|
-
explicit_user_statements: pair.explicitStatements.map(formatMemoryForPrompt)
|
|
56815
|
+
explicit_user_statements: pair.explicitStatements.slice(0, explicitPromptCap).map(formatMemoryForPrompt)
|
|
56813
56816
|
},
|
|
56814
56817
|
null,
|
|
56815
56818
|
2
|
|
@@ -57842,7 +57845,7 @@ agent_platform_filter=false.`,
|
|
|
57842
57845
|
}
|
|
57843
57846
|
|
|
57844
57847
|
// src/auto_save/save_message_tool.ts
|
|
57845
|
-
import * as
|
|
57848
|
+
import * as os9 from "node:os";
|
|
57846
57849
|
|
|
57847
57850
|
// src/auto_save/gemini_capture.ts
|
|
57848
57851
|
import * as fs2 from "node:fs";
|
|
@@ -58813,8 +58816,228 @@ function isCaptureArmed3() {
|
|
|
58813
58816
|
return _state3 !== null && _state3.rootExists;
|
|
58814
58817
|
}
|
|
58815
58818
|
|
|
58816
|
-
// src/auto_save/
|
|
58819
|
+
// src/auto_save/hermes_capture.ts
|
|
58820
|
+
import * as fs5 from "node:fs";
|
|
58821
|
+
import * as path6 from "node:path";
|
|
58822
|
+
import * as os8 from "node:os";
|
|
58817
58823
|
var DEVICE_NAME5 = os8.hostname();
|
|
58824
|
+
var STATE_DB = path6.join(os8.homedir(), ".hermes", "state.db");
|
|
58825
|
+
var AGENT_PLATFORM2 = "hermes";
|
|
58826
|
+
var POLL_INTERVAL_MS4 = 3e3;
|
|
58827
|
+
var _DatabaseSync = null;
|
|
58828
|
+
var _sqliteUnavailable = false;
|
|
58829
|
+
async function loadSqlite() {
|
|
58830
|
+
if (_DatabaseSync) return _DatabaseSync;
|
|
58831
|
+
if (_sqliteUnavailable) return null;
|
|
58832
|
+
try {
|
|
58833
|
+
const mod = await import("node:sqlite");
|
|
58834
|
+
_DatabaseSync = mod?.DatabaseSync ?? null;
|
|
58835
|
+
if (!_DatabaseSync) _sqliteUnavailable = true;
|
|
58836
|
+
return _DatabaseSync;
|
|
58837
|
+
} catch {
|
|
58838
|
+
_sqliteUnavailable = true;
|
|
58839
|
+
return null;
|
|
58840
|
+
}
|
|
58841
|
+
}
|
|
58842
|
+
var _state4 = null;
|
|
58843
|
+
var _pollTimer4 = null;
|
|
58844
|
+
var _flushInProgress4 = false;
|
|
58845
|
+
var _consecutiveOpenFailures = 0;
|
|
58846
|
+
var MAX_OPEN_FAILURES = 5;
|
|
58847
|
+
function openRo(DatabaseSync) {
|
|
58848
|
+
try {
|
|
58849
|
+
return new DatabaseSync(STATE_DB, { readOnly: true });
|
|
58850
|
+
} catch {
|
|
58851
|
+
return null;
|
|
58852
|
+
}
|
|
58853
|
+
}
|
|
58854
|
+
function parseNewRows(db2, afterId) {
|
|
58855
|
+
const raw = db2.prepare(
|
|
58856
|
+
`SELECT id, session_id, role, content
|
|
58857
|
+
FROM messages
|
|
58858
|
+
WHERE id > ?
|
|
58859
|
+
ORDER BY id ASC`
|
|
58860
|
+
).all(afterId);
|
|
58861
|
+
const rows = [];
|
|
58862
|
+
let maxId = afterId;
|
|
58863
|
+
for (const r of raw) {
|
|
58864
|
+
const id = Number(r.id);
|
|
58865
|
+
if (id > maxId) maxId = id;
|
|
58866
|
+
let role;
|
|
58867
|
+
if (r.role === "user") role = "user";
|
|
58868
|
+
else if (r.role === "assistant") role = "assistant";
|
|
58869
|
+
else continue;
|
|
58870
|
+
const message = (r.content ?? "").trim();
|
|
58871
|
+
if (!message) continue;
|
|
58872
|
+
rows.push({ id, role, message, sessionId: String(r.session_id) });
|
|
58873
|
+
}
|
|
58874
|
+
return { rows, maxId };
|
|
58875
|
+
}
|
|
58876
|
+
function lookupModel(db2, sessionId, cache2) {
|
|
58877
|
+
if (cache2.has(sessionId)) return cache2.get(sessionId);
|
|
58878
|
+
let model = null;
|
|
58879
|
+
try {
|
|
58880
|
+
const row = db2.prepare(`SELECT model FROM sessions WHERE id = ? LIMIT 1`).get(sessionId);
|
|
58881
|
+
model = row?.model ?? null;
|
|
58882
|
+
} catch {
|
|
58883
|
+
model = null;
|
|
58884
|
+
}
|
|
58885
|
+
cache2.set(sessionId, model);
|
|
58886
|
+
return model;
|
|
58887
|
+
}
|
|
58888
|
+
function isCaptureArmed4() {
|
|
58889
|
+
return _state4 !== null;
|
|
58890
|
+
}
|
|
58891
|
+
async function captureSessionStart4(_cwd) {
|
|
58892
|
+
if (_pollTimer4) {
|
|
58893
|
+
clearInterval(_pollTimer4);
|
|
58894
|
+
_pollTimer4 = null;
|
|
58895
|
+
}
|
|
58896
|
+
_state4 = null;
|
|
58897
|
+
_consecutiveOpenFailures = 0;
|
|
58898
|
+
if (!fs5.existsSync(STATE_DB)) return;
|
|
58899
|
+
const DatabaseSync = await loadSqlite();
|
|
58900
|
+
if (!DatabaseSync) {
|
|
58901
|
+
console.error(
|
|
58902
|
+
"\u{1F4DD} [Hermes] node:sqlite \uBBF8\uC9C0\uC6D0 (Node < 22.5?) \u2014 capture \uBE44\uD65C\uC131, save_message fallback"
|
|
58903
|
+
);
|
|
58904
|
+
return;
|
|
58905
|
+
}
|
|
58906
|
+
const db2 = openRo(DatabaseSync);
|
|
58907
|
+
if (!db2) {
|
|
58908
|
+
console.error("\u{1F4DD} [Hermes] state.db \uC5F4\uAE30 \uC2E4\uD328 \u2014 capture \uBE44\uD65C\uC131");
|
|
58909
|
+
return;
|
|
58910
|
+
}
|
|
58911
|
+
let maxId = 0;
|
|
58912
|
+
try {
|
|
58913
|
+
const row = db2.prepare(`SELECT COALESCE(MAX(id), 0) AS m FROM messages`).get();
|
|
58914
|
+
maxId = Number(row?.m ?? 0);
|
|
58915
|
+
} catch (err2) {
|
|
58916
|
+
console.error(
|
|
58917
|
+
"\u{1F4DD} [Hermes] messages \uC870\uD68C \uC2E4\uD328 \u2014 capture \uBE44\uD65C\uC131:",
|
|
58918
|
+
err2 instanceof Error ? err2.message : err2
|
|
58919
|
+
);
|
|
58920
|
+
try {
|
|
58921
|
+
db2.close();
|
|
58922
|
+
} catch {
|
|
58923
|
+
}
|
|
58924
|
+
return;
|
|
58925
|
+
}
|
|
58926
|
+
try {
|
|
58927
|
+
db2.close();
|
|
58928
|
+
} catch {
|
|
58929
|
+
}
|
|
58930
|
+
_state4 = { cursor: maxId, modelCache: /* @__PURE__ */ new Map() };
|
|
58931
|
+
console.error(`\u{1F4DD} [Hermes] capture armed: cursor=${maxId} (live-from-now)`);
|
|
58932
|
+
if (_pollTimer4) clearInterval(_pollTimer4);
|
|
58933
|
+
_pollTimer4 = setInterval(() => {
|
|
58934
|
+
void flush();
|
|
58935
|
+
}, POLL_INTERVAL_MS4);
|
|
58936
|
+
}
|
|
58937
|
+
async function flush() {
|
|
58938
|
+
const empty = { inserted: 0, dedup: 0, skipped: 0 };
|
|
58939
|
+
if (!_state4 || _flushInProgress4) return empty;
|
|
58940
|
+
_flushInProgress4 = true;
|
|
58941
|
+
const DatabaseSync = await loadSqlite();
|
|
58942
|
+
if (!DatabaseSync) {
|
|
58943
|
+
_flushInProgress4 = false;
|
|
58944
|
+
return empty;
|
|
58945
|
+
}
|
|
58946
|
+
const db2 = openRo(DatabaseSync);
|
|
58947
|
+
if (!db2) {
|
|
58948
|
+
_consecutiveOpenFailures++;
|
|
58949
|
+
if (_consecutiveOpenFailures >= MAX_OPEN_FAILURES) {
|
|
58950
|
+
console.error(
|
|
58951
|
+
`\u{1F4DD} [Hermes] openRo ${_consecutiveOpenFailures}\uD68C \uC5F0\uC18D \uC2E4\uD328 \u2014 capture \uBE44\uD65C\uC131(save_message fallback \uBCF5\uADC0)`
|
|
58952
|
+
);
|
|
58953
|
+
resetCaptureState();
|
|
58954
|
+
}
|
|
58955
|
+
_flushInProgress4 = false;
|
|
58956
|
+
return empty;
|
|
58957
|
+
}
|
|
58958
|
+
_consecutiveOpenFailures = 0;
|
|
58959
|
+
let inserted = 0;
|
|
58960
|
+
let dedup = 0;
|
|
58961
|
+
let skipped = 0;
|
|
58962
|
+
try {
|
|
58963
|
+
const { rows, maxId } = parseNewRows(db2, _state4.cursor);
|
|
58964
|
+
let firstFailedId = null;
|
|
58965
|
+
if (rows.length > 0) {
|
|
58966
|
+
const userId = await getDefaultUserId();
|
|
58967
|
+
for (const r of rows) {
|
|
58968
|
+
const agentModel = r.role === "user" ? null : lookupModel(db2, r.sessionId, _state4.modelCache) ?? "unknown";
|
|
58969
|
+
try {
|
|
58970
|
+
const res = await insertRawMemory({
|
|
58971
|
+
user_id: userId,
|
|
58972
|
+
agent_platform: AGENT_PLATFORM2,
|
|
58973
|
+
agent_model: agentModel,
|
|
58974
|
+
role: r.role,
|
|
58975
|
+
message: r.message,
|
|
58976
|
+
external_uuid: `hermes:${r.id}`,
|
|
58977
|
+
device_name: DEVICE_NAME5
|
|
58978
|
+
});
|
|
58979
|
+
if (res.inserted) inserted++;
|
|
58980
|
+
else dedup++;
|
|
58981
|
+
} catch (err2) {
|
|
58982
|
+
console.error(
|
|
58983
|
+
`\u26A0\uFE0F [Hermes] insert failed at id ${r.id}:`,
|
|
58984
|
+
err2 instanceof Error ? err2.message : err2
|
|
58985
|
+
);
|
|
58986
|
+
skipped++;
|
|
58987
|
+
if (firstFailedId === null) firstFailedId = r.id;
|
|
58988
|
+
}
|
|
58989
|
+
}
|
|
58990
|
+
}
|
|
58991
|
+
const advanceTo = firstFailedId !== null ? firstFailedId - 1 : maxId;
|
|
58992
|
+
if (advanceTo > _state4.cursor) _state4.cursor = advanceTo;
|
|
58993
|
+
} catch (err2) {
|
|
58994
|
+
console.error(
|
|
58995
|
+
"\u26A0\uFE0F [Hermes] flush error:",
|
|
58996
|
+
err2 instanceof Error ? err2.message : err2
|
|
58997
|
+
);
|
|
58998
|
+
} finally {
|
|
58999
|
+
try {
|
|
59000
|
+
db2.close();
|
|
59001
|
+
} catch {
|
|
59002
|
+
}
|
|
59003
|
+
_flushInProgress4 = false;
|
|
59004
|
+
}
|
|
59005
|
+
if (inserted || dedup || skipped) {
|
|
59006
|
+
console.error(
|
|
59007
|
+
`\u{1F4DD} [Hermes] flush: inserted=${inserted}, dedup=${dedup}, skipped=${skipped}, cursor=${_state4?.cursor}`
|
|
59008
|
+
);
|
|
59009
|
+
}
|
|
59010
|
+
return { inserted, dedup, skipped };
|
|
59011
|
+
}
|
|
59012
|
+
async function captureSessionEnd4() {
|
|
59013
|
+
if (_pollTimer4) {
|
|
59014
|
+
clearInterval(_pollTimer4);
|
|
59015
|
+
_pollTimer4 = null;
|
|
59016
|
+
}
|
|
59017
|
+
const waitStart = Date.now();
|
|
59018
|
+
while (_flushInProgress4 && Date.now() - waitStart < 2e3) {
|
|
59019
|
+
await new Promise((r2) => setTimeout(r2, 50));
|
|
59020
|
+
}
|
|
59021
|
+
if (!_state4) return { inserted: 0, skipped: 0, error: "session not armed" };
|
|
59022
|
+
const r = await flush();
|
|
59023
|
+
if (r.inserted || r.skipped) {
|
|
59024
|
+
console.error(
|
|
59025
|
+
`\u{1F4DD} [Hermes] final flush: inserted=${r.inserted}, dedup=${r.dedup}, skipped=${r.skipped}`
|
|
59026
|
+
);
|
|
59027
|
+
}
|
|
59028
|
+
return { inserted: r.inserted, skipped: r.skipped };
|
|
59029
|
+
}
|
|
59030
|
+
function resetCaptureState() {
|
|
59031
|
+
if (_pollTimer4) {
|
|
59032
|
+
clearInterval(_pollTimer4);
|
|
59033
|
+
_pollTimer4 = null;
|
|
59034
|
+
}
|
|
59035
|
+
_state4 = null;
|
|
59036
|
+
_flushInProgress4 = false;
|
|
59037
|
+
}
|
|
59038
|
+
|
|
59039
|
+
// src/auto_save/save_message_tool.ts
|
|
59040
|
+
var DEVICE_NAME6 = os9.hostname();
|
|
58818
59041
|
function registerSaveMessage(server) {
|
|
58819
59042
|
server.registerTool(
|
|
58820
59043
|
"save_message",
|
|
@@ -58871,6 +59094,14 @@ subagent \uCEE8\uD14D\uC2A4\uD2B8\uB77C\uBA74 subagent=true + subagent_model + s
|
|
|
58871
59094
|
}]
|
|
58872
59095
|
};
|
|
58873
59096
|
}
|
|
59097
|
+
if (id.agent_platform === "mcp" && isCaptureArmed4()) {
|
|
59098
|
+
return {
|
|
59099
|
+
content: [{
|
|
59100
|
+
type: "text",
|
|
59101
|
+
text: JSON.stringify({ stored: false, skipped: "passive capture active" }, null, 2)
|
|
59102
|
+
}]
|
|
59103
|
+
};
|
|
59104
|
+
}
|
|
58874
59105
|
const agentModel = args.role === "user" ? null : id.agent_model;
|
|
58875
59106
|
const inserted = await insertRawMemory({
|
|
58876
59107
|
user_id: userId,
|
|
@@ -58881,7 +59112,7 @@ subagent \uCEE8\uD14D\uC2A4\uD2B8\uB77C\uBA74 subagent=true + subagent_model + s
|
|
|
58881
59112
|
subagent_role: id.subagent_role,
|
|
58882
59113
|
role: args.role,
|
|
58883
59114
|
message: args.message,
|
|
58884
|
-
device_name:
|
|
59115
|
+
device_name: DEVICE_NAME6
|
|
58885
59116
|
// tag/embed NULL — Cold Path가 background 처리 (Hot Path latency 보장)
|
|
58886
59117
|
});
|
|
58887
59118
|
return {
|
|
@@ -59574,16 +59805,16 @@ async function drainColdPath(maxTicks = 12) {
|
|
|
59574
59805
|
}
|
|
59575
59806
|
|
|
59576
59807
|
// src/auto_save/jsonl_capture.ts
|
|
59577
|
-
import * as
|
|
59578
|
-
import * as
|
|
59579
|
-
import * as
|
|
59808
|
+
import * as fs6 from "node:fs";
|
|
59809
|
+
import * as path7 from "node:path";
|
|
59810
|
+
import * as os10 from "node:os";
|
|
59580
59811
|
var CLIENT_PLATFORM2 = "claude-code";
|
|
59581
|
-
var
|
|
59582
|
-
var PROJECTS_ROOT =
|
|
59812
|
+
var DEVICE_NAME7 = os10.hostname();
|
|
59813
|
+
var PROJECTS_ROOT = path7.join(os10.homedir(), ".claude", "projects");
|
|
59583
59814
|
var FLUSH_DEBOUNCE_MS4 = 200;
|
|
59584
|
-
var
|
|
59815
|
+
var _state5 = null;
|
|
59585
59816
|
var _watcher2 = null;
|
|
59586
|
-
var
|
|
59817
|
+
var _flushInProgress5 = false;
|
|
59587
59818
|
var _flushPending4 = false;
|
|
59588
59819
|
var _flushDebounceTimer4 = null;
|
|
59589
59820
|
function cwdToSlug(cwd) {
|
|
@@ -59591,29 +59822,29 @@ function cwdToSlug(cwd) {
|
|
|
59591
59822
|
}
|
|
59592
59823
|
function findProjectDir(cwd) {
|
|
59593
59824
|
const slug = cwdToSlug(cwd);
|
|
59594
|
-
const slugPath =
|
|
59825
|
+
const slugPath = path7.join(PROJECTS_ROOT, slug);
|
|
59595
59826
|
try {
|
|
59596
|
-
if (
|
|
59827
|
+
if (fs6.statSync(slugPath).isDirectory()) return slugPath;
|
|
59597
59828
|
} catch {
|
|
59598
59829
|
}
|
|
59599
59830
|
let subdirs;
|
|
59600
59831
|
try {
|
|
59601
|
-
subdirs =
|
|
59832
|
+
subdirs = fs6.readdirSync(PROJECTS_ROOT, { withFileTypes: true });
|
|
59602
59833
|
} catch {
|
|
59603
59834
|
return null;
|
|
59604
59835
|
}
|
|
59605
59836
|
for (const subdir of subdirs) {
|
|
59606
59837
|
if (!subdir.isDirectory()) continue;
|
|
59607
|
-
const dirPath =
|
|
59838
|
+
const dirPath = path7.join(PROJECTS_ROOT, subdir.name);
|
|
59608
59839
|
let files;
|
|
59609
59840
|
try {
|
|
59610
|
-
files =
|
|
59841
|
+
files = fs6.readdirSync(dirPath, { withFileTypes: true });
|
|
59611
59842
|
} catch {
|
|
59612
59843
|
continue;
|
|
59613
59844
|
}
|
|
59614
59845
|
for (const f of files) {
|
|
59615
59846
|
if (!f.isFile() || !f.name.endsWith(".jsonl")) continue;
|
|
59616
|
-
const foundCwd = readCwdFromJsonl(
|
|
59847
|
+
const foundCwd = readCwdFromJsonl(path7.join(dirPath, f.name));
|
|
59617
59848
|
if (foundCwd === cwd) return dirPath;
|
|
59618
59849
|
}
|
|
59619
59850
|
}
|
|
@@ -59622,13 +59853,13 @@ function findProjectDir(cwd) {
|
|
|
59622
59853
|
function readCwdFromJsonl(jsonlPath) {
|
|
59623
59854
|
let fd;
|
|
59624
59855
|
try {
|
|
59625
|
-
fd =
|
|
59856
|
+
fd = fs6.openSync(jsonlPath, "r");
|
|
59626
59857
|
} catch {
|
|
59627
59858
|
return null;
|
|
59628
59859
|
}
|
|
59629
59860
|
try {
|
|
59630
59861
|
const buf = Buffer.alloc(2048);
|
|
59631
|
-
const bytesRead =
|
|
59862
|
+
const bytesRead = fs6.readSync(fd, buf, 0, 2048, 0);
|
|
59632
59863
|
const raw = buf.slice(0, bytesRead).toString("utf-8");
|
|
59633
59864
|
for (const line of raw.split("\n")) {
|
|
59634
59865
|
if (!line.trim()) continue;
|
|
@@ -59640,11 +59871,11 @@ function readCwdFromJsonl(jsonlPath) {
|
|
|
59640
59871
|
}
|
|
59641
59872
|
return null;
|
|
59642
59873
|
} finally {
|
|
59643
|
-
|
|
59874
|
+
fs6.closeSync(fd);
|
|
59644
59875
|
}
|
|
59645
59876
|
}
|
|
59646
|
-
function
|
|
59647
|
-
|
|
59877
|
+
function captureSessionStart5(cwd) {
|
|
59878
|
+
_state5 = { cwd, projectDir: null, files: /* @__PURE__ */ new Map() };
|
|
59648
59879
|
_tryArm(cwd, 0);
|
|
59649
59880
|
}
|
|
59650
59881
|
var _MAX_ARM_RETRIES = 20;
|
|
@@ -59653,7 +59884,7 @@ function _tryArm(cwd, attempt) {
|
|
|
59653
59884
|
if (!projectDir) {
|
|
59654
59885
|
if (attempt < _MAX_ARM_RETRIES) {
|
|
59655
59886
|
setTimeout(() => {
|
|
59656
|
-
if (!
|
|
59887
|
+
if (!_state5 || _state5.cwd !== cwd) return;
|
|
59657
59888
|
_tryArm(cwd, attempt + 1);
|
|
59658
59889
|
}, 500);
|
|
59659
59890
|
} else {
|
|
@@ -59666,30 +59897,30 @@ function _tryArm(cwd, attempt) {
|
|
|
59666
59897
|
}
|
|
59667
59898
|
return;
|
|
59668
59899
|
}
|
|
59669
|
-
if (!
|
|
59670
|
-
|
|
59900
|
+
if (!_state5 || _state5.cwd !== cwd) return;
|
|
59901
|
+
_state5.projectDir = projectDir;
|
|
59671
59902
|
let entries;
|
|
59672
59903
|
try {
|
|
59673
|
-
entries =
|
|
59904
|
+
entries = fs6.readdirSync(projectDir, { withFileTypes: true });
|
|
59674
59905
|
} catch {
|
|
59675
59906
|
return;
|
|
59676
59907
|
}
|
|
59677
59908
|
for (const entry of entries) {
|
|
59678
59909
|
if (!entry.isFile() || !entry.name.endsWith(".jsonl")) continue;
|
|
59679
|
-
const jsonlPath =
|
|
59910
|
+
const jsonlPath = path7.join(projectDir, entry.name);
|
|
59680
59911
|
let stat;
|
|
59681
59912
|
try {
|
|
59682
|
-
stat =
|
|
59913
|
+
stat = fs6.statSync(jsonlPath);
|
|
59683
59914
|
} catch {
|
|
59684
59915
|
continue;
|
|
59685
59916
|
}
|
|
59686
59917
|
const sessionId = entry.name.replace(/\.jsonl$/, "");
|
|
59687
|
-
|
|
59918
|
+
_state5.files.set(jsonlPath, { cursorBytes: stat.size, sessionId, contentSeen: /* @__PURE__ */ new Set() });
|
|
59688
59919
|
}
|
|
59689
59920
|
if (attempt > 0) {
|
|
59690
|
-
console.error(`\u{1F4DD} [JSONL] project dir found on retry #${attempt}: ${
|
|
59921
|
+
console.error(`\u{1F4DD} [JSONL] project dir found on retry #${attempt}: ${path7.basename(projectDir)}/`);
|
|
59691
59922
|
}
|
|
59692
|
-
console.error(`\u{1F4DD} [JSONL] capture armed: ${
|
|
59923
|
+
console.error(`\u{1F4DD} [JSONL] capture armed: ${_state5.files.size} jsonl(s) in ${path7.basename(projectDir)}/`);
|
|
59693
59924
|
armDirWatcher3();
|
|
59694
59925
|
}
|
|
59695
59926
|
function parseEntry3(line) {
|
|
@@ -59729,23 +59960,23 @@ function parseEntry3(line) {
|
|
|
59729
59960
|
};
|
|
59730
59961
|
}
|
|
59731
59962
|
async function flushDeltaForFile4(jsonlPath, fileState) {
|
|
59732
|
-
if (!
|
|
59963
|
+
if (!fs6.existsSync(jsonlPath)) return { inserted: 0, skipped: 0, dedup: 0 };
|
|
59733
59964
|
let stat;
|
|
59734
59965
|
try {
|
|
59735
|
-
stat =
|
|
59966
|
+
stat = fs6.statSync(jsonlPath);
|
|
59736
59967
|
} catch {
|
|
59737
59968
|
return { inserted: 0, skipped: 0, dedup: 0 };
|
|
59738
59969
|
}
|
|
59739
59970
|
if (stat.size <= fileState.cursorBytes) return { inserted: 0, skipped: 0, dedup: 0 };
|
|
59740
59971
|
const length = stat.size - fileState.cursorBytes;
|
|
59741
|
-
const fd =
|
|
59972
|
+
const fd = fs6.openSync(jsonlPath, "r");
|
|
59742
59973
|
let raw;
|
|
59743
59974
|
try {
|
|
59744
59975
|
const buf = Buffer.alloc(length);
|
|
59745
|
-
|
|
59976
|
+
fs6.readSync(fd, buf, 0, length, fileState.cursorBytes);
|
|
59746
59977
|
raw = buf.toString("utf-8");
|
|
59747
59978
|
} finally {
|
|
59748
|
-
|
|
59979
|
+
fs6.closeSync(fd);
|
|
59749
59980
|
}
|
|
59750
59981
|
const lastNl = raw.lastIndexOf("\n");
|
|
59751
59982
|
if (lastNl === -1) return { inserted: 0, skipped: 0, dedup: 0 };
|
|
@@ -59779,7 +60010,7 @@ async function flushDeltaForFile4(jsonlPath, fileState) {
|
|
|
59779
60010
|
role: parsed.role,
|
|
59780
60011
|
message: parsed.message,
|
|
59781
60012
|
external_uuid: externalUuid,
|
|
59782
|
-
device_name:
|
|
60013
|
+
device_name: DEVICE_NAME7
|
|
59783
60014
|
});
|
|
59784
60015
|
if (result.inserted) inserted++;
|
|
59785
60016
|
else dedup++;
|
|
@@ -59792,24 +60023,24 @@ async function flushDeltaForFile4(jsonlPath, fileState) {
|
|
|
59792
60023
|
return { inserted, skipped, dedup };
|
|
59793
60024
|
}
|
|
59794
60025
|
async function flushAllFiles4() {
|
|
59795
|
-
if (!
|
|
59796
|
-
const projectDir =
|
|
59797
|
-
if (!
|
|
60026
|
+
if (!_state5 || !_state5.projectDir) return { inserted: 0, skipped: 0, dedup: 0 };
|
|
60027
|
+
const projectDir = _state5.projectDir;
|
|
60028
|
+
if (!fs6.existsSync(projectDir)) return { inserted: 0, skipped: 0, dedup: 0 };
|
|
59798
60029
|
let entries;
|
|
59799
60030
|
try {
|
|
59800
|
-
entries =
|
|
60031
|
+
entries = fs6.readdirSync(projectDir, { withFileTypes: true });
|
|
59801
60032
|
} catch {
|
|
59802
60033
|
return { inserted: 0, skipped: 0, dedup: 0 };
|
|
59803
60034
|
}
|
|
59804
60035
|
let totalI = 0, totalS = 0, totalD = 0;
|
|
59805
60036
|
for (const entry of entries) {
|
|
59806
60037
|
if (!entry.isFile() || !entry.name.endsWith(".jsonl")) continue;
|
|
59807
|
-
const jsonlPath =
|
|
59808
|
-
let fileState =
|
|
60038
|
+
const jsonlPath = path7.join(projectDir, entry.name);
|
|
60039
|
+
let fileState = _state5.files.get(jsonlPath);
|
|
59809
60040
|
if (!fileState) {
|
|
59810
60041
|
const sessionId = entry.name.replace(/\.jsonl$/, "");
|
|
59811
60042
|
fileState = { cursorBytes: 0, sessionId, contentSeen: /* @__PURE__ */ new Set() };
|
|
59812
|
-
|
|
60043
|
+
_state5.files.set(jsonlPath, fileState);
|
|
59813
60044
|
console.error(`\u{1F4DD} [JSONL] new session detected: ${entry.name}`);
|
|
59814
60045
|
}
|
|
59815
60046
|
const r = await flushDeltaForFile4(jsonlPath, fileState);
|
|
@@ -59820,11 +60051,11 @@ async function flushAllFiles4() {
|
|
|
59820
60051
|
return { inserted: totalI, skipped: totalS, dedup: totalD };
|
|
59821
60052
|
}
|
|
59822
60053
|
async function flushWithMutex4() {
|
|
59823
|
-
if (
|
|
60054
|
+
if (_flushInProgress5) {
|
|
59824
60055
|
_flushPending4 = true;
|
|
59825
60056
|
return;
|
|
59826
60057
|
}
|
|
59827
|
-
|
|
60058
|
+
_flushInProgress5 = true;
|
|
59828
60059
|
try {
|
|
59829
60060
|
const r = await flushAllFiles4();
|
|
59830
60061
|
if (r.inserted > 0 || r.skipped > 0 || r.dedup > 0) {
|
|
@@ -59833,7 +60064,7 @@ async function flushWithMutex4() {
|
|
|
59833
60064
|
} catch (err2) {
|
|
59834
60065
|
console.error("\u26A0\uFE0F [JSONL] live flush error:", err2);
|
|
59835
60066
|
} finally {
|
|
59836
|
-
|
|
60067
|
+
_flushInProgress5 = false;
|
|
59837
60068
|
if (_flushPending4) {
|
|
59838
60069
|
_flushPending4 = false;
|
|
59839
60070
|
setImmediate(() => {
|
|
@@ -59850,10 +60081,10 @@ function scheduleFlush4() {
|
|
|
59850
60081
|
}, FLUSH_DEBOUNCE_MS4);
|
|
59851
60082
|
}
|
|
59852
60083
|
function armDirWatcher3() {
|
|
59853
|
-
if (!
|
|
60084
|
+
if (!_state5 || !_state5.projectDir) return;
|
|
59854
60085
|
if (_watcher2) return;
|
|
59855
60086
|
try {
|
|
59856
|
-
_watcher2 =
|
|
60087
|
+
_watcher2 = fs6.watch(_state5.projectDir, (_eventType, filename) => {
|
|
59857
60088
|
if (filename && !filename.endsWith(".jsonl")) return;
|
|
59858
60089
|
scheduleFlush4();
|
|
59859
60090
|
});
|
|
@@ -59875,16 +60106,16 @@ function disarmDirWatcher3() {
|
|
|
59875
60106
|
_watcher2 = null;
|
|
59876
60107
|
}
|
|
59877
60108
|
}
|
|
59878
|
-
async function
|
|
60109
|
+
async function captureSessionEnd5() {
|
|
59879
60110
|
disarmDirWatcher3();
|
|
59880
60111
|
const waitStart = Date.now();
|
|
59881
|
-
while (
|
|
60112
|
+
while (_flushInProgress5 && Date.now() - waitStart < 2e3) {
|
|
59882
60113
|
await new Promise((r) => setTimeout(r, 50));
|
|
59883
60114
|
}
|
|
59884
|
-
if (!
|
|
60115
|
+
if (!_state5 || !_state5.projectDir) {
|
|
59885
60116
|
return { inserted: 0, skipped: 0, error: "session not armed" };
|
|
59886
60117
|
}
|
|
59887
|
-
|
|
60118
|
+
_flushInProgress5 = true;
|
|
59888
60119
|
try {
|
|
59889
60120
|
const r = await flushAllFiles4();
|
|
59890
60121
|
if (r.inserted > 0 || r.skipped > 0 || r.dedup > 0) {
|
|
@@ -59892,20 +60123,20 @@ async function captureSessionEnd4() {
|
|
|
59892
60123
|
}
|
|
59893
60124
|
return { inserted: r.inserted, skipped: r.skipped };
|
|
59894
60125
|
} finally {
|
|
59895
|
-
|
|
60126
|
+
_flushInProgress5 = false;
|
|
59896
60127
|
}
|
|
59897
60128
|
}
|
|
59898
60129
|
|
|
59899
60130
|
// src/auto_save/codex_capture.ts
|
|
59900
|
-
import * as
|
|
59901
|
-
import * as
|
|
59902
|
-
import * as
|
|
60131
|
+
import * as fs7 from "node:fs";
|
|
60132
|
+
import * as path8 from "node:path";
|
|
60133
|
+
import * as os11 from "node:os";
|
|
59903
60134
|
import { spawnSync } from "node:child_process";
|
|
59904
|
-
var
|
|
59905
|
-
var SESSIONS_ROOT2 =
|
|
59906
|
-
var
|
|
60135
|
+
var DEVICE_NAME8 = os11.hostname();
|
|
60136
|
+
var SESSIONS_ROOT2 = path8.join(os11.homedir(), ".codex", "sessions");
|
|
60137
|
+
var STATE_DB2 = path8.join(os11.homedir(), ".codex", "state_5.sqlite");
|
|
59907
60138
|
var FLUSH_DEBOUNCE_MS5 = 200;
|
|
59908
|
-
var
|
|
60139
|
+
var POLL_INTERVAL_MS5 = 3e3;
|
|
59909
60140
|
function sourceToPlatform(source) {
|
|
59910
60141
|
switch (source) {
|
|
59911
60142
|
case "cli":
|
|
@@ -59924,7 +60155,7 @@ function lookupPlatform(sessionId) {
|
|
|
59924
60155
|
try {
|
|
59925
60156
|
const res = spawnSync(
|
|
59926
60157
|
"sqlite3",
|
|
59927
|
-
[
|
|
60158
|
+
[STATE_DB2, `SELECT source FROM threads WHERE id='${sessionId}' LIMIT 1;`],
|
|
59928
60159
|
{ encoding: "utf-8", timeout: 500 }
|
|
59929
60160
|
);
|
|
59930
60161
|
const source = (res.stdout ?? "").trim();
|
|
@@ -59933,11 +60164,11 @@ function lookupPlatform(sessionId) {
|
|
|
59933
60164
|
}
|
|
59934
60165
|
return "codex-mcp-client";
|
|
59935
60166
|
}
|
|
59936
|
-
var
|
|
60167
|
+
var _state6 = null;
|
|
59937
60168
|
var SERVER_START_MS3 = Date.now();
|
|
59938
60169
|
var _watcher3 = null;
|
|
59939
|
-
var
|
|
59940
|
-
var
|
|
60170
|
+
var _pollTimer5 = null;
|
|
60171
|
+
var _flushInProgress6 = false;
|
|
59941
60172
|
var _flushPending5 = false;
|
|
59942
60173
|
var _flushDebounceTimer5 = null;
|
|
59943
60174
|
function extractSessionId2(filename) {
|
|
@@ -59945,18 +60176,18 @@ function extractSessionId2(filename) {
|
|
|
59945
60176
|
return m ? m[1] : null;
|
|
59946
60177
|
}
|
|
59947
60178
|
function* walkRollouts(root) {
|
|
59948
|
-
if (!
|
|
60179
|
+
if (!fs7.existsSync(root)) return;
|
|
59949
60180
|
const stack = [root];
|
|
59950
60181
|
while (stack.length) {
|
|
59951
60182
|
const dir = stack.pop();
|
|
59952
60183
|
let entries;
|
|
59953
60184
|
try {
|
|
59954
|
-
entries =
|
|
60185
|
+
entries = fs7.readdirSync(dir, { withFileTypes: true });
|
|
59955
60186
|
} catch {
|
|
59956
60187
|
continue;
|
|
59957
60188
|
}
|
|
59958
60189
|
for (const e of entries) {
|
|
59959
|
-
const p =
|
|
60190
|
+
const p = path8.join(dir, e.name);
|
|
59960
60191
|
if (e.isDirectory()) {
|
|
59961
60192
|
stack.push(p);
|
|
59962
60193
|
} else if (e.isFile() && e.name.startsWith("rollout-") && e.name.endsWith(".jsonl")) {
|
|
@@ -59965,9 +60196,9 @@ function* walkRollouts(root) {
|
|
|
59965
60196
|
}
|
|
59966
60197
|
}
|
|
59967
60198
|
}
|
|
59968
|
-
function
|
|
59969
|
-
const rootExists =
|
|
59970
|
-
|
|
60199
|
+
function captureSessionStart6(_cwd) {
|
|
60200
|
+
const rootExists = fs7.existsSync(SESSIONS_ROOT2);
|
|
60201
|
+
_state6 = {
|
|
59971
60202
|
rootExists,
|
|
59972
60203
|
files: /* @__PURE__ */ new Map()
|
|
59973
60204
|
};
|
|
@@ -59978,13 +60209,13 @@ function captureSessionStart5(_cwd) {
|
|
|
59978
60209
|
for (const filePath of walkRollouts(SESSIONS_ROOT2)) {
|
|
59979
60210
|
let stat;
|
|
59980
60211
|
try {
|
|
59981
|
-
stat =
|
|
60212
|
+
stat = fs7.statSync(filePath);
|
|
59982
60213
|
} catch {
|
|
59983
60214
|
continue;
|
|
59984
60215
|
}
|
|
59985
|
-
const sessionId = extractSessionId2(
|
|
60216
|
+
const sessionId = extractSessionId2(path8.basename(filePath));
|
|
59986
60217
|
if (!sessionId) continue;
|
|
59987
|
-
|
|
60218
|
+
_state6.files.set(filePath, {
|
|
59988
60219
|
cursorBytes: stat.size,
|
|
59989
60220
|
sessionId,
|
|
59990
60221
|
agentPlatform: lookupPlatform(sessionId),
|
|
@@ -60032,23 +60263,23 @@ function extractModelFromTurnContext(line) {
|
|
|
60032
60263
|
}
|
|
60033
60264
|
}
|
|
60034
60265
|
async function flushDeltaForFile5(filePath, fileState) {
|
|
60035
|
-
if (!
|
|
60266
|
+
if (!fs7.existsSync(filePath)) return { inserted: 0, skipped: 0, dedup: 0 };
|
|
60036
60267
|
let stat;
|
|
60037
60268
|
try {
|
|
60038
|
-
stat =
|
|
60269
|
+
stat = fs7.statSync(filePath);
|
|
60039
60270
|
} catch {
|
|
60040
60271
|
return { inserted: 0, skipped: 0, dedup: 0 };
|
|
60041
60272
|
}
|
|
60042
60273
|
if (stat.size <= fileState.cursorBytes) return { inserted: 0, skipped: 0, dedup: 0 };
|
|
60043
60274
|
const length = stat.size - fileState.cursorBytes;
|
|
60044
|
-
const fd =
|
|
60275
|
+
const fd = fs7.openSync(filePath, "r");
|
|
60045
60276
|
let raw;
|
|
60046
60277
|
try {
|
|
60047
60278
|
const buf = Buffer.alloc(length);
|
|
60048
|
-
|
|
60279
|
+
fs7.readSync(fd, buf, 0, length, fileState.cursorBytes);
|
|
60049
60280
|
raw = buf.toString("utf-8");
|
|
60050
60281
|
} finally {
|
|
60051
|
-
|
|
60282
|
+
fs7.closeSync(fd);
|
|
60052
60283
|
}
|
|
60053
60284
|
const lastNl = raw.lastIndexOf("\n");
|
|
60054
60285
|
if (lastNl === -1) return { inserted: 0, skipped: 0, dedup: 0 };
|
|
@@ -60089,7 +60320,7 @@ async function flushDeltaForFile5(filePath, fileState) {
|
|
|
60089
60320
|
role: parsed.role,
|
|
60090
60321
|
message: parsed.message,
|
|
60091
60322
|
external_uuid: externalUuid,
|
|
60092
|
-
device_name:
|
|
60323
|
+
device_name: DEVICE_NAME8
|
|
60093
60324
|
});
|
|
60094
60325
|
if (result.inserted) inserted++;
|
|
60095
60326
|
else dedup++;
|
|
@@ -60103,25 +60334,25 @@ async function flushDeltaForFile5(filePath, fileState) {
|
|
|
60103
60334
|
return { inserted, skipped, dedup };
|
|
60104
60335
|
}
|
|
60105
60336
|
async function flushAllFiles5() {
|
|
60106
|
-
if (!
|
|
60337
|
+
if (!_state6 || !_state6.rootExists) return { inserted: 0, skipped: 0, dedup: 0 };
|
|
60107
60338
|
let totalI = 0, totalS = 0, totalD = 0;
|
|
60108
60339
|
for (const filePath of walkRollouts(SESSIONS_ROOT2)) {
|
|
60109
|
-
let fileState =
|
|
60340
|
+
let fileState = _state6.files.get(filePath);
|
|
60110
60341
|
if (!fileState) {
|
|
60111
|
-
const sessionId = extractSessionId2(
|
|
60342
|
+
const sessionId = extractSessionId2(path8.basename(filePath));
|
|
60112
60343
|
if (!sessionId) continue;
|
|
60113
60344
|
let stat = null;
|
|
60114
60345
|
try {
|
|
60115
|
-
stat =
|
|
60346
|
+
stat = fs7.statSync(filePath);
|
|
60116
60347
|
} catch {
|
|
60117
60348
|
}
|
|
60118
60349
|
const fileBirthMs = stat ? stat.birthtimeMs || stat.ctimeMs : SERVER_START_MS3;
|
|
60119
60350
|
const isPreExisting = fileBirthMs < SERVER_START_MS3 - 5e3;
|
|
60120
60351
|
const initialCursor = isPreExisting ? stat?.size ?? 0 : 0;
|
|
60121
60352
|
if (isPreExisting) {
|
|
60122
|
-
console.error(`\u{1F4DD} [Codex] pre-existing rollout skipped (cursor=${initialCursor}): ${
|
|
60353
|
+
console.error(`\u{1F4DD} [Codex] pre-existing rollout skipped (cursor=${initialCursor}): ${path8.basename(filePath)}`);
|
|
60123
60354
|
} else {
|
|
60124
|
-
console.error(`\u{1F4DD} [Codex] new rollout detected: ${
|
|
60355
|
+
console.error(`\u{1F4DD} [Codex] new rollout detected: ${path8.basename(filePath)}`);
|
|
60125
60356
|
}
|
|
60126
60357
|
fileState = {
|
|
60127
60358
|
cursorBytes: initialCursor,
|
|
@@ -60129,7 +60360,7 @@ async function flushAllFiles5() {
|
|
|
60129
60360
|
agentPlatform: lookupPlatform(sessionId),
|
|
60130
60361
|
currentModel: null
|
|
60131
60362
|
};
|
|
60132
|
-
|
|
60363
|
+
_state6.files.set(filePath, fileState);
|
|
60133
60364
|
}
|
|
60134
60365
|
const r = await flushDeltaForFile5(filePath, fileState);
|
|
60135
60366
|
totalI += r.inserted;
|
|
@@ -60139,11 +60370,11 @@ async function flushAllFiles5() {
|
|
|
60139
60370
|
return { inserted: totalI, skipped: totalS, dedup: totalD };
|
|
60140
60371
|
}
|
|
60141
60372
|
async function flushWithMutex5() {
|
|
60142
|
-
if (
|
|
60373
|
+
if (_flushInProgress6) {
|
|
60143
60374
|
_flushPending5 = true;
|
|
60144
60375
|
return;
|
|
60145
60376
|
}
|
|
60146
|
-
|
|
60377
|
+
_flushInProgress6 = true;
|
|
60147
60378
|
try {
|
|
60148
60379
|
const r = await flushAllFiles5();
|
|
60149
60380
|
if (r.inserted > 0 || r.skipped > 0 || r.dedup > 0) {
|
|
@@ -60152,7 +60383,7 @@ async function flushWithMutex5() {
|
|
|
60152
60383
|
} catch (err2) {
|
|
60153
60384
|
console.error("\u26A0\uFE0F [Codex] live flush error:", err2);
|
|
60154
60385
|
} finally {
|
|
60155
|
-
|
|
60386
|
+
_flushInProgress6 = false;
|
|
60156
60387
|
if (_flushPending5) {
|
|
60157
60388
|
_flushPending5 = false;
|
|
60158
60389
|
setImmediate(() => {
|
|
@@ -60169,12 +60400,12 @@ function scheduleFlush5() {
|
|
|
60169
60400
|
}, FLUSH_DEBOUNCE_MS5);
|
|
60170
60401
|
}
|
|
60171
60402
|
function armDirWatcher4() {
|
|
60172
|
-
if (!
|
|
60403
|
+
if (!_state6 || !_state6.rootExists) return;
|
|
60173
60404
|
if (_watcher3) return;
|
|
60174
60405
|
try {
|
|
60175
|
-
_watcher3 =
|
|
60406
|
+
_watcher3 = fs7.watch(SESSIONS_ROOT2, { recursive: true }, (_evt, filename) => {
|
|
60176
60407
|
if (!filename) return;
|
|
60177
|
-
const base =
|
|
60408
|
+
const base = path8.basename(filename);
|
|
60178
60409
|
if (!base.startsWith("rollout-") || !base.endsWith(".jsonl")) return;
|
|
60179
60410
|
scheduleFlush5();
|
|
60180
60411
|
});
|
|
@@ -60182,18 +60413,18 @@ function armDirWatcher4() {
|
|
|
60182
60413
|
} catch (err2) {
|
|
60183
60414
|
console.error("\u26A0\uFE0F [Codex] fs.watch failed \u2014 polling only:", err2);
|
|
60184
60415
|
}
|
|
60185
|
-
|
|
60416
|
+
_pollTimer5 = setInterval(() => {
|
|
60186
60417
|
void flushWithMutex5();
|
|
60187
|
-
},
|
|
60418
|
+
}, POLL_INTERVAL_MS5);
|
|
60188
60419
|
}
|
|
60189
60420
|
function disarmDirWatcher4() {
|
|
60190
60421
|
if (_flushDebounceTimer5) {
|
|
60191
60422
|
clearTimeout(_flushDebounceTimer5);
|
|
60192
60423
|
_flushDebounceTimer5 = null;
|
|
60193
60424
|
}
|
|
60194
|
-
if (
|
|
60195
|
-
clearInterval(
|
|
60196
|
-
|
|
60425
|
+
if (_pollTimer5) {
|
|
60426
|
+
clearInterval(_pollTimer5);
|
|
60427
|
+
_pollTimer5 = null;
|
|
60197
60428
|
}
|
|
60198
60429
|
if (_watcher3) {
|
|
60199
60430
|
try {
|
|
@@ -60203,16 +60434,16 @@ function disarmDirWatcher4() {
|
|
|
60203
60434
|
_watcher3 = null;
|
|
60204
60435
|
}
|
|
60205
60436
|
}
|
|
60206
|
-
async function
|
|
60437
|
+
async function captureSessionEnd6() {
|
|
60207
60438
|
disarmDirWatcher4();
|
|
60208
60439
|
const waitStart = Date.now();
|
|
60209
|
-
while (
|
|
60440
|
+
while (_flushInProgress6 && Date.now() - waitStart < 2e3) {
|
|
60210
60441
|
await new Promise((r) => setTimeout(r, 50));
|
|
60211
60442
|
}
|
|
60212
|
-
if (!
|
|
60443
|
+
if (!_state6 || !_state6.rootExists) {
|
|
60213
60444
|
return { inserted: 0, skipped: 0, error: "session not armed" };
|
|
60214
60445
|
}
|
|
60215
|
-
|
|
60446
|
+
_flushInProgress6 = true;
|
|
60216
60447
|
try {
|
|
60217
60448
|
const r = await flushAllFiles5();
|
|
60218
60449
|
if (r.inserted > 0 || r.skipped > 0 || r.dedup > 0) {
|
|
@@ -60220,21 +60451,21 @@ async function captureSessionEnd5() {
|
|
|
60220
60451
|
}
|
|
60221
60452
|
return { inserted: r.inserted, skipped: r.skipped };
|
|
60222
60453
|
} finally {
|
|
60223
|
-
|
|
60454
|
+
_flushInProgress6 = false;
|
|
60224
60455
|
}
|
|
60225
60456
|
}
|
|
60226
60457
|
|
|
60227
60458
|
// src/version.ts
|
|
60228
|
-
import
|
|
60229
|
-
import
|
|
60459
|
+
import fs8 from "fs";
|
|
60460
|
+
import path9 from "path";
|
|
60230
60461
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
60231
|
-
var __dirname3 =
|
|
60232
|
-
var packageJsonPath =
|
|
60233
|
-
var packageJson = JSON.parse(
|
|
60462
|
+
var __dirname3 = path9.dirname(fileURLToPath2(import.meta.url));
|
|
60463
|
+
var packageJsonPath = path9.resolve(__dirname3, "..", "package.json");
|
|
60464
|
+
var packageJson = JSON.parse(fs8.readFileSync(packageJsonPath, "utf8"));
|
|
60234
60465
|
var PACKAGE_VERSION2 = packageJson.version || "0.0.0";
|
|
60235
60466
|
|
|
60236
60467
|
// src/index.ts
|
|
60237
|
-
import
|
|
60468
|
+
import fs10 from "fs";
|
|
60238
60469
|
var BRIEF_DB_TIMEOUT_MS = 5e3;
|
|
60239
60470
|
var INSTRUCTIONS_MAX_CHARS = Number(process.env.INSTRUCTIONS_MAX_CHARS ?? 1900);
|
|
60240
60471
|
var INSTRUCTIONS_SEP = "\n\n---\n\n";
|
|
@@ -60244,7 +60475,7 @@ var STATIC_INSTRUCTIONS = `Long-term memory MCP server (RESPEC v1).
|
|
|
60244
60475
|
|
|
60245
60476
|
Tools: memory_startup(\uC2DC\uC791 brief) \xB7 search_memory(\uACFC\uAC70 \uC870\uD68C/\uAC80\uC0C9) \xB7 manage_knowledge(\uC800\uC7A5/\uC218\uC815/\uC0AD\uC81C; \uAC15\uC81C\uAE30\uC5B5 is_pinned) \xB7 save_message(transcript \uBBF8\uC9C0\uC6D0 platform fallback).
|
|
60246
60477
|
|
|
60247
|
-
\uC790\uB3D9 \uC800\uC7A5: Claude Code / Codex CLI / Gemini CLI / Grok Build / Antigravity\uB294 transcript \uC790\uB3D9 \uCEA1\uCC98 \u2014 save_message \uD638\uCD9C \uAE08\uC9C0(\uC911\uBCF5 row). \uADF8 \uC678 platform\uB9CC \uB9E4 turn save_message.
|
|
60478
|
+
\uC790\uB3D9 \uC800\uC7A5: Claude Code / Codex CLI / Gemini CLI / Grok Build / Antigravity / Hermes\uB294 transcript \uC790\uB3D9 \uCEA1\uCC98 \u2014 save_message \uD638\uCD9C \uAE08\uC9C0(\uC911\uBCF5 row). \uADF8 \uC678 platform\uB9CC \uB9E4 turn save_message.
|
|
60248
60479
|
|
|
60249
60480
|
\uB2A5\uB3D9 \uADDC\uCE59(mandatory): named entity(\uD504\uB85C\uC81D\uD2B8\xB7repo\xB7\uC778\uBB3C) \uC5B8\uAE09 \uC2DC, \uB610\uB294 \uACFC\uAC70 \uC120\uD638\xB7\uACB0\uC815\uC744 \uAC00\uC815\uD558\uAE30 \uC804 \uBA3C\uC800 search_memory. \uC791\uC5C5\uB2F9 1-2\uD68C.
|
|
60250
60481
|
|
|
@@ -60303,11 +60534,12 @@ async function shutdown(reason) {
|
|
|
60303
60534
|
try {
|
|
60304
60535
|
await Promise.race([
|
|
60305
60536
|
Promise.allSettled([
|
|
60306
|
-
captureSessionEnd4(),
|
|
60307
60537
|
captureSessionEnd5(),
|
|
60538
|
+
captureSessionEnd6(),
|
|
60308
60539
|
captureSessionEnd(),
|
|
60309
60540
|
captureSessionEnd2(),
|
|
60310
|
-
captureSessionEnd3()
|
|
60541
|
+
captureSessionEnd3(),
|
|
60542
|
+
captureSessionEnd4()
|
|
60311
60543
|
]),
|
|
60312
60544
|
new Promise((resolve) => setTimeout(resolve, 3e3))
|
|
60313
60545
|
]);
|
|
@@ -60414,16 +60646,17 @@ async function runMcpServer() {
|
|
|
60414
60646
|
registerTools(server);
|
|
60415
60647
|
installShutdownHandlers();
|
|
60416
60648
|
startParentWatchdog();
|
|
60417
|
-
captureSessionStart4(process.cwd());
|
|
60418
60649
|
captureSessionStart5(process.cwd());
|
|
60650
|
+
captureSessionStart6(process.cwd());
|
|
60419
60651
|
captureSessionStart(process.cwd());
|
|
60420
60652
|
captureSessionStart2(process.cwd());
|
|
60421
60653
|
captureSessionStart3(process.cwd());
|
|
60654
|
+
void captureSessionStart4(process.cwd());
|
|
60422
60655
|
console.error("\u{1F680} Starting Memory MCP Server...");
|
|
60423
60656
|
if (process.env.SSH_ENABLED === "true" && !process.env.SSH_KEY_PATH) {
|
|
60424
60657
|
throw new Error("\u274C SSH_KEY_PATH is required when SSH is enabled");
|
|
60425
60658
|
}
|
|
60426
|
-
if (process.env.SSH_KEY_PATH && !
|
|
60659
|
+
if (process.env.SSH_KEY_PATH && !fs10.existsSync(process.env.SSH_KEY_PATH)) {
|
|
60427
60660
|
console.error(`\u26A0\uFE0F [WARNING] SSH key not found at: ${process.env.SSH_KEY_PATH}`);
|
|
60428
60661
|
}
|
|
60429
60662
|
try {
|