@sayue_ltr/fleq 1.50.1 → 2.0.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.
- package/CHANGELOG.md +174 -0
- package/README.md +42 -6
- package/dist/config.js +37 -4
- package/dist/dmdata/rest-client.js +58 -3
- package/dist/dmdata/telegram-parser.js +115 -64
- package/dist/dmdata/ws-client.js +49 -18
- package/dist/engine/cli/cli-run.js +88 -3
- package/dist/engine/cli/cli.js +12 -0
- package/dist/engine/eew/eew-tracker.js +41 -15
- package/dist/engine/filter/compile-filter.js +21 -0
- package/dist/engine/filter/compiler.js +188 -0
- package/dist/engine/filter/errors.js +41 -0
- package/dist/engine/filter/field-registry.js +78 -0
- package/dist/engine/filter/index.js +15 -0
- package/dist/engine/filter/parser.js +137 -0
- package/dist/engine/filter/rank-maps.js +34 -0
- package/dist/engine/filter/tokenizer.js +121 -0
- package/dist/engine/filter/type-checker.js +104 -0
- package/dist/engine/filter/types.js +2 -0
- package/dist/engine/filter-template/pipeline-controller.js +73 -0
- package/dist/engine/filter-template/pipeline.js +16 -0
- package/dist/engine/messages/display-callbacks.js +7 -0
- package/dist/engine/messages/message-router.js +114 -182
- package/dist/engine/messages/summary-tracker.js +106 -0
- package/dist/engine/messages/telegram-stats.js +103 -0
- package/dist/engine/messages/volcano-route-handler.js +122 -0
- package/dist/engine/monitor/monitor.js +52 -4
- package/dist/engine/monitor/shutdown.js +1 -0
- package/dist/engine/notification/notifier.js +21 -4
- package/dist/engine/notification/sound-player.js +398 -36
- package/dist/engine/presentation/diff-store.js +158 -0
- package/dist/engine/presentation/diff-types.js +2 -0
- package/dist/engine/presentation/events/from-earthquake.js +53 -0
- package/dist/engine/presentation/events/from-eew.js +72 -0
- package/dist/engine/presentation/events/from-lg-observation.js +58 -0
- package/dist/engine/presentation/events/from-nankai-trough.js +39 -0
- package/dist/engine/presentation/events/from-raw.js +35 -0
- package/dist/engine/presentation/events/from-seismic-text.js +37 -0
- package/dist/engine/presentation/events/from-tsunami.js +51 -0
- package/dist/engine/presentation/events/from-volcano.js +88 -0
- package/dist/engine/presentation/events/to-presentation-event.js +32 -0
- package/dist/engine/presentation/level-helpers.js +118 -0
- package/dist/engine/presentation/processors/process-earthquake.js +36 -0
- package/dist/engine/presentation/processors/process-eew.js +105 -0
- package/dist/engine/presentation/processors/process-lg-observation.js +30 -0
- package/dist/engine/presentation/processors/process-message.js +53 -0
- package/dist/engine/presentation/processors/process-nankai-trough.js +30 -0
- package/dist/engine/presentation/processors/process-raw.js +22 -0
- package/dist/engine/presentation/processors/process-seismic-text.js +30 -0
- package/dist/engine/presentation/processors/process-tsunami.js +42 -0
- package/dist/engine/presentation/processors/process-volcano.js +41 -0
- package/dist/engine/presentation/types.js +2 -0
- package/dist/engine/startup/config-resolver.js +2 -0
- package/dist/engine/template/compile-template.js +18 -0
- package/dist/engine/template/compiler.js +105 -0
- package/dist/engine/template/field-accessor.js +31 -0
- package/dist/engine/template/filters.js +100 -0
- package/dist/engine/template/index.js +5 -0
- package/dist/engine/template/parser.js +185 -0
- package/dist/engine/template/tokenizer.js +96 -0
- package/dist/engine/template/types.js +2 -0
- package/dist/types.js +3 -2
- package/dist/ui/display-adapter.js +60 -0
- package/dist/ui/earthquake-formatter.js +22 -5
- package/dist/ui/eew-formatter.js +25 -10
- package/dist/ui/formatter.js +116 -32
- package/dist/ui/minimap/grid-layout.js +91 -0
- package/dist/ui/minimap/index.js +16 -0
- package/dist/ui/minimap/minimap-renderer.js +277 -0
- package/dist/ui/minimap/pref-mapping.js +82 -0
- package/dist/ui/minimap/types.js +2 -0
- package/dist/ui/night-overlay.js +56 -0
- package/dist/ui/repl-handlers/command-definitions.js +327 -0
- package/dist/ui/repl-handlers/index.js +11 -0
- package/dist/ui/repl-handlers/info-handlers.js +633 -0
- package/dist/ui/repl-handlers/operation-handlers.js +233 -0
- package/dist/ui/repl-handlers/settings-handlers.js +927 -0
- package/dist/ui/repl-handlers/types.js +10 -0
- package/dist/ui/repl.js +81 -1752
- package/dist/ui/statistics-formatter.js +258 -0
- package/dist/ui/status-line.js +80 -0
- package/dist/ui/summary/index.js +5 -0
- package/dist/ui/summary/summary-line.js +18 -0
- package/dist/ui/summary/summary-model.js +31 -0
- package/dist/ui/summary/token-builders.js +317 -0
- package/dist/ui/summary/types.js +2 -0
- package/dist/ui/summary/width-fit.js +41 -0
- package/dist/ui/summary-interval-formatter.js +72 -0
- package/dist/ui/test-samples.js +6 -0
- package/dist/ui/theme.js +43 -5
- package/dist/ui/tip-shuffler.js +81 -0
- package/dist/ui/volcano-formatter.js +15 -13
- package/dist/ui/waiting-tips-eew.js +63 -0
- package/dist/ui/waiting-tips-info-systems.js +81 -0
- package/dist/ui/waiting-tips-seismology.js +97 -0
- package/dist/ui/waiting-tips-tsunami.js +72 -0
- package/dist/ui/waiting-tips-weather.js +189 -0
- package/dist/ui/waiting-tips.js +420 -249
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,180 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [2.0.0](https://github.com/Lateo2580/FlEq/compare/v1.51.0...v2.0.0) (2026-04-25)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
* **policy:** --event-log / --event-log-raw / --no-event-log の
|
|
11
|
+
CLI オプションが廃止された。eventLog / eventLogRaw 設定キーも廃止。
|
|
12
|
+
これらの機能に依存している外部利用者は、削除前バージョン (v1.52.x)
|
|
13
|
+
を pin するか、自身で private fork を保持して継続利用すること。
|
|
14
|
+
|
|
15
|
+
次回リリースは major bump (v2.0.0) として npm run release:major で
|
|
16
|
+
発行する想定。
|
|
17
|
+
|
|
18
|
+
関連: 段階1 (baf0b41)
|
|
19
|
+
|
|
20
|
+
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|
21
|
+
|
|
22
|
+
### 機能追加
|
|
23
|
+
|
|
24
|
+
* **cli:** add --event-log and --event-log-raw flags ([f046653](https://github.com/Lateo2580/FlEq/commit/f046653df9c42d88f0362bdeb34dc87bcdf999f3))
|
|
25
|
+
* **cli:** show eventLog status in startup banner ([07d509f](https://github.com/Lateo2580/FlEq/commit/07d509fda93cfc0e4f1d83b9208e5dc0e86e9270))
|
|
26
|
+
* **cli:** 起動バナーに音声バックエンドの健康状態を表示 ([30a070e](https://github.com/Lateo2580/FlEq/commit/30a070e0fa97c8c034269c608a050500b058ce6d))
|
|
27
|
+
* clock コマンド・ヘルプ・status 表示を uptime 対応に ([f362927](https://github.com/Lateo2580/FlEq/commit/f362927c84515770b609628c2ced7ba0cf19004f))
|
|
28
|
+
* commands コマンド新設 — help から一覧表示を分離 ([0eb81c1](https://github.com/Lateo2580/FlEq/commit/0eb81c1fe335617e6346657a0d9bf1cacca0b387))
|
|
29
|
+
* **config:** add eventLog and eventLogRaw configuration ([db1f376](https://github.com/Lateo2580/FlEq/commit/db1f376648e705c61d1439f85e75fdde17a74810))
|
|
30
|
+
* EEW isWarning 判定を XML ベースに移行 (classification はフォールバック) ([c2087cd](https://github.com/Lateo2580/FlEq/commit/c2087cd931a31af603cadd4eff90a0a33bac833f))
|
|
31
|
+
* Event File Writer — write telegrams as individual JSON files ([0ebbd0c](https://github.com/Lateo2580/FlEq/commit/0ebbd0cb21e33d03cb97f7c6a78f996941dbfcad))
|
|
32
|
+
* formatUptime 関数を追加 (DDD:HH:MM:SS, dim ゼロ桁) ([a694522](https://github.com/Lateo2580/FlEq/commit/a6945227cc1c3c1d16728356075aae4e9765301b))
|
|
33
|
+
* implement EventFileWriter with atomic write ([e05e9cb](https://github.com/Lateo2580/FlEq/commit/e05e9cb66cd61e9af049b2c6e8d2beed7c1f50e8))
|
|
34
|
+
* **monitor:** apply eventLog config to EventFileWriter on startup ([12c251b](https://github.com/Lateo2580/FlEq/commit/12c251b1c298d4f8f0446ec93576d8904bed091b))
|
|
35
|
+
* ParsedEarthquakeInfo に eventId を追加し、地震情報表示に EventID 行を表示 ([7562377](https://github.com/Lateo2580/FlEq/commit/756237726821e2c48ceed4a58ba2ce62ce3270b8))
|
|
36
|
+
* **policy:** dmdata.jp 再配信ポリシー対応の段階1実装 ([baf0b41](https://github.com/Lateo2580/FlEq/commit/baf0b4135878ab6400554bc7c790ddd4c8be6cdc))
|
|
37
|
+
* processEew に suppressed kind を追加 (VXSE45 優先時) ([e65b33e](https://github.com/Lateo2580/FlEq/commit/e65b33e6d7ab7480bd13359a7da21661b78a40a7))
|
|
38
|
+
* PromptClock 型に uptime を追加 ([d7c2829](https://github.com/Lateo2580/FlEq/commit/d7c2829487b78ebf993c4188ec1054d74b8ad071))
|
|
39
|
+
* **repl:** add eventlog command ([874a679](https://github.com/Lateo2580/FlEq/commit/874a679eb4b12d8bba330a205d11a117ab8de2e9))
|
|
40
|
+
* **sound:** checkSoundBackend で実再生プローブによる健康チェックを追加 ([46c391c](https://github.com/Lateo2580/FlEq/commit/46c391cb3222e5200594e27040f2f9214aace123))
|
|
41
|
+
* **sound:** process.uptime ベースの単調時計ヘルパーを追加 ([6cfc195](https://github.com/Lateo2580/FlEq/commit/6cfc195bf2540f0c6586ad22be8159824fdde49f))
|
|
42
|
+
* **sound:** 起動直後 60 秒以内の再生失敗を 20 秒後に自動リトライ ([9b86ff9](https://github.com/Lateo2580/FlEq/commit/9b86ff96111bc18066e0f4aaba7f0f513fd07b1e))
|
|
43
|
+
* **sound:** 再生失敗系ログを debug から warn に格上げ ([fd9f1d5](https://github.com/Lateo2580/FlEq/commit/fd9f1d5dc07ba234bbdb9cb0cb76bd9015662673))
|
|
44
|
+
* StatusLine で uptime モード表示に対応 (未接続時も表示) ([55c93c7](https://github.com/Lateo2580/FlEq/commit/55c93c7733d5e31fccd5f47944e37736aaa5ec41))
|
|
45
|
+
* wire EventFileWriter into message-router and VolcanoRouteHandler ([a1107e0](https://github.com/Lateo2580/FlEq/commit/a1107e00db7adbfdd81c3e377143001c7542e8ce))
|
|
46
|
+
* wrap-up コマンド新設 + Codex CLI フラグ更新 + commit リマインド hook 追加 ([68dac86](https://github.com/Lateo2580/FlEq/commit/68dac861fc17e95ce1fb6ac9cb0c43bc5bc62592))
|
|
47
|
+
* 警報昇格通知をイベント単位の isUpgradeToWarning に変更 ([2e338dd](https://github.com/Lateo2580/FlEq/commit/2e338dd797f4c814da8209505f2d1e2a822e951b))
|
|
48
|
+
* 待機中Tipsに火山カテゴリを追加 (+78項目) ([0f619bb](https://github.com/Lateo2580/FlEq/commit/0f619bb87eb663f611ea461d2002040a0fedafe6))
|
|
49
|
+
* 待機中Tipsに気象カテゴリを追加 (警報・予報・定時報) ([deda85e](https://github.com/Lateo2580/FlEq/commit/deda85e46f1b154248a919ac623c3e81ea5d1048))
|
|
50
|
+
* 待機中Tipsを大幅拡充 — 新8カテゴリ+229件追加 (444→673件) ([bac458a](https://github.com/Lateo2580/FlEq/commit/bac458a556ddaa807f558fcf57cc0199b10c2a40))
|
|
51
|
+
* 統計表示にテーマロールベースのカラーリングを追加 ([d816b17](https://github.com/Lateo2580/FlEq/commit/d816b1766f3b25c2cbd199ee54248df995ef3121))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### バグ修正
|
|
55
|
+
|
|
56
|
+
* **cli:** let --no-event-log override --event-log-raw ([fe5226e](https://github.com/Lateo2580/FlEq/commit/fe5226e13ccf7d3c8357c925cdff5466755a340f))
|
|
57
|
+
* **eew:** isWarning 観測ログを真の仕様不整合のみに絞る ([be1757c](https://github.com/Lateo2580/FlEq/commit/be1757cabf7ae22b7c8045e316477ad338fac049))
|
|
58
|
+
* **event-file-writer:** prevent collision and enforce maxFiles strictly ([a7227d6](https://github.com/Lateo2580/FlEq/commit/a7227d6f6b619fcd5a5ddfbf972aa143a5c5ff63))
|
|
59
|
+
* formatUptime の日部分を文字レベルで dim 表示する ([67d5c70](https://github.com/Lateo2580/FlEq/commit/67d5c700a35d48b97de2c7534392ef33109af59c))
|
|
60
|
+
* **monitor:** drain EventFileWriter queue on shutdown ([6cd0fc2](https://github.com/Lateo2580/FlEq/commit/6cd0fc2836e51c43218202ea51257a18cdb8056b))
|
|
61
|
+
* processMessage の EEW suppressed 結果ハンドリングを追加 ([3b5f48f](https://github.com/Lateo2580/FlEq/commit/3b5f48f72e627ee0e68372e892959c623bab174b))
|
|
62
|
+
* **sound:** Codex レビュー 2 の指摘を反映 ([3d3fdf1](https://github.com/Lateo2580/FlEq/commit/3d3fdf185a51c43d6519c7fb083a415ffa184249))
|
|
63
|
+
* **sound:** DoneHandle 化で launch 経路の log/bell も二重完了ガードで保護 ([cc5fd1c](https://github.com/Lateo2580/FlEq/commit/cc5fd1c126a38c39585250dd15831f436b2a02b7))
|
|
64
|
+
* **sound:** runPlay の timeout と execFile コールバックによる二重完了を防止 ([b0456dc](https://github.com/Lateo2580/FlEq/commit/b0456dc8f78ea1b7e6d6f62bcc8e4a007fb90aae))
|
|
65
|
+
* VXSE61 の複数 Coordinate ノードから十進度を正しく抽出 ([bdcfb38](https://github.com/Lateo2580/FlEq/commit/bdcfb383f0d34694714fa81da38cee875529e424))
|
|
66
|
+
* 起動メッセージをcommands案内に更新、+マーカーの位置と凡例を改善 ([f13fabd](https://github.com/Lateo2580/FlEq/commit/f13fabd7c688ef9da5b171787de51e5aa80d2c00))
|
|
67
|
+
* 抑制報の hasWarningIssued 更新と終端処理を修正 (Codex レビュー指摘) ([34676ba](https://github.com/Lateo2580/FlEq/commit/34676ba8a5c0d434de387a13b7349740abaaeafb))
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### リファクタリング
|
|
71
|
+
|
|
72
|
+
* codex-design スキルを対立的レビュー方式に刷新 ([6db5a6d](https://github.com/Lateo2580/FlEq/commit/6db5a6d6dd17ca8bcdf0192064458dc866f92752))
|
|
73
|
+
* EewTracker を byType Map ベースに再設計 ([79a606f](https://github.com/Lateo2580/FlEq/commit/79a606fbcb80fe2b15ee5887529140ec9c311f56))
|
|
74
|
+
* **policy:** dmdata.jp 再配信ポリシー対応の段階2 ([cf5c6fb](https://github.com/Lateo2580/FlEq/commit/cf5c6fbe047953ce256827e18ce5a62d74186096))
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
### ドキュメント
|
|
78
|
+
|
|
79
|
+
* EEW再設計に伴う仕様書同期 (5ファイル) ([a4f4b4a](https://github.com/Lateo2580/FlEq/commit/a4f4b4ad15f2c764599078884e50a427f678aa08))
|
|
80
|
+
* uptime モードの Tip・仕様書を同期 ([6b77ae5](https://github.com/Lateo2580/FlEq/commit/6b77ae57298584e7978bdae40cc3c2b86e4ae084))
|
|
81
|
+
* 待機中Tipsを現行機能に同期 (21件追加, 1件修正) ([078e070](https://github.com/Lateo2580/FlEq/commit/078e0708b76e2a89246dac67a2242cd3387558ea))
|
|
82
|
+
|
|
83
|
+
## [1.51.0](https://github.com/Lateo2580/FlEq/compare/v1.50.1...v1.51.0) (2026-03-29)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### 機能追加
|
|
87
|
+
|
|
88
|
+
* **compact:** add width-adaptive summary line display (Phase 3) ([2a747ef](https://github.com/Lateo2580/FlEq/commit/2a747efc12379c72c458a2767e328a83096ed3b4))
|
|
89
|
+
* **diff/focus:** add PresentationDiffStore and focus mode (Phase 4) ([00f7cb3](https://github.com/Lateo2580/FlEq/commit/00f7cb3d65558f92bd34b1bc6e0e73374fe0b5d2))
|
|
90
|
+
* distribute waiting tips across categories with epoch-deck shuffler ([fd87c84](https://github.com/Lateo2580/FlEq/commit/fd87c84b99c0fb83dec47f3205f1d3a0c70213da))
|
|
91
|
+
* **filter/template:** add --filter and --template with REPL support (Phase 2) ([7acad77](https://github.com/Lateo2580/FlEq/commit/7acad777e11cdb0955fba97a8c64d250db40d1d8))
|
|
92
|
+
* **integration:** volcano pipeline + final fixes + documentation ([a2ffae1](https://github.com/Lateo2580/FlEq/commit/a2ffae139eb0893406a0128e04542c3ec0d7e205))
|
|
93
|
+
* **minimap:** add 47-prefecture area-to-pref mapping ([1b0a58a](https://github.com/Lateo2580/FlEq/commit/1b0a58a8926097965dd19d1e559d73cd07fbe6e0))
|
|
94
|
+
* **minimap:** add 47-prefecture grid layout ([eab5f1b](https://github.com/Lateo2580/FlEq/commit/eab5f1b4376bad7bb1b6a31661f3b18dada5f819))
|
|
95
|
+
* **minimap:** add ASCII minimap with 12-block Japan layout (Phase 7) ([195f404](https://github.com/Lateo2580/FlEq/commit/195f404c3fd2b33a2e0aafa9396d45c035a2939b))
|
|
96
|
+
* **minimap:** rewrite renderer for 47-prefecture grid layout ([70d0e95](https://github.com/Lateo2580/FlEq/commit/70d0e95d26cbccb476f73531f510a73ae334f368))
|
|
97
|
+
* **night:** add night mode as theme overlay (Phase 6) ([b206b22](https://github.com/Lateo2580/FlEq/commit/b206b22000666bff18b6ed65aa29352e1bda6434))
|
|
98
|
+
* **presentation:** add PresentationEvent common layer (Phase 1) ([7afdea5](https://github.com/Lateo2580/FlEq/commit/7afdea57960c192996fa10b83fd448a91f8ef87c))
|
|
99
|
+
* **rest:** REST API に指数バックオフ付きリトライ機構を追加 ([3837964](https://github.com/Lateo2580/FlEq/commit/3837964545b064b7ad856d95e5bb3185dc77a586))
|
|
100
|
+
* **site:** add CSS with light/dark theme and navbar/hero styles ([6213fd3](https://github.com/Lateo2580/FlEq/commit/6213fd3dcaa8314f854c31e421372d24b2113e1a))
|
|
101
|
+
* **site:** add dark mode toggle, copy button, smooth scroll ([2fdde07](https://github.com/Lateo2580/FlEq/commit/2fdde0784805e70ca26b88fbfaa367d80bc42625))
|
|
102
|
+
* **site:** add features section with responsive grid ([add41eb](https://github.com/Lateo2580/FlEq/commit/add41ebf6fa0db46e58a2aa40bb82eb8f0930c33))
|
|
103
|
+
* **site:** add footer with links and attribution ([24e055f](https://github.com/Lateo2580/FlEq/commit/24e055faeaba03ed5c9fe92100a658586115b01a))
|
|
104
|
+
* **site:** add HTML skeleton with navbar and hero section ([0de85af](https://github.com/Lateo2580/FlEq/commit/0de85afa569daf9aa9fa471e0f5bf2af9bf72fa5))
|
|
105
|
+
* **site:** add install section with steps, prerequisites, and OS table ([4f2db43](https://github.com/Lateo2580/FlEq/commit/4f2db4327f4c0fdfd010eab1db699f066f7d4807))
|
|
106
|
+
* **site:** add screenshot section with terminal mockup ([a65b381](https://github.com/Lateo2580/FlEq/commit/a65b381e8a4bb7f973a0a9af34c682cef89871f4))
|
|
107
|
+
* **site:** add supported categories section ([af495e3](https://github.com/Lateo2580/FlEq/commit/af495e3df7010d9c8ea5321fa07b7e69163716f4))
|
|
108
|
+
* **site:** finalize responsive breakpoints ([202adc2](https://github.com/Lateo2580/FlEq/commit/202adc230bc1c98c45d2c792dee0eefd7aac4eae))
|
|
109
|
+
* **site:** overhaul output preview with tabbed terminal and update content ([94d5354](https://github.com/Lateo2580/FlEq/commit/94d5354bba04970886492a1a15defa68b79575a4))
|
|
110
|
+
* **stats:** add telegram statistics display (Phase 0) ([9d29b82](https://github.com/Lateo2580/FlEq/commit/9d29b821014e8904bf4979c5da821898fd08a7fd))
|
|
111
|
+
* **summary:** add periodic summary with sparkline (Phase 5) ([fc4879c](https://github.com/Lateo2580/FlEq/commit/fc4879c359f4ff8368a05e01490644451f2ae682))
|
|
112
|
+
* **ui:** add renderGroupedItemList helper for compact area display ([06afba3](https://github.com/Lateo2580/FlEq/commit/06afba3fdb2a70fa3543c8197fab7520f2246144))
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
### バグ修正
|
|
116
|
+
|
|
117
|
+
* **config:** summaryInterval のバリデーションを追加し窓幅を統一 ([0fccdb8](https://github.com/Lateo2580/FlEq/commit/0fccdb838e3b2ea6b34d82adc8e0dc24b36dfdc9))
|
|
118
|
+
* **diff-store:** previous Map に TTL/クリーンアップを追加しメモリ蓄積を防止 ([7b9434a](https://github.com/Lateo2580/FlEq/commit/7b9434a5c502413cd8913db5571586b7ac5edfdd))
|
|
119
|
+
* **filter,template:** ReDoS 対策・実行時 try-catch・パーサ再帰深度制限を追加 ([05d9a6f](https://github.com/Lateo2580/FlEq/commit/05d9a6f545ab1df826c9a9b02aada05a32fbdd24))
|
|
120
|
+
* info-handlers.ts に NotifyCategory の import を追加 ([5ab9df0](https://github.com/Lateo2580/FlEq/commit/5ab9df0d9d20e1aaae70aa8caf4d533420339f17))
|
|
121
|
+
* **monitor:** シャットダウン時に要約タイマーを停止 ([24099b1](https://github.com/Lateo2580/FlEq/commit/24099b1ad024fe30204a016b2a499eb3a510b48e))
|
|
122
|
+
* **router:** volcanoMsgCache に TTL を追加し残留エントリを防止 ([db4c683](https://github.com/Lateo2580/FlEq/commit/db4c683bdea28e468aedad28e3a88822da4305b4))
|
|
123
|
+
* **site:** address code review findings ([28dda04](https://github.com/Lateo2580/FlEq/commit/28dda04158e898255591b2343a03bbb492c32e76))
|
|
124
|
+
* **site:** fix CSS dark mode fallback for no-JS scenarios ([59e3ba1](https://github.com/Lateo2580/FlEq/commit/59e3ba1b8f69263449eed55ddade9b381d137cf8))
|
|
125
|
+
* **sound:** Windows カスタム通知音が再生されないバグを修正 ([69486a8](https://github.com/Lateo2580/FlEq/commit/69486a8c4276080917ea95f2896ff3b9e8d837a8))
|
|
126
|
+
* **telegram-stats:** eewEventIds/earthquakeMaxIntByEvent にサイズ上限を追加 ([7c6ff34](https://github.com/Lateo2580/FlEq/commit/7c6ff34fd7f9474bf8e912163819b6be4dd215a6))
|
|
127
|
+
* **ui:** summary/minimap の PresentationEvent フィールド参照を修正 ([b85e8c1](https://github.com/Lateo2580/FlEq/commit/b85e8c1e0e0b8a9b25b2049fdd687cac70cf8b8e))
|
|
128
|
+
* **ws:** 孤立ソケット防止のため doConnect に多層世代チェックを追加 ([f671708](https://github.com/Lateo2580/FlEq/commit/f67170815b0d712a78aac6d6225801dddf635162))
|
|
129
|
+
* セキュリティ・互換性の修正8件 ([ad557be](https://github.com/Lateo2580/FlEq/commit/ad557bed33136e5adb9c5d8d6f0b3db94e784df9))
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
### パフォーマンス改善
|
|
133
|
+
|
|
134
|
+
* **filter:** 正規表現パターンをコンパイル時にキャッシュ ([545c725](https://github.com/Lateo2580/FlEq/commit/545c725ef3f13f07a2b70aaed512a1358e7fa438))
|
|
135
|
+
* **notifier:** resolveIconPath の結果をキャッシュ ([6e104c9](https://github.com/Lateo2580/FlEq/commit/6e104c933c88b99a3a3a4321516f71d2a99c218f))
|
|
136
|
+
* **sound:** 音声再生を有界キューで直列化しタイムアウトを追加 ([675748b](https://github.com/Lateo2580/FlEq/commit/675748ba5e3cc2eb2257c18a708840a59fa1e4ff))
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
### リファクタリング
|
|
140
|
+
|
|
141
|
+
* apply Claude Code best practices — rules, commands, hooks, slim CLAUDE.md ([9fda668](https://github.com/Lateo2580/FlEq/commit/9fda66837cd107797944e00cc329eabbe8b03ac7))
|
|
142
|
+
* **eew:** use renderGroupedItemList for compact forecast area display ([eb6ef92](https://github.com/Lateo2580/FlEq/commit/eb6ef9234c1a9cc3a5ef6d9ca56770202288e52c))
|
|
143
|
+
* FrameLevel を ui/formatter から types.ts に移動 ([beb7893](https://github.com/Lateo2580/FlEq/commit/beb789352cef9577382ec9402a024046e4d1babc))
|
|
144
|
+
* **minimap:** remove old block-mapping, update exports for v2 ([b75392a](https://github.com/Lateo2580/FlEq/commit/b75392a39a6d5c2f728459a59e184350e814addb))
|
|
145
|
+
* **minimap:** replace BlockId with PrefId (47 prefectures) ([118a3ad](https://github.com/Lateo2580/FlEq/commit/118a3ad952d96c3793625c9590f455c97f7af4dd))
|
|
146
|
+
* **parser:** 6つのparse関数の共通前処理を extractBaseReport に集約 ([8eed90f](https://github.com/Lateo2580/FlEq/commit/8eed90fc946f85820d9ba35104f24897417ee1e8))
|
|
147
|
+
* **repl:** repl.ts を大規模リファクタリング (2,500行→310行) ([abf8253](https://github.com/Lateo2580/FlEq/commit/abf825351ad2ad184ee03b3130b5d147536a6092))
|
|
148
|
+
* **router:** 表示パイプラインを runDisplayPipeline に共通化 ([08b7a84](https://github.com/Lateo2580/FlEq/commit/08b7a84712f4b2834e7b8b3bf571a0b1fd4a2e4f))
|
|
149
|
+
* **ui:** CJK文字幅判定の重複を isWideChar ヘルパーに統合 ([3ad362a](https://github.com/Lateo2580/FlEq/commit/3ad362a2544774593bd2007e2a16cfd765091c16))
|
|
150
|
+
* **ui:** use renderGroupedItemList for compact long-period area display ([44577f6](https://github.com/Lateo2580/FlEq/commit/44577f6f7b13506ce742433f50273ceb03f0a491))
|
|
151
|
+
* **volcano:** use renderSimpleNameList, remove municipality truncation ([6b9a8d6](https://github.com/Lateo2580/FlEq/commit/6b9a8d6b91d89885d3bd61b5420fba3201f8abf4))
|
|
152
|
+
* **ws:** close/error ハンドラの重複処理を onDisconnect に統合 ([fc84374](https://github.com/Lateo2580/FlEq/commit/fc84374d90f0acf5d9a80423f7e522bc11694c0c))
|
|
153
|
+
* アーキテクチャリファクタリング3件 (W8/W7/C2) ([724c2a0](https://github.com/Lateo2580/FlEq/commit/724c2a0b6f4a85cb570e66d4ea621a575eeb3085))
|
|
154
|
+
* 未使用フィールドの削除 ([16e9e12](https://github.com/Lateo2580/FlEq/commit/16e9e1262444c6c42eb759e806af1838d2acbca9))
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
### ドキュメント
|
|
158
|
+
|
|
159
|
+
* add Claude Harness policy and hook configuration ([91f5b54](https://github.com/Lateo2580/FlEq/commit/91f5b54d4912d3a7a0172f7e9864137a62cd99fc))
|
|
160
|
+
* add landing page design spec ([b1acb2b](https://github.com/Lateo2580/FlEq/commit/b1acb2b9ec0476b9621f17f4d64765609903a7a8))
|
|
161
|
+
* add landing page implementation plan ([8afda8a](https://github.com/Lateo2580/FlEq/commit/8afda8af92ef6ba3ad712d65152b67f6895d65f4))
|
|
162
|
+
* Codexレビューのフィードバックを設計・プランに反映 ([1f1c71b](https://github.com/Lateo2580/FlEq/commit/1f1c71baa56b2ea6d96cd3ee1eb03d81450e7f0c))
|
|
163
|
+
* **engine:** engine.md の critical 乖離10件を修正 ([36a598e](https://github.com/Lateo2580/FlEq/commit/36a598e68ff2f57147b1179493109b0836f6fecd)), closes [#3](https://github.com/Lateo2580/FlEq/issues/3)
|
|
164
|
+
* fix GitHub Pages deployment method in landing page spec ([26df90a](https://github.com/Lateo2580/FlEq/commit/26df90a804c9fb1a423164cc459a5395fc7a51fc))
|
|
165
|
+
* **minimap:** add implementation plan and fix spec overlaps ([57b5414](https://github.com/Lateo2580/FlEq/commit/57b541434f45cd0519529494349657668cdc5599))
|
|
166
|
+
* **minimap:** add v2 design spec for prefecture-level ASCII minimap ([20b47d0](https://github.com/Lateo2580/FlEq/commit/20b47d0a7c0835f5fb6c609df4e5ba2ea0f45b74))
|
|
167
|
+
* remove hamburger menu from landing page spec ([756132a](https://github.com/Lateo2580/FlEq/commit/756132abf323a420512b3ea075dab860b146175f))
|
|
168
|
+
* root.md/dmdata.md/display-reference.md の critical 乖離を修正 ([b39fbad](https://github.com/Lateo2580/FlEq/commit/b39fbad9f49951c7696f85c21c082a0eff9215b7))
|
|
169
|
+
* **site:** 対応区分・機能説明を実装と同期 ([4b83a79](https://github.com/Lateo2580/FlEq/commit/4b83a7988e5d10279bae64bfe26805f0bd1cc96a))
|
|
170
|
+
* **specs:** add telegram statistics feature design ([39916a4](https://github.com/Lateo2580/FlEq/commit/39916a42a549694d7a248776f90bb3650f234bbe))
|
|
171
|
+
* **specs:** address Codex review feedback on telegram statistics spec ([5f22851](https://github.com/Lateo2580/FlEq/commit/5f22851500fd2c9c1e7cd19c322fd2c6f3c51b5c))
|
|
172
|
+
* summary コマンドの help 一覧に間隔設定可能な旨を追記 ([e55c769](https://github.com/Lateo2580/FlEq/commit/e55c76920a3ed7d5ee72d02b4dbedfcba9e327f8))
|
|
173
|
+
* **ui:** add JSDoc note about renderSimpleNameList label styling ([5e74594](https://github.com/Lateo2580/FlEq/commit/5e745943e514960f9d398e834664d045e0476a55))
|
|
174
|
+
* **ui:** ui.md の critical 乖離5件を修正 ([d0e336e](https://github.com/Lateo2580/FlEq/commit/d0e336e28ea6dbbf27339a9e38f4accdab9fcb24))
|
|
175
|
+
* ヘルスチェックで検出されたドキュメント乖離31件を解消 ([f428dc7](https://github.com/Lateo2580/FlEq/commit/f428dc7124add03c32d1cff723af5451e45ab952))
|
|
176
|
+
* 総合ヘルスチェック実装プランを追加 ([5767864](https://github.com/Lateo2580/FlEq/commit/5767864ad7bbc75e131315a729b423994adaeb92))
|
|
177
|
+
* 総合ヘルスチェック設計を追加 ([da35d32](https://github.com/Lateo2580/FlEq/commit/da35d32451c8fd9b5b9010395ba0d6039a93f01d))
|
|
178
|
+
|
|
5
179
|
## [1.50.1](https://github.com/Lateo2580/FlEq/compare/v1.50.0...v1.50.1) (2026-03-23)
|
|
6
180
|
|
|
7
181
|
|
package/README.md
CHANGED
|
@@ -13,6 +13,14 @@ npm パッケージ名: `@sayue_ltr/fleq` / CLI コマンド名: `fleq`
|
|
|
13
13
|
- REPL による実行中の設定変更・状態確認
|
|
14
14
|
- CUD 配色準拠のテーマシステム(カスタマイズ可能)
|
|
15
15
|
- Raspberry Pi 等の低メモリ環境でも動作
|
|
16
|
+
- 電文統計(`stats` コマンド)でセッション中の受信状況を一覧表示
|
|
17
|
+
- `--filter` で条件式による電文の絞り込み表示
|
|
18
|
+
- `--template` でユーザー定義テンプレートによる 1 行要約カスタマイズ
|
|
19
|
+
- `--compact` 改善: 端末幅に応じた幅適応型 1 行表示
|
|
20
|
+
- `--focus` で条件に一致しない電文を薄く(dim compact)表示
|
|
21
|
+
- `--summary-interval` で N 分ごとの定期受信要約(sparkline グラフ付き)
|
|
22
|
+
- `--night` ナイトモード(彩度・輝度を抑制、危険色は維持)
|
|
23
|
+
- 地震/EEW/津波の地域情報を ASCII ミニマップ(12 ブロック列島形)で表示
|
|
16
24
|
|
|
17
25
|
## 出力例
|
|
18
26
|
|
|
@@ -36,17 +44,17 @@ FlEq を使うには、以下の準備が必要です。
|
|
|
36
44
|
|
|
37
45
|
| OS | 備考 |
|
|
38
46
|
|----|------|
|
|
39
|
-
|
|
|
47
|
+
| Windows 10+ | メイン開発・テスト環境(ConPTY 対応ターミナル推奨) |
|
|
48
|
+
| macOS 10.13+ | 動作確認済み |
|
|
40
49
|
| Linux (x64 / ARM) | Raspberry Pi 等の ARM デバイスでも動作 |
|
|
41
|
-
| Windows 10+ | ConPTY 対応のターミナルを推奨 |
|
|
42
50
|
|
|
43
51
|
## 受信区分と内容
|
|
44
52
|
|
|
45
53
|
| 区分 | 分類名 | 内容 |
|
|
46
54
|
|------|--------|------|
|
|
47
55
|
| 地震・津波関連 | `telegram.earthquake` | 震度速報、震源情報、震源・震度情報、津波警報等 |
|
|
48
|
-
| 緊急地震速報(予報) | `eew.forecast` | EEW
|
|
49
|
-
| 緊急地震速報(警報) | `eew.warning` | EEW
|
|
56
|
+
| 緊急地震速報(予報) | `eew.forecast` | EEW 予報 |
|
|
57
|
+
| 緊急地震速報(警報) | `eew.warning` | EEW 警報 |
|
|
50
58
|
| 火山関連 | `telegram.volcano` | 噴火警報、噴火速報、降灰予報、火山の状況に関する解説情報等 |
|
|
51
59
|
|
|
52
60
|
## インストール
|
|
@@ -121,6 +129,18 @@ fleq --debug
|
|
|
121
129
|
|
|
122
130
|
# 同一APIキーの既存ソケットを閉じてから接続
|
|
123
131
|
fleq --close-others
|
|
132
|
+
|
|
133
|
+
# EEW 警報だけ表示(通知・統計は全電文が対象)
|
|
134
|
+
fleq --filter 'domain = "eew" and isWarning = true'
|
|
135
|
+
|
|
136
|
+
# テンプレートで 1 行要約をカスタマイズ
|
|
137
|
+
fleq --template '{{title}} {{hypocenterName|default:"-"}} M{{magnitude|default:"-"}} 最大{{maxInt|default:"-"}}'
|
|
138
|
+
|
|
139
|
+
# 震度 4 以上にフォーカス(それ以外は薄く表示)
|
|
140
|
+
fleq --focus 'maxInt >= "4"'
|
|
141
|
+
|
|
142
|
+
# ナイトモード + 30 分ごとの受信要約
|
|
143
|
+
fleq --night --summary-interval 30
|
|
124
144
|
```
|
|
125
145
|
|
|
126
146
|
デフォルトの受信区分は `telegram.earthquake,eew.forecast,eew.warning,telegram.volcano` です。
|
|
@@ -136,6 +156,11 @@ fleq --close-others
|
|
|
136
156
|
| `--keep-existing` | 既存接続を維持(互換オプション。現在はデフォルト動作) | `true` |
|
|
137
157
|
| `--close-others` | 同一 API キーの既存ソケットを閉じてから接続 | `false` |
|
|
138
158
|
| `--mode <mode>` | 表示モード: `normal` / `compact` | `normal` |
|
|
159
|
+
| `--filter <expr>` | 条件式で電文を絞り込み表示(通知・統計には非適用) | なし |
|
|
160
|
+
| `--focus <expr>` | 条件に一致しない電文を dim compact 表示に落とす | なし |
|
|
161
|
+
| `--template <tpl>` | ユーザー定義テンプレートで 1 行要約をカスタマイズ | なし |
|
|
162
|
+
| `--summary-interval <min>` | N 分ごとの定期受信要約を表示(sparkline 付き) | `0`(無効) |
|
|
163
|
+
| `--night` | ナイトモード(彩度・輝度を抑制、危険色は維持) | `false` |
|
|
139
164
|
| `--debug` | デバッグログ表示 | `false` |
|
|
140
165
|
|
|
141
166
|
## 設定
|
|
@@ -177,9 +202,11 @@ fleq config keys # 設定可能キー一覧を表示
|
|
|
177
202
|
| `promptClock` | プロンプト時計: `"elapsed"` (経過時間) / `"clock"` (現在時刻) |
|
|
178
203
|
| `waitTipIntervalMin` | 待機中ヒント表示間隔(分、0 で無効、デフォルト: 30) |
|
|
179
204
|
| `sound` | 通知音の有効/無効 (`true` / `false`) |
|
|
180
|
-
| `eewLog` | EEW ログ記録の有効/無効 (`true` / `false`
|
|
205
|
+
| `eewLog` | EEW ログ記録の有効/無効 (`true` / `false`、デフォルト: `false`。明示 opt-in) |
|
|
181
206
|
| `maxObservations` | 観測点の最大表示件数 (1〜999 / `"off"` で全件表示) |
|
|
182
207
|
| `backup` | EEW 副回線の有効/無効 (`true` / `false`) |
|
|
208
|
+
| `nightMode` | ナイトモードの有効/無効 (`true` / `false`) |
|
|
209
|
+
| `summaryInterval` | 定期受信要約の間隔(分、0 で無効) |
|
|
183
210
|
| `truncation` | 省略表示の上限設定(`truncation.<key> <N>` で個別設定。`fleq config keys` で詳細を確認) |
|
|
184
211
|
|
|
185
212
|
> **補足:** `eewLogFields`(EEW ログの記録項目)と通知カテゴリ設定は、REPL の `eewlog fields` / `notify` コマンドで管理します。
|
|
@@ -226,6 +253,8 @@ Raspberry Pi での常時稼働については [Raspberry Pi 500 セットアッ
|
|
|
226
253
|
| `history [N]` | 地震履歴を取得・表示(デフォルト 10 件、最新が一番下) |
|
|
227
254
|
| `colors` | カラーパレット・震度色の一覧を表示 |
|
|
228
255
|
| `detail [tsunami\|volcano]` | 直近の津波情報または火山警報状態を再表示 |
|
|
256
|
+
| `stats` | セッション中の電文受信統計を表示 |
|
|
257
|
+
| `summary` | 直近の定期受信要約を手動表示 |
|
|
229
258
|
|
|
230
259
|
### ステータス
|
|
231
260
|
| コマンド | 説明 |
|
|
@@ -248,6 +277,12 @@ Raspberry Pi での常時稼働については [Raspberry Pi 500 セットアッ
|
|
|
248
277
|
| `tablewidth [N\|auto]` | テーブル幅の表示・変更(`auto` でターミナル幅に自動追従) |
|
|
249
278
|
| `infotext [full/short]` | お知らせ電文の全文/省略切替 |
|
|
250
279
|
| `tipinterval [N]` | 待機中ヒント表示間隔(分)を表示・変更(0 で無効) |
|
|
280
|
+
| `filter set <expr>` | フィルタ条件を動的に設定 |
|
|
281
|
+
| `filter clear` | フィルタ条件をクリア |
|
|
282
|
+
| `filter test <expr>` | フィルタ式の構文チェック |
|
|
283
|
+
| `focus set <expr>` | フォーカス条件を動的に設定 |
|
|
284
|
+
| `focus clear` | フォーカス条件をクリア |
|
|
285
|
+
| `night [on/off]` | ナイトモードの ON/OFF 切替 |
|
|
251
286
|
| `mode [normal/compact]` | 表示モード切替 |
|
|
252
287
|
| `clock [elapsed/now]` | プロンプト時計の切替(`now` は Config 上の `"clock"` に対応) |
|
|
253
288
|
| `sound [on/off]` | 通知音の ON/OFF 切替 |
|
|
@@ -298,7 +333,7 @@ A: グローバルインストールが完了しているか確認してくだ
|
|
|
298
333
|
A: API キーに必要な権限が付与されているか確認してください。最低限 `socket.start` と、受信する区分に対応する `telegram.get.*` 権限が必要です。dmdata.jp の管理画面で確認できます。
|
|
299
334
|
|
|
300
335
|
**Q: EEW が受信できない**
|
|
301
|
-
A: `eew.forecast` / `eew.warning` の受信には dmdata.jp
|
|
336
|
+
A: `eew.forecast` / `eew.warning` の受信には dmdata.jp の対応する契約が必要です。
|
|
302
337
|
|
|
303
338
|
**Q: 他のデバイスで FlEq を起動したら、既存の接続が切れた**
|
|
304
339
|
A: デバイスごとに異なる `appName` を設定してください。詳しくは「複数デバイスで使う場合」を参照してください。
|
|
@@ -308,6 +343,7 @@ A: `notify-send` がインストールされているか確認してください
|
|
|
308
343
|
|
|
309
344
|
## 関連ドキュメント
|
|
310
345
|
|
|
346
|
+
- [CLI 強化機能ガイド](docs/cli-features.md) — フィルタ・テンプレート・フォーカス等の詳細な使い方
|
|
311
347
|
- [表示リファレンス](docs/display-reference.md) — 電文タイプ別の表示フォーマット一覧
|
|
312
348
|
- [Raspberry Pi 500 セットアップガイド](docs/raspi500-setup-guide.md) — Raspberry Pi での常時稼働セットアップ
|
|
313
349
|
- [内部仕様書](docs/specs/) — アーキテクチャ・電文ルーティング・UI 仕様等の開発者向けドキュメント
|
package/dist/config.js
CHANGED
|
@@ -59,7 +59,7 @@ class ConfigError extends Error {
|
|
|
59
59
|
exports.ConfigError = ConfigError;
|
|
60
60
|
/** 旧Configファイルのディレクトリ (マイグレーション用) */
|
|
61
61
|
const OLD_CONFIG_DIR = path.join(os.homedir(), ".config", "dmdata-monitor");
|
|
62
|
-
/** レガシーConfigディレクトリ (
|
|
62
|
+
/** レガシーConfigディレクトリ (OS 別パス導入前の ~/.config/fleq からのマイグレーション用) */
|
|
63
63
|
const LEGACY_CONFIG_DIR = path.join(os.homedir(), ".config", "fleq");
|
|
64
64
|
/**
|
|
65
65
|
* OS・環境変数・ホームディレクトリからConfigディレクトリを解決する純粋関数。
|
|
@@ -159,7 +159,7 @@ const VALID_TEST_MODES = ["no", "including", "only"];
|
|
|
159
159
|
/** 有効な表示モード */
|
|
160
160
|
const VALID_DISPLAY_MODES = ["normal", "compact"];
|
|
161
161
|
/** 有効なプロンプト時計モード */
|
|
162
|
-
const VALID_PROMPT_CLOCKS = ["elapsed", "clock"];
|
|
162
|
+
const VALID_PROMPT_CLOCKS = ["elapsed", "clock", "uptime"];
|
|
163
163
|
/** 有効な EEW ログ記録項目 */
|
|
164
164
|
exports.VALID_EEW_LOG_FIELDS = [
|
|
165
165
|
"hypocenter",
|
|
@@ -196,7 +196,6 @@ exports.VALID_TRUNCATION_KEYS = [
|
|
|
196
196
|
"volcanoAshfallDetailLines",
|
|
197
197
|
"volcanoAshfallRegularLines",
|
|
198
198
|
"volcanoPreventionLines",
|
|
199
|
-
"volcanoMunicipalities",
|
|
200
199
|
"ashfallAreasQuick",
|
|
201
200
|
"ashfallAreasOther",
|
|
202
201
|
"ashfallPeriodsQuick",
|
|
@@ -215,12 +214,14 @@ const CONFIG_KEYS = {
|
|
|
215
214
|
tableWidth: 'テーブル表示幅 (40〜200 / "auto" でターミナル幅に自動追従)',
|
|
216
215
|
infoFullText: "お知らせ電文の全文表示 (true/false)",
|
|
217
216
|
displayMode: '表示モード: "normal" | "compact"',
|
|
218
|
-
promptClock: 'プロンプト時計: "elapsed" (経過時間) | "clock" (現在時刻)',
|
|
217
|
+
promptClock: 'プロンプト時計: "elapsed" (経過時間) | "clock" (現在時刻) | "uptime" (稼働時間)',
|
|
219
218
|
waitTipIntervalMin: "待機中ヒント表示間隔 (分, 0で無効)",
|
|
220
219
|
sound: "通知音の有効/無効 (true/false)",
|
|
221
220
|
eewLog: "EEWログ記録の有効/無効 (true/false)",
|
|
222
221
|
maxObservations: '観測点の最大表示件数 (1〜999 / "off" で全件表示)',
|
|
223
222
|
backup: "EEW副回線の有効/無効 (true/false)",
|
|
223
|
+
nightMode: "ナイトモードの有効/無効 (true/false)",
|
|
224
|
+
summaryInterval: "定期受信要約の間隔 (分, 1〜1440)",
|
|
224
225
|
truncation: "省略表示の上限設定 (truncation.<key> で個別設定)",
|
|
225
226
|
};
|
|
226
227
|
/** Configファイルのパスを返す */
|
|
@@ -284,6 +285,8 @@ function validateConfig(raw) {
|
|
|
284
285
|
applyNotifySettings(config, raw.notify);
|
|
285
286
|
applyMaxObservations(config, raw.maxObservations);
|
|
286
287
|
applyBooleanField(config, "backup", raw.backup);
|
|
288
|
+
applyBooleanField(config, "nightMode", raw.nightMode);
|
|
289
|
+
applySummaryInterval(config, raw.summaryInterval);
|
|
287
290
|
applyTruncation(config, raw.truncation);
|
|
288
291
|
return config;
|
|
289
292
|
}
|
|
@@ -329,6 +332,11 @@ function applyBooleanField(config, field, value) {
|
|
|
329
332
|
}
|
|
330
333
|
}
|
|
331
334
|
function applyTableWidth(config, value) {
|
|
335
|
+
if (value === "auto") {
|
|
336
|
+
log.warn('config.json の tableWidth に "auto" が指定されていますが、文字列 "auto" は無効です。' +
|
|
337
|
+
"tableWidth を削除するとターミナル幅に自動追従します。");
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
332
340
|
if (typeof value === "number" && value >= 40 && value <= 200) {
|
|
333
341
|
config.tableWidth = value;
|
|
334
342
|
}
|
|
@@ -353,6 +361,14 @@ function applyWaitTipInterval(config, value) {
|
|
|
353
361
|
config.waitTipIntervalMin = value;
|
|
354
362
|
}
|
|
355
363
|
}
|
|
364
|
+
function applySummaryInterval(config, value) {
|
|
365
|
+
if (typeof value === "number" &&
|
|
366
|
+
Number.isInteger(value) &&
|
|
367
|
+
value >= 1 &&
|
|
368
|
+
value <= 1440) {
|
|
369
|
+
config.summaryInterval = value;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
356
372
|
function applyNotifySettings(config, value) {
|
|
357
373
|
if (typeof value !== "object" || value == null || Array.isArray(value)) {
|
|
358
374
|
return;
|
|
@@ -530,6 +546,20 @@ function setConfigValue(key, value) {
|
|
|
530
546
|
}
|
|
531
547
|
config.backup = value === "true";
|
|
532
548
|
break;
|
|
549
|
+
case "nightMode":
|
|
550
|
+
if (value !== "true" && value !== "false") {
|
|
551
|
+
throw new ConfigError("nightMode は true または false を指定してください。");
|
|
552
|
+
}
|
|
553
|
+
config.nightMode = value === "true";
|
|
554
|
+
break;
|
|
555
|
+
case "summaryInterval": {
|
|
556
|
+
const si = Number(value);
|
|
557
|
+
if (isNaN(si) || !Number.isInteger(si) || si < 1 || si > 1440) {
|
|
558
|
+
throw new ConfigError("summaryInterval は 1〜1440 の整数を指定してください。");
|
|
559
|
+
}
|
|
560
|
+
config.summaryInterval = si;
|
|
561
|
+
break;
|
|
562
|
+
}
|
|
533
563
|
case "maxObservations": {
|
|
534
564
|
if (value === "off") {
|
|
535
565
|
delete config.maxObservations;
|
|
@@ -542,6 +572,9 @@ function setConfigValue(key, value) {
|
|
|
542
572
|
config.maxObservations = mo;
|
|
543
573
|
break;
|
|
544
574
|
}
|
|
575
|
+
case "truncation":
|
|
576
|
+
throw new ConfigError(`truncation は set コマンドでは直接変更できません。truncation.<key> を指定してください。\n` +
|
|
577
|
+
`有効なサブキー: ${exports.VALID_TRUNCATION_KEYS.join(", ")}`);
|
|
545
578
|
}
|
|
546
579
|
saveConfig(config);
|
|
547
580
|
}
|
|
@@ -49,6 +49,11 @@ const API_BASE = "https://api.dmdata.jp/v2";
|
|
|
49
49
|
const REQUEST_TIMEOUT_MS = 15_000;
|
|
50
50
|
const SOCKET_CLEANUP_MAX_RETRIES = 5;
|
|
51
51
|
const SOCKET_CLEANUP_RETRY_INTERVAL_MS = 500;
|
|
52
|
+
/** リトライ設定 */
|
|
53
|
+
const RETRY_MAX_ATTEMPTS = 3;
|
|
54
|
+
const RETRY_BASE_DELAY_MS = 1_000;
|
|
55
|
+
const RETRY_MAX_JITTER_MS = 500;
|
|
56
|
+
const RETRYABLE_STATUS_CODES = new Set([429, 500, 502, 503, 504]);
|
|
52
57
|
/** TLS ハンドシェイクを再利用するための keep-alive エージェント (遅延初期化) */
|
|
53
58
|
let keepAliveAgent = null;
|
|
54
59
|
function getKeepAliveAgent() {
|
|
@@ -61,8 +66,18 @@ function getKeepAliveAgent() {
|
|
|
61
66
|
function buildAuthorizationHeader(apiKey) {
|
|
62
67
|
return `Basic ${Buffer.from(`${apiKey}:`).toString("base64")}`;
|
|
63
68
|
}
|
|
64
|
-
/**
|
|
65
|
-
|
|
69
|
+
/** HTTP レスポンスのステータスコードを保持するエラー */
|
|
70
|
+
class HttpError extends Error {
|
|
71
|
+
statusCode;
|
|
72
|
+
retryAfterMs;
|
|
73
|
+
constructor(message, statusCode, retryAfterMs) {
|
|
74
|
+
super(message);
|
|
75
|
+
this.statusCode = statusCode;
|
|
76
|
+
this.retryAfterMs = retryAfterMs;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** 単発 HTTPS リクエストを Promise でラップ */
|
|
80
|
+
function requestOnce(method, url, apiKey, body) {
|
|
66
81
|
return new Promise((resolve, reject) => {
|
|
67
82
|
const parsed = new URL(url);
|
|
68
83
|
const options = {
|
|
@@ -100,7 +115,18 @@ function request(method, url, apiKey, body) {
|
|
|
100
115
|
const errMsg = typeof json === "object" && json != null && "error" in json
|
|
101
116
|
? json.error?.message || "Unknown error"
|
|
102
117
|
: data.slice(0, 200);
|
|
103
|
-
|
|
118
|
+
// Retry-After ヘッダーの解析 (429 用)
|
|
119
|
+
let retryAfterMs = null;
|
|
120
|
+
if (statusCode === 429) {
|
|
121
|
+
const retryAfter = res.headers["retry-after"];
|
|
122
|
+
if (retryAfter != null) {
|
|
123
|
+
const seconds = Number(retryAfter);
|
|
124
|
+
if (!Number.isNaN(seconds)) {
|
|
125
|
+
retryAfterMs = seconds * 1_000;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
reject(new HttpError(`${method} ${parsed.pathname}: HTTP ${statusCode}: ${errMsg}`, statusCode, retryAfterMs));
|
|
104
130
|
return;
|
|
105
131
|
}
|
|
106
132
|
resolve(json);
|
|
@@ -120,6 +146,35 @@ function request(method, url, apiKey, body) {
|
|
|
120
146
|
req.end();
|
|
121
147
|
});
|
|
122
148
|
}
|
|
149
|
+
/** 指数バックオフ + ジッター付きリトライでリクエストを実行 */
|
|
150
|
+
async function request(method, url, apiKey, body) {
|
|
151
|
+
let lastError;
|
|
152
|
+
for (let attempt = 0; attempt <= RETRY_MAX_ATTEMPTS; attempt++) {
|
|
153
|
+
try {
|
|
154
|
+
return await requestOnce(method, url, apiKey, body);
|
|
155
|
+
}
|
|
156
|
+
catch (err) {
|
|
157
|
+
lastError = err;
|
|
158
|
+
// リトライ上限到達
|
|
159
|
+
if (attempt >= RETRY_MAX_ATTEMPTS)
|
|
160
|
+
break;
|
|
161
|
+
// リトライ可能なエラーか判定
|
|
162
|
+
if (!(err instanceof HttpError) || !RETRYABLE_STATUS_CODES.has(err.statusCode)) {
|
|
163
|
+
break; // ネットワークエラー・タイムアウト・4xx(429以外)等はリトライしない
|
|
164
|
+
}
|
|
165
|
+
// バックオフ遅延の算出: 指数バックオフ + ジッター、429 の場合は Retry-After を尊重
|
|
166
|
+
const exponentialDelay = RETRY_BASE_DELAY_MS * Math.pow(2, attempt);
|
|
167
|
+
const jitter = Math.floor(Math.random() * RETRY_MAX_JITTER_MS);
|
|
168
|
+
const baseDelay = err.retryAfterMs != null
|
|
169
|
+
? Math.max(err.retryAfterMs, exponentialDelay)
|
|
170
|
+
: exponentialDelay;
|
|
171
|
+
const delay = baseDelay + jitter;
|
|
172
|
+
log.warn(`${method} ${new URL(url).pathname}: HTTP ${err.statusCode} — ${delay}ms 後にリトライします (${attempt + 1}/${RETRY_MAX_ATTEMPTS})`);
|
|
173
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
throw lastError;
|
|
177
|
+
}
|
|
123
178
|
/** 契約一覧を取得し、有効な区分を返す */
|
|
124
179
|
async function listContracts(apiKey) {
|
|
125
180
|
log.debug("GET /v2/contract");
|