|
1 | | -[API Reference](../API_REFERENCE.md) > Application層 |
| 1 | +[EpisodicRAG](../../../README.md) > [Docs](../../README.md) > [API](../API_REFERENCE.md) > Application |
2 | 2 |
|
3 | 3 | # Application層 API |
4 | 4 |
|
5 | 5 | ビジネスロジックの実装。 |
6 | 6 |
|
| 7 | +> 📖 用語・共通概念は [用語集](../../../README.md) を参照 |
| 8 | +
|
7 | 9 | ```python |
8 | 10 | from application.shadow import ShadowTemplate, ShadowUpdater |
9 | 11 | from application.grand import GrandDigestManager, ShadowGrandDigestManager |
@@ -208,10 +210,77 @@ class ShadowUpdater: |
208 | 210 |
|
209 | 211 | ## GrandDigest管理(application/grand/) |
210 | 212 |
|
211 | | -| クラス | 説明 | |
212 | | -|--------|------| |
213 | | -| `GrandDigestManager` | GrandDigest.txt CRUD操作 | |
214 | | -| `ShadowGrandDigestManager` | ShadowGrandDigest.txt管理 | |
| 213 | +### GrandDigestManager |
| 214 | + |
| 215 | +GrandDigest.txt の CRUD操作を担当。 |
| 216 | + |
| 217 | +```python |
| 218 | +class GrandDigestManager: |
| 219 | + def __init__(self, config: DigestConfig): ... |
| 220 | +``` |
| 221 | + |
| 222 | +| メソッド | 説明 | 例外 | |
| 223 | +|---------|------|------| |
| 224 | +| `get_template() -> GrandDigestData` | テンプレート生成(全8レベル対応) | - | |
| 225 | +| `load_or_create() -> GrandDigestData` | 読み込みまたは新規作成 | `FileIOError` | |
| 226 | +| `save(data: GrandDigestData) -> None` | GrandDigest.txtを保存 | `FileIOError` | |
| 227 | +| `update_digest(level, digest_name, overall_digest) -> None` | 指定レベルのダイジェスト更新 | `DigestError` | |
| 228 | + |
| 229 | +**使用例**: |
| 230 | + |
| 231 | +```python |
| 232 | +from application.grand import GrandDigestManager |
| 233 | +from config import DigestConfig |
| 234 | + |
| 235 | +config = DigestConfig() |
| 236 | +manager = GrandDigestManager(config) |
| 237 | + |
| 238 | +# テンプレート取得 |
| 239 | +template = manager.get_template() |
| 240 | + |
| 241 | +# 読み込みまたは作成 |
| 242 | +data = manager.load_or_create() |
| 243 | + |
| 244 | +# ダイジェスト更新 |
| 245 | +manager.update_digest("weekly", "W0001_タイトル", overall_digest_data) |
| 246 | +``` |
| 247 | + |
| 248 | +### ShadowGrandDigestManager |
| 249 | + |
| 250 | +ShadowGrandDigest.txt 管理のFacade。Shadow更新・カスケード処理を統括。 |
| 251 | + |
| 252 | +```python |
| 253 | +class ShadowGrandDigestManager: |
| 254 | + def __init__(self, config: Optional[DigestConfig] = None): ... |
| 255 | +``` |
| 256 | + |
| 257 | +| メソッド | 説明 | |
| 258 | +|---------|------| |
| 259 | +| `add_files_to_shadow(level, new_files) -> None` | Shadowに新規ファイル追加(増分更新) | |
| 260 | +| `clear_shadow_level(level) -> None` | 指定レベルのShadow初期化 | |
| 261 | +| `get_shadow_digest_for_level(level) -> Optional[OverallDigestData]` | Shadowダイジェスト取得 | |
| 262 | +| `promote_shadow_to_grand(level) -> None` | Shadow→Grand昇格 | |
| 263 | +| `update_shadow_for_new_loops() -> None` | 新規Loop検出→weekly Shadow更新 | |
| 264 | +| `cascade_update_on_digest_finalize(level) -> None` | 確定時カスケード処理 | |
| 265 | + |
| 266 | +**使用例**: |
| 267 | + |
| 268 | +```python |
| 269 | +from application.grand import ShadowGrandDigestManager |
| 270 | +from config import DigestConfig |
| 271 | + |
| 272 | +config = DigestConfig() |
| 273 | +manager = ShadowGrandDigestManager(config) |
| 274 | + |
| 275 | +# 新しいLoopファイルを検出してShadowを更新 |
| 276 | +manager.update_shadow_for_new_loops() |
| 277 | + |
| 278 | +# Weeklyダイジェスト確定時のカスケード処理 |
| 279 | +manager.cascade_update_on_digest_finalize("weekly") |
| 280 | + |
| 281 | +# 指定レベルのShadowダイジェストを取得 |
| 282 | +shadow = manager.get_shadow_digest_for_level("weekly") |
| 283 | +``` |
215 | 284 |
|
216 | 285 | --- |
217 | 286 |
|
|
0 commit comments