@dropout-ai/runtime 0.2.3 → 0.2.4
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/package.json +1 -1
- package/src/index.js +14 -0
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -7,6 +7,19 @@ const sessionId =
|
|
|
7
7
|
global.__dropout_session_id__ ||
|
|
8
8
|
(global.__dropout_session_id__ = crypto.randomUUID());
|
|
9
9
|
|
|
10
|
+
// Internal telemetry sender
|
|
11
|
+
async function safeSendTelemetry(payload) {
|
|
12
|
+
try {
|
|
13
|
+
await originalFetch('http://localhost:4000/capture', {
|
|
14
|
+
method: 'POST',
|
|
15
|
+
headers: { 'Content-Type': 'application/json' },
|
|
16
|
+
body: JSON.stringify(payload)
|
|
17
|
+
});
|
|
18
|
+
} catch (e) {
|
|
19
|
+
// Fail silently
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
10
23
|
const NEGATIVE_FEEDBACK = [
|
|
11
24
|
"not helpful",
|
|
12
25
|
"dont just dump",
|
|
@@ -61,6 +74,7 @@ function detectSignals(text, output = "") {
|
|
|
61
74
|
}
|
|
62
75
|
|
|
63
76
|
(function () {
|
|
77
|
+
"use strict";
|
|
64
78
|
// 1. Guard global.fetch existence and idempotency
|
|
65
79
|
if (typeof global.fetch !== 'function' || global.fetch.__dropout_patched__) {
|
|
66
80
|
return;
|