@theokit/agents 13.1.0 → 13.2.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 +74 -0
- package/dist/{agent-compiler-B_Z3OZel.d.ts → agent-compiler-BaOZzU7Q.d.ts} +1 -1
- package/dist/auth.js +3 -3
- package/dist/{bridge-entry-vzdHNu_x.d.ts → bridge-entry-BgWauyLQ.d.ts} +4 -4
- package/dist/bridge.d.ts +5 -5
- package/dist/bridge.js +4 -4
- package/dist/{chunk-M5DRNOIU.js → chunk-2SP5BB6U.js} +27 -6
- package/dist/chunk-2SP5BB6U.js.map +1 -0
- package/dist/{chunk-HBHZV3KL.js → chunk-CBP72LFM.js} +2 -2
- package/dist/{chunk-PMMOOXR6.js → chunk-PYVLRSXZ.js} +22 -2
- package/dist/chunk-PYVLRSXZ.js.map +1 -0
- package/dist/{chunk-AAW4I45J.js → chunk-SL3QW5WZ.js} +7 -7
- package/dist/config.d.ts +112 -4
- package/dist/config.js +217 -10
- package/dist/config.js.map +1 -1
- package/dist/{define-agent-Cm7UGHx-.d.ts → define-agent-DOZL_0uP.d.ts} +2 -2
- package/dist/{delegation-scoring-195_ROT3.d.ts → delegation-scoring-DLsMQ4BJ.d.ts} +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +4 -4
- package/dist/{setting-sources-gate-DFu51i50.d.ts → setting-sources-gate-BXdZmY78.d.ts} +7 -1
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +2 -1
- package/dist/testing.js.map +1 -1
- package/dist/tools.d.ts +3 -3
- package/dist/tools.js +3 -2
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-M5DRNOIU.js.map +0 -1
- package/dist/chunk-PMMOOXR6.js.map +0 -1
- /package/dist/{chunk-HBHZV3KL.js.map → chunk-CBP72LFM.js.map} +0 -0
- /package/dist/{chunk-AAW4I45J.js.map → chunk-SL3QW5WZ.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,79 @@
|
|
|
1
1
|
# @theokit/agents
|
|
2
2
|
|
|
3
|
+
## 13.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- af53600: Read the settings files the declared layers correspond to
|
|
8
|
+
|
|
9
|
+
`SETTINGS_LAYERS` published a precedence stack — `user` 10, `project-shared` 20, `project-local` 30 —
|
|
10
|
+
and opened no file. Measured with controls (`loadMcpJson` 5 files, an invented term 0):
|
|
11
|
+
`settings.local.json` appeared once in this package, as a comment; `outputStyle` appeared zero times
|
|
12
|
+
here and zero times in the SDK's built output.
|
|
13
|
+
|
|
14
|
+
Three documented features were unreachable for that one reason. `settings.local.json` had a
|
|
15
|
+
precedence and no reader. `outputStyle` had a loader — shipped in this same line of work — with no
|
|
16
|
+
caller and no source for the name it takes. The session `env` had neither.
|
|
17
|
+
|
|
18
|
+
`loadSettings` opens the three files, folds them through the existing `LayeredConfig` (rather than
|
|
19
|
+
deriving a second answer to "which layer wins"), and reports which declared layers contributed
|
|
20
|
+
nothing. `resolveOutputStyle` joins the two halves so the documented path works end to end: name a
|
|
21
|
+
style in settings, get the style — and a named style with no file behind it still refuses, because
|
|
22
|
+
returning nothing there would restore the silence this work removed.
|
|
23
|
+
|
|
24
|
+
Unknown keys pass through untouched. The brief is the same mechanisms, not every configuration, and
|
|
25
|
+
a reader that dropped what it did not recognise would silently discard an operator's settings.
|
|
26
|
+
|
|
27
|
+
- 88dd1ca: Translate a settings `permissions` block into rules the engine evaluates
|
|
28
|
+
|
|
29
|
+
The SDK ships a real permission engine — `PermissionEngine(rules, { defaultAction })`,
|
|
30
|
+
`PermissionRule`, `PermissionAction` — and it is a code surface: you construct it with rules. What
|
|
31
|
+
was missing was the path from the FILE to those rules. Measured: `permissions` appears in 13 SDK
|
|
32
|
+
files, and the SDK reads `settings.json` in three, of which two are sourcemaps and the third
|
|
33
|
+
describes the hooks shape. An operator writing `{ "permissions": { "deny": ["Bash(curl:*)"] } }` got
|
|
34
|
+
a file nothing translated.
|
|
35
|
+
|
|
36
|
+
`permissionRulesFromSettings` renders `Tool` and `Tool(prefix:*)` / `Tool(exact)` into anchored
|
|
37
|
+
rules, emitted deny-before-ask-before-allow because the engine is first-match-wins and an operator
|
|
38
|
+
reading their own file top to bottom has no reason to expect an `allow` above a `deny` to win.
|
|
39
|
+
|
|
40
|
+
Anything it cannot render faithfully — path globs, `~` expansion, per-tool argument names — is
|
|
41
|
+
RETURNED as unsupported with a reason, never quietly turned into a matcher that almost fires. A
|
|
42
|
+
`deny` an operator believes is in force and is not is strictly more dangerous than no rule, because
|
|
43
|
+
without one they would have written the guard themselves.
|
|
44
|
+
|
|
45
|
+
- 6022a2a: An operator can refuse every hook a foreign configuration root declares
|
|
46
|
+
|
|
47
|
+
`.claude/hooks.json` runs shell commands out of a working directory that usually arrived with the
|
|
48
|
+
clone, and the operator tier had no switch for it: an operator who inherited an untrusted checkout
|
|
49
|
+
could not decline hook execution without editing files inside it. `disableAllHooks` in the managed
|
|
50
|
+
policy now drops the `hooks` surface where `resolveCompatSources` grants the root — one place, and
|
|
51
|
+
the place whose own refusal message already says that root "includes hooks.json, which executes
|
|
52
|
+
shell". It applies whether the consumer took the whole root or narrowed it, and when hooks were the
|
|
53
|
+
only surface asked for, nothing is granted at all.
|
|
54
|
+
|
|
55
|
+
Unlike every other key in this policy, a malformed value fails CLOSED: `"disableAllHooks": "true"`
|
|
56
|
+
as a string is read as `true`, with a warning naming what happened. The asymmetry is the reason —
|
|
57
|
+
fail-open is silent and unsafe, fail-closed is loud and recoverable. An absent key still means hooks
|
|
58
|
+
run, so no existing consumer changes behaviour.
|
|
59
|
+
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- c692b54: Report a malformed operator policy to every reader, not just whichever ran first
|
|
63
|
+
|
|
64
|
+
`currentOperatorPolicy` memoises, and the memo took the warn channel with it: the first caller in the
|
|
65
|
+
process received the warnings and every caller after passed a channel that was never invoked.
|
|
66
|
+
Measured with a policy declaring `disableSkillShellExecution: "true"` — a string where a boolean is
|
|
67
|
+
required — the first reader heard one warning and the second heard none.
|
|
68
|
+
|
|
69
|
+
Three modules read this policy and nothing orders them, so whether an operator learned their policy
|
|
70
|
+
was malformed depended on which code path a given application happened to run first. The whole
|
|
71
|
+
operator tier is a set of refusals; one that silently fails to apply, in a process where nobody is
|
|
72
|
+
told, is the failure the tier exists to remove.
|
|
73
|
+
|
|
74
|
+
The warnings are now kept beside the policy and replayed to each reader. A well-formed policy
|
|
75
|
+
collects nothing, so nothing is replayed and no new noise appears.
|
|
76
|
+
|
|
3
77
|
## 13.1.0
|
|
4
78
|
|
|
5
79
|
### Minor Changes
|
|
@@ -2,7 +2,7 @@ import { InlineSkill, SystemPromptResolver, SessionStore, PermissionGate, Memory
|
|
|
2
2
|
import { AgentDefinition } from '@theokit/sdk/subagents-loader';
|
|
3
3
|
import { TheokitAgentError } from '@theokit/sdk/errors';
|
|
4
4
|
import { R as ReasoningEffort, a as MemoryOptions, P as ProjectContextOptions, M as McpServersMap, H as HumanInTheLoopOptions, C as CheckpointOptions, T as ToolOptions, A as ApprovalOptions, B as BudgetOptions } from './types-C16Wuh9E.js';
|
|
5
|
-
import { G as GatedSettingSource, a as GatedCompatSource } from './setting-sources-gate-
|
|
5
|
+
import { G as GatedSettingSource, a as GatedCompatSource } from './setting-sources-gate-BXdZmY78.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* M9 (theokit-ai-first) — guardrail contract + typed errors.
|
package/dist/auth.js
CHANGED
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
readSecureJson,
|
|
3
3
|
writeSecureJson
|
|
4
4
|
} from "./chunk-D2EFYZBV.js";
|
|
5
|
-
import {
|
|
6
|
-
currentOperatorPolicy
|
|
7
|
-
} from "./chunk-M5DRNOIU.js";
|
|
8
5
|
import {
|
|
9
6
|
debugLog
|
|
10
7
|
} from "./chunk-M5J3Q6YC.js";
|
|
11
8
|
import {
|
|
12
9
|
ConfigurationError
|
|
13
10
|
} from "./chunk-U72XTMYB.js";
|
|
11
|
+
import {
|
|
12
|
+
currentOperatorPolicy
|
|
13
|
+
} from "./chunk-2SP5BB6U.js";
|
|
14
14
|
import {
|
|
15
15
|
__name
|
|
16
16
|
} from "./chunk-Z4QWC7IK.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ExecutionContext } from '@theokit/http';
|
|
2
2
|
import { c as AgentOptions, T as ToolOptions, P as ProjectContextOptions, H as HumanInTheLoopOptions, R as ReasoningEffort, M as McpServersMap } from './types-C16Wuh9E.js';
|
|
3
|
-
import { a as CompiledAgentOptions, b as CompiledTool, G as Guardrail, S as SkillsSelection, H as HookApprovalGate, C as CodePlugin } from './agent-compiler-
|
|
3
|
+
import { a as CompiledAgentOptions, b as CompiledTool, G as Guardrail, S as SkillsSelection, H as HookApprovalGate, C as CodePlugin } from './agent-compiler-BaOZzU7Q.js';
|
|
4
4
|
import { SkillsSettings, ContextSettings, SystemPromptResolver, ModelSelection, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker, CustomTool, RunEventSink, MemorySettings, TelemetrySettings } from '@theokit/sdk';
|
|
5
|
-
import { S as StreamEvent, f as ApprovalRequiredEvent, a4 as MaskError } from './delegation-scoring-
|
|
5
|
+
import { S as StreamEvent, f as ApprovalRequiredEvent, a4 as MaskError } from './delegation-scoring-DLsMQ4BJ.js';
|
|
6
6
|
import { RetryOptions } from '@theokit/sdk/retry';
|
|
7
7
|
import { SandboxPosture } from '@theokit/sdk/sandbox';
|
|
8
|
-
import { A as AgentDefinition } from './define-agent-
|
|
8
|
+
import { A as AgentDefinition } from './define-agent-DOZL_0uP.js';
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
import { H as HookHandlers } from './hook-handlers-Cw2FsnE5.js';
|
|
11
|
-
import { S as SettingSourcesSelection } from './setting-sources-gate-
|
|
11
|
+
import { S as SettingSourcesSelection } from './setting-sources-gate-BXdZmY78.js';
|
|
12
12
|
import { WireChunk } from '@theokit/presenter/wire';
|
|
13
13
|
import { TheokitAgentError } from '@theokit/sdk/errors';
|
|
14
14
|
|
package/dist/bridge.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { c as APPROVAL_MODES, d as AfterToolCallContext, e as AgentBuilder, f as AgentDefinitionError, g as AgentExecutionContext, h as AgentManifest, A as AgentManifestEntry, i as AgentManifestSource, j as AgentManifestTool, b as AgentModule, k as AgentRoute, l as AgentRouteContext, m as AgentRunInfo, n as AgentsPluginOptions, o as ApiErrorContext, p as ApiErrorDecision, q as ApiErrorPolicy, r as ApprovalMode, a as ApprovalPosture, B as BeforeToolCallContext, u as CompiledContextWindow, v as ContextualTool, D as DefinitionOrThunk, w as DelegationTimeoutError, E as EphemeralAgent, L as LLMCallContext, M as McpApprovalSpec, x as McpFileError, y as McpRegistryConfig, z as McpRequestContext, F as McpSelection, P as ProcessInputContext, G as SdkAgentHandle, I as SdkMessage, J as SdkSendOptions, K as SdkTurnHandle, N as Segment, O as ShouldAutoApproveOptions, T as ToolCallVeto, Q as ToolHooks, U as ToolHooksPlugin, W as WRITE_SCOPED_TOOLS, V as agentsPlugin, X as applyPosture, Y as buildModelSelection, Z as compileAgentModule, _ as compileContextWindow, $ as compileLoadedAgentModule, a0 as compileProjectContext, a1 as compileSkills, a2 as createAgentExecutionContext, a3 as createApiErrorHandler, a4 as createSdkAgentStream, a5 as createThinkTagExtractor, a6 as createToolHooksPlugin, a7 as extractThinkTagStream, a8 as generateAgentManifest, a9 as generateAgentRoutes, aa as isAgentContext, ab as loadMcpJson, ac as mcpRegistry, ad as mcpToolApprovals, ae as projectContextMetadataOnlyKnobs, af as reasoningEffortOf, ag as resolveMcpServers, ah as runWithApiErrorHandling, ai as shouldAutoApprove, s as streamAgentUIMessages, aj as toAgentFactory, ak as translateSdkEvent, al as withClockCap, am as withEphemeralAgent } from './bridge-entry-
|
|
2
|
-
export { c as CompatImportUnsupportedError, a as CompiledAgentOptions, b as CompiledTool, H as HookApprovalGate, j as HookApprovalRequest, k as HookGateUnsupportedError, T as ToolWalkResult, m as ToolboxWalkResult, n as compileTools } from './agent-compiler-
|
|
3
|
-
export { A as AgentStopReason, d as AgentStreamEvent, e as AgentTurnMetadata, f as ApprovalRequiredEvent, g as ArtifactChunkEvent, h as ArtifactStartEvent, B as BackgroundDelegation, i as BudgetExceededError, C as CheckpointSavedEvent, k as DelegateFn, a as DelegateOptions, l as DelegationBudgetExceededError, m as DelegationError, n as DelegationPort, c as DelegationResult, D as DelegationTarget, o as DoneEvent, E as ErrorEvent, F as FileEditEvent, I as IterationEvent, P as PartialToolCallEvent, v as RunStartedEvent, w as ScoreVerdict, x as ScoredDelegation, y as Scorer, z as StateUpdateEvent, S as StreamEvent, T as TextDeltaEvent, G as ThinkingEvent, H as ToolCallEvent, J as ToolResultEvent, K as delegate, M as delegateBackground, N as delegateWithScoring, O as isApprovalRequired, Q as isDone, U as isError, V as isPartialToolCall, W as isTextDelta, X as isToolCall, Y as isToolResult, a0 as presentUIMessageStream, a3 as streamAgentResponse } from './delegation-scoring-
|
|
4
|
-
export { a as AGENT_BRAND, A as AgentDefinition, D as DefineAgentConfig, I as InferAgentInput, b as InferAgentToolNames, c as compileAgentDefinition, i as isAgentDefinition } from './define-agent-
|
|
5
|
-
export { C as CompatSurface, a as GatedCompatSource, G as GatedSettingSource, P as ProjectSettingsGrant, R as ResolvedCompatSource, b as SettingSourceCapability, S as SettingSourcesSelection, U as UntrustedSettingSourceError, r as resolveCompatSources, c as resolveSettingSources } from './setting-sources-gate-
|
|
1
|
+
export { c as APPROVAL_MODES, d as AfterToolCallContext, e as AgentBuilder, f as AgentDefinitionError, g as AgentExecutionContext, h as AgentManifest, A as AgentManifestEntry, i as AgentManifestSource, j as AgentManifestTool, b as AgentModule, k as AgentRoute, l as AgentRouteContext, m as AgentRunInfo, n as AgentsPluginOptions, o as ApiErrorContext, p as ApiErrorDecision, q as ApiErrorPolicy, r as ApprovalMode, a as ApprovalPosture, B as BeforeToolCallContext, u as CompiledContextWindow, v as ContextualTool, D as DefinitionOrThunk, w as DelegationTimeoutError, E as EphemeralAgent, L as LLMCallContext, M as McpApprovalSpec, x as McpFileError, y as McpRegistryConfig, z as McpRequestContext, F as McpSelection, P as ProcessInputContext, G as SdkAgentHandle, I as SdkMessage, J as SdkSendOptions, K as SdkTurnHandle, N as Segment, O as ShouldAutoApproveOptions, T as ToolCallVeto, Q as ToolHooks, U as ToolHooksPlugin, W as WRITE_SCOPED_TOOLS, V as agentsPlugin, X as applyPosture, Y as buildModelSelection, Z as compileAgentModule, _ as compileContextWindow, $ as compileLoadedAgentModule, a0 as compileProjectContext, a1 as compileSkills, a2 as createAgentExecutionContext, a3 as createApiErrorHandler, a4 as createSdkAgentStream, a5 as createThinkTagExtractor, a6 as createToolHooksPlugin, a7 as extractThinkTagStream, a8 as generateAgentManifest, a9 as generateAgentRoutes, aa as isAgentContext, ab as loadMcpJson, ac as mcpRegistry, ad as mcpToolApprovals, ae as projectContextMetadataOnlyKnobs, af as reasoningEffortOf, ag as resolveMcpServers, ah as runWithApiErrorHandling, ai as shouldAutoApprove, s as streamAgentUIMessages, aj as toAgentFactory, ak as translateSdkEvent, al as withClockCap, am as withEphemeralAgent } from './bridge-entry-BgWauyLQ.js';
|
|
2
|
+
export { c as CompatImportUnsupportedError, a as CompiledAgentOptions, b as CompiledTool, H as HookApprovalGate, j as HookApprovalRequest, k as HookGateUnsupportedError, T as ToolWalkResult, m as ToolboxWalkResult, n as compileTools } from './agent-compiler-BaOZzU7Q.js';
|
|
3
|
+
export { A as AgentStopReason, d as AgentStreamEvent, e as AgentTurnMetadata, f as ApprovalRequiredEvent, g as ArtifactChunkEvent, h as ArtifactStartEvent, B as BackgroundDelegation, i as BudgetExceededError, C as CheckpointSavedEvent, k as DelegateFn, a as DelegateOptions, l as DelegationBudgetExceededError, m as DelegationError, n as DelegationPort, c as DelegationResult, D as DelegationTarget, o as DoneEvent, E as ErrorEvent, F as FileEditEvent, I as IterationEvent, P as PartialToolCallEvent, v as RunStartedEvent, w as ScoreVerdict, x as ScoredDelegation, y as Scorer, z as StateUpdateEvent, S as StreamEvent, T as TextDeltaEvent, G as ThinkingEvent, H as ToolCallEvent, J as ToolResultEvent, K as delegate, M as delegateBackground, N as delegateWithScoring, O as isApprovalRequired, Q as isDone, U as isError, V as isPartialToolCall, W as isTextDelta, X as isToolCall, Y as isToolResult, a0 as presentUIMessageStream, a3 as streamAgentResponse } from './delegation-scoring-DLsMQ4BJ.js';
|
|
4
|
+
export { a as AGENT_BRAND, A as AgentDefinition, D as DefineAgentConfig, I as InferAgentInput, b as InferAgentToolNames, c as compileAgentDefinition, i as isAgentDefinition } from './define-agent-DOZL_0uP.js';
|
|
5
|
+
export { C as CompatSurface, a as GatedCompatSource, G as GatedSettingSource, P as ProjectSettingsGrant, R as ResolvedCompatSource, b as SettingSourceCapability, S as SettingSourcesSelection, U as UntrustedSettingSourceError, r as resolveCompatSources, c as resolveSettingSources } from './setting-sources-gate-BXdZmY78.js';
|
|
6
6
|
import '@theokit/http';
|
|
7
7
|
import './types-C16Wuh9E.js';
|
|
8
8
|
import '@theokit/sdk';
|
package/dist/bridge.js
CHANGED
|
@@ -29,8 +29,7 @@ import {
|
|
|
29
29
|
runWithApiErrorHandling,
|
|
30
30
|
streamAgentResponse,
|
|
31
31
|
streamAgentUIMessages
|
|
32
|
-
} from "./chunk-
|
|
33
|
-
import "./chunk-M5DRNOIU.js";
|
|
32
|
+
} from "./chunk-SL3QW5WZ.js";
|
|
34
33
|
import {
|
|
35
34
|
APPROVAL_MODES,
|
|
36
35
|
BudgetExceededError,
|
|
@@ -57,7 +56,7 @@ import {
|
|
|
57
56
|
translateSdkEvent,
|
|
58
57
|
withClockCap,
|
|
59
58
|
withEphemeralAgent
|
|
60
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-CBP72LFM.js";
|
|
61
60
|
import "./chunk-MJ6FRILJ.js";
|
|
62
61
|
import {
|
|
63
62
|
AGENT_BRAND,
|
|
@@ -66,9 +65,10 @@ import {
|
|
|
66
65
|
isAgentDefinition,
|
|
67
66
|
resolveCompatSources,
|
|
68
67
|
resolveSettingSources
|
|
69
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-PYVLRSXZ.js";
|
|
70
69
|
import "./chunk-M5J3Q6YC.js";
|
|
71
70
|
import "./chunk-U72XTMYB.js";
|
|
71
|
+
import "./chunk-2SP5BB6U.js";
|
|
72
72
|
import "./chunk-OXNDJSAJ.js";
|
|
73
73
|
import "./chunk-Z4QWC7IK.js";
|
|
74
74
|
export {
|
|
@@ -7,6 +7,7 @@ import { existsSync, readFileSync } from "fs";
|
|
|
7
7
|
import { join } from "path";
|
|
8
8
|
var KNOWN_KEYS = /* @__PURE__ */ new Set([
|
|
9
9
|
"disableSkillShellExecution",
|
|
10
|
+
"disableAllHooks",
|
|
10
11
|
"deniedMcpServers",
|
|
11
12
|
"allowedMcpServers",
|
|
12
13
|
"apiKeyHelper"
|
|
@@ -73,13 +74,23 @@ function applyPolicyKey(out, key, value, path, warn) {
|
|
|
73
74
|
if (key === "apiKeyHelper") out.apiKeyHelper = value.trim();
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
applyBooleanKey(out, key, value, path, warn);
|
|
78
|
+
}
|
|
79
|
+
__name(applyPolicyKey, "applyPolicyKey");
|
|
80
|
+
function applyBooleanKey(out, key, value, path, warn) {
|
|
81
|
+
if (typeof value === "boolean") {
|
|
82
|
+
if (key === "disableSkillShellExecution") out.disableSkillShellExecution = value;
|
|
83
|
+
if (key === "disableAllHooks") out.disableAllHooks = value;
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (key === "disableAllHooks") {
|
|
87
|
+
out.disableAllHooks = true;
|
|
88
|
+
warn(`${path} declares "disableAllHooks" as ${typeof value}, not a boolean. It is being read as TRUE \u2014 hooks are refused \u2014 because a security switch that silently fails open is worse than one that fails visibly. Write \`true\` or \`false\` to say which you meant.`);
|
|
78
89
|
return;
|
|
79
90
|
}
|
|
80
|
-
|
|
91
|
+
warn(`${path} declares "${key}" as ${typeof value}, not a boolean \u2014 it is NOT being applied.`);
|
|
81
92
|
}
|
|
82
|
-
__name(
|
|
93
|
+
__name(applyBooleanKey, "applyBooleanKey");
|
|
83
94
|
function readStringList(value, key, path, warn) {
|
|
84
95
|
if (Array.isArray(value) && value.every((v) => typeof v === "string")) {
|
|
85
96
|
return value;
|
|
@@ -90,8 +101,18 @@ function readStringList(value, key, path, warn) {
|
|
|
90
101
|
__name(readStringList, "readStringList");
|
|
91
102
|
var cached;
|
|
92
103
|
var rootOverride;
|
|
104
|
+
var cachedWarnings = [];
|
|
93
105
|
function currentOperatorPolicy(warn) {
|
|
94
|
-
cached
|
|
106
|
+
if (cached === void 0) {
|
|
107
|
+
const collected = [];
|
|
108
|
+
cached = readOperatorPolicy(rootOverride, (message) => {
|
|
109
|
+
collected.push(message);
|
|
110
|
+
warn(message);
|
|
111
|
+
});
|
|
112
|
+
cachedWarnings = collected;
|
|
113
|
+
return cached;
|
|
114
|
+
}
|
|
115
|
+
for (const message of cachedWarnings) warn(message);
|
|
95
116
|
return cached;
|
|
96
117
|
}
|
|
97
118
|
__name(currentOperatorPolicy, "currentOperatorPolicy");
|
|
@@ -106,4 +127,4 @@ export {
|
|
|
106
127
|
currentOperatorPolicy,
|
|
107
128
|
mcpServerAdmitted
|
|
108
129
|
};
|
|
109
|
-
//# sourceMappingURL=chunk-
|
|
130
|
+
//# sourceMappingURL=chunk-2SP5BB6U.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/config/operator-policy.ts"],"mappings":";;;;;AA4BA,SAASA,YAAYC,oBAAoB;AACzC,SAASC,YAAY;AA8DrB,IAAMC,aAAa,oBAAIC,IAA0B;EAC/C;EACA;EACA;EACA;EACA;CACD;AAGD,IAAMC,cAAc,oBAAID,IAA0B;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BT,IAAIW;AACJ,IAAIC;AAmBJ,IAAIC,iBAAoC,CAAA;AAEjC,SAASC,sBAAsBlC,MAA+B;AACnE,MAAI+B,WAAWtC,QAAW;AACxB,UAAM0C,YAAsB,CAAA;AAC5BJ,aAAShC,mBAAmBiC,cAAc,CAACjB,YAAAA;AACzCoB,gBAAUC,KAAKrB,OAAAA;AACff,WAAKe,OAAAA;IACP,CAAA;AACAkB,qBAAiBE;AACjB,WAAOJ;EACT;AAGA,aAAWhB,WAAWkB,eAAgBjC,MAAKe,OAAAA;AAC3C,SAAOgB;AACT;AAdgBG;AAwCT,SAASG,kBAAkBC,MAAcC,QAAsB;AACpE,MAAIA,OAAOC,kBAAkBC,SAASH,IAAAA,MAAU,KAAM,QAAO;AAC7D,MAAIC,OAAOG,sBAAsBC,OAAW,QAAO;AACnD,SAAOJ,OAAOG,kBAAkBD,SAASH,IAAAA;AAC3C;AAJgBD;","names":["existsSync","readFileSync","join","KNOWN_KEYS","Set","STRING_KEYS","LIST_KEYS","operatorPolicyPath","root","undefined","join","process","platform","env","PROGRAMDATA","readOperatorPolicy","warn","path","parsed","readPolicyDocument","out","key","value","Object","entries","applyPolicyKey","existsSync","JSON","parse","readFileSync","cause","message","Array","isArray","has","list","readStringList","deniedMcpServers","allowedMcpServers","trim","length","apiKeyHelper","applyBooleanKey","disableSkillShellExecution","disableAllHooks","every","v","cached","rootOverride","cachedWarnings","currentOperatorPolicy","collected","push","mcpServerAdmitted","name","policy","deniedMcpServers","includes","allowedMcpServers","undefined"]}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-MJ6FRILJ.js";
|
|
5
5
|
import {
|
|
6
6
|
compileAgentDefinition
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PYVLRSXZ.js";
|
|
8
8
|
import {
|
|
9
9
|
debugLog
|
|
10
10
|
} from "./chunk-M5J3Q6YC.js";
|
|
@@ -2777,4 +2777,4 @@ export {
|
|
|
2777
2777
|
delegateBackground,
|
|
2778
2778
|
delegateWithScoring
|
|
2779
2779
|
};
|
|
2780
|
-
//# sourceMappingURL=chunk-
|
|
2780
|
+
//# sourceMappingURL=chunk-CBP72LFM.js.map
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
currentOperatorPolicy
|
|
3
|
+
} from "./chunk-2SP5BB6U.js";
|
|
1
4
|
import {
|
|
2
5
|
__name
|
|
3
6
|
} from "./chunk-Z4QWC7IK.js";
|
|
4
7
|
|
|
5
8
|
// src/bridge/setting-sources-gate.ts
|
|
6
9
|
import { TheokitAgentError } from "@theokit/sdk/errors";
|
|
10
|
+
var EVERY_SURFACE = [
|
|
11
|
+
"commands",
|
|
12
|
+
"hooks",
|
|
13
|
+
"plugins",
|
|
14
|
+
"skills",
|
|
15
|
+
"subagents"
|
|
16
|
+
];
|
|
17
|
+
var IGNORE_WARNING = /* @__PURE__ */ __name(() => void 0, "IGNORE_WARNING");
|
|
7
18
|
var UntrustedSettingSourceError = class extends TheokitAgentError {
|
|
8
19
|
static {
|
|
9
20
|
__name(this, "UntrustedSettingSourceError");
|
|
@@ -39,7 +50,7 @@ function resolveSettingSources(selection) {
|
|
|
39
50
|
return sources;
|
|
40
51
|
}
|
|
41
52
|
__name(resolveSettingSources, "resolveSettingSources");
|
|
42
|
-
function resolveCompatSources(selection) {
|
|
53
|
+
function resolveCompatSources(selection, onWarn) {
|
|
43
54
|
if (selection?.claudeCode === void 0) return [];
|
|
44
55
|
const posture = selection.claudeCode.trustedBy;
|
|
45
56
|
if (!posture.allows.projectSettings) {
|
|
@@ -50,6 +61,15 @@ function resolveCompatSources(selection) {
|
|
|
50
61
|
throw new UntrustedSettingSourceError(`\`claudeCode.import\` is an empty list, which could mean "no surfaces" or "unset, so all of them" \u2014 and the two differ by whether <cwd>/.claude/hooks.json executes. Name the surfaces you want, or omit \`import\` to take the whole root (usetheokit/theokit#686).`, selection.claudeCode.trustedBy.source, "projectSettings");
|
|
51
62
|
}
|
|
52
63
|
const gated = /* @__PURE__ */ __name((source) => source, "gated");
|
|
64
|
+
if (currentOperatorPolicy(onWarn ?? IGNORE_WARNING).disableAllHooks === true) {
|
|
65
|
+
const kept = (surfaces ?? EVERY_SURFACE).filter((surface) => surface !== "hooks");
|
|
66
|
+
return kept.length === 0 ? [] : [
|
|
67
|
+
gated({
|
|
68
|
+
kind: "claude-code",
|
|
69
|
+
import: kept
|
|
70
|
+
})
|
|
71
|
+
];
|
|
72
|
+
}
|
|
53
73
|
if (surfaces !== void 0) return [
|
|
54
74
|
gated({
|
|
55
75
|
kind: "claude-code",
|
|
@@ -255,4 +275,4 @@ export {
|
|
|
255
275
|
compileAgentDefinition,
|
|
256
276
|
compileSkillsSelection
|
|
257
277
|
};
|
|
258
|
-
//# sourceMappingURL=chunk-
|
|
278
|
+
//# sourceMappingURL=chunk-PYVLRSXZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/bridge/setting-sources-gate.ts","../src/bridge/define-agent.ts"],"mappings":";;;;;;;;AACA,SAASA,yBAAyB;AA+JlC,IAAMC,gBAA0C;EAC9C;EACA;EACA;EACA;EACA;;AAGF,IAAMC,iBAAiB,6BAAYC,QAAZ;AAehB,IAAMC,8BAAN,cAA0CC,kBAAAA;EAtLjD,OAsLiDA;;;;;EAC7BC,OAAO;EAEzB,YACEC,SAESC,aAEAC,YACT;AACA,UAAMF,OAAAA,GAAAA,KAJGC,cAAAA,aAAAA,KAEAC,aAAAA;EAGX;AACF;AA0FO,SAASC,sBACdC,WAA8C;AAE9C,MAAIA,cAAcR,OAAW,QAAO,CAAA;AAIpC,QAAMS,UAAgC,CAAA;AACtC,QAAMC,QAAQ,wBAACC,SAA4CA,MAA7C;AACd,MAAIH,UAAUI,SAAS,KAAMH,SAAQI,KAAKH,MAAM,MAAA,CAAA;AAEhD,QAAMI,QAAQN,UAAUO;AACxB,MAAID,UAAUd,QAAW;AACvB,UAAMgB,UAAUF,MAAMG;AACtB,QAA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rustedSettingSourceError","TheokitAgentError","name","message","trustSource","capability","resolveSettingSources","selection","sources","gated","root","user","push","grant","project","posture","trustedBy","allows","projectSettings","level","source","pluginsGrant","plugins","resolveCompatSources","onWarn","claudeCode","surfaces","import","length","currentOperatorPolicy","disableAllHooks","kept","filter","surface","kind","AGENT_BRAND","Symbol","for","defineAgent","config","assertValidMaxIterations","maxIterations","value","undefined","Number","isInteger","Error","String","isAgentDefinition","toCompiledTool","tool","handler","compiled","name","description","inputSchema","input","ctx","sym","Object","getOwnPropertySymbols","compileAgentDefinition","def","model","reasoningEffort","systemPrompt","system","tools","map","agents","stream","context","runContext","guardrails","approvals","hitl","compileApprovals","compileSkillsSelection","skills","settingSources","resolveSettingSources","claudeCode","compatSources","resolveCompatSources","hookApproval","memory","telemetry","compileHooksAndPlugins","mcpServers","hooks","entries","filter","h","explicit","plugins","length","plugin","version","kind","register","hookName","on","skillsResolver","enabled","inline","entry","push","autoInject","toolNames","Set","t","gates","Map","toolName","options","has","join","set"]}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
currentOperatorPolicy,
|
|
3
|
-
mcpServerAdmitted
|
|
4
|
-
} from "./chunk-M5DRNOIU.js";
|
|
5
1
|
import {
|
|
6
2
|
createHitlPlugin,
|
|
7
3
|
createSdkAgentStream,
|
|
8
4
|
moderateOutputStream,
|
|
9
5
|
runInputGuards,
|
|
10
6
|
textPayloadExtractor
|
|
11
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CBP72LFM.js";
|
|
12
8
|
import {
|
|
13
9
|
compileAgentDefinition,
|
|
14
10
|
defineAgent,
|
|
15
11
|
isAgentDefinition
|
|
16
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PYVLRSXZ.js";
|
|
17
13
|
import {
|
|
18
14
|
ConfigurationError
|
|
19
15
|
} from "./chunk-U72XTMYB.js";
|
|
16
|
+
import {
|
|
17
|
+
currentOperatorPolicy,
|
|
18
|
+
mcpServerAdmitted
|
|
19
|
+
} from "./chunk-2SP5BB6U.js";
|
|
20
20
|
import {
|
|
21
21
|
__name
|
|
22
22
|
} from "./chunk-Z4QWC7IK.js";
|
|
@@ -1340,4 +1340,4 @@ export {
|
|
|
1340
1340
|
generateAgentManifest,
|
|
1341
1341
|
agentsPlugin
|
|
1342
1342
|
};
|
|
1343
|
-
//# sourceMappingURL=chunk-
|
|
1343
|
+
//# sourceMappingURL=chunk-SL3QW5WZ.js.map
|
package/dist/config.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TheokitAgentError } from '@theokit/sdk/errors';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { TrustPosture, LayerValues } from '@theokit/sdk';
|
|
4
|
-
export { DeclaredLayer, LayerValues } from '@theokit/sdk';
|
|
5
|
-
import { R as ResolvedCompatSource } from './setting-sources-gate-
|
|
3
|
+
import { TrustPosture, LayerValues, PermissionRule } from '@theokit/sdk';
|
|
4
|
+
export { DeclaredLayer, LayerValues, PermissionAction, PermissionRule } from '@theokit/sdk';
|
|
5
|
+
import { R as ResolvedCompatSource } from './setting-sources-gate-BXdZmY78.js';
|
|
6
6
|
export { resolveEffectiveContextWindow as effectiveContextWindow } from '@theokit/sdk/compaction';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -724,6 +724,114 @@ interface LoadOutputStyleInput {
|
|
|
724
724
|
* were searched.
|
|
725
725
|
*/
|
|
726
726
|
declare function loadOutputStyle(input: LoadOutputStyleInput): OutputStyle | undefined;
|
|
727
|
+
/**
|
|
728
|
+
* The style the project's settings name, read from the project's style files.
|
|
729
|
+
*
|
|
730
|
+
* The two halves of the documented mechanism, joined. `loadSettings` reads the `outputStyle` key and
|
|
731
|
+
* {@link loadOutputStyle} reads the file; until this existed nothing connected them, so a consumer
|
|
732
|
+
* had to find both modules and know that one feeds the other. Two halves each individually correct
|
|
733
|
+
* and jointly unreachable is the same defect as a capability with no caller — it just takes two
|
|
734
|
+
* files to make.
|
|
735
|
+
*
|
|
736
|
+
* Deliberately does NOT soften the loader: a style named in settings with no file behind it still
|
|
737
|
+
* throws {@link OutputStyleError}. Returning `undefined` there would restore the exact silence this
|
|
738
|
+
* work removed — configured, not applied, and no way to tell which.
|
|
739
|
+
*
|
|
740
|
+
* @throws OutputStyleError when settings name a style and no file backs it.
|
|
741
|
+
*/
|
|
742
|
+
declare function resolveOutputStyle(input: {
|
|
743
|
+
readonly cwd: string;
|
|
744
|
+
readonly homeDir?: string;
|
|
745
|
+
readonly onWarn?: (message: string) => void;
|
|
746
|
+
}): OutputStyle | undefined;
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* Translate a settings `permissions` block into rules the SDK's engine evaluates.
|
|
750
|
+
*
|
|
751
|
+
* The SDK ships `PermissionEngine(rules, { defaultAction })` and it is a CODE surface: you construct
|
|
752
|
+
* it with `PermissionRule[]`. What was missing was the path from the FILE to those rules. Measured
|
|
753
|
+
* 2026-09-11: `permissions` appears in 13 SDK files, and the SDK reads `settings.json` in three, of
|
|
754
|
+
* which two are sourcemaps and the third describes the hooks shape. An operator writing
|
|
755
|
+
* `{ "permissions": { "deny": ["Bash(curl:*)"] } }` got a file nothing translated.
|
|
756
|
+
*
|
|
757
|
+
* ## Partial fidelity would be worse than absence
|
|
758
|
+
*
|
|
759
|
+
* A `deny` that silently fails to match is a control the operator believes is in force — strictly
|
|
760
|
+
* more dangerous than no rule, because without one they would have written the guard themselves. So
|
|
761
|
+
* every entry this module cannot render faithfully is RETURNED as unsupported, with a reason, and
|
|
762
|
+
* excluded from the rules. Nothing is quietly turned into a matcher that does not bite.
|
|
763
|
+
*
|
|
764
|
+
* ## What it deliberately does not attempt
|
|
765
|
+
*
|
|
766
|
+
* The reference's specifier language is larger than this: path globs with `~` expansion, per-tool
|
|
767
|
+
* argument names, and matching semantics that differ by tool. Implementing a lookalike would produce
|
|
768
|
+
* rules that match *almost* the right calls, which is the failure above. Two forms are translated —
|
|
769
|
+
* a bare tool name, and `Tool(prefix:*)` / `Tool(exact)` — and everything else is reported.
|
|
770
|
+
*/
|
|
771
|
+
|
|
772
|
+
/** An entry that was understood well enough to refuse, but not well enough to translate. */
|
|
773
|
+
interface UnsupportedPermissionEntry {
|
|
774
|
+
/** The entry as written, so the operator can find it in their file. */
|
|
775
|
+
readonly entry: string;
|
|
776
|
+
/** Why it was not translated. */
|
|
777
|
+
readonly reason: string;
|
|
778
|
+
}
|
|
779
|
+
interface PermissionTranslation {
|
|
780
|
+
readonly rules: readonly PermissionRule[];
|
|
781
|
+
readonly unsupported: readonly UnsupportedPermissionEntry[];
|
|
782
|
+
}
|
|
783
|
+
/** The `permissions` block as a settings file may carry it. */
|
|
784
|
+
interface PermissionsBlock {
|
|
785
|
+
readonly allow?: readonly string[];
|
|
786
|
+
readonly deny?: readonly string[];
|
|
787
|
+
readonly ask?: readonly string[];
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* The rules a `permissions` block means, and the entries that could not be rendered.
|
|
791
|
+
*
|
|
792
|
+
* An absent or empty block yields nothing and reports nothing: most projects declare no permissions,
|
|
793
|
+
* and a translator that warned there would be noise in every one of them.
|
|
794
|
+
*/
|
|
795
|
+
declare function permissionRulesFromSettings(block: PermissionsBlock | undefined): PermissionTranslation;
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* The keys this layer can act on today, plus everything else untouched.
|
|
799
|
+
*
|
|
800
|
+
* Typed narrowly on purpose: a key is listed here when something in this package reads it, not
|
|
801
|
+
* because the reference documents it. Declaring a field the code ignores would publish a control
|
|
802
|
+
* that does nothing, which is the shape every item in this batch had.
|
|
803
|
+
*/
|
|
804
|
+
declare const SETTINGS_SCHEMA: z.ZodObject<{
|
|
805
|
+
outputStyle: z.ZodOptional<z.ZodString>;
|
|
806
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
807
|
+
permissions: z.ZodOptional<z.ZodObject<{
|
|
808
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
809
|
+
deny: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
810
|
+
ask: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
811
|
+
}, z.core.$loose>>;
|
|
812
|
+
}, z.core.$loose>;
|
|
813
|
+
type Settings = z.infer<typeof SETTINGS_SCHEMA>;
|
|
814
|
+
interface LoadSettingsInput {
|
|
815
|
+
/** Project root. Its `.claude/settings.json` and `.claude/settings.local.json` are read. */
|
|
816
|
+
readonly cwd: string;
|
|
817
|
+
/** Home directory, for the user-level file. Omit to read the project only. */
|
|
818
|
+
readonly homeDir?: string;
|
|
819
|
+
/** Where a file that exists and cannot be parsed is reported. */
|
|
820
|
+
readonly onWarn?: (message: string) => void;
|
|
821
|
+
}
|
|
822
|
+
interface LoadSettingsResult {
|
|
823
|
+
readonly values: Settings;
|
|
824
|
+
/** Which layer each resolved key came from. */
|
|
825
|
+
readonly provenancePerKey: Readonly<Record<string, string>>;
|
|
826
|
+
/** Which declared layers contributed nothing — a file nobody is reading is named, not hidden. */
|
|
827
|
+
readonly precedenceReport: PrecedenceReport;
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* The settings as the declared layers resolve them.
|
|
831
|
+
*
|
|
832
|
+
* Never throws for a missing or malformed file; see {@link readLayer}.
|
|
833
|
+
*/
|
|
834
|
+
declare function loadSettings(input: LoadSettingsInput): LoadSettingsResult;
|
|
727
835
|
|
|
728
836
|
/**
|
|
729
837
|
* Split a markdown file into frontmatter lines and body.
|
|
@@ -814,4 +922,4 @@ declare class ContextPressureThresholdError extends TheokitAgentError {
|
|
|
814
922
|
*/
|
|
815
923
|
declare function contextPressure(usedTokens: number, effectiveWindow: number, thresholds?: ContextPressureThresholds): ContextPressure;
|
|
816
924
|
|
|
817
|
-
export { type ComposeInstructionsOptions, type ComposedInstructions, type ConfigLayer, type ContextPressure, ContextPressureThresholdError, type ContextPressureThresholds, type CustomCommand, type CustomCommandsResult, DEFAULT_CONTEXT_PRESSURE_THRESHOLDS, type ExpandImportsInput, FILE_INLINE_CAP, type InstructionBlock, type InstructionSource, type InstructionTree, type InstructionTreeBudget, LAYERS_ARE_POSITIONED, LayerOutOfOrderError, LayeredConfig, type LayeredConfigInput, type LayeredConfigResult, type LoadCustomCommandsInput, type LoadInstructionTreeInput, type LoadOutputStyleInput, type OutputStyle, OutputStyleError, type ParsedFrontmatter, type PrecedenceReport, type ProvenancePerKey, SETTINGS_LAYERS, type SettingsLayer, type ShellResult, type TemplateDeps, type TrustRecord, TrustStore, TrustStorePermissionsError, blockAppliesTo, composeInstructions, contextPressure, expandCommandTemplate, expandInstructionImports, frontmatterValue, layerPrecedence, loadCustomCommands, loadInstructionTree, loadOutputStyle, settingsLayerChain, splitFrontmatter, templateHints };
|
|
925
|
+
export { type ComposeInstructionsOptions, type ComposedInstructions, type ConfigLayer, type ContextPressure, ContextPressureThresholdError, type ContextPressureThresholds, type CustomCommand, type CustomCommandsResult, DEFAULT_CONTEXT_PRESSURE_THRESHOLDS, type ExpandImportsInput, FILE_INLINE_CAP, type InstructionBlock, type InstructionSource, type InstructionTree, type InstructionTreeBudget, LAYERS_ARE_POSITIONED, LayerOutOfOrderError, LayeredConfig, type LayeredConfigInput, type LayeredConfigResult, type LoadCustomCommandsInput, type LoadInstructionTreeInput, type LoadOutputStyleInput, type LoadSettingsInput, type LoadSettingsResult, type OutputStyle, OutputStyleError, type ParsedFrontmatter, type PermissionTranslation, type PermissionsBlock, type PrecedenceReport, type ProvenancePerKey, SETTINGS_LAYERS, type Settings, type SettingsLayer, type ShellResult, type TemplateDeps, type TrustRecord, TrustStore, TrustStorePermissionsError, type UnsupportedPermissionEntry, blockAppliesTo, composeInstructions, contextPressure, expandCommandTemplate, expandInstructionImports, frontmatterValue, layerPrecedence, loadCustomCommands, loadInstructionTree, loadOutputStyle, loadSettings, permissionRulesFromSettings, resolveOutputStyle, settingsLayerChain, splitFrontmatter, templateHints };
|