caplyr 0.1.0 → 0.1.2
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.js +13 -0
- package/dist/index.mjs +13 -0
- package/package.json +11 -5
package/dist/index.js
CHANGED
|
@@ -43,7 +43,13 @@ var LogShipper = class {
|
|
|
43
43
|
this.onError = config.onError;
|
|
44
44
|
this.timer = setInterval(() => this.flush(), this.flushInterval);
|
|
45
45
|
if (typeof process !== "undefined" && process.on) {
|
|
46
|
+
const flushAndExit = () => {
|
|
47
|
+
this.flush().finally(() => {
|
|
48
|
+
});
|
|
49
|
+
};
|
|
46
50
|
process.on("beforeExit", () => this.flush());
|
|
51
|
+
process.on("SIGTERM", flushAndExit);
|
|
52
|
+
process.on("SIGINT", flushAndExit);
|
|
47
53
|
}
|
|
48
54
|
}
|
|
49
55
|
/**
|
|
@@ -92,6 +98,13 @@ var LogShipper = class {
|
|
|
92
98
|
}
|
|
93
99
|
this.flush();
|
|
94
100
|
}
|
|
101
|
+
async shutdown() {
|
|
102
|
+
if (this.timer) {
|
|
103
|
+
clearInterval(this.timer);
|
|
104
|
+
this.timer = null;
|
|
105
|
+
}
|
|
106
|
+
await this.flush();
|
|
107
|
+
}
|
|
95
108
|
};
|
|
96
109
|
|
|
97
110
|
// src/heartbeat.ts
|
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,13 @@ var LogShipper = class {
|
|
|
10
10
|
this.onError = config.onError;
|
|
11
11
|
this.timer = setInterval(() => this.flush(), this.flushInterval);
|
|
12
12
|
if (typeof process !== "undefined" && process.on) {
|
|
13
|
+
const flushAndExit = () => {
|
|
14
|
+
this.flush().finally(() => {
|
|
15
|
+
});
|
|
16
|
+
};
|
|
13
17
|
process.on("beforeExit", () => this.flush());
|
|
18
|
+
process.on("SIGTERM", flushAndExit);
|
|
19
|
+
process.on("SIGINT", flushAndExit);
|
|
14
20
|
}
|
|
15
21
|
}
|
|
16
22
|
/**
|
|
@@ -59,6 +65,13 @@ var LogShipper = class {
|
|
|
59
65
|
}
|
|
60
66
|
this.flush();
|
|
61
67
|
}
|
|
68
|
+
async shutdown() {
|
|
69
|
+
if (this.timer) {
|
|
70
|
+
clearInterval(this.timer);
|
|
71
|
+
this.timer = null;
|
|
72
|
+
}
|
|
73
|
+
await this.flush();
|
|
74
|
+
}
|
|
62
75
|
};
|
|
63
76
|
|
|
64
77
|
// src/heartbeat.ts
|
package/package.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "caplyr",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
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",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
-
"files": [
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
9
11
|
"exports": {
|
|
10
12
|
".": {
|
|
11
13
|
"types": "./dist/index.d.ts",
|
|
12
14
|
"import": "./dist/index.mjs",
|
|
13
|
-
"require": "./dist/index.js"
|
|
15
|
+
"require": "./dist/index.js"
|
|
14
16
|
}
|
|
15
17
|
},
|
|
16
18
|
"scripts": {
|
|
@@ -42,8 +44,12 @@
|
|
|
42
44
|
"openai": ">=4.0.0"
|
|
43
45
|
},
|
|
44
46
|
"peerDependenciesMeta": {
|
|
45
|
-
"@anthropic-ai/sdk": {
|
|
46
|
-
|
|
47
|
+
"@anthropic-ai/sdk": {
|
|
48
|
+
"optional": true
|
|
49
|
+
},
|
|
50
|
+
"openai": {
|
|
51
|
+
"optional": true
|
|
52
|
+
}
|
|
47
53
|
},
|
|
48
54
|
"devDependencies": {
|
|
49
55
|
"@anthropic-ai/sdk": "^0.30.0",
|