pi-free 1.0.3 → 1.0.4
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 +30 -14
- package/package.json +1 -1
- package/usage/formatters.ts +2 -18
- package/usage/limits.ts +3 -21
- package/usage/types.ts +26 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,10 +7,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.0.4] - 2025-04-03
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- **All tests now passing** (127/127)
|
|
14
|
+
- Fixed mock paths in kilo.test.ts, zen.test.ts, ollama.test.ts
|
|
15
|
+
- Fixed createCtxReRegister mocks in zen.test.ts and openrouter.test.ts
|
|
16
|
+
- Fixed cline.test.ts to test actual provider re-registration behavior
|
|
17
|
+
- Added missing DEFAULT_MIN_SIZE_B constant to openrouter mock
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- **Code quality improvements**
|
|
21
|
+
- Refactored usage modules to break circular dependency (limits.ts ↔ formatters.ts)
|
|
22
|
+
- Created usage/types.ts with shared interfaces (FreeTierLimit, FreeTierUsage)
|
|
23
|
+
- Bumped version to 1.0.4
|
|
24
|
+
|
|
25
|
+
## [1.0.3] - 2025-04-03
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
- Updated package.json metadata (name, description, keywords, repository URL)
|
|
29
|
+
- Updated .npmignore for cleaner publishes
|
|
30
|
+
|
|
31
|
+
## [1.0.0] - 2024-03-28
|
|
32
|
+
|
|
10
33
|
### Added
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
34
|
+
- Initial release with 6 providers: Kilo, Zen, OpenRouter, NVIDIA, Cline, Fireworks
|
|
35
|
+
- Free tier usage tracking across all sessions
|
|
36
|
+
- Provider failover with model hopping
|
|
37
|
+
- Autocompact integration for rate limit recovery
|
|
38
|
+
- Usage widget with glimpseui
|
|
39
|
+
- Command toggles for free/all model filtering
|
|
40
|
+
- Hardcoded benchmark data from Artificial Analysis
|
|
14
41
|
|
|
15
42
|
### Changed
|
|
16
43
|
- **Major refactoring**: Split free-tier-limits.ts into usage/* modules
|
|
@@ -46,14 +73,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
46
73
|
- fetchWithRetry() now properly throws after exhausting retries
|
|
47
74
|
- Auth error pattern matching now handles more message variants
|
|
48
75
|
- Test isolation for free-tier-limits tests
|
|
49
|
-
|
|
50
|
-
## [1.0.0] - 2024-03-28
|
|
51
|
-
|
|
52
|
-
### Added
|
|
53
|
-
- Initial release with 6 providers: Kilo, Zen, OpenRouter, NVIDIA, Cline, Fireworks
|
|
54
|
-
- Free tier usage tracking across all sessions
|
|
55
|
-
- Provider failover with model hopping
|
|
56
|
-
- Autocompact integration for rate limit recovery
|
|
57
|
-
- Usage widget with glimpseui
|
|
58
|
-
- Command toggles for free/all model filtering
|
|
59
|
-
- Hardcoded benchmark data from Artificial Analysis
|
package/package.json
CHANGED
package/usage/formatters.ts
CHANGED
|
@@ -3,25 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import type { CumulativeUsageReport } from "./cumulative.ts";
|
|
6
|
-
import {
|
|
7
|
-
type FreeTierLimit,
|
|
8
|
-
getFreeTierUsage,
|
|
9
|
-
getLimitWarning,
|
|
10
|
-
} from "./limits.ts";
|
|
6
|
+
import { getFreeTierUsage, getLimitWarning } from "./limits.ts";
|
|
11
7
|
import type { SessionUsageReport } from "./tracking.ts";
|
|
12
|
-
|
|
13
|
-
export interface FreeTierUsage {
|
|
14
|
-
provider: string;
|
|
15
|
-
requestsToday: number;
|
|
16
|
-
requestsThisHour: number;
|
|
17
|
-
requestsThisMonth?: number;
|
|
18
|
-
limit: FreeTierLimit;
|
|
19
|
-
remainingToday?: number;
|
|
20
|
-
remainingThisHour?: number;
|
|
21
|
-
remainingThisMonth?: number;
|
|
22
|
-
percentUsed: number;
|
|
23
|
-
status: "ok" | "warning" | "critical" | "unknown";
|
|
24
|
-
}
|
|
8
|
+
// Types imported via limits.ts (which re-exports from types.ts)
|
|
25
9
|
|
|
26
10
|
export function formatSessionUsage(report: SessionUsageReport): string {
|
|
27
11
|
if (report.providers.length === 0) {
|
package/usage/limits.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { createLogger } from "../lib/logger.ts";
|
|
11
11
|
import { getDailyRequestCount } from "./metrics.ts";
|
|
12
|
+
import type { FreeTierLimit, FreeTierUsage } from "./types.ts";
|
|
12
13
|
|
|
13
14
|
export {
|
|
14
15
|
type CumulativeUsageReport,
|
|
@@ -30,6 +31,8 @@ export {
|
|
|
30
31
|
resetUsageStats,
|
|
31
32
|
type SessionUsageReport,
|
|
32
33
|
} from "./tracking.ts";
|
|
34
|
+
// Re-export types for consumers
|
|
35
|
+
export type { FreeTierLimit, FreeTierUsage } from "./types.ts";
|
|
33
36
|
|
|
34
37
|
const _logger = createLogger("free-tier");
|
|
35
38
|
|
|
@@ -37,14 +40,6 @@ const _logger = createLogger("free-tier");
|
|
|
37
40
|
// Free Tier Limits Configuration
|
|
38
41
|
// =============================================================================
|
|
39
42
|
|
|
40
|
-
export interface FreeTierLimit {
|
|
41
|
-
provider: string;
|
|
42
|
-
requestsPerDay?: number;
|
|
43
|
-
requestsPerHour?: number;
|
|
44
|
-
requestsPerMonth?: number;
|
|
45
|
-
description: string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
43
|
export const FREE_TIER_LIMITS: Record<string, FreeTierLimit> = {
|
|
49
44
|
kilo: {
|
|
50
45
|
provider: "kilo",
|
|
@@ -80,19 +75,6 @@ export const FREE_TIER_LIMITS: Record<string, FreeTierLimit> = {
|
|
|
80
75
|
// Usage Status and Warnings
|
|
81
76
|
// =============================================================================
|
|
82
77
|
|
|
83
|
-
export interface FreeTierUsage {
|
|
84
|
-
provider: string;
|
|
85
|
-
requestsToday: number;
|
|
86
|
-
requestsThisHour: number;
|
|
87
|
-
requestsThisMonth?: number;
|
|
88
|
-
limit: FreeTierLimit;
|
|
89
|
-
remainingToday?: number;
|
|
90
|
-
remainingThisHour?: number;
|
|
91
|
-
remainingThisMonth?: number;
|
|
92
|
-
percentUsed: number;
|
|
93
|
-
status: "ok" | "warning" | "critical" | "unknown";
|
|
94
|
-
}
|
|
95
|
-
|
|
96
78
|
export function getFreeTierUsage(provider: string): FreeTierUsage {
|
|
97
79
|
const limit = FREE_TIER_LIMITS[provider];
|
|
98
80
|
if (!limit) {
|
package/usage/types.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for usage tracking modules
|
|
3
|
+
*
|
|
4
|
+
* Extracted to break circular dependency between limits.ts and formatters.ts
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface FreeTierLimit {
|
|
8
|
+
provider: string;
|
|
9
|
+
requestsPerDay?: number;
|
|
10
|
+
requestsPerHour?: number;
|
|
11
|
+
requestsPerMonth?: number;
|
|
12
|
+
description: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface FreeTierUsage {
|
|
16
|
+
provider: string;
|
|
17
|
+
requestsToday: number;
|
|
18
|
+
requestsThisHour: number;
|
|
19
|
+
requestsThisMonth?: number;
|
|
20
|
+
limit: FreeTierLimit;
|
|
21
|
+
remainingToday?: number;
|
|
22
|
+
remainingThisHour?: number;
|
|
23
|
+
remainingThisMonth?: number;
|
|
24
|
+
percentUsed: number;
|
|
25
|
+
status: "ok" | "warning" | "critical" | "unknown";
|
|
26
|
+
}
|