refactor: unify duplicate Logger interfaces into single canonical type#14
Open
yuanrengu wants to merge 1 commit into
Open
refactor: unify duplicate Logger interfaces into single canonical type#14yuanrengu wants to merge 1 commit into
yuanrengu wants to merge 1 commit into
Conversation
23 files had local Logger/StoreLogger/PluginLogger/PipelineLogger/RunnerLogger/ExtractorLogger/TriggerLogger
interface definitions with identical shapes ({debug?, info, warn, error}).
Replace all with imports from the canonical `Logger` in `src/core/types.ts`:
- 17 files: local `interface Logger` → `import type { Logger }`
- 6 files: named variants (StoreLogger, PluginLogger, etc.) → `type X = Logger` alias
Two intentionally different interfaces are preserved:
- `CheckpointLogger` (only info + optional warn) — different contract
- `ensure-hook-policy.ts` Logger (no error) — different contract
Net: -120 lines, zero behavioral change.
Signed-off-by: yuanrengu <heyonggang0811@126.com>
7e0d289 to
a7911ff
Compare
Collaborator
|
Hi @yuanrengu, thanks for the PR! 🧹 Unifying duplicate Logger interfaces across the codebase is a worthwhile cleanup direction. We'll review the changes and get back to you shortly. Thanks for the contribution! 🙏 |
Author
|
@Maxwell-Code07 Thanks! I've been diving into agent memory systems lately and learning a lot through this project. Happy to help improve it — let me know if any changes are needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
23 files had local
Logger/StoreLogger/PluginLogger/PipelineLogger/RunnerLogger/ExtractorLogger/TriggerLoggerinterface definitions with identical shapes ({debug?, info, warn, error}). This PR replaces all duplicates with imports from the canonicalLoggerinsrc/core/types.ts.Changes
interface Loggerremoved →import type { Logger }from../types.jsStoreLogger→type StoreLogger = Logger(exported, used by tcvdb-client/factory)PluginLogger→type PluginLogger = Logger(exported, used by offload/*)PipelineLogger→type PipelineLogger = Logger(exported, used by seed-runtime)RunnerLogger→type RunnerLogger = LoggerExtractorLogger→type ExtractorLogger = LoggerTriggerLogger→type TriggerLogger = LoggerPreserved as-is (different contract)
CheckpointLoggerincheckpoint.ts— onlyinfo+ optionalwarn(noerror)Loggerinensure-hook-policy.ts— onlyinfo,warn,debug?(noerror)Impact
npx tsdownpasses (714.61 kB, no errors)core/types.tshas zero importsTest plan
npx tsdownbuilds successfullyimport typepaths verified correct (relative to each file)StoreLogger,PluginLogger, etc.) remain importable from original modules