@theokit/sdk 4.48.0 → 4.49.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/dist/index.d.cts CHANGED
@@ -1263,6 +1263,63 @@ declare class Tool {
1263
1263
  static create<T extends ZodType, O extends ZodType = never>(spec: DefineToolSpec<T, O>): CustomTool;
1264
1264
  }
1265
1265
 
1266
+ /**
1267
+ * Audit whether every configuration key can be set from the environment, or says why not.
1268
+ *
1269
+ * A key settable only by editing a file cannot be set in CI, in a container, or for a single
1270
+ * invocation. That is usually an oversight rather than a decision, and it is invisible — nothing
1271
+ * fails, the key simply has no environment path, and nobody notices until someone needs one.
1272
+ *
1273
+ * The opposite failure rots more quietly. An opt-out written for a key that has since gained an
1274
+ * environment path, or for a key that no longer exists, still reads as a considered decision while
1275
+ * exempting nothing. Both questions are answered by one call so a consumer cannot check the gap and
1276
+ * forget the rot: they fail for opposite reasons, and a suite that asks only one looks complete.
1277
+ *
1278
+ * ## Why the framework owns the rule and not the keys
1279
+ *
1280
+ * A framework cannot enumerate a consumer's configuration keys, and should not try. Which keys exist
1281
+ * is that product's vocabulary — the same reason the security floor takes its permissiveness order
1282
+ * as data and the trust posture takes its capability list. So the consumer ranges over its own keys
1283
+ * with this, rather than registering them here.
1284
+ *
1285
+ * That is a narrower claim than "reachability is checked in the framework", and it is the honest
1286
+ * one: the failure still surfaces in the consumer's own suite. What the consumer no longer writes is
1287
+ * the detector, which is where the subtlety lives — the stale-opt-out half is the part everyone
1288
+ * forgets.
1289
+ *
1290
+ * @public
1291
+ */
1292
+ /** A key deliberately left off the environment, with the reason and what would reverse it. @public */
1293
+ interface EnvOptOut {
1294
+ readonly key: string;
1295
+ /** Why an environment variable is the wrong shape for this key. */
1296
+ readonly reason: string;
1297
+ /** What would make this opt-out obsolete. An opt-out with no exit is a permanent excuse. */
1298
+ readonly exitCriterion: string;
1299
+ }
1300
+ /** @public */
1301
+ interface EnvReachabilityInput {
1302
+ /** Every configuration key the product declares. */
1303
+ readonly keys: readonly string[];
1304
+ /** The subset that an environment variable can set. */
1305
+ readonly reachable: readonly string[];
1306
+ /** Documented exemptions for keys that deliberately have no environment path. */
1307
+ readonly optOuts: readonly EnvOptOut[];
1308
+ }
1309
+ /** @public */
1310
+ interface EnvReachabilityAudit {
1311
+ /** Keys with neither an environment path nor a documented opt-out. */
1312
+ readonly unreachable: readonly string[];
1313
+ /** Opt-outs that exempt nothing: the key gained an environment path, or no longer exists. */
1314
+ readonly staleOptOuts: readonly string[];
1315
+ }
1316
+ /**
1317
+ * @returns both axes, in the order the caller declared them — a stable order so a failure message
1318
+ * does not change between runs for reasons unrelated to the code.
1319
+ * @public
1320
+ */
1321
+ declare function auditEnvReachability(input: EnvReachabilityInput): EnvReachabilityAudit;
1322
+
1266
1323
  /**
1267
1324
  * `EventBus` — typed EventEmitter wrapper.
1268
1325
  *
@@ -2835,4 +2892,4 @@ interface WiringRecordInput<K extends string> {
2835
2892
  */
2836
2893
  declare function recordWiring<K extends string>(input: WiringRecordInput<K>): Readonly<Record<K, WiredEntity>>;
2837
2894
 
2838
- export { Agent, AgentBuilder, AgentDefinition, AgentDescription, AgentFactory, AgentOperationOptions, AgentOptions, type AgentPromptResult, type AgentRegistryOptions, type BatchItem, type BatchOptions, type BatchProgress, type BatchResult, Budget, BudgetHandle, BudgetOptions, BudgetSnapshot, BudgetTracker, CloudOptions, ContextSettings, type CounterBudgetTrackerOptions, CustomTool, type DeclaredLayer, type DeepPartial, type DefineProviderOptions, type DefineToolSpec, type DiagnosticsSink, type DreamingSweepOptions, type DreamingSweepResult, ErrorMetadata, EventBus, type EvictReason, GOAL_CONTINUATION_MARKER, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, GoalEvent, type GoalLoopAgent, GoalOptions, GoalResult, InlineSkill, JobQueue, type JobQueueOptions, JudgeCredentialError, JudgeResult, LayerOrderError, type LayerValues, ListAgentsOptions, ListResult, ListRunsOptions, LiveAgentRegistry, LocalOptions, McpServerConfig, Memory, MemoryId, MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, NoopMemoryProvider, type NormalizedJsonSchema, PermissionEngine, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, PermissionMode, PermissionPlugin, type PermissionPluginOptions, Plugin, PluginsSettings, PreToolCallDecision, Processor, Provider, ProviderProfile, ProviderRoutingSettings, Run, RunEventSink, RunResult, SDKAgent, SDKAgentInfo, SDKMessage, type SDKModel, SDKProvider, type SDKRepository, type SDKUser, SOVEREIGN_ENV_KEYS, Security, type SecurityFloorInput, type SessionMessage, type SessionMessagePart, type SessionScope, type ShareGptMessage, type ShareGptTrajectory, SkillReadTool, SkillsSettings, type SovereignEnvKey, Squad, type SquadOptions, type SquadRun, StreamObjectError, type StreamObjectEvent, type StreamObjectOptions, SystemPromptResolver, TASK_RESERVED_PREFIXES, Task, type TaskCancelResult, type TaskConfigureOptions, type TaskEvent, type TaskFilter, type TaskHandle, type TaskKind, type TaskState, type TaskStoreOptions, type TaskSubmitOptions, type TaskWorkContext, type TaskWorkFn, Theokit, TheokitAgentError, type TheokitRequestOptions, TokenLimiter, type TokenLimiterOptions, Tool, ToolError, ToolResultContentBlock, type TrustLevel, type TrustPosture, type TrustPostureInput, type TrustSource, UngatedCapabilityError, UnicodeNormalizer, type UnicodeNormalizerOptions, UsageAccumulator, type WiredEntity, type WiringRecordInput, applySecurityFloor, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, estimateTokens, extractRawId, foldLayers, getPricingEntry, inferApiMode, isValidTaskId, loadProjectEnv, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, recordWiring, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, setDiagnosticsSink, toShareGptTrajectory, verifyLayerOrdering, withCwdMutex };
2895
+ export { Agent, AgentBuilder, AgentDefinition, AgentDescription, AgentFactory, AgentOperationOptions, AgentOptions, type AgentPromptResult, type AgentRegistryOptions, type BatchItem, type BatchOptions, type BatchProgress, type BatchResult, Budget, BudgetHandle, BudgetOptions, BudgetSnapshot, BudgetTracker, CloudOptions, ContextSettings, type CounterBudgetTrackerOptions, CustomTool, type DeclaredLayer, type DeepPartial, type DefineProviderOptions, type DefineToolSpec, type DiagnosticsSink, type DreamingSweepOptions, type DreamingSweepResult, type EnvOptOut, type EnvReachabilityAudit, type EnvReachabilityInput, ErrorMetadata, EventBus, type EvictReason, GOAL_CONTINUATION_MARKER, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, GoalEvent, type GoalLoopAgent, GoalOptions, GoalResult, InlineSkill, JobQueue, type JobQueueOptions, JudgeCredentialError, JudgeResult, LayerOrderError, type LayerValues, ListAgentsOptions, ListResult, ListRunsOptions, LiveAgentRegistry, LocalOptions, McpServerConfig, Memory, MemoryId, MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, NoopMemoryProvider, type NormalizedJsonSchema, PermissionEngine, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, PermissionMode, PermissionPlugin, type PermissionPluginOptions, Plugin, PluginsSettings, PreToolCallDecision, Processor, Provider, ProviderProfile, ProviderRoutingSettings, Run, RunEventSink, RunResult, SDKAgent, SDKAgentInfo, SDKMessage, type SDKModel, SDKProvider, type SDKRepository, type SDKUser, SOVEREIGN_ENV_KEYS, Security, type SecurityFloorInput, type SessionMessage, type SessionMessagePart, type SessionScope, type ShareGptMessage, type ShareGptTrajectory, SkillReadTool, SkillsSettings, type SovereignEnvKey, Squad, type SquadOptions, type SquadRun, StreamObjectError, type StreamObjectEvent, type StreamObjectOptions, SystemPromptResolver, TASK_RESERVED_PREFIXES, Task, type TaskCancelResult, type TaskConfigureOptions, type TaskEvent, type TaskFilter, type TaskHandle, type TaskKind, type TaskState, type TaskStoreOptions, type TaskSubmitOptions, type TaskWorkContext, type TaskWorkFn, Theokit, TheokitAgentError, type TheokitRequestOptions, TokenLimiter, type TokenLimiterOptions, Tool, ToolError, ToolResultContentBlock, type TrustLevel, type TrustPosture, type TrustPostureInput, type TrustSource, UngatedCapabilityError, UnicodeNormalizer, type UnicodeNormalizerOptions, UsageAccumulator, type WiredEntity, type WiringRecordInput, applySecurityFloor, auditEnvReachability, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, estimateTokens, extractRawId, foldLayers, getPricingEntry, inferApiMode, isValidTaskId, loadProjectEnv, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, recordWiring, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, setDiagnosticsSink, toShareGptTrajectory, verifyLayerOrdering, withCwdMutex };
package/dist/index.d.ts CHANGED
@@ -1263,6 +1263,63 @@ declare class Tool {
1263
1263
  static create<T extends ZodType, O extends ZodType = never>(spec: DefineToolSpec<T, O>): CustomTool;
1264
1264
  }
1265
1265
 
1266
+ /**
1267
+ * Audit whether every configuration key can be set from the environment, or says why not.
1268
+ *
1269
+ * A key settable only by editing a file cannot be set in CI, in a container, or for a single
1270
+ * invocation. That is usually an oversight rather than a decision, and it is invisible — nothing
1271
+ * fails, the key simply has no environment path, and nobody notices until someone needs one.
1272
+ *
1273
+ * The opposite failure rots more quietly. An opt-out written for a key that has since gained an
1274
+ * environment path, or for a key that no longer exists, still reads as a considered decision while
1275
+ * exempting nothing. Both questions are answered by one call so a consumer cannot check the gap and
1276
+ * forget the rot: they fail for opposite reasons, and a suite that asks only one looks complete.
1277
+ *
1278
+ * ## Why the framework owns the rule and not the keys
1279
+ *
1280
+ * A framework cannot enumerate a consumer's configuration keys, and should not try. Which keys exist
1281
+ * is that product's vocabulary — the same reason the security floor takes its permissiveness order
1282
+ * as data and the trust posture takes its capability list. So the consumer ranges over its own keys
1283
+ * with this, rather than registering them here.
1284
+ *
1285
+ * That is a narrower claim than "reachability is checked in the framework", and it is the honest
1286
+ * one: the failure still surfaces in the consumer's own suite. What the consumer no longer writes is
1287
+ * the detector, which is where the subtlety lives — the stale-opt-out half is the part everyone
1288
+ * forgets.
1289
+ *
1290
+ * @public
1291
+ */
1292
+ /** A key deliberately left off the environment, with the reason and what would reverse it. @public */
1293
+ interface EnvOptOut {
1294
+ readonly key: string;
1295
+ /** Why an environment variable is the wrong shape for this key. */
1296
+ readonly reason: string;
1297
+ /** What would make this opt-out obsolete. An opt-out with no exit is a permanent excuse. */
1298
+ readonly exitCriterion: string;
1299
+ }
1300
+ /** @public */
1301
+ interface EnvReachabilityInput {
1302
+ /** Every configuration key the product declares. */
1303
+ readonly keys: readonly string[];
1304
+ /** The subset that an environment variable can set. */
1305
+ readonly reachable: readonly string[];
1306
+ /** Documented exemptions for keys that deliberately have no environment path. */
1307
+ readonly optOuts: readonly EnvOptOut[];
1308
+ }
1309
+ /** @public */
1310
+ interface EnvReachabilityAudit {
1311
+ /** Keys with neither an environment path nor a documented opt-out. */
1312
+ readonly unreachable: readonly string[];
1313
+ /** Opt-outs that exempt nothing: the key gained an environment path, or no longer exists. */
1314
+ readonly staleOptOuts: readonly string[];
1315
+ }
1316
+ /**
1317
+ * @returns both axes, in the order the caller declared them — a stable order so a failure message
1318
+ * does not change between runs for reasons unrelated to the code.
1319
+ * @public
1320
+ */
1321
+ declare function auditEnvReachability(input: EnvReachabilityInput): EnvReachabilityAudit;
1322
+
1266
1323
  /**
1267
1324
  * `EventBus` — typed EventEmitter wrapper.
1268
1325
  *
@@ -2835,4 +2892,4 @@ interface WiringRecordInput<K extends string> {
2835
2892
  */
