@theokit/sdk 4.45.0 → 4.47.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 +47 -0
- package/dist/index.cjs +49 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +127 -1
- package/dist/index.d.ts +127 -1
- package/dist/index.js +47 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.47.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d511e6a: `resolveTrustPosture` — decide what a project directory is allowed to switch on.
|
|
8
|
+
|
|
9
|
+
A product that reads a repository must answer this before it builds anything: are that repository's
|
|
10
|
+
hooks honoured, are its MCP servers started, do its instructions enter the persona? The stakes are
|
|
11
|
+
not configuration-shaped — a hook is arbitrary command execution on every tool call, and an MCP
|
|
12
|
+
server is an external process SPAWNED while the agent is built, before any per-tool approval exists
|
|
13
|
+
to refuse it.
|
|
14
|
+
|
|
15
|
+
The arithmetic is small; the invariant is the point. Untrusted means EVERY declared capability is
|
|
16
|
+
off, and `allows` is built FROM the declared list, so a product that adds a ninth capability cannot
|
|
17
|
+
forget to gate it. That failure is invisible when it happens: the new capability simply works in a
|
|
18
|
+
directory where it should not.
|
|
19
|
+
|
|
20
|
+
It deliberately does NOT decide what "trusted" means. Where the record lives, what the environment
|
|
21
|
+
variable is called, whether a legacy alias is honoured — all the consumer's, because all of it is
|
|
22
|
+
that product's vocabulary. `source` is reported (`env` / `store` / `default`) because "trusted
|
|
23
|
+
because the operator recorded this directory" and "trusted because a blanket switch is on" are
|
|
24
|
+
different facts, and only the second stays on across every directory the process opens.
|
|
25
|
+
|
|
26
|
+
Additive. Nothing calls it yet.
|
|
27
|
+
|
|
28
|
+
## 4.46.0
|
|
29
|
+
|
|
30
|
+
### Minor Changes
|
|
31
|
+
|
|
32
|
+
- dbead57: `foldLayers` / `verifyLayerOrdering` — combine configuration layers in a declared order.
|
|
33
|
+
|
|
34
|
+
Later layers win, `undefined` never overwrites, and named keys ACCUMULATE instead of being
|
|
35
|
+
replaced. That last rule is not a nicety: with plain last-wins a project file DISPLACES the user's
|
|
36
|
+
entries for a list-valued key rather than adding to them, and for a key like `hooks` — arbitrary
|
|
37
|
+
command execution on every tool call — that is the difference between a repository adding a hook and
|
|
38
|
+
a repository removing yours.
|
|
39
|
+
|
|
40
|
+
`verifyLayerOrdering` refuses a chain that is not strictly ascending, naming both layers and both
|
|
41
|
+
precedences. Tolerating it would make resolution depend on array order rather than on declared
|
|
42
|
+
precedence: two sources of truth for one decision.
|
|
43
|
+
|
|
44
|
+
The layer NAMES are the caller's, supplied as data — one product's chain is
|
|
45
|
+
defaults/user/project/profile/env/cli and `profile` is that product's idea. Entries may omit
|
|
46
|
+
`precedence` to mean "this array is already the order".
|
|
47
|
+
|
|
48
|
+
Additive. Nothing calls it yet.
|
|
49
|
+
|
|
3
50
|
## 4.45.0
|
|
4
51
|
|
|
5
52
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -919,6 +919,42 @@ var JobQueue = class {
|
|
|
919
919
|
if (next !== void 0) next();
|
|
920
920
|
}
|
|
921
921
|
};
|
|
922
|
+
|
|
923
|
+
// src/layer-fold.ts
|
|
924
|
+
var LayerOrderError = class extends chunkYULF6FPB_cjs.TheokitAgentError {
|
|
925
|
+
name = "LayerOrderError";
|
|
926
|
+
};
|
|
927
|
+
function verifyLayerOrdering(layers) {
|
|
928
|
+
let previous;
|
|
929
|
+
for (const current of layers) {
|
|
930
|
+
if (current.precedence === void 0) continue;
|
|
931
|
+
const declared = { layer: current.layer, precedence: current.precedence };
|
|
932
|
+
if (previous !== void 0 && declared.precedence <= previous.precedence) {
|
|
933
|
+
throw new LayerOrderError(
|
|
934
|
+
`layers out of order: \`${declared.layer}\` (precedence ${String(declared.precedence)}) comes after \`${previous.layer}\` (precedence ${String(previous.precedence)}) but does not outrank it`
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
previous = declared;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
function foldLayers(entries, accumulatingKeys = []) {
|
|
941
|
+
verifyLayerOrdering(entries);
|
|
942
|
+
const accumulated = new Map(accumulatingKeys.map((k) => [k, []]));
|
|
943
|
+
const combined = {};
|
|
944
|
+
for (const { values } of entries) {
|
|
945
|
+
for (const [key, value] of Object.entries(values)) {
|
|
946
|
+
if (value === void 0) continue;
|
|
947
|
+
const stack = accumulated.get(key);
|
|
948
|
+
if (stack !== void 0 && Array.isArray(value)) {
|
|
949
|
+
stack.push(...value);
|
|
950
|
+
combined[key] = [...stack];
|
|
951
|
+
continue;
|
|
952
|
+
}
|
|
953
|
+
combined[key] = value;
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
return combined;
|
|
957
|
+
}
|
|
922
958
|
function diaryPath(cwd) {
|
|
923
959
|
return path.join(chunkGH52NOCL_cjs.memoryDir(cwd), "dream-diary.md");
|
|
924
960
|
}
|
|
@@ -2152,6 +2188,15 @@ function safeStringify(v) {
|
|
|
2152
2188
|
}
|
|
2153
2189
|
}
|
|
2154
2190
|
|
|
2191
|
+
// src/trust-posture.ts
|
|
2192
|
+
function resolveTrustPosture(input) {
|
|
2193
|
+
const source = input.envOverride === true ? "env" : input.isTrusted() ? "store" : "default";
|
|
2194
|
+
const level = source === "default" ? "untrusted" : "trusted";
|
|
2195
|
+
const granted = level === "trusted";
|
|
2196
|
+
const allows = Object.fromEntries(input.capabilities.map((key) => [key, granted]));
|
|
2197
|
+
return { level, source, allows };
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2155
2200
|
Object.defineProperty(exports, "GOAL_CONTINUATION_MARKER", {
|
|
2156
2201
|
enumerable: true,
|
|
2157
2202
|
get: function () { return chunkOBA6YK2R_cjs.GOAL_CONTINUATION_MARKER; }
|
|
@@ -2284,6 +2329,7 @@ exports.AgentFactory = AgentFactory;
|
|
|
2284
2329
|
exports.Budget = Budget;
|
|
2285
2330
|
exports.EventBus = EventBus;
|
|
2286
2331
|
exports.JobQueue = JobQueue;
|
|
2332
|
+
exports.LayerOrderError = LayerOrderError;
|
|
2287
2333
|
exports.Memory = Memory;
|
|
2288
2334
|
exports.NoopMemoryProvider = NoopMemoryProvider;
|
|
2289
2335
|
exports.PermissionEngine = PermissionEngine;
|
|
@@ -2305,6 +2351,7 @@ exports.chargeAndCheckThresholds = chargeAndCheckThresholds;
|
|
|
2305
2351
|
exports.createCounterBudgetTracker = createCounterBudgetTracker;
|
|
2306
2352
|
exports.estimateTokens = estimateTokens;
|
|
2307
2353
|
exports.extractRawId = extractRawId;
|
|
2354
|
+
exports.foldLayers = foldLayers;
|
|
2308
2355
|
exports.inferApiMode = inferApiMode;
|
|
2309
2356
|
exports.loadProjectEnv = loadProjectEnv;
|
|
2310
2357
|
exports.migrateSqliteToLance = migrateSqliteToLance2;
|
|
@@ -2312,9 +2359,11 @@ exports.mkMemoryId = mkMemoryId;
|
|
|
2312
2359
|
exports.normalizeSchema = normalizeSchema;
|
|
2313
2360
|
exports.normalizeUsage = normalizeUsage;
|
|
2314
2361
|
exports.preflightCheck = preflightCheck;
|
|
2362
|
+
exports.resolveTrustPosture = resolveTrustPosture;
|
|
2315
2363
|
exports.runGoalLoop = runGoalLoop;
|
|
2316
2364
|
exports.scopedConversationId = scopedConversationId;
|
|
2317
2365
|
exports.sessionScopePrefix = sessionScopePrefix;
|
|
2318
2366
|
exports.toShareGptTrajectory = toShareGptTrajectory;
|
|
2367
|
+
exports.verifyLayerOrdering = verifyLayerOrdering;
|
|
2319
2368
|
//# sourceMappingURL=index.cjs.map
|
|
2320
2369
|
//# sourceMappingURL=index.cjs.map
|