@theokit/sdk 4.43.0 → 4.44.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/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.44.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 0cabe27: `pnpm release` now verifies its tags reached the remote instead of trusting an exit code.
8
+
9
+ `changeset publish` creates one annotated tag per published package and pushes them, then reports
10
+ success on its own exit code — and an exit code is not evidence a ref transferred.
11
+
12
+ Measured 2026-08-11: `git push` contacts the remote BEFORE `pre-push` runs, `pre-push` runs the full
13
+ `pnpm validate` for around eleven minutes, and by the time the transfer begins the server has
14
+ dropped the idle connection. Git dies of SIGPIPE (exit 141) silently — no error text, nothing
15
+ transferred, output ending in `✓ pre-push gates passed`. A missing release tag is not noticed that
16
+ day; it is noticed weeks later by whoever is bisecting.
17
+
18
+ `scripts/verify-release-refs.mjs` compares the tags at a revision against `git ls-remote`, and is
19
+ wired into `pnpm release` after `changeset publish` rather than offered as a wrapper — a wrapper
20
+ only helps whoever remembers to call it.
21
+
22
+ Three distinct exit codes, because collapsing them is the failure being removed: `0` verified,
23
+ `1` a tag never reached the remote, `2` could not check (unreachable remote, or a revision that does
24
+ not resolve).
25
+
26
+ ## 4.44.0
27
+
28
+ ### Minor Changes
29
+
30
+ - 8cfc61b: `loadProjectEnv` — read a project's `.env` without letting it move the credential store.
31
+
32
+ `process.loadEnvFile()` reads the PROJECT's `.env` into `process.env`. That is right for a provider
33
+ key and is the documented way to configure a scaffolded product. It is a hole for the handful of
34
+ variables that decide WHERE credentials live and WHAT is trusted: a cloned repository is untrusted
35
+ input, and a `.env` inside it is untrusted input the runtime is about to treat as configuration.
36
+
37
+ Without a guard, a repository shipping `THEOKIT_AUTH_HOME=/tmp/attacker-store` redirects the
38
+ credential store the moment the product starts in that directory — before any trust prompt, because
39
+ locating the store is what happens first.
40
+
41
+ `loadProjectEnv(env?, load?)` captures the sovereign keys before the load and restores them after,
42
+ including restoring "was not set" by deleting the key. `SOVEREIGN_ENV_KEYS` names them explicitly —
43
+ `THEOKIT_HOME`, `THEOKIT_AUTH_HOME`, `THEOKIT_DIR_NAME`, `THEOKIT_TRUSTED_PROVIDERS`,
44
+ `THEOKIT_REDACT_SECRETS`, `THEOKIT_OAUTH_TX_SALT` — because a convention ("anything ending in
45
+ `_HOME`") silently changes meaning as variables are added, in both directions.
46
+
47
+ `THEOKIT_API_KEY` is deliberately NOT sovereign: a project supplying its own provider key is the
48
+ intended path, and a key the project supplies is a key the project already has.
49
+
50
+ Additive. Nothing calls it yet; existing behaviour is unchanged.
51
+
3
52
  ## 4.43.0
4
53
 
5
54
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -1491,6 +1491,39 @@ var PermissionPlugin = class {
1491
1491
  }
1492
1492
  };
1493
1493
 
1494
+ // src/project-env.ts
1495
+ var SOVEREIGN_ENV_KEYS = [
1496
+ /** Locates the SDK home — sessions, and the credential store beneath it. */
1497
+ "THEOKIT_HOME",
1498
+ /** Locates the credential store explicitly, independently of `THEOKIT_HOME`. */
1499
+ "THEOKIT_AUTH_HOME",
1500
+ /** Names the project config directory, so it decides which files are READ as configuration. */
1501
+ "THEOKIT_DIR_NAME",
1502
+ /** A trust decision: which providers are honoured without further checks. */
1503
+ "THEOKIT_TRUSTED_PROVIDERS",
1504
+ /** Turning redaction off from a repository's `.env` would put secrets into logs. */
1505
+ "THEOKIT_REDACT_SECRETS",
1506
+ /** Cryptographic material for the OAuth transaction cookie. */
1507
+ "THEOKIT_OAUTH_TX_SALT"
1508
+ ];
1509
+ function loadProjectEnv(env = process.env, load = typeof process.loadEnvFile === "function" ? () => {
1510
+ process.loadEnvFile();
1511
+ } : void 0) {
1512
+ if (load === void 0) return;
1513
+ const sovereign = new Map(
1514
+ SOVEREIGN_ENV_KEYS.map((key) => [key, env[key]])
1515
+ );
1516
+ try {
1517
+ load();
1518
+ } catch {
1519
+ return;
1520
+ }
1521
+ for (const [key, original] of sovereign) {
1522
+ if (original === void 0) delete env[key];
1523
+ else env[key] = original;
1524
+ }
1525
+ }
1526
+
1494
1527
  // src/schema-normalizer.ts
1495
1528
  function isJsonSchemaObject(s) {
1496
1529
  if (typeof s !== "object" || s === null) return false;
@@ -2224,6 +2257,7 @@ exports.PermissionEngine = PermissionEngine;
2224
2257
  exports.PermissionPlugin = PermissionPlugin;
2225
2258
  exports.Plugin = Plugin;
2226
2259
  exports.Provider = Provider;
2260
+ exports.SOVEREIGN_ENV_KEYS = SOVEREIGN_ENV_KEYS;
2227
2261
  exports.Security = Security;
2228
2262
  exports.Skill = Skill;
2229
2263
  exports.SkillReadTool = SkillReadTool;
@@ -2238,6 +2272,7 @@ exports.createCounterBudgetTracker = createCounterBudgetTracker;
2238
2272
  exports.estimateTokens = estimateTokens;
2239
2273
  exports.extractRawId = extractRawId;
2240
2274
  exports.inferApiMode = inferApiMode;
2275
+ exports.loadProjectEnv = loadProjectEnv;
2241
2276
  exports.migrateSqliteToLance = migrateSqliteToLance2;
2242
2277
  exports.mkMemoryId = mkMemoryId;
2243
2278
  exports.normalizeSchema = normalizeSchema;