2836
2893
  declare function recordWiring<K extends string>(input: WiringRecordInput<K>): Readonly<Record<K, WiredEntity>>;
2837
2894
 
2838
- export { Agent, AgentBuilder, AgentDefinition, AgentDescription, AgentFactory, AgentOperationOptions, AgentOptions, type AgentPromptResult, type AgentRegistryOptions, type BatchItem, type BatchOptions, type BatchProgress, type BatchResult, Budget, BudgetHandle, BudgetOptions, BudgetSnapshot, BudgetTracker, CloudOptions, ContextSettings, type CounterBudgetTrackerOptions, CustomTool, type DeclaredLayer, type DeepPartial, type DefineProviderOptions, type DefineToolSpec, type DiagnosticsSink, type DreamingSweepOptions, type DreamingSweepResult, ErrorMetadata, EventBus, type EvictReason, GOAL_CONTINUATION_MARKER, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, GoalEvent, type GoalLoopAgent, GoalOptions, GoalResult, InlineSkill, JobQueue, type JobQueueOptions, JudgeCredentialError, JudgeResult, LayerOrderError, type LayerValues, ListAgentsOptions, ListResult, ListRunsOptions, LiveAgentRegistry, LocalOptions, McpServerConfig, Memory, MemoryId, MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, NoopMemoryProvider, type NormalizedJsonSchema, PermissionEngine, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, PermissionMode, PermissionPlugin, type PermissionPluginOptions, Plugin, PluginsSettings, PreToolCallDecision, Processor, Provider, ProviderProfile, ProviderRoutingSettings, Run, RunEventSink, RunResult, SDKAgent, SDKAgentInfo, SDKMessage, type SDKModel, SDKProvider, type SDKRepository, type SDKUser, SOVEREIGN_ENV_KEYS, Security, type SecurityFloorInput, type SessionMessage, type SessionMessagePart, type SessionScope, type ShareGptMessage, type ShareGptTrajectory, SkillReadTool, SkillsSettings, type SovereignEnvKey, Squad, type SquadOptions, type SquadRun, StreamObjectError, type StreamObjectEvent, type StreamObjectOptions, SystemPromptResolver, TASK_RESERVED_PREFIXES, Task, type TaskCancelResult, type TaskConfigureOptions, type TaskEvent, type TaskFilter, type TaskHandle, type TaskKind, type TaskState, type TaskStoreOptions, type TaskSubmitOptions, type TaskWorkContext, type TaskWorkFn, Theokit, TheokitAgentError, type TheokitRequestOptions, TokenLimiter, type TokenLimiterOptions, Tool, ToolError, ToolResultContentBlock, type TrustLevel, type TrustPosture, type TrustPostureInput, type TrustSource, UngatedCapabilityError, UnicodeNormalizer, type UnicodeNormalizerOptions, UsageAccumulator, type WiredEntity, type WiringRecordInput, applySecurityFloor, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, estimateTokens, extractRawId, foldLayers, getPricingEntry, inferApiMode, isValidTaskId, loadProjectEnv, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, recordWiring, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, setDiagnosticsSink, toShareGptTrajectory, verifyLayerOrdering, withCwdMutex };
2895
+ export { Agent, AgentBuilder, AgentDefinition, AgentDescription, AgentFactory, AgentOperationOptions, AgentOptions, type AgentPromptResult, type AgentRegistryOptions, type BatchItem, type BatchOptions, type BatchProgress, type BatchResult, Budget, BudgetHandle, BudgetOptions, BudgetSnapshot, BudgetTracker, CloudOptions, ContextSettings, type CounterBudgetTrackerOptions, CustomTool, type DeclaredLayer, type DeepPartial, type DefineProviderOptions, type DefineToolSpec, type DiagnosticsSink, type DreamingSweepOptions, type DreamingSweepResult, type EnvOptOut, type EnvReachabilityAudit, type EnvReachabilityInput, ErrorMetadata, EventBus, type EvictReason, GOAL_CONTINUATION_MARKER, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, GoalEvent, type GoalLoopAgent, GoalOptions, GoalResult, InlineSkill, JobQueue, type JobQueueOptions, JudgeCredentialError, JudgeResult, LayerOrderError, type LayerValues, ListAgentsOptions, ListResult, ListRunsOptions, LiveAgentRegistry, LocalOptions, McpServerConfig, Memory, MemoryId, MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, NoopMemoryProvider, type NormalizedJsonSchema, PermissionEngine, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, PermissionMode, PermissionPlugin, type PermissionPluginOptions, Plugin, PluginsSettings, PreToolCallDecision, Processor, Provider, ProviderProfile, ProviderRoutingSettings, Run, RunEventSink, RunResult, SDKAgent, SDKAgentInfo, SDKMessage, type SDKModel, SDKProvider, type SDKRepository, type SDKUser, SOVEREIGN_ENV_KEYS, Security, type SecurityFloorInput, type SessionMessage, type SessionMessagePart, type SessionScope, type ShareGptMessage, type ShareGptTrajectory, SkillReadTool, SkillsSettings, type SovereignEnvKey, Squad, type SquadOptions, type SquadRun, StreamObjectError, type StreamObjectEvent, type StreamObjectOptions, SystemPromptResolver, TASK_RESERVED_PREFIXES, Task, type TaskCancelResult, type TaskConfigureOptions, type TaskEvent, type TaskFilter, type TaskHandle, type TaskKind, type TaskState, type TaskStoreOptions, type TaskSubmitOptions, type TaskWorkContext, type TaskWorkFn, Theokit, TheokitAgentError, type TheokitRequestOptions, TokenLimiter, type TokenLimiterOptions, Tool, ToolError, ToolResultContentBlock, type TrustLevel, type TrustPosture, type TrustPostureInput, type TrustSource, UngatedCapabilityError, UnicodeNormalizer, type UnicodeNormalizerOptions, UsageAccumulator, type WiredEntity, type WiringRecordInput, applySecurityFloor, auditEnvReachability, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, estimateTokens, extractRawId, foldLayers, getPricingEntry, inferApiMode, isValidTaskId, loadProjectEnv, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, recordWiring, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, setDiagnosticsSink, toShareGptTrajectory, verifyLayerOrdering, withCwdMutex };
package/dist/index.js CHANGED
@@ -664,6 +664,17 @@ var SkillReadTool = class {
664
664
  }
665
665
  };
666
666
 
667
+ // src/env-reachability.ts
668
+ function auditEnvReachability(input) {
669
+ const reachable = new Set(input.reachable);
670
+ const exempt = new Set(input.optOuts.map((o) => o.key));
671
+ const declared = new Set(input.keys);
672
+ return {
673
+ unreachable: input.keys.filter((k) => !reachable.has(k) && !exempt.has(k)),
674
+ staleOptOuts: input.optOuts.filter((o) => !declared.has(o.key) || reachable.has(o.key)).map((o) => o.key)
675
+ };
676
+ }
677
+
667
678
  // src/event-bus.ts
668
679
  var EventBus = class {
669
680
  handlers = /* @__PURE__ */ new Map();
@@ -2223,6 +2234,6 @@ function recordWiring(input) {
2223
2234
  return record;
2224
2235
  }
2225
2236
 
2226
- export { AgentFactory, Budget, EventBus, JobQueue, LayerOrderError, Memory, NoopMemoryProvider, PermissionEngine, PermissionPlugin, Plugin, Provider, SOVEREIGN_ENV_KEYS, Security, Skill, SkillReadTool, Squad, Task, Theokit, TokenLimiter, UngatedCapabilityError, UnicodeNormalizer, applyMode, applySecurityFloor, chargeAndCheckThresholds, createCounterBudgetTracker, estimateTokens, extractRawId, foldLayers, inferApiMode, loadProjectEnv, migrateSqliteToLance2 as migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, recordWiring, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, verifyLayerOrdering };
2237
+ export { AgentFactory, Budget, EventBus, JobQueue, LayerOrderError, Memory, NoopMemoryProvider, PermissionEngine, PermissionPlugin, Plugin, Provider, SOVEREIGN_ENV_KEYS, Security, Skill, SkillReadTool, Squad, Task, Theokit, TokenLimiter, UngatedCapabilityError, UnicodeNormalizer, applyMode, applySecurityFloor, auditEnvReachability, chargeAndCheckThresholds, createCounterBudgetTracker, estimateTokens, extractRawId, foldLayers, inferApiMode, loadProjectEnv, migrateSqliteToLance2 as migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, recordWiring, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, verifyLayerOrdering };
2227
2238
  //# sourceMappingURL=index.js.map
2228
2239
  //# sourceMappingURL=index.js.map