Repository navigation
feat(claude): discover Personal and Team organizations for quota, sessions and today (#1756) - #1758
Open
ozymandiashh wants to merge 1 commit into
Open
ozymandiashh wants to merge 1 commit into
ozymandiashh wants to merge 1 commit into
Conversation
This branch has not been deployed
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
Closes #1756
Claude.app): Readsclaude-code-sessions/<accountUuid>/<orgUuid>/local_*.jsonandoauth:tokenCacheV2(persisting per-organization credentials and profile metadata inclaude-org-credentials.json/claude-org-profiles.jsonso switching accounts inClaude.appkeeps every subscription connected).TodayandliveSessionsattribution: MapscliSessionIdfromclaude-code-sessions/<accountUuid>/<orgUuid>/local_*.json(and subagent sidechains) to the owning organization profile (claude-org:<orgUuid>), partitioning~/.claude/projects/usage accurately between Personal and each Team organization.CLAUDE_CONFIG_DIR: DerivesClaude Code-credentials-<first 8 hex of sha256(dir.normalize("NFC"))>for non-default config directories, prefers fresher Keychain/Desktop credentials when a file credential has expired, and refreshes expired OAuth credentials when arefreshTokenis present.seven_dayisnull: Falls backdecodeClaudeUsage().primarytofive_hourwhenseven_dayisnull, and updatesheadlineWindowto match unscoped weekly/monthly windows before falling back to the busiest window soWeekly · Fable (0%)does not mask an active5-hourwindow.Testing / Verification
Max 20x) subscription and a Team (Codeburn—Team Premium) subscription;codeburn quota --claude-profiles --format jsonreturns bothPersonal(Max 20x, 12 sessions today) andCodeburn(Team Premium, 7 sessions today) with their independent quota windows and exact partitionedtodaytotals (12 + 7 = 19 sessions).npm testpasses (tests/quota-providers.test.ts,tests/live-sessions.test.ts,tests/provider-env-declarations.test.ts,tests/env-isolation-declarations.test.ts).npm run buildandnpx tsc --noEmitsucceed.