@theokit/sdk 4.46.0 → 4.48.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 CHANGED
@@ -1,5 +1,36 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.48.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d9ddcbe: Add `recordWiring`: report which project entities a build requested, which it wired, and which a trust posture withheld — derived from the values handed to the builder rather than from re-reading configuration.
8
+
9
+ ## 4.47.0
10
+
11
+ ### Minor Changes
12
+
13
+ - d511e6a: `resolveTrustPosture` — decide what a project directory is allowed to switch on.
14
+
15
+ A product that reads a repository must answer this before it builds anything: are that repository's
16
+ hooks honoured, are its MCP servers started, do its instructions enter the persona? The stakes are
17
+ not configuration-shaped — a hook is arbitrary command execution on every tool call, and an MCP
18
+ server is an external process SPAWNED while the agent is built, before any per-tool approval exists
19
+ to refuse it.
20
+
21
+ The arithmetic is small; the invariant is the point. Untrusted means EVERY declared capability is
22
+ off, and `allows` is built FROM the declared list, so a product that adds a ninth capability cannot
23
+ forget to gate it. That failure is invisible when it happens: the new capability simply works in a
24
+ directory where it should not.
25
+
26
+ It deliberately does NOT decide what "trusted" means. Where the record lives, what the environment
27
+ variable is called, whether a legacy alias is honoured — all the consumer's, because all of it is
28
+ that product's vocabulary. `source` is reported (`env` / `store` / `default`) because "trusted
29
+ because the operator recorded this directory" and "trusted because a blanket switch is on" are
30
+ different facts, and only the second stays on across every directory the process opens.
31
+
32
+ Additive. Nothing calls it yet.
33
+
3
34
  ## 4.46.0
4
35
 
5
36
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -2188,6 +2188,38 @@ function safeStringify(v) {
2188
2188
  }
2189
2189
  }
2190
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
+
2200
+ // src/wiring-record.ts
2201
+ var UngatedCapabilityError = class extends chunkYULF6FPB_cjs.TheokitAgentError {
2202
+ name = "UngatedCapabilityError";
2203
+ };
2204
+ function recordWiring(input) {
2205
+ const record = {};
2206
+ for (const [capability, requested] of Object.entries(input.requested)) {
2207
+ const allowed = input.posture.allows[capability];
2208
+ if (allowed === void 0) {
2209
+ throw new UngatedCapabilityError(
2210
+ `capability \`${capability}\` was recorded as wired but the posture does not gate it; gated capabilities are: ${Object.keys(input.posture.allows).join(", ") || "(none)"}`
2211
+ );
2212
+ }
2213
+ record[capability] = {
2214
+ // Copied, not aliased. See the @returns note.
2215
+ active: allowed ? [...requested] : [],
2216
+ requested: [...requested],
2217
+ suppressedByTrust: !allowed && requested.length > 0
2218
+ };
2219
+ }
2220
+ return record;
2221
+ }
2222
+
2191
2223
  Object.defineProperty(exports, "GOAL_CONTINUATION_MARKER", {
2192
2224
  enumerable: true,
2193
2225
  get: function () { return chunkOBA6YK2R_cjs.GOAL_CONTINUATION_MARKER; }
@@ -2335,6 +2367,7 @@ exports.Squad = Squad;
2335
2367
  exports.Task = Task;
2336
2368
  exports.Theokit = Theokit;
2337
2369
  exports.TokenLimiter = TokenLimiter;
2370
+ exports.UngatedCapabilityError = UngatedCapabilityError;
2338
2371
  exports.UnicodeNormalizer = UnicodeNormalizer;
2339
2372
  exports.applyMode = applyMode;
2340
2373
  exports.applySecurityFloor = applySecurityFloor;
@@ -2350,6 +2383,8 @@ exports.mkMemoryId = mkMemoryId;
2350
2383
  exports.normalizeSchema = normalizeSchema;
2351
2384
  exports.normalizeUsage = normalizeUsage;
2352
2385
  exports.preflightCheck = preflightCheck;
2386
+ exports.recordWiring = recordWiring;
2387
+ exports.resolveTrustPosture = resolveTrustPosture;
2353
2388
  exports.runGoalLoop = runGoalLoop;
2354
2389
  exports.scopedConversationId = scopedConversationId;
2355
2390
  exports.sessionScopePrefix = sessionScopePrefix;