Skip to content

Feat/tokenstat engine cohesion#130

Merged
Qsnh merged 26 commits intomainfrom
feat/tokenstat-engine-cohesion
Apr 27, 2026
Merged

Feat/tokenstat engine cohesion#130
Qsnh merged 26 commits intomainfrom
feat/tokenstat-engine-cohesion

Conversation

@Qsnh
Copy link
Copy Markdown
Contributor

@Qsnh Qsnh commented Apr 27, 2026

No description provided.

Qsnh and others added 26 commits April 26, 2026 19:05
Design for moving per-engine token-usage extraction into each engine's
own package, slimming tokenstat down to a thin orchestrator (scheduling,
DB I/O, retry budget, tombstone, legacy fallback chain).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
10-task TDD plan that incrementally migrates per-engine token-usage
extraction into each engine package and slims tokenstat down to a thin
orchestrator. Each task keeps the build green; old and new code paths
coexist until the final cleanup task.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…(stubs)

Introduces ai.TokenUsage, ai.ErrSessionDataNotFound, and extends EngineAdapter
with CollectTokenUsage; all four adapters and test stubs implement it as a no-op
returning ErrSessionDataNotFound.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nd test mocks

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move Kimi token-usage extraction into internal/ai/kimi/ with Collector/NewCollector/NewCollectorAt, wiring it into kimiAdapter.CollectTokenUsage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… app

Replace parser-based Syncer with adapter-based dispatch; wire engines map
and fallback order from app.go into the new NewSyncer signature.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…eAdapter map

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…i.NewCollectorAt

- Drop redundant storeUsages passthrough; call upsertRows directly
- Promote tombstoneUsages to package-level var (avoid per-call alloc)
- Simplify syncSession/tryAdapter doc comments (remove bullet lists)
- Remove redundant collectSQL field comment
- Add NewCollectorAt test seam to pi.Collector for consistency with kimi/codex

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ine tombstone

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Package sessionfile is a shared file I/O utility, not an engine
implementation. Relocating it to internal/utils/ removes it from
the ai/ hierarchy and breaks the reverse dependency on the ai package
by replacing ai.ErrSessionDataNotFound with stdlib fs.ErrNotExist.
Engine callers remain responsible for wrapping the error into domain
terms at their own boundary.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
OPENBEE_URL is now injected via os.Setenv at server startup and inherited
by subprocesses through os.Environ(), matching the optional env-var semantics
of OPENBEE_API_KEY. Removes the explicit openbeeURL parameter from EngineConfig,
NewAdapter, NewInvoker, and BuildBaseEnv across all four engine packages.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…on and openbee url refactor

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Qsnh Qsnh merged commit 546f2bf into main Apr 27, 2026
@Qsnh Qsnh deleted the feat/tokenstat-engine-cohesion branch April 27, 2026 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant