@tokenwarden/opencode 0.1.2 → 0.1.3

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.
@@ -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 hasValidStoredLicense(store, now))) {
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 hasValidStoredLicense(store, now) {
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 false;
160
+ return "not-configured";
161
161
  const stored = JSON.parse(content);
162
162
  if (!stored.license)
163
- return false;
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 false;
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 status;
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 result;
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();
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "siteURL": "https://tokenwarden.ai/",
3
- "generatedAt": "2026-06-11T13:30:16.184Z"
3
+ "generatedAt": "2026-06-11T14:43:43.265Z"
4
4
  }
@@ -8,10 +8,10 @@
8
8
  "platform": "darwin",
9
9
  "arch": "arm64",
10
10
  "sha256": "513d90c920758b1f758d2d99c39c459f133d736eb13e188916c1234c94f14076",
11
- "builtAt": "2026-06-11T13:30:16.184Z",
11
+ "builtAt": "2026-06-11T14:43:43.265Z",
12
12
  "signingKey": "production-env",
13
13
  "freeMonthlySavedTokenCap": 1000000,
14
14
  "siteURL": "https://tokenwarden.ai/"
15
15
  },
16
- "signature": "iF6XOVsohoW2HtnU5Qs-EKi8w7zN-QOFnuWmBEZt1pgkYmyb4GmeeIsfKJohVfaz85PRVvdZ1SYDmKibxxLJBw"
16
+ "signature": "L2J2B9YavNUQodYbet2PYd86LliDH616BmyaWgH_2SLbfXLUStHE8ERAs7ybszi0D6Xg3rVtUcGv82qEBaDUDw"
17
17
  }
@@ -8,10 +8,10 @@
8
8
  "platform": "darwin",
9
9
  "arch": "x64",
10
10
  "sha256": "ddba81a47b8bd308839765b04b1c48a837754b4074ff023ca96676019e8e3744",
11
- "builtAt": "2026-06-11T13:30:16.184Z",
11
+ "builtAt": "2026-06-11T14:43:43.265Z",
12
12
  "signingKey": "production-env",
13
13
  "freeMonthlySavedTokenCap": 1000000,
14
14
  "siteURL": "https://tokenwarden.ai/"
15
15
  },
16
- "signature": "ezyJhHQG7TpvCPVjPdIqzlfJznQa1PxmdrH3pkdNiUkAN2qLJrCpofpjHFOPUzSz9-2rbNTZOXYYx_jLRsRmDQ"
16
+ "signature": "kZGTNvT75K7wVZvfWvt3FVgSrM_4-wh-K4v24rxNLBQK64QE8tPKhHPzu1v3BhJGZgegaMw9gO_tPQU9gSwTCA"
17
17
  }
@@ -8,10 +8,10 @@
8
8
  "platform": "linux",
9
9
  "arch": "arm64",
10
10
  "sha256": "06d9ad12796c9870a1a0515af08faa3e27fd1e4485b7c74bfd211ae32d617d7c",
11
- "builtAt": "2026-06-11T13:30:16.184Z",
11
+ "builtAt": "2026-06-11T14:43:43.265Z",
12
12
  "signingKey": "production-env",
13
13
  "freeMonthlySavedTokenCap": 1000000,
14
14
  "siteURL": "https://tokenwarden.ai/"
15
15
  },
16
- "signature": "hV-F0bZFuxGCyTE-fEINH2X3dSmr5FhprTKfu5JBpBA09i2XPhRUEAE_eDUXEnGh7lzyjbEZ_r4MzKAI4GZfCQ"
16
+ "signature": "rAzERmHFJNT8sT09ZcgHPL8kN8WfMBSXr10qY41w5Svf3Dik7WpjuSIYuLrX1qTC5vt_YRA2ph4Ljg2Uu1m6Dg"
17
17
  }
@@ -8,10 +8,10 @@
8
8
  "platform": "linux",
9
9
  "arch": "x64",
10
10
  "sha256": "92767449e681a41c62fc2f9f732ea3b17d8f99b0d66d42abbffcdf3f0bdff226",
11
- "builtAt": "2026-06-11T13:30:16.184Z",
11
+ "builtAt": "2026-06-11T14:43:43.265Z",
12
12
  "signingKey": "production-env",
13
13
  "freeMonthlySavedTokenCap": 1000000,
14
14
  "siteURL": "https://tokenwarden.ai/"
15
15
  },
16
- "signature": "P9qttm0PvMjLZakkMljYuPKHiNuIeReMiv9U4B-dZLp6khzquS4WI_vhQsXT4tWbICeyYPkJgkylzmY1YYUUCA"
16
+ "signature": "P2y4wg0TXUJ3ShFCxbD1UImvSR_DItyBLs3dvP-o_tIksMR9kkTtBk2iRZWpg2WVH6ZU71qVJtXqjtVXmkgzBw"
17
17
  }
@@ -7,11 +7,11 @@
7
7
  "binary": "tokenwarden-engine-win32-x64.exe",
8
8
  "platform": "win32",
9
9
  "arch": "x64",
10
- "sha256": "b3467b671d0b2fdfe97955a9fcffb1d0e933c9804dc7591ae72467b5766a03a6",
11
- "builtAt": "2026-06-11T13:30:16.184Z",
10
+ "sha256": "431ee2e18c8381c36573829fba3a7f665fe02d3fa2bd0b14a70f67414858693d",
11
+ "builtAt": "2026-06-11T14:43:43.265Z",
12
12
  "signingKey": "production-env",
13
13
  "freeMonthlySavedTokenCap": 1000000,
14
14
  "siteURL": "https://tokenwarden.ai/"
15
15
  },
16
- "signature": "9YCA1ICOOQTHb4Iq1yVgZwbOdoF01TXmdd8C9mJAbbWApeIn78ExixGkpsMGMaXGx2n2dH86eG0O3Sh133UtAw"
16
+ "signature": "b1k9QpOKkzCAm4IaBSmdlNsDNAs1GQU923nFSxcaqgam4A-VcBKThwndAQse_5H2ZWsq3RSGdz4mUZQjGUiMDQ"
17
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenwarden/opencode",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Local-first opencode cost and context control plugin.",
5
5
  "type": "module",
6
6
  "main": "dist/src/plugin/index.js",