@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/dist/index.d.cts
CHANGED
|
@@ -1578,6 +1578,68 @@ declare class JobQueue {
|
|
|
1578
1578
|
cancel(id: string): boolean;
|
|
1579
1579
|
}
|
|
1580
1580
|
|
|
1581
|
+
/**
|
|
1582
|
+
* Fold configuration layers in a declared order — later layers win, named keys accumulate.
|
|
1583
|
+
*
|
|
1584
|
+
* Every product that reads configuration from more than one place rebuilds these two rules, and the
|
|
1585
|
+
* second one is not a nicety. With plain last-wins, a project file DISPLACES the user's entries for
|
|
1586
|
+
* a list-valued key rather than adding to them — and for a key like `hooks`, which carries arbitrary
|
|
1587
|
+
* command execution, that is the difference between a repository adding a hook and a repository
|
|
1588
|
+
* removing yours.
|
|
1589
|
+
*
|
|
1590
|
+
* The layer NAMES are the caller's, supplied as data. One product's chain is
|
|
1591
|
+
* defaults/user/project/profile/env/cli; `profile` is that product's idea and does not belong here.
|
|
1592
|
+
* That is the same test the security floor passed: a vocabulary expressible as data generalises, an
|
|
1593
|
+
* open-ended interface shaped by one product does not.
|
|
1594
|
+
*
|
|
1595
|
+
* @public
|
|
1596
|
+
*/
|
|
1597
|
+
|
|
1598
|
+
/** Raised when a declared layer chain is not strictly ascending. @public */
|
|
1599
|
+
declare class LayerOrderError extends TheokitAgentError {
|
|
1600
|
+
readonly name = "LayerOrderError";
|
|
1601
|
+
}
|
|
1602
|
+
/** @public */
|
|
1603
|
+
interface DeclaredLayer {
|
|
1604
|
+
readonly layer: string;
|
|
1605
|
+
/** Higher wins. Optional — omit it to mean "this array is already the order". */
|
|
1606
|
+
readonly precedence?: number;
|
|
1607
|
+
}
|
|
1608
|
+
/** @public */
|
|
1609
|
+
interface LayerValues extends DeclaredLayer {
|
|
1610
|
+
readonly values: Readonly<Record<string, unknown>>;
|
|
1611
|
+
}
|
|
1612
|
+
/**
|
|
1613
|
+
* Assert that each layer strictly outranks the one before it.
|
|
1614
|
+
*
|
|
1615
|
+
* Entries without a `precedence` are skipped rather than treated as zero: omitting it means the
|
|
1616
|
+
* caller is expressing order by position, and inventing a number for them would manufacture a
|
|
1617
|
+
* conflict out of a legitimate usage.
|
|
1618
|
+
*
|
|
1619
|
+
* @throws LayerOrderError naming both layers and both precedences — a refusal that only says "out
|
|
1620
|
+
* of order" sends the reader to compare the whole list by hand.
|
|
1621
|
+
* @public
|
|
1622
|
+
*/
|
|
1623
|
+
declare function verifyLayerOrdering(layers: readonly DeclaredLayer[]): void;
|
|
1624
|
+
/**
|
|
1625
|
+
* Combine `entries` into one record.
|
|
1626
|
+
*
|
|
1627
|
+
* Later entries win. A value of `undefined` never overwrites — a layer that does not mention a key
|
|
1628
|
+
* must not erase it, because "said nothing" is overwhelmingly more common than "said nothing on
|
|
1629
|
+
* purpose".
|
|
1630
|
+
*
|
|
1631
|
+
* Keys in `accumulatingKeys` whose value is an array are CONCATENATED across layers instead of
|
|
1632
|
+
* replaced. A non-array value for such a key replaces, deliberately: a malformed config must not
|
|
1633
|
+
* corrupt the accumulator into a mixed list, and leaving the raw value visible lets the consumer's
|
|
1634
|
+
* own validation reject it with its own message.
|
|
1635
|
+
*
|
|
1636
|
+
* The accumulator is per-call and the inputs are never mutated, so folding twice yields the same
|
|
1637
|
+
* answer — which a consumer that folds once to display and once to apply depends on.
|
|
1638
|
+
*
|
|
1639
|
+
* @public
|
|
1640
|
+
*/
|
|
1641
|
+
declare function foldLayers(entries: readonly LayerValues[], accumulatingKeys?: readonly string[]): Record<string, unknown>;
|
|
1642
|
+
|
|
1581
1643
|
/**
|
|
1582
1644
|
* Public handle to an open memory index. Mirrors the internal `MemoryIndex`
|
|
1583
1645
|
* contract structurally; defined here (NOT re-exported from internal/) so
|
|
@@ -2633,4 +2695,68 @@ declare function toShareGptTrajectory(result: BatchResult, options?: {
|
|
|
2633
2695
|
model?: string;
|
|
2634
2696
|
}): ShareGptTrajectory | null;
|
|
2635
2697
|
|
|
2636
|
-
|
|
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
|
@@ -1578,6 +1578,68 @@ declare class JobQueue {
|
|
|
1578
1578
|
cancel(id: string): boolean;
|
|
1579
1579
|
}
|
|
1580
1580
|
|
|
1581
|
+
/**
|
|
1582
|
+
* Fold configuration layers in a declared order — later layers win, named keys accumulate.
|
|
1583
|
+
*
|
|
1584
|
+
* Every product that reads configuration from more than one place rebuilds these two rules, and the
|
|
1585
|
+
* second one is not a nicety. With plain last-wins, a project file DISPLACES the user's entries for
|
|
1586
|
+
* a list-valued key rather than adding to them — and for a key like `hooks`, which carries arbitrary
|
|
1587
|
+
* command execution, that is the difference between a repository adding a hook and a repository
|
|
1588
|
+
* removing yours.
|
|
1589
|
+
*
|
|
1590
|
+
* The layer NAMES are the caller's, supplied as data. One product's chain is
|
|
1591
|
+
* defaults/user/project/profile/env/cli; `profile` is that product's idea and does not belong here.
|
|
1592
|
+
* That is the same test the security floor passed: a vocabulary expressible as data generalises, an
|
|
1593
|
+
* open-ended interface shaped by one product does not.
|
|
1594
|
+
*
|
|
1595
|
+
* @public
|
|
1596
|
+
*/
|
|
1597
|
+
|
|
1598
|
+
/** Raised when a declared layer chain is not strictly ascending. @public */
|
|
1599
|
+
declare class LayerOrderError extends TheokitAgentError {
|
|
1600
|
+
readonly name = "LayerOrderError";
|
|
1601
|
+
}
|
|
1602
|
+
/** @public */
|
|
1603
|
+
interface DeclaredLayer {
|
|
1604
|
+
readonly layer: string;
|
|
1605
|
+
/** Higher wins. Optional — omit it to mean "this array is already the order". */
|
|
1606
|
+
readonly precedence?: number;
|
|
1607
|
+
}
|
|
1608
|
+
/** @public */
|
|
1609
|
+
interface LayerValues extends DeclaredLayer {
|
|
1610
|
+
readonly values: Readonly<Record<string, unknown>>;
|
|
1611
|
+
}
|
|
1612
|
+
/**
|
|
1613
|
+
* Assert that each layer strictly outranks the one before it.
|
|
1614
|
+
*
|
|
1615
|
+
* Entries without a `precedence` are skipped rather than treated as zero: omitting it means the
|
|
1616
|
+
* caller is expressing order by position, and inventing a number for them would manufacture a
|
|
1617
|
+
* conflict out of a legitimate usage.
|
|
1618
|
+
*
|
|
1619
|
+
* @throws LayerOrderError naming both layers and both precedences — a refusal that only says "out
|
|
1620
|
+
* of order" sends the reader to compare the whole list by hand.
|
|
1621
|
+
* @public
|
|
1622
|
+
*/
|
|
1623
|
+
declare function verifyLayerOrdering(layers: readonly DeclaredLayer[]): void;
|
|
1624
|
+
/**
|
|
1625
|
+
* Combine `entries` into one record.
|
|
1626
|
+
*
|
|
1627
|
+
* Later entries win. A value of `undefined` never overwrites — a layer that does not mention a key
|
|
1628
|
+
* must not erase it, because "said nothing" is overwhelmingly more common than "said nothing on
|
|
1629
|
+
* purpose".
|
|
1630
|
+
*
|
|
1631
|
+
* Keys in `accumulatingKeys` whose value is an array are CONCATENATED across layers instead of
|
|
1632
|
+
* replaced. A non-array value for such a key replaces, deliberately: a malformed config must not
|
|
1633
|
+
* corrupt the accumulator into a mixed list, and leaving the raw value visible lets the consumer's
|
|
1634
|
+
* own validation reject it with its own message.
|
|
1635
|
+
*
|
|
1636
|
+
* The accumulator is per-call and the inputs are never mutated, so folding twice yields the same
|
|
1637
|
+
* answer — which a consumer that folds once to display and once to apply depends on.
|
|
1638
|
+
*
|
|
1639
|
+
* @public
|
|
1640
|
+
*/
|
|
1641
|
+
declare function foldLayers(entries: readonly LayerValues[], accumulatingKeys?: readonly string[]): Record<string, unknown>;
|
|
1642
|
+
|
|
1581
1643
|
/**
|
|
1582
1644
|
* Public handle to an open memory index. Mirrors the internal `MemoryIndex`
|
|
1583
1645
|
* contract structurally; defined here (NOT re-exported from internal/) so
|
|
@@ -2633,4 +2695,68 @@ declare function toShareGptTrajectory(result: BatchResult, options?: {
|
|
|
2633
2695
|
model?: string;
|
|
2634
2696
|
}): ShareGptTrajectory | null;
|
|
2635
2697
|
|
|
2636
|
-
|
|
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
|
@@ -53,7 +53,7 @@ import './chunk-5NBUH3NO.js';
|
|
|
53
53
|
import './chunk-2S6B5B2A.js';
|
|
54
54
|
import './chunk-6FSQ3CHQ.js';
|
|
55
55
|
import './chunk-OLLOUAUJ.js';
|
|
56
|
-
import { BudgetExceededError, MemoryAdapterError, AuthenticationError, ConfigurationError } from './chunk-MRKSSN36.js';
|
|
56
|
+
import { BudgetExceededError, TheokitAgentError, MemoryAdapterError, AuthenticationError, ConfigurationError } from './chunk-MRKSSN36.js';
|
|
57
57
|
export { AgentDisposedError, AgentRunError, AuthenticationError, BudgetExceededError, ConfigurationError, IntegrationNotConnectedError, InvalidTaskIdError, MemoryAdapterError, NetworkError, RateLimitError, TaskNotFoundError, TheokitAgentError, UnknownAgentError, UnsupportedBudgetOperationError, UnsupportedRunOperationError, UnsupportedTaskOperationError, isTransientError } from './chunk-MRKSSN36.js';
|
|
58
58
|
import { diag, redactSecrets, addPattern } from './chunk-PBML2FHN.js';
|
|
59
59
|
export { setDiagnosticsSink } from './chunk-PBML2FHN.js';
|
|
@@ -922,6 +922,42 @@ var JobQueue = class {
|
|
|
922
922
|
if (next !== void 0) next();
|
|
923
923
|
}
|
|
924
924
|
};
|
|
925
|
+
|
|
926
|
+
// src/layer-fold.ts
|
|
927
|
+
var LayerOrderError = class extends TheokitAgentError {
|
|
928
|
+
name = "LayerOrderError";
|
|
929
|
+
};
|
|
930
|
+
function verifyLayerOrdering(layers) {
|
|
931
|
+
let previous;
|
|
932
|
+
for (const current of layers) {
|
|
933
|
+
if (current.precedence === void 0) continue;
|
|
934
|
+
const declared = { layer: current.layer, precedence: current.precedence };
|
|
935
|
+
if (previous !== void 0 && declared.precedence <= previous.precedence) {
|
|
936
|
+
throw new LayerOrderError(
|
|
937
|
+
`layers out of order: \`${declared.layer}\` (precedence ${String(declared.precedence)}) comes after \`${previous.layer}\` (precedence ${String(previous.precedence)}) but does not outrank it`
|
|
938
|
+
);
|
|
939
|
+
}
|
|
940
|
+
previous = declared;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
function foldLayers(entries, accumulatingKeys = []) {
|
|
944
|
+
verifyLayerOrdering(entries);
|
|
945
|
+
const accumulated = new Map(accumulatingKeys.map((k) => [k, []]));
|
|
946
|
+
const combined = {};
|
|
947
|
+
for (const { values } of entries) {
|
|
948
|
+
for (const [key, value] of Object.entries(values)) {
|
|
949
|
+
if (value === void 0) continue;
|
|
950
|
+
const stack = accumulated.get(key);
|
|
951
|
+
if (stack !== void 0 && Array.isArray(value)) {
|
|
952
|
+
stack.push(...value);
|
|
953
|
+
combined[key] = [...stack];
|
|
954
|
+
continue;
|
|
955
|
+
}
|
|
956
|
+
combined[key] = value;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
return combined;
|
|
960
|
+
}
|
|
925
961
|
function diaryPath(cwd) {
|
|
926
962
|
return join(memoryDir(cwd), "dream-diary.md");
|
|
927
963
|
}
|
|
@@ -2155,6 +2191,15 @@ function safeStringify(v) {
|
|
|
2155
2191
|
}
|
|
2156
2192
|
}
|
|
2157
2193
|
|
|
2158
|
-
|
|
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 };
|
|
2159
2204
|
//# sourceMappingURL=index.js.map
|
|
2160
2205
|
//# sourceMappingURL=index.js.map
|