Teknium
04c1c5d53f
refactor: extract shared helpers to deduplicate repeated code patterns (#7917)
* refactor: add shared helper modules for code deduplication
New modules:
- gateway/platforms/helpers.py: MessageDeduplicator, TextBatchAggregator,
strip_markdown, ThreadParticipationTracker, redact_phone
- hermes_cli/cli_output.py: print_info/success/warning/error, prompt helpers
- tools/path_security.py: validate_within_dir, has_traversal_component
- utils.py additions: safe_json_loads, read_json_file, read_jsonl,
append_jsonl, env_str/lower/int/bool helpers
- hermes_constants.py additions: get_config_path, get_skills_dir,
get_logs_dir, get_env_path
* refactor: migrate gateway adapters to shared helpers
- MessageDeduplicator: discord, slack, dingtalk, wecom, weixin, mattermost
- strip_markdown: bluebubbles, feishu, sms
- redact_phone: sms, signal
- ThreadParticipationTracker: discord, matrix
- _acquire/_release_platform_lock: telegram, discord, slack, whatsapp,
signal, weixin
Net -316 lines across 19 files.
* refactor: migrate CLI modules to shared helpers
- tools_config.py: use cli_output print/prompt + curses_radiolist (-117 lines)
- setup.py: use cli_output print helpers + curses_radiolist (-101 lines)
- mcp_config.py: use cli_output prompt (-15 lines)
- memory_setup.py: use curses_radiolist (-86 lines)
Net -263 lines across 5 files.
* refactor: migrate to shared utility helpers
- safe_json_loads: agent/display.py (4 sites)
- get_config_path: skill_utils.py, hermes_logging.py, hermes_time.py
- get_skills_dir: skill_utils.py, prompt_builder.py
- Token estimation dedup: skills_tool.py imports from model_metadata
- Path security: skills_tool, cronjob_tools, skill_manager_tool, credential_files
- Non-atomic YAML writes: doctor.py, config.py now use atomic_yaml_write
- Platform dict: new platforms.py, skills_config + tools_config derive from it
- Anthropic key: new get_anthropic_key() in auth.py, used by doctor/status/config/main
* test: update tests for shared helper migrations
- test_dingtalk: use _dedup.is_duplicate() instead of _is_duplicate()
- test_mattermost: use _dedup instead of _seen_posts/_prune_seen
- test_signal: import redact_phone from helpers instead of signal
- test_discord_connect: _platform_lock_identity instead of _token_lock_identity
- test_telegram_conflict: updated lock error message format
- test_skill_manager_tool: 'escapes' instead of 'boundary' in error msgs
2026-04-11 13:59:52 -07:00
..
2026-02-26 03:20:08 +03:00
2026-04-10 21:18:34 -07:00
2026-03-26 13:19:43 -07:00
2026-03-29 21:29:13 -07:00
2026-04-10 16:51:44 -07:00
2026-04-05 12:31:10 -07:00
2026-04-07 03:28:44 -07:00
2026-04-11 13:47:25 -07:00
2026-04-11 02:03:20 -07:00
2026-04-01 12:05:02 -07:00
2026-04-10 03:52:00 -07:00
2026-03-17 03:52:15 -07:00
2026-04-10 03:52:00 -07:00
2026-04-10 03:21:45 -07:00
2026-04-06 13:20:01 -07:00
2026-04-10 03:52:00 -07:00
2026-04-10 21:16:53 -07:00
2026-03-13 23:59:18 -07:00
2026-04-05 19:46:58 -07:00
2026-04-10 03:44:43 -07:00
2026-04-11 13:59:52 -07:00
2026-03-09 02:20:57 -07:00
2026-04-09 23:25:27 -07:00
2026-04-10 05:19:26 -07:00
2026-04-11 13:59:52 -07:00
2026-04-09 02:26:33 -07:00
2026-04-11 13:59:52 -07:00
2026-03-14 09:32:05 -07:00
2026-03-13 08:52:54 -07:00
2026-03-14 14:27:21 +03:00
2026-04-10 03:52:00 -07:00
2026-04-08 17:08:40 -07:00
2026-04-03 10:24:07 -07:00
2026-04-09 23:25:27 -07:00
2026-03-23 06:50:09 -07:00
2026-04-11 13:59:52 -07:00
2026-04-03 18:20:50 -07:00
2026-04-03 13:16:26 -07:00
2026-03-29 15:38:32 -07:00
2026-03-17 01:47:34 -07:00
2026-04-10 21:16:56 -07:00
2026-04-10 05:54:56 -07:00
2026-04-07 22:45:14 -07:00
2026-04-06 16:54:16 -07:00
2026-04-03 13:10:11 -07:00
2026-04-08 20:01:06 -07:00
2026-04-10 21:18:34 -07:00
2026-03-13 07:40:38 -07:00
2026-03-29 20:05:59 -07:00
2026-04-11 13:46:16 -07:00
2026-03-15 03:50:45 -07:00
2026-04-11 13:59:52 -07:00
2026-04-10 21:15:59 -07:00
2026-04-11 11:12:20 -07:00
2026-04-11 13:59:52 -07:00
2026-04-10 05:04:28 -07:00
2026-02-28 03:38:27 -05:00
2026-03-11 09:15:34 +01:00
2026-04-10 03:07:00 -07:00
2026-04-10 02:58:42 -07:00
2026-03-05 18:39:37 -08:00
2026-04-10 03:44:43 -07:00
2026-03-14 21:28:51 -07:00
2026-04-10 05:04:28 -07:00
2026-04-07 09:58:45 -07:00
2026-03-22 04:56:13 -07:00
2026-04-08 03:36:44 -07:00
2026-04-10 21:18:34 -07:00
2026-04-11 03:11:34 -07:00
2026-03-14 21:19:22 -07:00
2026-03-10 23:34:52 -07:00
2026-04-10 03:52:00 -07:00
2026-03-28 14:25:12 -07:00
2026-04-10 03:52:00 -07:00
2026-03-27 04:03:13 -07:00
2026-04-04 19:05:34 -07:00
2026-04-10 21:18:34 -07:00
2026-04-10 03:01:59 -07:00
2026-04-11 13:46:16 -07:00
2026-03-30 19:17:07 -07:00
2026-03-26 19:27:58 -07:00
2026-04-11 03:11:34 -07:00
2026-04-06 13:20:01 -07:00
2026-04-10 21:18:34 -07:00
2026-03-22 09:33:39 -07:00
2026-04-10 03:44:43 -07:00
2026-04-11 13:59:52 -07:00
2026-04-07 11:12:08 -07:00
2026-04-09 14:07:32 -07:00
2026-04-10 05:04:28 -07:00
2026-03-17 03:14:53 -07:00
2026-03-27 11:33:19 -07:00
2026-03-15 23:04:34 -07:00
2026-04-07 17:27:09 -07:00
2026-04-10 03:52:00 -07:00
2026-04-02 20:54:27 -07:00
2026-03-01 05:28:12 -08:00
2026-04-10 03:52:00 -07:00
2026-04-10 03:27:30 -07:00
2026-04-07 17:19:07 -07:00
2026-04-07 14:08:59 -07:00
2026-04-11 13:59:52 -07:00
2026-04-03 13:16:26 -07:00
2026-03-27 04:03:13 -07:00
2026-03-29 21:53:59 -07:00
2026-03-27 04:03:13 -07:00
2026-03-28 14:23:27 -07:00
2026-03-15 03:50:45 -07:00
2026-04-10 05:34:33 -07:00
2026-03-27 04:03:13 -07:00
2026-03-17 02:49:57 -07:00
2026-04-05 11:59:28 -07:00
2026-04-09 23:25:27 -07:00
2026-03-14 14:27:20 +03:00
2026-03-04 21:34:40 +03:00
2026-03-31 10:42:03 -07:00
2026-04-05 11:59:28 -07:00
2026-04-05 00:28:58 -07:00
2026-04-05 00:28:58 -07:00
2026-04-10 02:33:01 -07:00
2026-03-26 14:41:04 -07:00
2026-04-03 10:24:07 -07:00
2026-04-07 17:27:09 -07:00
2026-03-28 14:33:35 -07:00
2026-04-07 17:27:09 -07:00
2026-04-09 23:25:27 -07:00
2026-04-11 13:48:25 -07:00
2026-03-29 16:25:20 -07:00
2026-04-03 01:16:39 -07:00
2026-03-17 10:44:37 -07:00
2026-04-05 11:07:47 -07:00
2026-04-10 03:38:44 -07:00