@theokit/sdk 4.44.1 → 4.46.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 +44 -0
- package/dist/index.cjs +73 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +121 -1
- package/dist/index.d.ts +121 -1
- package/dist/index.js +71 -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
|
|
@@ -1977,6 +2039,64 @@ declare class Security {
|
|
|
1977
2039
|
static addPattern(re: RegExp): void;
|
|
1978
2040
|
}
|
|
1979
2041
|
|
|
2042
|
+
/**
|
|
2043
|
+
* Resolve a security-relevant setting across configuration layers, where a lower-trust layer may
|
|
2044
|
+
* TIGHTEN it and never loosen it.
|
|
2045
|
+
*
|
|
2046
|
+
* Layered configuration usually resolves last-wins, and for the keys that decide confinement — a
|
|
2047
|
+
* sandbox mode, an approval policy — last-wins is a hole. With plain precedence a project layer
|
|
2048
|
+
* outranks the user's own file, so a cloned repository can hand itself the most permissive setting
|
|
2049
|
+
* and the operator's global choice loses silently, at the moment the directory is opened. Nothing
|
|
2050
|
+
* fails; the confinement is simply gone.
|
|
2051
|
+
*
|
|
2052
|
+
* ## What is generic here, and what is not
|
|
2053
|
+
*
|
|
2054
|
+
* The RULE is generic: named layers may only move the value in the confining direction, while one
|
|
2055
|
+
* designated layer — the operator's explicit flag — wins in both. The VOCABULARY is not: which
|
|
2056
|
+
* values count as more permissive, what the layers are called, and which one is the operator's are
|
|
2057
|
+
* all the consumer's, and are parameters.
|
|
2058
|
+
*
|
|
2059
|
+
* That distinction is what makes this extractable when a keypress router was not. Here the
|
|
2060
|
+
* vocabulary is DATA — two lists and a name — so a second product supplies its own without
|
|
2061
|
+
* inheriting the first's words. An interface shaped by one product's states would have given the
|
|
2062
|
+
* second consumer something to route around.
|
|
2063
|
+
*
|
|
2064
|
+
* ## Why the override is not validated
|
|
2065
|
+
*
|
|
2066
|
+
* `override` is returned verbatim, even when it is outside `permissiveness`. Validating the
|
|
2067
|
+
* operator's flag is the consumer's job: it owns the vocabulary, the error message and the exit
|
|
2068
|
+
* code. Silently dropping an unrecognised flag would be worse than passing it through — the
|
|
2069
|
+
* operator would see their explicit instruction ignored with no explanation.
|
|
2070
|
+
*
|
|
2071
|
+
* A value outside the vocabulary in a RESTRICTED layer is different and IS ignored: a typo in a
|
|
2072
|
+
* repository's config must neither become the effective setting nor be treated as maximally
|
|
2073
|
+
* permissive.
|
|
2074
|
+
*
|
|
2075
|
+
* @public
|
|
2076
|
+
*/
|
|
2077
|
+
/** @public */
|
|
2078
|
+
interface SecurityFloorInput {
|
|
2079
|
+
/**
|
|
2080
|
+
* The vocabulary, ordered from most confined to least. Index is permissiveness, so
|
|
2081
|
+
* `["read-only", "workspace-write", "danger-full-access"]` says read-only confines the most.
|
|
2082
|
+
*/
|
|
2083
|
+
readonly permissiveness: readonly string[];
|
|
2084
|
+
/** Layers that may only tighten — typically anything a repository or environment can supply. */
|
|
2085
|
+
readonly restricted: readonly string[];
|
|
2086
|
+
/** The layer that wins outright in both directions — the operator's explicit flag. */
|
|
2087
|
+
readonly override: string;
|
|
2088
|
+
/**
|
|
2089
|
+
* Values per layer. Layers absent from `restricted` are unconstrained, which is how a `user`
|
|
2090
|
+
* layer loosens its own `defaults`.
|
|
2091
|
+
*/
|
|
2092
|
+
readonly layers: Readonly<Record<string, string | undefined>>;
|
|
2093
|
+
}
|
|
2094
|
+
/**
|
|
2095
|
+
* @returns the resolved value, or `undefined` when no layer supplied one.
|
|
2096
|
+
* @public
|
|
2097
|
+
*/
|
|
2098
|
+
declare function applySecurityFloor(input: SecurityFloorInput): string | undefined;
|
|
2099
|
+
|
|
1980
2100
|
/**
|
|
1981
2101
|
* M3 #62 — scoped session state.
|
|
1982
2102
|
*
|
|
@@ -2575,4 +2695,4 @@ declare function toShareGptTrajectory(result: BatchResult, options?: {
|
|
|
2575
2695
|
model?: string;
|
|
2576
2696
|
}): ShareGptTrajectory | null;
|
|
2577
2697
|
|
|
2578
|
-
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 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, 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 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, UnicodeNormalizer, type UnicodeNormalizerOptions, UsageAccumulator, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, estimateTokens, extractRawId, getPricingEntry, inferApiMode, isValidTaskId, loadProjectEnv, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, runGoalLoop, scopedConversationId, sessionScopePrefix, setDiagnosticsSink, toShareGptTrajectory, withCwdMutex };
|
|
2698
|
+
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, UnicodeNormalizer, type UnicodeNormalizerOptions, UsageAccumulator, applySecurityFloor, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, estimateTokens, extractRawId, foldLayers, getPricingEntry, inferApiMode, isValidTaskId, loadProjectEnv, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, 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
|
|
@@ -1977,6 +2039,64 @@ declare class Security {
|
|
|
1977
2039
|
static addPattern(re: RegExp): void;
|
|
1978
2040
|
}
|
|
1979
2041
|
|
|
2042
|
+
/**
|
|
2043
|
+
* Resolve a security-relevant setting across configuration layers, where a lower-trust layer may
|
|
2044
|
+
* TIGHTEN it and never loosen it.
|
|
2045
|
+
*
|
|
2046
|
+
* Layered configuration usually resolves last-wins, and for the keys that decide confinement — a
|
|
2047
|
+
* sandbox mode, an approval policy — last-wins is a hole. With plain precedence a project layer
|
|
2048
|
+
* outranks the user's own file, so a cloned repository can hand itself the most permissive setting
|
|
2049
|
+
* and the operator's global choice loses silently, at the moment the directory is opened. Nothing
|
|
2050
|
+
* fails; the confinement is simply gone.
|
|
2051
|
+
*
|
|
2052
|
+
* ## What is generic here, and what is not
|
|
2053
|
+
*
|
|
2054
|
+
* The RULE is generic: named layers may only move the value in the confining direction, while one
|
|
2055
|
+
* designated layer — the operator's explicit flag — wins in both. The VOCABULARY is not: which
|
|
2056
|
+
* values count as more permissive, what the layers are called, and which one is the operator's are
|
|
2057
|
+
* all the consumer's, and are parameters.
|
|
2058
|
+
*
|
|
2059
|
+
* That distinction is what makes this extractable when a keypress router was not. Here the
|
|
2060
|
+
* vocabulary is DATA — two lists and a name — so a second product supplies its own without
|
|
2061
|
+
* inheriting the first's words. An interface shaped by one product's states would have given the
|
|
2062
|
+
* second consumer something to route around.
|
|
2063
|
+
*
|
|
2064
|
+
* ## Why the override is not validated
|
|
2065
|
+
*
|
|
2066
|
+
* `override` is returned verbatim, even when it is outside `permissiveness`. Validating the
|
|
2067
|
+
* operator's flag is the consumer's job: it owns the vocabulary, the error message and the exit
|
|
2068
|
+
* code. Silently dropping an unrecognised flag would be worse than passing it through — the
|
|
2069
|
+
* operator would see their explicit instruction ignored with no explanation.
|
|
2070
|
+
*
|
|
2071
|
+
* A value outside the vocabulary in a RESTRICTED layer is different and IS ignored: a typo in a
|
|
2072
|
+
* repository's config must neither become the effective setting nor be treated as maximally
|
|
2073
|
+
* permissive.
|
|
2074
|
+
*
|
|
2075
|
+
* @public
|
|
2076
|
+
*/
|
|
2077
|
+
/** @public */
|
|
2078
|
+
interface SecurityFloorInput {
|
|
2079
|
+
/**
|
|
2080
|
+
* The vocabulary, ordered from most confined to least. Index is permissiveness, so
|
|
2081
|
+
* `["read-only", "workspace-write", "danger-full-access"]` says read-only confines the most.
|
|
2082
|
+
*/
|
|
2083
|
+
readonly permissiveness: readonly string[];
|
|
2084
|
+
/** Layers that may only tighten — typically anything a repository or environment can supply. */
|
|
2085
|
+
readonly restricted: readonly string[];
|
|
2086
|
+
/** The layer that wins outright in both directions — the operator's explicit flag. */
|
|
2087
|
+
readonly override: string;
|
|
2088
|
+
/**
|
|
2089
|
+
* Values per layer. Layers absent from `restricted` are unconstrained, which is how a `user`
|
|
2090
|
+
* layer loosens its own `defaults`.
|
|
2091
|
+
*/
|
|
2092
|
+
readonly layers: Readonly<Record<string, string | undefined>>;
|
|
2093
|
+
}
|
|
2094
|
+
/**
|
|
2095
|
+
* @returns the resolved value, or `undefined` when no layer supplied one.
|
|
2096
|
+
* @public
|
|
2097
|
+
*/
|
|
2098
|
+
declare function applySecurityFloor(input: SecurityFloorInput): string | undefined;
|
|
2099
|
+
|
|
1980
2100
|
/**
|
|
1981
2101
|
* M3 #62 — scoped session state.
|
|
1982
2102
|
*
|
|
@@ -2575,4 +2695,4 @@ declare function toShareGptTrajectory(result: BatchResult, options?: {
|
|
|
2575
2695
|
model?: string;
|
|
2576
2696
|
}): ShareGptTrajectory | null;
|
|
2577
2697
|
|
|
2578
|
-
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 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, 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 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, UnicodeNormalizer, type UnicodeNormalizerOptions, UsageAccumulator, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, estimateTokens, extractRawId, getPricingEntry, inferApiMode, isValidTaskId, loadProjectEnv, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, runGoalLoop, scopedConversationId, sessionScopePrefix, setDiagnosticsSink, toShareGptTrajectory, withCwdMutex };
|
|
2698
|
+
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, UnicodeNormalizer, type UnicodeNormalizerOptions, UsageAccumulator, applySecurityFloor, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, estimateTokens, extractRawId, foldLayers, getPricingEntry, inferApiMode, isValidTaskId, loadProjectEnv, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, 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
|
}
|
|
@@ -1624,6 +1660,39 @@ var Security = class {
|
|
|
1624
1660
|
}
|
|
1625
1661
|
};
|
|
1626
1662
|
|
|
1663
|
+
// src/security-floor.ts
|
|
1664
|
+
function permissivenessOf(order, value) {
|
|
1665
|
+
if (value === void 0) return -1;
|
|
1666
|
+
return order.indexOf(value);
|
|
1667
|
+
}
|
|
1668
|
+
function baseline(input) {
|
|
1669
|
+
const { restricted, override, layers } = input;
|
|
1670
|
+
let value;
|
|
1671
|
+
for (const [name, candidate] of Object.entries(layers)) {
|
|
1672
|
+
if (name === override || restricted.includes(name)) continue;
|
|
1673
|
+
if (candidate !== void 0) value = candidate;
|
|
1674
|
+
}
|
|
1675
|
+
return value;
|
|
1676
|
+
}
|
|
1677
|
+
function tightenOnly(input, start) {
|
|
1678
|
+
const { permissiveness, restricted, layers } = input;
|
|
1679
|
+
let resolved = start;
|
|
1680
|
+
let ceiling = permissivenessOf(permissiveness, start);
|
|
1681
|
+
for (const layer of restricted) {
|
|
1682
|
+
const candidate = layers[layer];
|
|
1683
|
+
if (candidate === void 0) continue;
|
|
1684
|
+
const level = permissivenessOf(permissiveness, candidate);
|
|
1685
|
+
if (level < 0) continue;
|
|
1686
|
+
if (ceiling >= 0 && level > ceiling) continue;
|
|
1687
|
+
resolved = candidate;
|
|
1688
|
+
ceiling = level;
|
|
1689
|
+
}
|
|
1690
|
+
return resolved;
|
|
1691
|
+
}
|
|
1692
|
+
function applySecurityFloor(input) {
|
|
1693
|
+
return input.layers[input.override] ?? tightenOnly(input, baseline(input));
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1627
1696
|
// src/session-scope.ts
|
|
1628
1697
|
function scopedConversationId(scope, id) {
|
|
1629
1698
|
return `${scope}__${id}`;
|
|
@@ -2122,6 +2191,6 @@ function safeStringify(v) {
|
|
|
2122
2191
|
}
|
|
2123
2192
|
}
|
|
2124
2193
|
|
|
2125
|
-
export { AgentFactory, Budget, EventBus, JobQueue, Memory, NoopMemoryProvider, PermissionEngine, PermissionPlugin, Plugin, Provider, SOVEREIGN_ENV_KEYS, Security, Skill, SkillReadTool, Squad, Task, Theokit, TokenLimiter, UnicodeNormalizer, applyMode, chargeAndCheckThresholds, createCounterBudgetTracker, estimateTokens, extractRawId, inferApiMode, loadProjectEnv, migrateSqliteToLance2 as migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, runGoalLoop, scopedConversationId, sessionScopePrefix, toShareGptTrajectory };
|
|
2194
|
+
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, runGoalLoop, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, verifyLayerOrdering };
|
|
2126
2195
|
//# sourceMappingURL=index.js.map
|
|
2127
2196
|
//# sourceMappingURL=index.js.map
|