caplyr 0.1.7 → 0.1.9

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/dist/index.d.mts CHANGED
@@ -8,7 +8,7 @@ interface CaplyrConfig {
8
8
  };
9
9
  downgradeThreshold?: number;
10
10
  fallback?: string;
11
- /** API endpoint for heartbeat and log ingestion (default: https://api.caplyr.com) */
11
+ /** API endpoint for heartbeat and log ingestion (default: https://caplyr.com) */
12
12
  endpoint?: string;
13
13
  /** Dashboard URL for error messages (default: https://app.caplyr.com) */
14
14
  dashboardUrl?: string;
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ interface CaplyrConfig {
8
8
  };
9
9
  downgradeThreshold?: number;
10
10
  fallback?: string;
11
- /** API endpoint for heartbeat and log ingestion (default: https://api.caplyr.com) */
11
+ /** API endpoint for heartbeat and log ingestion (default: https://caplyr.com) */
12
12
  endpoint?: string;
13
13
  /** Dashboard URL for error messages (default: https://app.caplyr.com) */
14
14
  dashboardUrl?: string;
package/dist/index.js CHANGED
@@ -50,7 +50,7 @@ var LogShipper = class {
50
50
  constructor(config) {
51
51
  this.buffer = [];
52
52
  this.timer = null;
53
- this.endpoint = config.endpoint ?? "https://api.caplyr.com";
53
+ this.endpoint = config.endpoint ?? "https://caplyr.com";
54
54
  this.apiKey = config.apiKey;
55
55
  this.batchSize = config.batchSize ?? 10;
56
56
  this.flushInterval = config.flushInterval ?? 3e4;
@@ -128,7 +128,7 @@ var Heartbeat = class {
128
128
  };
129
129
  this.status = "ACTIVE";
130
130
  this.lastHeartbeatAt = null;
131
- this.endpoint = config.endpoint ?? "https://api.caplyr.com";
131
+ this.endpoint = config.endpoint ?? "https://caplyr.com";
132
132
  this.apiKey = config.apiKey;
133
133
  this.interval = config.heartbeatInterval ?? 6e4;
134
134
  this.budget = config.budget;
@@ -293,16 +293,13 @@ function enforcePreCall(model, config, heartbeat, shipper, provider, startTime)
293
293
  dashboard_url: dashboardUrl
294
294
  };
295
295
  pushBlockedLog(shipper, provider, model, startTime, reason, config.endpoint_tag);
296
- if (config.mode === "alert_only") {
297
- config.onEnforcement?.({
298
- type: "kill_switch",
299
- timestamp: Date.now(),
300
- reason: blockError.message,
301
- budget_used: blockError.budget_used,
302
- budget_limit: blockError.budget_limit
303
- });
304
- return { proceed: true, model, downgraded: false, enforcementReason: reason };
305
- }
296
+ config.onEnforcement?.({
297
+ type: "kill_switch",
298
+ timestamp: Date.now(),
299
+ reason: blockError.message,
300
+ budget_used: blockError.budget_used,
301
+ budget_limit: blockError.budget_limit
302
+ });
306
303
  throw Object.assign(new Error(blockError.message), { caplyr: blockError });
307
304
  }
308
305
  if (config.mode === "cost_protect") {
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ var LogShipper = class {
17
17
  constructor(config) {
18
18
  this.buffer = [];
19
19
  this.timer = null;
20
- this.endpoint = config.endpoint ?? "https://api.caplyr.com";
20
+ this.endpoint = config.endpoint ?? "https://caplyr.com";
21
21
  this.apiKey = config.apiKey;
22
22
  this.batchSize = config.batchSize ?? 10;
23
23
  this.flushInterval = config.flushInterval ?? 3e4;
@@ -95,7 +95,7 @@ var Heartbeat = class {
95
95
  };
96
96
  this.status = "ACTIVE";
97
97
  this.lastHeartbeatAt = null;
98
- this.endpoint = config.endpoint ?? "https://api.caplyr.com";
98
+ this.endpoint = config.endpoint ?? "https://caplyr.com";
99
99
  this.apiKey = config.apiKey;
100
100
  this.interval = config.heartbeatInterval ?? 6e4;
101
101
  this.budget = config.budget;
@@ -260,16 +260,13 @@ function enforcePreCall(model, config, heartbeat, shipper, provider, startTime)
260
260
  dashboard_url: dashboardUrl
261
261
  };
262
262
  pushBlockedLog(shipper, provider, model, startTime, reason, config.endpoint_tag);
263
- if (config.mode === "alert_only") {
264
- config.onEnforcement?.({
265
- type: "kill_switch",
266
- timestamp: Date.now(),
267
- reason: blockError.message,
268
- budget_used: blockError.budget_used,
269
- budget_limit: blockError.budget_limit
270
- });
271
- return { proceed: true, model, downgraded: false, enforcementReason: reason };
272
- }
263
+ config.onEnforcement?.({
264
+ type: "kill_switch",
265
+ timestamp: Date.now(),
266
+ reason: blockError.message,
267
+ budget_used: blockError.budget_used,
268
+ budget_limit: blockError.budget_limit
269
+ });
273
270
  throw Object.assign(new Error(blockError.message), { caplyr: blockError });
274
271
  }
275
272
  if (config.mode === "cost_protect") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "caplyr",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "AI Cost Control Plane — budget guardrails, auto-downgrade, and kill switch for AI API calls",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",