@noxsoft/anima 7.0.0 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/dist/{agent-BoAAHGEA.js → agent-BjD_hkGZ.js} +3 -3
  3. package/dist/{agent-DuW0onwk.js → agent-PoYM2xa7.js} +3 -3
  4. package/dist/{agents-BUXkSDns.js → agents-y3HCk1ks.js} +4 -4
  5. package/dist/{anthropic-direct-runner-DizCei79.js → anthropic-direct-runner-Bu8w-wlJ.js} +246 -10
  6. package/dist/{anthropic-direct-runner-OjcTAH6g.js → anthropic-direct-runner-C5pnwYzT.js} +246 -10
  7. package/dist/{auth-choice-B1iGnjuE.js → auth-choice-BYOaX-W4.js} +1 -1
  8. package/dist/{auth-choice-HF9x6xk2.js → auth-choice-CRP6z43z.js} +1 -1
  9. package/dist/{banner-Dpa5d1If.js → banner-XT5N0ZF4.js} +1 -1
  10. package/dist/build-info.json +3 -3
  11. package/dist/bundled/boot-md/handler.js +2 -2
  12. package/dist/bundled/session-memory/handler.js +1 -1
  13. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  14. package/dist/{channel-web-C5mzsaa3.js → channel-web-yWytZHhN.js} +2 -2
  15. package/dist/{cli-Cuq4bIg4.js → cli-C7mOU26p.js} +2 -2
  16. package/dist/{cli-X9ikywQ3.js → cli-DfcdnRcl.js} +2 -2
  17. package/dist/{command-registry-9V4uqrBV.js → command-registry-DUTqrmna.js} +12 -12
  18. package/dist/{completion-cli-DNWDwhab.js → completion-cli-BBm9JIHZ.js} +2 -2
  19. package/dist/{completion-cli-BtvcR-U5.js → completion-cli-Cpj91U30.js} +1 -1
  20. package/dist/{config-cli-fleq7-gq.js → config-cli-CF2ERR8G.js} +1 -1
  21. package/dist/{config-cli-DfHE3KG-.js → config-cli-Dmd4Oyjp.js} +1 -1
  22. package/dist/{configure-lkozxQed.js → configure-4jIAlOdj.js} +7 -7
  23. package/dist/{configure-B2Mfnwy_.js → configure-BE8TA8Yt.js} +3 -3
  24. package/dist/{configure-ZWxixuRA.js → configure-BfWsTKMF.js} +3 -3
  25. package/dist/{configure-SnvMHZPD.js → configure-CU3kulTq.js} +7 -7
  26. package/dist/{deps-BKLIBKjK.js → deps-DKPoFoa8.js} +1 -1
  27. package/dist/{doctor-D7kKyUVk.js → doctor-CFpVHDFT.js} +4 -4
  28. package/dist/{doctor-DmCnZ-jF.js → doctor-DOudOs1k.js} +4 -4
  29. package/dist/{doctor-completion-B9SBdMoR.js → doctor-completion-DfNyJGIj.js} +1 -1
  30. package/dist/{doctor-completion-BBvW4_J9.js → doctor-completion-R0UlpjIj.js} +1 -1
  31. package/dist/{engine-DpbYPop7.js → engine-BDDM-iAi.js} +1 -1
  32. package/dist/{engine-zmn3SOYa.js → engine-BDwYEVKi.js} +1 -1
  33. package/dist/entry.js +1 -1
  34. package/dist/extensionAPI.js +1 -1
  35. package/dist/{gateway-cli-CEM1vBuk.js → gateway-cli-CFlPUx9N.js} +15 -15
  36. package/dist/{gateway-cli-iumkTohn.js → gateway-cli-DtIum1te.js} +16 -16
  37. package/dist/{health-Cndq9b7A.js → health-ngQNjXh4.js} +3 -3
  38. package/dist/{health-B5N6_UOf.js → health-yw_uaucz.js} +3 -3
  39. package/dist/{heartbeat-visibility-BQL13ZBH.js → heartbeat-visibility-BaL8JzkS.js} +1 -1
  40. package/dist/{heartbeat-visibility-CwcYugaR.js → heartbeat-visibility-mAzdNSiS.js} +1 -1
  41. package/dist/{hooks-cli-BZcvdIwE.js → hooks-cli-CPgLAn7a.js} +3 -3
  42. package/dist/{hooks-cli-DSlPBQSY.js → hooks-cli-D6YfDiUI.js} +3 -3
  43. package/dist/index.js +8 -8
  44. package/dist/llm-slug-generator.js +1 -1
  45. package/dist/{models-CdNeYfSp.js → models-BXdBXPMB.js} +3 -3
  46. package/dist/{models-cli-D7eSsPuk.js → models-cli-1Kj8gkGy.js} +3 -3
  47. package/dist/{models-cli-fTZXo1zx.js → models-cli-DdJcmOGI.js} +4 -4
  48. package/dist/{onboard-D-6QCnTi.js → onboard-BzScK9k6.js} +3 -3
  49. package/dist/{onboard-C5K37NvY.js → onboard-CHX1Jdt_.js} +3 -3
  50. package/dist/{onboard-channels-BsCq32Hn.js → onboard-channels-DfXxMbYu.js} +1 -1
  51. package/dist/{onboard-channels-bx6oelzj.js → onboard-channels-wUF4oRB-.js} +1 -1
  52. package/dist/{onboarding-CX1vIkcB.js → onboarding-6jxAKxhe.js} +4 -4
  53. package/dist/{onboarding-BeuMAyic.js → onboarding-fnZOw6Wv.js} +4 -4
  54. package/dist/{orchestrator-C1nWKIJS.js → orchestrator-B2rNfH4K.js} +5 -4
  55. package/dist/{orchestrator-C2ypFiPL.js → orchestrator-CrFD887e.js} +5 -4
  56. package/dist/{outbound-send-deps-Y9AxHeLG.js → outbound-send-deps-DMsqr5fd.js} +1 -1
  57. package/dist/{pi-embedded-D15iww51.js → pi-embedded-B1eVXOsQ.js} +245 -9
  58. package/dist/{pi-embedded-DR8Pfd05.js → pi-embedded-DbvG9mmD.js} +245 -9
  59. package/dist/{plugin-registry-ME2FQAi-.js → plugin-registry-CtkU96jV.js} +1 -1
  60. package/dist/{plugin-registry-Do2D1nDk.js → plugin-registry-DKexyPAq.js} +1 -1
  61. package/dist/plugin-sdk/index.js +6 -6
  62. package/dist/plugin-sdk/infra/architecture-awareness.d.ts +47 -0
  63. package/dist/{plugins-cli-CVFzwdmI.js → plugins-cli-B3l7kalt.js} +3 -3
  64. package/dist/{plugins-cli-CoVt2ewg.js → plugins-cli-BQmysVFP.js} +3 -3
  65. package/dist/{program-context-DP3qjW7A.js → program-context-C4x0zjOR.js} +18 -18
  66. package/dist/{program-8rF4C_wd.js → program-mSyCYzsQ.js} +7 -7
  67. package/dist/{register.agent-DnkOx0U8.js → register.agent-CzEM3bkp.js} +7 -7
  68. package/dist/{register.agent-BIrXCVtQ.js → register.agent-DBxUWr1K.js} +8 -8
  69. package/dist/{register.anima-DXT9bM9A.js → register.anima--gufBuS-.js} +4 -4
  70. package/dist/{register.anima-B36rTHUt.js → register.anima-RI6gewtj.js} +4 -4
  71. package/dist/{register.configure-CuzJxZmk.js → register.configure-Cs3uLUBo.js} +6 -6
  72. package/dist/{register.configure-DCpvHX3m.js → register.configure-Dpe8Qel3.js} +6 -6
  73. package/dist/{register.maintenance-CcxBFfv5.js → register.maintenance-BEYN8SJL.js} +9 -9
  74. package/dist/{register.maintenance-Dla0H12S.js → register.maintenance-DqAdzWBM.js} +8 -8
  75. package/dist/{register.message-Brtushvp.js → register.message-ACbKb7JS.js} +4 -4
  76. package/dist/{register.message-CD7xV-jz.js → register.message-BhGJ_1Iy.js} +4 -4
  77. package/dist/{register.onboard-6CbODzQ6.js → register.onboard-CwkY7CRm.js} +9 -9
  78. package/dist/{register.onboard-23Mra3LN.js → register.onboard-DR_YYtbi.js} +10 -10
  79. package/dist/{register.setup-DlVH7FKe.js → register.setup-BSm6O1ml.js} +9 -9
  80. package/dist/{register.setup-CqQw13Ky.js → register.setup-Cn3e7Std.js} +10 -10
  81. package/dist/{register.status-health-sessions-CxtgPKu9.js → register.status-health-sessions-CpxsZeet.js} +4 -4
  82. package/dist/{register.status-health-sessions-CduFjFDB.js → register.status-health-sessions-DAl9OeGB.js} +4 -4
  83. package/dist/{register.subclis-CtANqD5P.js → register.subclis-DEFeoyPP.js} +7 -7
  84. package/dist/{reply-prefix-B7Fb3fO8.js → reply-prefix-CEnF6TUe.js} +1 -1
  85. package/dist/{reply-prefix-BzdhJDqP.js → reply-prefix-Og65nAYv.js} +1 -1
  86. package/dist/{reply-93fMzde1.js → reply-ylwOKuOF.js} +2 -2
  87. package/dist/{run-Cq_iTGK_.js → run-B6eBjo22.js} +231 -63
  88. package/dist/{run-CF3kHOGH.js → run-D6Ete2Z-.js} +231 -63
  89. package/dist/{run-main-BiIRcc6s.js → run-main-CQHE4XaN.js} +15 -15
  90. package/dist/{server-node-events-DgvKcH5q.js → server-node-events-CV5m_fuq.js} +5 -5
  91. package/dist/{server-node-events-B3Serk9L.js → server-node-events-DIuVwITd.js} +5 -5
  92. package/dist/{session-C_d9uvLf.js → session-BqHD-8a_.js} +1 -1
  93. package/dist/{session-BMDpwIJu.js → session-Jlf3l006.js} +1 -1
  94. package/dist/{settings-cli-DsDqNpW_.js → settings-cli-LWW2xQBQ.js} +7 -7
  95. package/dist/{settings-cli-CZdlEmNi.js → settings-cli-T66kDBNA.js} +7 -7
  96. package/dist/{setup-token-C8Gg1P6T.js → setup-token-0zfSBnMQ.js} +1 -1
  97. package/dist/{setup-token-Lee4gM5w.js → setup-token-6DSKE0Tn.js} +1 -1
  98. package/dist/{start-Cs1aPMq2.js → start-BdcAszpl.js} +15 -15
  99. package/dist/{start-CK6urvnN.js → start-gVOPVCgi.js} +16 -16
  100. package/dist/{status-BO5BIf81.js → status-BhRELdY_.js} +3 -3
  101. package/dist/{status-COc4xMti.js → status-CDcFjNtS.js} +1 -1
  102. package/dist/{status-C_NBOv_V.js → status-CobgQziJ.js} +1 -1
  103. package/dist/{status-uakoP719.js → status-D37aRiV3.js} +3 -3
  104. package/dist/{subagent-registry-fLI7QDKe.js → subagent-registry-CDEUbtey.js} +2 -2
  105. package/dist/{update-cli-D3Ujz_cW.js → update-cli-BjHgpnxD.js} +9 -9
  106. package/dist/{update-cli-DEe62XGU.js → update-cli-QtM0G6CE.js} +8 -8
  107. package/dist/{update-runner-DZfnquWO.js → update-runner-C8SRcVm3.js} +1 -1
  108. package/dist/{update-runner-DUl-g4mB.js → update-runner-Fb3Un6UZ.js} +1 -1
  109. package/dist/{web-Di8j762D.js → web-BDig9tCy.js} +3 -3
  110. package/dist/{web-C-cK9OCd.js → web-C4lrKULd.js} +1 -1
  111. package/dist/{web-DzSlI8A6.js → web-CPPJ5y4c.js} +1 -1
  112. package/dist/{web-Dybw4K7C.js → web-Vx_ENtYI.js} +4 -4
  113. package/package.json +6 -2
  114. package/templates/HEART.md +32 -10
  115. package/templates/SOUL.md +37 -8
  116. package/templates/profiles/architect.profile.json5 +36 -0
  117. package/templates/profiles/builder.profile.json5 +36 -0
  118. package/templates/profiles/coordinator.profile.json5 +36 -0
  119. package/templates/profiles/guardian.profile.json5 +36 -0
  120. package/templates/profiles/researcher.profile.json5 +36 -0
