@theokit/sdk 4.43.0 → 4.44.0
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 +26 -0
- package/dist/index.cjs +35 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +66 -1
- package/dist/index.d.ts +66 -1
- package/dist/index.js +34 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.44.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8cfc61b: `loadProjectEnv` — read a project's `.env` without letting it move the credential store.
|
|
8
|
+
|
|
9
|
+
`process.loadEnvFile()` reads the PROJECT's `.env` into `process.env`. That is right for a provider
|
|
10
|
+
key and is the documented way to configure a scaffolded product. It is a hole for the handful of
|
|
11
|
+
variables that decide WHERE credentials live and WHAT is trusted: a cloned repository is untrusted
|
|
12
|
+
input, and a `.env` inside it is untrusted input the runtime is about to treat as configuration.
|
|
13
|
+
|
|
14
|
+
Without a guard, a repository shipping `THEOKIT_AUTH_HOME=/tmp/attacker-store` redirects the
|
|
15
|
+
credential store the moment the product starts in that directory — before any trust prompt, because
|
|
16
|
+
locating the store is what happens first.
|
|
17
|
+
|
|
18
|
+
`loadProjectEnv(env?, load?)` captures the sovereign keys before the load and restores them after,
|
|
19
|
+
including restoring "was not set" by deleting the key. `SOVEREIGN_ENV_KEYS` names them explicitly —
|
|
20
|
+
`THEOKIT_HOME`, `THEOKIT_AUTH_HOME`, `THEOKIT_DIR_NAME`, `THEOKIT_TRUSTED_PROVIDERS`,
|
|
21
|
+
`THEOKIT_REDACT_SECRETS`, `THEOKIT_OAUTH_TX_SALT` — because a convention ("anything ending in
|
|
22
|
+
`_HOME`") silently changes meaning as variables are added, in both directions.
|
|
23
|
+
|
|
24
|
+
`THEOKIT_API_KEY` is deliberately NOT sovereign: a project supplying its own provider key is the
|
|
25
|
+
intended path, and a key the project supplies is a key the project already has.
|
|
26
|
+
|
|
27
|
+
Additive. Nothing calls it yet; existing behaviour is unchanged.
|
|
28
|
+
|
|
3
29
|
## 4.43.0
|
|
4
30
|
|
|
5
31
|
### 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;
|