@gabrielsmartin/orbit-sdk 0.4.1 → 0.4.3

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/README.md CHANGED
@@ -144,7 +144,7 @@ const stats = orbit.stats()
144
144
  Free to try, no auth required:
145
145
 
146
146
  ```bash
147
- curl -X POST https://gtll-soul-guide-81e596e1.base44.app/functions/orbitGateway \
147
+ curl -X POST https://api.gtll.app/orbitRoute \
148
148
  -H "Content-Type: application/json" \
149
149
  -d '{"query": "write a haiku about recursion"}'
150
150
  ```
@@ -153,11 +153,11 @@ curl -X POST https://gtll-soul-guide-81e596e1.base44.app/functions/orbitGateway
153
153
 
154
154
  | Tier | Price | Limit |
155
155
  |------|-------|-------|
156
- | Free | $0/mo | 3 queries/day |
157
- | Pro | $19/mo | Unlimited |
158
- | Team | $99/mo | Unlimited · 5 seats |
156
+ | Free | $0/mo | 100 queries/day |
157
+ | Pro | **$9/mo** · founding rate, locked forever | Unlimited |
158
+ | Team | **$49/mo** · founding rate, locked forever | Unlimited · 5 seats |
159
159
 
160
- → [Pro](https://buy.stripe.com/6oE5kF3Yz5Co06s9AB) · [Team](https://buy.stripe.com/9AQ9AV5GH9SEdss6op)
160
+ → [Get Pro](https://buy.stripe.com/7sY14mdHYbTE3DT4PIbwk00) · [Get Team](https://buy.stripe.com/9B67sKfQ6bTE0rHgyqbwk01)
161
161
 
162
162
  ---
163
163
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gabrielsmartin/orbit-sdk",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "Rule-based LLM router. Classifies queries across 8 axes and picks the optimal model. Fast, deterministic, zero dependencies.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -39,7 +39,7 @@
39
39
  "license": "MIT",
40
40
  "repository": {
41
41
  "type": "git",
42
- "url": "git+https://github.com/gtllco/orbit.git"
42
+ "url": "https://github.com/gtllco/orbit.git"
43
43
  },
44
44
  "homepage": "https://github.com/gtllco/orbit",
45
45
  "bugs": {
@@ -100,3 +100,40 @@ export function fingerprint(text) {
100
100
  domain,
101
101
  };
102
102
  }
103
+
104
+ /**
105
+ * Apply signal bias to a fingerprint before routing.
106
+ * 777 = completion → quality floor (never cheap out on final form)
107
+ * 555 = variation → inject creativity + recency (break the expected model)
108
+ * 333 = foundation → cost floor (strip to minimum — ethics override still wins)
109
+ *
110
+ * @param {Object} scores - Raw 8-axis fingerprint
111
+ * @param {string|null} signalCode - "777" | "555" | "333" | null
112
+ * @returns {Object} Biased fingerprint
113
+ */
114
+ export function applySignalBias(scores, signalCode) {
115
+ if (!signalCode) return scores;
116
+ const s = { ...scores };
117
+
118
+ if (signalCode === "777") {
119
+ s.cost_tolerance = Math.max(s.cost_tolerance, 8);
120
+ s.complexity = Math.max(s.complexity, 6);
121
+ s.signal_applied = "777";
122
+ s.signal_reason = "Completion bias — quality floor raised. Final form deserves the best model.";
123
+ } else if (signalCode === "555") {
124
+ s.creativity = Math.max(s.creativity, 6);
125
+ s.recency = Math.max(s.recency, 5);
126
+ s.variation_mode = true;
127
+ s.signal_applied = "555";
128
+ s.signal_reason = "Variation bias — creativity + recency floors raised. Breaking the default pattern.";
129
+ } else if (signalCode === "333") {
130
+ if ((s.emotional_weight ?? 0) < 7) {
131
+ s.cost_tolerance = 1;
132
+ s.complexity = Math.min(s.complexity, 4);
133
+ }
134
+ s.signal_applied = "333";
135
+ s.signal_reason = "Foundation bias — cost minimized. Strip to essentials.";
136
+ }
137
+
138
+ return s;
139
+ }
package/src/index.d.ts CHANGED
@@ -74,6 +74,8 @@ export declare class OrbitClient {
74
74
  export declare function fingerprint(text: string): QueryScores;
75
75
  export declare function route(scores: QueryScores, config?: OrbitConfig): { model: ModelInfo; reason: string; rule: string };
76
76
  export declare function calculateSavings(model: ModelInfo, estimatedTokens?: number): SavingsInfo;
77
+ export declare function applySignalBias(scores: QueryScores, signalCode: '777' | '555' | '333' | null): QueryScores & { signal_applied?: string; signal_reason?: string; variation_mode?: boolean };
78
+ export declare function inferSignalFromEvent(eventPriority: string): '777' | '555' | '333' | null;
77
79
  export declare const MODEL_MATRIX: Record<string, ModelInfo>;
78
80
 
79
81
  declare const orbit: OrbitClient;
package/src/index.js CHANGED
@@ -7,12 +7,12 @@
7
7
  * 777 · 555 · 333
8
8
  */
9
9
 
10
- import { fingerprint } from './fingerprint.js';
10
+ import { fingerprint, applySignalBias } from './fingerprint.js';
11
11
  import { route, calculateSavings, MODEL_MATRIX } from './router.js';
12
12
 
13
- export { fingerprint, route, calculateSavings, MODEL_MATRIX };
13
+ export { fingerprint, applySignalBias, route, calculateSavings, MODEL_MATRIX };
14
14
 
15
- const GATEWAY_URL = 'https://gtll-soul-guide-81e596e1.base44.app/functions/orbitWaitlist';
15
+ const GATEWAY_URL = 'https://api.gtll.app/orbitSignup';
16
16
 
17
17
  /**
18
18
  * OrbitClient — the main class
@@ -52,19 +52,19 @@ export class OrbitClient {
52
52
  * @returns {{ model, reason, rule, scores, savings, timestamp }}
53
53
  */
54
54
  route(text, options = {}) {
55
- const scores = fingerprint(text);
55
+ let scores = fingerprint(text);
56
56
 
57
57
  if (options.cost_tolerance) {
58
58
  scores.cost_tolerance = options.cost_tolerance === 'low' ? 2
59
59
  : options.cost_tolerance === 'high' ? 9 : 5;
60
60
  }
61
61
 
62
- const config = {
63
- ...this.config,
64
- ...options,
65
- signal: options.signal || this.config.signal || null,
66
- };
62
+ // Apply signal bias (777/555/333) — modifies axes before routing
63
+ if (options.signal) {
64
+ scores = applySignalBias(scores, options.signal);
65
+ }
67
66
 
67
+ const config = { ...this.config, ...options };
68
68
  const decision = route(scores, config);
69
69
  const savings = calculateSavings(decision.model, options.estimated_tokens || 500);
70
70
 
@@ -72,6 +72,8 @@ export class OrbitClient {
72
72
  model: decision.model,
73
73
  reason: decision.reason,
74
74
  rule: decision.rule,
75
+ signal: options.signal || null,
76
+ signal_reason: scores.signal_reason || null,
75
77
  scores,
76
78
  savings,
77
79
  timestamp: new Date().toISOString(),
@@ -88,7 +90,7 @@ export class OrbitClient {
88
90
 
89
91
  // Nudge unauthenticated users toward API key
90
92
  if (!this.config.apiKey && this._stats.total_queries === 3) {
91
- console.warn(`[ORBIT] Free tier: 15 API queries/day. Get your key → https://gtll-soul-guide-81e596e1.base44.app/functions/orbitWaitlist (POST { action: "get_key", email })`);
93
+ console.warn(`[ORBIT] Free tier: 100 API queries/day. Get your key → https://api.gtll.app/orbitSignup (POST { action: "get_key", email })`);
92
94
  }
93
95
  }
94
96
 
package/src/router.js CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  export const MODEL_MATRIX = {
13
13
  claude_sonnet: {
14
- id: 'claude-sonnet-3-5',
14
+ id: 'claude-sonnet-4-6',
15
15
  name: 'Claude Sonnet',
16
16
  provider: 'anthropic',
17
17
  costPer1M: 15,
@@ -20,7 +20,7 @@ export const MODEL_MATRIX = {
20
20
  tier: 'medium',
21
21
  },
22
22
  claude_haiku: {
23
- id: 'claude-haiku-3-5',
23
+ id: 'claude-haiku-4-5',
24
24
  name: 'Claude Haiku',
25
25
  provider: 'anthropic',
26
26
  costPer1M: 1,
@@ -84,6 +84,17 @@ export function route(scores, config = {}) {
84
84
 
85
85
  const blocked = config.blocked_models || [];
86
86
  const preferLow = config.cost_tolerance === 'low' || cost_tolerance <= 3;
87
+ const preferHigh = config.cost_tolerance === 'high' || cost_tolerance >= 8;
88
+ const variationMode = scores.variation_mode ?? false;
89
+
90
+ // Rule 0: SIGNAL 555 VARIATION — break the default pattern before all other rules
91
+ if (variationMode && recency >= 5 && !blocked.includes('grok')) {
92
+ return {
93
+ model: MODEL_MATRIX.grok,
94
+ reason: `Signal 555 — variation mode active, recency ${recency}/10. Grok selected to break the default routing.`,
95
+ rule: 'signal_555_variation',
96
+ };
97
+ }
87
98
 
88
99
  // Signal override (777/555/333) — always wins if set
89
100
  if (config.signal === '777') {