@qadanm/opencode-smart-router 0.0.0-stage → 0.6.1

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 (62) hide show
  1. package/CHANGELOG.md +286 -0
  2. package/CONTRIBUTING.md +103 -0
  3. package/LICENSE +21 -0
  4. package/README.md +425 -2
  5. package/SECURITY.md +174 -0
  6. package/config.example.json +107 -0
  7. package/dist/npm/index.js +40 -0
  8. package/docs/ARCHITECTURE.md +104 -0
  9. package/docs/DEBUGGING-GUI.md +70 -0
  10. package/docs/INSTALL.md +151 -0
  11. package/docs/LIMITATIONS.md +230 -0
  12. package/docs/MODELS.md +124 -0
  13. package/docs/OPENDESIGN-INTEGRATION.md +635 -0
  14. package/docs/QA.md +142 -0
  15. package/docs/SHARED-CORE.md +114 -0
  16. package/install +75 -0
  17. package/package.json +94 -4
  18. package/scripts/install.sh +324 -0
  19. package/scripts/uninstall.sh +91 -0
  20. package/src/allowance.ts +135 -0
  21. package/src/core/classify/classifier.ts +305 -0
  22. package/src/core/config-writer.ts +167 -0
  23. package/src/core/config.ts +1047 -0
  24. package/src/core/context/strategy.ts +188 -0
  25. package/src/core/context-health.ts +39 -0
  26. package/src/core/failures.ts +398 -0
  27. package/src/core/history/opencode.ts +173 -0
  28. package/src/core/models/protocol.ts +22 -0
  29. package/src/core/models/registry.ts +204 -0
  30. package/src/core/models/seed.ts +781 -0
  31. package/src/core/offline/mode.ts +321 -0
  32. package/src/core/plan-page.ts +390 -0
  33. package/src/core/plans/catalog.ts +487 -0
  34. package/src/core/policy/calibration.ts +259 -0
  35. package/src/core/policy/eligibility.ts +630 -0
  36. package/src/core/providers/enablement.ts +143 -0
  37. package/src/core/providers/opendesign-credits.ts +206 -0
  38. package/src/core/providers/opendesign-models.ts +654 -0
  39. package/src/core/providers/opendesign.ts +474 -0
  40. package/src/core/quota/calibration.ts +166 -0
  41. package/src/core/quota/commandcode.ts +471 -0
  42. package/src/core/quota/credentials.ts +490 -0
  43. package/src/core/quota/ledger.ts +1304 -0
  44. package/src/core/quota/opencode-go.ts +148 -0
  45. package/src/core/quota/opendesign.ts +1043 -0
  46. package/src/core/quota/reconcile.ts +155 -0
  47. package/src/core/quota/report.ts +261 -0
  48. package/src/core/quota/service.ts +273 -0
  49. package/src/core/reprompt.ts +48 -0
  50. package/src/core/routing/engine.ts +978 -0
  51. package/src/core/types.ts +866 -0
  52. package/src/core/ui.ts +236 -0
  53. package/src/core/util.ts +114 -0
  54. package/src/gui/index.tsx +1675 -0
  55. package/src/gui/viewmodel.ts +456 -0
  56. package/src/index.ts +33 -0
  57. package/src/rpc.ts +204 -0
  58. package/src/server/containment.ts +131 -0
  59. package/src/server/controller.ts +3405 -0
  60. package/src/server/route-tracker.ts +60 -0
  61. package/src/server/shared-core.ts +701 -0
  62. package/src/tui/index.tsx +168 -0
@@ -0,0 +1,107 @@
1
+ {
2
+ "enabled": true,
3
+ "mode": "balanced",
4
+ "dryRun": false,
5
+ "providers": {
6
+ "opencode-go": {
7
+ "enabled": true,
8
+ "plan": "go",
9
+ "reserveMonthlyPct": 10,
10
+ "reserveWeeklyPct": 15,
11
+ "reserveFiveHourPct": 10,
12
+ "allowExtraUsage": false,
13
+ "probeUsage": true,
14
+ "credentialSource": "auto"
15
+ },
16
+ "commandcode": {
17
+ "enabled": true,
18
+ "plan": "goat",
19
+ "reserveMonthlyPct": 10,
20
+ "reserveWeeklyPct": 15,
21
+ "reserveFiveHourPct": 10,
22
+ "allowExtraUsage": false,
23
+ "probeUsage": true,
24
+ "monthlyCreditsUsd": 70,
25
+ "fiveHourCapUsd": 14,
26
+ "weeklyCapUsd": 35,
27
+ "credentialSource": "auto"
28
+ },
29
+ "opendesign": {
30
+ "enabled": true,
31
+ "plan": "pro",
32
+ "reserveMonthlyPct": 5,
33
+ "reserveWeeklyPct": 10,
34
+ "reserveFiveHourPct": 0,
35
+ "allowExtraUsage": false,
36
+ "probeUsage": true,
37
+ "subscriptionOnly": true,
38
+ "providerScopedQuota": true,
39
+ "ignoreFiveHourWindow": true,
40
+ "credentialSource": "auto"
41
+ }
42
+ },
43
+ "privacy": {
44
+ "allowTrainingModels": false,
45
+ "allowFreeModels": false,
46
+ "requireZdr": false
47
+ },
48
+ "premium": {
49
+ "mode": "ask",
50
+ "monthlyBudgetUsd": 0,
51
+ "oneShotApproval": true
52
+ },
53
+ "routing": {
54
+ "intelligenceFloor": 39.5,
55
+ "designFloor": 60,
56
+ "sophisticatedDesignFloor": 75,
57
+ "switchHysteresisPct": 20,
58
+ "largeContextTokens": 300000,
59
+ "largeContextHysteresisPct": 35,
60
+ "maxEscalationsPerTask": 2,
61
+ "preferSameProvider": true,
62
+ "failClosed": false,
63
+ "protectEscalationPool": true,
64
+ "longContextFloorTokens": 1000000
65
+ },
66
+ "quota": {
67
+ "probeOpenCodeGo": true,
68
+ "probeCommandCode": true,
69
+ "probeOpenDesign": true,
70
+ "probeIntervalMinutes": 5,
71
+ "bootstrapSessions": 100,
72
+ "bootstrapDays": 31
73
+ },
74
+ "contextHealth": {
75
+ "enabled": true,
76
+ "warnAtTokens": 400000,
77
+ "recommendAtTokens": 700000
78
+ },
79
+ "contextManagement": {
80
+ "mode": "native",
81
+ "enabled": true,
82
+ "compactAtTokens": 0,
83
+ "cooldownMinutes": 10,
84
+ "allowEmergencyCompaction": true
85
+ },
86
+ "speed": {
87
+ "enabled": true,
88
+ "weightPct": 15,
89
+ "minSamples": 3,
90
+ "slowRouteMultiple": 2.5
91
+ },
92
+ "ui": {
93
+ "notifications": true,
94
+ "compactMode": false
95
+ },
96
+ "logging": {
97
+ "storePromptText": false,
98
+ "decisionLogSize": 100,
99
+ "diagnostics": true
100
+ },
101
+ "models": {
102
+ "approved": [],
103
+ "excluded": [],
104
+ "tierOverrides": {},
105
+ "definitions": []
106
+ }
107
+ }