@teevee98/synapse-hub 4.1.4 → 4.2.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 (116) hide show
  1. package/.agents/rules/git-push-protocol.md +2 -2
  2. package/.agents/skills/01-web-automation/auth-session-and-cookie-manager/SKILL.md +6 -1
  3. package/.agents/skills/01-web-automation/bats-testing-patterns/SKILL.md +6 -1
  4. package/.agents/skills/01-web-automation/clean-pom-crafter/SKILL.md +8 -3
  5. package/.agents/skills/01-web-automation/e2e-testing-patterns/SKILL.md +6 -1
  6. package/.agents/skills/01-web-automation/katalon-cli-runner/SKILL.md +6 -1
  7. package/.agents/skills/01-web-automation/lam-script-generator/SKILL.md +6 -1
  8. package/.agents/skills/01-web-automation/mobile-appium-som/SKILL.md +6 -1
  9. package/.agents/skills/01-web-automation/mobile-appium-som/examples/BaseScreen.java +2 -2
  10. package/.agents/skills/01-web-automation/mobile-appium-som/examples/LoginScreen.java +2 -2
  11. package/.agents/skills/01-web-automation/mobile-appium-som/examples/TC_MobileLogin.java +2 -2
  12. package/.agents/skills/01-web-automation/playwright-live-interaction/SKILL.md +7 -2
  13. package/.agents/skills/01-web-automation/playwright-webapp-testing/SKILL.md +6 -1
  14. package/.agents/skills/01-web-automation/web-agent-gym-benchmarking/SKILL.md +6 -1
  15. package/.agents/skills/02-test-design/architecture-decision-records/SKILL.md +6 -1
  16. package/.agents/skills/02-test-design/gherkin-to-suite/SKILL.md +6 -1
  17. package/.agents/skills/02-test-design/rbt-manual-testing/SKILL.md +6 -1
  18. package/.agents/skills/02-test-design/review-spec/SKILL.md +4 -1
  19. package/.agents/skills/02-test-design/tot-exploratory-testing/SKILL.md +6 -1
  20. package/.agents/skills/03-api-and-contracts/api-network-mocking-interception/SKILL.md +6 -1
  21. package/.agents/skills/03-api-and-contracts/api-spec-to-e2e-matrix/SKILL.md +6 -1
  22. package/.agents/skills/03-api-and-contracts/consumer-driven-contract-testing/SKILL.md +7 -2
  23. package/.agents/skills/04-performance-and-load/backend-load-and-stress-patterns/SKILL.md +7 -2
  24. package/.agents/skills/04-performance-and-load/lean-impact-scoreboard/SKILL.md +4 -1
  25. package/.agents/skills/04-performance-and-load/web-vitals-and-performance-profiler/SKILL.md +6 -1
  26. package/.agents/skills/05-security-and-compliance/security-dast-sentinel/SKILL.md +6 -1
  27. package/.agents/skills/05-security-and-compliance/skillspector-security-guard/SKILL.md +6 -1
  28. package/.agents/skills/05-security-and-compliance/wcag-audit-patterns/SKILL.md +6 -1
  29. package/.agents/skills/06-healing-and-resilience/agentless-qa-repair/SKILL.md +6 -1
  30. package/.agents/skills/06-healing-and-resilience/antigravity-test-sentinel/SKILL.md +6 -1
  31. package/.agents/skills/06-healing-and-resilience/failure-autopsy-and-healing/SKILL.md +7 -2
  32. package/.agents/skills/06-healing-and-resilience/flaky-test-sentinel-and-quarantine/SKILL.md +6 -1
  33. package/.agents/skills/06-healing-and-resilience/self-healing-locator/SKILL.md +6 -1
  34. package/.agents/skills/06-healing-and-resilience/systematic-debugging/SKILL.md +6 -1
  35. package/.agents/skills/06-healing-and-resilience/test-driven-development/SKILL.md +6 -1
  36. package/.agents/skills/06-healing-and-resilience/verification-before-completion/SKILL.md +6 -1
  37. package/.agents/skills/06-healing-and-resilience/visual-regression-sentinel/SKILL.md +6 -1
  38. package/.agents/skills/07-data-and-state/db-state-verifier-and-seeder/SKILL.md +6 -1
  39. package/.agents/skills/07-data-and-state/file-and-report-validator/SKILL.md +6 -1
  40. package/.agents/skills/07-data-and-state/synthetic-test-data-generator/SKILL.md +6 -1
  41. package/.agents/skills/08-code-quality/code-refactoring-refactor-clean/SKILL.md +6 -1
  42. package/.agents/skills/08-code-quality/graphify-impact-analyzer/SKILL.md +6 -1
  43. package/.agents/skills/08-code-quality/lean-code-ladder/SKILL.md +6 -1
  44. package/.agents/skills/08-code-quality/repo-quality-audit/SKILL.md +4 -1
  45. package/.agents/skills/08-code-quality/senior-code-review/SKILL.md +4 -1
  46. package/.agents/skills/08-code-quality/surgical-coding-principles/SKILL.md +6 -1
  47. package/.agents/skills/08-code-quality/technical-debt-harvester/SKILL.md +4 -1
  48. package/.agents/skills/09-ci-and-devops/github-actions-templates/SKILL.md +6 -1
  49. package/.agents/skills/10-agent-orchestration/actor-qa-swarm/SKILL.md +6 -1
  50. package/.agents/skills/10-agent-orchestration/agent-orchestration-multi-agent-optimize/SKILL.md +6 -1
  51. package/.agents/skills/10-agent-orchestration/event-stream-qa-orchestrator/SKILL.md +6 -1
  52. package/.agents/skills/10-agent-orchestration/persistent-planning-files/SKILL.md +6 -1
  53. package/.agents/skills/10-agent-orchestration/qa-memory-os/SKILL.md +6 -1
  54. package/.agents/skills/11-ai-and-prompting/meta-prompt-crafter/SKILL.md +6 -1
  55. package/.agents/skills/11-ai-and-prompting/mipro-prompt-compiler/SKILL.md +6 -1
  56. package/.agents/skills/11-ai-and-prompting/qa-aci-interface/SKILL.md +6 -1
  57. package/.agents/skills/11-ai-and-prompting/token-and-context-optimizer/SKILL.md +6 -1
  58. package/AGENTS.md +7 -1
  59. package/LICENSE +5 -5
  60. package/NOTICE +1 -1
  61. package/README.en.md +4 -4
  62. package/README.md +4 -4
  63. package/agentskills.json +1 -1
  64. package/docs/ARCHITECTURE.en.md +2 -2
  65. package/docs/ARCHITECTURE.md +11 -2
  66. package/docs/CLI_REFERENCE.en.md +6 -4
  67. package/docs/CLI_REFERENCE.md +1 -1
  68. package/docs/CONTRIBUTING.en.md +1 -1
  69. package/docs/CONTRIBUTING.md +2 -2
  70. package/docs/TOOL_CATALOG.md +6 -2
  71. package/docs/research/agent_skill_training_analysis.md +1 -1
  72. package/package.json +1 -1
  73. package/plugin.json +1 -1
  74. package/skills_manifest.json +320 -55
  75. package/synapse.config.json +1 -1
  76. package/templates/ui/index.html +2 -2
  77. package/tools/TOOL_CATALOG.json +63 -3
  78. package/tools/__init__.py +1 -1
  79. package/tools/api_fuzzer.py +179 -118
  80. package/tools/author_integrity.py +121 -11
  81. package/tools/benchmark_swarm_context.py +119 -18
  82. package/tools/break_ui_generator.py +233 -0
  83. package/tools/browser_helpers.js +2 -2
  84. package/tools/check_version_sync.py +18 -50
  85. package/tools/cli.py +109 -18
  86. package/tools/core/bm25_retriever.py +218 -0
  87. package/tools/core/i18n.py +4 -4
  88. package/tools/core/provider_usage_adapter.py +317 -0
  89. package/tools/core/token_estimator.py +42 -14
  90. package/tools/count_tokens.py +5 -0
  91. package/tools/coverage_reporter.py +245 -0
  92. package/tools/dashboard_generator.py +6 -6
  93. package/tools/db_sandbox.py +146 -4
  94. package/tools/distill_skill.py +191 -0
  95. package/tools/git_pre_commit_guard.py +12 -0
  96. package/tools/humanize_linter.py +3 -0
  97. package/tools/mcp_docx_server.py +1 -1
  98. package/tools/mcp_excel_server.py +1 -1
  99. package/tools/mcp_server.py +75 -15
  100. package/tools/micro_mutator.py +84 -14
  101. package/tools/pentest_scope_guard.py +399 -56
  102. package/tools/perf/benchmark_perf_runner.py +42 -0
  103. package/tools/rules_router.py +401 -41
  104. package/tools/security_scanner.py +80 -0
  105. package/tools/senior_code_review.py +14 -0
  106. package/tools/skill_canonical_digest.py +244 -0
  107. package/tools/skill_profiles.py +77 -7
  108. package/tools/slide_deck_exporter.py +477 -0
  109. package/tools/sync_skills_manifest.py +166 -0
  110. package/tools/task_memory_manager.py +260 -0
  111. package/tools/ui_server.py +1 -1
  112. package/tools/update_sentinel.py +3 -3
  113. package/tools/validate_host_interop.py +485 -0
  114. package/tools/validate_skills_schema.py +282 -0
  115. package/tools/verify_all.py +572 -42
  116. package/tools/welcome_page.py +2 -2
