@eduardo191labs/opencode-free-pi 0.7.24 → 0.7.26
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/dist/catalog/live.js +10 -0
- package/dist/catalog/models.js +10 -0
- package/dist/constants.d.ts +3 -1
- package/dist/constants.js +4 -2
- package/dist/types.d.ts +9 -0
- package/package.json +1 -1
- package/src/catalog/live.ts +10 -0
- package/src/catalog/models.ts +8 -0
- package/src/constants.ts +4 -2
- package/src/types.ts +6 -0
package/dist/catalog/live.js
CHANGED
|
@@ -259,6 +259,16 @@ export function settleWindow(samples) {
|
|
|
259
259
|
*/
|
|
260
260
|
async function commitWindow(deps, tokens, modelID) {
|
|
261
261
|
const limits = (cached ??= emptyLimits());
|
|
262
|
+
// The measured ceiling belongs to the model probed, not to every model: the
|
|
263
|
+
// gateway's limit is per model, and a global window taken from one model
|
|
264
|
+
// would advertise capacity another one rejects. The per-model value is what
|
|
265
|
+
// `buildModels` reads for that model; the global window stays as the
|
|
266
|
+
// fallback for models never probed.
|
|
267
|
+
const entry = observation(modelID);
|
|
268
|
+
if ((entry.maxPromptTokens ?? 0) < tokens) {
|
|
269
|
+
entry.maxPromptTokens = tokens;
|
|
270
|
+
entry.updatedAt = Date.now();
|
|
271
|
+
}
|
|
262
272
|
if (limits.window && limits.window.tokens >= tokens)
|
|
263
273
|
return limits.window.tokens;
|
|
264
274
|
limits.window = { tokens, verifiedAt: Date.now(), model: modelID };
|
package/dist/catalog/models.js
CHANGED
|
@@ -203,6 +203,16 @@ export function accountAccess(me) {
|
|
|
203
203
|
};
|
|
204
204
|
}
|
|
205
205
|
function isPremiumModel(model) {
|
|
206
|
+
// The catalog's `access` field is the authoritative lane. `premium_only`
|
|
207
|
+
// means exactly what the name says; before the field existed the only clues
|
|
208
|
+
// were `tier`, the note and the "at capacity" label, and a curl_cffi probe
|
|
209
|
+
// showed those missed 18 of the 19 premium-only models (no tier, empty note,
|
|
210
|
+
// plain "~Nx usage" names). Keep the old heuristics for catalogs that still
|
|
211
|
+
// omit `access`.
|
|
212
|
+
if (model.access === "premium_only")
|
|
213
|
+
return true;
|
|
214
|
+
if (model.access === "free" || model.access === "free_unlimited")
|
|
215
|
+
return false;
|
|
206
216
|
if (model.tier === "premium")
|
|
207
217
|
return true;
|
|
208
218
|
if (/premium\s+credits/i.test(model.note ?? ""))
|
package/dist/constants.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const INTEGRATION_ID = "free-pi";
|
|
|
5
5
|
export declare const PROVIDER_NAME = "Free Pi";
|
|
6
6
|
export declare const DEFENSE_PROVIDER_NAME = "Free Pi Defense";
|
|
7
7
|
export declare const DEFAULT_BASE_URL = "https://api.freepi.ai";
|
|
8
|
-
export declare const DEFAULT_CLIENT_VERSION = "0.6.
|
|
8
|
+
export declare const DEFAULT_CLIENT_VERSION = "0.6.28";
|
|
9
9
|
export declare const CONSENT_VERSION = "4";
|
|
10
10
|
/**
|
|
11
11
|
* The provider CLI's window. The gateway enforces its own ceiling but does not
|
|
@@ -87,6 +87,8 @@ export declare const SESSION_TRACK_LIMIT = 200;
|
|
|
87
87
|
export declare const AUTH_SKEW_MS = 60000;
|
|
88
88
|
export declare const AUTH_TIMEOUT_MS: number;
|
|
89
89
|
export declare const AUTH_NETWORK_FAILURES = 6;
|
|
90
|
+
/** Fallback token lifetime when the JWT carries no `exp`. Measured free-pi
|
|
91
|
+
* tokens live 90 days; this fallback only applies when the header is missing. */
|
|
90
92
|
export declare const DEFAULT_TOKEN_LIFETIME_MS: number;
|
|
91
93
|
export declare const REFRESH_PREFIX = "free-pi:v1:";
|
|
92
94
|
export declare const AD_CONTEXT_MAX_CHARS = 1000;
|
package/dist/constants.js
CHANGED
|
@@ -5,7 +5,7 @@ export const INTEGRATION_ID = PROVIDER_ID;
|
|
|
5
5
|
export const PROVIDER_NAME = "Free Pi";
|
|
6
6
|
export const DEFENSE_PROVIDER_NAME = "Free Pi Defense";
|
|
7
7
|
export const DEFAULT_BASE_URL = "https://api.freepi.ai";
|
|
8
|
-
export const DEFAULT_CLIENT_VERSION = "0.6.
|
|
8
|
+
export const DEFAULT_CLIENT_VERSION = "0.6.28";
|
|
9
9
|
export const CONSENT_VERSION = "4";
|
|
10
10
|
/**
|
|
11
11
|
* The provider CLI's window. The gateway enforces its own ceiling but does not
|
|
@@ -101,7 +101,9 @@ export const SESSION_TRACK_LIMIT = 200;
|
|
|
101
101
|
export const AUTH_SKEW_MS = 60_000;
|
|
102
102
|
export const AUTH_TIMEOUT_MS = 15 * 60_000;
|
|
103
103
|
export const AUTH_NETWORK_FAILURES = 6;
|
|
104
|
-
|
|
104
|
+
/** Fallback token lifetime when the JWT carries no `exp`. Measured free-pi
|
|
105
|
+
* tokens live 90 days; this fallback only applies when the header is missing. */
|
|
106
|
+
export const DEFAULT_TOKEN_LIFETIME_MS = 90 * 24 * 60 * 60_000;
|
|
105
107
|
export const REFRESH_PREFIX = "free-pi:v1:";
|
|
106
108
|
export const AD_CONTEXT_MAX_CHARS = 1_000;
|
|
107
109
|
export const AD_REQUEST_TIMEOUT_MS = 5_000;
|
package/dist/types.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export type CatalogModel = {
|
|
|
15
15
|
display_name?: string;
|
|
16
16
|
section?: string;
|
|
17
17
|
tier?: "regular" | "premium";
|
|
18
|
+
/** Billing lane: `free`, `free_unlimited` or `premium_only`. */
|
|
19
|
+
access?: string;
|
|
18
20
|
input_credits_per_mtok?: number;
|
|
19
21
|
output_credits_per_mtok?: number;
|
|
20
22
|
cache_read_credits_per_mtok?: number;
|
|
@@ -92,6 +94,11 @@ export type Catalog = {
|
|
|
92
94
|
default_model?: string;
|
|
93
95
|
notice?: string;
|
|
94
96
|
models?: CatalogModel[];
|
|
97
|
+
/** The gateway's suggested split for fusion-style two-model workflows. */
|
|
98
|
+
fusion?: {
|
|
99
|
+
planner?: string;
|
|
100
|
+
executor?: string;
|
|
101
|
+
} & Record<string, unknown>;
|
|
95
102
|
};
|
|
96
103
|
/** Intermediate, SDK-agnostic model shape used while the catalog is built. */
|
|
97
104
|
export type ModelDefinition = {
|
|
@@ -166,6 +173,8 @@ export type MeResponse = {
|
|
|
166
173
|
premium_get_line?: string;
|
|
167
174
|
guest?: boolean;
|
|
168
175
|
visible_allowance?: boolean;
|
|
176
|
+
return_bonus?: Record<string, unknown> | null;
|
|
177
|
+
streak?: Record<string, unknown> | null;
|
|
169
178
|
earn_reward?: Record<string, unknown> | null;
|
|
170
179
|
slow_tier?: Record<string, unknown>;
|
|
171
180
|
};
|
package/package.json
CHANGED
package/src/catalog/live.ts
CHANGED
|
@@ -343,6 +343,16 @@ async function commitWindow(
|
|
|
343
343
|
modelID: string,
|
|
344
344
|
): Promise<number> {
|
|
345
345
|
const limits = (cached ??= emptyLimits());
|
|
346
|
+
// The measured ceiling belongs to the model probed, not to every model: the
|
|
347
|
+
// gateway's limit is per model, and a global window taken from one model
|
|
348
|
+
// would advertise capacity another one rejects. The per-model value is what
|
|
349
|
+
// `buildModels` reads for that model; the global window stays as the
|
|
350
|
+
// fallback for models never probed.
|
|
351
|
+
const entry = observation(modelID);
|
|
352
|
+
if ((entry.maxPromptTokens ?? 0) < tokens) {
|
|
353
|
+
entry.maxPromptTokens = tokens;
|
|
354
|
+
entry.updatedAt = Date.now();
|
|
355
|
+
}
|
|
346
356
|
if (limits.window && limits.window.tokens >= tokens) return limits.window.tokens;
|
|
347
357
|
limits.window = { tokens, verifiedAt: Date.now(), model: modelID };
|
|
348
358
|
loaded = true;
|
package/src/catalog/models.ts
CHANGED
|
@@ -300,6 +300,14 @@ export function accountAccess(me: MeResponse | undefined): AccountAccess | undef
|
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
function isPremiumModel(model: CatalogModel): boolean {
|
|
303
|
+
// The catalog's `access` field is the authoritative lane. `premium_only`
|
|
304
|
+
// means exactly what the name says; before the field existed the only clues
|
|
305
|
+
// were `tier`, the note and the "at capacity" label, and a curl_cffi probe
|
|
306
|
+
// showed those missed 18 of the 19 premium-only models (no tier, empty note,
|
|
307
|
+
// plain "~Nx usage" names). Keep the old heuristics for catalogs that still
|
|
308
|
+
// omit `access`.
|
|
309
|
+
if (model.access === "premium_only") return true;
|
|
310
|
+
if (model.access === "free" || model.access === "free_unlimited") return false;
|
|
303
311
|
if (model.tier === "premium") return true;
|
|
304
312
|
if (/premium\s+credits/i.test(model.note ?? "")) return true;
|
|
305
313
|
// The catalog labels every model the free lane cannot take with "at capacity
|
package/src/constants.ts
CHANGED
|
@@ -8,7 +8,7 @@ export const PROVIDER_NAME = "Free Pi";
|
|
|
8
8
|
export const DEFENSE_PROVIDER_NAME = "Free Pi Defense";
|
|
9
9
|
|
|
10
10
|
export const DEFAULT_BASE_URL = "https://api.freepi.ai";
|
|
11
|
-
export const DEFAULT_CLIENT_VERSION = "0.6.
|
|
11
|
+
export const DEFAULT_CLIENT_VERSION = "0.6.28";
|
|
12
12
|
export const CONSENT_VERSION = "4";
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -114,7 +114,9 @@ export const SESSION_TRACK_LIMIT = 200;
|
|
|
114
114
|
export const AUTH_SKEW_MS = 60_000;
|
|
115
115
|
export const AUTH_TIMEOUT_MS = 15 * 60_000;
|
|
116
116
|
export const AUTH_NETWORK_FAILURES = 6;
|
|
117
|
-
|
|
117
|
+
/** Fallback token lifetime when the JWT carries no `exp`. Measured free-pi
|
|
118
|
+
* tokens live 90 days; this fallback only applies when the header is missing. */
|
|
119
|
+
export const DEFAULT_TOKEN_LIFETIME_MS = 90 * 24 * 60 * 60_000;
|
|
118
120
|
export const REFRESH_PREFIX = "free-pi:v1:";
|
|
119
121
|
|
|
120
122
|
export const AD_CONTEXT_MAX_CHARS = 1_000;
|
package/src/types.ts
CHANGED
|
@@ -11,6 +11,8 @@ export type CatalogModel = {
|
|
|
11
11
|
display_name?: string;
|
|
12
12
|
section?: string;
|
|
13
13
|
tier?: "regular" | "premium";
|
|
14
|
+
/** Billing lane: `free`, `free_unlimited` or `premium_only`. */
|
|
15
|
+
access?: string;
|
|
14
16
|
input_credits_per_mtok?: number;
|
|
15
17
|
output_credits_per_mtok?: number;
|
|
16
18
|
cache_read_credits_per_mtok?: number;
|
|
@@ -76,6 +78,8 @@ export type Catalog = {
|
|
|
76
78
|
default_model?: string;
|
|
77
79
|
notice?: string;
|
|
78
80
|
models?: CatalogModel[];
|
|
81
|
+
/** The gateway's suggested split for fusion-style two-model workflows. */
|
|
82
|
+
fusion?: { planner?: string; executor?: string } & Record<string, unknown>;
|
|
79
83
|
};
|
|
80
84
|
|
|
81
85
|
/** Intermediate, SDK-agnostic model shape used while the catalog is built. */
|
|
@@ -146,6 +150,8 @@ export type MeResponse = {
|
|
|
146
150
|
premium_get_line?: string;
|
|
147
151
|
guest?: boolean;
|
|
148
152
|
visible_allowance?: boolean;
|
|
153
|
+
return_bonus?: Record<string, unknown> | null;
|
|
154
|
+
streak?: Record<string, unknown> | null;
|
|
149
155
|
earn_reward?: Record<string, unknown> | null;
|
|
150
156
|
slow_tier?: Record<string, unknown>;
|
|
151
157
|
};
|