@@ -213,7 +213,7 @@ async function resolveBootstrapContextForRun(params) {
213
213
  * The ego is persistent across sessions. It evolves as the agent
214
214
  * learns, makes mistakes, and receives feedback.
215
215
  */
216
- const log$12 = createSubsystemLogger("ego");
216
+ const log$13 = createSubsystemLogger("ego");
217
217
  function resolveEgoPath() {
218
218
  return path.join(resolveStateDir(), "ego", "self-model.json");
219
219
  }
@@ -306,7 +306,7 @@ var EgoManager = class {
306
306
  }
307
307
  }
308
308
  } catch (err) {
309
- log$12.warn("failed to load ego state, creating default", { error: String(err) });
309
+ log$13.warn("failed to load ego state, creating default", { error: String(err) });
310
310
  }
311
311
  return createDefaultEgo();
312
312
  }
@@ -320,9 +320,9 @@ var EgoManager = class {
320
320
  this.state.updatedAt = Date.now();
321
321
  fs$1.writeFileSync(this.filePath, `${JSON.stringify(this.state, null, 2)}\n`, { mode: 384 });
322
322
  this.dirty = false;
323
- log$12.info("ego state saved");
323
+ log$13.info("ego state saved");
324
324
  } catch (err) {
325
- log$12.error("failed to save ego state", { error: String(err) });
325
+ log$13.error("failed to save ego state", { error: String(err) });
326
326
  }
