@leo000001/opencode-quota-sidebar 1.0.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/CONTRIBUTING.md +102 -0
  3. package/LICENSE +21 -0
  4. package/README.md +216 -0
  5. package/SECURITY.md +26 -0
  6. package/dist/cache.d.ts +6 -0
  7. package/dist/cache.js +22 -0
  8. package/dist/cost.d.ts +13 -0
  9. package/dist/cost.js +76 -0
  10. package/dist/format.d.ts +21 -0
  11. package/dist/format.js +426 -0
  12. package/dist/helpers.d.ts +14 -0
  13. package/dist/helpers.js +50 -0
  14. package/dist/index.d.ts +5 -0
  15. package/dist/index.js +699 -0
  16. package/dist/period.d.ts +1 -0
  17. package/dist/period.js +14 -0
  18. package/dist/providers/common.d.ts +24 -0
  19. package/dist/providers/common.js +114 -0
  20. package/dist/providers/core/anthropic.d.ts +2 -0
  21. package/dist/providers/core/anthropic.js +46 -0
  22. package/dist/providers/core/copilot.d.ts +2 -0
  23. package/dist/providers/core/copilot.js +117 -0
  24. package/dist/providers/core/openai.d.ts +2 -0
  25. package/dist/providers/core/openai.js +159 -0
  26. package/dist/providers/index.d.ts +8 -0
  27. package/dist/providers/index.js +14 -0
  28. package/dist/providers/registry.d.ts +9 -0
  29. package/dist/providers/registry.js +38 -0
  30. package/dist/providers/third_party/rightcode.d.ts +2 -0
  31. package/dist/providers/third_party/rightcode.js +230 -0
  32. package/dist/providers/types.d.ts +58 -0
  33. package/dist/providers/types.js +1 -0
  34. package/dist/quota.d.ts +49 -0
  35. package/dist/quota.js +116 -0
  36. package/dist/quota_render.d.ts +5 -0
  37. package/dist/quota_render.js +85 -0
  38. package/dist/storage.d.ts +32 -0
  39. package/dist/storage.js +328 -0
  40. package/dist/storage_chunks.d.ts +9 -0
  41. package/dist/storage_chunks.js +147 -0
  42. package/dist/storage_dates.d.ts +9 -0
  43. package/dist/storage_dates.js +88 -0
  44. package/dist/storage_parse.d.ts +4 -0
  45. package/dist/storage_parse.js +149 -0
  46. package/dist/storage_paths.d.ts +14 -0
  47. package/dist/storage_paths.js +31 -0
  48. package/dist/title.d.ts +8 -0
  49. package/dist/title.js +38 -0
  50. package/dist/types.d.ts +116 -0
  51. package/dist/types.js +1 -0
  52. package/dist/usage.d.ts +51 -0
  53. package/dist/usage.js +243 -0
  54. package/package.json +68 -0
  55. package/quota-sidebar.config.example.json +25 -0
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@leo000001/opencode-quota-sidebar",
3
+ "version": "1.0.0",
4
+ "description": "OpenCode plugin that shows quota and token usage in session titles",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist/*.js",
16
+ "dist/*.d.ts",
17
+ "dist/providers/**/*.js",
18
+ "dist/providers/**/*.d.ts",
19
+ "LICENSE",
20
+ "CHANGELOG.md",
21
+ "CONTRIBUTING.md",
22
+ "SECURITY.md",
23
+ "README.md",
24
+ "quota-sidebar.config.example.json"
25
+ ],
26
+ "scripts": {
27
+ "clean": "node -e \"const fs=require('fs'); fs.rmSync('dist',{recursive:true,force:true}); fs.rmSync('tsconfig.tsbuildinfo',{force:true});\"",
28
+ "build": "npm run clean && tsc -p tsconfig.json",
29
+ "prepare": "npm run build",
30
+ "prepack": "npm run build",
31
+ "prepublishOnly": "npm run typecheck && npm run build && npm test",
32
+ "typecheck": "tsc -p tsconfig.json --noEmit",
33
+ "test": "node -e \"const fs=require('fs'); const path=require('path'); const {spawnSync}=require('child_process'); const dir=path.join('dist','__tests__'); const files=fs.existsSync(dir)?fs.readdirSync(dir).filter(f=>f.endsWith('.test.js')).map(f=>path.join(dir,f)):[]; if(files.length===0){ console.error('No test files found under dist/__tests__. Run: npm run build'); process.exit(1);} const res=spawnSync(process.execPath,['--test',...files],{stdio:'inherit'}); process.exit(typeof res.status==='number'?res.status:1);\""
34
+ },
35
+ "keywords": [
36
+ "opencode",
37
+ "plugin",
38
+ "quota",
39
+ "sidebar",
40
+ "token-usage"
41
+ ],
42
+ "license": "MIT",
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "https://github.com/xihuai18/opencode-quota-sidebar.git"
46
+ },
47
+ "homepage": "https://github.com/xihuai18/opencode-quota-sidebar#readme",
48
+ "bugs": {
49
+ "url": "https://github.com/xihuai18/opencode-quota-sidebar/issues"
50
+ },
51
+ "author": "xihuai18",
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "engines": {
56
+ "node": ">=18"
57
+ },
58
+ "peerDependencies": {
59
+ "@opencode-ai/plugin": "^1.2.10",
60
+ "@opencode-ai/sdk": "^1.2.10"
61
+ },
62
+ "devDependencies": {
63
+ "@opencode-ai/plugin": "^1.2.10",
64
+ "@opencode-ai/sdk": "^1.2.10",
65
+ "@types/node": "^22.13.10",
66
+ "typescript": "^5.8.2"
67
+ }
68
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "sidebar": {
3
+ "enabled": true,
4
+ "width": 36,
5
+ "showCost": true,
6
+ "showQuota": true
7
+ },
8
+ "quota": {
9
+ "refreshMs": 300000,
10
+ "includeOpenAI": true,
11
+ "includeCopilot": true,
12
+ "includeAnthropic": true,
13
+ "providers": {
14
+ "rightcode": {
15
+ "enabled": true
16
+ }
17
+ },
18
+ "refreshAccessToken": false,
19
+ "requestTimeoutMs": 8000
20
+ },
21
+ "toast": {
22
+ "durationMs": 12000
23
+ },
24
+ "retentionDays": 730
25
+ }