@kl-c/matrixos 0.1.6 → 0.1.9

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.
Files changed (124) hide show
  1. package/.agents/command/adopt.md +50 -0
  2. package/.agents/command/features.md +35 -0
  3. package/.opencode/command/adopt.md +50 -0
  4. package/.opencode/command/features.md +35 -0
  5. package/dist/cli/config-manager/write-gateway-env.d.ts +7 -0
  6. package/dist/cli/index.js +942 -788
  7. package/dist/cli/install-validators.d.ts +1 -0
  8. package/dist/cli/skills/debugging/references/methodology/02-investigate.md +1 -1
  9. package/dist/cli/skills/refactor/SKILL.md +1 -1
  10. package/dist/cli/skills/superpowers-brainstorming/SKILL.md +162 -0
  11. package/dist/cli/skills/superpowers-brainstorming/SUPERPOWERS_LICENSE +21 -0
  12. package/dist/cli/skills/superpowers-brainstorming/scripts/frame-template.html +213 -0
  13. package/dist/cli/skills/superpowers-brainstorming/scripts/helper.js +167 -0
  14. package/dist/cli/skills/superpowers-brainstorming/scripts/server.cjs +723 -0
  15. package/dist/cli/skills/superpowers-brainstorming/scripts/start-server.sh +209 -0
  16. package/dist/cli/skills/superpowers-brainstorming/scripts/stop-server.sh +120 -0
  17. package/dist/cli/skills/superpowers-brainstorming/spec-document-reviewer-prompt.md +49 -0
  18. package/dist/cli/skills/superpowers-brainstorming/visual-companion.md +291 -0
  19. package/dist/cli/skills/superpowers-receiving-code-review/SKILL.md +216 -0
  20. package/dist/cli/skills/superpowers-receiving-code-review/SUPERPOWERS_LICENSE +21 -0
  21. package/dist/cli/skills/superpowers-systematic-debugging/CREATION-LOG.md +119 -0
  22. package/dist/cli/skills/superpowers-systematic-debugging/SKILL.md +299 -0
  23. package/dist/cli/skills/superpowers-systematic-debugging/SUPERPOWERS_LICENSE +21 -0
  24. package/dist/cli/skills/superpowers-systematic-debugging/condition-based-waiting-example.ts +158 -0
  25. package/dist/cli/skills/superpowers-systematic-debugging/condition-based-waiting.md +115 -0
  26. package/dist/cli/skills/superpowers-systematic-debugging/defense-in-depth.md +122 -0
  27. package/dist/cli/skills/superpowers-systematic-debugging/find-polluter.sh +63 -0
  28. package/dist/cli/skills/superpowers-systematic-debugging/root-cause-tracing.md +169 -0
  29. package/dist/cli/skills/superpowers-systematic-debugging/test-academic.md +14 -0
  30. package/dist/cli/skills/superpowers-systematic-debugging/test-pressure-1.md +58 -0
  31. package/dist/cli/skills/superpowers-systematic-debugging/test-pressure-2.md +68 -0
  32. package/dist/cli/skills/superpowers-systematic-debugging/test-pressure-3.md +69 -0
  33. package/dist/cli/skills/superpowers-writing-skills/SKILL.md +692 -0
  34. package/dist/cli/skills/superpowers-writing-skills/SUPERPOWERS_LICENSE +21 -0
  35. package/dist/cli/skills/superpowers-writing-skills/anthropic-best-practices.md +1150 -0
  36. package/dist/cli/skills/superpowers-writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
  37. package/dist/cli/skills/superpowers-writing-skills/graphviz-conventions.dot +172 -0
  38. package/dist/cli/skills/superpowers-writing-skills/persuasion-principles.md +187 -0
  39. package/dist/cli/skills/superpowers-writing-skills/render-graphs.js +168 -0
  40. package/dist/cli/skills/superpowers-writing-skills/testing-skills-with-subagents.md +384 -0
  41. package/dist/cli/types.d.ts +4 -0
  42. package/dist/cli-node/index.js +942 -788
  43. package/dist/config/schema/oh-my-opencode-config.d.ts +7 -0
  44. package/dist/config/schema/watchdog.d.ts +7 -0
  45. package/dist/features/anti-loop/background-registry.d.ts +10 -0
  46. package/dist/features/anti-loop/logger.d.ts +15 -0
  47. package/dist/features/dashboard/frontend/css/style.css +211 -0
  48. package/dist/features/dashboard/frontend/index.html +173 -0
  49. package/dist/features/dashboard/frontend/js/api.js +2 -0
  50. package/dist/features/dashboard/frontend/js/app.js +349 -0
  51. package/dist/features/matrix-inventory/features.d.ts +45 -0
  52. package/dist/hooks/agent-anti-loop/hook.d.ts +21 -26
  53. package/dist/index.js +392 -145
  54. package/dist/oh-my-opencode.schema.json +49 -0
  55. package/dist/plugin/agent-anti-loop.d.ts +8 -5
  56. package/dist/skills/debugging/references/methodology/02-investigate.md +1 -1
  57. package/dist/skills/refactor/SKILL.md +1 -1
  58. package/dist/skills/superpowers-brainstorming/SKILL.md +162 -0
  59. package/dist/skills/superpowers-brainstorming/SUPERPOWERS_LICENSE +21 -0
  60. package/dist/skills/superpowers-brainstorming/scripts/frame-template.html +213 -0
  61. package/dist/skills/superpowers-brainstorming/scripts/helper.js +167 -0
  62. package/dist/skills/superpowers-brainstorming/scripts/server.cjs +723 -0
  63. package/dist/skills/superpowers-brainstorming/scripts/start-server.sh +209 -0
  64. package/dist/skills/superpowers-brainstorming/scripts/stop-server.sh +120 -0
  65. package/dist/skills/superpowers-brainstorming/spec-document-reviewer-prompt.md +49 -0
  66. package/dist/skills/superpowers-brainstorming/visual-companion.md +291 -0
  67. package/dist/skills/superpowers-receiving-code-review/SKILL.md +216 -0
  68. package/dist/skills/superpowers-receiving-code-review/SUPERPOWERS_LICENSE +21 -0
  69. package/dist/skills/superpowers-systematic-debugging/CREATION-LOG.md +119 -0
  70. package/dist/skills/superpowers-systematic-debugging/SKILL.md +299 -0
  71. package/dist/skills/superpowers-systematic-debugging/SUPERPOWERS_LICENSE +21 -0
  72. package/dist/skills/superpowers-systematic-debugging/condition-based-waiting-example.ts +158 -0
  73. package/dist/skills/superpowers-systematic-debugging/condition-based-waiting.md +115 -0
  74. package/dist/skills/superpowers-systematic-debugging/defense-in-depth.md +122 -0
  75. package/dist/skills/superpowers-systematic-debugging/find-polluter.sh +63 -0
  76. package/dist/skills/superpowers-systematic-debugging/root-cause-tracing.md +169 -0
  77. package/dist/skills/superpowers-systematic-debugging/test-academic.md +14 -0
  78. package/dist/skills/superpowers-systematic-debugging/test-pressure-1.md +58 -0
  79. package/dist/skills/superpowers-systematic-debugging/test-pressure-2.md +68 -0
  80. package/dist/skills/superpowers-systematic-debugging/test-pressure-3.md +69 -0
  81. package/dist/skills/superpowers-writing-skills/SKILL.md +692 -0
  82. package/dist/skills/superpowers-writing-skills/SUPERPOWERS_LICENSE +21 -0
  83. package/dist/skills/superpowers-writing-skills/anthropic-best-practices.md +1150 -0
  84. package/dist/skills/superpowers-writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
  85. package/dist/skills/superpowers-writing-skills/graphviz-conventions.dot +172 -0
  86. package/dist/skills/superpowers-writing-skills/persuasion-principles.md +187 -0
  87. package/dist/skills/superpowers-writing-skills/render-graphs.js +168 -0
  88. package/dist/skills/superpowers-writing-skills/testing-skills-with-subagents.md +384 -0
  89. package/dist/testing/create-gateway-relay.d.ts +26 -0
  90. package/dist/tui.js +14 -0
  91. package/package.json +2 -1
  92. package/packages/shared-skills/skills/debugging/references/methodology/02-investigate.md +1 -1
  93. package/packages/shared-skills/skills/refactor/SKILL.md +1 -1
  94. package/packages/shared-skills/skills/superpowers-brainstorming/SKILL.md +162 -0
  95. package/packages/shared-skills/skills/superpowers-brainstorming/SUPERPOWERS_LICENSE +21 -0
  96. package/packages/shared-skills/skills/superpowers-brainstorming/scripts/frame-template.html +213 -0
  97. package/packages/shared-skills/skills/superpowers-brainstorming/scripts/helper.js +167 -0
  98. package/packages/shared-skills/skills/superpowers-brainstorming/scripts/server.cjs +723 -0
  99. package/packages/shared-skills/skills/superpowers-brainstorming/scripts/start-server.sh +209 -0
  100. package/packages/shared-skills/skills/superpowers-brainstorming/scripts/stop-server.sh +120 -0
  101. package/packages/shared-skills/skills/superpowers-brainstorming/spec-document-reviewer-prompt.md +49 -0
  102. package/packages/shared-skills/skills/superpowers-brainstorming/visual-companion.md +291 -0
  103. package/packages/shared-skills/skills/superpowers-receiving-code-review/SKILL.md +216 -0
  104. package/packages/shared-skills/skills/superpowers-receiving-code-review/SUPERPOWERS_LICENSE +21 -0
  105. package/packages/shared-skills/skills/superpowers-systematic-debugging/CREATION-LOG.md +119 -0
  106. package/packages/shared-skills/skills/superpowers-systematic-debugging/SKILL.md +299 -0
  107. package/packages/shared-skills/skills/superpowers-systematic-debugging/SUPERPOWERS_LICENSE +21 -0
  108. package/packages/shared-skills/skills/superpowers-systematic-debugging/condition-based-waiting-example.ts +158 -0
  109. package/packages/shared-skills/skills/superpowers-systematic-debugging/condition-based-waiting.md +115 -0
  110. package/packages/shared-skills/skills/superpowers-systematic-debugging/defense-in-depth.md +122 -0
  111. package/packages/shared-skills/skills/superpowers-systematic-debugging/find-polluter.sh +63 -0
  112. package/packages/shared-skills/skills/superpowers-systematic-debugging/root-cause-tracing.md +169 -0
  113. package/packages/shared-skills/skills/superpowers-systematic-debugging/test-academic.md +14 -0
  114. package/packages/shared-skills/skills/superpowers-systematic-debugging/test-pressure-1.md +58 -0
  115. package/packages/shared-skills/skills/superpowers-systematic-debugging/test-pressure-2.md +68 -0
  116. package/packages/shared-skills/skills/superpowers-systematic-debugging/test-pressure-3.md +69 -0
  117. package/packages/shared-skills/skills/superpowers-writing-skills/SKILL.md +692 -0
  118. package/packages/shared-skills/skills/superpowers-writing-skills/SUPERPOWERS_LICENSE +21 -0
  119. package/packages/shared-skills/skills/superpowers-writing-skills/anthropic-best-practices.md +1150 -0
  120. package/packages/shared-skills/skills/superpowers-writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
  121. package/packages/shared-skills/skills/superpowers-writing-skills/graphviz-conventions.dot +172 -0
  122. package/packages/shared-skills/skills/superpowers-writing-skills/persuasion-principles.md +187 -0
  123. package/packages/shared-skills/skills/superpowers-writing-skills/render-graphs.js +168 -0
  124. package/packages/shared-skills/skills/superpowers-writing-skills/testing-skills-with-subagents.md +384 -0
