@tokenwarden/opencode 0.1.2 → 0.1.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/dist/src/core/billing.js +6 -6
- package/dist/src/core/protection/engine.js +6 -3
- package/dist/src/core/protection/sidecar.js +4 -1
- package/native/bin/tokenwarden-build-config.json +1 -1
- package/native/bin/tokenwarden-engine-darwin-arm64.manifest.json +2 -2
- package/native/bin/tokenwarden-engine-darwin-x64.manifest.json +2 -2
- package/native/bin/tokenwarden-engine-linux-arm64.manifest.json +2 -2
- package/native/bin/tokenwarden-engine-linux-x64.manifest.json +2 -2
- package/native/bin/tokenwarden-engine-win32-x64.exe +0 -0
- package/native/bin/tokenwarden-engine-win32-x64.exe.manifest.json +3 -3
- package/package.json +1 -1
package/dist/src/core/billing.js
CHANGED
|
@@ -134,7 +134,7 @@ export async function getBillingEntitlement(store, now = new Date(), freeCapToke
|
|
|
134
134
|
.reduce((total, event) => total + event.savedTokens, 0);
|
|
135
135
|
if (account.plan === "standard" &&
|
|
136
136
|
account.status === "active" &&
|
|
137
|
-
(await
|
|
137
|
+
(await getStoredLicenseStatus(store, now)) === "valid") {
|
|
138
138
|
return {
|
|
139
139
|
account,
|
|
140
140
|
monthlySavedTokens,
|
|
@@ -153,18 +153,18 @@ export async function getBillingEntitlement(store, now = new Date(), freeCapToke
|
|
|
153
153
|
canOptimize: remainingFreeTokens > 0,
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
|
-
async function
|
|
156
|
+
export async function getStoredLicenseStatus(store, now = new Date(), machineHash) {
|
|
157
157
|
try {
|
|
158
158
|
const content = await encryptedReadFile(licensePath(store));
|
|
159
159
|
if (!content)
|
|
160
|
-
return
|
|
160
|
+
return "not-configured";
|
|
161
161
|
const stored = JSON.parse(content);
|
|
162
162
|
if (!stored.license)
|
|
163
|
-
return
|
|
164
|
-
return verifyLicense({ token: stored.license, publicKeyPem: LICENSE_PUBLIC_KEY, now }).ok;
|
|
163
|
+
return "invalid";
|
|
164
|
+
return verifyLicense({ token: stored.license, publicKeyPem: LICENSE_PUBLIC_KEY, now, machineHash }).ok ? "valid" : "invalid";
|
|
165
165
|
}
|
|
166
166
|
catch {
|
|
167
|
-
return
|
|
167
|
+
return "invalid";
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
export async function applySavingsCap(store, event, freeCapTokens = FREE_MONTHLY_SAVED_TOKEN_CAP) {
|
|
@@ -4,7 +4,7 @@ import { smartPack, smartRead } from "../code-summary.js";
|
|
|
4
4
|
import { reduceToolOutput } from "../log-reducer.js";
|
|
5
5
|
import { createSavingsEvent } from "../savings.js";
|
|
6
6
|
import { appendSavingsEvent, createStore, summarizeStore, writeRawOutput } from "../storage.js";
|
|
7
|
-
import { activateHostedLicense, applySavingsCap, connectBillingClient, disconnectBillingClient, getBillingEntitlement } from "../billing.js";
|
|
7
|
+
import { activateHostedLicense, applySavingsCap, connectBillingClient, disconnectBillingClient, getBillingEntitlement, getStoredLicenseStatus } from "../billing.js";
|
|
8
8
|
import { defaultSidecarPaths, requestSidecarReduceToolOutput, requestSidecarSmartPack, requestSidecarSmartRead, requestSidecarStatus, } from "./sidecar.js";
|
|
9
9
|
export async function createProtectedEngine(input = {}) {
|
|
10
10
|
if (input.preferNativeSidecar === false)
|
|
@@ -28,7 +28,7 @@ export function createSidecarBackedEngine(input) {
|
|
|
28
28
|
return createEngineFromStore(store, {
|
|
29
29
|
mode: input.status.mode,
|
|
30
30
|
license: "not-configured",
|
|
31
|
-
rulePack: "development",
|
|
31
|
+
rulePack: input.status.signingKey === "development-local" ? "development" : "valid",
|
|
32
32
|
tamper: "passed",
|
|
33
33
|
}, input.sidecarPaths, input.status.freeMonthlySavedTokenCap);
|
|
34
34
|
}
|
|
@@ -47,7 +47,10 @@ export function createEngineFromStore(store, status, sidecarPaths, freeCapTokens
|
|
|
47
47
|
const monthlyFreeCapTokens = freeCapTokens;
|
|
48
48
|
return {
|
|
49
49
|
async protectionStatus() {
|
|
50
|
-
return
|
|
50
|
+
return {
|
|
51
|
+
...status,
|
|
52
|
+
license: await getStoredLicenseStatus(store),
|
|
53
|
+
};
|
|
51
54
|
},
|
|
52
55
|
async smartRead(input) {
|
|
53
56
|
if (!sidecarPaths)
|
|
@@ -53,7 +53,10 @@ export async function requestSidecarStatus(paths = defaultSidecarPaths()) {
|
|
|
53
53
|
typeof result.siteURL !== "string") {
|
|
54
54
|
throw new Error("sidecar returned invalid status payload");
|
|
55
55
|
}
|
|
56
|
-
return
|
|
56
|
+
return {
|
|
57
|
+
...result,
|
|
58
|
+
signingKey: verification.manifest.signingKey,
|
|
59
|
+
};
|
|
57
60
|
}
|
|
58
61
|
export async function requestSidecarReduceToolOutput(input) {
|
|
59
62
|
const paths = input.paths ?? defaultSidecarPaths();
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"platform": "darwin",
|
|
9
9
|
"arch": "arm64",
|
|
10
10
|
"sha256": "513d90c920758b1f758d2d99c39c459f133d736eb13e188916c1234c94f14076",
|
|
11
|
-
"builtAt": "2026-06-
|
|
11
|
+
"builtAt": "2026-06-11T17:16:22.060Z",
|
|
12
12
|
"signingKey": "production-env",
|
|
13
13
|
"freeMonthlySavedTokenCap": 1000000,
|
|
14
14
|
"siteURL": "https://tokenwarden.ai/"
|
|
15
15
|
},
|
|
16
|
-
"signature": "
|
|
16
|
+
"signature": "_7dZQ2LTqQ1sQ5-idQcf6dVsWL98vGAz37aUffqSQyNiGjUPE0zzKEYOD60DdDwng4h2M_MZijnmL0zdfelEDQ"
|
|
17
17
|
}
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"platform": "darwin",
|
|
9
9
|
"arch": "x64",
|
|
10
10
|
"sha256": "ddba81a47b8bd308839765b04b1c48a837754b4074ff023ca96676019e8e3744",
|
|
11
|
-
"builtAt": "2026-06-
|
|
11
|
+
"builtAt": "2026-06-11T17:16:22.060Z",
|
|
12
12
|
"signingKey": "production-env",
|
|
13
13
|
"freeMonthlySavedTokenCap": 1000000,
|
|
14
14
|
"siteURL": "https://tokenwarden.ai/"
|
|
15
15
|
},
|
|
16
|
-
"signature": "
|
|
16
|
+
"signature": "GTtuYsP9zJ2QdpMjmd0CYP3VUGE0KjFLYbYvEisK4V2WNaGYsoWIO76JY259w-ENG9br26xVuzsNCD_ZO_4aBg"
|
|
17
17
|
}
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"platform": "linux",
|
|
9
9
|
"arch": "arm64",
|
|
10
10
|
"sha256": "06d9ad12796c9870a1a0515af08faa3e27fd1e4485b7c74bfd211ae32d617d7c",
|
|
11
|
-
"builtAt": "2026-06-
|
|
11
|
+
"builtAt": "2026-06-11T17:16:22.060Z",
|
|
12
12
|
"signingKey": "production-env",
|
|
13
13
|
"freeMonthlySavedTokenCap": 1000000,
|
|
14
14
|
"siteURL": "https://tokenwarden.ai/"
|
|
15
15
|
},
|
|
16
|
-
"signature": "
|
|
16
|
+
"signature": "9ITUCUcSm3vPwvp4fJWJ_s92phebmJkqJfYmgHC67_tvBIxKSNX04y6I3qLAYsZOaXdewJg2q8UxzBzWb00oBA"
|
|
17
17
|
}
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"platform": "linux",
|
|
9
9
|
"arch": "x64",
|
|
10
10
|
"sha256": "92767449e681a41c62fc2f9f732ea3b17d8f99b0d66d42abbffcdf3f0bdff226",
|
|
11
|
-
"builtAt": "2026-06-
|
|
11
|
+
"builtAt": "2026-06-11T17:16:22.060Z",
|
|
12
12
|
"signingKey": "production-env",
|
|
13
13
|
"freeMonthlySavedTokenCap": 1000000,
|
|
14
14
|
"siteURL": "https://tokenwarden.ai/"
|
|
15
15
|
},
|
|
16
|
-
"signature": "
|
|
16
|
+
"signature": "iC1dMKqr5kfig1vtuXvwExxxqpdsGtz3JE1G3MiiV8t6iKYyJpYUxZXtVTqdOn3n32QLejBl_RX2UGCBFfgeBg"
|
|
17
17
|
}
|
|
Binary file
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
"binary": "tokenwarden-engine-win32-x64.exe",
|
|
8
8
|
"platform": "win32",
|
|
9
9
|
"arch": "x64",
|
|
10
|
-
"sha256": "
|
|
11
|
-
"builtAt": "2026-06-
|
|
10
|
+
"sha256": "b4a32319bf6b19dd4e6a79caeb3cc3f0471773153b93d4b60ce08cdf819bf39b",
|
|
11
|
+
"builtAt": "2026-06-11T17:16:22.060Z",
|
|
12
12
|
"signingKey": "production-env",
|
|
13
13
|
"freeMonthlySavedTokenCap": 1000000,
|
|
14
14
|
"siteURL": "https://tokenwarden.ai/"
|
|
15
15
|
},
|
|
16
|
-
"signature": "
|
|
16
|
+
"signature": "UsB89_fWLtUNC4PJXAMbmtz8mZmj7UGlFHPIvAIvVEAPHXPpWSPT-ZiSdMUbcrEKjG54wD-Ou9WA-ZlpkRsfAA"
|
|
17
17
|
}
|