@kl-c/matrixos 0.3.8 → 0.3.10
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/index.js +23 -3
- package/dist/cli-node/index.js +23 -3
- package/dist/index.js +9 -1
- package/dist/tui.js +8 -0
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2163,7 +2163,7 @@ var package_default;
|
|
|
2163
2163
|
var init_package = __esm(() => {
|
|
2164
2164
|
package_default = {
|
|
2165
2165
|
name: "@kl-c/matrixos",
|
|
2166
|
-
version: "0.3.
|
|
2166
|
+
version: "0.3.10",
|
|
2167
2167
|
description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
|
|
2168
2168
|
main: "./dist/index.js",
|
|
2169
2169
|
types: "dist/index.d.ts",
|
|
@@ -84953,11 +84953,14 @@ class MatrixGateway {
|
|
|
84953
84953
|
return adapter.send(env2);
|
|
84954
84954
|
}
|
|
84955
84955
|
async handleInbound(env2) {
|
|
84956
|
+
console.error("[gateway] handleInbound", env2.id, env2.sender.id, env2.content.text?.slice(0, 30));
|
|
84956
84957
|
if (this.seenIds.has(env2.id)) {
|
|
84958
|
+
console.error("[gateway] dedupe rejected", env2.id);
|
|
84957
84959
|
return;
|
|
84958
84960
|
}
|
|
84959
84961
|
this.seenIds.add(env2.id);
|
|
84960
84962
|
if (this.isLoop(env2)) {
|
|
84963
|
+
console.error("[gateway] loop detected");
|
|
84961
84964
|
this.audit({
|
|
84962
84965
|
timestamp: new Date().toISOString(),
|
|
84963
84966
|
type: "loop_detected",
|
|
@@ -84969,6 +84972,7 @@ class MatrixGateway {
|
|
|
84969
84972
|
return;
|
|
84970
84973
|
}
|
|
84971
84974
|
if (this.isRateLimited(env2)) {
|
|
84975
|
+
console.error("[gateway] rate limited");
|
|
84972
84976
|
this.audit({
|
|
84973
84977
|
timestamp: new Date().toISOString(),
|
|
84974
84978
|
type: "rate_limited",
|
|
@@ -84980,6 +84984,7 @@ class MatrixGateway {
|
|
|
84980
84984
|
}
|
|
84981
84985
|
const allowResult = this.isAllowed(env2);
|
|
84982
84986
|
if (!allowResult.ok) {
|
|
84987
|
+
console.error("[gateway] security denied:", allowResult.reason);
|
|
84983
84988
|
this.audit({
|
|
84984
84989
|
timestamp: new Date().toISOString(),
|
|
84985
84990
|
type: "message_denied",
|
|
@@ -84991,7 +84996,10 @@ class MatrixGateway {
|
|
|
84991
84996
|
return;
|
|
84992
84997
|
}
|
|
84993
84998
|
if (this.handler) {
|
|
84999
|
+
console.error("[gateway] invoking handler for", env2.id);
|
|
84994
85000
|
await this.handler(env2);
|
|
85001
|
+
} else {
|
|
85002
|
+
console.error("[gateway] no handler registered");
|
|
84995
85003
|
}
|
|
84996
85004
|
this.audit({
|
|
84997
85005
|
timestamp: new Date().toISOString(),
|
|
@@ -166113,10 +166121,13 @@ async function runCliCommand(args, replyMsg) {
|
|
|
166113
166121
|
}
|
|
166114
166122
|
async function handleGatewayMessage(env5, opts = {}) {
|
|
166115
166123
|
const text = env5.content.text ?? "";
|
|
166124
|
+
console.error("[gateway-handler] received text:", text.slice(0, 50));
|
|
166116
166125
|
if (isReadoptCommand(env5)) {
|
|
166126
|
+
console.error("[gateway-handler] readopt command");
|
|
166117
166127
|
return runCliCommand(["adopt"], "Re-adoption MaTrixOS lancee. Suis le wizard localement.");
|
|
166118
166128
|
}
|
|
166119
166129
|
if (isTelegramAdoptCommand(env5)) {
|
|
166130
|
+
console.error("[gateway-handler] telegram-adopt command");
|
|
166120
166131
|
return runCliCommand(["gateway", "adopt", "telegram"], "Configuration Telegram lancee. Colle ton bot token quand demande (jamais par chat).");
|
|
166121
166132
|
}
|
|
166122
166133
|
const command = opts.command ?? "matrixos";
|
|
@@ -166124,6 +166135,7 @@ async function handleGatewayMessage(env5, opts = {}) {
|
|
|
166124
166135
|
const args = argsTemplate.map((a2) => a2 === "{text}" ? text : a2);
|
|
166125
166136
|
const cwd = opts.cwd ?? process.cwd();
|
|
166126
166137
|
const timeoutMs = opts.timeoutMs ?? 30000;
|
|
166138
|
+
console.error("[gateway-handler] spawn:", command, args, "cwd:", cwd, "timeout:", timeoutMs);
|
|
166127
166139
|
const started = Date.now();
|
|
166128
166140
|
return new Promise((resolve19) => {
|
|
166129
166141
|
let stdout2 = "";
|
|
@@ -166162,11 +166174,14 @@ async function handleGatewayMessage(env5, opts = {}) {
|
|
|
166162
166174
|
}, timeoutMs);
|
|
166163
166175
|
child.stdout?.on("data", (chunk) => {
|
|
166164
166176
|
const s = chunk.toString("utf8");
|
|
166177
|
+
console.error("[gateway-handler] stdout chunk:", s.slice(0, 120).replace(/\n/g, "\\n"));
|
|
166165
166178
|
stdout2 += s;
|
|
166166
166179
|
opts.onPartial?.(s);
|
|
166167
166180
|
});
|
|
166168
166181
|
child.stderr?.on("data", (chunk) => {
|
|
166169
|
-
|
|
166182
|
+
const s = chunk.toString("utf8");
|
|
166183
|
+
console.error("[gateway-handler] stderr chunk:", s.slice(0, 120).replace(/\n/g, "\\n"));
|
|
166184
|
+
stderr += s;
|
|
166170
166185
|
});
|
|
166171
166186
|
child.on("error", (err) => {
|
|
166172
166187
|
clearTimeout(timer);
|
|
@@ -166178,6 +166193,7 @@ async function handleGatewayMessage(env5, opts = {}) {
|
|
|
166178
166193
|
});
|
|
166179
166194
|
child.on("close", (code) => {
|
|
166180
166195
|
clearTimeout(timer);
|
|
166196
|
+
console.error("[gateway-handler] child close code:", code, "stdout len:", stdout2.length, "stderr len:", stderr.length);
|
|
166181
166197
|
if (code === 0) {
|
|
166182
166198
|
finish({ ok: true, reply: stdout2.trim() || "(empty reply)", exitCode: code });
|
|
166183
166199
|
} else {
|
|
@@ -166292,6 +166308,7 @@ async function runGatewayStart(opts = {}) {
|
|
|
166292
166308
|
args: opts.args,
|
|
166293
166309
|
timeoutMs: opts.timeoutMs
|
|
166294
166310
|
});
|
|
166311
|
+
console.error("[gateway-start] handler result:", r2.ok, "reply len:", r2.reply.length, "duration:", r2.durationMs, "exitCode:", r2.exitCode);
|
|
166295
166312
|
if (env6.content.text && r2.ok) {
|
|
166296
166313
|
const reply = {
|
|
166297
166314
|
id: "reply-" + env6.id,
|
|
@@ -166307,7 +166324,10 @@ async function runGatewayStart(opts = {}) {
|
|
|
166307
166324
|
};
|
|
166308
166325
|
try {
|
|
166309
166326
|
await gateway2.send(reply);
|
|
166310
|
-
|
|
166327
|
+
console.error("[gateway-start] reply sent");
|
|
166328
|
+
} catch (e) {
|
|
166329
|
+
console.error("[gateway-start] reply failed:", e instanceof Error ? e.message : String(e));
|
|
166330
|
+
}
|
|
166311
166331
|
}
|
|
166312
166332
|
});
|
|
166313
166333
|
await gateway2.start();
|
package/dist/cli-node/index.js
CHANGED
|
@@ -2163,7 +2163,7 @@ var package_default;
|
|
|
2163
2163
|
var init_package = __esm(() => {
|
|
2164
2164
|
package_default = {
|
|
2165
2165
|
name: "@kl-c/matrixos",
|
|
2166
|
-
version: "0.3.
|
|
2166
|
+
version: "0.3.10",
|
|
2167
2167
|
description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
|
|
2168
2168
|
main: "./dist/index.js",
|
|
2169
2169
|
types: "dist/index.d.ts",
|
|
@@ -85008,11 +85008,14 @@ class MatrixGateway {
|
|
|
85008
85008
|
return adapter.send(env2);
|
|
85009
85009
|
}
|
|
85010
85010
|
async handleInbound(env2) {
|
|
85011
|
+
console.error("[gateway] handleInbound", env2.id, env2.sender.id, env2.content.text?.slice(0, 30));
|
|
85011
85012
|
if (this.seenIds.has(env2.id)) {
|
|
85013
|
+
console.error("[gateway] dedupe rejected", env2.id);
|
|
85012
85014
|
return;
|
|
85013
85015
|
}
|
|
85014
85016
|
this.seenIds.add(env2.id);
|
|
85015
85017
|
if (this.isLoop(env2)) {
|
|
85018
|
+
console.error("[gateway] loop detected");
|
|
85016
85019
|
this.audit({
|
|
85017
85020
|
timestamp: new Date().toISOString(),
|
|
85018
85021
|
type: "loop_detected",
|
|
@@ -85024,6 +85027,7 @@ class MatrixGateway {
|
|
|
85024
85027
|
return;
|
|
85025
85028
|
}
|
|
85026
85029
|
if (this.isRateLimited(env2)) {
|
|
85030
|
+
console.error("[gateway] rate limited");
|
|
85027
85031
|
this.audit({
|
|
85028
85032
|
timestamp: new Date().toISOString(),
|
|
85029
85033
|
type: "rate_limited",
|
|
@@ -85035,6 +85039,7 @@ class MatrixGateway {
|
|
|
85035
85039
|
}
|
|
85036
85040
|
const allowResult = this.isAllowed(env2);
|
|
85037
85041
|
if (!allowResult.ok) {
|
|
85042
|
+
console.error("[gateway] security denied:", allowResult.reason);
|
|
85038
85043
|
this.audit({
|
|
85039
85044
|
timestamp: new Date().toISOString(),
|
|
85040
85045
|
type: "message_denied",
|
|
@@ -85046,7 +85051,10 @@ class MatrixGateway {
|
|
|
85046
85051
|
return;
|
|
85047
85052
|
}
|
|
85048
85053
|
if (this.handler) {
|
|
85054
|
+
console.error("[gateway] invoking handler for", env2.id);
|
|
85049
85055
|
await this.handler(env2);
|
|
85056
|
+
} else {
|
|
85057
|
+
console.error("[gateway] no handler registered");
|
|
85050
85058
|
}
|
|
85051
85059
|
this.audit({
|
|
85052
85060
|
timestamp: new Date().toISOString(),
|
|
@@ -166168,10 +166176,13 @@ async function runCliCommand(args, replyMsg) {
|
|
|
166168
166176
|
}
|
|
166169
166177
|
async function handleGatewayMessage(env5, opts = {}) {
|
|
166170
166178
|
const text = env5.content.text ?? "";
|
|
166179
|
+
console.error("[gateway-handler] received text:", text.slice(0, 50));
|
|
166171
166180
|
if (isReadoptCommand(env5)) {
|
|
166181
|
+
console.error("[gateway-handler] readopt command");
|
|
166172
166182
|
return runCliCommand(["adopt"], "Re-adoption MaTrixOS lancee. Suis le wizard localement.");
|
|
166173
166183
|
}
|
|
166174
166184
|
if (isTelegramAdoptCommand(env5)) {
|
|
166185
|
+
console.error("[gateway-handler] telegram-adopt command");
|
|
166175
166186
|
return runCliCommand(["gateway", "adopt", "telegram"], "Configuration Telegram lancee. Colle ton bot token quand demande (jamais par chat).");
|
|
166176
166187
|
}
|
|
166177
166188
|
const command = opts.command ?? "matrixos";
|
|
@@ -166179,6 +166190,7 @@ async function handleGatewayMessage(env5, opts = {}) {
|
|
|
166179
166190
|
const args = argsTemplate.map((a2) => a2 === "{text}" ? text : a2);
|
|
166180
166191
|
const cwd = opts.cwd ?? process.cwd();
|
|
166181
166192
|
const timeoutMs = opts.timeoutMs ?? 30000;
|
|
166193
|
+
console.error("[gateway-handler] spawn:", command, args, "cwd:", cwd, "timeout:", timeoutMs);
|
|
166182
166194
|
const started = Date.now();
|
|
166183
166195
|
return new Promise((resolve19) => {
|
|
166184
166196
|
let stdout2 = "";
|
|
@@ -166217,11 +166229,14 @@ async function handleGatewayMessage(env5, opts = {}) {
|
|
|
166217
166229
|
}, timeoutMs);
|
|
166218
166230
|
child.stdout?.on("data", (chunk) => {
|
|
166219
166231
|
const s = chunk.toString("utf8");
|
|
166232
|
+
console.error("[gateway-handler] stdout chunk:", s.slice(0, 120).replace(/\n/g, "\\n"));
|
|
166220
166233
|
stdout2 += s;
|
|
166221
166234
|
opts.onPartial?.(s);
|
|
166222
166235
|
});
|
|
166223
166236
|
child.stderr?.on("data", (chunk) => {
|
|
166224
|
-
|
|
166237
|
+
const s = chunk.toString("utf8");
|
|
166238
|
+
console.error("[gateway-handler] stderr chunk:", s.slice(0, 120).replace(/\n/g, "\\n"));
|
|
166239
|
+
stderr += s;
|
|
166225
166240
|
});
|
|
166226
166241
|
child.on("error", (err) => {
|
|
166227
166242
|
clearTimeout(timer);
|
|
@@ -166233,6 +166248,7 @@ async function handleGatewayMessage(env5, opts = {}) {
|
|
|
166233
166248
|
});
|
|
166234
166249
|
child.on("close", (code) => {
|
|
166235
166250
|
clearTimeout(timer);
|
|
166251
|
+
console.error("[gateway-handler] child close code:", code, "stdout len:", stdout2.length, "stderr len:", stderr.length);
|
|
166236
166252
|
if (code === 0) {
|
|
166237
166253
|
finish({ ok: true, reply: stdout2.trim() || "(empty reply)", exitCode: code });
|
|
166238
166254
|
} else {
|
|
@@ -166347,6 +166363,7 @@ async function runGatewayStart(opts = {}) {
|
|
|
166347
166363
|
args: opts.args,
|
|
166348
166364
|
timeoutMs: opts.timeoutMs
|
|
166349
166365
|
});
|
|
166366
|
+
console.error("[gateway-start] handler result:", r2.ok, "reply len:", r2.reply.length, "duration:", r2.durationMs, "exitCode:", r2.exitCode);
|
|
166350
166367
|
if (env6.content.text && r2.ok) {
|
|
166351
166368
|
const reply = {
|
|
166352
166369
|
id: "reply-" + env6.id,
|
|
@@ -166362,7 +166379,10 @@ async function runGatewayStart(opts = {}) {
|
|
|
166362
166379
|
};
|
|
166363
166380
|
try {
|
|
166364
166381
|
await gateway2.send(reply);
|
|
166365
|
-
|
|
166382
|
+
console.error("[gateway-start] reply sent");
|
|
166383
|
+
} catch (e) {
|
|
166384
|
+
console.error("[gateway-start] reply failed:", e instanceof Error ? e.message : String(e));
|
|
166385
|
+
}
|
|
166366
166386
|
}
|
|
166367
166387
|
});
|
|
166368
166388
|
await gateway2.start();
|
package/dist/index.js
CHANGED
|
@@ -368019,7 +368019,7 @@ function getCachedVersion(options = {}) {
|
|
|
368019
368019
|
// package.json
|
|
368020
368020
|
var package_default = {
|
|
368021
368021
|
name: "@kl-c/matrixos",
|
|
368022
|
-
version: "0.3.
|
|
368022
|
+
version: "0.3.10",
|
|
368023
368023
|
description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
|
|
368024
368024
|
main: "./dist/index.js",
|
|
368025
368025
|
types: "dist/index.d.ts",
|
|
@@ -443312,11 +443312,14 @@ class MatrixGateway {
|
|
|
443312
443312
|
return adapter.send(env2);
|
|
443313
443313
|
}
|
|
443314
443314
|
async handleInbound(env2) {
|
|
443315
|
+
console.error("[gateway] handleInbound", env2.id, env2.sender.id, env2.content.text?.slice(0, 30));
|
|
443315
443316
|
if (this.seenIds.has(env2.id)) {
|
|
443317
|
+
console.error("[gateway] dedupe rejected", env2.id);
|
|
443316
443318
|
return;
|
|
443317
443319
|
}
|
|
443318
443320
|
this.seenIds.add(env2.id);
|
|
443319
443321
|
if (this.isLoop(env2)) {
|
|
443322
|
+
console.error("[gateway] loop detected");
|
|
443320
443323
|
this.audit({
|
|
443321
443324
|
timestamp: new Date().toISOString(),
|
|
443322
443325
|
type: "loop_detected",
|
|
@@ -443328,6 +443331,7 @@ class MatrixGateway {
|
|
|
443328
443331
|
return;
|
|
443329
443332
|
}
|
|
443330
443333
|
if (this.isRateLimited(env2)) {
|
|
443334
|
+
console.error("[gateway] rate limited");
|
|
443331
443335
|
this.audit({
|
|
443332
443336
|
timestamp: new Date().toISOString(),
|
|
443333
443337
|
type: "rate_limited",
|
|
@@ -443339,6 +443343,7 @@ class MatrixGateway {
|
|
|
443339
443343
|
}
|
|
443340
443344
|
const allowResult = this.isAllowed(env2);
|
|
443341
443345
|
if (!allowResult.ok) {
|
|
443346
|
+
console.error("[gateway] security denied:", allowResult.reason);
|
|
443342
443347
|
this.audit({
|
|
443343
443348
|
timestamp: new Date().toISOString(),
|
|
443344
443349
|
type: "message_denied",
|
|
@@ -443350,7 +443355,10 @@ class MatrixGateway {
|
|
|
443350
443355
|
return;
|
|
443351
443356
|
}
|
|
443352
443357
|
if (this.handler) {
|
|
443358
|
+
console.error("[gateway] invoking handler for", env2.id);
|
|
443353
443359
|
await this.handler(env2);
|
|
443360
|
+
} else {
|
|
443361
|
+
console.error("[gateway] no handler registered");
|
|
443354
443362
|
}
|
|
443355
443363
|
this.audit({
|
|
443356
443364
|
timestamp: new Date().toISOString(),
|
package/dist/tui.js
CHANGED
|
@@ -20763,11 +20763,14 @@ class MatrixGateway {
|
|
|
20763
20763
|
return adapter.send(env2);
|
|
20764
20764
|
}
|
|
20765
20765
|
async handleInbound(env2) {
|
|
20766
|
+
console.error("[gateway] handleInbound", env2.id, env2.sender.id, env2.content.text?.slice(0, 30));
|
|
20766
20767
|
if (this.seenIds.has(env2.id)) {
|
|
20768
|
+
console.error("[gateway] dedupe rejected", env2.id);
|
|
20767
20769
|
return;
|
|
20768
20770
|
}
|
|
20769
20771
|
this.seenIds.add(env2.id);
|
|
20770
20772
|
if (this.isLoop(env2)) {
|
|
20773
|
+
console.error("[gateway] loop detected");
|
|
20771
20774
|
this.audit({
|
|
20772
20775
|
timestamp: new Date().toISOString(),
|
|
20773
20776
|
type: "loop_detected",
|
|
@@ -20779,6 +20782,7 @@ class MatrixGateway {
|
|
|
20779
20782
|
return;
|
|
20780
20783
|
}
|
|
20781
20784
|
if (this.isRateLimited(env2)) {
|
|
20785
|
+
console.error("[gateway] rate limited");
|
|
20782
20786
|
this.audit({
|
|
20783
20787
|
timestamp: new Date().toISOString(),
|
|
20784
20788
|
type: "rate_limited",
|
|
@@ -20790,6 +20794,7 @@ class MatrixGateway {
|
|
|
20790
20794
|
}
|
|
20791
20795
|
const allowResult = this.isAllowed(env2);
|
|
20792
20796
|
if (!allowResult.ok) {
|
|
20797
|
+
console.error("[gateway] security denied:", allowResult.reason);
|
|
20793
20798
|
this.audit({
|
|
20794
20799
|
timestamp: new Date().toISOString(),
|
|
20795
20800
|
type: "message_denied",
|
|
@@ -20801,7 +20806,10 @@ class MatrixGateway {
|
|
|
20801
20806
|
return;
|
|
20802
20807
|
}
|
|
20803
20808
|
if (this.handler) {
|
|
20809
|
+
console.error("[gateway] invoking handler for", env2.id);
|
|
20804
20810
|
await this.handler(env2);
|
|
20811
|
+
} else {
|
|
20812
|
+
console.error("[gateway] no handler registered");
|
|
20805
20813
|
}
|
|
20806
20814
|
this.audit({
|
|
20807
20815
|
timestamp: new Date().toISOString(),
|
package/package.json
CHANGED