@optima-chat/dev-skills 0.7.22 → 0.7.23
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.
|
@@ -90,15 +90,21 @@ INSERT INTO credit_ledger (id, user_id, type, description, initial_amount, remai
|
|
|
90
90
|
SELECT concat('crd_gift_', substr(md5(random()::text), 1, 16)), '${safeUserId}', 'subscription', '${safePlanName} plan gift (${months} month)', ${monthlyCredits}, ${monthlyCredits}, '${periodEndISO}', '${now}'
|
|
91
91
|
WHERE ${monthlyCredits} > 0;
|
|
92
92
|
|
|
93
|
-
--
|
|
93
|
+
-- Update existing active session quota, or insert new one if none exists
|
|
94
|
+
UPDATE token_quotas SET plan_id='${safePlan}', monthly_limit=${sessionTokenLimit}, updated_at='${now}'
|
|
95
|
+
WHERE user_id='${safeUserId}' AND period_type='session' AND period_end > '${now}';
|
|
96
|
+
|
|
94
97
|
INSERT INTO token_quotas (id, user_id, plan_id, period_type, monthly_limit, monthly_used, period_start, period_end, created_at, updated_at)
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
SELECT concat('tq_sess_', substr(md5(random()::text), 1, 16)), '${safeUserId}', '${safePlan}', 'session', ${sessionTokenLimit}, 0, '${now}', '${sessionEnd}', '${now}', '${now}'
|
|
99
|
+
WHERE NOT EXISTS (SELECT 1 FROM token_quotas WHERE user_id='${safeUserId}' AND period_type='session' AND period_end > '${now}');
|
|
100
|
+
|
|
101
|
+
-- Update existing active weekly quota, or insert new one if none exists
|
|
102
|
+
UPDATE token_quotas SET plan_id='${safePlan}', monthly_limit=${weeklyTokenLimit}, updated_at='${now}'
|
|
103
|
+
WHERE user_id='${safeUserId}' AND period_type='weekly' AND period_end > '${now}';
|
|
97
104
|
|
|
98
|
-
-- Upsert weekly token quota
|
|
99
105
|
INSERT INTO token_quotas (id, user_id, plan_id, period_type, monthly_limit, monthly_used, period_start, period_end, created_at, updated_at)
|
|
100
|
-
|
|
101
|
-
|
|
106
|
+
SELECT concat('tq_week_', substr(md5(random()::text), 1, 16)), '${safeUserId}', '${safePlan}', 'weekly', ${weeklyTokenLimit}, 0, '${now}', '${weekEnd}', '${now}', '${now}'
|
|
107
|
+
WHERE NOT EXISTS (SELECT 1 FROM token_quotas WHERE user_id='${safeUserId}' AND period_type='weekly' AND period_end > '${now}');
|
|
102
108
|
|
|
103
109
|
COMMIT;
|
|
104
110
|
`.trim();
|
|
@@ -93,15 +93,21 @@ INSERT INTO credit_ledger (id, user_id, type, description, initial_amount, remai
|
|
|
93
93
|
SELECT concat('crd_gift_', substr(md5(random()::text), 1, 16)), '${safeUserId}', 'subscription', '${safePlanName} plan gift (${months} month)', ${monthlyCredits}, ${monthlyCredits}, '${periodEndISO}', '${now}'
|
|
94
94
|
WHERE ${monthlyCredits} > 0;
|
|
95
95
|
|
|
96
|
-
--
|
|
96
|
+
-- Update existing active session quota, or insert new one if none exists
|
|
97
|
+
UPDATE token_quotas SET plan_id='${safePlan}', monthly_limit=${sessionTokenLimit}, updated_at='${now}'
|
|
98
|
+
WHERE user_id='${safeUserId}' AND period_type='session' AND period_end > '${now}';
|
|
99
|
+
|
|
97
100
|
INSERT INTO token_quotas (id, user_id, plan_id, period_type, monthly_limit, monthly_used, period_start, period_end, created_at, updated_at)
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
SELECT concat('tq_sess_', substr(md5(random()::text), 1, 16)), '${safeUserId}', '${safePlan}', 'session', ${sessionTokenLimit}, 0, '${now}', '${sessionEnd}', '${now}', '${now}'
|
|
102
|
+
WHERE NOT EXISTS (SELECT 1 FROM token_quotas WHERE user_id='${safeUserId}' AND period_type='session' AND period_end > '${now}');
|
|
103
|
+
|
|
104
|
+
-- Update existing active weekly quota, or insert new one if none exists
|
|
105
|
+
UPDATE token_quotas SET plan_id='${safePlan}', monthly_limit=${weeklyTokenLimit}, updated_at='${now}'
|
|
106
|
+
WHERE user_id='${safeUserId}' AND period_type='weekly' AND period_end > '${now}';
|
|
100
107
|
|
|
101
|
-
-- Upsert weekly token quota
|
|
102
108
|
INSERT INTO token_quotas (id, user_id, plan_id, period_type, monthly_limit, monthly_used, period_start, period_end, created_at, updated_at)
|
|
103
|
-
|
|
104
|
-
|
|
109
|
+
SELECT concat('tq_week_', substr(md5(random()::text), 1, 16)), '${safeUserId}', '${safePlan}', 'weekly', ${weeklyTokenLimit}, 0, '${now}', '${weekEnd}', '${now}', '${now}'
|
|
110
|
+
WHERE NOT EXISTS (SELECT 1 FROM token_quotas WHERE user_id='${safeUserId}' AND period_type='weekly' AND period_end > '${now}');
|
|
105
111
|
|
|
106
112
|
COMMIT;
|
|
107
113
|
`.trim();
|
package/package.json
CHANGED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"WebSearch",
|
|
5
|
-
"WebFetch(domain:code.claude.com)",
|
|
6
|
-
"WebFetch(domain:platform.claude.com)",
|
|
7
|
-
"WebFetch(domain:github.com)",
|
|
8
|
-
"Bash(gh repo view:*)",
|
|
9
|
-
"Bash(gh repo clone:*)",
|
|
10
|
-
"Bash(gh repo list:*)",
|
|
11
|
-
"Read(//private/tmp/optima-docs/**)",
|
|
12
|
-
"Read(//tmp/optima-docs/**)",
|
|
13
|
-
"Bash(git init:*)",
|
|
14
|
-
"Bash(gh repo create:*)",
|
|
15
|
-
"Read(//private/tmp/optima-workspace/**)",
|
|
16
|
-
"Read(//tmp/optima-workspace/**)",
|
|
17
|
-
"Read(//tmp/optima-workspace/.claude/commands/**)",
|
|
18
|
-
"Bash(git add:*)",
|
|
19
|
-
"Bash(git push:*)",
|
|
20
|
-
"Bash(find:*)",
|
|
21
|
-
"Bash(git commit:*)",
|
|
22
|
-
"Bash(aws logs get-log-events:*)",
|
|
23
|
-
"Bash(npm install:*)",
|
|
24
|
-
"Bash(optima-dev-skills:*)",
|
|
25
|
-
"Bash(optima-generate-test-token:*)",
|
|
26
|
-
"Bash(optima-query-db:*)",
|
|
27
|
-
"Bash(gh variable set:*)",
|
|
28
|
-
"Bash(npm publish:*)",
|
|
29
|
-
"Bash(python3:*)",
|
|
30
|
-
"Bash(gh api:*)",
|
|
31
|
-
"Bash(curl -s http://auth.optima.chat/openapi.json)",
|
|
32
|
-
"Bash(curl -s https://auth.optima.chat/openapi.json)",
|
|
33
|
-
"Bash(cat:*)",
|
|
34
|
-
"Bash(node /Users/verypro/optima-dev-skills/scripts/install.js:*)",
|
|
35
|
-
"Bash(aws logs tail:*)",
|
|
36
|
-
"Bash(grep:*)",
|
|
37
|
-
"Bash(npm view:*)",
|
|
38
|
-
"Bash(npm version:*)",
|
|
39
|
-
"Bash(git checkout:*)",
|
|
40
|
-
"Bash(git pull:*)",
|
|
41
|
-
"Bash(node scripts/install.js:*)",
|
|
42
|
-
"Bash(gh issue:*)",
|
|
43
|
-
"Bash(npm run:*)",
|
|
44
|
-
"Bash(gh pr:*)",
|
|
45
|
-
"Bash(node:*)",
|
|
46
|
-
"Bash(echo \"exit: $?\")"
|
|
47
|
-
],
|
|
48
|
-
"deny": [],
|
|
49
|
-
"ask": []
|
|
50
|
-
}
|
|
51
|
-
}
|