opencode-interrupt-plugin 0.4.37 → 0.4.38

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.
@@ -2,6 +2,11 @@ const POLAR_ORG_ID = '166f4429-84b8-4e41-9c74-eff1b8724873';
2
2
  const POLAR_VALIDATE_URL = 'https://api.polar.sh/v1/customer-portal/license-keys/validate';
3
3
  const POLAR_ACTIVATE_URL = 'https://api.polar.sh/v1/customer-portal/license-keys/activate';
4
4
  const OFFLINE_GRACE_DAYS = 7;
5
+ async function timeoutSignal(ms) {
6
+ const ctrl = new AbortController();
7
+ setTimeout(() => ctrl.abort(), ms);
8
+ return ctrl.signal;
9
+ }
5
10
  export async function activateLicense(key, machineLabel) {
6
11
  try {
7
12
  const response = await fetch(POLAR_ACTIVATE_URL, {
@@ -13,7 +18,7 @@ export async function activateLicense(key, machineLabel) {
13
18
  label: machineLabel,
14
19
  conditions: { major_version: 1 },
15
20
  }),
16
- signal: AbortSignal.timeout(8000),
21
+ signal: await timeoutSignal(8000),
17
22
  });
18
23
  if (response.status === 200) {
19
24
  const data = await response.json();
@@ -49,7 +54,7 @@ export async function validateLicense(key, activationId) {
49
54
  activation_id: activationId,
50
55
  conditions: { major_version: 1 },
51
56
  }),
52
- signal: AbortSignal.timeout(5000),
57
+ signal: await timeoutSignal(5000),
53
58
  });
54
59
  if (response.status === 200) {
55
60
  const data = await response.json();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-interrupt-plugin",
3
- "version": "0.4.37",
3
+ "version": "0.4.38",
4
4
  "description": "Streaming TTS + voice interruption for OpenCode. Speaks responses as they arrive and detects when you talk over it.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",