opcode-pg-memory 2.2.8 → 2.3.1
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.js +232 -214
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -21006
- package/dist/index.js.map +1 -0
- package/dist/mcp-server.js +319 -302
- package/dist/mcp-server.js.map +1 -0
- package/dist/src/cache/semantic-cache.js +399 -0
- package/dist/src/cache/semantic-cache.js.map +1 -0
- package/dist/src/cli.js +404 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/config.d.ts +5 -0
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +89 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/db/init-db.js +545 -0
- package/dist/src/db/init-db.js.map +1 -0
- package/dist/src/hooks/message-part-updated.js +203 -0
- package/dist/src/hooks/message-part-updated.js.map +1 -0
- package/dist/src/hooks/message-updated.js +347 -0
- package/dist/src/hooks/message-updated.js.map +1 -0
- package/dist/src/hooks/session-compacting.js +179 -0
- package/dist/src/hooks/session-compacting.js.map +1 -0
- package/dist/src/hooks/session-completed.js +337 -0
- package/dist/src/hooks/session-completed.js.map +1 -0
- package/dist/src/hooks/session-created.js +206 -0
- package/dist/src/hooks/session-created.js.map +1 -0
- package/dist/src/hooks/tool-execute.js +267 -0
- package/dist/src/hooks/tool-execute.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +642 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/mcp/hindsight-reflect-omo.js +318 -0
- package/dist/src/mcp/hindsight-reflect-omo.js.map +1 -0
- package/dist/src/mcp/hindsight-reflect.js +838 -0
- package/dist/src/mcp/hindsight-reflect.js.map +1 -0
- package/dist/src/mcp/recall-memory-omo.js +263 -0
- package/dist/src/mcp/recall-memory-omo.js.map +1 -0
- package/dist/src/mcp/recall-memory.d.ts +6 -0
- package/dist/src/mcp/recall-memory.d.ts.map +1 -1
- package/dist/src/mcp/recall-memory.js +900 -0
- package/dist/src/mcp/recall-memory.js.map +1 -0
- package/dist/src/omo/adapter.js +583 -0
- package/dist/src/omo/adapter.js.map +1 -0
- package/dist/src/omo/types.js +44 -0
- package/dist/src/omo/types.js.map +1 -0
- package/dist/src/services/db-polling.d.ts +33 -0
- package/dist/src/services/db-polling.d.ts.map +1 -0
- package/dist/src/services/db-polling.js +104 -0
- package/dist/src/services/db-polling.js.map +1 -0
- package/dist/src/services/event-synchronizer.d.ts +15 -0
- package/dist/src/services/event-synchronizer.d.ts.map +1 -0
- package/dist/src/services/event-synchronizer.js +119 -0
- package/dist/src/services/event-synchronizer.js.map +1 -0
- package/dist/src/services/keyword.js +29 -0
- package/dist/src/services/keyword.js.map +1 -0
- package/dist/src/services/logger.js +42 -0
- package/dist/src/services/logger.js.map +1 -0
- package/dist/src/services/opencode-schema-adapter.d.ts +100 -0
- package/dist/src/services/opencode-schema-adapter.d.ts.map +1 -0
- package/dist/src/services/opencode-schema-adapter.js +192 -0
- package/dist/src/services/opencode-schema-adapter.js.map +1 -0
- package/dist/src/services/privacy.js +23 -0
- package/dist/src/services/privacy.js.map +1 -0
- package/dist/src/topic/segment-manager.js +447 -0
- package/dist/src/topic/segment-manager.js.map +1 -0
- package/dist/src/types.d.ts +20 -2
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +8 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils/embedding.js +180 -0
- package/dist/src/utils/embedding.js.map +1 -0
- package/dist/src/utils/token-budget.js +152 -0
- package/dist/src/utils/token-budget.js.map +1 -0
- package/package.json +5 -4
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module";
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __getProtoOf = Object.getPrototypeOf;
|
|
4
5
|
var __defProp = Object.defineProperty;
|
|
@@ -44,10 +45,11 @@ var __export = (target, all) => {
|
|
|
44
45
|
});
|
|
45
46
|
};
|
|
46
47
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
48
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
47
49
|
|
|
48
50
|
// node_modules/postgres-array/index.js
|
|
49
|
-
var require_postgres_array = __commonJS((
|
|
50
|
-
|
|
51
|
+
var require_postgres_array = __commonJS((exports) => {
|
|
52
|
+
exports.parse = function(source, transform) {
|
|
51
53
|
return new ArrayParser(source, transform).parse();
|
|
52
54
|
};
|
|
53
55
|
|
|
@@ -142,9 +144,9 @@ var require_postgres_array = __commonJS((exports2) => {
|
|
|
142
144
|
});
|
|
143
145
|
|
|
144
146
|
// node_modules/pg-types/lib/arrayParser.js
|
|
145
|
-
var require_arrayParser = __commonJS((
|
|
147
|
+
var require_arrayParser = __commonJS((exports, module) => {
|
|
146
148
|
var array = require_postgres_array();
|
|
147
|
-
|
|
149
|
+
module.exports = {
|
|
148
150
|
create: function(source, transform) {
|
|
149
151
|
return {
|
|
150
152
|
parse: function() {
|
|
@@ -156,12 +158,12 @@ var require_arrayParser = __commonJS((exports2, module2) => {
|
|
|
156
158
|
});
|
|
157
159
|
|
|
158
160
|
// node_modules/postgres-date/index.js
|
|
159
|
-
var require_postgres_date = __commonJS((
|
|
161
|
+
var require_postgres_date = __commonJS((exports, module) => {
|
|
160
162
|
var DATE_TIME = /(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/;
|
|
161
163
|
var DATE = /^(\d{1,})-(\d{2})-(\d{2})( BC)?$/;
|
|
162
164
|
var TIME_ZONE = /([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/;
|
|
163
165
|
var INFINITY = /^-?infinity$/;
|
|
164
|
-
|
|
166
|
+
module.exports = function parseDate(isoDate) {
|
|
165
167
|
if (INFINITY.test(isoDate)) {
|
|
166
168
|
return Number(isoDate.replace("i", "I"));
|
|
167
169
|
}
|
|
@@ -241,8 +243,8 @@ var require_postgres_date = __commonJS((exports2, module2) => {
|
|
|
241
243
|
});
|
|
242
244
|
|
|
243
245
|
// node_modules/xtend/mutable.js
|
|
244
|
-
var require_mutable = __commonJS((
|
|
245
|
-
|
|
246
|
+
var require_mutable = __commonJS((exports, module) => {
|
|
247
|
+
module.exports = extend;
|
|
246
248
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
247
249
|
function extend(target) {
|
|
248
250
|
for (var i = 1;i < arguments.length; i++) {
|
|
@@ -258,9 +260,9 @@ var require_mutable = __commonJS((exports2, module2) => {
|
|
|
258
260
|
});
|
|
259
261
|
|
|
260
262
|
// node_modules/postgres-interval/index.js
|
|
261
|
-
var require_postgres_interval = __commonJS((
|
|
263
|
+
var require_postgres_interval = __commonJS((exports, module) => {
|
|
262
264
|
var extend = require_mutable();
|
|
263
|
-
|
|
265
|
+
module.exports = PostgresInterval;
|
|
264
266
|
function PostgresInterval(raw) {
|
|
265
267
|
if (!(this instanceof PostgresInterval)) {
|
|
266
268
|
return new PostgresInterval(raw);
|
|
@@ -350,9 +352,9 @@ var require_postgres_interval = __commonJS((exports2, module2) => {
|
|
|
350
352
|
});
|
|
351
353
|
|
|
352
354
|
// node_modules/postgres-bytea/index.js
|
|
353
|
-
var require_postgres_bytea = __commonJS((
|
|
355
|
+
var require_postgres_bytea = __commonJS((exports, module) => {
|
|
354
356
|
var bufferFrom = Buffer.from || Buffer;
|
|
355
|
-
|
|
357
|
+
module.exports = function parseBytea(input) {
|
|
356
358
|
if (/^\\x/.test(input)) {
|
|
357
359
|
return bufferFrom(input.substr(2), "hex");
|
|
358
360
|
}
|
|
@@ -383,7 +385,7 @@ var require_postgres_bytea = __commonJS((exports2, module2) => {
|
|
|
383
385
|
});
|
|
384
386
|
|
|
385
387
|
// node_modules/pg-types/lib/textParsers.js
|
|
386
|
-
var require_textParsers = __commonJS((
|
|
388
|
+
var require_textParsers = __commonJS((exports, module) => {
|
|
387
389
|
var array = require_postgres_array();
|
|
388
390
|
var arrayParser = require_arrayParser();
|
|
389
391
|
var parseDate = require_postgres_date();
|
|
@@ -580,13 +582,13 @@ var require_textParsers = __commonJS((exports2, module2) => {
|
|
|
580
582
|
register(1183, parseStringArray);
|
|
581
583
|
register(1270, parseStringArray);
|
|
582
584
|
};
|
|
583
|
-
|
|
585
|
+
module.exports = {
|
|
584
586
|
init
|
|
585
587
|
};
|
|
586
588
|
});
|
|
587
589
|
|
|
588
590
|
// node_modules/pg-int8/index.js
|
|
589
|
-
var require_pg_int8 = __commonJS((
|
|
591
|
+
var require_pg_int8 = __commonJS((exports, module) => {
|
|
590
592
|
var BASE = 1e6;
|
|
591
593
|
function readInt8(buffer) {
|
|
592
594
|
var high = buffer.readInt32BE(0);
|
|
@@ -659,11 +661,11 @@ var require_pg_int8 = __commonJS((exports2, module2) => {
|
|
|
659
661
|
return sign + digits + result;
|
|
660
662
|
}
|
|
661
663
|
}
|
|
662
|
-
|
|
664
|
+
module.exports = readInt8;
|
|
663
665
|
});
|
|
664
666
|
|
|
665
667
|
// node_modules/pg-types/lib/binaryParsers.js
|
|
666
|
-
var require_binaryParsers = __commonJS((
|
|
668
|
+
var require_binaryParsers = __commonJS((exports, module) => {
|
|
667
669
|
var parseInt64 = require_pg_int8();
|
|
668
670
|
var parseBits = function(data, bits, offset, invert, callback) {
|
|
669
671
|
offset = offset || 0;
|
|
@@ -856,14 +858,14 @@ var require_binaryParsers = __commonJS((exports2, module2) => {
|
|
|
856
858
|
register(1009, parseArray);
|
|
857
859
|
register(25, parseText);
|
|
858
860
|
};
|
|
859
|
-
|
|
861
|
+
module.exports = {
|
|
860
862
|
init
|
|
861
863
|
};
|
|
862
864
|
});
|
|
863
865
|
|
|
864
866
|
// node_modules/pg-types/lib/builtins.js
|
|
865
|
-
var require_builtins = __commonJS((
|
|
866
|
-
|
|
867
|
+
var require_builtins = __commonJS((exports, module) => {
|
|
868
|
+
module.exports = {
|
|
867
869
|
BOOL: 16,
|
|
868
870
|
BYTEA: 17,
|
|
869
871
|
CHAR: 18,
|
|
@@ -928,15 +930,15 @@ var require_builtins = __commonJS((exports2, module2) => {
|
|
|
928
930
|
});
|
|
929
931
|
|
|
930
932
|
// node_modules/pg-types/index.js
|
|
931
|
-
var require_pg_types = __commonJS((
|
|
933
|
+
var require_pg_types = __commonJS((exports) => {
|
|
932
934
|
var textParsers = require_textParsers();
|
|
933
935
|
var binaryParsers = require_binaryParsers();
|
|
934
936
|
var arrayParser = require_arrayParser();
|
|
935
937
|
var builtinTypes = require_builtins();
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
938
|
+
exports.getTypeParser = getTypeParser;
|
|
939
|
+
exports.setTypeParser = setTypeParser;
|
|
940
|
+
exports.arrayParser = arrayParser;
|
|
941
|
+
exports.builtins = builtinTypes;
|
|
940
942
|
var typeParsers = {
|
|
941
943
|
text: {},
|
|
942
944
|
binary: {}
|
|
@@ -967,12 +969,12 @@ var require_pg_types = __commonJS((exports2) => {
|
|
|
967
969
|
});
|
|
968
970
|
|
|
969
971
|
// node_modules/pg/lib/defaults.js
|
|
970
|
-
var require_defaults = __commonJS((
|
|
972
|
+
var require_defaults = __commonJS((exports, module) => {
|
|
971
973
|
var user;
|
|
972
974
|
try {
|
|
973
975
|
user = process.platform === "win32" ? process.env.USERNAME : process.env.USER;
|
|
974
976
|
} catch {}
|
|
975
|
-
|
|
977
|
+
module.exports = {
|
|
976
978
|
host: "localhost",
|
|
977
979
|
user,
|
|
978
980
|
database: undefined,
|
|
@@ -1000,16 +1002,16 @@ var require_defaults = __commonJS((exports2, module2) => {
|
|
|
1000
1002
|
var pgTypes = require_pg_types();
|
|
1001
1003
|
var parseBigInteger = pgTypes.getTypeParser(20, "text");
|
|
1002
1004
|
var parseBigIntegerArray = pgTypes.getTypeParser(1016, "text");
|
|
1003
|
-
|
|
1005
|
+
module.exports.__defineSetter__("parseInt8", function(val) {
|
|
1004
1006
|
pgTypes.setTypeParser(20, "text", val ? pgTypes.getTypeParser(23, "text") : parseBigInteger);
|
|
1005
1007
|
pgTypes.setTypeParser(1016, "text", val ? pgTypes.getTypeParser(1007, "text") : parseBigIntegerArray);
|
|
1006
1008
|
});
|
|
1007
1009
|
});
|
|
1008
1010
|
|
|
1009
1011
|
// node_modules/pg/lib/utils.js
|
|
1010
|
-
var require_utils = __commonJS((
|
|
1012
|
+
var require_utils = __commonJS((exports, module) => {
|
|
1011
1013
|
var defaults = require_defaults();
|
|
1012
|
-
var util =
|
|
1014
|
+
var util = __require("util");
|
|
1013
1015
|
var { isDate } = util.types || util;
|
|
1014
1016
|
function escapeElement(elementRepresentation) {
|
|
1015
1017
|
const escaped = elementRepresentation.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
@@ -1155,7 +1157,7 @@ var require_utils = __commonJS((exports2, module2) => {
|
|
|
1155
1157
|
}
|
|
1156
1158
|
return escaped;
|
|
1157
1159
|
};
|
|
1158
|
-
|
|
1160
|
+
module.exports = {
|
|
1159
1161
|
prepareValue: function prepareValueWrapper(value) {
|
|
1160
1162
|
return prepareValue(value);
|
|
1161
1163
|
},
|
|
@@ -1166,8 +1168,8 @@ var require_utils = __commonJS((exports2, module2) => {
|
|
|
1166
1168
|
});
|
|
1167
1169
|
|
|
1168
1170
|
// node_modules/pg/lib/crypto/utils-legacy.js
|
|
1169
|
-
var require_utils_legacy = __commonJS((
|
|
1170
|
-
var nodeCrypto =
|
|
1171
|
+
var require_utils_legacy = __commonJS((exports, module) => {
|
|
1172
|
+
var nodeCrypto = __require("crypto");
|
|
1171
1173
|
function md5(string) {
|
|
1172
1174
|
return nodeCrypto.createHash("md5").update(string, "utf-8").digest("hex");
|
|
1173
1175
|
}
|
|
@@ -1189,7 +1191,7 @@ var require_utils_legacy = __commonJS((exports2, module2) => {
|
|
|
1189
1191
|
async function deriveKey(password, salt, iterations) {
|
|
1190
1192
|
return nodeCrypto.pbkdf2Sync(password, salt, iterations, 32, "sha256");
|
|
1191
1193
|
}
|
|
1192
|
-
|
|
1194
|
+
module.exports = {
|
|
1193
1195
|
postgresMd5PasswordHash,
|
|
1194
1196
|
randomBytes: nodeCrypto.randomBytes,
|
|
1195
1197
|
deriveKey,
|
|
@@ -1201,9 +1203,9 @@ var require_utils_legacy = __commonJS((exports2, module2) => {
|
|
|
1201
1203
|
});
|
|
1202
1204
|
|
|
1203
1205
|
// node_modules/pg/lib/crypto/utils-webcrypto.js
|
|
1204
|
-
var require_utils_webcrypto = __commonJS((
|
|
1205
|
-
var nodeCrypto =
|
|
1206
|
-
|
|
1206
|
+
var require_utils_webcrypto = __commonJS((exports, module) => {
|
|
1207
|
+
var nodeCrypto = __require("crypto");
|
|
1208
|
+
module.exports = {
|
|
1207
1209
|
postgresMd5PasswordHash,
|
|
1208
1210
|
randomBytes,
|
|
1209
1211
|
deriveKey,
|
|
@@ -1250,17 +1252,17 @@ var require_utils_webcrypto = __commonJS((exports2, module2) => {
|
|
|
1250
1252
|
});
|
|
1251
1253
|
|
|
1252
1254
|
// node_modules/pg/lib/crypto/utils.js
|
|
1253
|
-
var require_utils2 = __commonJS((
|
|
1255
|
+
var require_utils2 = __commonJS((exports, module) => {
|
|
1254
1256
|
var useLegacyCrypto = parseInt(process.versions && process.versions.node && process.versions.node.split(".")[0]) < 15;
|
|
1255
1257
|
if (useLegacyCrypto) {
|
|
1256
|
-
|
|
1258
|
+
module.exports = require_utils_legacy();
|
|
1257
1259
|
} else {
|
|
1258
|
-
|
|
1260
|
+
module.exports = require_utils_webcrypto();
|
|
1259
1261
|
}
|
|
1260
1262
|
});
|
|
1261
1263
|
|
|
1262
1264
|
// node_modules/pg/lib/crypto/cert-signatures.js
|
|
1263
|
-
var require_cert_signatures = __commonJS((
|
|
1265
|
+
var require_cert_signatures = __commonJS((exports, module) => {
|
|
1264
1266
|
function x509Error(msg, cert) {
|
|
1265
1267
|
return new Error("SASL channel binding: " + msg + " when parsing public certificate " + cert.toString("base64"));
|
|
1266
1268
|
}
|
|
@@ -1368,11 +1370,11 @@ var require_cert_signatures = __commonJS((exports2, module2) => {
|
|
|
1368
1370
|
}
|
|
1369
1371
|
throw x509Error("unknown OID " + oid, data);
|
|
1370
1372
|
}
|
|
1371
|
-
|
|
1373
|
+
module.exports = { signatureAlgorithmHashFromCertificate };
|
|
1372
1374
|
});
|
|
1373
1375
|
|
|
1374
1376
|
// node_modules/pg/lib/crypto/sasl.js
|
|
1375
|
-
var require_sasl = __commonJS((
|
|
1377
|
+
var require_sasl = __commonJS((exports, module) => {
|
|
1376
1378
|
var crypto = require_utils2();
|
|
1377
1379
|
var { signatureAlgorithmHashFromCertificate } = require_cert_signatures();
|
|
1378
1380
|
function startSession(mechanisms, stream) {
|
|
@@ -1528,7 +1530,7 @@ var require_sasl = __commonJS((exports2, module2) => {
|
|
|
1528
1530
|
}
|
|
1529
1531
|
return Buffer.from(a.map((_, i) => a[i] ^ b[i]));
|
|
1530
1532
|
}
|
|
1531
|
-
|
|
1533
|
+
module.exports = {
|
|
1532
1534
|
startSession,
|
|
1533
1535
|
continueSession,
|
|
1534
1536
|
finalizeSession
|
|
@@ -1536,7 +1538,7 @@ var require_sasl = __commonJS((exports2, module2) => {
|
|
|
1536
1538
|
});
|
|
1537
1539
|
|
|
1538
1540
|
// node_modules/pg/lib/type-overrides.js
|
|
1539
|
-
var require_type_overrides = __commonJS((
|
|
1541
|
+
var require_type_overrides = __commonJS((exports, module) => {
|
|
1540
1542
|
var types = require_pg_types();
|
|
1541
1543
|
function TypeOverrides(userTypes) {
|
|
1542
1544
|
this._types = userTypes || types;
|
|
@@ -1564,11 +1566,11 @@ var require_type_overrides = __commonJS((exports2, module2) => {
|
|
|
1564
1566
|
format = format || "text";
|
|
1565
1567
|
return this.getOverrides(format)[oid] || this._types.getTypeParser(oid, format);
|
|
1566
1568
|
};
|
|
1567
|
-
|
|
1569
|
+
module.exports = TypeOverrides;
|
|
1568
1570
|
});
|
|
1569
1571
|
|
|
1570
1572
|
// node_modules/pg-connection-string/index.js
|
|
1571
|
-
var require_pg_connection_string = __commonJS((
|
|
1573
|
+
var require_pg_connection_string = __commonJS((exports, module) => {
|
|
1572
1574
|
function parse(str, options = {}) {
|
|
1573
1575
|
if (str.charAt(0) === "/") {
|
|
1574
1576
|
const config2 = str.split(" ");
|
|
@@ -1622,7 +1624,7 @@ var require_pg_connection_string = __commonJS((exports2, module2) => {
|
|
|
1622
1624
|
if (config.sslcert || config.sslkey || config.sslrootcert || config.sslmode) {
|
|
1623
1625
|
config.ssl = {};
|
|
1624
1626
|
}
|
|
1625
|
-
const fs = config.sslcert || config.sslkey || config.sslrootcert ?
|
|
1627
|
+
const fs = config.sslcert || config.sslkey || config.sslrootcert ? __require("fs") : null;
|
|
1626
1628
|
if (config.sslcert) {
|
|
1627
1629
|
config.ssl.cert = fs.readFileSync(config.sslcert).toString();
|
|
1628
1630
|
}
|
|
@@ -1739,15 +1741,15 @@ To prepare for this change:
|
|
|
1739
1741
|
See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode definitions.`);
|
|
1740
1742
|
}
|
|
1741
1743
|
}
|
|
1742
|
-
|
|
1744
|
+
module.exports = parse;
|
|
1743
1745
|
parse.parse = parse;
|
|
1744
1746
|
parse.toClientConfig = toClientConfig;
|
|
1745
1747
|
parse.parseIntoClientConfig = parseIntoClientConfig;
|
|
1746
1748
|
});
|
|
1747
1749
|
|
|
1748
1750
|
// node_modules/pg/lib/connection-parameters.js
|
|
1749
|
-
var require_connection_parameters = __commonJS((
|
|
1750
|
-
var dns =
|
|
1751
|
+
var require_connection_parameters = __commonJS((exports, module) => {
|
|
1752
|
+
var dns = __require("dns");
|
|
1751
1753
|
var defaults = require_defaults();
|
|
1752
1754
|
var parse = require_pg_connection_string().parse;
|
|
1753
1755
|
var val = function(key, config, envVar) {
|
|
@@ -1881,11 +1883,11 @@ var require_connection_parameters = __commonJS((exports2, module2) => {
|
|
|
1881
1883
|
});
|
|
1882
1884
|
}
|
|
1883
1885
|
}
|
|
1884
|
-
|
|
1886
|
+
module.exports = ConnectionParameters;
|
|
1885
1887
|
});
|
|
1886
1888
|
|
|
1887
1889
|
// node_modules/pg/lib/result.js
|
|
1888
|
-
var require_result = __commonJS((
|
|
1890
|
+
var require_result = __commonJS((exports, module) => {
|
|
1889
1891
|
var types = require_pg_types();
|
|
1890
1892
|
var matchRegexp = /^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/;
|
|
1891
1893
|
|
|
@@ -1969,12 +1971,12 @@ var require_result = __commonJS((exports2, module2) => {
|
|
|
1969
1971
|
this._prebuiltEmptyResultObject = { ...row };
|
|
1970
1972
|
}
|
|
1971
1973
|
}
|
|
1972
|
-
|
|
1974
|
+
module.exports = Result;
|
|
1973
1975
|
});
|
|
1974
1976
|
|
|
1975
1977
|
// node_modules/pg/lib/query.js
|
|
1976
|
-
var require_query = __commonJS((
|
|
1977
|
-
var { EventEmitter } =
|
|
1978
|
+
var require_query = __commonJS((exports, module) => {
|
|
1979
|
+
var { EventEmitter } = __require("events");
|
|
1978
1980
|
var Result = require_result();
|
|
1979
1981
|
var utils = require_utils();
|
|
1980
1982
|
|
|
@@ -2155,42 +2157,42 @@ var require_query = __commonJS((exports2, module2) => {
|
|
|
2155
2157
|
}
|
|
2156
2158
|
handleCopyData(msg, connection) {}
|
|
2157
2159
|
}
|
|
2158
|
-
|
|
2160
|
+
module.exports = Query;
|
|
2159
2161
|
});
|
|
2160
2162
|
|
|
2161
2163
|
// node_modules/pg-protocol/dist/messages.js
|
|
2162
|
-
var require_messages = __commonJS((
|
|
2163
|
-
Object.defineProperty(
|
|
2164
|
-
|
|
2165
|
-
|
|
2164
|
+
var require_messages = __commonJS((exports) => {
|
|
2165
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2166
|
+
exports.NoticeMessage = exports.DataRowMessage = exports.CommandCompleteMessage = exports.ReadyForQueryMessage = exports.NotificationResponseMessage = exports.BackendKeyDataMessage = exports.AuthenticationMD5Password = exports.ParameterStatusMessage = exports.ParameterDescriptionMessage = exports.RowDescriptionMessage = exports.Field = exports.CopyResponse = exports.CopyDataMessage = exports.DatabaseError = exports.copyDone = exports.emptyQuery = exports.replicationStart = exports.portalSuspended = exports.noData = exports.closeComplete = exports.bindComplete = exports.parseComplete = undefined;
|
|
2167
|
+
exports.parseComplete = {
|
|
2166
2168
|
name: "parseComplete",
|
|
2167
2169
|
length: 5
|
|
2168
2170
|
};
|
|
2169
|
-
|
|
2171
|
+
exports.bindComplete = {
|
|
2170
2172
|
name: "bindComplete",
|
|
2171
2173
|
length: 5
|
|
2172
2174
|
};
|
|
2173
|
-
|
|
2175
|
+
exports.closeComplete = {
|
|
2174
2176
|
name: "closeComplete",
|
|
2175
2177
|
length: 5
|
|
2176
2178
|
};
|
|
2177
|
-
|
|
2179
|
+
exports.noData = {
|
|
2178
2180
|
name: "noData",
|
|
2179
2181
|
length: 5
|
|
2180
2182
|
};
|
|
2181
|
-
|
|
2183
|
+
exports.portalSuspended = {
|
|
2182
2184
|
name: "portalSuspended",
|
|
2183
2185
|
length: 5
|
|
2184
2186
|
};
|
|
2185
|
-
|
|
2187
|
+
exports.replicationStart = {
|
|
2186
2188
|
name: "replicationStart",
|
|
2187
2189
|
length: 4
|
|
2188
2190
|
};
|
|
2189
|
-
|
|
2191
|
+
exports.emptyQuery = {
|
|
2190
2192
|
name: "emptyQuery",
|
|
2191
2193
|
length: 4
|
|
2192
2194
|
};
|
|
2193
|
-
|
|
2195
|
+
exports.copyDone = {
|
|
2194
2196
|
name: "copyDone",
|
|
2195
2197
|
length: 4
|
|
2196
2198
|
};
|
|
@@ -2202,7 +2204,7 @@ var require_messages = __commonJS((exports2) => {
|
|
|
2202
2204
|
this.name = name;
|
|
2203
2205
|
}
|
|
2204
2206
|
}
|
|
2205
|
-
|
|
2207
|
+
exports.DatabaseError = DatabaseError;
|
|
2206
2208
|
|
|
2207
2209
|
class CopyDataMessage {
|
|
2208
2210
|
constructor(length, chunk) {
|
|
@@ -2211,7 +2213,7 @@ var require_messages = __commonJS((exports2) => {
|
|
|
2211
2213
|
this.name = "copyData";
|
|
2212
2214
|
}
|
|
2213
2215
|
}
|
|
2214
|
-
|
|
2216
|
+
exports.CopyDataMessage = CopyDataMessage;
|
|
2215
2217
|
|
|
2216
2218
|
class CopyResponse {
|
|
2217
2219
|
constructor(length, name, binary, columnCount) {
|
|
@@ -2221,7 +2223,7 @@ var require_messages = __commonJS((exports2) => {
|
|
|
2221
2223
|
this.columnTypes = new Array(columnCount);
|
|
2222
2224
|
}
|
|
2223
2225
|
}
|
|
2224
|
-
|
|
2226
|
+
exports.CopyResponse = CopyResponse;
|
|
2225
2227
|
|
|
2226
2228
|
class Field {
|
|
2227
2229
|
constructor(name, tableID, columnID, dataTypeID, dataTypeSize, dataTypeModifier, format) {
|
|
@@ -2234,7 +2236,7 @@ var require_messages = __commonJS((exports2) => {
|
|
|
2234
2236
|
this.format = format;
|
|
2235
2237
|
}
|
|
2236
2238
|
}
|
|
2237
|
-
|
|
2239
|
+
exports.Field = Field;
|
|
2238
2240
|
|
|
2239
2241
|
class RowDescriptionMessage {
|
|
2240
2242
|
constructor(length, fieldCount) {
|
|
@@ -2244,7 +2246,7 @@ var require_messages = __commonJS((exports2) => {
|
|
|
2244
2246
|
this.fields = new Array(this.fieldCount);
|
|
2245
2247
|
}
|
|
2246
2248
|
}
|
|
2247
|
-
|
|
2249
|
+
exports.RowDescriptionMessage = RowDescriptionMessage;
|
|
2248
2250
|
|
|
2249
2251
|
class ParameterDescriptionMessage {
|
|
2250
2252
|
constructor(length, parameterCount) {
|
|
@@ -2254,7 +2256,7 @@ var require_messages = __commonJS((exports2) => {
|
|
|
2254
2256
|
this.dataTypeIDs = new Array(this.parameterCount);
|
|
2255
2257
|
}
|
|
2256
2258
|
}
|
|
2257
|
-
|
|
2259
|
+
exports.ParameterDescriptionMessage = ParameterDescriptionMessage;
|
|
2258
2260
|
|
|
2259
2261
|
class ParameterStatusMessage {
|
|
2260
2262
|
constructor(length, parameterName, parameterValue) {
|
|
@@ -2264,7 +2266,7 @@ var require_messages = __commonJS((exports2) => {
|
|
|
2264
2266
|
this.name = "parameterStatus";
|
|
2265
2267
|
}
|
|
2266
2268
|
}
|
|
2267
|
-
|
|
2269
|
+
exports.ParameterStatusMessage = ParameterStatusMessage;
|
|
2268
2270
|
|
|
2269
2271
|
class AuthenticationMD5Password {
|
|
2270
2272
|
constructor(length, salt) {
|
|
@@ -2273,7 +2275,7 @@ var require_messages = __commonJS((exports2) => {
|
|
|
2273
2275
|
this.name = "authenticationMD5Password";
|
|
2274
2276
|
}
|
|
2275
2277
|
}
|
|
2276
|
-
|
|
2278
|
+
exports.AuthenticationMD5Password = AuthenticationMD5Password;
|
|
2277
2279
|
|
|
2278
2280
|
class BackendKeyDataMessage {
|
|
2279
2281
|
constructor(length, processID, secretKey) {
|
|
@@ -2283,7 +2285,7 @@ var require_messages = __commonJS((exports2) => {
|
|
|
2283
2285
|
this.name = "backendKeyData";
|
|
2284
2286
|
}
|
|
2285
2287
|
}
|
|
2286
|
-
|
|
2288
|
+
exports.BackendKeyDataMessage = BackendKeyDataMessage;
|
|
2287
2289
|
|
|
2288
2290
|
class NotificationResponseMessage {
|
|
2289
2291
|
constructor(length, processId, channel, payload) {
|
|
@@ -2294,7 +2296,7 @@ var require_messages = __commonJS((exports2) => {
|
|
|
2294
2296
|
this.name = "notification";
|
|
2295
2297
|
}
|
|
2296
2298
|
}
|
|
2297
|
-
|
|
2299
|
+
exports.NotificationResponseMessage = NotificationResponseMessage;
|
|
2298
2300
|
|
|
2299
2301
|
class ReadyForQueryMessage {
|
|
2300
2302
|
constructor(length, status) {
|
|
@@ -2303,7 +2305,7 @@ var require_messages = __commonJS((exports2) => {
|
|
|
2303
2305
|
this.name = "readyForQuery";
|
|
2304
2306
|
}
|
|
2305
2307
|
}
|
|
2306
|
-
|
|
2308
|
+
exports.ReadyForQueryMessage = ReadyForQueryMessage;
|
|
2307
2309
|
|
|
2308
2310
|
class CommandCompleteMessage {
|
|
2309
2311
|
constructor(length, text) {
|
|
@@ -2312,7 +2314,7 @@ var require_messages = __commonJS((exports2) => {
|
|
|
2312
2314
|
this.name = "commandComplete";
|
|
2313
2315
|
}
|
|
2314
2316
|
}
|
|
2315
|
-
|
|
2317
|
+
exports.CommandCompleteMessage = CommandCompleteMessage;
|
|
2316
2318
|
|
|
2317
2319
|
class DataRowMessage {
|
|
2318
2320
|
constructor(length, fields) {
|
|
@@ -2322,7 +2324,7 @@ var require_messages = __commonJS((exports2) => {
|
|
|
2322
2324
|
this.fieldCount = fields.length;
|
|
2323
2325
|
}
|
|
2324
2326
|
}
|
|
2325
|
-
|
|
2327
|
+
exports.DataRowMessage = DataRowMessage;
|
|
2326
2328
|
|
|
2327
2329
|
class NoticeMessage {
|
|
2328
2330
|
constructor(length, message) {
|
|
@@ -2331,13 +2333,13 @@ var require_messages = __commonJS((exports2) => {
|
|
|
2331
2333
|
this.name = "notice";
|
|
2332
2334
|
}
|
|
2333
2335
|
}
|
|
2334
|
-
|
|
2336
|
+
exports.NoticeMessage = NoticeMessage;
|
|
2335
2337
|
});
|
|
2336
2338
|
|
|
2337
2339
|
// node_modules/pg-protocol/dist/buffer-writer.js
|
|
2338
|
-
var require_buffer_writer = __commonJS((
|
|
2339
|
-
Object.defineProperty(
|
|
2340
|
-
|
|
2340
|
+
var require_buffer_writer = __commonJS((exports) => {
|
|
2341
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2342
|
+
exports.Writer = undefined;
|
|
2341
2343
|
|
|
2342
2344
|
class Writer {
|
|
2343
2345
|
constructor(size = 256) {
|
|
@@ -2410,13 +2412,13 @@ var require_buffer_writer = __commonJS((exports2) => {
|
|
|
2410
2412
|
return result;
|
|
2411
2413
|
}
|
|
2412
2414
|
}
|
|
2413
|
-
|
|
2415
|
+
exports.Writer = Writer;
|
|
2414
2416
|
});
|
|
2415
2417
|
|
|
2416
2418
|
// node_modules/pg-protocol/dist/serializer.js
|
|
2417
|
-
var require_serializer = __commonJS((
|
|
2418
|
-
Object.defineProperty(
|
|
2419
|
-
|
|
2419
|
+
var require_serializer = __commonJS((exports) => {
|
|
2420
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2421
|
+
exports.serialize = undefined;
|
|
2420
2422
|
var buffer_writer_1 = require_buffer_writer();
|
|
2421
2423
|
var writer = new buffer_writer_1.Writer;
|
|
2422
2424
|
var startup = (opts) => {
|
|
@@ -2573,13 +2575,13 @@ var require_serializer = __commonJS((exports2) => {
|
|
|
2573
2575
|
copyFail,
|
|
2574
2576
|
cancel
|
|
2575
2577
|
};
|
|
2576
|
-
|
|
2578
|
+
exports.serialize = serialize;
|
|
2577
2579
|
});
|
|
2578
2580
|
|
|
2579
2581
|
// node_modules/pg-protocol/dist/buffer-reader.js
|
|
2580
|
-
var require_buffer_reader = __commonJS((
|
|
2581
|
-
Object.defineProperty(
|
|
2582
|
-
|
|
2582
|
+
var require_buffer_reader = __commonJS((exports) => {
|
|
2583
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2584
|
+
exports.BufferReader = undefined;
|
|
2583
2585
|
|
|
2584
2586
|
class BufferReader {
|
|
2585
2587
|
constructor(offset = 0) {
|
|
@@ -2629,13 +2631,13 @@ var require_buffer_reader = __commonJS((exports2) => {
|
|
|
2629
2631
|
return result;
|
|
2630
2632
|
}
|
|
2631
2633
|
}
|
|
2632
|
-
|
|
2634
|
+
exports.BufferReader = BufferReader;
|
|
2633
2635
|
});
|
|
2634
2636
|
|
|
2635
2637
|
// node_modules/pg-protocol/dist/parser.js
|
|
2636
|
-
var require_parser = __commonJS((
|
|
2637
|
-
Object.defineProperty(
|
|
2638
|
-
|
|
2638
|
+
var require_parser = __commonJS((exports) => {
|
|
2639
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2640
|
+
exports.Parser = undefined;
|
|
2639
2641
|
var messages_1 = require_messages();
|
|
2640
2642
|
var buffer_reader_1 = require_buffer_reader();
|
|
2641
2643
|
var CODE_LENGTH = 1;
|
|
@@ -2786,7 +2788,7 @@ var require_parser = __commonJS((exports2) => {
|
|
|
2786
2788
|
return message;
|
|
2787
2789
|
}
|
|
2788
2790
|
}
|
|
2789
|
-
|
|
2791
|
+
exports.Parser = Parser;
|
|
2790
2792
|
var parseReadyForQueryMessage = (reader) => {
|
|
2791
2793
|
const status = reader.string(1);
|
|
2792
2794
|
return new messages_1.ReadyForQueryMessage(LATEINIT_LENGTH, status);
|
|
@@ -2938,15 +2940,15 @@ var require_parser = __commonJS((exports2) => {
|
|
|
2938
2940
|
});
|
|
2939
2941
|
|
|
2940
2942
|
// node_modules/pg-protocol/dist/index.js
|
|
2941
|
-
var require_dist = __commonJS((
|
|
2942
|
-
Object.defineProperty(
|
|
2943
|
-
|
|
2943
|
+
var require_dist = __commonJS((exports) => {
|
|
2944
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2945
|
+
exports.DatabaseError = exports.serialize = exports.parse = undefined;
|
|
2944
2946
|
var messages_1 = require_messages();
|
|
2945
|
-
Object.defineProperty(
|
|
2947
|
+
Object.defineProperty(exports, "DatabaseError", { enumerable: true, get: function() {
|
|
2946
2948
|
return messages_1.DatabaseError;
|
|
2947
2949
|
} });
|
|
2948
2950
|
var serializer_1 = require_serializer();
|
|
2949
|
-
Object.defineProperty(
|
|
2951
|
+
Object.defineProperty(exports, "serialize", { enumerable: true, get: function() {
|
|
2950
2952
|
return serializer_1.serialize;
|
|
2951
2953
|
} });
|
|
2952
2954
|
var parser_1 = require_parser();
|
|
@@ -2955,29 +2957,29 @@ var require_dist = __commonJS((exports2) => {
|
|
|
2955
2957
|
stream.on("data", (buffer) => parser.parse(buffer, callback));
|
|
2956
2958
|
return new Promise((resolve) => stream.on("end", () => resolve()));
|
|
2957
2959
|
}
|
|
2958
|
-
|
|
2960
|
+
exports.parse = parse;
|
|
2959
2961
|
});
|
|
2960
2962
|
|
|
2961
2963
|
// node_modules/pg-cloudflare/dist/empty.js
|
|
2962
|
-
var require_empty = __commonJS((
|
|
2963
|
-
Object.defineProperty(
|
|
2964
|
-
|
|
2964
|
+
var require_empty = __commonJS((exports) => {
|
|
2965
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2966
|
+
exports.default = {};
|
|
2965
2967
|
});
|
|
2966
2968
|
|
|
2967
2969
|
// node_modules/pg/lib/stream.js
|
|
2968
|
-
var require_stream = __commonJS((
|
|
2970
|
+
var require_stream = __commonJS((exports, module) => {
|
|
2969
2971
|
var { getStream, getSecureStream } = getStreamFuncs();
|
|
2970
|
-
|
|
2972
|
+
module.exports = {
|
|
2971
2973
|
getStream,
|
|
2972
2974
|
getSecureStream
|
|
2973
2975
|
};
|
|
2974
2976
|
function getNodejsStreamFuncs() {
|
|
2975
2977
|
function getStream2(ssl) {
|
|
2976
|
-
const net =
|
|
2978
|
+
const net = __require("net");
|
|
2977
2979
|
return new net.Socket;
|
|
2978
2980
|
}
|
|
2979
2981
|
function getSecureStream2(options) {
|
|
2980
|
-
const tls =
|
|
2982
|
+
const tls = __require("tls");
|
|
2981
2983
|
return tls.connect(options);
|
|
2982
2984
|
}
|
|
2983
2985
|
return {
|
|
@@ -3020,8 +3022,8 @@ var require_stream = __commonJS((exports2, module2) => {
|
|
|
3020
3022
|
});
|
|
3021
3023
|
|
|
3022
3024
|
// node_modules/pg/lib/connection.js
|
|
3023
|
-
var require_connection = __commonJS((
|
|
3024
|
-
var EventEmitter =
|
|
3025
|
+
var require_connection = __commonJS((exports, module) => {
|
|
3026
|
+
var EventEmitter = __require("events").EventEmitter;
|
|
3025
3027
|
var { parse, serialize } = require_dist();
|
|
3026
3028
|
var { getStream, getSecureStream } = require_stream();
|
|
3027
3029
|
var flushBuffer = serialize.flush();
|
|
@@ -3094,7 +3096,7 @@ var require_connection = __commonJS((exports2, module2) => {
|
|
|
3094
3096
|
options.key = self.ssl.key;
|
|
3095
3097
|
}
|
|
3096
3098
|
}
|
|
3097
|
-
const net =
|
|
3099
|
+
const net = __require("net");
|
|
3098
3100
|
if (net.isIP && net.isIP(host) === 0) {
|
|
3099
3101
|
options.servername = host;
|
|
3100
3102
|
}
|
|
@@ -3194,13 +3196,13 @@ var require_connection = __commonJS((exports2, module2) => {
|
|
|
3194
3196
|
this._send(serialize.copyFail(msg));
|
|
3195
3197
|
}
|
|
3196
3198
|
}
|
|
3197
|
-
|
|
3199
|
+
module.exports = Connection;
|
|
3198
3200
|
});
|
|
3199
3201
|
|
|
3200
3202
|
// node_modules/split2/index.js
|
|
3201
|
-
var require_split2 = __commonJS((
|
|
3202
|
-
var { Transform } =
|
|
3203
|
-
var { StringDecoder } =
|
|
3203
|
+
var require_split2 = __commonJS((exports, module) => {
|
|
3204
|
+
var { Transform } = __require("stream");
|
|
3205
|
+
var { StringDecoder } = __require("string_decoder");
|
|
3204
3206
|
var kLast = Symbol("last");
|
|
3205
3207
|
var kDecoder = Symbol("decoder");
|
|
3206
3208
|
function transform(chunk, enc, cb) {
|
|
@@ -3293,15 +3295,15 @@ var require_split2 = __commonJS((exports2, module2) => {
|
|
|
3293
3295
|
};
|
|
3294
3296
|
return stream;
|
|
3295
3297
|
}
|
|
3296
|
-
|
|
3298
|
+
module.exports = split;
|
|
3297
3299
|
});
|
|
3298
3300
|
|
|
3299
3301
|
// node_modules/pgpass/lib/helper.js
|
|
3300
|
-
var require_helper = __commonJS((
|
|
3301
|
-
var path =
|
|
3302
|
-
var Stream =
|
|
3302
|
+
var require_helper = __commonJS((exports, module) => {
|
|
3303
|
+
var path = __require("path");
|
|
3304
|
+
var Stream = __require("stream").Stream;
|
|
3303
3305
|
var split = require_split2();
|
|
3304
|
-
var util =
|
|
3306
|
+
var util = __require("util");
|
|
3305
3307
|
var defaultPort = 5432;
|
|
3306
3308
|
var isWin = process.platform === "win32";
|
|
3307
3309
|
var warnStream = process.stderr;
|
|
@@ -3323,7 +3325,7 @@ var require_helper = __commonJS((exports2, module2) => {
|
|
|
3323
3325
|
warnStream.write(util.format.apply(util, args));
|
|
3324
3326
|
}
|
|
3325
3327
|
}
|
|
3326
|
-
Object.defineProperty(
|
|
3328
|
+
Object.defineProperty(exports, "isWin", {
|
|
3327
3329
|
get: function() {
|
|
3328
3330
|
return isWin;
|
|
3329
3331
|
},
|
|
@@ -3331,17 +3333,17 @@ var require_helper = __commonJS((exports2, module2) => {
|
|
|
3331
3333
|
isWin = val;
|
|
3332
3334
|
}
|
|
3333
3335
|
});
|
|
3334
|
-
|
|
3336
|
+
exports.warnTo = function(stream) {
|
|
3335
3337
|
var old = warnStream;
|
|
3336
3338
|
warnStream = stream;
|
|
3337
3339
|
return old;
|
|
3338
3340
|
};
|
|
3339
|
-
|
|
3341
|
+
exports.getFileName = function(rawEnv) {
|
|
3340
3342
|
var env = rawEnv || process.env;
|
|
3341
3343
|
var file = env.PGPASSFILE || (isWin ? path.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path.join(env.HOME || "./", ".pgpass"));
|
|
3342
3344
|
return file;
|
|
3343
3345
|
};
|
|
3344
|
-
|
|
3346
|
+
exports.usePgPass = function(stats, fname) {
|
|
3345
3347
|
if (Object.prototype.hasOwnProperty.call(process.env, "PGPASSWORD")) {
|
|
3346
3348
|
return false;
|
|
3347
3349
|
}
|
|
@@ -3359,7 +3361,7 @@ var require_helper = __commonJS((exports2, module2) => {
|
|
|
3359
3361
|
}
|
|
3360
3362
|
return true;
|
|
3361
3363
|
};
|
|
3362
|
-
var matcher =
|
|
3364
|
+
var matcher = exports.match = function(connInfo, entry) {
|
|
3363
3365
|
return fieldNames.slice(0, -1).reduce(function(prev, field, idx) {
|
|
3364
3366
|
if (idx == 1) {
|
|
3365
3367
|
if (Number(connInfo[field] || defaultPort) === Number(entry[field])) {
|
|
@@ -3369,7 +3371,7 @@ var require_helper = __commonJS((exports2, module2) => {
|
|
|
3369
3371
|
return prev && (entry[field] === "*" || entry[field] === connInfo[field]);
|
|
3370
3372
|
}, true);
|
|
3371
3373
|
};
|
|
3372
|
-
|
|
3374
|
+
exports.getPassword = function(connInfo, stream, cb) {
|
|
3373
3375
|
var pass;
|
|
3374
3376
|
var lineStream = stream.pipe(split());
|
|
3375
3377
|
function onLine(line) {
|
|
@@ -3391,7 +3393,7 @@ var require_helper = __commonJS((exports2, module2) => {
|
|
|
3391
3393
|
stream.on("error", onErr);
|
|
3392
3394
|
lineStream.on("data", onLine).on("end", onEnd).on("error", onErr);
|
|
3393
3395
|
};
|
|
3394
|
-
var parseLine =
|
|
3396
|
+
var parseLine = exports.parseLine = function(line) {
|
|
3395
3397
|
if (line.length < 11 || line.match(/^\s+#/)) {
|
|
3396
3398
|
return null;
|
|
3397
3399
|
}
|
|
@@ -3426,7 +3428,7 @@ var require_helper = __commonJS((exports2, module2) => {
|
|
|
3426
3428
|
obj = Object.keys(obj).length === nrOfFields ? obj : null;
|
|
3427
3429
|
return obj;
|
|
3428
3430
|
};
|
|
3429
|
-
var isValidEntry =
|
|
3431
|
+
var isValidEntry = exports.isValidEntry = function(entry) {
|
|
3430
3432
|
var rules = {
|
|
3431
3433
|
0: function(x) {
|
|
3432
3434
|
return x.length > 0;
|
|
@@ -3461,11 +3463,11 @@ var require_helper = __commonJS((exports2, module2) => {
|
|
|
3461
3463
|
});
|
|
3462
3464
|
|
|
3463
3465
|
// node_modules/pgpass/lib/index.js
|
|
3464
|
-
var require_lib = __commonJS((
|
|
3465
|
-
var path =
|
|
3466
|
-
var fs =
|
|
3466
|
+
var require_lib = __commonJS((exports, module) => {
|
|
3467
|
+
var path = __require("path");
|
|
3468
|
+
var fs = __require("fs");
|
|
3467
3469
|
var helper = require_helper();
|
|
3468
|
-
|
|
3470
|
+
module.exports = function(connInfo, cb) {
|
|
3469
3471
|
var file = helper.getFileName();
|
|
3470
3472
|
fs.stat(file, function(err, stat) {
|
|
3471
3473
|
if (err || !helper.usePgPass(stat, file)) {
|
|
@@ -3475,14 +3477,14 @@ var require_lib = __commonJS((exports2, module2) => {
|
|
|
3475
3477
|
helper.getPassword(connInfo, st, cb);
|
|
3476
3478
|
});
|
|
3477
3479
|
};
|
|
3478
|
-
|
|
3480
|
+
module.exports.warnTo = helper.warnTo;
|
|
3479
3481
|
});
|
|
3480
3482
|
|
|
3481
3483
|
// node_modules/pg/lib/client.js
|
|
3482
|
-
var require_client = __commonJS((
|
|
3483
|
-
var EventEmitter =
|
|
3484
|
+
var require_client = __commonJS((exports, module) => {
|
|
3485
|
+
var EventEmitter = __require("events").EventEmitter;
|
|
3484
3486
|
var utils = require_utils();
|
|
3485
|
-
var nodeUtils =
|
|
3487
|
+
var nodeUtils = __require("util");
|
|
3486
3488
|
var sasl = require_sasl();
|
|
3487
3489
|
var TypeOverrides = require_type_overrides();
|
|
3488
3490
|
var ConnectionParameters = require_connection_parameters();
|
|
@@ -4056,12 +4058,12 @@ var require_client = __commonJS((exports2, module2) => {
|
|
|
4056
4058
|
}
|
|
4057
4059
|
}
|
|
4058
4060
|
Client.Query = Query;
|
|
4059
|
-
|
|
4061
|
+
module.exports = Client;
|
|
4060
4062
|
});
|
|
4061
4063
|
|
|
4062
4064
|
// node_modules/pg-pool/index.js
|
|
4063
|
-
var require_pg_pool = __commonJS((
|
|
4064
|
-
var EventEmitter =
|
|
4065
|
+
var require_pg_pool = __commonJS((exports, module) => {
|
|
4066
|
+
var EventEmitter = __require("events").EventEmitter;
|
|
4065
4067
|
var NOOP = function() {};
|
|
4066
4068
|
var removeWhere = (list, predicate) => {
|
|
4067
4069
|
const i = list.findIndex(predicate);
|
|
@@ -4468,15 +4470,15 @@ var require_pg_pool = __commonJS((exports2, module2) => {
|
|
|
4468
4470
|
return this._clients.length;
|
|
4469
4471
|
}
|
|
4470
4472
|
}
|
|
4471
|
-
|
|
4473
|
+
module.exports = Pool;
|
|
4472
4474
|
});
|
|
4473
4475
|
|
|
4474
4476
|
// node_modules/pg/lib/native/query.js
|
|
4475
|
-
var require_query2 = __commonJS((
|
|
4476
|
-
var EventEmitter =
|
|
4477
|
-
var util =
|
|
4477
|
+
var require_query2 = __commonJS((exports, module) => {
|
|
4478
|
+
var EventEmitter = __require("events").EventEmitter;
|
|
4479
|
+
var util = __require("util");
|
|
4478
4480
|
var utils = require_utils();
|
|
4479
|
-
var NativeQuery =
|
|
4481
|
+
var NativeQuery = module.exports = function(config, values, callback) {
|
|
4480
4482
|
EventEmitter.call(this);
|
|
4481
4483
|
config = utils.normalizeQueryConfig(config, values, callback);
|
|
4482
4484
|
this.text = config.text;
|
|
@@ -4608,8 +4610,8 @@ var require_query2 = __commonJS((exports2, module2) => {
|
|
|
4608
4610
|
});
|
|
4609
4611
|
|
|
4610
4612
|
// node_modules/pg/lib/native/client.js
|
|
4611
|
-
var require_client2 = __commonJS((
|
|
4612
|
-
var nodeUtils =
|
|
4613
|
+
var require_client2 = __commonJS((exports, module) => {
|
|
4614
|
+
var nodeUtils = __require("util");
|
|
4613
4615
|
var Native;
|
|
4614
4616
|
try {
|
|
4615
4617
|
Native = (()=>{throw new Error("Cannot require module "+"pg-native");})();
|
|
@@ -4617,12 +4619,12 @@ var require_client2 = __commonJS((exports2, module2) => {
|
|
|
4617
4619
|
throw e;
|
|
4618
4620
|
}
|
|
4619
4621
|
var TypeOverrides = require_type_overrides();
|
|
4620
|
-
var EventEmitter =
|
|
4621
|
-
var util =
|
|
4622
|
+
var EventEmitter = __require("events").EventEmitter;
|
|
4623
|
+
var util = __require("util");
|
|
4622
4624
|
var ConnectionParameters = require_connection_parameters();
|
|
4623
4625
|
var NativeQuery = require_query2();
|
|
4624
4626
|
var queryQueueLengthDeprecationNotice = nodeUtils.deprecate(() => {}, "Calling client.query() when the client is already executing a query is deprecated and will be removed in pg@9.0. Use async/await or an external async flow control mechanism instead.");
|
|
4625
|
-
var Client =
|
|
4627
|
+
var Client = module.exports = function(config) {
|
|
4626
4628
|
EventEmitter.call(this);
|
|
4627
4629
|
config = config || {};
|
|
4628
4630
|
this._Promise = config.Promise || global.Promise;
|
|
@@ -4853,13 +4855,8 @@ var require_client2 = __commonJS((exports2, module2) => {
|
|
|
4853
4855
|
};
|
|
4854
4856
|
});
|
|
4855
4857
|
|
|
4856
|
-
// node_modules/pg/lib/native/index.js
|
|
4857
|
-
var require_native = __commonJS((exports2, module2) => {
|
|
4858
|
-
module2.exports = require_client2();
|
|
4859
|
-
});
|
|
4860
|
-
|
|
4861
4858
|
// node_modules/pg/lib/index.js
|
|
4862
|
-
var require_lib2 = __commonJS((
|
|
4859
|
+
var require_lib2 = __commonJS((exports, module) => {
|
|
4863
4860
|
var Client = require_client();
|
|
4864
4861
|
var defaults = require_defaults();
|
|
4865
4862
|
var Connection = require_connection();
|
|
@@ -4897,22 +4894,22 @@ var require_lib2 = __commonJS((exports2, module2) => {
|
|
|
4897
4894
|
forceNative = !!process.env.NODE_PG_FORCE_NATIVE;
|
|
4898
4895
|
} catch {}
|
|
4899
4896
|
if (forceNative) {
|
|
4900
|
-
clientConstructor =
|
|
4897
|
+
clientConstructor = require_client2();
|
|
4901
4898
|
}
|
|
4902
|
-
|
|
4903
|
-
Object.defineProperty(
|
|
4899
|
+
module.exports = new PG(clientConstructor);
|
|
4900
|
+
Object.defineProperty(module.exports, "native", {
|
|
4904
4901
|
configurable: true,
|
|
4905
4902
|
enumerable: false,
|
|
4906
4903
|
get() {
|
|
4907
4904
|
let native = null;
|
|
4908
4905
|
try {
|
|
4909
|
-
native = new PG(
|
|
4906
|
+
native = new PG(require_client2());
|
|
4910
4907
|
} catch (err) {
|
|
4911
4908
|
if (err.code !== "MODULE_NOT_FOUND") {
|
|
4912
4909
|
throw err;
|
|
4913
4910
|
}
|
|
4914
4911
|
}
|
|
4915
|
-
Object.defineProperty(
|
|
4912
|
+
Object.defineProperty(module.exports, "native", {
|
|
4916
4913
|
value: native
|
|
4917
4914
|
});
|
|
4918
4915
|
return native;
|
|
@@ -4954,16 +4951,16 @@ var init_esm = __esm(() => {
|
|
|
4954
4951
|
});
|
|
4955
4952
|
|
|
4956
4953
|
// src/cli.ts
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4954
|
+
import { mkdirSync, writeFileSync, readFileSync, existsSync, copyFileSync, readdirSync, statSync } from "node:fs";
|
|
4955
|
+
import { join, dirname } from "node:path";
|
|
4956
|
+
import { homedir } from "node:os";
|
|
4960
4957
|
var __dirname = "C:\\Users\\Grace\\.config\\opencode\\plugins\\opcode-pg-memory\\src";
|
|
4961
|
-
var OPENCODE_CONFIG_DIR =
|
|
4962
|
-
var OPENCODE_COMMAND_DIR =
|
|
4963
|
-
var OPENCODE_SKILLS_DIR =
|
|
4958
|
+
var OPENCODE_CONFIG_DIR = join(homedir(), ".config", "opencode");
|
|
4959
|
+
var OPENCODE_COMMAND_DIR = join(OPENCODE_CONFIG_DIR, "command");
|
|
4960
|
+
var OPENCODE_SKILLS_DIR = join(homedir(), ".config", "opencode", "skills");
|
|
4964
4961
|
var PLUGIN_NAME = "opcode-pg-memory";
|
|
4965
4962
|
var REPO_URL = "https://github.com/Vbs313/opcode-pg-memory";
|
|
4966
|
-
var OPENCODE_CACHE_DIR =
|
|
4963
|
+
var OPENCODE_CACHE_DIR = join(homedir(), ".cache", "opencode", "packages", "opcode-pg-memory@latest");
|
|
4967
4964
|
var PG_MEMORY_INIT_COMMAND = `---
|
|
4968
4965
|
description: Initialize pg-memory with codebase knowledge
|
|
4969
4966
|
---
|
|
@@ -4993,18 +4990,18 @@ function stripJsoncComments(content) {
|
|
|
4993
4990
|
}
|
|
4994
4991
|
function findOpencodeConfig() {
|
|
4995
4992
|
const candidates = [
|
|
4996
|
-
|
|
4997
|
-
|
|
4993
|
+
join(OPENCODE_CONFIG_DIR, "opencode.jsonc"),
|
|
4994
|
+
join(OPENCODE_CONFIG_DIR, "opencode.json")
|
|
4998
4995
|
];
|
|
4999
4996
|
for (const path of candidates) {
|
|
5000
|
-
if (
|
|
4997
|
+
if (existsSync(path))
|
|
5001
4998
|
return path;
|
|
5002
4999
|
}
|
|
5003
5000
|
return null;
|
|
5004
5001
|
}
|
|
5005
5002
|
function addPluginToConfig(configPath) {
|
|
5006
5003
|
try {
|
|
5007
|
-
const content =
|
|
5004
|
+
const content = readFileSync(configPath, "utf-8");
|
|
5008
5005
|
if (content.includes(PLUGIN_NAME)) {
|
|
5009
5006
|
console.log("Plugin already registered");
|
|
5010
5007
|
return true;
|
|
@@ -5030,14 +5027,14 @@ function addPluginToConfig(configPath) {
|
|
|
5030
5027
|
"${PLUGIN_NAME}"
|
|
5031
5028
|
${end}`;
|
|
5032
5029
|
});
|
|
5033
|
-
|
|
5030
|
+
writeFileSync(configPath, newContent);
|
|
5034
5031
|
} else {
|
|
5035
5032
|
const newContent = content.replace(/^(\s*\{)/, `$1
|
|
5036
5033
|
"plugin": ["${PLUGIN_NAME}"],`);
|
|
5037
|
-
|
|
5034
|
+
writeFileSync(configPath, newContent);
|
|
5038
5035
|
}
|
|
5039
5036
|
} else {
|
|
5040
|
-
|
|
5037
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
5041
5038
|
}
|
|
5042
5039
|
console.log(`Added plugin to ${configPath}`);
|
|
5043
5040
|
return true;
|
|
@@ -5047,20 +5044,20 @@ function addPluginToConfig(configPath) {
|
|
|
5047
5044
|
}
|
|
5048
5045
|
}
|
|
5049
5046
|
function createNewConfig() {
|
|
5050
|
-
const configPath =
|
|
5051
|
-
|
|
5047
|
+
const configPath = join(OPENCODE_CONFIG_DIR, "opencode.jsonc");
|
|
5048
|
+
mkdirSync(OPENCODE_CONFIG_DIR, { recursive: true });
|
|
5052
5049
|
const config = `{
|
|
5053
5050
|
"plugin": ["${PLUGIN_NAME}"]
|
|
5054
5051
|
}
|
|
5055
5052
|
`;
|
|
5056
|
-
|
|
5053
|
+
writeFileSync(configPath, config);
|
|
5057
5054
|
console.log(`Created ${configPath}`);
|
|
5058
5055
|
return true;
|
|
5059
5056
|
}
|
|
5060
5057
|
function createInitCommand() {
|
|
5061
|
-
|
|
5062
|
-
const initPath =
|
|
5063
|
-
|
|
5058
|
+
mkdirSync(OPENCODE_COMMAND_DIR, { recursive: true });
|
|
5059
|
+
const initPath = join(OPENCODE_COMMAND_DIR, "pg-memory-init.md");
|
|
5060
|
+
writeFileSync(initPath, PG_MEMORY_INIT_COMMAND);
|
|
5064
5061
|
console.log("Created /pg-memory-init command");
|
|
5065
5062
|
return true;
|
|
5066
5063
|
}
|
|
@@ -5079,9 +5076,9 @@ bunx opcode-pg-memory sync
|
|
|
5079
5076
|
This imports all historical OpenCode sessions into the pg-memory PostgreSQL database for future retrieval.
|
|
5080
5077
|
`;
|
|
5081
5078
|
function createSyncCommand() {
|
|
5082
|
-
|
|
5083
|
-
const syncPath =
|
|
5084
|
-
|
|
5079
|
+
mkdirSync(OPENCODE_COMMAND_DIR, { recursive: true });
|
|
5080
|
+
const syncPath = join(OPENCODE_COMMAND_DIR, "pg-memory-sync.md");
|
|
5081
|
+
writeFileSync(syncPath, PG_MEMORY_SYNC_COMMAND);
|
|
5085
5082
|
console.log("Created /pg-memory-sync command");
|
|
5086
5083
|
return true;
|
|
5087
5084
|
}
|
|
@@ -5100,12 +5097,32 @@ Summarize and reflect on the current session to extract reusable patterns, lesso
|
|
|
5100
5097
|
3. Present the results in a clear format: error patterns, tool usage, success patterns, recommendations
|
|
5101
5098
|
`;
|
|
5102
5099
|
function createReflectCommand() {
|
|
5103
|
-
|
|
5104
|
-
const reflectPath =
|
|
5105
|
-
|
|
5100
|
+
mkdirSync(OPENCODE_COMMAND_DIR, { recursive: true });
|
|
5101
|
+
const reflectPath = join(OPENCODE_COMMAND_DIR, "pg-memory-reflect.md");
|
|
5102
|
+
writeFileSync(reflectPath, PG_MEMORY_REFLECT_COMMAND);
|
|
5106
5103
|
console.log("Created /pg-memory-reflect command");
|
|
5107
5104
|
return true;
|
|
5108
5105
|
}
|
|
5106
|
+
var PG_MEMORY_NOTE_COMMAND = `---
|
|
5107
|
+
description: Record an observation for the current session
|
|
5108
|
+
---
|
|
5109
|
+
|
|
5110
|
+
# PG Memory Note
|
|
5111
|
+
|
|
5112
|
+
Record the recent work as an observation in the pg-memory database.
|
|
5113
|
+
|
|
5114
|
+
Determine the current session ID, then insert:
|
|
5115
|
+
\`\`\`bash
|
|
5116
|
+
psql -h localhost -U opencode -d PGOMO -c "INSERT INTO observations (session_map_id, tool_name, tool_input_summary, tool_output_summary, importance) SELECT sm.id, 'TOOL_NAME', 'INPUT_SUMMARY', 'RESULT_SUMMARY', IMPORTANCE FROM session_map sm WHERE sm.opencode_session_id = 'ses_SESSION_ID';"
|
|
5117
|
+
\`\`\`
|
|
5118
|
+
`;
|
|
5119
|
+
function createNoteCommand() {
|
|
5120
|
+
mkdirSync(OPENCODE_COMMAND_DIR, { recursive: true });
|
|
5121
|
+
const notePath = join(OPENCODE_COMMAND_DIR, "pg-memory-note.md");
|
|
5122
|
+
writeFileSync(notePath, PG_MEMORY_NOTE_COMMAND);
|
|
5123
|
+
console.log("Created /pg-memory-note command");
|
|
5124
|
+
return true;
|
|
5125
|
+
}
|
|
5109
5126
|
var PG_MEMORY_SKILL = `# pg-memory — Long-term Memory for OpenCode
|
|
5110
5127
|
|
|
5111
5128
|
You have access to persistent long-term memory via the pg-memory plugin. Use it to search historical knowledge and reflect on completed work.
|
|
@@ -5126,9 +5143,9 @@ Call AFTER completing significant work.
|
|
|
5126
5143
|
Always call recall_memory(query=<current task goal>) before working on a new problem.
|
|
5127
5144
|
`;
|
|
5128
5145
|
function createSkill() {
|
|
5129
|
-
|
|
5130
|
-
const skillPath =
|
|
5131
|
-
|
|
5146
|
+
mkdirSync(OPENCODE_SKILLS_DIR, { recursive: true });
|
|
5147
|
+
const skillPath = join(OPENCODE_SKILLS_DIR, "pg-memory.md");
|
|
5148
|
+
writeFileSync(skillPath, PG_MEMORY_SKILL);
|
|
5132
5149
|
console.log("Created pg-memory skill");
|
|
5133
5150
|
return true;
|
|
5134
5151
|
}
|
|
@@ -5150,9 +5167,9 @@ var PG_MEMORY_AGENTS_TEMPLATE = `# PG Memory — Long-term Memory System
|
|
|
5150
5167
|
OmO 子代理无 MCP 直接访问。主代理应先调用 recall_memory 再将结果传给子代理。
|
|
5151
5168
|
`;
|
|
5152
5169
|
function createAgentsTemplate() {
|
|
5153
|
-
|
|
5154
|
-
const agentsPath =
|
|
5155
|
-
|
|
5170
|
+
mkdirSync(OPENCODE_SKILLS_DIR, { recursive: true });
|
|
5171
|
+
const agentsPath = join(OPENCODE_SKILLS_DIR, "pg-memory-agents.template.md");
|
|
5172
|
+
writeFileSync(agentsPath, PG_MEMORY_AGENTS_TEMPLATE);
|
|
5156
5173
|
console.log("Created AGENTS.md template (copy to project root)");
|
|
5157
5174
|
return true;
|
|
5158
5175
|
}
|
|
@@ -5187,24 +5204,24 @@ if (!cmd || cmd === "help" || cmd === "--help" || cmd === "-h") {
|
|
|
5187
5204
|
process.exit(0);
|
|
5188
5205
|
}
|
|
5189
5206
|
function populateOpencodeCache() {
|
|
5190
|
-
const cacheDist =
|
|
5191
|
-
const sourceDist =
|
|
5192
|
-
if (!
|
|
5207
|
+
const cacheDist = join(OPENCODE_CACHE_DIR, "dist");
|
|
5208
|
+
const sourceDist = join(__dirname, "..", "dist");
|
|
5209
|
+
if (!existsSync(sourceDist)) {
|
|
5193
5210
|
console.log(" dist/ not found at", sourceDist, "- plugin not running from npm package, skipping cache");
|
|
5194
5211
|
return false;
|
|
5195
5212
|
}
|
|
5196
|
-
if (!
|
|
5197
|
-
|
|
5213
|
+
if (!existsSync(cacheDist)) {
|
|
5214
|
+
mkdirSync(cacheDist, { recursive: true });
|
|
5198
5215
|
}
|
|
5199
5216
|
function copyDir(src, dest) {
|
|
5200
|
-
|
|
5201
|
-
for (const entry of
|
|
5202
|
-
const srcPath =
|
|
5203
|
-
const destPath =
|
|
5204
|
-
if (
|
|
5217
|
+
mkdirSync(dest, { recursive: true });
|
|
5218
|
+
for (const entry of readdirSync(src)) {
|
|
5219
|
+
const srcPath = join(src, entry);
|
|
5220
|
+
const destPath = join(dest, entry);
|
|
5221
|
+
if (statSync(srcPath).isDirectory()) {
|
|
5205
5222
|
copyDir(srcPath, destPath);
|
|
5206
5223
|
} else {
|
|
5207
|
-
|
|
5224
|
+
copyFileSync(srcPath, destPath);
|
|
5208
5225
|
}
|
|
5209
5226
|
}
|
|
5210
5227
|
}
|
|
@@ -5213,12 +5230,12 @@ function populateOpencodeCache() {
|
|
|
5213
5230
|
const cacheDir = OPENCODE_CACHE_DIR;
|
|
5214
5231
|
const sourceFiles = [".env.example", "README.md", "LICENSE", "scripts/migration-v2.sql", "package.json"];
|
|
5215
5232
|
for (const file of sourceFiles) {
|
|
5216
|
-
const srcFile =
|
|
5217
|
-
const destFile =
|
|
5218
|
-
const destDir =
|
|
5219
|
-
if (
|
|
5220
|
-
|
|
5221
|
-
|
|
5233
|
+
const srcFile = join(__dirname, "..", file);
|
|
5234
|
+
const destFile = join(cacheDir, file);
|
|
5235
|
+
const destDir = dirname(destFile);
|
|
5236
|
+
if (existsSync(srcFile)) {
|
|
5237
|
+
mkdirSync(destDir, { recursive: true });
|
|
5238
|
+
copyFileSync(srcFile, destFile);
|
|
5222
5239
|
}
|
|
5223
5240
|
}
|
|
5224
5241
|
return true;
|
|
@@ -5238,6 +5255,7 @@ OpenCode PG Memory installer
|
|
|
5238
5255
|
createInitCommand();
|
|
5239
5256
|
createSyncCommand();
|
|
5240
5257
|
createReflectCommand();
|
|
5258
|
+
createNoteCommand();
|
|
5241
5259
|
createSkill();
|
|
5242
5260
|
createAgentsTemplate();
|
|
5243
5261
|
populateOpencodeCache();
|
|
@@ -5262,8 +5280,8 @@ Syncing OpenCode sessions to PostgreSQL...
|
|
|
5262
5280
|
try {
|
|
5263
5281
|
const { Database } = await import("bun:sqlite");
|
|
5264
5282
|
const { Pool: Pool2 } = await Promise.resolve().then(() => (init_esm(), exports_esm));
|
|
5265
|
-
const opencodeDb =
|
|
5266
|
-
if (!
|
|
5283
|
+
const opencodeDb = join(homedir(), ".local", "share", "opencode", "opencode.db");
|
|
5284
|
+
if (!existsSync(opencodeDb)) {
|
|
5267
5285
|
console.error("OpenCode database not found at:", opencodeDb);
|
|
5268
5286
|
return 1;
|
|
5269
5287
|
}
|