pi-kimi-keepalive 0.3.5 → 0.3.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +12 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-kimi-keepalive",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Prompt-cache keepalive for Kimi (kimi-coding) sessions in the Pi coding agent. Replays the last real provider request while idle so the automatic prefix cache never expires.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -52,16 +52,25 @@ import {
52
52
  const STATE_DIR = join(homedir(), ".pi", "cache-keepalive");
53
53
  const STATE_FILE = join(STATE_DIR, "state.json");
54
54
 
55
- /** Package version, read from the package.json that ships this extension. */
55
+ /** Version of record; kept in sync with package.json (enforced by a test). */
56
+ export const FALLBACK_VERSION = "0.3.6";
57
+
58
+ /**
59
+ * Package version. The relative import.meta.url read works when the extension
60
+ * is loaded from its package directory (npm / repo); some host loaders copy or
61
+ * transpile the .ts elsewhere, losing the relative anchor — then the constant
62
+ * above is the source of truth.
63
+ */
56
64
  function ownVersion(): string {
57
65
  try {
58
66
  const pkg = JSON.parse(
59
67
  readFileSync(new URL("../../package.json", import.meta.url), "utf8"),
60
68
  ) as { version?: unknown };
61
- return typeof pkg.version === "string" ? pkg.version : "unknown";
69
+ if (typeof pkg.version === "string") return pkg.version;
62
70
  } catch {
63
- return "unknown";
71
+ // fall through to the in-source constant
64
72
  }
73
+ return FALLBACK_VERSION;
65
74
  }
66
75
  /** Live OAuth state; resolved lazily so tests can redirect it via PI_AGENT_DIR. */
67
76
  function authFile(): string {