@@ -0,0 +1,260 @@
1
+ #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ # -*- coding: utf-8 -*-
6
+ """
7
+ tools/task_memory_manager.py — Compaction-Resilient Working Memory Manager
8
+ Inspired by OthmanAdi/planning-with-files (28.1k ⭐).
9
+
10
+ Maintains disk-persistent working memory across agent compactions and sessions:
11
+ - task_plan.md: Strategic goal, phases, and active state.
12
+ - findings.md: Empirical discovery, DOM selectors, diagnostic evidence.
13
+ - progress.md: Checklists, milestones, step-by-step audit log.
14
+ - .checksums.json: SHA-256 cryptographic verification of file integrity.
15
+
16
+ 100% Python Standard Library (zero external dependencies).
17
+ """
18
+
19
+ import argparse
20
+ import datetime
21
+ import hashlib
22
+ import json
23
+ import os
24
+ import sys
25
+ from typing import Any, Dict, Optional, Tuple
26
+
27
+ DEFAULT_MEMORY_DIR = ".task_memory"
28
+
29
+
30
+ def compute_sha256(content: str) -> str:
31
+ """Computes SHA-256 hexadecimal digest for a string content."""
32
+ return hashlib.sha256(content.encode("utf-8")).hexdigest()
33
+
34
+
35
+ def compute_file_sha256(file_path: str) -> Optional[str]:
36
+ """Computes SHA-256 for a file on disk."""
37
+ if not os.path.isfile(file_path):
38
+ return None
39
+ with open(file_path, "r", encoding="utf-8") as f:
40
+ return hashlib.sha256(f.read().encode("utf-8")).hexdigest()
41
+
42
+
43
+ class TaskMemoryManager:
44
+ """Manages disk-persistent working memory files with cryptographic checksums."""
45
+
46
+ def __init__(self, memory_dir: str = DEFAULT_MEMORY_DIR):
47
+ self.memory_dir = os.path.abspath(memory_dir)
48
+ self.plan_path = os.path.join(self.memory_dir, "task_plan.md")
49
+ self.findings_path = os.path.join(self.memory_dir, "findings.md")
50
+ self.progress_path = os.path.join(self.memory_dir, "progress.md")
51
+ self.checksums_path = os.path.join(self.memory_dir, ".checksums.json")
52
+
53
+ def _read_checksums(self) -> Dict[str, str]:
54
+ if not os.path.isfile(self.checksums_path):
55
+ return {}
56
+ for _ in range(5):
57
+ try:
58
+ with open(self.checksums_path, "r", encoding="utf-8") as f:
59
+ return json.load(f)
60
+ except (json.JSONDecodeError, OSError):
61
+ continue
62
+ return {}
63
+
64
+ def _write_checksums(self, checksums: Dict[str, str]) -> None:
65
+ tmp_path = self.checksums_path + ".tmp"
66
+ actual_tmp = f"{tmp_path}.{os.getpid()}_{id(checksums)}"
67
+ with open(actual_tmp, "w", encoding="utf-8") as f:
68
+ json.dump(checksums, f, indent=2, ensure_ascii=False)
69
+ os.replace(actual_tmp, self.checksums_path)
70
+
71
+ def _update_file_checksum(self, filename: str, content: str) -> None:
72
+ checksums = self._read_checksums()
73
+ checksums[filename] = compute_sha256(content)
74
+ self._write_checksums(checksums)
75
+
76
+ def init_memory(self, title: str = "Task Execution Plan", goal: str = "Execute task according to DoD") -> Dict[str, str]:
77
+ """Initializes empty memory files if they do not exist."""
78
+ os.makedirs(self.memory_dir, exist_ok=True)
79
+ now = datetime.datetime.now(datetime.timezone.utc).isoformat()
80
+
81
+ if not os.path.isfile(self.plan_path):
82
+ initial_plan = (
83
+ f"# {title}\n\n"
84
+ f"> Initialized: `{now}`\n\n"
85
+ f"## 1. Goal & Requirements\n{goal}\n\n"
86
+ f"## 2. Phases & Milestones\n- [ ] Phase 1: Discovery & Analysis\n- [ ] Phase 2: Implementation\n- [ ] Phase 3: Verification & DoD\n\n"
87
+ f"## 3. Active Status\n`IN_PROGRESS`\n"
88
+ )
89
+ with open(self.plan_path, "w", encoding="utf-8") as f:
90
+ f.write(initial_plan)
91
+ self._update_file_checksum("task_plan.md", initial_plan)
92
+
93
+ if not os.path.isfile(self.findings_path):
94
+ initial_findings = (
95
+ f"# Empirical Findings & Evidence Log\n\n"
96
+ f"> Initialized: `{now}`\n\n"
97
+ f"| Timestamp | Category | Summary | Details |\n"
98
+ f"|---|---|---|---|\n"
99
+ )
100
+ with open(self.findings_path, "w", encoding="utf-8") as f:
101
+ f.write(initial_findings)
102
+ self._update_file_checksum("findings.md", initial_findings)
103
+
104
+ if not os.path.isfile(self.progress_path):
105
+ initial_progress = (
106
+ f"# Execution Progress & Milestone Ledger\n\n"
107
+ f"> Initialized: `{now}`\n\n"
108
+ f"## Milestones\n"
109
+ f"- [x] Task memory initialized (`{now}`)\n"
110
+ )
111
+ with open(self.progress_path, "w", encoding="utf-8") as f:
112
+ f.write(initial_progress)
113
+ self._update_file_checksum("progress.md", initial_progress)
114
+
115
+ return self._read_checksums()
116
+
117
+ def update_task_plan(self, content: str) -> str:
118
+ """Overwrites or updates task_plan.md and recomputes checksum."""
119
+ os.makedirs(self.memory_dir, exist_ok=True)
120
+ with open(self.plan_path, "w", encoding="utf-8") as f:
121
+ f.write(content)
122
+ sha = compute_sha256(content)
123
+ self._update_file_checksum("task_plan.md", content)
124
+ return sha
125
+
126
+ def record_finding(self, title: str, details: str, category: str = "OBSERVATION") -> None:
127
+ """Appends an empirical finding or diagnostic evidence to findings.md."""
128
+ os.makedirs(self.memory_dir, exist_ok=True)
129
+ now = datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d %H:%M:%S UTC")
130
+ sanitized_title = str(title).replace("\r", " ").replace("\n", " ").replace("|", "/")
131
+ sanitized_cat = str(category).replace("\r", " ").replace("\n", " ").replace("|", "/")
132
+ sanitized_details = str(details).replace("\r", " ").replace("\n", " ").replace("|", "/")
133
+ row = f"| `{now}` | `{sanitized_cat}` | **{sanitized_title}** | {sanitized_details} |\n"
134
+
135
+ if not os.path.isfile(self.findings_path):
136
+ self.init_memory()
137
+
138
+ with open(self.findings_path, "a", encoding="utf-8") as f:
139
+ f.write(row)
140
+
141
+ with open(self.findings_path, "r", encoding="utf-8") as f:
142
+ content = f.read()
143
+ self._update_file_checksum("findings.md", content)
144
+
145
+ def record_progress(self, step: str, status: str = "DONE") -> None:
146
+ """Records a completed step or milestone in progress.md."""
147
+ os.makedirs(self.memory_dir, exist_ok=True)
148
+ now = datetime.datetime.now(datetime.timezone.utc).strftime("%H:%M:%S UTC")
149
+ sanitized_step = str(step).replace("\r", " ").replace("\n", " ")
150
+ sanitized_status = str(status).replace("\r", " ").replace("\n", " ")
151
+ mark = "[x]" if sanitized_status.upper() in ("DONE", "COMPLETED", "PASS") else "[-]"
152
+ entry = f"- {mark} `{now}` {sanitized_step} (`{sanitized_status}`)\n"
153
+
154
+ if not os.path.isfile(self.progress_path):
155
+ self.init_memory()
156
+
157
+ with open(self.progress_path, "a", encoding="utf-8") as f:
158
+ f.write(entry)
159
+
160
+ with open(self.progress_path, "r", encoding="utf-8") as f:
161
+ content = f.read()
162
+ self._update_file_checksum("progress.md", content)
163
+
164
+ def verify_integrity(self) -> Tuple[bool, Dict[str, Dict[str, Any]]]:
165
+ """
166
+ Verifies SHA-256 hashes of all memory files against recorded checksums.
167
+ Returns: (all_valid, details_map)
168
+ """
169
+ checksums = self._read_checksums()
170
+ results: Dict[str, Dict[str, Any]] = {}
171
+ all_valid = True
172
+
173
+ files = [
174
+ ("task_plan.md", self.plan_path),
175
+ ("findings.md", self.findings_path),
176
+ ("progress.md", self.progress_path),
177
+ ]
178
+
179
+ for fname, fpath in files:
180
+ expected = checksums.get(fname)
181
+ actual = compute_file_sha256(fpath)
182
+ valid = (actual is not None) and (actual == expected)
183
+ if not valid:
184
+ all_valid = False
185
+ results[fname] = {
186
+ "exists": os.path.isfile(fpath),
187
+ "expected_sha256": expected,
188
+ "actual_sha256": actual,
189
+ "valid": valid,
190
+ }
191
+
192
+ return all_valid, results
193
+
194
+ def export_summary(self) -> str:
195
+ """Exports a compact text summary of working memory state."""
196
+ valid, details = self.verify_integrity()
197
+ lines = [
198
+ f"Task Memory Status: {'VALID (100% SHA-256 Match)' if valid else 'COMPROMISED / MODIFIED'}",
199
+ f"Location: {self.memory_dir}",
200
+ ]
201
+ for fname, info in details.items():
202
+ status = "OK" if info["valid"] else "MISMATCH / MISSING"
203
+ lines.append(f" - {fname}: {status} (SHA: {str(info['actual_sha256'])[:8]}...)")
204
+ return "\n".join(lines)
205
+
206
+
207
+ def main() -> int:
208
+ parser = argparse.ArgumentParser(description="Compaction-Resilient Working Memory Manager (OthmanAdi Pattern)")
209
+ subparsers = parser.add_subparsers(dest="command", required=True)
210
+
211
+ # init
212
+ init_p = subparsers.add_parser("init", help="Initialize memory files")
213
+ init_p.add_argument("--dir", default=DEFAULT_MEMORY_DIR, help="Memory directory")
214
+ init_p.add_argument("--title", default="Task Execution Plan", help="Plan title")
215
+
216
+ # finding
217
+ finding_p = subparsers.add_parser("finding", help="Record finding")
218
+ finding_p.add_argument("title", help="Finding title")
219
+ finding_p.add_argument("details", help="Details text")
220
+ finding_p.add_argument("--dir", default=DEFAULT_MEMORY_DIR, help="Memory directory")
221
+ finding_p.add_argument("--cat", default="OBSERVATION", help="Category")
222
+
223
+ # progress
224
+ progress_p = subparsers.add_parser("progress", help="Record progress milestone")
225
+ progress_p.add_argument("step", help="Completed step description")
226
+ progress_p.add_argument("--dir", default=DEFAULT_MEMORY_DIR, help="Memory directory")
227
+ progress_p.add_argument("--status", default="DONE", help="Step status")
228
+
229
+ # verify
230
+ verify_p = subparsers.add_parser("verify", help="Verify cryptographic integrity")
231
+ verify_p.add_argument("--dir", default=DEFAULT_MEMORY_DIR, help="Memory directory")
232
+
233
+ args = parser.parse_args()
234
+ mgr = TaskMemoryManager(args.dir)
235
+
236
+ if args.command == "init":
237
+ res = mgr.init_memory(title=args.title)
238
+ print(f"✅ Initialized task memory in {args.dir} with checksums: {list(res.keys())}")
239
+ return 0
240
+
241
+ if args.command == "finding":
242
+ mgr.record_finding(title=args.title, details=args.details, category=args.cat)
243
+ print(f"✅ Recorded finding: '{args.title}' in {args.dir}/findings.md")
244
+ return 0
245
+
246
+ if args.command == "progress":
247
+ mgr.record_progress(step=args.step, status=args.status)
248
+ print(f"✅ Recorded progress: '{args.step}' in {args.dir}/progress.md")
249
+ return 0
250
+
251
+ if args.command == "verify":
252
+ valid, details = mgr.verify_integrity()
253
+ print(mgr.export_summary())
254
+ return 0 if valid else 1
255
+
256
+ return -1
257
+
258
+
259
+ if __name__ == "__main__":
260
+ sys.exit(main())
@@ -236,7 +236,7 @@ class SynapseUiHandler(BaseHTTPRequestHandler):
236
236
  if path == "/api/status":
237
237
  active_target = JOB_MANAGER.target_dir or REPO_ROOT
238
238
  self.send_json(200, {
239
- "version": "4.1.4",
239
+ "version": "4.2.0",
240
240
  "status": "ONLINE",
241
241
  "os": sys.platform,
242
242
  "workspace": active_target,
@@ -68,7 +68,7 @@ def get_local_version():
68
68
  try:
69
69
  with open(pkg_file, "r", encoding="utf-8") as f:
70
70
  data = json.load(f)
71
- return data.get("version", "4.1.4")
71
+ return data.get("version", "4.2.0")
72
72
  except (OSError, json.JSONDecodeError):
73
73
  data = {}
74
74
 
@@ -77,11 +77,11 @@ def get_local_version():
77
77
  try:
78
78
  with open(manifest_file, "r", encoding="utf-8") as f:
79
79
  data = json.load(f)
80
- return data.get("version", "4.1.4")
80
+ return data.get("version", "4.2.0")
81
81
  except (OSError, json.JSONDecodeError):
82
82
  data = {}
83
83
 
84
- return "4.1.4"
84
+ return "4.2.0"
85
85
 
86
86
 
87
87
  def fetch_remote_version():