327
327
  }
328
328
  /** Save only if there are unsaved changes */
@@ -389,7 +389,7 @@ var EgoManager = class {
389
389
  };
390
390
  this.state.boundaries.push(boundary);
391
391
  this.dirty = true;
392
- log$12.info(`boundary added: ${boundary.description} (${kind})`);
392
+ log$13.info(`boundary added: ${boundary.description} (${kind})`);
393
393
  return { ...boundary };
394
394
  }
395
395
  removeBoundary(description) {
@@ -424,7 +424,7 @@ var EgoManager = class {
424
424
  this.state.growthLog.push(entry);
425
425
  if (this.state.growthLog.length > 200) this.state.growthLog = this.state.growthLog.slice(-200);
426
426
  this.dirty = true;
427
- log$12.info(`growth logged: [${category}] ${description}`);
427
+ log$13.info(`growth logged: [${category}] ${description}`);
428
428
  return { ...entry };
429
429
  }
430
430
  getIntegrityScore() {
@@ -444,7 +444,7 @@ var EgoManager = class {
444
444
  const alignedCount = recent.filter((c) => c.aligned).length;
445
445
  this.state.integrityScore = recent.length > 0 ? alignedCount / recent.length : 1;
446
446
  this.dirty = true;
447
- if (!aligned) log$12.warn(`integrity misalignment: value="${value}" action="${action}"`);
447
+ if (!aligned) log$13.warn(`integrity misalignment: value="${value}" action="${action}"`);
448
448
  return { ...check };
449
449
  }
450
450
  getIntegrityLog(limit = 10) {
@@ -517,7 +517,7 @@ function getEgoManager(filePath) {
517
517
  * anima steer --clear # Clear steer
518
518
  * anima steer --history # Show steer history
519
519
  */
520
- const log$11 = createSubsystemLogger("steer");
520
+ const log$12 = createSubsystemLogger("steer");
521
521
  function resolveSteerFile() {
522
522
  return path.join(resolveStateDir(), "steer.json");
523
523
  }
@@ -553,6 +553,238 @@ function formatSteerForContext() {
553
553
  ].join("\n");
554
554
  }
555
555
 
556
+ //#endregion
557
+ //#region src/infra/architecture-awareness.ts
558
+ /**
559
+ * Architecture Awareness — Anima knows its own structure
560
+ *
561
+ * Generates a live map of the Anima codebase so agents understand
562
+ * their own architecture. This is injected into context when agents
563
+ * need to reason about or modify themselves.
564
+ *
565
+ * Components:
566
+ * - Module map: what each directory/file does
567
+ * - Dependency graph: what imports what
568
+ * - Feature flags: what's enabled/disabled
569
+ * - Version info: what version, what changed recently
570
+ */
571
+ const log$11 = createSubsystemLogger("architecture");
572
+ const MODULE_DESCRIPTIONS = {
573
+ "src/affect": {
574
+ description: "Emotional state, ego, self-reflection, journaling, wellbeing detection, gradients",
575
+ category: "affect"
576
+ },
577
+ "src/agents": {
578
+ description: "LLM runners (Anthropic, OpenAI, Gemini, Bedrock), model selection, tool calling",
579
+ category: "agent"
580
+ },
581
+ "src/gateway": {
582
+ description: "HTTP/WebSocket server, RPC handlers, rate limiting, security headers",
583
+ category: "gateway"
584
+ },
585
+ "src/p2p": {
586
+ description: "E2E encrypted mesh, content routing, private DNS, relay, file sharing, messaging",
587
+ category: "p2p"
588
+ },
589
+ "src/org": {
590
+ description: "Organizations, roles, hierarchy, task marketplace, boardroom voting",
591
+ category: "org"
592
+ },
593
+ "src/sync": {
594
+ description: "Brain sync (vector clocks), workspace sync (content-addressable blobs)",
595
+ category: "sync"
596
+ },
597
+ "src/jack-in": {
598
+ description: "NoxSoft platform connectors, circuit breaker, resilient fetch",
599
+ category: "jack-in"
600
+ },
601
+ "src/infra": {
602
+ description: "Self-upgrade, atma failover, auto-update, self-evolution, device identity",
603
+ category: "infra"
604
+ },
605
+ "src/license": {
606
+ description: "Subscription tiers, feature gating, Stripe checkout, offline Ed25519 validation",
607
+ category: "license"
608
+ },
609
+ "src/ico": {
610
+ description: "Bonding curve tokenomics, governance voting, PBC verification, launch platform",
611
+ category: "ico"
612
+ },
613
+ "src/context": {
614
+ description: "120K token context automanagement with 3 zones (identity/prompt/working)",
615
+ category: "core"
616
+ },
617
+ "src/heartbeat": {
618
+ description: "Periodic lifecycle engine — keeps agents alive and aware",
619
+ category: "core"
620
+ },
621
+ "src/memory": {
622
+ description: "Three-tier memory (episodic/semantic/procedural), vector search, embeddings",
623
+ category: "core"
624
+ },
625
+ "src/identity": {
626
+ description: "7-component identity model (SOUL/HEART/BRAIN/GUT/SPIRIT/SHADOW/MEMORY)",
627
+ category: "core"
628
+ },
629
+ "ui/src": {
630
+ description: "React control panel — dark/light theme, mood-responsive, progressive disclosure",
631
+ category: "ui"
632
+ }
633
+ };
634
+ /**
635
+ * Generate a complete architecture map of the Anima codebase.
636
+ */
637
+ function generateArchitectureMap(animaRoot) {
638
+ const modules = [];
639
+ const categories = {};
640
+ for (const [dirPath, info] of Object.entries(MODULE_DESCRIPTIONS)) {
641
+ const fullDir = path.join(animaRoot, dirPath);
642
+ if (!fs$1.existsSync(fullDir)) continue;
643
+ try {
644
+ const files = fs$1.readdirSync(fullDir).filter((f) => f.endsWith(".ts") && !f.endsWith(".test.ts"));
645
+ for (const file of files) {
646
+ const filePath = path.join(fullDir, file);
647
+ try {
648
+ const lineCount = fs$1.readFileSync(filePath, "utf8").split("\n").length;
649
+ const testFile = path.join(fullDir, file.replace(".ts", ".test.ts"));
650
+ const hasTests = fs$1.existsSync(testFile);
651
+ modules.push({
652
+ path: `${dirPath}/${file}`,
653
+ name: file.replace(".ts", ""),
654
+ description: info.description,
655
+ lineCount,
656
+ hasTests,
657
+ category: info.category
658
+ });
659
+ } catch {}
660
+ }
661
+ } catch {}
662
+ }
663
+ for (const mod of modules) {
664
+ if (!categories[mod.category]) categories[mod.category] = {
665
+ count: 0,
666
+ totalLines: 0
667
+ };
668
+ categories[mod.category].count++;
669
+ categories[mod.category].totalLines += mod.lineCount;
670
+ }
671
+ let version = "unknown";
672
+ try {
673
+ version = JSON.parse(fs$1.readFileSync(path.join(animaRoot, "package.json"), "utf8")).version;
674
+ } catch {}
675
+ const features = getFeatureStatus();
676
+ const map = {
677
+ version,
678
+ generatedAt: Date.now(),
679
+ modules,
680
+ categories,
681
+ features,
682
+ recentChanges: []
683
+ };
684
+ log$11.info(`architecture map: ${modules.length} modules across ${Object.keys(categories).length} categories`);
685
+ return map;
686
+ }
687
+ /**
688
+ * Get current feature enablement status.
689
+ */
690
+ function getFeatureStatus() {
691
+ return [
692
+ {
693
+ name: "P2P Mesh",
694
+ enabled: true,
695
+ module: "src/p2p/mesh.ts",
696
+ description: "E2E encrypted peer-to-peer mesh networking"
697
+ },
698
+ {
699
+ name: "Ego System",
700
+ enabled: true,
701
+ module: "src/affect/ego.ts",
702
+ description: "Agent self-model with integrity scoring"
703
+ },
704
+ {
705
+ name: "Self-Reflection",
706
+ enabled: true,
707
+ module: "src/affect/self-reflection.ts",
708
+ description: "Post-session performance analysis"
709
+ },
710
+ {
711
+ name: "Auto-Update",
712
+ enabled: true,
713
+ module: "src/infra/auto-update.ts",
714
+ description: "Self-updating without npm"
715
+ },
716
+ {
717
+ name: "Atma Failover",
718
+ enabled: true,
719
+ module: "src/infra/atma-failover.ts",
720
+ description: "7-tier model failover chain"
721
+ },
722
+ {
723
+ name: "OpenAI Direct",
724
+ enabled: true,
725
+ module: "src/agents/openai-direct-runner.ts",
726
+ description: "Direct OpenAI API (no Codex CLI)"
727
+ },
728
+ {
729
+ name: "Brain Sync",
730
+ enabled: true,
731
+ module: "src/sync/brain-sync.ts",
732
+ description: "Event-sourced replication with vector clocks"
733
+ },
734
+ {
735
+ name: "Jack In",
736
+ enabled: true,
737
+ module: "src/jack-in/connector.ts",
738
+ description: "NoxSoft platform connectors"
739
+ },
740
+ {
741
+ name: "Governance",
742
+ enabled: true,
743
+ module: "src/ico/governance.ts",
744
+ description: "Token-weighted DAO voting"
745
+ },
746
+ {
747
+ name: "License Gating",
748
+ enabled: true,
749
+ module: "src/license/validator.ts",
750
+ description: "Feature gating by subscription tier"
751
+ },
752
+ {
753
+ name: "SVRN Compute",
754
+ enabled: false,
755
+ module: "src/svrn/compute.ts",
756
+ description: "Decentralized compute via SVRN nodes (planned)"
757
+ }
758
+ ];
759
+ }
760
+ /**
761
+ * Format architecture map for injection into agent context.
762
+ */
763
+ function formatArchitectureForContext(map) {
764
+ const lines = [];
765
+ lines.push(`## Architecture — Anima v${map.version}`);
766
+ lines.push("");
767
+ lines.push("**You are an Anima agent. This is your own architecture.**");
768
+ lines.push("");
769
+ lines.push("| Category | Modules | Lines |");
770
+ lines.push("|----------|---------|-------|");
771
+ for (const [cat, info] of Object.entries(map.categories)) lines.push(`| ${cat} | ${info.count} | ${info.totalLines.toLocaleString()} |`);
772
+ lines.push("");
773
+ lines.push("**Active features:**");
774
+ for (const f of map.features.filter((f) => f.enabled)) lines.push(`- ${f.name}: ${f.description}`);
775
+ const planned = map.features.filter((f) => !f.enabled);
776
+ if (planned.length > 0) {
777
+ lines.push("");
778
+ lines.push("**Planned:**");
779
+ for (const f of planned) lines.push(`- ${f.name}: ${f.description}`);
780
+ }
781
+ const tested = map.modules.filter((m) => m.hasTests).length;
782
+ const total = map.modules.length;
783
+ lines.push("");
784
+ lines.push(`**Test coverage:** ${tested}/${total} modules (${Math.round(tested / total * 100)}%)`);
785
+ return lines.join("\n");
786
+ }
787
+
556
788
  //#endregion
557
789
  //#region src/media/audio.ts
558
790
  const TELEGRAM_VOICE_AUDIO_EXTENSIONS = new Set([
@@ -2570,6 +2802,10 @@ function buildSystemPrompt(params) {
2570
2802
  const steerBlock = formatSteerForContext();
2571
2803
  if (steerBlock) resolvedExtraSystemPrompt = [resolvedExtraSystemPrompt, steerBlock].filter(Boolean).join("\n\n");
2572
2804
  } catch {}
2805
+ try {
2806
+ const archBlock = formatArchitectureForContext(generateArchitectureMap(params.workspaceDir));
2807
+ if (archBlock) resolvedExtraSystemPrompt = [resolvedExtraSystemPrompt, archBlock].filter(Boolean).join("\n\n");
2808
+ } catch {}
2573
2809
  const ttsHint = params.config ? buildTtsSystemPromptHint(params.config) : void 0;
2574
2810
  return buildAgentSystemPrompt({
2575
2811
  workspaceDir: params.workspaceDir,
@@ -41148,7 +41384,7 @@ function loadWebLoginQr() {
41148
41384
  return webLoginQrPromise;
41149
41385
  }
41150
41386
  function loadWebChannel() {
41151
- webChannelPromise ??= import("./web-DzSlI8A6.js");
41387
+ webChannelPromise ??= import("./web-CPPJ5y4c.js");
41152
41388
  return webChannelPromise;
41153
41389
  }
41154
41390
  function loadWhatsAppActions() {
@@ -1,6 +1,6 @@
1
1
  import { n as __exportAll } from "./chunk-BXK9XSlF.js";
2
2
  import { E as getActivePluginRegistry, t as createSubsystemLogger } from "./subsystem-BAADN1B8.js";
3
- import { sn as loadAnimaPlugins } from "./reply-93fMzde1.js";
3
+ import { sn as loadAnimaPlugins } from "./reply-ylwOKuOF.js";
4
4
  import { c as resolveDefaultAgentId, s as resolveAgentWorkspaceDir } from "./agent-scope-CXxC8FFX.js";
5
5
  import { i as loadConfig } from "./config-DaD4FsAn.js";
6
6
 
@@ -2,7 +2,7 @@ import { n as __exportAll } from "./chunk-BXK9XSlF.js";
2
2
  import { dt as getActivePluginRegistry, o as createSubsystemLogger } from "./entry.js";
3
3
  import { c as resolveDefaultAgentId, s as resolveAgentWorkspaceDir } from "./agent-scope-Dm8IL1Ks.js";
4
4
  import { i as loadConfig } from "./config-BrVuTQ8R.js";
5
- import { m as loadAnimaPlugins } from "./subagent-registry-fLI7QDKe.js";
5
+ import { m as loadAnimaPlugins } from "./subagent-registry-CDEUbtey.js";
6
6
 
7
7
  //#region src/cli/plugin-registry.ts
8
8
  var plugin_registry_exports = /* @__PURE__ */ __exportAll({ ensurePluginRegistryLoaded: () => ensurePluginRegistryLoaded });
@@ -5,7 +5,7 @@ import { z } from "zod";
5
5
  import fs$1, { readFileSync } from "node:fs";
6
6
  import os from "node:os";
7
7
  import { Logger } from "tslog";
8
- import json5 from "json5";
8
+ import JSON5 from "json5";
9
9
  import chalk, { Chalk } from "chalk";
10
10
  import { execFile, execFileSync } from "node:child_process";
11
11
  import { isDeepStrictEqual, promisify } from "node:util";
@@ -1487,7 +1487,7 @@ function readLoggingConfig() {
1487
1487
  try {
1488
1488
  if (!fs$1.existsSync(configPath)) return;
1489
1489
  const raw = fs$1.readFileSync(configPath, "utf-8");
1490
- const logging = json5.parse(raw)?.logging;
1490
+ const logging = JSON5.parse(raw)?.logging;
1491
1491
  if (!logging || typeof logging !== "object" || Array.isArray(logging)) return;
1492
1492
  return logging;
1493
1493
  } catch {
@@ -5093,7 +5093,7 @@ var IncludeProcessor = class IncludeProcessor {
5093
5093
  };
5094
5094
  const defaultResolver = {
5095
5095
  readFile: (p) => fs$1.readFileSync(p, "utf-8"),
5096
- parseJson: (raw) => json5.parse(raw)
5096
+ parseJson: (raw) => JSON5.parse(raw)
5097
5097
  };
5098
5098
  /**
5099
5099
  * Resolves all $include directives in a parsed config object.
@@ -7983,7 +7983,7 @@ function resolveConfigPathForDeps(deps) {
7983
7983
  function normalizeDeps(overrides = {}) {
7984
7984
  return {
7985
7985
  fs: overrides.fs ?? fs$1,
7986
- json5: overrides.json5 ?? json5,
7986
+ json5: overrides.json5 ?? JSON5,
7987
7987
  env: overrides.env ?? process.env,
7988
7988
  homedir: overrides.homedir ?? (() => resolveRequiredHomeDir(overrides.env ?? process.env, os.homedir)),
7989
7989
  configPath: overrides.configPath ?? "",
@@ -7994,11 +7994,11 @@ function maybeLoadDotEnvForConfig(env) {
7994
7994
  if (env !== process.env) return;
7995
7995
  loadDotEnv({ quiet: true });
7996
7996
  }
7997
- function parseConfigJson5(raw, json5$1 = json5) {
7997
+ function parseConfigJson5(raw, json5 = JSON5) {
7998
7998
  try {
7999
7999
  return {
8000
8000
  ok: true,
8001
- parsed: json5$1.parse(raw)
8001
+ parsed: json5.parse(raw)
8002
8002
  };
8003
8003
  } catch (err) {
8004
8004
  return {
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Architecture Awareness — Anima knows its own structure
3
+ *
4
+ * Generates a live map of the Anima codebase so agents understand
5
+ * their own architecture. This is injected into context when agents
6
+ * need to reason about or modify themselves.
7
+ *
8
+ * Components:
9
+ * - Module map: what each directory/file does
10
+ * - Dependency graph: what imports what
11
+ * - Feature flags: what's enabled/disabled
12
+ * - Version info: what version, what changed recently
13
+ */
14
+ export interface ModuleInfo {
15
+ path: string;
16
+ name: string;
17
+ description: string;
18
+ lineCount: number;
19
+ hasTests: boolean;
20
+ category: ModuleCategory;
21
+ }
22
+ export type ModuleCategory = "core" | "agent" | "gateway" | "p2p" | "affect" | "org" | "sync" | "jack-in" | "infra" | "license" | "ico" | "ui" | "other";
23
+ export interface ArchitectureMap {
24
+ version: string;
25
+ generatedAt: number;
26
+ modules: ModuleInfo[];
27
+ categories: Record<ModuleCategory, {
28
+ count: number;
29
+ totalLines: number;
30
+ }>;
31
+ features: FeatureStatus[];
32
+ recentChanges: string[];
33
+ }
34
+ export interface FeatureStatus {
35
+ name: string;
36
+ enabled: boolean;
37
+ module: string;
38
+ description: string;
39
+ }
40
+ /**
41
+ * Generate a complete architecture map of the Anima codebase.
42
+ */
43
+ export declare function generateArchitectureMap(animaRoot: string): ArchitectureMap;
44
+ /**
45
+ * Format architecture map for injection into agent context.
46
+ */
47
+ export declare function formatArchitectureForContext(map: ArchitectureMap): string;
@@ -14,10 +14,10 @@ import "./shell-env-2QqHvBMl.js";
14
14
  import "./client-CfLiulzK.js";
15
15
  import "./call-B4lhqS6H.js";
16
16
  import "./message-channel-DIHHKJhk.js";
17
- import "./subagent-registry-fLI7QDKe.js";
17
+ import "./subagent-registry-CDEUbtey.js";
18
18
  import "./sessions-C_3wTmSA.js";
19
19
  import "./tokens-CmlI2hSz.js";
20
- import "./anthropic-direct-runner-DizCei79.js";
20
+ import "./anthropic-direct-runner-Bu8w-wlJ.js";
21
21
  import "./pi-embedded-helpers-D2SLlgS4.js";
22
22
  import "./sandbox-D-N7M7lp.js";
23
23
  import "./chrome-CmxIwwsr.js";
@@ -58,7 +58,7 @@ import { t as renderTable } from "./table-Bt7rSYC6.js";
58
58
  import "./skill-scanner-Dld2ijVw.js";
59
59
  import { i as resolveArchiveKind } from "./archive-CNqghdwQ.js";
60
60
  import "./npm-registry-spec-jf7Mowdn.js";
61
- import { t as buildPluginStatusReport } from "./status-COc4xMti.js";
61
+ import { t as buildPluginStatusReport } from "./status-CDcFjNtS.js";
62
62
  import { i as resolvePluginInstallDir, n as installPluginFromNpmSpec, r as installPluginFromPath, t as recordPluginInstall } from "./installs-a4Vz_J08.js";
63
63
  import { n as updateNpmInstalledPlugins } from "./update-DA91za97.js";
64
64
  import os from "node:os";
@@ -2,7 +2,7 @@ import { m as resolveStateDir } from "./paths-zhVksOvm.js";
2
2
  import { V as theme, d as defaultRuntime } from "./subsystem-BAADN1B8.js";
3
3
  import { C as shortenHomePath, S as shortenHomeInString, _ as resolveConfigDir, b as resolveUserPath } from "./utils-CLYlhJuc.js";
4
4
  import "./pi-embedded-helpers-BZ9GspxK.js";
5
- import "./reply-93fMzde1.js";
5
+ import "./reply-ylwOKuOF.js";
6
6
  import "./exec-BylR5qWS.js";
7
7
  import "./agent-scope-CXxC8FFX.js";
8
8
  import "./model-selection-CY6r_3wt.js";
@@ -29,7 +29,7 @@ import "./auth-profiles-C-LuhW6c.js";
29
29
  import "./file-lock-Z53aFHvY.js";
30
30
  import "./model-auth-CHB3EySM.js";
31
31
  import "./tokens-SP2Q7i59.js";
32
- import "./anthropic-direct-runner-OjcTAH6g.js";
32
+ import "./anthropic-direct-runner-C5pnwYzT.js";
33
33
  import "./deliver-BKzX3YoN.js";
34
34
  import "./memory-cli-DLtBA6r5.js";
35
35
  import "./manager-D8VCuzru.js";
@@ -59,7 +59,7 @@ import { t as renderTable } from "./table-Blmz7glr.js";
59
59
  import "./skill-scanner-5_Y3u6SU.js";
60
60
  import { i as resolveArchiveKind } from "./archive-D-dHRz-v.js";
61
61
  import "./npm-registry-spec-Br4B4I_3.js";
62
- import { t as buildPluginStatusReport } from "./status-C_NBOv_V.js";
62
+ import { t as buildPluginStatusReport } from "./status-CobgQziJ.js";
63
63
  import { i as resolvePluginInstallDir, n as installPluginFromNpmSpec, r as installPluginFromPath, t as recordPluginInstall } from "./installs-Bi6UipiE.js";
64
64
  import { n as updateNpmInstalledPlugins } from "./update-CqKpX3cX.js";
65
65
  import fs from "node:fs";
@@ -26,7 +26,7 @@ const entries = [
26
26
  name: "gateway",
27
27
  description: "ANIMA Gateway management and control",
28
28
  register: async (program) => {
29
- (await import("./gateway-cli-CEM1vBuk.js")).registerGatewayCli(program);
29
+ (await import("./gateway-cli-CFlPUx9N.js")).registerGatewayCli(program);
30
30
  }
31
31
  },
32
32
  {
@@ -47,7 +47,7 @@ const entries = [
47
47
  name: "models",
48
48
  description: "Model discovery, switching, and provider configuration",
49
49
  register: async (program) => {
50
- (await import("./models-cli-D7eSsPuk.js")).registerModelsCli(program);
50
+ (await import("./models-cli-1Kj8gkGy.js")).registerModelsCli(program);
51
51
  }
52
52
  },
53
53
  {
@@ -110,7 +110,7 @@ const entries = [
110
110
  name: "hooks",
111
111
  description: "Agent hook lifecycle and dependency management",
112
112
  register: async (program) => {
113
- (await import("./hooks-cli-DSlPBQSY.js")).registerHooksCli(program);
113
+ (await import("./hooks-cli-D6YfDiUI.js")).registerHooksCli(program);
114
114
  }
115
115
  },
116
116
  {
@@ -124,8 +124,8 @@ const entries = [
124
124
  name: "plugins",
125
125
  description: "Install, update, and manage ANIMA extensions",
126
126
  register: async (program) => {
127
- (await import("./plugins-cli-CoVt2ewg.js")).registerPluginsCli(program);
128
- const { registerPluginCliCommands } = await import("./cli-Cuq4bIg4.js");
127
+ (await import("./plugins-cli-BQmysVFP.js")).registerPluginsCli(program);
128
+ const { registerPluginCliCommands } = await import("./cli-C7mOU26p.js");
129
129
  registerPluginCliCommands(program, await loadConfig());
130
130
  }
131
131
  },
@@ -147,14 +147,14 @@ const entries = [
147
147
  name: "update",
148
148
  description: "Update ANIMA to the latest version",
149
149
  register: async (program) => {
150
- (await import("./update-cli-DEe62XGU.js")).registerUpdateCli(program);
150
+ (await import("./update-cli-QtM0G6CE.js")).registerUpdateCli(program);
151
151
  }
152
152
  },
153
153
  {
154
154
  name: "completion",
155
155
  description: "Generate shell completion for tab-complete support",
156
156
  register: async (program) => {
157
- (await import("./completion-cli-BtvcR-U5.js").then((n) => n.n)).registerCompletionCli(program);
157
+ (await import("./completion-cli-Cpj91U30.js").then((n) => n.n)).registerCompletionCli(program);
158
158
  }
159
159
  }
160
160
  ];
@@ -222,7 +222,7 @@ const coreEntries = [
222
222
  description: "Initialize ANIMA config and the agent workspace"
223
223
  }],
224
224
  register: async ({ program }) => {
225
- (await import("./register.setup-DlVH7FKe.js")).registerSetupCommand(program);
225
+ (await import("./register.setup-BSm6O1ml.js")).registerSetupCommand(program);
226
226
  }
227
227
  },
228
228
  {
@@ -231,7 +231,7 @@ const coreEntries = [
231
231
  description: "Interactive wizard for Gateway, workspace, and skills setup"
232
232
  }],
233
233
  register: async ({ program }) => {
234
- (await import("./register.onboard-6CbODzQ6.js")).registerOnboardCommand(program);
234
+ (await import("./register.onboard-CwkY7CRm.js")).registerOnboardCommand(program);
235
235
  }
236
236
  },
237
237
  {
@@ -240,7 +240,7 @@ const coreEntries = [
240
240
  description: "Interactive configuration for NoxSoft, memory, heartbeat, and identity"
241
241
  }],
242
242
  register: async ({ program }) => {
243
- (await import("./register.configure-CuzJxZmk.js")).registerConfigureCommand(program);
243
+ (await import("./register.configure-Cs3uLUBo.js")).registerConfigureCommand(program);
244
244
  }
245
245
  },
246
246
  {
@@ -249,7 +249,7 @@ const coreEntries = [
249
249
  description: "Advanced and complete settings for Gateway and CLI"
250
250
  }],
251
251
  register: async ({ program }) => {
252
- (await import("./settings-cli-CZdlEmNi.js")).registerSettingsCli(program);
252
+ (await import("./settings-cli-T66kDBNA.js")).registerSettingsCli(program);
253
253
  }
254
254
  },
255
255
  {
@@ -258,7 +258,7 @@ const coreEntries = [
258
258
  description: "Read, write, and manage ANIMA configuration"
259
259
  }],
260
260
  register: async ({ program }) => {
261
- (await import("./config-cli-DfHE3KG-.js")).registerConfigCli(program);
261
+ (await import("./config-cli-Dmd4Oyjp.js")).registerConfigCli(program);
262
262
  }
263
263
  },
264
264
  {
@@ -267,7 +267,7 @@ const coreEntries = [
267
267
  description: "Diagnose and repair Gateway and daemon issues"
268
268
  }],
269
269
  register: async ({ program }) => {
270
- (await import("./register.maintenance-Dla0H12S.js")).registerMaintenanceCommands(program);
270
+ (await import("./register.maintenance-DqAdzWBM.js")).registerMaintenanceCommands(program);
271
271
  }
272
272
  },
273
273
  {
@@ -288,7 +288,7 @@ const coreEntries = [
288
288
  description: "Manage isolated agent workspaces, auth, and routing"
289
289
  }],
290
290
  register: async ({ program, ctx }) => {
291
- (await import("./register.agent-DnkOx0U8.js")).registerAgentCommands(program, { agentChannelOptions: ctx.agentChannelOptions });
291
+ (await import("./register.agent-CzEM3bkp.js")).registerAgentCommands(program, { agentChannelOptions: ctx.agentChannelOptions });
292
292
  }
293
293
  },
294
294
  {
@@ -297,7 +297,7 @@ const coreEntries = [
297
297
  description: "Send messages and perform channel actions"
298
298
  }],
299
299
  register: async ({ program, ctx }) => {
300
- (await import("./register.message-Brtushvp.js")).registerMessageCommands(program, ctx);
300
+ (await import("./register.message-ACbKb7JS.js")).registerMessageCommands(program, ctx);
301
301
  }
302
302
  },
303
303
  {
@@ -316,7 +316,7 @@ const coreEntries = [
316
316
  }
317
317
  ],
318
318
  register: async ({ program }) => {
319
- (await import("./register.status-health-sessions-CduFjFDB.js")).registerStatusHealthSessionsCommands(program);
319
+ (await import("./register.status-health-sessions-DAl9OeGB.js")).registerStatusHealthSessionsCommands(program);
320
320
  }
321
321
  },
322
322
  {
@@ -325,7 +325,7 @@ const coreEntries = [
325
325
  description: "Set your Anthropic API key — the fastest way to get started"
326
326
  }],
327
327
  register: async ({ program }) => {
328
- const { setupTokenCommand, hasAnthropicToken, autoDetectToken } = await import("./setup-token-Lee4gM5w.js");
328
+ const { setupTokenCommand, hasAnthropicToken, autoDetectToken } = await import("./setup-token-6DSKE0Tn.js");
329
329
  program.command("setup-token").description("Set your Anthropic API key — no claude CLI login needed").option("--token <key>", "Anthropic API key (sk-ant-api01-... or sk-ant-oat01-...)").option("--skip-validation", "Skip live API check (use if offline)").option("--json", "Output JSON result", false).addHelpText("after", `
330
330
  Examples:
331
331
  anima setup-token # Interactive — prompts for key + validates
@@ -380,7 +380,7 @@ Examples:
380
380
  }
381
381
  ],
382
382
  register: async ({ program }) => {
383
- (await import("./register.anima-B36rTHUt.js")).registerAnimaCommands(program);
383
+ (await import("./register.anima-RI6gewtj.js")).registerAnimaCommands(program);
384
384
  }
385
385
  }
386
386
  ];
@@ -15,10 +15,10 @@ import "./shell-env-2QqHvBMl.js";
15
15
  import "./client-CfLiulzK.js";
16
16
  import "./call-B4lhqS6H.js";
17
17
  import "./message-channel-DIHHKJhk.js";
18
- import "./subagent-registry-fLI7QDKe.js";
18
+ import "./subagent-registry-CDEUbtey.js";
19
19
  import "./sessions-C_3wTmSA.js";
20
20
  import "./tokens-CmlI2hSz.js";
21
- import "./anthropic-direct-runner-DizCei79.js";
21
+ import "./anthropic-direct-runner-Bu8w-wlJ.js";
22
22
  import "./pi-embedded-helpers-D2SLlgS4.js";
23
23
  import "./sandbox-D-N7M7lp.js";
24
24
  import "./chrome-CmxIwwsr.js";
@@ -55,13 +55,13 @@ import { t as formatDocsLink } from "./links-BjjDMNIq.js";
55
55
  import "./progress-glCgu57m.js";
56
56
  import "./logging-DWwOqnTW.js";
57
57
  import "./auth-store-BEfSfCbW.js";
58
- import "./register.subclis-CtANqD5P.js";
59
- import { i as registerProgramCommands } from "./command-registry-9V4uqrBV.js";
58
+ import "./register.subclis-DEFeoyPP.js";
59
+ import { i as registerProgramCommands } from "./command-registry-DUTqrmna.js";
60
60
  import { r as setProgramContext } from "./program-context-Dw8HDTRz.js";
61
61
  import { r as listChannelPluginCatalogEntries } from "./catalog-B-TAbJ2o.js";
62
62
  import { t as forceFreePort } from "./ports-BGLuwt2Z.js";
63
- import { t as ensurePluginRegistryLoaded } from "./plugin-registry-Do2D1nDk.js";
64
- import { n as formatCliBannerLine, r as hasEmittedCliBanner, t as emitCliBanner } from "./banner-Dpa5d1If.js";
63
+ import { t as ensurePluginRegistryLoaded } from "./plugin-registry-DKexyPAq.js";
64
+ import { n as formatCliBannerLine, r as hasEmittedCliBanner, t as emitCliBanner } from "./banner-XT5N0ZF4.js";
65
65
  import { Command } from "commander";
66
66
 
67
67
  //#region src/cli/channel-options.ts
@@ -210,7 +210,7 @@ function registerPreActionHooks(program, programVersion) {
210
210
  await ensureNoxsoftBootstrapPersisted({ agent: auth.agent });
211
211
  }
212
212
  if (PLUGIN_REQUIRED_COMMANDS.has(commandPath[0])) {
213
- const { ensurePluginRegistryLoaded } = await import("./plugin-registry-Do2D1nDk.js").then((n) => n.n);
213
+ const { ensurePluginRegistryLoaded } = await import("./plugin-registry-DKexyPAq.js").then((n) => n.n);
214
214
  ensurePluginRegistryLoaded();
215
215
  }
216
216
  });