chainlesschain 0.47.8 → 0.49.0

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 (86) hide show
  1. package/bin/chainlesschain.js +0 -0
  2. package/package.json +10 -8
  3. package/src/assets/web-panel/.build-hash +1 -1
  4. package/src/assets/web-panel/assets/{AppLayout-6SPt_8Y_.js → AppLayout-Rvi759IS.js} +1 -1
  5. package/src/assets/web-panel/assets/Dashboard-BS-tzGNj.css +1 -0
  6. package/src/assets/web-panel/assets/{Dashboard-Br7kCwKJ.js → Dashboard-DBhFxXYQ.js} +2 -2
  7. package/src/assets/web-panel/assets/{index-tN-8TosE.js → index-uL0cZ8N_.js} +2 -2
  8. package/src/assets/web-panel/index.html +2 -2
  9. package/src/commands/activitypub.js +533 -0
  10. package/src/commands/codegen.js +303 -0
  11. package/src/commands/collab.js +482 -0
  12. package/src/commands/compliance.js +597 -6
  13. package/src/commands/crosschain.js +382 -0
  14. package/src/commands/dbevo.js +388 -0
  15. package/src/commands/dev.js +411 -0
  16. package/src/commands/federation.js +427 -0
  17. package/src/commands/fusion.js +332 -0
  18. package/src/commands/governance.js +505 -0
  19. package/src/commands/hardening.js +110 -0
  20. package/src/commands/incentive.js +373 -0
  21. package/src/commands/inference.js +304 -0
  22. package/src/commands/infra.js +361 -0
  23. package/src/commands/kg.js +371 -0
  24. package/src/commands/marketplace.js +326 -0
  25. package/src/commands/matrix.js +283 -0
  26. package/src/commands/mcp.js +441 -18
  27. package/src/commands/nlprog.js +329 -0
  28. package/src/commands/nostr.js +196 -7
  29. package/src/commands/ops.js +408 -0
  30. package/src/commands/perception.js +385 -0
  31. package/src/commands/pqc.js +34 -0
  32. package/src/commands/privacy.js +345 -0
  33. package/src/commands/quantization.js +280 -0
  34. package/src/commands/recommend.js +336 -0
  35. package/src/commands/reputation.js +349 -0
  36. package/src/commands/runtime.js +500 -0
  37. package/src/commands/sla.js +352 -0
  38. package/src/commands/social.js +265 -0
  39. package/src/commands/stress.js +252 -0
  40. package/src/commands/tech.js +268 -0
  41. package/src/commands/tenant.js +576 -0
  42. package/src/commands/trust.js +366 -0
  43. package/src/harness/mcp-client.js +330 -54
  44. package/src/index.js +114 -0
  45. package/src/lib/activitypub-bridge.js +623 -0
  46. package/src/lib/aiops.js +523 -0
  47. package/src/lib/autonomous-developer.js +524 -0
  48. package/src/lib/code-agent.js +442 -0
  49. package/src/lib/collaboration-governance.js +556 -0
  50. package/src/lib/community-governance.js +649 -0
  51. package/src/lib/compliance-framework-reporter.js +600 -0
  52. package/src/lib/content-recommendation.js +600 -0
  53. package/src/lib/cross-chain.js +669 -0
  54. package/src/lib/dbevo.js +669 -0
  55. package/src/lib/decentral-infra.js +445 -0
  56. package/src/lib/federation-hardening.js +587 -0
  57. package/src/lib/hardening-manager.js +409 -0
  58. package/src/lib/inference-network.js +407 -0
  59. package/src/lib/knowledge-graph.js +530 -0
  60. package/src/lib/matrix-bridge.js +252 -0
  61. package/src/lib/mcp-client.js +3 -0
  62. package/src/lib/mcp-registry.js +347 -0
  63. package/src/lib/mcp-scaffold.js +385 -0
  64. package/src/lib/multimodal.js +698 -0
  65. package/src/lib/nl-programming.js +595 -0
  66. package/src/lib/nostr-bridge.js +214 -38
  67. package/src/lib/perception.js +500 -0
  68. package/src/lib/pqc-manager.js +141 -9
  69. package/src/lib/privacy-computing.js +575 -0
  70. package/src/lib/protocol-fusion.js +535 -0
  71. package/src/lib/quantization.js +362 -0
  72. package/src/lib/reputation-optimizer.js +509 -0
  73. package/src/lib/skill-marketplace.js +397 -0
  74. package/src/lib/sla-manager.js +484 -0
  75. package/src/lib/social-graph.js +408 -0
  76. package/src/lib/stix-parser.js +167 -0
  77. package/src/lib/stress-tester.js +383 -0
  78. package/src/lib/tech-learning-engine.js +651 -0
  79. package/src/lib/tenant-saas.js +831 -0
  80. package/src/lib/threat-intel.js +268 -0
  81. package/src/lib/token-incentive.js +513 -0
  82. package/src/lib/topic-classifier.js +400 -0
  83. package/src/lib/trust-security.js +473 -0
  84. package/src/lib/ueba.js +403 -0
  85. package/src/lib/universal-runtime.js +771 -0
  86. package/src/assets/web-panel/assets/Dashboard-CKeMmCoT.css +0 -1
