one-more-token 0.5.2 → 0.6.0
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/data/subscriptions.json +32 -0
- package/dist/main.js +11 -4
- package/migrations/011_subscription_model.sql +22 -0
- package/package.json +1 -1
package/data/subscriptions.json
CHANGED
|
@@ -114,6 +114,38 @@
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
]
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"id": "nan-gentle-deepseek",
|
|
120
|
+
"label": "NaN Gentle · DeepSeek V4 Flash",
|
|
121
|
+
"provider": "nan",
|
|
122
|
+
"monthlyPriceUsd": null,
|
|
123
|
+
"reviewedAt": "2026-11-23",
|
|
124
|
+
"windows": [
|
|
125
|
+
{
|
|
126
|
+
"kind": "monthly",
|
|
127
|
+
"limit": {
|
|
128
|
+
"unit": "tokens",
|
|
129
|
+
"value": 1000000000
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"id": "nan-gentle-glm53-flash",
|
|
136
|
+
"label": "NaN Gentle · GLM 5.3 Flash",
|
|
137
|
+
"provider": "nan",
|
|
138
|
+
"monthlyPriceUsd": null,
|
|
139
|
+
"reviewedAt": "2026-11-23",
|
|
140
|
+
"windows": [
|
|
141
|
+
{
|
|
142
|
+
"kind": "monthly",
|
|
143
|
+
"limit": {
|
|
144
|
+
"unit": "tokens",
|
|
145
|
+
"value": 500000000
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
]
|
|
117
149
|
}
|
|
118
150
|
]
|
|
119
151
|
}
|
package/dist/main.js
CHANGED
|
@@ -20558,7 +20558,9 @@ var init_tables = __esm({
|
|
|
20558
20558
|
position: external_exports.number().int().nonnegative(),
|
|
20559
20559
|
subscription_id: id,
|
|
20560
20560
|
provider: external_exports.string().min(1),
|
|
20561
|
-
agent: nullable2(external_exports.string().min(1))
|
|
20561
|
+
agent: nullable2(external_exports.string().min(1)),
|
|
20562
|
+
/** Optional model narrowing (spec §5.1: NaN Gentle meters each model separately). */
|
|
20563
|
+
model: nullable2(external_exports.string().min(1))
|
|
20562
20564
|
});
|
|
20563
20565
|
QuotaWindowSchema = external_exports.object({
|
|
20564
20566
|
id,
|
|
@@ -22867,11 +22869,12 @@ async function syncUserSubscriptions(db, file2, plans) {
|
|
|
22867
22869
|
subscription.endedAt ?? null
|
|
22868
22870
|
]);
|
|
22869
22871
|
for (const rule of subscription.match) {
|
|
22870
|
-
await db.run("INSERT INTO subscription_rules VALUES ($1, $2, $3, $4)", [
|
|
22872
|
+
await db.run("INSERT INTO subscription_rules VALUES ($1, $2, $3, $4, $5)", [
|
|
22871
22873
|
position++,
|
|
22872
22874
|
subscription.id,
|
|
22873
22875
|
rule.provider,
|
|
22874
|
-
rule.agent ?? null
|
|
22876
|
+
rule.agent ?? null,
|
|
22877
|
+
rule.model ?? null
|
|
22875
22878
|
]);
|
|
22876
22879
|
}
|
|
22877
22880
|
}
|
|
@@ -22894,7 +22897,11 @@ var init_config2 = __esm({
|
|
|
22894
22897
|
startedAt: date7.optional(),
|
|
22895
22898
|
endedAt: date7.optional(),
|
|
22896
22899
|
match: external_exports.array(
|
|
22897
|
-
external_exports.object({
|
|
22900
|
+
external_exports.object({
|
|
22901
|
+
provider: external_exports.string().min(1),
|
|
22902
|
+
agent: external_exports.string().min(1).optional(),
|
|
22903
|
+
model: external_exports.string().min(1).optional()
|
|
22904
|
+
}).strict()
|
|
22898
22905
|
).min(1)
|
|
22899
22906
|
}).strict();
|
|
22900
22907
|
UserSubscriptionsFileSchema = external_exports.object({ version: external_exports.literal(1), subscriptions: external_exports.array(UserSubscriptionSchema) }).strict();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
-- Subscription rules may narrow a provider rule to one model (spec §5.1: the NaN Gentle plan meters
|
|
2
|
+
-- each model with its own allowance). NULL keeps the rule covering every model of the provider.
|
|
3
|
+
ALTER TABLE subscription_rules ADD COLUMN model VARCHAR;
|
|
4
|
+
|
|
5
|
+
-- Rebuilt with the model condition; semantics otherwise identical to 005.
|
|
6
|
+
CREATE OR REPLACE VIEW turn_subscriptions AS
|
|
7
|
+
SELECT
|
|
8
|
+
t.id AS turn_id,
|
|
9
|
+
(
|
|
10
|
+
SELECT r.subscription_id
|
|
11
|
+
FROM subscription_rules r
|
|
12
|
+
JOIN subscriptions s ON s.id = r.subscription_id
|
|
13
|
+
WHERE r.provider = t.provider
|
|
14
|
+
AND (r.model IS NULL OR r.model = t.model)
|
|
15
|
+
AND (r.agent IS NULL OR r.agent = se.agent)
|
|
16
|
+
AND (s.started_at IS NULL OR CAST(t.ts AS DATE) >= s.started_at)
|
|
17
|
+
AND (s.ended_at IS NULL OR CAST(t.ts AS DATE) <= s.ended_at)
|
|
18
|
+
ORDER BY r.position
|
|
19
|
+
LIMIT 1
|
|
20
|
+
) AS subscription_id
|
|
21
|
+
FROM turns t
|
|
22
|
+
LEFT JOIN sessions se ON se.id = t.session_id;
|