@automagik/omni 2.260224.3 → 2.260224.8
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/commands/install.d.ts.map +1 -1
- package/dist/index.js +239 -17
- package/dist/server/index.js +53293 -51624
- package/dist/version.d.ts.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAokBpC,wBAAgB,oBAAoB,IAAI,OAAO,CAO9C"}
|
package/dist/index.js
CHANGED
|
@@ -2251,7 +2251,7 @@ var init_config = __esm(() => {
|
|
|
2251
2251
|
},
|
|
2252
2252
|
"server.port": { description: "Server port (default: 8882)" },
|
|
2253
2253
|
"server.databaseUrl": { description: "PostgreSQL connection URL" },
|
|
2254
|
-
"server.dataDir": { description: "Data directory for
|
|
2254
|
+
"server.dataDir": { description: "Data directory for pgserve (PostgreSQL) and media storage" },
|
|
2255
2255
|
"server.logLevel": {
|
|
2256
2256
|
description: "Log level",
|
|
2257
2257
|
values: ["debug", "info", "warn", "error"]
|
|
@@ -27652,8 +27652,58 @@ function raw(text) {
|
|
|
27652
27652
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
27653
27653
|
import { dirname, join as join2 } from "path";
|
|
27654
27654
|
import { fileURLToPath } from "url";
|
|
27655
|
+
// package.json
|
|
27656
|
+
var package_default = {
|
|
27657
|
+
name: "@automagik/omni",
|
|
27658
|
+
version: "2.260224.8",
|
|
27659
|
+
description: "LLM-optimized CLI for Omni v2",
|
|
27660
|
+
type: "module",
|
|
27661
|
+
bin: {
|
|
27662
|
+
omni: "./bin/omni"
|
|
27663
|
+
},
|
|
27664
|
+
main: "dist/index.js",
|
|
27665
|
+
types: "dist/index.d.ts",
|
|
27666
|
+
files: ["dist", "bin"],
|
|
27667
|
+
publishConfig: {
|
|
27668
|
+
access: "public"
|
|
27669
|
+
},
|
|
27670
|
+
scripts: {
|
|
27671
|
+
build: "bun build ./src/index.ts --outdir ./dist --target bun && bun run build:types",
|
|
27672
|
+
"build:types": "tsc --emitDeclarationOnly --declaration --outDir dist",
|
|
27673
|
+
dev: "echo 'CLI package - no dev server (use: bun run ./src/index.ts <command>)'",
|
|
27674
|
+
typecheck: "tsc --noEmit",
|
|
27675
|
+
test: "bun test",
|
|
27676
|
+
"test:integration": "RUN_INTEGRATION_TESTS=1 bun test",
|
|
27677
|
+
clean: "rm -rf dist",
|
|
27678
|
+
"build:server": "bun build src/bundled-server-entry.ts --outfile dist/server/index.js --target bun",
|
|
27679
|
+
"build:migrations": "cp -r ../db/drizzle dist/drizzle",
|
|
27680
|
+
prepack: "bun run build && bun run build:server && bun run build:migrations"
|
|
27681
|
+
},
|
|
27682
|
+
dependencies: {
|
|
27683
|
+
chalk: "^5.4.0",
|
|
27684
|
+
commander: "^13.1.0",
|
|
27685
|
+
ora: "^8.1.1",
|
|
27686
|
+
"qrcode-terminal": "^0.12.0"
|
|
27687
|
+
},
|
|
27688
|
+
devDependencies: {
|
|
27689
|
+
"@omni/api": "workspace:*",
|
|
27690
|
+
"@omni/channel-discord": "workspace:*",
|
|
27691
|
+
"@omni/channel-sdk": "workspace:*",
|
|
27692
|
+
"@omni/channel-slack": "workspace:*",
|
|
27693
|
+
"@omni/channel-telegram": "workspace:*",
|
|
27694
|
+
"@omni/channel-whatsapp": "workspace:*",
|
|
27695
|
+
"@omni/core": "workspace:*",
|
|
27696
|
+
"@omni/sdk": "workspace:*",
|
|
27697
|
+
"@types/node": "^22.10.3",
|
|
27698
|
+
"@types/qrcode-terminal": "^0.12.2",
|
|
27699
|
+
typescript: "^5.7.3"
|
|
27700
|
+
}
|
|
27701
|
+
};
|
|
27702
|
+
|
|
27703
|
+
// src/version.ts
|
|
27655
27704
|
var CLI_VERSION_HEADER = "x-omni-cli-version";
|
|
27656
27705
|
var SERVER_VERSION_HEADER = "x-omni-server-version";
|
|
27706
|
+
var EMBEDDED_VERSION = package_default?.version;
|
|
27657
27707
|
var __dirname2 = dirname(fileURLToPath(import.meta.url));
|
|
27658
27708
|
function readJsonFile(path) {
|
|
27659
27709
|
try {
|
|
@@ -27695,6 +27745,8 @@ function readVersionFromPackage() {
|
|
|
27695
27745
|
return version;
|
|
27696
27746
|
}
|
|
27697
27747
|
function detectVersion() {
|
|
27748
|
+
if (EMBEDDED_VERSION && EMBEDDED_VERSION !== "0.0.0")
|
|
27749
|
+
return EMBEDDED_VERSION;
|
|
27698
27750
|
return readVersionFromArtifact() ?? readVersionFromPackage();
|
|
27699
27751
|
}
|
|
27700
27752
|
var VERSION = detectVersion();
|
|
@@ -30874,18 +30926,83 @@ function stripAnsi(string) {
|
|
|
30874
30926
|
return string.replace(regex, "");
|
|
30875
30927
|
}
|
|
30876
30928
|
|
|
30877
|
-
// ../../node_modules/.bun/get-east-asian-width@1.
|
|
30878
|
-
|
|
30879
|
-
|
|
30880
|
-
|
|
30881
|
-
|
|
30882
|
-
|
|
30883
|
-
|
|
30884
|
-
|
|
30885
|
-
|
|
30886
|
-
|
|
30929
|
+
// ../../node_modules/.bun/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup-data.js
|
|
30930
|
+
var ambiguousRanges = [161, 161, 164, 164, 167, 168, 170, 170, 173, 174, 176, 180, 182, 186, 188, 191, 198, 198, 208, 208, 215, 216, 222, 225, 230, 230, 232, 234, 236, 237, 240, 240, 242, 243, 247, 250, 252, 252, 254, 254, 257, 257, 273, 273, 275, 275, 283, 283, 294, 295, 299, 299, 305, 307, 312, 312, 319, 322, 324, 324, 328, 331, 333, 333, 338, 339, 358, 359, 363, 363, 462, 462, 464, 464, 466, 466, 468, 468, 470, 470, 472, 472, 474, 474, 476, 476, 593, 593, 609, 609, 708, 708, 711, 711, 713, 715, 717, 717, 720, 720, 728, 731, 733, 733, 735, 735, 768, 879, 913, 929, 931, 937, 945, 961, 963, 969, 1025, 1025, 1040, 1103, 1105, 1105, 8208, 8208, 8211, 8214, 8216, 8217, 8220, 8221, 8224, 8226, 8228, 8231, 8240, 8240, 8242, 8243, 8245, 8245, 8251, 8251, 8254, 8254, 8308, 8308, 8319, 8319, 8321, 8324, 8364, 8364, 8451, 8451, 8453, 8453, 8457, 8457, 8467, 8467, 8470, 8470, 8481, 8482, 8486, 8486, 8491, 8491, 8531, 8532, 8539, 8542, 8544, 8555, 8560, 8569, 8585, 8585, 8592, 8601, 8632, 8633, 8658, 8658, 8660, 8660, 8679, 8679, 8704, 8704, 8706, 8707, 8711, 8712, 8715, 8715, 8719, 8719, 8721, 8721, 8725, 8725, 8730, 8730, 8733, 8736, 8739, 8739, 8741, 8741, 8743, 8748, 8750, 8750, 8756, 8759, 8764, 8765, 8776, 8776, 8780, 8780, 8786, 8786, 8800, 8801, 8804, 8807, 8810, 8811, 8814, 8815, 8834, 8835, 8838, 8839, 8853, 8853, 8857, 8857, 8869, 8869, 8895, 8895, 8978, 8978, 9312, 9449, 9451, 9547, 9552, 9587, 9600, 9615, 9618, 9621, 9632, 9633, 9635, 9641, 9650, 9651, 9654, 9655, 9660, 9661, 9664, 9665, 9670, 9672, 9675, 9675, 9678, 9681, 9698, 9701, 9711, 9711, 9733, 9734, 9737, 9737, 9742, 9743, 9756, 9756, 9758, 9758, 9792, 9792, 9794, 9794, 9824, 9825, 9827, 9829, 9831, 9834, 9836, 9837, 9839, 9839, 9886, 9887, 9919, 9919, 9926, 9933, 9935, 9939, 9941, 9953, 9955, 9955, 9960, 9961, 9963, 9969, 9972, 9972, 9974, 9977, 9979, 9980, 9982, 9983, 10045, 10045, 10102, 10111, 11094, 11097, 12872, 12879, 57344, 63743, 65024, 65039, 65533, 65533, 127232, 127242, 127248, 127277, 127280, 127337, 127344, 127373, 127375, 127376, 127387, 127404, 917760, 917999, 983040, 1048573, 1048576, 1114109];
|
|
30931
|
+
var fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
|
|
30932
|
+
var halfwidthRanges = [8361, 8361, 65377, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65512, 65518];
|
|
30933
|
+
var narrowRanges = [32, 126, 162, 163, 165, 166, 172, 172, 175, 175, 10214, 10221, 10629, 10630];
|
|
30934
|
+
var wideRanges = [4352, 4447, 8986, 8987, 9001, 9002, 9193, 9196, 9200, 9200, 9203, 9203, 9725, 9726, 9748, 9749, 9776, 9783, 9800, 9811, 9855, 9855, 9866, 9871, 9875, 9875, 9889, 9889, 9898, 9899, 9917, 9918, 9924, 9925, 9934, 9934, 9940, 9940, 9962, 9962, 9970, 9971, 9973, 9973, 9978, 9978, 9981, 9981, 9989, 9989, 9994, 9995, 10024, 10024, 10060, 10060, 10062, 10062, 10067, 10069, 10071, 10071, 10133, 10135, 10160, 10160, 10175, 10175, 11035, 11036, 11088, 11088, 11093, 11093, 11904, 11929, 11931, 12019, 12032, 12245, 12272, 12287, 12289, 12350, 12353, 12438, 12441, 12543, 12549, 12591, 12593, 12686, 12688, 12773, 12783, 12830, 12832, 12871, 12880, 42124, 42128, 42182, 43360, 43388, 44032, 55203, 63744, 64255, 65040, 65049, 65072, 65106, 65108, 65126, 65128, 65131, 94176, 94180, 94192, 94198, 94208, 101589, 101631, 101662, 101760, 101874, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127488, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 127776, 127789, 127797, 127799, 127868, 127870, 127891, 127904, 127946, 127951, 127955, 127968, 127984, 127988, 127988, 127992, 128062, 128064, 128064, 128066, 128252, 128255, 128317, 128331, 128334, 128336, 128359, 128378, 128378, 128405, 128406, 128420, 128420, 128507, 128591, 128640, 128709, 128716, 128716, 128720, 128722, 128725, 128728, 128732, 128735, 128747, 128748, 128756, 128764, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129674, 129678, 129734, 129736, 129736, 129741, 129756, 129759, 129770, 129775, 129784, 131072, 196605, 196608, 262141];
|
|
30935
|
+
|
|
30936
|
+
// ../../node_modules/.bun/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/utilities.js
|
|
30937
|
+
var isInRange = (ranges, codePoint) => {
|
|
30938
|
+
let low = 0;
|
|
30939
|
+
let high = Math.floor(ranges.length / 2) - 1;
|
|
30940
|
+
while (low <= high) {
|
|
30941
|
+
const mid = Math.floor((low + high) / 2);
|
|
30942
|
+
const i = mid * 2;
|
|
30943
|
+
if (codePoint < ranges[i]) {
|
|
30944
|
+
high = mid - 1;
|
|
30945
|
+
} else if (codePoint > ranges[i + 1]) {
|
|
30946
|
+
low = mid + 1;
|
|
30947
|
+
} else {
|
|
30948
|
+
return true;
|
|
30949
|
+
}
|
|
30950
|
+
}
|
|
30951
|
+
return false;
|
|
30952
|
+
};
|
|
30887
30953
|
|
|
30888
|
-
// ../../node_modules/.bun/get-east-asian-width@1.
|
|
30954
|
+
// ../../node_modules/.bun/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup.js
|
|
30955
|
+
var minimumAmbiguousCodePoint = ambiguousRanges[0];
|
|
30956
|
+
var maximumAmbiguousCodePoint = ambiguousRanges.at(-1);
|
|
30957
|
+
var minimumFullWidthCodePoint = fullwidthRanges[0];
|
|
30958
|
+
var maximumFullWidthCodePoint = fullwidthRanges.at(-1);
|
|
30959
|
+
var minimumHalfWidthCodePoint = halfwidthRanges[0];
|
|
30960
|
+
var maximumHalfWidthCodePoint = halfwidthRanges.at(-1);
|
|
30961
|
+
var minimumNarrowCodePoint = narrowRanges[0];
|
|
30962
|
+
var maximumNarrowCodePoint = narrowRanges.at(-1);
|
|
30963
|
+
var minimumWideCodePoint = wideRanges[0];
|
|
30964
|
+
var maximumWideCodePoint = wideRanges.at(-1);
|
|
30965
|
+
var commonCjkCodePoint = 19968;
|
|
30966
|
+
var [wideFastPathStart, wideFastPathEnd] = findWideFastPathRange(wideRanges);
|
|
30967
|
+
function findWideFastPathRange(ranges) {
|
|
30968
|
+
let fastPathStart = ranges[0];
|
|
30969
|
+
let fastPathEnd = ranges[1];
|
|
30970
|
+
for (let index = 0;index < ranges.length; index += 2) {
|
|
30971
|
+
const start = ranges[index];
|
|
30972
|
+
const end = ranges[index + 1];
|
|
30973
|
+
if (commonCjkCodePoint >= start && commonCjkCodePoint <= end) {
|
|
30974
|
+
return [start, end];
|
|
30975
|
+
}
|
|
30976
|
+
if (end - start > fastPathEnd - fastPathStart) {
|
|
30977
|
+
fastPathStart = start;
|
|
30978
|
+
fastPathEnd = end;
|
|
30979
|
+
}
|
|
30980
|
+
}
|
|
30981
|
+
return [fastPathStart, fastPathEnd];
|
|
30982
|
+
}
|
|
30983
|
+
var isAmbiguous = (codePoint) => {
|
|
30984
|
+
if (codePoint < minimumAmbiguousCodePoint || codePoint > maximumAmbiguousCodePoint) {
|
|
30985
|
+
return false;
|
|
30986
|
+
}
|
|
30987
|
+
return isInRange(ambiguousRanges, codePoint);
|
|
30988
|
+
};
|
|
30989
|
+
var isFullWidth = (codePoint) => {
|
|
30990
|
+
if (codePoint < minimumFullWidthCodePoint || codePoint > maximumFullWidthCodePoint) {
|
|
30991
|
+
return false;
|
|
30992
|
+
}
|
|
30993
|
+
return isInRange(fullwidthRanges, codePoint);
|
|
30994
|
+
};
|
|
30995
|
+
var isWide = (codePoint) => {
|
|
30996
|
+
if (codePoint >= wideFastPathStart && codePoint <= wideFastPathEnd) {
|
|
30997
|
+
return true;
|
|
30998
|
+
}
|
|
30999
|
+
if (codePoint < minimumWideCodePoint || codePoint > maximumWideCodePoint) {
|
|
31000
|
+
return false;
|
|
31001
|
+
}
|
|
31002
|
+
return isInRange(wideRanges, codePoint);
|
|
31003
|
+
};
|
|
31004
|
+
|
|
31005
|
+
// ../../node_modules/.bun/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/index.js
|
|
30889
31006
|
function validate(codePoint) {
|
|
30890
31007
|
if (!Number.isSafeInteger(codePoint)) {
|
|
30891
31008
|
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
@@ -31516,7 +31633,7 @@ function buildApiRuntimeEnv(cfg) {
|
|
|
31516
31633
|
MEDIA_STORAGE_PATH: join4(cfg.dataDir, "media"),
|
|
31517
31634
|
OMNI_PACKAGES_DIR: join4(cfg.dataDir, "packages"),
|
|
31518
31635
|
PGSERVE_EMBEDDED: "true",
|
|
31519
|
-
PGSERVE_DATA: join4(cfg.dataDir, "
|
|
31636
|
+
PGSERVE_DATA: join4(cfg.dataDir, "pgserve"),
|
|
31520
31637
|
NATS_URL: "nats://localhost:4222",
|
|
31521
31638
|
NODE_ENV: "production",
|
|
31522
31639
|
LOG_LEVEL: "info"
|
|
@@ -31673,7 +31790,7 @@ async function startServices(cfg) {
|
|
|
31673
31790
|
const runtimeEnv = buildApiRuntimeEnv(cfg);
|
|
31674
31791
|
const apiSpinner = ora(`Starting ${PM2_PROCESSES.api} on port ${cfg.port}...`).start();
|
|
31675
31792
|
const launcherPath = getServerLauncherPath();
|
|
31676
|
-
const apiCode = await runPm2(["start", launcherPath, "--name", PM2_PROCESSES.api], runtimeEnv);
|
|
31793
|
+
const apiCode = await runPm2(["start", launcherPath, "--name", PM2_PROCESSES.api, "--interpreter", "bash"], runtimeEnv);
|
|
31677
31794
|
if (apiCode !== 0) {
|
|
31678
31795
|
apiSpinner.fail(`Failed to start ${PM2_PROCESSES.api} (pm2 exit code ${apiCode})`);
|
|
31679
31796
|
} else {
|
|
@@ -41757,6 +41874,111 @@ function numberFromEnv(name, fallback2) {
|
|
|
41757
41874
|
const parsed = Number(val);
|
|
41758
41875
|
return Number.isNaN(parsed) ? fallback2 : parsed;
|
|
41759
41876
|
}
|
|
41877
|
+
// ../core/src/hooks/types.ts
|
|
41878
|
+
var HOOK_EVENTS = ["before_agent_start", "before_message_write"];
|
|
41879
|
+
var MAX_HOOKS_PER_INSTANCE = 50;
|
|
41880
|
+
var BeforeAgentStartContextSchema = exports_external.object({
|
|
41881
|
+
instanceId: exports_external.string(),
|
|
41882
|
+
chatId: exports_external.string(),
|
|
41883
|
+
senderId: exports_external.string(),
|
|
41884
|
+
senderName: exports_external.string().optional(),
|
|
41885
|
+
model: exports_external.string().optional(),
|
|
41886
|
+
provider: exports_external.string().optional(),
|
|
41887
|
+
agentId: exports_external.string().optional(),
|
|
41888
|
+
triggerType: exports_external.string().optional(),
|
|
41889
|
+
traceId: exports_external.string().optional(),
|
|
41890
|
+
correlationId: exports_external.string().optional(),
|
|
41891
|
+
files: exports_external.array(exports_external.unknown()).optional(),
|
|
41892
|
+
metadata: exports_external.record(exports_external.string()).optional()
|
|
41893
|
+
});
|
|
41894
|
+
var BeforeMessageWriteContextSchema = exports_external.object({
|
|
41895
|
+
instanceId: exports_external.string(),
|
|
41896
|
+
chatId: exports_external.string(),
|
|
41897
|
+
content: exports_external.string().max(1e5),
|
|
41898
|
+
direction: exports_external.enum(["inbound", "outbound"]),
|
|
41899
|
+
senderId: exports_external.string().optional(),
|
|
41900
|
+
metadata: exports_external.record(exports_external.string()).optional()
|
|
41901
|
+
});
|
|
41902
|
+
var DEFAULT_HOOK_PRIORITY = 50;
|
|
41903
|
+
var MIN_HOOK_PRIORITY = 0;
|
|
41904
|
+
var MAX_HOOK_PRIORITY = 100;
|
|
41905
|
+
// ../core/src/hooks/registry.ts
|
|
41906
|
+
class HookRegistry {
|
|
41907
|
+
hooks = new Map;
|
|
41908
|
+
register(instanceId, input) {
|
|
41909
|
+
const { event, handler, name, id: customId } = input;
|
|
41910
|
+
if (!HOOK_EVENTS.includes(event)) {
|
|
41911
|
+
throw new Error(`Invalid hook event: ${event}. Must be one of: ${HOOK_EVENTS.join(", ")}`);
|
|
41912
|
+
}
|
|
41913
|
+
if (this.getHookCount(instanceId) >= MAX_HOOKS_PER_INSTANCE) {
|
|
41914
|
+
throw new Error(`Hook registration limit exceeded for instance ${instanceId} (max: ${MAX_HOOKS_PER_INSTANCE})`);
|
|
41915
|
+
}
|
|
41916
|
+
const rawPriority = input.priority ?? DEFAULT_HOOK_PRIORITY;
|
|
41917
|
+
const priority = Math.max(MIN_HOOK_PRIORITY, Math.min(MAX_HOOK_PRIORITY, rawPriority));
|
|
41918
|
+
const hookId = customId ?? `hook_${generateId()}`;
|
|
41919
|
+
const hookHandler = {
|
|
41920
|
+
id: hookId,
|
|
41921
|
+
event,
|
|
41922
|
+
priority,
|
|
41923
|
+
handler,
|
|
41924
|
+
name
|
|
41925
|
+
};
|
|
41926
|
+
let instanceHooks = this.hooks.get(instanceId);
|
|
41927
|
+
if (!instanceHooks) {
|
|
41928
|
+
instanceHooks = new Map;
|
|
41929
|
+
this.hooks.set(instanceId, instanceHooks);
|
|
41930
|
+
}
|
|
41931
|
+
let eventHooks = instanceHooks.get(event);
|
|
41932
|
+
if (!eventHooks) {
|
|
41933
|
+
eventHooks = new Map;
|
|
41934
|
+
instanceHooks.set(event, eventHooks);
|
|
41935
|
+
}
|
|
41936
|
+
eventHooks.set(hookId, hookHandler);
|
|
41937
|
+
return hookId;
|
|
41938
|
+
}
|
|
41939
|
+
unregister(instanceId, hookId) {
|
|
41940
|
+
const instanceHooks = this.hooks.get(instanceId);
|
|
41941
|
+
if (!instanceHooks)
|
|
41942
|
+
return false;
|
|
41943
|
+
let removed = false;
|
|
41944
|
+
for (const [, eventHooks] of instanceHooks) {
|
|
41945
|
+
if (eventHooks.delete(hookId)) {
|
|
41946
|
+
removed = true;
|
|
41947
|
+
}
|
|
41948
|
+
}
|
|
41949
|
+
return removed;
|
|
41950
|
+
}
|
|
41951
|
+
getHooks(instanceId, event) {
|
|
41952
|
+
const instanceHooks = this.hooks.get(instanceId);
|
|
41953
|
+
if (!instanceHooks)
|
|
41954
|
+
return [];
|
|
41955
|
+
const eventHooks = instanceHooks.get(event);
|
|
41956
|
+
if (!eventHooks)
|
|
41957
|
+
return [];
|
|
41958
|
+
return Array.from(eventHooks.values()).sort((a, b2) => a.priority - b2.priority);
|
|
41959
|
+
}
|
|
41960
|
+
getHookCount(instanceId, event) {
|
|
41961
|
+
const instanceHooks = this.hooks.get(instanceId);
|
|
41962
|
+
if (!instanceHooks)
|
|
41963
|
+
return 0;
|
|
41964
|
+
if (event) {
|
|
41965
|
+
return instanceHooks.get(event)?.size ?? 0;
|
|
41966
|
+
}
|
|
41967
|
+
let count = 0;
|
|
41968
|
+
for (const [, eventHooks] of instanceHooks) {
|
|
41969
|
+
count += eventHooks.size;
|
|
41970
|
+
}
|
|
41971
|
+
return count;
|
|
41972
|
+
}
|
|
41973
|
+
clearInstance(instanceId) {
|
|
41974
|
+
this.hooks.delete(instanceId);
|
|
41975
|
+
}
|
|
41976
|
+
clearAll() {
|
|
41977
|
+
this.hooks.clear();
|
|
41978
|
+
}
|
|
41979
|
+
}
|
|
41980
|
+
// ../core/src/hooks/executor.ts
|
|
41981
|
+
var log12 = createLogger("hooks:executor");
|
|
41760
41982
|
// src/commands/providers-setup.ts
|
|
41761
41983
|
import { execFileSync, execSync } from "child_process";
|
|
41762
41984
|
import * as nodeCrypto2 from "crypto";
|
|
@@ -42442,7 +42664,7 @@ function buildApiRuntimeEnv2() {
|
|
|
42442
42664
|
OMNI_API_KEY: config2.apiKey ?? "",
|
|
42443
42665
|
MEDIA_STORAGE_PATH: join5(serverConfig.dataDir, "media"),
|
|
42444
42666
|
PGSERVE_EMBEDDED: "true",
|
|
42445
|
-
PGSERVE_DATA: join5(serverConfig.dataDir, "
|
|
42667
|
+
PGSERVE_DATA: join5(serverConfig.dataDir, "pgserve"),
|
|
42446
42668
|
NATS_URL: "nats://localhost:4222",
|
|
42447
42669
|
NODE_ENV: serverConfig.nodeEnv,
|
|
42448
42670
|
LOG_LEVEL: serverConfig.logLevel
|
|
@@ -43081,7 +43303,7 @@ function buildApiRuntimeEnv3() {
|
|
|
43081
43303
|
MEDIA_STORAGE_PATH: join6(serverConfig.dataDir, "media"),
|
|
43082
43304
|
OMNI_PACKAGES_DIR: join6(serverConfig.dataDir, "packages"),
|
|
43083
43305
|
PGSERVE_EMBEDDED: "true",
|
|
43084
|
-
PGSERVE_DATA: join6(serverConfig.dataDir, "
|
|
43306
|
+
PGSERVE_DATA: join6(serverConfig.dataDir, "pgserve"),
|
|
43085
43307
|
NATS_URL: "nats://localhost:4222",
|
|
43086
43308
|
NODE_ENV: serverConfig.nodeEnv,
|
|
43087
43309
|
LOG_LEVEL: serverConfig.logLevel
|
|
@@ -43100,7 +43322,7 @@ async function runStart() {
|
|
|
43100
43322
|
info(`Starting ${PM2_PROCESSES.api} (port ${apiPort})...`);
|
|
43101
43323
|
const env2 = buildApiRuntimeEnv3();
|
|
43102
43324
|
const launcherPath = getServerLauncherPath();
|
|
43103
|
-
const apiCode = await runPm2(["start", launcherPath, "--name", PM2_PROCESSES.api], env2);
|
|
43325
|
+
const apiCode = await runPm2(["start", launcherPath, "--name", PM2_PROCESSES.api, "--interpreter", "bash"], env2);
|
|
43104
43326
|
if (apiCode !== 0) {
|
|
43105
43327
|
error(`Failed to start ${PM2_PROCESSES.api} (pm2 exit code ${apiCode})`, undefined, 1);
|
|
43106
43328
|
return;
|