@theokit/sdk 4.46.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 +25 -0
- package/dist/index.cjs +10 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -1
- package/dist/index.d.ts +65 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2695,4 +2695,68 @@ declare function toShareGptTrajectory(result: BatchResult, options?: {
|
|
|
2695
2695
|
model?: string;
|
|
2696
2696
|
}): ShareGptTrajectory | null;
|
|
2697
2697
|
|
|
2698
|
-
|
|
2698
|
+
/**
|
|
2699
|
+
* Decide what a project directory is allowed to switch on.
|
|
2700
|
+
*
|
|
2701
|
+
* A product that reads a repository has to answer this before it builds anything: are that
|
|
2702
|
+
* repository's hooks honoured, are its MCP servers started, do its instructions enter the persona?
|
|
2703
|
+
* The stakes are not configuration-shaped. A hook is arbitrary command execution on every tool
|
|
2704
|
+
* call, and an MCP server is an external process SPAWNED while the agent is built — before any
|
|
2705
|
+
* per-tool approval exists to refuse it. A product that gets this wrong grants local execution on
|
|
2706
|
+
* first build, in a directory the user only meant to open.
|
|
2707
|
+
*
|
|
2708
|
+
* ## What this is, and what it deliberately is not
|
|
2709
|
+
*
|
|
2710
|
+
* The arithmetic is small: pick a level, derive one boolean per capability. The value is the
|
|
2711
|
+
* INVARIANT — untrusted means EVERY declared capability is off, and `allows` is built FROM the
|
|
2712
|
+
* declared list, so a product that adds a ninth capability cannot forget to gate it. That failure
|
|
2713
|
+
* is invisible when it happens: the new capability simply works in a directory where it should not,
|
|
2714
|
+
* and nothing reports anything.
|
|
2715
|
+
*
|
|
2716
|
+
* It does NOT decide what "trusted" means. Where the record lives, what the environment variable is
|
|
2717
|
+
* called, whether a legacy alias is still honoured — all of that is the consumer's, because all of
|
|
2718
|
+
* it is that product's vocabulary. The framework owns the shape of the answer and the guarantee
|
|
2719
|
+
* that the answer covers everything declared.
|
|
2720
|
+
*
|
|
2721
|
+
* ## Why `source` is reported
|
|
2722
|
+
*
|
|
2723
|
+
* "Trusted because the operator recorded this directory" and "trusted because a blanket environment
|
|
2724
|
+
* switch is on" are different facts. A surface that only shows `trusted` cannot warn about the
|
|
2725
|
+
* second, which is the one that stays on across every directory the process ever opens.
|
|
2726
|
+
*
|
|
2727
|
+
* @public
|
|
2728
|
+
*/
|
|
2729
|
+
/** @public */
|
|
2730
|
+
type TrustLevel = "trusted" | "untrusted";
|
|
2731
|
+
/** Where the decision came from. @public */
|
|
2732
|
+
type TrustSource = "env" | "store" | "default";
|
|
2733
|
+
/** @public */
|
|
2734
|
+
interface TrustPostureInput<K extends string> {
|
|
2735
|
+
/**
|
|
2736
|
+
* Every capability a repository could switch on. `allows` is built from exactly this list — the
|
|
2737
|
+
* guarantee that nothing is left ungated.
|
|
2738
|
+
*/
|
|
2739
|
+
readonly capabilities: readonly K[];
|
|
2740
|
+
/**
|
|
2741
|
+
* Whether the operator has recorded this directory as trusted. Called at most once, and not at
|
|
2742
|
+
* all when `envOverride` already granted trust — it may touch the filesystem.
|
|
2743
|
+
*/
|
|
2744
|
+
readonly isTrusted: () => boolean;
|
|
2745
|
+
/**
|
|
2746
|
+
* A blanket override from the consumer's own environment vocabulary. `true` grants trust;
|
|
2747
|
+
* `false` and `undefined` both mean "the operator did not switch it on" — NOT "switched it off",
|
|
2748
|
+
* because an unset variable must not override a trusted store.
|
|
2749
|
+
*/
|
|
2750
|
+
readonly envOverride?: boolean;
|
|
2751
|
+
}
|
|
2752
|
+
/** @public */
|
|
2753
|
+
interface TrustPosture<K extends string> {
|
|
2754
|
+
readonly level: TrustLevel;
|
|
2755
|
+
readonly source: TrustSource;
|
|
2756
|
+
/** One entry per declared capability. Every value is `false` when the level is untrusted. */
|
|
2757
|
+
readonly allows: Readonly<Record<K, boolean>>;
|
|
2758
|
+
}
|
|
2759
|
+
/** @public */
|
|
2760
|
+
declare function resolveTrustPosture<K extends string>(input: TrustPostureInput<K>): TrustPosture<K>;
|
|
2761
|
+
|
|
2762
|
+
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, UnicodeNormalizer, type UnicodeNormalizerOptions, UsageAccumulator, applySecurityFloor, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, estimateTokens, extractRawId, foldLayers, getPricingEntry, inferApiMode, isValidTaskId, loadProjectEnv, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, setDiagnosticsSink, toShareGptTrajectory, verifyLayerOrdering, withCwdMutex };
|
package/dist/index.d.ts
CHANGED
|
@@ -2695,4 +2695,68 @@ declare function toShareGptTrajectory(result: BatchResult, options?: {
|
|
|
2695
2695
|
model?: string;
|
|
2696
2696
|
}): ShareGptTrajectory | null;
|
|
2697
2697
|
|
|
2698
|
-
|
|
2698
|
+
/**
|
|
2699
|
+
* Decide what a project directory is allowed to switch on.
|
|
2700
|
+
*
|
|
2701
|
+
* A product that reads a repository has to answer this before it builds anything: are that
|
|
2702
|
+
* repository's hooks honoured, are its MCP servers started, do its instructions enter the persona?
|
|
2703
|
+
* The stakes are not configuration-shaped. A hook is arbitrary command execution on every tool
|
|
2704
|
+
* call, and an MCP server is an external process SPAWNED while the agent is built — before any
|
|
2705
|
+
* per-tool approval exists to refuse it. A product that gets this wrong grants local execution on
|
|
2706
|
+
* first build, in a directory the user only meant to open.
|
|
2707
|
+
*
|
|
2708
|
+
* ## What this is, and what it deliberately is not
|
|
2709
|
+
*
|
|
2710
|
+
* The arithmetic is small: pick a level, derive one boolean per capability. The value is the
|
|
2711
|
+
* INVARIANT — untrusted means EVERY declared capability is off, and `allows` is built FROM the
|
|
2712
|
+
* declared list, so a product that adds a ninth capability cannot forget to gate it. That failure
|
|
2713
|
+
* is invisible when it happens: the new capability simply works in a directory where it should not,
|
|
2714
|
+
* and nothing reports anything.
|
|
2715
|
+
*
|
|
2716
|
+
* It does NOT decide what "trusted" means. Where the record lives, what the environment variable is
|
|
2717
|
+
* called, whether a legacy alias is still honoured — all of that is the consumer's, because all of
|
|
2718
|
+
* it is that product's vocabulary. The framework owns the shape of the answer and the guarantee
|
|
2719
|
+
* that the answer covers everything declared.
|
|
2720
|
+
*
|
|
2721
|
+
* ## Why `source` is reported
|
|
2722
|
+
*
|
|
2723
|
+
* "Trusted because the operator recorded this directory" and "trusted because a blanket environment
|
|
2724
|
+
* switch is on" are different facts. A surface that only shows `trusted` cannot warn about the
|
|
2725
|
+
* second, which is the one that stays on across every directory the process ever opens.
|
|
2726
|
+
*
|
|
2727
|
+
* @public
|
|
2728
|
+
*/
|
|
2729
|
+
/** @public */
|
|
2730
|
+
type TrustLevel = "trusted" | "untrusted";
|
|
2731
|
+
/** Where the decision came from. @public */
|
|
2732
|
+
type TrustSource = "env" | "store" | "default";
|
|
2733
|
+
/** @public */
|
|
2734
|
+
interface TrustPostureInput<K extends string> {
|
|
2735
|
+
/**
|
|
2736
|
+
* Every capability a repository could switch on. `allows` is built from exactly this list — the
|
|
2737
|
+
* guarantee that nothing is left ungated.
|
|
2738
|
+
*/
|
|
2739
|
+
readonly capabilities: readonly K[];
|
|
2740
|
+
/**
|
|
2741
|
+
* Whether the operator has recorded this directory as trusted. Called at most once, and not at
|
|
2742
|
+
* all when `envOverride` already granted trust — it may touch the filesystem.
|
|
2743
|
+
*/
|
|
2744
|
+
readonly isTrusted: () => boolean;
|
|
2745
|
+
/**
|
|
2746
|
+
* A blanket override from the consumer's own environment vocabulary. `true` grants trust;
|
|
2747
|
+
* `false` and `undefined` both mean "the operator did not switch it on" — NOT "switched it off",
|
|
2748
|
+
* because an unset variable must not override a trusted store.
|
|
2749
|
+
*/
|
|
2750
|
+
readonly envOverride?: boolean;
|
|
2751
|
+
}
|
|
2752
|
+
/** @public */
|
|
2753
|
+
interface TrustPosture<K extends string> {
|
|
2754
|
+
readonly level: TrustLevel;
|
|
2755
|
+
readonly source: TrustSource;
|
|
2756
|
+
/** One entry per declared capability. Every value is `false` when the level is untrusted. */
|
|
2757
|
+
readonly allows: Readonly<Record<K, boolean>>;
|
|
2758
|
+
}
|
|
2759
|
+
/** @public */
|
|
2760
|
+
declare function resolveTrustPosture<K extends string>(input: TrustPostureInput<K>): TrustPosture<K>;
|
|
2761
|
+
|
|
2762
|
+
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, UnicodeNormalizer, type UnicodeNormalizerOptions, UsageAccumulator, applySecurityFloor, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, estimateTokens, extractRawId, foldLayers, getPricingEntry, inferApiMode, isValidTaskId, loadProjectEnv, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, setDiagnosticsSink, toShareGptTrajectory, verifyLayerOrdering, withCwdMutex };
|
package/dist/index.js
CHANGED
|
@@ -2191,6 +2191,15 @@ function safeStringify(v) {
|
|
|
2191
2191
|
}
|
|
2192
2192
|
}
|
|
2193
2193
|
|
|
2194
|
-
|
|
2194
|
+
// src/trust-posture.ts
|
|
2195
|
+
function resolveTrustPosture(input) {
|
|
2196
|
+
const source = input.envOverride === true ? "env" : input.isTrusted() ? "store" : "default";
|
|
2197
|
+
const level = source === "default" ? "untrusted" : "trusted";
|
|
2198
|
+
const granted = level === "trusted";
|
|
2199
|
+
const allows = Object.fromEntries(input.capabilities.map((key) => [key, granted]));
|
|
2200
|
+
return { level, source, allows };
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
export { AgentFactory, Budget, EventBus, JobQueue, LayerOrderError, Memory, NoopMemoryProvider, PermissionEngine, PermissionPlugin, Plugin, Provider, SOVEREIGN_ENV_KEYS, Security, Skill, SkillReadTool, Squad, Task, Theokit, TokenLimiter, UnicodeNormalizer, applyMode, applySecurityFloor, chargeAndCheckThresholds, createCounterBudgetTracker, estimateTokens, extractRawId, foldLayers, inferApiMode, loadProjectEnv, migrateSqliteToLance2 as migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, verifyLayerOrdering };
|
|
2195
2204
|
//# sourceMappingURL=index.js.map
|
|
2196
2205
|
//# sourceMappingURL=index.js.map
|