@@ -14,6 +14,14 @@ import {
14
14
  getMessages,
15
15
  joinRoom,
16
16
  getLoginState,
17
+ sendThreadReply,
18
+ getThreadMessages,
19
+ getThreadRoots,
20
+ createSpace,
21
+ addSpaceChild,
22
+ removeSpaceChild,
23
+ listSpaceChildren,
24
+ listSpaces,
17
25
  } from "../lib/matrix-bridge.js";
18
26
 
19
27
  export function registerMatrixCommand(program) {
@@ -165,4 +173,279 @@ export function registerMatrixCommand(program) {
165
173
  process.exit(1);
166
174
  }
167
175
  });
176
+
177
+ // ── Threads (MSC3440 / spec §11.38) ──────────────────────────────
178
+
179
+ const thread = matrix
180
+ .command("thread")
181
+ .description("Matrix threaded replies (m.thread relation)");
182
+
183
+ thread
184
+ .command("send <room-id> <root-event-id> <body>")
185
+ .description("Send a threaded reply referencing a root event")
186
+ .option("-t, --type <msgtype>", "Message type", "m.text")
187
+ .option(
188
+ "--reply-to <event-id>",
189
+ "Event the reply directly targets (defaults to root)",
190
+ )
191
+ .option(
192
+ "--no-fallback",
193
+ "Disable is_falling_back (non-thread clients won't see it as a reply)",
194
+ )
195
+ .option("--json", "Output as JSON")
196
+ .action(async (roomId, rootEventId, body, options) => {
197
+ try {
198
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
199
+ if (!ctx.db) {
200
+ logger.error("Database not available");
201
+ process.exit(1);
202
+ }
203
+ const db = ctx.db.getDatabase();
204
+ ensureMatrixTables(db);
205
+
206
+ const result = sendThreadReply(db, {
207
+ roomId,
208
+ rootEventId,
209
+ body,
210
+ msgtype: options.type,
211
+ inReplyTo: options.replyTo,
212
+ isFallingBack: options.fallback !== false,
213
+ });
214
+ if (options.json) {
215
+ console.log(JSON.stringify(result, null, 2));
216
+ } else {
217
+ logger.success(`Thread reply sent to ${chalk.cyan(roomId)}`);
218
+ logger.log(` ${chalk.bold("Root:")} ${rootEventId}`);
219
+ logger.log(` ${chalk.bold("Event:")} ${result.event.eventId}`);
220
+ }
221
+ await shutdown();
222
+ } catch (err) {
223
+ logger.error(`Failed: ${err.message}`);
224
+ process.exit(1);
225
+ }
226
+ });
227
+
228
+ thread
229
+ .command("list <room-id> <root-event-id>")
230
+ .description("List all replies in a thread")
231
+ .option("--json", "Output as JSON")
232
+ .action(async (roomId, rootEventId, options) => {
233
+ try {
234
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
235
+ if (!ctx.db) {
236
+ logger.error("Database not available");
237
+ process.exit(1);
238
+ }
239
+ const db = ctx.db.getDatabase();
240
+ ensureMatrixTables(db);
241
+
242
+ const messages = getThreadMessages(roomId, rootEventId);
243
+ if (options.json) {
244
+ console.log(JSON.stringify(messages, null, 2));
245
+ } else if (messages.length === 0) {
246
+ logger.info("No replies in this thread.");
247
+ } else {
248
+ for (const m of messages) {
249
+ logger.log(` ${chalk.gray(m.sender)} ${m.content.body}`);
250
+ }
251
+ }
252
+ await shutdown();
253
+ } catch (err) {
254
+ logger.error(`Failed: ${err.message}`);
255
+ process.exit(1);
256
+ }
257
+ });
258
+
259
+ thread
260
+ .command("roots <room-id>")
261
+ .description("List distinct thread roots within a room")
262
+ .option("--json", "Output as JSON")
263
+ .action(async (roomId, options) => {
264
+ try {
265
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
266
+ if (!ctx.db) {
267
+ logger.error("Database not available");
268
+ process.exit(1);
269
+ }
270
+ const db = ctx.db.getDatabase();
271
+ ensureMatrixTables(db);
272
+
273
+ const roots = getThreadRoots(roomId);
274
+ if (options.json) {
275
+ console.log(JSON.stringify(roots, null, 2));
276
+ } else if (roots.length === 0) {
277
+ logger.info("No threads found.");
278
+ } else {
279
+ for (const r of roots) {
280
+ logger.log(
281
+ ` ${chalk.cyan(r.rootEventId.slice(0, 16))}... replies=${r.replyCount} last=${r.lastReplyAt}`,
282
+ );
283
+ }
284
+ }
285
+ await shutdown();
286
+ } catch (err) {
287
+ logger.error(`Failed: ${err.message}`);
288
+ process.exit(1);
289
+ }
290
+ });
291
+
292
+ // ── Spaces (spec §11.34) ─────────────────────────────────────────
293
+
294
+ const space = matrix
295
+ .command("space")
296
+ .description("Matrix Spaces — hierarchical room grouping (m.space)");
297
+
298
+ space
299
+ .command("create <name>")
300
+ .description("Create a new Matrix Space")
301
+ .option("-t, --topic <text>", "Space topic / description")
302
+ .option("--json", "Output as JSON")
303
+ .action(async (name, options) => {
304
+ try {
305
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
306
+ if (!ctx.db) {
307
+ logger.error("Database not available");
308
+ process.exit(1);
309
+ }
310
+ const db = ctx.db.getDatabase();
311
+ ensureMatrixTables(db);
312
+
313
+ const result = createSpace(db, { name, topic: options.topic });
314
+ if (options.json) {
315
+ console.log(JSON.stringify(result, null, 2));
316
+ } else {
317
+ logger.success(`Space created: ${chalk.cyan(result.space.name)}`);
318
+ logger.log(` ${chalk.bold("Room ID:")} ${result.space.roomId}`);
319
+ }
320
+ await shutdown();
321
+ } catch (err) {
322
+ logger.error(`Failed: ${err.message}`);
323
+ process.exit(1);
324
+ }
325
+ });
326
+
327
+ space
328
+ .command("add-child <space-id> <child-room-id>")
329
+ .description("Add a child room to a Space")
330
+ .option("--via <server...>", "Homeserver(s) via which child is reachable")
331
+ .option("--json", "Output as JSON")
332
+ .action(async (spaceId, childRoomId, options) => {
333
+ try {
334
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
335
+ if (!ctx.db) {
336
+ logger.error("Database not available");
337
+ process.exit(1);
338
+ }
339
+ const db = ctx.db.getDatabase();
340
+ ensureMatrixTables(db);
341
+
342
+ const result = addSpaceChild(db, {
343
+ spaceId,
344
+ childRoomId,
345
+ via: options.via,
346
+ });
347
+ if (options.json) {
348
+ console.log(JSON.stringify(result, null, 2));
349
+ } else {
350
+ logger.success(
351
+ `Added ${chalk.cyan(childRoomId)} to space ${chalk.cyan(spaceId)}`,
352
+ );
353
+ logger.log(` ${chalk.bold("Via:")} ${result.via.join(", ")}`);
354
+ }
355
+ await shutdown();
356
+ } catch (err) {
357
+ logger.error(`Failed: ${err.message}`);
358
+ process.exit(1);
359
+ }
360
+ });
361
+
362
+ space
363
+ .command("remove-child <space-id> <child-room-id>")
364
+ .description("Remove a child room from a Space")
365
+ .action(async (spaceId, childRoomId) => {
366
+ try {
367
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
368
+ if (!ctx.db) {
369
+ logger.error("Database not available");
370
+ process.exit(1);
371
+ }
372
+ const db = ctx.db.getDatabase();
373
+ ensureMatrixTables(db);
374
+
375
+ const result = removeSpaceChild(db, { spaceId, childRoomId });
376
+ if (result.removed) {
377
+ logger.success(
378
+ `Removed ${chalk.cyan(childRoomId)} from ${chalk.cyan(spaceId)}`,
379
+ );
380
+ } else {
381
+ logger.info(`${childRoomId} was not a child of ${spaceId}`);
382
+ }
383
+ await shutdown();
384
+ } catch (err) {
385
+ logger.error(`Failed: ${err.message}`);
386
+ process.exit(1);
387
+ }
388
+ });
389
+
390
+ space
391
+ .command("children <space-id>")
392
+ .description("List all child rooms of a Space")
393
+ .option("--json", "Output as JSON")
394
+ .action(async (spaceId, options) => {
395
+ try {
396
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
397
+ if (!ctx.db) {
398
+ logger.error("Database not available");
399
+ process.exit(1);
400
+ }
401
+ const db = ctx.db.getDatabase();
402
+ ensureMatrixTables(db);
403
+
404
+ const children = listSpaceChildren(spaceId);
405
+ if (options.json) {
406
+ console.log(JSON.stringify(children, null, 2));
407
+ } else if (children.length === 0) {
408
+ logger.info("Space has no children.");
409
+ } else {
410
+ for (const c of children) {
411
+ logger.log(` ${chalk.cyan(c.childRoomId)} via=${c.via.join(",")}`);
412
+ }
413
+ }
414
+ await shutdown();
415
+ } catch (err) {
416
+ logger.error(`Failed: ${err.message}`);
417
+ process.exit(1);
418
+ }
419
+ });
420
+
421
+ space
422
+ .command("list")
423
+ .description("List all Spaces")
424
+ .option("--json", "Output as JSON")
425
+ .action(async (options) => {
426
+ try {
427
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
428
+ if (!ctx.db) {
429
+ logger.error("Database not available");
430
+ process.exit(1);
431
+ }
432
+ const db = ctx.db.getDatabase();
433
+ ensureMatrixTables(db);
434
+
435
+ const spaces = listSpaces();
436
+ if (options.json) {
437
+ console.log(JSON.stringify(spaces, null, 2));
438
+ } else if (spaces.length === 0) {
439
+ logger.info("No spaces found.");
440
+ } else {
441
+ for (const s of spaces) {
442
+ logger.log(` ${chalk.cyan(s.roomId)} ${s.name}`);
443
+ }
444
+ }
445
+ await shutdown();
446
+ } catch (err) {
447
+ logger.error(`Failed: ${err.message}`);
448
+ process.exit(1);
449
+ }
450
+ });
168
451
  }