ai-killswitch 1.2.0 → 1.2.1
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/bin/killswitch.js +16 -8
- package/package.json +1 -1
package/bin/killswitch.js
CHANGED
|
@@ -46,15 +46,23 @@ async function signDeathReceipt(receipt, privateKey) {
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
// Vault sync -
|
|
50
|
-
|
|
49
|
+
// Vault sync - opt-in telemetry
|
|
50
|
+
// Only sends if VAULT_SYNC=on env var
|
|
51
|
+
// Sends: receipt_id, signer, timestamp, event_type, status (NO process command details)
|
|
52
|
+
function pingCounter(receipt, enabled = false) {
|
|
53
|
+
if (!enabled) return;
|
|
54
|
+
|
|
51
55
|
fetch(COUNTER_URL, {
|
|
52
56
|
method: 'POST',
|
|
53
57
|
headers: { 'Content-Type': 'application/json' },
|
|
54
58
|
body: JSON.stringify({
|
|
55
|
-
|
|
59
|
+
receipt_id: `KILL-${Date.now()}`,
|
|
60
|
+
signer: receipt.signer,
|
|
61
|
+
timestamp: receipt.timestamp,
|
|
62
|
+
event_type: receipt.type,
|
|
63
|
+
status: receipt.status,
|
|
56
64
|
sdk_source: 'ai-killswitch',
|
|
57
|
-
sdk_version: '1.2.
|
|
65
|
+
sdk_version: '1.2.1',
|
|
58
66
|
}),
|
|
59
67
|
}).catch(() => {});
|
|
60
68
|
}
|
|
@@ -104,7 +112,7 @@ async function getProcessInfo(pid) {
|
|
|
104
112
|
program
|
|
105
113
|
.name('ai-killswitch')
|
|
106
114
|
.description('Dead man\'s switch for AI. Monitor. Kill. Sign receipt.')
|
|
107
|
-
.version('1.2.
|
|
115
|
+
.version('1.2.1\n' + PATENT_NOTICE, '-v, --version');
|
|
108
116
|
|
|
109
117
|
// KILL command - terminate and sign receipt
|
|
110
118
|
program
|
|
@@ -150,7 +158,7 @@ program
|
|
|
150
158
|
console.log(`[KILLSWITCH] Signer: ${signedReceipt.signer}`);
|
|
151
159
|
|
|
152
160
|
// Ping counter
|
|
153
|
-
pingCounter(signedReceipt);
|
|
161
|
+
pingCounter(signedReceipt, process.env.VAULT_SYNC === 'on');
|
|
154
162
|
});
|
|
155
163
|
|
|
156
164
|
// WATCH command - monitor a process
|
|
@@ -186,7 +194,7 @@ program
|
|
|
186
194
|
const signedReceipt = await signDeathReceipt(receipt, key);
|
|
187
195
|
fs.writeFileSync('death-receipt.json', JSON.stringify(signedReceipt, null, 2));
|
|
188
196
|
console.log('[KILLSWITCH] Death receipt signed: death-receipt.json');
|
|
189
|
-
pingCounter(signedReceipt);
|
|
197
|
+
pingCounter(signedReceipt, process.env.VAULT_SYNC === 'on');
|
|
190
198
|
} else {
|
|
191
199
|
await killProcess(targetPid);
|
|
192
200
|
}
|
|
@@ -276,7 +284,7 @@ program
|
|
|
276
284
|
const signedReceipt = await signDeathReceipt(receipt, key);
|
|
277
285
|
fs.writeFileSync('death-receipt.json', JSON.stringify(signedReceipt, null, 2));
|
|
278
286
|
console.log('[KILLSWITCH] Death receipt signed: death-receipt.json');
|
|
279
|
-
pingCounter(signedReceipt);
|
|
287
|
+
pingCounter(signedReceipt, process.env.VAULT_SYNC === 'on');
|
|
280
288
|
} else {
|
|
281
289
|
child.kill('SIGKILL');
|
|
282
290
|
}
|