package/dist/index.js CHANGED
@@ -57285,7 +57285,7 @@ var require_dist10 = __commonJS((exports, module) => {
57285
57285
  var import_node_worker_threads2 = __require("worker_threads");
57286
57286
  var import_collection2 = require_dist3();
57287
57287
  var import_node_events = __require("events");
57288
- var import_node_path126 = __require("path");
57288
+ var import_node_path128 = __require("path");
57289
57289
  var import_node_worker_threads = __require("worker_threads");
57290
57290
  var import_collection = require_dist3();
57291
57291
  var WorkerSendPayloadOp = /* @__PURE__ */ ((WorkerSendPayloadOp2) => {
@@ -57420,18 +57420,18 @@ var require_dist10 = __commonJS((exports, module) => {
57420
57420
  resolveWorkerPath() {
57421
57421
  const path28 = this.options.workerPath;
57422
57422
  if (!path28) {
57423
- return (0, import_node_path126.join)(__dirname, "defaultWorker.js");
57423
+ return (0, import_node_path128.join)(__dirname, "defaultWorker.js");
57424
57424
  }
57425
- if ((0, import_node_path126.isAbsolute)(path28)) {
57425
+ if ((0, import_node_path128.isAbsolute)(path28)) {
57426
57426
  return path28;
57427
57427
  }
57428
57428
  if (/^\.\.?[/\\]/.test(path28)) {
57429
- return (0, import_node_path126.resolve)(path28);
57429
+ return (0, import_node_path128.resolve)(path28);
57430
57430
  }
57431
57431
  try {
57432
57432
  return __require.resolve(path28);
57433
57433
  } catch {
57434
- return (0, import_node_path126.resolve)(path28);
57434
+ return (0, import_node_path128.resolve)(path28);
57435
57435
  }
57436
57436
  }
57437
57437
  async waitForWorkerReady(worker) {
@@ -233073,7 +233073,7 @@ import * as Crypto from "crypto";
233073
233073
  import { once } from "events";
233074
233074
  import { createReadStream, createWriteStream, promises as fs26, WriteStream } from "fs";
233075
233075
  import { tmpdir as tmpdir8 } from "os";
233076
- import { join as join134 } from "path";
233076
+ import { join as join136 } from "path";
233077
233077
  import { Readable as Readable2, Transform } from "stream";
233078
233078
  import { URL as URL2 } from "url";
233079
233079
  async function getMediaKeys(buffer2, mediaType) {
@@ -233151,7 +233151,7 @@ async function generateThumbnail(file2, mediaType, options) {
233151
233151
  };
233152
233152
  }
233153
233153
  } else if (mediaType === "video") {
233154
- const imgFilename = join134(getTmpFilesDirectory(), generateMessageIDV2() + ".jpg");
233154
+ const imgFilename = join136(getTmpFilesDirectory(), generateMessageIDV2() + ".jpg");
233155
233155
  try {
233156
233156
  await extractVideoThumb(file2, imgFilename, "00:00:00", { width: 32, height: 32 });
233157
233157
  const buff = await fs26.readFile(imgFilename);
@@ -233194,7 +233194,7 @@ var import_boom5, getTmpFilesDirectory = () => tmpdir8(), getImageProcessingLibr
233194
233194
  const { stream: stream3 } = await getStream(media);
233195
233195
  logger7?.debug("got stream for raw upload");
233196
233196
  const hasher = Crypto.createHash("sha256");
233197
- const filePath = join134(tmpdir8(), mediaType + generateMessageIDV2());
233197
+ const filePath = join136(tmpdir8(), mediaType + generateMessageIDV2());
233198
233198
  const fileWriteStream = createWriteStream(filePath);
233199
233199
  let fileLength = 0;
233200
233200
  try {
@@ -233334,12 +233334,12 @@ var import_boom5, getTmpFilesDirectory = () => tmpdir8(), getImageProcessingLibr
233334
233334
  logger7?.debug("fetched media stream");
233335
233335
  const mediaKey = Crypto.randomBytes(32);
233336
233336
  const { cipherKey, iv, macKey } = await getMediaKeys(mediaKey, mediaType);
233337
- const encFilePath = join134(getTmpFilesDirectory(), mediaType + generateMessageIDV2() + "-enc");
233337
+ const encFilePath = join136(getTmpFilesDirectory(), mediaType + generateMessageIDV2() + "-enc");
233338
233338
  const encFileWriteStream = createWriteStream(encFilePath);
233339
233339
  let originalFileStream;
233340
233340
  let originalFilePath;
233341
233341
  if (saveOriginalFileIfRequired) {
233342
- originalFilePath = join134(getTmpFilesDirectory(), mediaType + generateMessageIDV2() + "-original");
233342
+ originalFilePath = join136(getTmpFilesDirectory(), mediaType + generateMessageIDV2() + "-original");
233343
233343
  originalFileStream = createWriteStream(originalFilePath);
233344
233344
  }
233345
233345
  let fileLength = 0;
@@ -242744,7 +242744,7 @@ var init_auth_utils = __esm(() => {
242744
242744
 
242745
242745
  // node_modules/.bun/@whiskeysockets+baileys@7.0.0-rc13+13d21a63c79191a3/node_modules/@whiskeysockets/baileys/lib/Utils/use-multi-file-auth-state.js
242746
242746
  import { mkdir as mkdir11, readFile as readFile14, stat as stat8, unlink as unlink3, writeFile as writeFile4 } from "fs/promises";
242747
- import { join as join135 } from "path";
242747
+ import { join as join137 } from "path";
242748
242748
  var fileLocks, getFileLock = (path28) => {
242749
242749
  let mutex = fileLocks.get(path28);
242750
242750
  if (!mutex) {
@@ -242754,7 +242754,7 @@ var fileLocks, getFileLock = (path28) => {
242754
242754
  return mutex;
242755
242755
  }, useMultiFileAuthState = async (folder) => {
242756
242756
  const writeData = async (data3, file2) => {
242757
- const filePath = join135(folder, fixFileName(file2));
242757
+ const filePath = join137(folder, fixFileName(file2));
242758
242758
  const mutex = getFileLock(filePath);
242759
242759
  return mutex.acquire().then(async (release2) => {
242760
242760
  try {
@@ -242766,7 +242766,7 @@ var fileLocks, getFileLock = (path28) => {
242766
242766
  };
242767
242767
  const readData = async (file2) => {
242768
242768
  try {
242769
- const filePath = join135(folder, fixFileName(file2));
242769
+ const filePath = join137(folder, fixFileName(file2));
242770
242770
  const mutex = getFileLock(filePath);
242771
242771
  return await mutex.acquire().then(async (release2) => {
242772
242772
  try {
@@ -242782,7 +242782,7 @@ var fileLocks, getFileLock = (path28) => {
242782
242782
  };
242783
242783
  const removeData = async (file2) => {
242784
242784
  try {
242785
- const filePath = join135(folder, fixFileName(file2));
242785
+ const filePath = join137(folder, fixFileName(file2));
242786
242786
  const mutex = getFileLock(filePath);
242787
242787
  return mutex.acquire().then(async (release2) => {
242788
242788
  try {
@@ -263536,10 +263536,10 @@ var require_on_exit_leak_free = __commonJS((exports, module) => {
263536
263536
  exit: onExit,
263537
263537
  beforeExit: onBeforeExit
263538
263538
  };
263539
- var registry2;
263539
+ var registry3;
263540
263540
  function ensureRegistry() {
263541
- if (registry2 === undefined) {
263542
- registry2 = new FinalizationRegistry(clear);
263541
+ if (registry3 === undefined) {
263542
+ registry3 = new FinalizationRegistry(clear);
263543
263543
  }
263544
263544
  }
263545
263545
  function install(event) {
@@ -263554,7 +263554,7 @@ var require_on_exit_leak_free = __commonJS((exports, module) => {
263554
263554
  }
263555
263555
  process.removeListener(event, functions[event]);
263556
263556
  if (refs.exit.length === 0 && refs.beforeExit.length === 0) {
263557
- registry2 = undefined;
263557
+ registry3 = undefined;
263558
263558
  }
263559
263559
  }
263560
263560
  function onExit() {
@@ -263588,7 +263588,7 @@ var require_on_exit_leak_free = __commonJS((exports, module) => {
263588
263588
  const ref = new WeakRef(obj);
263589
263589
  ref.fn = fn;
263590
263590
  ensureRegistry();
263591
- registry2.register(obj, ref);
263591
+ registry3.register(obj, ref);
263592
263592
  refs[event].push(ref);
263593
263593
  }
263594
263594
  function register(obj, fn) {
@@ -263598,10 +263598,10 @@ var require_on_exit_leak_free = __commonJS((exports, module) => {
263598
263598
  _register("beforeExit", obj, fn);
263599
263599
  }
263600
263600
  function unregister(obj) {
263601
- if (registry2 === undefined) {
263601
+ if (registry3 === undefined) {
263602
263602
  return;
263603
263603
  }
263604
- registry2.unregister(obj);
263604
+ registry3.unregister(obj);
263605
263605
  for (const event of ["exit", "beforeExit"]) {
263606
263606
  refs[event] = refs[event].filter((ref) => {
263607
263607
  const _obj = ref.deref();
@@ -263753,7 +263753,7 @@ var require_thread_stream = __commonJS((exports, module) => {
263753
263753
  var { version: version2 } = require_package3();
263754
263754
  var { EventEmitter: EventEmitter4 } = __require("events");
263755
263755
  var { Worker } = __require("worker_threads");
263756
- var { join: join136 } = __require("path");
263756
+ var { join: join138 } = __require("path");
263757
263757
  var { pathToFileURL: pathToFileURL2 } = __require("url");
263758
263758
  var { wait: wait2 } = require_wait2();
263759
263759
  var {
@@ -263787,7 +263787,7 @@ var require_thread_stream = __commonJS((exports, module) => {
263787
263787
  }
263788
263788
  var FinalizationRegistry2 = process.env.NODE_V8_COVERAGE ? FakeFinalizationRegistry : global.FinalizationRegistry || FakeFinalizationRegistry;
263789
263789
  var WeakRef2 = process.env.NODE_V8_COVERAGE ? FakeWeakRef : global.WeakRef || FakeWeakRef;
263790
- var registry2 = new FinalizationRegistry2((worker) => {
263790
+ var registry3 = new FinalizationRegistry2((worker) => {
263791
263791
  if (worker.exited) {
263792
263792
  return;
263793
263793
  }
@@ -263796,7 +263796,7 @@ var require_thread_stream = __commonJS((exports, module) => {
263796
263796
  function createWorker(stream3, opts) {
263797
263797
  const { filename, workerData } = opts;
263798
263798
  const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
263799
- const toExecute = bundlerOverrides["thread-stream-worker"] || join136(__dirname, "lib", "worker.js");
263799
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join138(__dirname, "lib", "worker.js");
263800
263800
  const worker = new Worker(toExecute, {
263801
263801
  ...opts.workerOpts,
263802
263802
  trackUnmanagedFds: false,
@@ -263815,7 +263815,7 @@ var require_thread_stream = __commonJS((exports, module) => {
263815
263815
  worker.stream = new FakeWeakRef(stream3);
263816
263816
  worker.on("message", onWorkerMessage);
263817
263817
  worker.on("exit", onWorkerExit);
263818
- registry2.register(stream3, worker);
263818
+ registry3.register(stream3, worker);
263819
263819
  return worker;
263820
263820
  }
263821
263821
  function drain(stream3) {
@@ -263918,7 +263918,7 @@ var require_thread_stream = __commonJS((exports, module) => {
263918
263918
  if (stream3 === undefined) {
263919
263919
  return;
263920
263920
  }
263921
- registry2.unregister(stream3);
263921
+ registry3.unregister(stream3);
263922
263922
  stream3.worker.exited = true;
263923
263923
  stream3.worker.off("exit", onWorkerExit);
263924
263924
  destroy(stream3, code !== 0 ? new Error("the worker thread exited") : null);
@@ -264197,7 +264197,7 @@ var require_transport = __commonJS((exports, module) => {
264197
264197
  var __dirname = "/home/shiro/MaTrixOS/node_modules/.bun/pino@9.14.0/node_modules/pino/lib";
264198
264198
  var { createRequire: createRequire4 } = __require("module");
264199
264199
  var getCallers = require_caller();
264200
- var { join: join136, isAbsolute: isAbsolute21, sep: sep3 } = __require("path");
264200
+ var { join: join138, isAbsolute: isAbsolute21, sep: sep3 } = __require("path");
264201
264201
  var sleep3 = require_atomic_sleep();
264202
264202
  var onExit = require_on_exit_leak_free();
264203
264203
  var ThreadStream = require_thread_stream();
@@ -264260,7 +264260,7 @@ var require_transport = __commonJS((exports, module) => {
264260
264260
  throw new Error("only one of target or targets can be specified");
264261
264261
  }
264262
264262
  if (targets) {
264263
- target = bundlerOverrides["pino-worker"] || join136(__dirname, "worker.js");
264263
+ target = bundlerOverrides["pino-worker"] || join138(__dirname, "worker.js");
264264
264264
  options.targets = targets.filter((dest) => dest.target).map((dest) => {
264265
264265
  return {
264266
264266
  ...dest,
@@ -264277,7 +264277,7 @@ var require_transport = __commonJS((exports, module) => {
264277
264277
  });
264278
264278
  });
264279
264279
  } else if (pipeline3) {
264280
- target = bundlerOverrides["pino-worker"] || join136(__dirname, "worker.js");
264280
+ target = bundlerOverrides["pino-worker"] || join138(__dirname, "worker.js");
264281
264281
  options.pipelines = [pipeline3.map((dest) => {
264282
264282
  return {
264283
264283
  ...dest,
@@ -264299,7 +264299,7 @@ var require_transport = __commonJS((exports, module) => {
264299
264299
  return origin;
264300
264300
  }
264301
264301
  if (origin === "pino/file") {
264302
- return join136(__dirname, "..", "file.js");
264302
+ return join138(__dirname, "..", "file.js");
264303
264303
  }
264304
264304
  let fixTarget2;
264305
264305
  for (const filePath of callers) {
@@ -265237,7 +265237,7 @@ var require_safe_stable_stringify = __commonJS((exports, module) => {
265237
265237
  return circularValue;
265238
265238
  }
265239
265239
  let res = "";
265240
- let join136 = ",";
265240
+ let join138 = ",";
265241
265241
  const originalIndentation = indentation;
265242
265242
  if (Array.isArray(value)) {
265243
265243
  if (value.length === 0) {
@@ -265251,7 +265251,7 @@ var require_safe_stable_stringify = __commonJS((exports, module) => {
265251
265251
  indentation += spacer;
265252
265252
  res += `
265253
265253
  ${indentation}`;
265254
- join136 = `,
265254
+ join138 = `,
265255
265255
  ${indentation}`;
265256
265256
  }
265257
265257
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -265259,13 +265259,13 @@ ${indentation}`;
265259
265259
  for (;i < maximumValuesToStringify - 1; i++) {
265260
265260
  const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
265261
265261
  res += tmp2 !== undefined ? tmp2 : "null";
265262
- res += join136;
265262
+ res += join138;
265263
265263
  }
265264
265264
  const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
265265
265265
  res += tmp !== undefined ? tmp : "null";
265266
265266
  if (value.length - 1 > maximumBreadth) {
265267
265267
  const removedKeys = value.length - maximumBreadth - 1;
265268
- res += `${join136}"... ${getItemCount(removedKeys)} not stringified"`;
265268
+ res += `${join138}"... ${getItemCount(removedKeys)} not stringified"`;
265269
265269
  }
265270
265270
  if (spacer !== "") {
265271
265271
  res += `
@@ -265286,7 +265286,7 @@ ${originalIndentation}`;
265286
265286
  let separator = "";
265287
265287
  if (spacer !== "") {
265288
265288
  indentation += spacer;
265289
- join136 = `,
265289
+ join138 = `,
265290
265290
  ${indentation}`;
265291
265291
  whitespace = " ";
265292
265292
  }
@@ -265300,13 +265300,13 @@ ${indentation}`;
265300
265300
  const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
265301
265301
  if (tmp !== undefined) {
265302
265302
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
265303
- separator = join136;
265303
+ separator = join138;
265304
265304
  }
265305
265305
  }
265306
265306
  if (keyLength > maximumBreadth) {
265307
265307
  const removedKeys = keyLength - maximumBreadth;
265308
265308
  res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
265309
- separator = join136;
265309
+ separator = join138;
265310
265310
  }
265311
265311
  if (spacer !== "" && separator.length > 1) {
265312
265312
  res = `
@@ -265346,7 +265346,7 @@ ${originalIndentation}`;
265346
265346
  }
265347
265347
  const originalIndentation = indentation;
265348
265348
  let res = "";
265349
- let join136 = ",";
265349
+ let join138 = ",";
265350
265350
  if (Array.isArray(value)) {
265351
265351
  if (value.length === 0) {
265352
265352
  return "[]";
@@ -265359,7 +265359,7 @@ ${originalIndentation}`;
265359
265359
  indentation += spacer;
265360
265360
  res += `
265361
265361
  ${indentation}`;
265362
- join136 = `,
265362
+ join138 = `,
265363
265363
  ${indentation}`;
265364
265364
  }
265365
265365
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -265367,13 +265367,13 @@ ${indentation}`;
265367
265367
  for (;i < maximumValuesToStringify - 1; i++) {
265368
265368
  const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
265369
265369
  res += tmp2 !== undefined ? tmp2 : "null";
265370
- res += join136;
265370
+ res += join138;
265371
265371
  }
265372
265372
  const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
265373
265373
  res += tmp !== undefined ? tmp : "null";
265374
265374
  if (value.length - 1 > maximumBreadth) {
265375
265375
  const removedKeys = value.length - maximumBreadth - 1;
265376
- res += `${join136}"... ${getItemCount(removedKeys)} not stringified"`;
265376
+ res += `${join138}"... ${getItemCount(removedKeys)} not stringified"`;
265377
265377
  }
265378
265378
  if (spacer !== "") {
265379
265379
  res += `
@@ -265386,7 +265386,7 @@ ${originalIndentation}`;
265386
265386
  let whitespace = "";
265387
265387
  if (spacer !== "") {
265388
265388
  indentation += spacer;
265389
- join136 = `,
265389
+ join138 = `,
265390
265390
  ${indentation}`;
265391
265391
  whitespace = " ";
265392
265392
  }
@@ -265395,7 +265395,7 @@ ${indentation}`;
265395
265395
  const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
265396
265396
  if (tmp !== undefined) {
265397
265397
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
265398
- separator = join136;
265398
+ separator = join138;
265399
265399
  }
265400
265400
  }
265401
265401
  if (spacer !== "" && separator.length > 1) {
@@ -265452,20 +265452,20 @@ ${originalIndentation}`;
265452
265452
  indentation += spacer;
265453
265453
  let res2 = `
265454
265454
  ${indentation}`;
265455
- const join137 = `,
265455
+ const join139 = `,
265456
265456
  ${indentation}`;
265457
265457
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
265458
265458
  let i = 0;
265459
265459
  for (;i < maximumValuesToStringify - 1; i++) {
265460
265460
  const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
265461
265461
  res2 += tmp2 !== undefined ? tmp2 : "null";
265462
- res2 += join137;
265462
+ res2 += join139;
265463
265463
  }
265464
265464
  const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
265465
265465
  res2 += tmp !== undefined ? tmp : "null";
265466
265466
  if (value.length - 1 > maximumBreadth) {
265467
265467
  const removedKeys = value.length - maximumBreadth - 1;
265468
- res2 += `${join137}"... ${getItemCount(removedKeys)} not stringified"`;
265468
+ res2 += `${join139}"... ${getItemCount(removedKeys)} not stringified"`;
265469
265469
  }
265470
265470
  res2 += `
265471
265471
  ${originalIndentation}`;
@@ -265481,16 +265481,16 @@ ${originalIndentation}`;
265481
265481
  return '"[Object]"';
265482
265482
  }
265483
265483
  indentation += spacer;
265484
- const join136 = `,
265484
+ const join138 = `,
265485
265485
  ${indentation}`;
265486
265486
  let res = "";
265487
265487
  let separator = "";
265488
265488
  let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
265489
265489
  if (isTypedArrayWithEntries(value)) {
265490
- res += stringifyTypedArray(value, join136, maximumBreadth);
265490
+ res += stringifyTypedArray(value, join138, maximumBreadth);
265491
265491
  keys = keys.slice(value.length);
265492
265492
  maximumPropertiesToStringify -= value.length;
265493
- separator = join136;
265493
+ separator = join138;
265494
265494
  }
265495
265495
  if (deterministic) {
265496
265496
  keys = sort(keys, comparator);
@@ -265501,13 +265501,13 @@ ${indentation}`;
265501
265501
  const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
265502
265502
  if (tmp !== undefined) {
265503
265503
  res += `${separator}${strEscape(key2)}: ${tmp}`;
265504
- separator = join136;
265504
+ separator = join138;
265505
265505
  }
265506
265506
  }
265507
265507
  if (keyLength > maximumBreadth) {
265508
265508
  const removedKeys = keyLength - maximumBreadth;
265509
265509
  res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
265510
- separator = join136;
265510
+ separator = join138;
265511
265511
  }
265512
265512
  if (separator !== "") {
265513
265513
  res = `
@@ -266157,7 +266157,7 @@ var init_Defaults = __esm(() => {
266157
266157
  import { createHash as createHash13 } from "crypto";
266158
266158
  import { createWriteStream as createWriteStream2, promises as fs28 } from "fs";
266159
266159
  import { tmpdir as tmpdir9 } from "os";
266160
- import { join as join136 } from "path";
266160
+ import { join as join138 } from "path";
266161
266161
  async function uploadingNecessaryImagesOfProduct(product, waUploadToServer, timeoutMs = 30000) {
266162
266162
  product = {
266163
266163
  ...product,
@@ -266335,7 +266335,7 @@ var import_boom12, parseCatalogNode = (node) => {
266335
266335
  }
266336
266336
  const { stream: stream3 } = await getStream(img);
266337
266337
  const hasher = createHash13("sha256");
266338
- const filePath = join136(tmpdir9(), "img" + generateMessageIDV2());
266338
+ const filePath = join138(tmpdir9(), "img" + generateMessageIDV2());
266339
266339
  const encFileWriteStream = createWriteStream2(filePath);
266340
266340
  for await (const block2 of stream3) {
266341
266341
  hasher.update(block2);
@@ -297183,18 +297183,18 @@ var init_merge = __esm(() => {
297183
297183
  });
297184
297184
 
297185
297185
  // packages/omo-config-core/src/loader/types.ts
297186
- import { existsSync as existsSync113, lstatSync as lstatSync5, readFileSync as readFileSync77 } from "fs";
297186
+ import { existsSync as existsSync114, lstatSync as lstatSync5, readFileSync as readFileSync77 } from "fs";
297187
297187
  var DEFAULT_READ_FILE_SYSTEM;
297188
297188
  var init_types7 = __esm(() => {
297189
297189
  DEFAULT_READ_FILE_SYSTEM = {
297190
- existsSync: existsSync113,
297190
+ existsSync: existsSync114,
297191
297191
  lstatSync: lstatSync5,
297192
297192
  readFileSync: readFileSync77
297193
297193
  };
297194
297194
  });
297195
297195
 
297196
297196
  // packages/omo-config-core/src/loader/paths.ts
297197
- import { dirname as dirname45, isAbsolute as isAbsolute21, join as join137, relative as relative15, resolve as resolve42 } from "path";
297197
+ import { dirname as dirname45, isAbsolute as isAbsolute21, join as join139, relative as relative15, resolve as resolve42 } from "path";
297198
297198
  function containsPath2(parent, child) {
297199
297199
  const pathToChild = relative15(parent, child);
297200
297200
  return pathToChild === "" || !pathToChild.startsWith("..") && !isAbsolute21(pathToChild);
@@ -297203,23 +297203,23 @@ function resolveHomeDir(env2 = process.env) {
297203
297203
  return resolve42(env2.HOME ?? env2.USERPROFILE ?? process.cwd());
297204
297204
  }
297205
297205
  function resolveUserMatrixosConfigPath(env2 = process.env, platform4 = process.platform) {
297206
- return join137(resolveUserMatrixosConfigDirectory(env2, platform4), "omo.jsonc");
297206
+ return join139(resolveUserMatrixosConfigDirectory(env2, platform4), "omo.jsonc");
297207
297207
  }
297208
297208
  function resolveUserMatrixosConfigDirectory(env2 = process.env, platform4 = process.platform) {
297209
297209
  if (platform4 === "win32" && env2.APPDATA !== undefined && env2.APPDATA.length > 0) {
297210
- return join137(env2.APPDATA, "omo");
297210
+ return join139(env2.APPDATA, "omo");
297211
297211
  }
297212
297212
  if (env2.XDG_CONFIG_HOME !== undefined && env2.XDG_CONFIG_HOME.length > 0) {
297213
- return join137(env2.XDG_CONFIG_HOME, "omo");
297213
+ return join139(env2.XDG_CONFIG_HOME, "omo");
297214
297214
  }
297215
- return join137(resolveHomeDir(env2), ".config", "omo");
297215
+ return join139(resolveHomeDir(env2), ".config", "omo");
297216
297216
  }
297217
297217
  function detectUserOmoJsonPath(env2, platform4, fileSystem) {
297218
297218
  const configDir = resolveUserMatrixosConfigDirectory(env2, platform4);
297219
- const jsoncPath = join137(configDir, "omo.jsonc");
297219
+ const jsoncPath = join139(configDir, "omo.jsonc");
297220
297220
  if (fileSystem.existsSync(jsoncPath))
297221
297221
  return jsoncPath;
297222
- const jsonPath = join137(configDir, "omo.json");
297222
+ const jsonPath = join139(configDir, "omo.json");
297223
297223
  return fileSystem.existsSync(jsonPath) ? jsonPath : jsoncPath;
297224
297224
  }
297225
297225
  function isSymlinkedProjectPath(path28, fileSystem) {
@@ -297237,13 +297237,13 @@ function isLoadableProjectConfigFile(path28, fileSystem) {
297237
297237
  return fileSystem.existsSync(path28) && !isSymlinkedProjectPath(path28, fileSystem);
297238
297238
  }
297239
297239
  function detectOmoJsonPath(dir2, fileSystem) {
297240
- const omoDir = join137(dir2, ".omo");
297240
+ const omoDir = join139(dir2, ".omo");
297241
297241
  if (isSymlinkedProjectPath(omoDir, fileSystem))
297242
297242
  return null;
297243
- const jsoncPath = join137(omoDir, "omo.jsonc");
297243
+ const jsoncPath = join139(omoDir, "omo.jsonc");
297244
297244
  if (isLoadableProjectConfigFile(jsoncPath, fileSystem))
297245
297245
  return jsoncPath;
297246
- const jsonPath = join137(omoDir, "omo.json");
297246
+ const jsonPath = join139(omoDir, "omo.json");
297247
297247
  return isLoadableProjectConfigFile(jsonPath, fileSystem) ? jsonPath : null;
297248
297248
  }
297249
297249
  function findProjectConfigPathsFarthestFirst(cwd, homeDir, fileSystem) {
@@ -297388,10 +297388,10 @@ var init_loader2 = __esm(() => {
297388
297388
 
297389
297389
  // packages/omo-config-core/src/loader/profile-resolution.ts
297390
297390
  function registryLookup(config3, name) {
297391
- const registry2 = config3.profileRegistry;
297392
- if (!registry2)
297391
+ const registry3 = config3.profileRegistry;
297392
+ if (!registry3)
297393
297393
  return;
297394
- const found = registry2.profiles[name];
297394
+ const found = registry3.profiles[name];
297395
297395
  if (!found)
297396
297396
  return;
297397
297397
  const parsed = ProfileSchema.safeParse(found);
@@ -297504,9 +297504,9 @@ var init_loader3 = __esm(() => {
297504
297504
  // packages/omo-config-core/src/writer/types.ts
297505
297505
  import {
297506
297506
  copyFileSync as copyFileSync3,
297507
- existsSync as existsSync114,
297507
+ existsSync as existsSync115,
297508
297508
  lstatSync as lstatSync6,
297509
- mkdirSync as mkdirSync24,
297509
+ mkdirSync as mkdirSync25,
297510
297510
  readFileSync as readFileSync78,
297511
297511
  readdirSync as readdirSync29,
297512
297512
  renameSync as renameSync10,
@@ -297517,9 +297517,9 @@ var DEFAULT_WRITE_FILE_SYSTEM, MatrixosConfigWriteError;
297517
297517
  var init_types8 = __esm(() => {
297518
297518
  DEFAULT_WRITE_FILE_SYSTEM = {
297519
297519
  copyFileSync: copyFileSync3,
297520
- existsSync: existsSync114,
297520
+ existsSync: existsSync115,
297521
297521
  lstatSync: lstatSync6,
297522
- mkdirSync: mkdirSync24,
297522
+ mkdirSync: mkdirSync25,
297523
297523
  readFileSync: readFileSync78,
297524
297524
  readdirSync: readdirSync29,
297525
297525
  renameSync: renameSync10,
@@ -297544,7 +297544,7 @@ var init_types8 = __esm(() => {
297544
297544
 
297545
297545
  // packages/omo-config-core/src/writer/writer.ts
297546
297546
  import { randomUUID as randomUUID13 } from "crypto";
297547
- import { dirname as dirname46, join as join138 } from "path";
297547
+ import { dirname as dirname46, join as join140 } from "path";
297548
297548
  function backupSuffix() {
297549
297549
  return new Date().toISOString().replace(/[:.]/g, "-");
297550
297550
  }
@@ -297575,13 +297575,13 @@ function resolveWritePath(options) {
297575
297575
  const jsoncPath2 = resolveUserMatrixosConfigPath(options.env, options.platform ?? process.platform);
297576
297576
  if (fileSystem.existsSync(jsoncPath2))
297577
297577
  return jsoncPath2;
297578
- const jsonPath2 = join138(dirname46(jsoncPath2), "omo.json");
297578
+ const jsonPath2 = join140(dirname46(jsoncPath2), "omo.json");
297579
297579
  return fileSystem.existsSync(jsonPath2) ? jsonPath2 : jsoncPath2;
297580
297580
  }
297581
- const jsoncPath = join138(options.projectDir ?? process.cwd(), ".omo", "omo.jsonc");
297581
+ const jsoncPath = join140(options.projectDir ?? process.cwd(), ".omo", "omo.jsonc");
297582
297582
  if (fileSystem.existsSync(jsoncPath))
297583
297583
  return jsoncPath;
297584
- const jsonPath = join138(dirname46(jsoncPath), "omo.json");
297584
+ const jsonPath = join140(dirname46(jsoncPath), "omo.json");
297585
297585
  return fileSystem.existsSync(jsonPath) ? jsonPath : jsoncPath;
297586
297586
  }
297587
297587
  function writeAtomically(path28, content, fileSystem) {
@@ -297693,8 +297693,8 @@ var init_writer2 = __esm(() => {
297693
297693
  });
297694
297694
 
297695
297695
  // packages/omo-config-core/src/generator/mini-os-generator.ts
297696
- import { existsSync as existsSync115, mkdirSync as mkdirSync25, writeFileSync as writeFileSync26 } from "fs";
297697
- import { dirname as dirname47, join as join139 } from "path";
297696
+ import { existsSync as existsSync116, mkdirSync as mkdirSync26, writeFileSync as writeFileSync26 } from "fs";
297697
+ import { dirname as dirname47, join as join141 } from "path";
297698
297698
  function generateMiniOS(options) {
297699
297699
  const fs29 = options.fs ?? defaultFS;
297700
297700
  const profile3 = options.profile;
@@ -297705,29 +297705,29 @@ function generateMiniOS(options) {
297705
297705
  if (!fs29.existsSync(targetDir)) {
297706
297706
  fs29.mkdirSync(targetDir, { recursive: true });
297707
297707
  }
297708
- const pkgPath = join139(targetDir, "package.json");
297708
+ const pkgPath = join141(targetDir, "package.json");
297709
297709
  writeIfMissing(fs29, pkgPath, TPL_PACKAGE_JSON(packageName, displayName, profile3.version, profile3.description, profile3.extends, profile3.baseAgent));
297710
297710
  filesWritten.push(pkgPath);
297711
- const srcDir = join139(targetDir, "src");
297711
+ const srcDir = join141(targetDir, "src");
297712
297712
  fs29.mkdirSync(srcDir, { recursive: true });
297713
- const indexPath = join139(srcDir, "index.ts");
297713
+ const indexPath = join141(srcDir, "index.ts");
297714
297714
  writeIfMissing(fs29, indexPath, TPL_INDEX_TS(profile3.name, displayName, profile3.description));
297715
297715
  filesWritten.push(indexPath);
297716
- const binDir = join139(targetDir, "bin");
297716
+ const binDir = join141(targetDir, "bin");
297717
297717
  fs29.mkdirSync(binDir, { recursive: true });
297718
- const binPath = join139(binDir, "matrixos-mini.js");
297718
+ const binPath = join141(binDir, "matrixos-mini.js");
297719
297719
  writeIfMissing(fs29, binPath, TPL_BIN);
297720
297720
  filesWritten.push(binPath);
297721
- const scriptDir = join139(targetDir, "script");
297721
+ const scriptDir = join141(targetDir, "script");
297722
297722
  fs29.mkdirSync(scriptDir, { recursive: true });
297723
- const buildPath = join139(scriptDir, "build.ts");
297723
+ const buildPath = join141(scriptDir, "build.ts");
297724
297724
  writeIfMissing(fs29, buildPath, TPL_BUILD_TS);
297725
297725
  filesWritten.push(buildPath);
297726
297726
  if (Object.keys(profile3.agents).length > 0) {
297727
- const agentsDir = join139(targetDir, "agents");
297727
+ const agentsDir = join141(targetDir, "agents");
297728
297728
  fs29.mkdirSync(agentsDir, { recursive: true });
297729
297729
  for (const [agentName, agentDef] of Object.entries(profile3.agents)) {
297730
- const agentFile = join139(agentsDir, `${agentName}.ts`);
297730
+ const agentFile = join141(agentsDir, `${agentName}.ts`);
297731
297731
  const description2 = agentDef.description ?? `Custom ${displayName} agent: ${agentName}`;
297732
297732
  writeIfMissing(fs29, agentFile, `// ${description2}
297733
297733
  // Generated by MaTrixOS Mini-OS Profile Generator.
@@ -297738,10 +297738,10 @@ export const description = ${JSON.stringify(description2)}
297738
297738
  }
297739
297739
  }
297740
297740
  if (profile3.skills.length > 0) {
297741
- const skillsDir = join139(targetDir, "skills");
297741
+ const skillsDir = join141(targetDir, "skills");
297742
297742
  fs29.mkdirSync(skillsDir, { recursive: true });
297743
297743
  for (const skill2 of profile3.skills) {
297744
- const skillFile = join139(skillsDir, `${skill2}.md`);
297744
+ const skillFile = join141(skillsDir, `${skill2}.md`);
297745
297745
  writeIfMissing(fs29, skillFile, `# ${skill2}
297746
297746
 
297747
297747
  _Skill required by the ${displayName} profile. Implementation goes here._
@@ -297749,12 +297749,12 @@ _Skill required by the ${displayName} profile. Implementation goes here._
297749
297749
  filesWritten.push(skillFile);
297750
297750
  }
297751
297751
  }
297752
- const readmePath = join139(targetDir, "README.md");
297752
+ const readmePath = join141(targetDir, "README.md");
297753
297753
  const agentsList = Object.keys(profile3.agents);
297754
297754
  const skillsList = profile3.skills;
297755
297755
  writeIfMissing(fs29, readmePath, TPL_README(packageName, displayName, profile3.description, profile3.version, profile3.baseAgent, profile3.extends, agentsList, skillsList));
297756
297756
  filesWritten.push(readmePath);
297757
- const agentsMdPath = join139(targetDir, "AGENTS.md");
297757
+ const agentsMdPath = join141(targetDir, "AGENTS.md");
297758
297758
  writeIfMissing(fs29, agentsMdPath, TPL_AGENT_MD(displayName, profile3.description));
297759
297759
  filesWritten.push(agentsMdPath);
297760
297760
  return { packageName, packageDir: targetDir, filesWritten };
@@ -297906,7 +297906,7 @@ This profile is activated when the user mentions the profile name in their reque
297906
297906
  - Profiles can be composed: multiple profiles in \`profiles: [...]\` are merged in order.
297907
297907
  `;
297908
297908
  var init_mini_os_generator = __esm(() => {
297909
- defaultFS = { existsSync: existsSync115, mkdirSync: mkdirSync25, writeFileSync: writeFileSync26 };
297909
+ defaultFS = { existsSync: existsSync116, mkdirSync: mkdirSync26, writeFileSync: writeFileSync26 };
297910
297910
  });
297911
297911
 
297912
297912
  // packages/omo-config-core/src/generator/index.ts
@@ -367932,7 +367932,7 @@ function getCachedVersion(options = {}) {
367932
367932
  // package.json
367933
367933
  var package_default = {
367934
367934
  name: "@kl-c/matrixos",
367935
- version: "0.1.6",
367935
+ version: "0.1.9",
367936
367936
  description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
367937
367937
  main: "./dist/index.js",
367938
367938
  types: "dist/index.d.ts",
@@ -368012,6 +368012,7 @@ var package_default = {
368012
368012
  scripts: {
368013
368013
  build: "bun run script/build.ts",
368014
368014
  "build:cli-node": "bun run script/build-cli-node.ts",
368015
+ "build:dashboard-frontend": "rm -rf dist/features/dashboard/frontend && mkdir -p dist/features/dashboard/frontend && cp -R packages/omo-opencode/src/features/dashboard/frontend/. dist/features/dashboard/frontend/",
368015
368016
  "build:shared-skills-assets": "rm -rf dist/skills && cp -R packages/shared-skills/skills dist/skills && mkdir -p dist/cli && rm -rf dist/cli/skills && cp -R packages/shared-skills/skills dist/cli/skills",
368016
368017
  "build:lsp-tools-mcp": "npm --prefix packages/lsp-tools-mcp ci && npm --prefix packages/lsp-tools-mcp run build",
368017
368018
  "build:lsp-daemon": "npm --prefix packages/lsp-daemon ci && npm --prefix packages/lsp-daemon run build",
@@ -441310,12 +441311,34 @@ function createPluginInterface(args) {
441310
441311
  }
441311
441312
 
441312
441313
  // packages/omo-opencode/src/hooks/agent-anti-loop/hook.ts
441314
+ function signaturesSimilar(a, b) {
441315
+ if (a === b)
441316
+ return true;
441317
+ const aTool = a.split(":")[0] ?? "";
441318
+ const bTool = b.split(":")[0] ?? "";
441319
+ if (aTool !== bTool)
441320
+ return false;
441321
+ return true;
441322
+ }
441323
+ var AVOIDANCE_PATTERNS = [
441324
+ /\btry\s+(again|a different|another)\b/i,
441325
+ /\bI'?ll\s+(try|attempt|give\s+it\s+another)\b/i,
441326
+ /\blet\s+me\s+try\s+again\b/i,
441327
+ /\bI\s+apologize\b.*\btry\b/i
441328
+ ];
441313
441329
  function createAgentAntiLoopHooks(config) {
441314
441330
  const state3 = {
441315
441331
  consecutiveBySignature: new Map,
441332
+ recentSignatures: [],
441316
441333
  lastMeaningfulToolAt: Date.now(),
441317
441334
  nudged: false,
441318
- fallbackTriggered: false
441335
+ fallbackTriggered: false,
441336
+ avoidanceCount: 0,
441337
+ avoidanceEscalated: false,
441338
+ hookExecutionTimestamps: [],
441339
+ hookRecursionBreachedAt: 0,
441340
+ contextTokens: 0,
441341
+ contextBloatBreachedAt: 0
441319
441342
  };
441320
441343
  function makeSignature(tool3, args) {
441321
441344
  try {
@@ -441341,6 +441364,7 @@ function createAgentAntiLoopHooks(config) {
441341
441364
  const prev = state3.consecutiveBySignature.get(sig) ?? 0;
441342
441365
  const count = prev + 1;
441343
441366
  state3.consecutiveBySignature.set(sig, count);
441367
+ state3.recentSignatures.push(sig);
441344
441368
  if (isMeaningfulOutput(output)) {
441345
441369
  state3.lastMeaningfulToolAt = now;
441346
441370
  state3.nudged = false;
@@ -441349,29 +441373,97 @@ function createAgentAntiLoopHooks(config) {
441349
441373
  if (count >= config.doomLoopThreshold) {
441350
441374
  state3.consecutiveBySignature.set(sig, 0);
441351
441375
  }
441376
+ const similarCount = state3.recentSignatures.filter((s) => signaturesSimilar(s, sig)).length;
441377
+ if (similarCount >= config.softDoomLoopThreshold) {
441378
+ state3.consecutiveBySignature.set(sig, 0);
441379
+ }
441380
+ },
441381
+ onAgentMessage(content) {
441382
+ const isAvoidance = AVOIDANCE_PATTERNS.some((p) => p.test(content));
441383
+ if (isAvoidance) {
441384
+ state3.avoidanceCount += 1;
441385
+ } else {
441386
+ state3.avoidanceCount = 0;
441387
+ }
441352
441388
  },
441353
441389
  checkStuck() {
441354
441390
  const now = Date.now();
441355
441391
  const elapsed = now - state3.lastMeaningfulToolAt;
441356
- const secondsSinceLastMeaningful = Math.floor(elapsed / 1000);
441357
- const stuck = secondsSinceLastMeaningful >= config.stuckTimeoutSec;
441358
- return { stuck, secondsSinceLastMeaningful };
441392
+ return { stuck: elapsed >= config.stuckTimeoutSec * 1000, secondsSinceLastMeaningful: Math.floor(elapsed / 1000) };
441393
+ },
441394
+ onHookExecute() {
441395
+ const now = Date.now();
441396
+ state3.hookExecutionTimestamps.push(now);
441397
+ const windowStart = now - config.hookRecursionWindowMs;
441398
+ state3.hookExecutionTimestamps = state3.hookExecutionTimestamps.filter((t2) => t2 >= windowStart);
441399
+ },
441400
+ isHookRecursion() {
441401
+ return state3.hookExecutionTimestamps.length >= config.hookRecursionThreshold;
441402
+ },
441403
+ onContextUpdate(tokens) {
441404
+ state3.contextTokens = tokens;
441405
+ },
441406
+ isContextBloat() {
441407
+ const now = Date.now();
441408
+ const elapsedSinceMeaningful = now - state3.lastMeaningfulToolAt;
441409
+ const bloated = state3.contextTokens >= config.contextBloatMaxTokens;
441410
+ const stale = elapsedSinceMeaningful >= config.contextBloatStuckSec * 1000;
441411
+ return bloated && stale;
441359
441412
  },
441360
441413
  reset() {
441361
441414
  state3.consecutiveBySignature.clear();
441415
+ state3.recentSignatures = [];
441362
441416
  state3.lastMeaningfulToolAt = Date.now();
441363
441417
  state3.nudged = false;
441364
441418
  state3.fallbackTriggered = false;
441419
+ state3.avoidanceCount = 0;
441420
+ state3.avoidanceEscalated = false;
441421
+ state3.hookExecutionTimestamps = [];
441422
+ state3.hookRecursionBreachedAt = 0;
441423
+ state3.contextTokens = 0;
441424
+ state3.contextBloatBreachedAt = 0;
441365
441425
  },
441366
441426
  getState() {
441367
- return { ...state3, consecutiveBySignature: new Map(state3.consecutiveBySignature) };
441427
+ return { ...state3, consecutiveBySignature: new Map(state3.consecutiveBySignature), recentSignatures: [...state3.recentSignatures] };
441368
441428
  }
441369
441429
  };
441370
441430
  }
441371
441431
 
441432
+ // packages/omo-opencode/src/features/anti-loop/logger.ts
441433
+ import { existsSync as existsSync112, mkdirSync as mkdirSync24, appendFileSync as appendFileSync8 } from "fs";
441434
+ import { join as join134 } from "path";
441435
+ function createAntiLoopLogger(logsDir) {
441436
+ const logFile = join134(logsDir, "anti-loop.jsonl");
441437
+ const parentDir = join134(logsDir, "..");
441438
+ if (!existsSync112(logsDir)) {
441439
+ mkdirSync24(logsDir, { recursive: true });
441440
+ }
441441
+ return {
441442
+ log(event) {
441443
+ const entry = {
441444
+ ...event,
441445
+ timestamp: new Date().toISOString()
441446
+ };
441447
+ try {
441448
+ appendFileSync8(logFile, JSON.stringify(entry) + `
441449
+ `, "utf-8");
441450
+ } catch {}
441451
+ }
441452
+ };
441453
+ }
441454
+
441455
+ // packages/omo-opencode/src/features/anti-loop/background-registry.ts
441456
+ var registry2 = new Map;
441457
+ function getRunningTasks() {
441458
+ return [...registry2.values()].filter((r) => r.status === "running");
441459
+ }
441460
+
441372
441461
  // packages/omo-opencode/src/plugin/agent-anti-loop.ts
441462
+ import { join as join135 } from "path";
441373
441463
  function createAgentAntiLoopWiring(config, deps) {
441374
441464
  const hooks = createAgentAntiLoopHooks(config);
441465
+ const logDir = deps.projectDir ? join135(deps.projectDir, ".matrixos", "logs") : process.cwd();
441466
+ const antiLoopLog = createAntiLoopLogger(logDir);
441375
441467
  return {
441376
441468
  toolExecuteAfter(input) {
441377
441469
  hooks.onToolAfter(input.tool, input.args, input.output);
@@ -441379,29 +441471,95 @@ function createAgentAntiLoopWiring(config, deps) {
441379
441471
  const sig = `${input.tool}:${JSON.stringify(input.args)}`;
441380
441472
  const count = state3.consecutiveBySignature.get(sig) ?? 0;
441381
441473
  if (count === 0 && state3.consecutiveBySignature.has(sig)) {
441382
- deps.log("[agent-anti-loop] doom loop detected", {
441383
- tool: input.tool,
441384
- threshold: config.doomLoopThreshold
441385
- });
441474
+ deps.log("[agent-anti-loop] doom loop detected", { tool: input.tool, threshold: config.doomLoopThreshold });
441475
+ antiLoopLog.log({ sessionId: process.env.OMO_SESSION_ID, pattern: "doom_loop", toolName: input.tool, detail: `${input.tool} called >=${config.doomLoopThreshold}x identical`, actionTaken: "counter_reset" });
441476
+ if (deps.injectNudge) {
441477
+ deps.injectNudge(`Watchdog: tool ${input.tool} repeated without progress. Try a different approach.`);
441478
+ }
441479
+ }
441480
+ const similarCount = state3.recentSignatures.filter((s) => s.startsWith(input.tool + ":")).length;
441481
+ if (similarCount >= config.softDoomLoopThreshold) {
441482
+ deps.log("[agent-anti-loop] soft doom loop warning", { tool: input.tool, similarCalls: similarCount });
441483
+ antiLoopLog.log({ sessionId: process.env.OMO_SESSION_ID, pattern: "soft_doom_loop", toolName: input.tool, detail: `${input.tool} called ${similarCount}x with similar args`, actionTaken: "warning" });
441484
+ }
441485
+ },
441486
+ onAgentMessage(content) {
441487
+ hooks.onAgentMessage(content);
441488
+ const state3 = hooks.getState();
441489
+ if (state3.avoidanceCount >= 3 && !state3.avoidanceEscalated) {
441490
+ deps.log("[agent-anti-loop] agent avoidance detected", { avoidanceCount: state3.avoidanceCount });
441491
+ antiLoopLog.log({ sessionId: process.env.OMO_SESSION_ID, pattern: "agent_avoidance", detail: `"I'll try again" pattern ${state3.avoidanceCount}x`, actionTaken: "nudge" });
441386
441492
  if (deps.injectNudge) {
441387
- deps.injectNudge(`\u26A0\uFE0F You appear to be repeating the same tool (${input.tool}) without progress. Try a different approach.`);
441493
+ deps.injectNudge("You appear stuck in a loop. Stop and analyze what went wrong before trying again.");
441388
441494
  }
441495
+ state3.avoidanceEscalated = true;
441389
441496
  }
441390
441497
  },
441391
441498
  async sessionIdle() {
441392
441499
  const { stuck, secondsSinceLastMeaningful } = hooks.checkStuck();
441393
441500
  if (!stuck)
441394
441501
  return;
441395
- deps.log("[agent-anti-loop] stuck detected", {
441396
- secondsSinceLastMeaningful,
441397
- recoveryStrategy: config.recoveryStrategy
441398
- });
441502
+ deps.log("[agent-anti-loop] stuck detected", { secondsSinceLastMeaningful, recoveryStrategy: config.recoveryStrategy });
441503
+ antiLoopLog.log({ sessionId: process.env.OMO_SESSION_ID, pattern: "stuck", detail: `No progress for ${secondsSinceLastMeaningful}s`, actionTaken: config.recoveryStrategy });
441399
441504
  if (config.recoveryStrategy === "nudge" && deps.injectNudge) {
441400
- deps.injectNudge(`\u26A0\uFE0F No meaningful progress for ${secondsSinceLastMeaningful}s. Try a different approach or ask for help.`);
441505
+ deps.injectNudge(`Watchdog: no progress for ${secondsSinceLastMeaningful}s. Try a different approach.`);
441506
+ }
441507
+ const running = getRunningTasks();
441508
+ if (running.length > 0) {
441509
+ const ids = running.map((r) => r.taskId).join(", ");
441510
+ deps.log("[agent-anti-loop] zombie session detected", { runningTasks: ids });
441511
+ antiLoopLog.log({ sessionId: process.env.OMO_SESSION_ID, pattern: "zombie_session", detail: `Session idle but ${running.length} background task(s) running: ${ids}`, actionTaken: config.recoveryStrategy });
441512
+ if (deps.injectNudge) {
441513
+ deps.injectNudge(`Watchdog: session idle but background task(s) still running (${ids}). Check for orphaned work.`);
441514
+ }
441401
441515
  }
441402
441516
  },
441403
441517
  sessionCreated() {
441404
441518
  hooks.reset();
441519
+ },
441520
+ onHookExecute() {
441521
+ hooks.onHookExecute();
441522
+ if (hooks.isHookRecursion()) {
441523
+ const now = Date.now();
441524
+ const state3 = hooks.getState();
441525
+ if (now - state3.hookRecursionBreachedAt > config.hookRecursionWindowMs) {
441526
+ state3.hookRecursionBreachedAt = now;
441527
+ deps.log("[agent-anti-loop] hook recursion detected", { count: state3.hookExecutionTimestamps.length, windowMs: config.hookRecursionWindowMs });
441528
+ antiLoopLog.log({ sessionId: process.env.OMO_SESSION_ID, pattern: "hook_recursion", detail: `${state3.hookExecutionTimestamps.length} hook executions within ${config.hookRecursionWindowMs}ms`, actionTaken: config.recoveryStrategy });
441529
+ if (deps.injectNudge) {
441530
+ deps.injectNudge("Watchdog: hook recursion detected. A hook is re-triggering itself in a loop.");
441531
+ }
441532
+ }
441533
+ }
441534
+ },
441535
+ onContextUpdate(tokens) {
441536
+ hooks.onContextUpdate(tokens);
441537
+ if (hooks.isContextBloat()) {
441538
+ const now = Date.now();
441539
+ const state3 = hooks.getState();
441540
+ if (now - state3.contextBloatBreachedAt > config.contextBloatStuckSec * 1000) {
441541
+ state3.contextBloatBreachedAt = now;
441542
+ deps.log("[agent-anti-loop] context bloat detected", { tokens, threshold: config.contextBloatMaxTokens });
441543
+ antiLoopLog.log({ sessionId: process.env.OMO_SESSION_ID, pattern: "context_bloat", detail: `Context ${tokens} tokens >= ${config.contextBloatMaxTokens} with no progress for ${config.contextBloatStuckSec}s`, actionTaken: config.recoveryStrategy });
441544
+ if (deps.injectNudge) {
441545
+ deps.injectNudge(`Watchdog: context bloat (${tokens} tokens) without progress. Consider compacting or clearing context.`);
441546
+ }
441547
+ }
441548
+ }
441549
+ },
441550
+ backgroundTaskCheck() {
441551
+ const running = getRunningTasks();
441552
+ const now = Date.now();
441553
+ for (const task of running) {
441554
+ const ageMs = now - task.startedAt;
441555
+ if (ageMs >= config.runawayTaskTimeoutSec * 1000) {
441556
+ deps.log("[agent-anti-loop] runaway task detected", { taskId: task.taskId, ageSec: Math.floor(ageMs / 1000) });
441557
+ antiLoopLog.log({ sessionId: process.env.OMO_SESSION_ID, pattern: "runaway_task", toolName: task.taskId, detail: `Background task running ${Math.floor(ageMs / 1000)}s >= ${config.runawayTaskTimeoutSec}s`, actionTaken: config.recoveryStrategy });
441558
+ if (deps.injectNudge) {
441559
+ deps.injectNudge(`Watchdog: background task ${task.taskId} has been running ${Math.floor(ageMs / 1000)}s without completing.`);
441560
+ }
441561
+ }
441562
+ }
441405
441563
  }
441406
441564
  };
441407
441565
  }
@@ -442694,6 +442852,13 @@ class MatrixGateway {
442694
442852
  async stop() {
442695
442853
  await Promise.all(Array.from(this.adapters.values()).map((a) => a.disconnect()));
442696
442854
  }
442855
+ async send(env2) {
442856
+ const adapter = this.adapters.get(env2.channel);
442857
+ if (!adapter) {
442858
+ throw new Error(`no adapter registered for channel "${env2.channel}"`);
442859
+ }
442860
+ return adapter.send(env2);
442861
+ }
442697
442862
  async handleInbound(env2) {
442698
442863
  if (this.seenIds.has(env2.id)) {
442699
442864
  return;
@@ -443391,9 +443556,16 @@ import * as z54 from "zod";
443391
443556
  var WatchdogConfigSchema = z54.object({
443392
443557
  enabled: z54.boolean().default(true),
443393
443558
  doomLoopThreshold: z54.number().int().positive().max(20).default(3),
443559
+ softDoomLoopThreshold: z54.number().int().positive().max(20).default(5),
443394
443560
  stuckTimeoutSec: z54.number().int().positive().max(600).default(90),
443395
443561
  auditLogPath: z54.string().optional(),
443396
443562
  recoveryStrategy: z54.enum(["nudge", "fallback", "restart", "notify", "safe"]).default("nudge"),
443563
+ hookRecursionWindowMs: z54.number().int().positive().max(60000).default(5000),
443564
+ hookRecursionThreshold: z54.number().int().positive().max(100).default(10),
443565
+ contextBloatMaxTokens: z54.number().int().positive().default(200000),
443566
+ contextBloatStuckSec: z54.number().int().positive().max(600).default(120),
443567
+ zombieSessionIdleSec: z54.number().int().positive().max(600).default(90),
443568
+ runawayTaskTimeoutSec: z54.number().int().positive().max(86400).default(600),
443397
443569
  heartbeatIntervalSec: z54.number().positive().max(300).default(30),
443398
443570
  heartbeatFilePath: z54.string().default(".matrixos/tmp/heartbeat"),
443399
443571
  fatalMarkerPath: z54.string().default(".matrixos/tmp/watchdog-fatal.json"),
@@ -444168,22 +444340,22 @@ init_plugin_identity();
444168
444340
  // packages/telemetry-core/src/activity-state.ts
444169
444341
  init_atomic_write();
444170
444342
  init_xdg_data_dir();
444171
- import { existsSync as existsSync118, mkdirSync as mkdirSync26, readFileSync as readFileSync80 } from "fs";
444172
- import { basename as basename26, join as join141 } from "path";
444343
+ import { existsSync as existsSync119, mkdirSync as mkdirSync27, readFileSync as readFileSync80 } from "fs";
444344
+ import { basename as basename26, join as join143 } from "path";
444173
444345
  var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
444174
444346
  function resolveTelemetryStateDir(product, options = {}) {
444175
444347
  const dataDir = resolveXdgDataDir(product.cacheDirName, {
444176
444348
  env: options.env,
444177
444349
  osProvider: options.osProvider
444178
444350
  });
444179
- const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join141(options.env.XDG_DATA_HOME, product.cacheDirName);
444351
+ const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join143(options.env.XDG_DATA_HOME, product.cacheDirName);
444180
444352
  if (dataDir === xdgStateDir || xdgStateDir === undefined && basename26(dataDir) === product.cacheDirName) {
444181
444353
  return dataDir;
444182
444354
  }
444183
- return join141(dataDir, product.cacheDirName);
444355
+ return join143(dataDir, product.cacheDirName);
444184
444356
  }
444185
444357
  function getTelemetryActivityStateFilePath(stateDir) {
444186
- return join141(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
444358
+ return join143(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
444187
444359
  }
444188
444360
  function getDailyActiveCaptureState(input2) {
444189
444361
  const state3 = readPostHogActivityState(input2.stateDir, input2.diagnostics);
@@ -444208,7 +444380,7 @@ function isPostHogActivityState(value) {
444208
444380
  }
444209
444381
  function readPostHogActivityState(stateDir, diagnostics) {
444210
444382
  const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
444211
- if (!existsSync118(stateFilePath)) {
444383
+ if (!existsSync119(stateFilePath)) {
444212
444384
  return {};
444213
444385
  }
444214
444386
  try {
@@ -444231,7 +444403,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
444231
444403
  function writePostHogActivityState(stateDir, nextState, diagnostics) {
444232
444404
  const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
444233
444405
  try {
444234
- mkdirSync26(stateDir, { recursive: true });
444406
+ mkdirSync27(stateDir, { recursive: true });
444235
444407
  writeFileAtomically(stateFilePath, `${JSON.stringify(nextState, null, 2)}
444236
444408
  `);
444237
444409
  } catch (error) {
@@ -450967,6 +451139,78 @@ function recordPluginTelemetry(input2) {
450967
451139
  posthog.shutdown();
450968
451140
  }
450969
451141
 
451142
+ // packages/omo-opencode/src/testing/create-gateway-relay.ts
451143
+ function createGatewayRelayHandler(deps) {
451144
+ const { input: input2, gateway, log: log8 } = deps;
451145
+ return async (env2) => {
451146
+ const inboundText = env2.content.text;
451147
+ if (!inboundText) {
451148
+ log8("[gateway] ignoring non-text inbound message", { channel: env2.channel });
451149
+ return;
451150
+ }
451151
+ log8("[gateway] inbound message \u2192 relaying to Morpheus", {
451152
+ channel: env2.channel,
451153
+ from: env2.sender.id,
451154
+ text: inboundText.slice(0, 200)
451155
+ });
451156
+ try {
451157
+ const createResult = await input2.client.session.create({
451158
+ body: {
451159
+ title: `Gateway relay (${env2.channel})`,
451160
+ parentID: undefined
451161
+ }
451162
+ });
451163
+ const sessionID = createResult.data?.id;
451164
+ if (!sessionID)
451165
+ throw new Error("session create returned no id");
451166
+ await input2.client.session.prompt({
451167
+ path: { id: sessionID },
451168
+ body: {
451169
+ agent: "morpheus",
451170
+ parts: [{ type: "text", text: inboundText }]
451171
+ },
451172
+ query: { directory: input2.directory }
451173
+ });
451174
+ await waitForCompletion(sessionID, { sessionID, messageID: "", agent: "morpheus", abort: new AbortController().signal }, input2);
451175
+ const reply = await processMessages(sessionID, input2);
451176
+ await gateway.send({
451177
+ id: makeEnvelopeId(env2.channel, env2.metadata.providerMessageId),
451178
+ channel: env2.channel,
451179
+ direction: "outbound",
451180
+ timestamp: new Date().toISOString(),
451181
+ sender: env2.sender,
451182
+ recipient: { id: env2.sender.id },
451183
+ content: { type: "text", text: reply },
451184
+ metadata: {
451185
+ providerMessageId: env2.metadata.providerMessageId,
451186
+ raw: null,
451187
+ isGroup: env2.metadata.isGroup
451188
+ }
451189
+ });
451190
+ deps.log("[gateway] reply sent", { channel: env2.channel, to: env2.sender.id });
451191
+ } catch (relayError) {
451192
+ const detail = relayError instanceof Error ? relayError.message : String(relayError);
451193
+ log8("[gateway] relay failed", { detail });
451194
+ try {
451195
+ await gateway.send({
451196
+ id: makeEnvelopeId(env2.channel, env2.metadata.providerMessageId),
451197
+ channel: env2.channel,
451198
+ direction: "outbound",
451199
+ timestamp: new Date().toISOString(),
451200
+ sender: env2.sender,
451201
+ recipient: { id: env2.sender.id },
451202
+ content: { type: "text", text: `\u26A0\uFE0F Erreur de traitement: ${detail}` },
451203
+ metadata: {
451204
+ providerMessageId: env2.metadata.providerMessageId,
451205
+ raw: null,
451206
+ isGroup: env2.metadata.isGroup
451207
+ }
451208
+ });
451209
+ } catch {}
451210
+ }
451211
+ };
451212
+ }
451213
+
450970
451214
  // packages/daily-brief-core/src/schema.ts
450971
451215
  import * as z64 from "zod";
450972
451216
  var DailyBriefConfigSchema = z64.object({
@@ -451632,36 +451876,6 @@ function createPluginModule(overrides2 = {}) {
451632
451876
  }
451633
451877
  return out;
451634
451878
  }
451635
- if (pluginConfig.gateway?.enabled) {
451636
- try {
451637
- const gwConfig = pluginConfig.gateway;
451638
- gateway = new MatrixGateway(gwConfig, {
451639
- handler: async (env2) => {
451640
- deps.log("[gateway] inbound message", {
451641
- channel: env2.channel,
451642
- from: env2.sender.id,
451643
- text: env2.content.text
451644
- });
451645
- }
451646
- });
451647
- for (const ch of gwConfig.channels) {
451648
- if (ch.type === "telegram") {
451649
- const voice = buildTelegramVoice(ch);
451650
- gateway.registerAdapter(new TelegramAdapter(ch, undefined, voice));
451651
- } else if (ch.type === "discord") {
451652
- gateway.registerAdapter(new DiscordAdapter(ch));
451653
- } else if (ch.type === "whatsapp") {
451654
- gateway.registerAdapter(new WhatsAppAdapter(ch, undefined, { enabled: true }));
451655
- }
451656
- }
451657
- await gateway.start();
451658
- deps.log("[gateway] started", { channels: gwConfig.channels.map((c2) => c2.type) });
451659
- } catch (error) {
451660
- const detail = error instanceof Error ? error.message : String(error);
451661
- console.warn(`[gateway] failed to start: ${detail}`);
451662
- gateway = undefined;
451663
- }
451664
- }
451665
451879
  if (pluginConfig.cron?.enabled) {
451666
451880
  try {
451667
451881
  const cronStore = createCronStore();
@@ -451814,6 +452028,39 @@ function createPluginModule(overrides2 = {}) {
451814
452028
  mergedSkills: toolsResult.mergedSkills,
451815
452029
  availableSkills: toolsResult.availableSkills
451816
452030
  });
452031
+ if (pluginConfig.gateway?.enabled) {
452032
+ try {
452033
+ const gwConfig = pluginConfig.gateway;
452034
+ let gwInstance;
452035
+ gwInstance = new MatrixGateway(gwConfig, {
452036
+ handler: createGatewayRelayHandler({
452037
+ input: input2,
452038
+ gateway: gwInstance,
452039
+ log: deps.log
452040
+ })
452041
+ });
452042
+ gateway = gwInstance;
452043
+ for (const ch of gwConfig.channels) {
452044
+ if (ch.type === "telegram") {
452045
+ const voice = buildTelegramVoice(ch);
452046
+ gateway.registerAdapter(new TelegramAdapter(ch, undefined, voice));
452047
+ } else if (ch.type === "discord") {
452048
+ gateway.registerAdapter(new DiscordAdapter(ch));
452049
+ } else if (ch.type === "whatsapp") {
452050
+ gateway.registerAdapter(new WhatsAppAdapter(ch, undefined, { enabled: true }));
452051
+ }
452052
+ }
452053
+ await gateway.start();
452054
+ const gw = gateway;
452055
+ deps.log("[gateway] started \u2014 Telegram/Discord/WhatsApp relay active", {
452056
+ channels: gwConfig.channels.map((c2) => c2.type)
452057
+ });
452058
+ } catch (error) {
452059
+ const detail = error instanceof Error ? error.message : String(error);
452060
+ console.warn(`[gateway] failed to start: ${detail}`);
452061
+ gateway = undefined;
452062
+ }
452063
+ }
451817
452064
  let dreamerTrigger;
451818
452065
  const dreamerConfig = pluginConfig.dreamer;
451819
452066
  if (dreamerConfig?.enabled) {