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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -12
- package/dist/index.mjs +9 -12
- package/package.json +1 -1
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://
|
|
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://
|
|
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://
|
|
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://
|
|
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
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
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://
|
|
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://
|
|
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
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
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") {
|