@theokit/agents 14.1.0 → 14.3.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 CHANGED
@@ -1,5 +1,85 @@
1
1
  # @theokit/agents
2
2
 
3
+ ## 14.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 4b23f36: The environment variables this package reads are now a CLOSED list in the README, gated both ways.
8
+
9
+ An operator exported a variable and nothing happened, and there was no way to tell "this runtime does
10
+ not read it" from "it read it and my value was wrong". `rules/foreign-config-surfaces.md` settles
11
+ that for `.claude/` file surfaces in one sentence — _a surface is read, or it is refused with a
12
+ reason about this product; it is never accepted and ignored_ — and the environment was the largest
13
+ surface that sentence did not cover.
14
+
15
+ **The list is closed, and that is the part worth having.** A variable absent from the table is not
16
+ read by this package — not "undocumented", not "read somewhere else". One sentence answers for every
17
+ variable anyone could export, including the ones nobody enumerated.
18
+
19
+ | Variable | Security | What it changes |
20
+ | ------------------------- | -------- | ------------------------------------------------------------------- |
21
+ | `PROGRAMDATA` | no | where the machine-wide operator policy is looked for on Windows |
22
+ | `THEOKIT_CODEX_CLIENT_ID` | **yes** | which OAuth client the Codex device authorisation is issued against |
23
+ | `THEOKIT_DEBUG` | no | debug logging (the logs can carry request shapes) |
24
+
25
+ **Three, not two.** `THEOKIT_CODEX_CLIENT_ID` is read through a constant rather than a literal
26
+ (`src/auth/device-provider.ts:97`, constant at `:93`), so it is invisible to any scan matching only
27
+ `process.env.X` — and it is the one of the three that touches a credential path. A gate that missed
28
+ it would have signed off on an incomplete list, producing from inside the gate the exact silence the
29
+ list exists to remove.
30
+
31
+ **The security column is a decision per row, not a keyword match.** A name containing `AWS` can be a
32
+ plain address, and a name matching nothing can disable a control.
33
+
34
+ `node scripts/check-env-verdicts.mjs` fails in **both** directions — a variable read and not listed,
35
+ and a variable listed that nothing reads any more. The second is the quieter failure: after a
36
+ refactor deletes the only read, the table keeps advertising a variable that does nothing, and no
37
+ operator can detect that by experiment. The gate uses node's stdlib only, makes no network call, and
38
+ reads nothing outside this repository.
39
+
40
+ ## 14.2.0
41
+
42
+ ### Minor Changes
43
+
44
+ - 8f35df1: `settingSources: { user: true }` now reads the operator's roots instead of changing nothing.
45
+
46
+ The flag was accepted by the type, forwarded, and consulted by nobody. You could set it, see no
47
+ difference, and have no way to tell "this runtime does not read it" from "it read it and my value was
48
+ wrong" — the accepted-and-ignored failure this package removes everywhere else.
49
+
50
+ ```ts
51
+ import { resolveOperatorRoots } from '@theokit/agents/config'
52
+
53
+ const { definitions, withheld } = resolveOperatorRoots({
54
+ user: true,
55
+ grants: ['claude-code'], // only this admits the foreign root
56
+ })
57
+ ```
58
+
59
+ It lives at `./config`, beside the operator POLICY reader, rather than in the root barrel — this
60
+ package's README is explicit that _"the barrel is not the API"_, and the bundle gate measured the
61
+ difference: 2 888 bytes every consumer would have paid to import an agent builder.
62
+
63
+ **Two roots, one grant.** `~/.theokit/skills/` and `~/.theokit/agents/` are ours — `user: true` is
64
+ the whole permission. `~/.claude/skills/` and `~/.claude/agents/` belong to another product under a
65
+ shared home, and they pass the **same** `claude-code` dialect grant that already gates that product's
66
+ project surfaces. `user` says which machine; the dialect says whose format. Collapsing the two would
67
+ admit a foreign inventory on a flag that never mentioned it.
68
+
69
+ **Every definition carries its origin.** `origin: 'theokit' | 'claude-code'` — so you can tell a
70
+ definition you wrote for this product from one you wrote for another, at the point you use it rather
71
+ than by remembering which directory it came from.
72
+
73
+ **A withheld root is named, never counted.** `withheld` reports the path and the grant that would
74
+ admit it. Being told you lost something, without being told what, helps nobody.
75
+
76
+ **Nothing changes for `user` absent or false.** No filesystem walk happens at all — asserted on the
77
+ reported read count rather than on the empty result, because a read-everything-then-filter
78
+ implementation produces the same result at the cost of a walk on every run.
79
+
80
+ A root that exists and cannot be read raises `OperatorRootUnreadableError` rather than resolving to
81
+ empty: reporting it as empty would be indistinguishable from an operator who configured nothing.
82
+
3
83
  ## 14.1.0
4
84
 
5
85
  ### Minor Changes
package/README.md CHANGED
@@ -154,6 +154,33 @@ file that arrives with the repository.
154
154
  This is distinct from the session auto-memory at `~/.claude/projects/`: each subagent reads and
155
155
  writes its own `MEMORY.md`, not the operator's.
156
156
 
157
+ ## Environment variables
158
+
159
+ **This list is CLOSED.** A variable that is not in this table is not read by this package — not
160
+ "undocumented", not "read somewhere else": not read. That is the whole point of writing it down.
161
+ `rules/foreign-config-surfaces.md` settles the same question for `.claude/` file surfaces in one
162
+ sentence — *a surface is read, or it is refused with a reason about this product; it is never
163
+ accepted and ignored* — and this is that sentence applied to the environment.
164
+
165
+ The reason the guarantee is worth more than a list of three: it answers for every variable anyone
166
+ could export, including the ones nobody enumerated, so an operator who sets something and sees no
167
+ change knows which of the two worlds they are in.
168
+
169
+ | Variable | Security | What it changes | Read at |
170
+ |---|---|---|---|
171
+ | `PROGRAMDATA` | no | Where the machine-wide operator policy is looked for on Windows. Changing it moves which policy file governs the run. | `src/config/operator-policy.ts:119` |
172
+ | `THEOKIT_CODEX_CLIENT_ID` | **yes** | Overrides the OAuth client id used for the Codex device flow. It selects which OAuth client the device authorisation is issued against, so it is a credential-path decision rather than a convenience one. | `src/auth/device-provider.ts:97`, via the constant at `:93` |
173
+ | `THEOKIT_DEBUG` | no | Turns on debug logging. Log output can contain request shapes, so treat the logs as sensitive even though the switch is not. | `src/debug-log.ts:10` |
174
+
175
+ The `Security` column is a decision per row, not a keyword match on the name. A name containing
176
+ `AWS` can be a plain address, and a name matching nothing can disable a control — so each row was
177
+ judged rather than classified.
178
+
179
+ `node scripts/check-env-verdicts.mjs` fails the build in **both** directions: a variable this package
180
+ reads and this table omits, and a variable this table lists that nothing reads any more. Without the
181
+ second direction the table would keep advertising a variable after a refactor deleted its only read,
182
+ which is a worse failure than never having documented it.
183
+
157
184
  ## Boundaries this package keeps
158
185
 
159
186
  - It does **not** call an LLM provider, run a tool-dispatch loop, or own the conversation store.
@@ -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-BoTngPIn.js';
5
+ import { G as GatedSettingSource, a as GatedCompatSource } from './setting-sources-gate-BJJiKq33.js';
6
6
 
7
7
  /**
8
8
  * M9 (theokit-ai-first) — guardrail contract + typed errors.
@@ -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-B1F9iumK.js';
3
+ import { a as CompiledAgentOptions, b as CompiledTool, G as Guardrail, S as SkillsSelection, H as HookApprovalGate, C as CodePlugin } from './agent-compiler-D7-Xd6Zh.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-BTuTKWkZ.js';
5
+ import { S as StreamEvent, f as ApprovalRequiredEvent, a4 as MaskError } from './delegation-scoring-CH9Mr9NF.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-D1zBG-Ys.js';
8
+ import { A as AgentDefinition } from './define-agent-y3fsG91f.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-BoTngPIn.js';
11
+ import { S as SettingSourcesSelection } from './setting-sources-gate-BJJiKq33.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-C0MwIOpc.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-B1F9iumK.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-BTuTKWkZ.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-D1zBG-Ys.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-BoTngPIn.js';
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-CuiHdpee.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-D7-Xd6Zh.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-CH9Mr9NF.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-y3fsG91f.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-BJJiKq33.js';
6
6
  import '@theokit/http';
7
7
  import './types-C16Wuh9E.js';
8
8
  import '@theokit/sdk';
package/dist/bridge.js CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  runWithApiErrorHandling,
30
30
  streamAgentResponse,
31
31
  streamAgentUIMessages
32
- } from "./chunk-DFGIED4E.js";
32
+ } from "./chunk-G6GCS5XI.js";
33
33
  import {
34
34
  APPROVAL_MODES,
35
35
  BudgetExceededError,
@@ -56,7 +56,7 @@ import {
56
56
  translateSdkEvent,
57
57
  withClockCap,
58
58
  withEphemeralAgent
59
- } from "./chunk-72QVLTDI.js";
59
+ } from "./chunk-KZPPH6LC.js";
60
60
  import "./chunk-MJ6FRILJ.js";
61
61
  import {
62
62
  AGENT_BRAND,
@@ -65,7 +65,7 @@ import {
65
65
  isAgentDefinition,
66
66
  resolveCompatSources,
67
67
  resolveSettingSources
68
- } from "./chunk-NKPNVQBF.js";
68
+ } from "./chunk-5WS66AW7.js";
69
69
  import "./chunk-M5J3Q6YC.js";
70
70
  import "./chunk-U72XTMYB.js";
71
71
  import "./chunk-2SP5BB6U.js";
@@ -276,4 +276,4 @@ export {
276
276
  compileAgentDefinition,
277
277
  compileSkillsSelection
278
278
  };
279
- //# sourceMappingURL=chunk-NKPNVQBF.js.map
279
+ //# sourceMappingURL=chunk-5WS66AW7.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/bridge/setting-sources-gate.ts","../src/bridge/define-agent.ts"],"mappings":";;;;;;;;AACA,SAASA,yBAAyB;AAyMlC,IAAMC,gBAA0C;EAC9C;EACA;EACA;EACA;EACA;EACA;;AAGF,IAAMC,iBAAiB,6BAAYC,QAAZ;AAehB,IAAMC,8BAAN,cAA0CC,kBAAAA;EAjOjD,OAiOiDA;;;;;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,QAAI,CAACD,QAAQE,OAAOC,iBAAiB;AACnC,YAAM,IAAIlB,4BACR,iKACgEe,QAAQI,KAAK,iBACpEJ,QAAQK,MAAM,wGAEvBL,QAAQK,QACR,iBAAA;IAEJ;AACAZ,YAAQI,KAAKH,MAAM,SAAA,CAAA;EACrB;AAMA,QAAMY,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;AACA,SAAO;IAAE2C,SAAS;SAAID;MAAUG;;EAAQ;AAC1C;AAtBST;AAwBF,SAASV,uBACdC,QAAmC;AAEnC,MAAIA,WAAWnC,OAAW,QAAO,CAAC;AAClC,MAAI,OAAOmC,WAAW,WAAY,QAAO;IAAEwB,gBAAgBxB;EAAO;AAClE,QAAMyB,UAAoB,CAAA;AAC1B,QAAMC,SAAwB,CAAA;AAC9B,aAAWC,SAAS3B,QAAQ;AAC1B,QAAI,OAAO2B,UAAU,SAAUF,SAAQG,KAAKD,KAAAA;QACvCD,QAAOE,KAAKD,KAAAA;EACnB;AACA,SAAO;IACL3B,QAAQ;MAAEyB;MAASI,YAAY;MAAM,GAAIH,OAAOT,SAAS,IAAI;QAAES;MAAO,IAAI,CAAC;IAAG;EAChF;AACF;AAdgB3B;AAqBhB,SAASD,iBAAiBd,KAAoB;AAC5C,QAAM8C,YAAY,IAAIC,KAAK/C,IAAIK,SAAS,CAAA,GAAIC,IAAI,CAAC0C,MAAMA,EAAEzD,IAAI,CAAA;AAC7D,QAAM0D,QAAQ,oBAAIC,IAAAA;AAClB,aAAW,CAACC,UAAUC,OAAAA,KAAYvD,OAAO+B,QAAQ5B,IAAIY,aAAa,CAAC,CAAA,GAAI;AACrE,QAAI,CAACkC,UAAUO,IAAIF,QAAAA,GAAW;AAC5B,YAAM,IAAInE,MACR,mEAAmEmE,QAAAA,sBAC9C;WAAIL;QAAWQ,KAAK,IAAA,KAAS,QAAA,GAAW;IAEjE;AACAL,UAAMM,IAAIJ,UAAUC,OAAAA;EACtB;AACA,SAAOH;AACT;AAbSnC;","names":["TheokitAgentError","EVERY_SURFACE","IGNORE_WARNING","undefined","UntrustedSettingSourceError","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
+ {"version":3,"sources":["../src/bridge/setting-sources-gate.ts","../src/bridge/define-agent.ts"],"mappings":";;;;;;;;AACA,SAASA,yBAAyB;AA+MlC,IAAMC,gBAA0C;EAC9C;EACA;EACA;EACA;EACA;EACA;;AAGF,IAAMC,iBAAiB,6BAAYC,QAAZ;AAehB,IAAMC,8BAAN,cAA0CC,kBAAAA;EAvOjD,OAuOiDA;;;;;EAC7BC,OAAO;EAEzB,YACEC,SAESC,aAEAC,YACT;AACA,UAAMF,OAAAA,GAAAA,KAJGC,cAAAA,aAAAA,KAEAC,aAAAA;EAGX;AACF;AAmGO,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,QAAI,CAACD,QAAQE,OAAOC,iBAAiB;AACnC,YAAM,IAAIlB,4BACR,iKACgEe,QAAQI,KAAK,iBACpEJ,QAAQK,MAAM,wGAEvBL,QAAQK,QACR,iBAAA;IAEJ;AACA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;AACzCjC,YAAI4C,GAAGD,UAAUjD,OAAAA;MACnB;IACF;EACF;AACA,SAAO;IAAE2C,SAAS;SAAID;MAAUG;;EAAQ;AAC1C;AAtBST;AAwBF,SAASV,uBACdC,QAAmC;AAEnC,MAAIA,WAAWnC,OAAW,QAAO,CAAC;AAClC,MAAI,OAAOmC,WAAW,WAAY,QAAO;IAAEwB,gBAAgBxB;EAAO;AAClE,QAAMyB,UAAoB,CAAA;AAC1B,QAAMC,SAAwB,CAAA;AAC9B,aAAWC,SAAS3B,QAAQ;AAC1B,QAAI,OAAO2B,UAAU,SAAUF,SAAQG,KAAKD,KAAAA;QACvCD,QAAOE,KAAKD,KAAAA;EACnB;AACA,SAAO;IACL3B,QAAQ;MAAEyB;MAASI,YAAY;MAAM,GAAIH,OAAOT,SAAS,IAAI;QAAES;MAAO,IAAI,CAAC;IAAG;EAChF;AACF;AAdgB3B;AAqBhB,SAASD,iBAAiBd,KAAoB;AAC5C,QAAM8C,YAAY,IAAIC,KAAK/C,IAAIK,SAAS,CAAA,GAAIC,IAAI,CAAC0C,MAAMA,EAAEzD,IAAI,CAAA;AAC7D,QAAM0D,QAAQ,oBAAIC,IAAAA;AAClB,aAAW,CAACC,UAAUC,OAAAA,KAAYvD,OAAO+B,QAAQ5B,IAAIY,aAAa,CAAC,CAAA,GAAI;AACrE,QAAI,CAACkC,UAAUO,IAAIF,QAAAA,GAAW;AAC5B,YAAM,IAAInE,MACR,mEAAmEmE,QAAAA,sBAC9C;WAAIL;QAAWQ,KAAK,IAAA,KAAS,QAAA,GAAW;IAEjE;AACAL,UAAMM,IAAIJ,UAAUC,OAAAA;EACtB;AACA,SAAOH;AACT;AAbSnC;","names":["TheokitAgentError","EVERY_SURFACE","IGNORE_WARNING","undefined","UntrustedSettingSourceError","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"]}
@@ -4,12 +4,12 @@ import {
4
4
  moderateOutputStream,
5
5
  runInputGuards,
6
6
  textPayloadExtractor
7
- } from "./chunk-72QVLTDI.js";
7
+ } from "./chunk-KZPPH6LC.js";
8
8
  import {
9
9
  compileAgentDefinition,
10
10
  defineAgent,
11
11
  isAgentDefinition
12
- } from "./chunk-NKPNVQBF.js";
12
+ } from "./chunk-5WS66AW7.js";
13
13
  import {
14
14
  ConfigurationError
15
15
  } from "./chunk-U72XTMYB.js";
@@ -1340,4 +1340,4 @@ export {
1340
1340
  generateAgentManifest,
1341
1341
  agentsPlugin
1342
1342
  };
1343
- //# sourceMappingURL=chunk-DFGIED4E.js.map
1343
+ //# sourceMappingURL=chunk-G6GCS5XI.js.map
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-MJ6FRILJ.js";
5
5
  import {
6
6
  compileAgentDefinition
7
- } from "./chunk-NKPNVQBF.js";
7
+ } from "./chunk-5WS66AW7.js";
8
8
  import {
9
9
  debugLog
10
10
  } from "./chunk-M5J3Q6YC.js";
@@ -2845,4 +2845,4 @@ export {
2845
2845
  delegateBackground,
2846
2846
  delegateWithScoring
2847
2847
  };
2848
- //# sourceMappingURL=chunk-72QVLTDI.js.map
2848
+ //# sourceMappingURL=chunk-KZPPH6LC.js.map
package/dist/config.d.ts CHANGED
@@ -2,7 +2,7 @@ import { TheokitAgentError } from '@theokit/sdk/errors';
2
2
  import { z } from 'zod';
3
3
  import { TrustPosture, LayerValues, PermissionRule } from '@theokit/sdk';
4
4
  export { DeclaredLayer, LayerValues, PermissionAction, PermissionRule } from '@theokit/sdk';
5
- import { R as ResolvedCompatSource } from './setting-sources-gate-BoTngPIn.js';
5
+ import { R as ResolvedCompatSource } from './setting-sources-gate-BJJiKq33.js';
6
6
  export { resolveEffectiveContextWindow as effectiveContextWindow } from '@theokit/sdk/compaction';
7
7
 
8
8
  /**
@@ -813,6 +813,74 @@ declare function currentOperatorPolicy(warn: (message: string) => void): Operato
813
813
  */
814
814
  declare function mcpServerAdmitted(name: string, policy: OperatorPolicy): boolean;
815
815
 
816
+ /**
817
+ * B-024 — read the operator's roots when `user: true`, or say why not.
818
+ *
819
+ * `SettingSourcesSelection.user` was forwarded and consulted by nothing: a flag a consumer could set
820
+ * that changed no behaviour and produced no complaint. That is the accepted-and-ignored failure
821
+ * `rules/foreign-config-surfaces.md` removes for `.claude/` file surfaces — *a surface is read, or it
822
+ * is refused with a reason; never accepted and ignored*.
823
+ *
824
+ * ## Two roots, one grant, one label
825
+ *
826
+ * `~/.theokit/` is ours: `user: true` is the whole permission. `~/.claude/` belongs to another
827
+ * product under a shared home, and it passes the SAME `claude-code` dialect grant that gates the
828
+ * project's `.claude/` surfaces — never a looser one. `user` says WHICH MACHINE; the dialect says
829
+ * WHOSE FORMAT, and collapsing them would admit a foreign inventory on a flag that never mentioned
830
+ * it.
831
+ *
832
+ * Every definition carries the root it came from, because an operator has to be able to tell one
833
+ * they wrote for this product from one they wrote for another — at the point of use, not by
834
+ * remembering which directory they put it in.
835
+ */
836
+ /** Which root a definition was loaded from. */
837
+ type OperatorOrigin = 'theokit' | 'claude-code';
838
+ /** A definition found under an operator root. */
839
+ interface OperatorDefinition {
840
+ readonly name: string;
841
+ readonly path: string;
842
+ readonly origin: OperatorOrigin;
843
+ }
844
+ /** A root that exists and was NOT read, with the grant that would admit it. */
845
+ interface WithheldRoot {
846
+ readonly root: string;
847
+ readonly reason: string;
848
+ }
849
+ /** A file under a read root that could not be taken as a definition. */
850
+ interface SkippedDefinition {
851
+ readonly path: string;
852
+ readonly reason: string;
853
+ }
854
+ interface OperatorRootsResult {
855
+ readonly definitions: readonly OperatorDefinition[];
856
+ /** Roots actually walked. Empty when `user` is absent — the proof of NFR-002, not a claim. */
857
+ readonly rootsRead: readonly string[];
858
+ /** Roots present and withheld, each NAMED. A count would tell an operator they lost something and not what. */
859
+ readonly withheld: readonly WithheldRoot[];
860
+ readonly skipped: readonly SkippedDefinition[];
861
+ }
862
+ interface OperatorRootsOptions {
863
+ /** `SettingSourcesSelection.user`. When false or absent, nothing is read at all. */
864
+ readonly user?: boolean;
865
+ /** The dialects the consumer granted, e.g. `['claude-code']`. */
866
+ readonly grants?: readonly string[];
867
+ /** Overridable for tests; defaults to the real home. */
868
+ readonly homeDir?: string;
869
+ }
870
+ /** An operator root exists and cannot be read. Refused loudly rather than reported as empty. */
871
+ declare class OperatorRootUnreadableError extends TheokitAgentError {
872
+ readonly name = "OperatorRootUnreadableError";
873
+ constructor(root: string, cause: unknown);
874
+ }
875
+ /**
876
+ * Resolve the operator's definitions for this run.
877
+ *
878
+ * With `user` absent or false nothing is walked — `rootsRead` is empty, and that is what the test
879
+ * asserts rather than the empty result, because a read-everything-then-filter implementation
880
+ * produces the same result at the cost of a walk on every run.
881
+ */
882
+ declare function resolveOperatorRoots(options: OperatorRootsOptions): OperatorRootsResult;
883
+
816
884
  /** Lines of `MEMORY.md` loaded, matching the reference. */
817
885
  declare const MEMORY_LINE_CAP = 200;
818
886
  /** Bytes loaded, matching the reference. Applied with the line cap, not instead of it. */
@@ -1028,4 +1096,4 @@ declare class ContextPressureThresholdError extends TheokitAgentError {
1028
1096
  */
1029
1097
  declare function contextPressure(usedTokens: number, effectiveWindow: number, thresholds?: ContextPressureThresholds): ContextPressure;
1030
1098
 
1031
- export { type AgentMemory, AgentMemoryError, type AgentMemoryScope, 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, MEMORY_BYTE_CAP, MEMORY_LINE_CAP, type OperatorPolicy, type OutputStyle, OutputStyleError, type ParsedFrontmatter, type PermissionTranslation, type PermissionsBlock, type PrecedenceReport, type ProvenancePerKey, type ResolveAgentMemoryInput, SETTINGS_LAYERS, type Settings, type SettingsLayer, type ShellResult, type TemplateDeps, type TrustRecord, TrustStore, TrustStorePermissionsError, type UnsupportedPermissionEntry, blockAppliesTo, composeInstructions, contextPressure, currentOperatorPolicy, expandCommandTemplate, expandInstructionImports, frontmatterValue, layerPrecedence, loadCustomCommands, loadInstructionTree, loadOutputStyle, loadSettings, mcpServerAdmitted, permissionRulesFromSettings, resolveAgentMemory, resolveOutputStyle, settingsLayerChain, splitFrontmatter, templateHints };
1099
+ export { type AgentMemory, AgentMemoryError, type AgentMemoryScope, 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, MEMORY_BYTE_CAP, MEMORY_LINE_CAP, type OperatorDefinition, type OperatorOrigin, type OperatorPolicy, OperatorRootUnreadableError, type OperatorRootsOptions, type OperatorRootsResult, type OutputStyle, OutputStyleError, type ParsedFrontmatter, type PermissionTranslation, type PermissionsBlock, type PrecedenceReport, type ProvenancePerKey, type ResolveAgentMemoryInput, SETTINGS_LAYERS, type Settings, type SettingsLayer, type ShellResult, type SkippedDefinition, type TemplateDeps, type TrustRecord, TrustStore, TrustStorePermissionsError, type UnsupportedPermissionEntry, type WithheldRoot, blockAppliesTo, composeInstructions, contextPressure, currentOperatorPolicy, expandCommandTemplate, expandInstructionImports, frontmatterValue, layerPrecedence, loadCustomCommands, loadInstructionTree, loadOutputStyle, loadSettings, mcpServerAdmitted, permissionRulesFromSettings, resolveAgentMemory, resolveOperatorRoots, resolveOutputStyle, settingsLayerChain, splitFrontmatter, templateHints };
package/dist/config.js CHANGED
@@ -1013,13 +1013,125 @@ function resolveOutputStyle(input) {
1013
1013
  }
1014
1014
  __name(resolveOutputStyle, "resolveOutputStyle");
1015
1015
 
1016
- // src/config/agent-memory.ts
1017
- import { existsSync as existsSync6, readFileSync as readFileSync7 } from "fs";
1018
- import { join as join6, resolve as resolve4 } from "path";
1016
+ // src/config/operator-roots.ts
1017
+ import { readdirSync as readdirSync4, readFileSync as readFileSync7, statSync as statSync4 } from "fs";
1018
+ import { homedir } from "os";
1019
+ import { join as join6 } from "path";
1019
1020
  import { TheokitAgentError as TheokitAgentError4 } from "@theokit/sdk/errors";
1021
+ var OperatorRootUnreadableError = class extends TheokitAgentError4 {
1022
+ static {
1023
+ __name(this, "OperatorRootUnreadableError");
1024
+ }
1025
+ name = "OperatorRootUnreadableError";
1026
+ constructor(root, cause) {
1027
+ super(`operator root ${root} exists and could not be read: ${cause instanceof Error ? cause.message : String(cause)}. Reporting it as empty would be indistinguishable from an operator who configured nothing.`, {
1028
+ code: "OPERATOR_ROOT_UNREADABLE",
1029
+ cause
1030
+ });
1031
+ }
1032
+ };
1033
+ var FOREIGN_DIALECT = "claude-code";
1034
+ var ROOTS = [
1035
+ {
1036
+ dir: ".theokit",
1037
+ origin: "theokit"
1038
+ },
1039
+ {
1040
+ dir: ".claude",
1041
+ origin: FOREIGN_DIALECT,
1042
+ dialect: FOREIGN_DIALECT
1043
+ }
1044
+ ];
1045
+ function exists(p) {
1046
+ try {
1047
+ return statSync4(p).isDirectory();
1048
+ } catch {
1049
+ return false;
1050
+ }
1051
+ }
1052
+ __name(exists, "exists");
1053
+ function readDefinitions(root, origin, skipped) {
1054
+ let entries;
1055
+ try {
1056
+ entries = readdirSync4(root);
1057
+ } catch (cause) {
1058
+ throw new OperatorRootUnreadableError(root, cause);
1059
+ }
1060
+ const out = [];
1061
+ for (const entry of entries) {
1062
+ if (!entry.endsWith(".md")) continue;
1063
+ const path = join6(root, entry);
1064
+ let body;
1065
+ try {
1066
+ body = readFileSync7(path, "utf8");
1067
+ } catch (cause) {
1068
+ throw new OperatorRootUnreadableError(path, cause);
1069
+ }
1070
+ if (!body.startsWith("---")) {
1071
+ skipped.push({
1072
+ path,
1073
+ reason: "no frontmatter \u2014 not a definition"
1074
+ });
1075
+ continue;
1076
+ }
1077
+ out.push({
1078
+ name: entry.slice(0, -3),
1079
+ path,
1080
+ origin
1081
+ });
1082
+ }
1083
+ return out;
1084
+ }
1085
+ __name(readDefinitions, "readDefinitions");
1086
+ function resolveOperatorRoots(options) {
1087
+ if (options.user !== true) {
1088
+ return {
1089
+ definitions: [],
1090
+ rootsRead: [],
1091
+ withheld: [],
1092
+ skipped: []
1093
+ };
1094
+ }
1095
+ const base = options.homeDir ?? homedir();
1096
+ const grants = new Set(options.grants ?? []);
1097
+ const definitions = [];
1098
+ const rootsRead = [];
1099
+ const withheld = [];
1100
+ const skipped = [];
1101
+ for (const { dir, origin, dialect } of ROOTS) {
1102
+ for (const kind of [
1103
+ "skills",
1104
+ "agents"
1105
+ ]) {
1106
+ const root = join6(base, dir, kind);
1107
+ if (!exists(root)) continue;
1108
+ if (dialect !== void 0 && !grants.has(dialect)) {
1109
+ withheld.push({
1110
+ root,
1111
+ reason: `not loaded \u2014 declare the '${dialect}' dialect in compatSources to receive it`
1112
+ });
1113
+ continue;
1114
+ }
1115
+ rootsRead.push(root);
1116
+ definitions.push(...readDefinitions(root, origin, skipped));
1117
+ }
1118
+ }
1119
+ return {
1120
+ definitions,
1121
+ rootsRead,
1122
+ withheld,
1123
+ skipped
1124
+ };
1125
+ }
1126
+ __name(resolveOperatorRoots, "resolveOperatorRoots");
1127
+
1128
+ // src/config/agent-memory.ts
1129
+ import { existsSync as existsSync6, readFileSync as readFileSync8 } from "fs";
1130
+ import { join as join7, resolve as resolve4 } from "path";
1131
+ import { TheokitAgentError as TheokitAgentError5 } from "@theokit/sdk/errors";
1020
1132
  var MEMORY_LINE_CAP = 200;
1021
1133
  var MEMORY_BYTE_CAP = 25e3;
1022
- var ROOTS = {
1134
+ var ROOTS2 = {
1023
1135
  project: [
1024
1136
  "cwd",
1025
1137
  "agent-memory"
@@ -1033,7 +1145,7 @@ var ROOTS = {
1033
1145
  "agent-memory"
1034
1146
  ]
1035
1147
  };
1036
- var AgentMemoryError = class extends TheokitAgentError4 {
1148
+ var AgentMemoryError = class extends TheokitAgentError5 {
1037
1149
  static {
1038
1150
  __name(this, "AgentMemoryError");
1039
1151
  }
@@ -1068,27 +1180,27 @@ function capped(raw) {
1068
1180
  }
1069
1181
  __name(capped, "capped");
1070
1182
  function isScope(value) {
1071
- return Object.hasOwn(ROOTS, value);
1183
+ return Object.hasOwn(ROOTS2, value);
1072
1184
  }
1073
1185
  __name(isScope, "isScope");
1074
1186
  function resolveAgentMemory(input) {
1075
1187
  if (!isScope(input.scope)) {
1076
- throw new AgentMemoryError(`memory scope "${input.scope}" is not one of: ${Object.keys(ROOTS).join(", ")}. It is refused rather than defaulted, because the three differ in WHO CAN SEE the notes \u2014 \`project\` is committed, \`local\` is kept out of version control, \`user\` crosses projects \u2014 and guessing would publish something somebody wrote expecting privacy.`);
1188
+ throw new AgentMemoryError(`memory scope "${input.scope}" is not one of: ${Object.keys(ROOTS2).join(", ")}. It is refused rather than defaulted, because the three differ in WHO CAN SEE the notes \u2014 \`project\` is committed, \`local\` is kept out of version control, \`user\` crosses projects \u2014 and guessing would publish something somebody wrote expecting privacy.`);
1077
1189
  }
1078
- const [base, dir] = ROOTS[input.scope];
1190
+ const [base, dir] = ROOTS2[input.scope];
1079
1191
  const baseDir = base === "home" ? input.homeDir : input.cwd;
1080
1192
  if (baseDir === void 0) {
1081
1193
  throw new AgentMemoryError(`memory scope "user" needs a home directory and none was given. Falling back to the project would write cross-project notes into one repository, which is the opposite of what the scope asks for.`);
1082
1194
  }
1083
- const memoryRoot = join6(baseDir, ".claude", dir);
1195
+ const memoryRoot = join7(baseDir, ".claude", dir);
1084
1196
  assertContained(memoryRoot, input.agent);
1085
- const root = join6(memoryRoot, input.agent);
1086
- const file = join6(root, "MEMORY.md");
1197
+ const root = join7(memoryRoot, input.agent);
1198
+ const file = join7(root, "MEMORY.md");
1087
1199
  if (!existsSync6(file)) return {
1088
1200
  root,
1089
1201
  truncated: false
1090
1202
  };
1091
- const { text, truncated } = capped(readFileSync7(file, "utf8"));
1203
+ const { text, truncated } = capped(readFileSync8(file, "utf8"));
1092
1204
  return {
1093
1205
  root,
1094
1206
  memory: text,
@@ -1208,12 +1320,12 @@ __name(permissionRulesFromSettings, "permissionRulesFromSettings");
1208
1320
 
1209
1321
  // src/config/context-pressure.ts
1210
1322
  import { resolveEffectiveContextWindow } from "@theokit/sdk/compaction";
1211
- import { TheokitAgentError as TheokitAgentError5 } from "@theokit/sdk/errors";
1323
+ import { TheokitAgentError as TheokitAgentError6 } from "@theokit/sdk/errors";
1212
1324
  var DEFAULT_CONTEXT_PRESSURE_THRESHOLDS = {
1213
1325
  warn: 0.75,
1214
1326
  critical: 0.9
1215
1327
  };
1216
- var ContextPressureThresholdError = class extends TheokitAgentError5 {
1328
+ var ContextPressureThresholdError = class extends TheokitAgentError6 {
1217
1329
  static {
1218
1330
  __name(this, "ContextPressureThresholdError");
1219
1331
  }
@@ -1247,6 +1359,7 @@ export {
1247
1359
  LayeredConfig,
1248
1360
  MEMORY_BYTE_CAP,
1249
1361
  MEMORY_LINE_CAP,
1362
+ OperatorRootUnreadableError,
1250
1363
  OutputStyleError,
1251
1364
  SETTINGS_LAYERS,
1252
1365
  TrustStore,
@@ -1267,6 +1380,7 @@ export {
1267
1380
  mcpServerAdmitted,
1268
1381
  permissionRulesFromSettings,
1269
1382
  resolveAgentMemory,
1383
+ resolveOperatorRoots,
1270
1384
  resolveOutputStyle,
1271
1385
  settingsLayerChain,
1272
1386
  splitFrontmatter,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/config/layered-config.ts","../src/config/trust-store.ts","../src/config/instruction-imports.ts","../src/config/instruction-tree.ts","../src/config/frontmatter.ts","../src/config/compose-instructions.ts","../src/config/custom-commands.ts","../src/bridge/unloaded-surfaces.ts","../src/config/command-template.ts","../src/config/settings-layers.ts","../src/config/output-styles.ts","../src/config/settings-file.ts","../src/config/agent-memory.ts","../src/config/settings-permissions.ts","../src/config/context-pressure.ts"],"mappings":";;;;;;;;;;;;;;;AAIA,SAASA,YAAYC,2BAA2B;AAChD,SAASC,yBAAyB;AAkH3B,IAAMC,uBAAN,cAAmCC,kBAAAA;EAvH1C,OAuH0CA;;;EACtBC,OAAO;EAEzB,YAAYC,SAAiB;AAE3B,UAAMA,SAAS;MAAEC,MAAM;MAA6BC,aAAa;IAAM,CAAA;EACzE;AACF;AASO,IAAMC,gBAAgB;;;;;;;;;;EAU3BC,QACEC,OAAkC;AAElCC,mBAAeD,MAAME,MAAM;AAE3B,UAAMC,eAAeH,MAAMI,oBAAoB,CAAA;AAC/C,UAAMC,SAASC,WAAWN,MAAME,QAAQC,YAAAA;AACxC,UAAMI,QAAQP,MAAMQ,OAAOC,MAAMJ,MAAAA;AAEj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AAWI,SAAS8B,MAAMV,MAAAA,KAAW,CAAA,GAAI;AACvC,YAAMkB,aAAanB,UAAUnB,OAAOoB,MAAAA;AACpC,UAAIQ,OAAOU,UAAAA,EAAaP,OAAMK,KAAKE,UAAAA;UAC9BN,aAAYI,KAAKE,UAAAA;IACxB;EACF;AAEA,SAAO;IAAEP;IAAOC;EAAY;AAC9B;AA5BgBH;;;AC3JhB,SAASU,qCAAqC;AAO9C,SAASC,qBAAAA,0BAAyB;AA+B3B,IAAMC,sCAAiE;EAC5EC,MAAM;EACNC,UAAU;AACZ;AAGO,IAAMC,gCAAN,cAA4CC,mBAAAA;EAhDnD,OAgDmDA;;;EAC/BC,OAAO;EAEzB,YAAYC,SAAiB;AAG3B,UAAMA,SAAS;MAAEC,MAAM;MAAyCC,aAAa;IAAM,CAAA;EACrF;AACF;AAmBO,SAASC,gBACdC,YACAC,iBACAC,aAAwCZ,qCAAmC;AAE3E,MAAIY,WAAWX,QAAQW,WAAWV,UAAU;AAC1C,UAAM,IAAIC,8BACR,+BAA+BU,OAAOD,WAAWX,IAAI,CAAA,iCAC/CY,OAAOD,WAAWV,QAAQ,CAAA,0DAA2D;EAE/F;AACA,MAAI,CAACY,OAAOC,SAASJ,eAAAA,KAAoBA,mBAAmB,EAAG,QAAO;AACtE,MAAI,CAACG,OAAOC,SAASL,UAAAA,KAAeA,cAAc,EAAG,QAAO;AAE5D,QAAMM,QAAQN,aAAaC;AAC3B,MAAIK,SAASJ,WAAWV,SAAU,QAAO;AACzC,MAAIc,SAASJ,WAAWX,KAAM,QAAO;AACrC,SAAO;AACT;AAlBgBQ;","names":["foldLayers","verifyLayerOrdering","TheokitAgentError","LayerOutOfOrderError","TheokitAgentError","name","message","code","isRetryable","LayeredConfig","resolve","input","assertOrdering","layers","accumulating","accumulatingKeys","folded","foldLayers","value","schema","parse","provenancePerKey","buildProvenance","precedenceReport","buildReport","verifyLayerOrdering","error","contributorsOf","key","filter","layer","values","map","keys","Set","flatMap","Object","provenance","contributors","winner","at","undefined","includes","join","declared","contributed","length","measured","has","declaredButSilent","diverges","chmodSync","existsSync","readFileSync","realpathSync","statSync","resolve","resolveTrustPosture","TheokitAgentError","atomicWriteJson","withFileLock","TrustStorePermissionsError","TheokitAgentError","name","file","mode","toString","code","isRetryable","FORBIDDEN_WRITE_BITS","canonicalDir","path","realpathSync","resolve","TrustStore","isTrusted","key","read","some","r","trusted","existsSync","assertSafePermissions","parsed","JSON","parse","readFileSync","records","trust","record","ensureSecureDir","withFileLock","existing","filter","atomicWriteJson","version","chmodSync","postureFor","capabilities","find","resolveTrustPosture","statSync","existsSync","readFileSync","realpathSync","dirname","resolve","MAX_IMPORT_DEPTH","IMPORT_REGEX","maskCodeSpans","text","replace","m","repeat","length","insideRoot","target","rootDir","real","realpathSync","realRoot","startsWith","importTarget","name","filePath","visited","warn","undefined","resolve","dirname","existsSync","has","expandInstructionImports","input","expand","onWarn","Set","alreadyLoaded","depth","wrap","ctx","masked","matches","matchAll","String","out","cursor","match","push","slice","index","add","content","readFileSync","expanded","join","readFileSync","readdirSync","statSync","join","relative","resolve","assertNoSymlinkEscape","FENCE","splitFrontmatter","raw","lines","split","trim","frontmatter","body","closing","findIndex","line","index","undefined","slice","join","frontmatterValue","key","prefix","startsWith","value","length","unquoted","exec","blockAppliesTo","block","filePath","scopesUnreadable","scopes","length","some","scope","globToRegExp","test","out","i","char","replace","RegExp","DEFAULT_FILE_NAMES","isPrivateInstructionFile","entry","endsWith","IGNORE_WARNING","undefined","loadInstructionTree","input","warn","onWarn","fileNames","accepts","includes","cwd","resolve","blocks","seenInodes","Set","chars","visit","dir","depth","budget","maxDepth","String","entries","readdirSync","path","stats","walkOrder","order","inode","dev","ino","has","add","isDirectory","assertNoSymlinkEscape","relative","maxFiles","parsed","parseInstructionFile","content","maxChars","push","truncated","root","roots","count","found","sort","a","b","localeCompare","join","statSync","isFile","item","filter","raw","readFileSync","rel","splitFrontmatter","expandInstructionImports","text","body","rootDir","scopeOf","frontmatter","parsePathsScope","declared","line","inPaths","inline","slice","indexOf","trim","startsWith","close","lastIndexOf","split","map","replaceAll","exec","DEFAULT_SEPARATOR","IGNORE_WARNING","undefined","composeInstructions","base","sources","options","warn","onWarn","separator","length","maxChars","String","text","slice","dropped","map","source","name","trimmed","kept","lengthOf","list","content","join","last","at","withoutLast","room","pop","push","readFileSync","readdirSync","statSync","extname","join","relative","existsSync","readdirSync","join","WORKFLOWS_DIR","join","SCRIPT_SUFFIXES","reportUnloadedSurfaces","input","dir","cwd","existsSync","scripts","readdirSync","filter","f","some","s","endsWith","length","onWarn","String","sort","a","b","localeCompare","COMMANDS_DIR","join","COMPAT_COMMANDS_DIR","CLAUDE_CODE_SOURCE","IGNORE_WARNING","undefined","declaresCommands","sources","some","source","import","includes","declaresClaudeCode","projectCommandDirs","input","projectDir","dirs","compatSources","push","mergeProjectCommands","loaded","warn","length","projectTrusted","pending","flatMap","dir","readCommandsDir","String","command","shadowed","get","name","path","set","loadCustomCommands","onWarn","Map","reportUnloadedSurfaces","cwd","homeDir","builtins","Set","builtinNames","shadowedBuiltins","keys","filter","has","commands","values","sort","byProjectThenName","a","b","localeCompare","root","entries","readdirSync","entry","stats","statSync","isDirectory","isFile","extname","parseCommandFile","relative","raw","readFileSync","parsed","splitFrontmatter","description","frontmatterValue","frontmatter","slice","body","PLACEHOLDER_REGEX","REFERENCE_REGEX","FENCED_COMMAND_REGEX","ARGS_REGEX","QUOTE_TRIM_REGEX","FILE_INLINE_CAP","splitArgs","rawArgs","match","map","arg","replace","templateHints","template","found","matchAll","undefined","push","Set","sort","comparePlaceholders","a","b","Number","slice","replaceAsync","source","pattern","resolve","matches","length","parts","cursor","index","join","expandCommandTemplate","deps","test","ConfigurationError","code","args","withArgs","warn","String","command","groups","cmd","currentOperatorPolicy","disableSkillShellExecution","result","shell","ok","text","name","file","content","readFile","SETTINGS_LAYERS","layer","precedence","CODE_PRECEDENCE","LAYERS_ARE_POSITIONED","layerPrecedence","found","find","l","Error","settingsLayerChain","values","entries","Object","filter","e","undefined","map","v","sort","a","b","existsSync","readFileSync","join","TheokitAgentError","existsSync","readFileSync","join","z","SETTINGS_SCHEMA","z","looseObject","outputStyle","string","optional","env","record","permissions","object","allow","array","deny","ask","loose","IGNORE_WARNING","undefined","FILE_LAYERS","layer","dir","file","readLayer","path","warn","existsSync","parsed","JSON","parse","readFileSync","Array","isArray","error","message","loadSettings","input","onWarn","layers","flatMap","entry","root","homeDir","cwd","declared","SETTINGS_LAYERS","find","l","precedence","values","join","ordered","sort","a","b","resolved","LayeredConfig","resolve","schema","value","provenancePerKey","precedenceReport","OUTPUT_STYLES_DIR","join","OutputStyleError","TheokitAgentError","name","message","code","isRetryable","loadOutputStyle","input","undefined","searched","cwd","homeDir","dir","path","existsSync","raw","readFileSync","parsed","splitFrontmatter","body","description","frontmatterValue","frontmatter","content","trim","keepCodingInstructions","resolveOutputStyle","settings","loadSettings","values","outputStyle","existsSync","readFileSync","join","resolve","TheokitAgentError","MEMORY_LINE_CAP","MEMORY_BYTE_CAP","ROOTS","project","local","user","AgentMemoryError","TheokitAgentError","name","message","code","isRetryable","assertContained","root","agent","full","resolve","startsWith","capped","raw","lines","split","text","slice","join","truncated","length","Buffer","byteLength","from","subarray","toString","endsWith","isScope","value","Object","hasOwn","resolveAgentMemory","input","scope","keys","base","dir","baseDir","homeDir","cwd","undefined","memoryRoot","file","existsSync","readFileSync","memory","ACTIONS","MAX_TOOL","MAX_SPEC","splitEntry","entry","open","indexOf","isToolName","tool","undefined","endsWith","slice","spec","length","includes","value","test","UNTRANSLATABLE","escapeRegExp","literal","replaceAll","String","raw","translate","action","parsed","trim","reason","prefix","args","command","RegExp","isRule","permissionRulesFromSettings","block","rules","unsupported","key","Object","keys","push","join","translated","resolveEffectiveContextWindow","TheokitAgentError","DEFAULT_CONTEXT_PRESSURE_THRESHOLDS","warn","critical","ContextPressureThresholdError","TheokitAgentError","name","message","code","isRetryable","contextPressure","usedTokens","effectiveWindow","thresholds","String","Number","isFinite","ratio"]}
1
+ {"version":3,"sources":["../src/config/layered-config.ts","../src/config/trust-store.ts","../src/config/instruction-imports.ts","../src/config/instruction-tree.ts","../src/config/frontmatter.ts","../src/config/compose-instructions.ts","../src/config/custom-commands.ts","../src/bridge/unloaded-surfaces.ts","../src/config/command-template.ts","../src/config/settings-layers.ts","../src/config/output-styles.ts","../src/config/settings-file.ts","../src/config/operator-roots.ts","../src/config/agent-memory.ts","../src/config/settings-permissions.ts","../src/config/context-pressure.ts"],"mappings":";;;;;;;;;;;;;;;AAIA,SAASA,YAAYC,2BAA2B;AAChD,SAASC,yBAAyB;AAkH3B,IAAMC,uBAAN,cAAmCC,kBAAAA;EAvH1C,OAuH0CA;;;EACtBC,OAAO;EAEzB,YAAYC,SAAiB;AAE3B,UAAMA,SAAS;MAAEC,MAAM;MAA6BC,aAAa;IAAM,CAAA;EACzE;AACF;AASO,IAAMC,gBAAgB;;;;;;;;;;EAU3BC,QACEC,OAAkC;AAElCC,mBAAeD,MAAME,MAAM;AAE3B,UAAMC,eAAeH,MAAMI,oBAAoB,CAAA;AAC/C,UAAMC,SAASC,WAAWN,MAAME,QAAQC,YAAAA;AACxC,UAAMI,QAAQP,MAAMQ,OAAOC,MAAMJ,MAAAA;AAEjC,WAAO;MACLE;MACAG,kBAAkBC,gBAAgBX,MAAME,QAAQC,YAAAA;MAChDS,kBAAkBC,YAAYb,MAAME,MAAM;IAC5C;EACF;AACF;AASA,SAASD,eAAeC,QAA8B;AACpD,MAAI;AACFY,wBAAoBZ,MAAAA;EACtB,SAASa,OAAO;AACd,UAAM,IAAIvB,qBAAsBuB,MAAgBpB,OAAO;EACzD;AACF;AANSM;AAST,SAASe,eAAed,QAAgCe,KAAW;AACjE,SAAOf,OAAOgB,OAAO,CAACC,UAAUF,OAAOE,MAAMC,MAAM,EAAEC,IAAI,CAACF,UAAUA,MAAMA,KAAK;AACjF;AAFSH;AAIT,SAASL,gBACPT,QACAC,cAA+B;AAE/B,QAAMmB,OAAO,IAAIC,IAAIrB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CAACY,OAAOC,SAASJ,eAAAA,KAAoBA,mBAAmB,EAAG,QAAO;AACtE,MAAI,CAACG,OAAOC,SAASL,UAAAA,KAAeA,cAAc,EAAG,QAAO;AAE5D,QAAMM,QAAQN,aAAaC;AAC3B,MAAIK,SAASJ,WAAWV,SAAU,QAAO;AACzC,MAAIc,SAASJ,WAAWX,KAAM,QAAO;AACrC,SAAO;AACT;AAlBgBQ;","names":["foldLayers","verifyLayerOrdering","TheokitAgentError","LayerOutOfOrderError","TheokitAgentError","name","message","code","isRetryable","LayeredConfig","resolve","input","assertOrdering","layers","accumulating","accumulatingKeys","folded","foldLayers","value","schema","parse","provenancePerKey","buildProvenance","precedenceReport","buildReport","verifyLayerOrdering","error","contributorsOf","key","filter","layer","values","map","keys","Set","flatMap","Object","provenance","contributors","winner","at","undefined","includes","join","declared","contributed","length","measured","has","declaredButSilent","diverges","chmodSync","existsSync","readFileSync","realpathSync","statSync","resolve","resolveTrustPosture","TheokitAgentError","atomicWriteJson","withFileLock","TrustStorePermissionsError","TheokitAgentError","name","file","mode","toString","code","isRetryable","FORBIDDEN_WRITE_BITS","canonicalDir","path","realpathSync","resolve","TrustStore","isTrusted","key","read","some","r","trusted","existsSync","assertSafePermissions","parsed","JSON","parse","readFileSync","records","trust","record","ensureSecureDir","withFileLock","existing","filter","atomicWriteJson","version","chmodSync","postureFor","capabilities","find","resolveTrustPosture","statSync","existsSync","readFileSync","realpathSync","dirname","resolve","MAX_IMPORT_DEPTH","IMPORT_REGEX","maskCodeSpans","text","replace","m","repeat","length","insideRoot","target","rootDir","real","realpathSync","realRoot","startsWith","importTarget","name","filePath","visited","warn","undefined","resolve","dirname","existsSync","has","expandInstructionImports","input","expand","onWarn","Set","alreadyLoaded","depth","wrap","ctx","masked","matches","matchAll","String","out","cursor","match","push","slice","index","add","content","readFileSync","expanded","join","readFileSync","readdirSync","statSync","join","relative","resolve","assertNoSymlinkEscape","FENCE","splitFrontmatter","raw","lines","split","trim","frontmatter","body","closing","findIndex","line","index","undefined","slice","join","frontmatterValue","key","prefix","startsWith","value","length","unquoted","exec","blockAppliesTo","block","filePath","scopesUnreadable","scopes","length","some","scope","globToRegExp","test","out","i","char","replace","RegExp","DEFAULT_FILE_NAMES","isPrivateInstructionFile","entry","endsWith","IGNORE_WARNING","undefined","loadInstructionTree","input","warn","onWarn","fileNames","accepts","includes","cwd","resolve","blocks","seenInodes","Set","chars","visit","dir","depth","budget","maxDepth","String","entries","readdirSync","path","stats","walkOrder","order","inode","dev","ino","has","add","isDirectory","assertNoSymlinkEscape","relative","maxFiles","parsed","parseInstructionFile","content","maxChars","push","truncated","root","roots","count","found","sort","a","b","localeCompare","join","statSync","isFile","item","filter","raw","readFileSync","rel","splitFrontmatter","expandInstructionImports","text","body","rootDir","scopeOf","frontmatter","parsePathsScope","declared","line","inPaths","inline","slice","indexOf","trim","startsWith","close","lastIndexOf","split","map","replaceAll","exec","DEFAULT_SEPARATOR","IGNORE_WARNING","undefined","composeInstructions","base","sources","options","warn","onWarn","separator","length","maxChars","String","text","slice","dropped","map","source","name","trimmed","kept","lengthOf","list","content","join","last","at","withoutLast","room","pop","push","readFileSync","readdirSync","statSync","extname","join","relative","existsSync","readdirSync","join","WORKFLOWS_DIR","join","SCRIPT_SUFFIXES","reportUnloadedSurfaces","input","dir","cwd","existsSync","scripts","readdirSync","filter","f","some","s","endsWith","length","onWarn","String","sort","a","b","localeCompare","COMMANDS_DIR","join","COMPAT_COMMANDS_DIR","CLAUDE_CODE_SOURCE","IGNORE_WARNING","undefined","declaresCommands","sources","some","source","import","includes","declaresClaudeCode","projectCommandDirs","input","projectDir","dirs","compatSources","push","mergeProjectCommands","loaded","warn","length","projectTrusted","pending","flatMap","dir","readCommandsDir","String","command","shadowed","get","name","path","set","loadCustomCommands","onWarn","Map","reportUnloadedSurfaces","cwd","homeDir","builtins","Set","builtinNames","shadowedBuiltins","keys","filter","has","commands","values","sort","byProjectThenName","a","b","localeCompare","root","entries","readdirSync","entry","stats","statSync","isDirectory","isFile","extname","parseCommandFile","relative","raw","readFileSync","parsed","splitFrontmatter","description","frontmatterValue","frontmatter","slice","body","PLACEHOLDER_REGEX","REFERENCE_REGEX","FENCED_COMMAND_REGEX","ARGS_REGEX","QUOTE_TRIM_REGEX","FILE_INLINE_CAP","splitArgs","rawArgs","match","map","arg","replace","templateHints","template","found","matchAll","undefined","push","Set","sort","comparePlaceholders","a","b","Number","slice","replaceAsync","source","pattern","resolve","matches","length","parts","cursor","index","join","expandCommandTemplate","deps","test","ConfigurationError","code","args","withArgs","warn","String","command","groups","cmd","currentOperatorPolicy","disableSkillShellExecution","result","shell","ok","text","name","file","content","readFile","SETTINGS_LAYERS","layer","precedence","CODE_PRECEDENCE","LAYERS_ARE_POSITIONED","layerPrecedence","found","find","l","Error","settingsLayerChain","values","entries","Object","filter","e","undefined","map","v","sort","a","b","existsSync","readFileSync","join","TheokitAgentError","existsSync","readFileSync","join","z","SETTINGS_SCHEMA","z","looseObject","outputStyle","string","optional","env","record","permissions","object","allow","array","deny","ask","loose","IGNORE_WARNING","undefined","FILE_LAYERS","layer","dir","file","readLayer","path","warn","existsSync","parsed","JSON","parse","readFileSync","Array","isArray","error","message","loadSettings","input","onWarn","layers","flatMap","entry","root","homeDir","cwd","declared","SETTINGS_LAYERS","find","l","precedence","values","join","ordered","sort","a","b","resolved","LayeredConfig","resolve","schema","value","provenancePerKey","precedenceReport","OUTPUT_STYLES_DIR","join","OutputStyleError","TheokitAgentError","name","message","code","isRetryable","loadOutputStyle","input","undefined","searched","cwd","homeDir","dir","path","existsSync","raw","readFileSync","parsed","splitFrontmatter","body","description","frontmatterValue","frontmatter","content","trim","keepCodingInstructions","resolveOutputStyle","settings","loadSettings","values","outputStyle","readdirSync","readFileSync","statSync","homedir","join","TheokitAgentError","OperatorRootUnreadableError","TheokitAgentError","name","root","cause","Error","message","String","code","FOREIGN_DIALECT","ROOTS","dir","origin","dialect","exists","p","statSync","isDirectory","readDefinitions","skipped","entries","readdirSync","out","entry","endsWith","path","join","body","readFileSync","startsWith","push","reason","slice","resolveOperatorRoots","options","user","definitions","rootsRead","withheld","base","homeDir","homedir","grants","Set","kind","undefined","has","existsSync","readFileSync","join","resolve","TheokitAgentError","MEMORY_LINE_CAP","MEMORY_BYTE_CAP","ROOTS","project","local","user","AgentMemoryError","TheokitAgentError","name","message","code","isRetryable","assertContained","root","agent","full","resolve","startsWith","capped","raw","lines","split","text","slice","join","truncated","length","Buffer","byteLength","from","subarray","toString","endsWith","isScope","value","Object","hasOwn","resolveAgentMemory","input","scope","keys","base","dir","baseDir","homeDir","cwd","undefined","memoryRoot","file","existsSync","readFileSync","memory","ACTIONS","MAX_TOOL","MAX_SPEC","splitEntry","entry","open","indexOf","isToolName","tool","undefined","endsWith","slice","spec","length","includes","value","test","UNTRANSLATABLE","escapeRegExp","literal","replaceAll","String","raw","translate","action","parsed","trim","reason","prefix","args","command","RegExp","isRule","permissionRulesFromSettings","block","rules","unsupported","key","Object","keys","push","join","translated","resolveEffectiveContextWindow","TheokitAgentError","DEFAULT_CONTEXT_PRESSURE_THRESHOLDS","warn","critical","ContextPressureThresholdError","TheokitAgentError","name","message","code","isRetryable","contextPressure","usedTokens","effectiveWindow","thresholds","String","Number","isFinite","ratio"]}
@@ -1,9 +1,9 @@
1
1
  import { CustomTool, MemorySettings, TelemetrySettings } from '@theokit/sdk';
2
2
  import { z } from 'zod';
3
- import { G as Guardrail, S as SkillsSelection, H as HookApprovalGate, C as CodePlugin, a as CompiledAgentOptions } from './agent-compiler-B1F9iumK.js';
3
+ import { G as Guardrail, S as SkillsSelection, H as HookApprovalGate, C as CodePlugin, a as CompiledAgentOptions } from './agent-compiler-D7-Xd6Zh.js';
4
4
  import { R as ReasoningEffort, H as HumanInTheLoopOptions, M as McpServersMap } from './types-C16Wuh9E.js';
5
5
  import { H as HookHandlers } from './hook-handlers-Cw2FsnE5.js';
6
- import { S as SettingSourcesSelection } from './setting-sources-gate-BoTngPIn.js';
6
+ import { S as SettingSourcesSelection } from './setting-sources-gate-BJJiKq33.js';
7
7
 
8
8
  /**
9
9
  * M2 (theokit-ai-first) — `defineAgent`, the zero-config imperative agent surface.
@@ -1,6 +1,6 @@
1
1
  import { PluginsSettings, ProviderRoutingSettings, AgentDefinition, BudgetTracker, CustomTool } from '@theokit/sdk';
2
2
  import { RetryOptions } from '@theokit/sdk/retry';
3
- import { a as CompiledAgentOptions, b as CompiledTool } from './agent-compiler-B1F9iumK.js';
3
+ import { a as CompiledAgentOptions, b as CompiledTool } from './agent-compiler-D7-Xd6Zh.js';
4
4
  import { TheokitAgentError } from '@theokit/sdk/errors';
5
5
  import { z } from 'zod';
6
6
  import { b as MainLoopMeta } from './types-C16Wuh9E.js';
package/dist/index.d.ts CHANGED
@@ -2,18 +2,18 @@ import { PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition, Budg
2
2
  export { BudgetTracker, CustomTool, DiagnosticsSink, GenerateObjectError, GoalEvent, GoalLoopAgent, GoalOptions, GoalResult, InlineSkill, JudgeCredentialError, JudgeResult, LayerOrderError, McpAuthConfig, McpHttpServerConfig, McpOAuthConfig, McpServerConfig, McpStdioServerConfig, Plugin, PluginsSettings, Provider, ProviderRoutingSettings, RunEvent, SDKAgent, SessionRecord, SessionStore, Squad, StreamObjectError, Tool, ToolError, ToolResultContentBlock, TrustLevel, TrustPosture, TrustPostureInput, TrustSource, UngatedCapabilityError, Verdict, WiredEntity, applySecurityFloor, auditEnvReachability, foldLayers, recordWiring, resolveTrustPosture, setDiagnosticsSink, verifyLayerOrdering } from '@theokit/sdk';
3
3
  import { b as MainLoopMeta, R as ReasoningEffort, T as ToolOptions, A as ApprovalOptions, H as HumanInTheLoopOptions } from './types-C16Wuh9E.js';
4
4
  export { c as AgentOptions, B as BudgetOptions, d as MainLoopOptions, M as McpServersMap, e as PolicyHandler, f as TimeoutAction, g as ToolboxOptions } from './types-C16Wuh9E.js';
5
- import { C as ContextWindowOptions, S as SkillsOptions, A as AgentManifestEntry, H as HitlDecision, s as streamAgentUIMessages, a as ApprovalPosture, b as AgentModule } from './bridge-entry-C0MwIOpc.js';
6
- export { c as APPROVAL_MODES, d as AfterToolCallContext, e as AgentBuilder, f as AgentDefinitionError, g as AgentExecutionContext, h as AgentManifest, i as AgentManifestSource, j as AgentManifestTool, k as AgentRoute, l as AgentRouteContext, m as AgentRunInfo, n as AgentsPluginOptions, o as ApiErrorContext, p as ApiErrorDecision, q as ApiErrorPolicy, r as ApprovalMode, t as ApprovalRequest, 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, R as RuntimeOverrides, 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, aj as toAgentFactory, ak as translateSdkEvent, al as withClockCap, am as withEphemeralAgent } from './bridge-entry-C0MwIOpc.js';
5
+ import { C as ContextWindowOptions, S as SkillsOptions, A as AgentManifestEntry, H as HitlDecision, s as streamAgentUIMessages, a as ApprovalPosture, b as AgentModule } from './bridge-entry-CuiHdpee.js';
6
+ export { c as APPROVAL_MODES, d as AfterToolCallContext, e as AgentBuilder, f as AgentDefinitionError, g as AgentExecutionContext, h as AgentManifest, i as AgentManifestSource, j as AgentManifestTool, k as AgentRoute, l as AgentRouteContext, m as AgentRunInfo, n as AgentsPluginOptions, o as ApiErrorContext, p as ApiErrorDecision, q as ApiErrorPolicy, r as ApprovalMode, t as ApprovalRequest, 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, R as RuntimeOverrides, 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, aj as toAgentFactory, ak as translateSdkEvent, al as withClockCap, am as withEphemeralAgent } from './bridge-entry-CuiHdpee.js';
7
7
  import { TheokitAgentError } from '@theokit/sdk/errors';
8
8
  export * from '@theokit/sdk/errors';
9
9
  export { ConfigurationError, BudgetExceededError as WindowBudgetExceededError } from '@theokit/sdk/errors';
10
- import { G as Guardrail, a as CompiledAgentOptions, b as CompiledTool } from './agent-compiler-B1F9iumK.js';
11
- export { c as CompatImportUnsupportedError, d as CostBudgetExceededError, e as GuardrailAction, f as GuardrailError, g as GuardrailPhase, h as GuardrailResult, i as GuardrailViolationError, H as HookApprovalGate, j as HookApprovalRequest, k as HookGateUnsupportedError, M as MalformedGuardrailResultError, l as SkillsRequestContext, S as SkillsSelection, T as ToolWalkResult, m as ToolboxWalkResult, U as UnreadableTextPayloadError, n as compileTools, r as resolveEnabledSkills } from './agent-compiler-B1F9iumK.js';
12
- import { S as SettingSourcesSelection } from './setting-sources-gate-BoTngPIn.js';
13
- export { C as CompatSurface, a as GatedCompatSource, G as GatedSettingSource, P as ProjectSettingsGrant, R as ResolvedCompatSource, b as SettingSourceCapability, U as UntrustedSettingSourceError, r as resolveCompatSources, c as resolveSettingSources } from './setting-sources-gate-BoTngPIn.js';
14
- import { L as LoopStrategy, R as ReflectionStrategy, b as RoundStreamFactory, S as StreamEvent, c as DelegationResult } from './delegation-scoring-BTuTKWkZ.js';
15
- 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, j as DEFAULT_MAX_ITERATIONS, k as DelegateFn, a as DelegateOptions, l as DelegationBudgetExceededError, m as DelegationError, n as DelegationPort, D as DelegationTarget, o as DoneEvent, E as ErrorEvent, F as FileEditEvent, I as IterationEvent, p as LoopFinishReason, q as LoopOutcome, r as LoopStrategyConfig, P as PartialToolCallEvent, s as ReflectionContext, t as ReflectionResult, u as ReflectionStrategyConfig, v as RunStartedEvent, w as ScoreVerdict, x as ScoredDelegation, y as Scorer, z as StateUpdateEvent, 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, Z as ladderReflectionStrategy, _ as loopStrategyConfigSchema, $ as noopReflectionStrategy, a0 as presentUIMessageStream, a1 as reflectionStrategyConfigSchema, a2 as resolveLoopStrategy, a3 as streamAgentResponse } from './delegation-scoring-BTuTKWkZ.js';
16
- 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-D1zBG-Ys.js';
10
+ import { G as Guardrail, a as CompiledAgentOptions, b as CompiledTool } from './agent-compiler-D7-Xd6Zh.js';
11
+ export { c as CompatImportUnsupportedError, d as CostBudgetExceededError, e as GuardrailAction, f as GuardrailError, g as GuardrailPhase, h as GuardrailResult, i as GuardrailViolationError, H as HookApprovalGate, j as HookApprovalRequest, k as HookGateUnsupportedError, M as MalformedGuardrailResultError, l as SkillsRequestContext, S as SkillsSelection, T as ToolWalkResult, m as ToolboxWalkResult, U as UnreadableTextPayloadError, n as compileTools, r as resolveEnabledSkills } from './agent-compiler-D7-Xd6Zh.js';
12
+ import { S as SettingSourcesSelection } from './setting-sources-gate-BJJiKq33.js';
13
+ export { C as CompatSurface, a as GatedCompatSource, G as GatedSettingSource, P as ProjectSettingsGrant, R as ResolvedCompatSource, b as SettingSourceCapability, U as UntrustedSettingSourceError, r as resolveCompatSources, c as resolveSettingSources } from './setting-sources-gate-BJJiKq33.js';
14
+ import { L as LoopStrategy, R as ReflectionStrategy, b as RoundStreamFactory, S as StreamEvent, c as DelegationResult } from './delegation-scoring-CH9Mr9NF.js';
15
+ 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, j as DEFAULT_MAX_ITERATIONS, k as DelegateFn, a as DelegateOptions, l as DelegationBudgetExceededError, m as DelegationError, n as DelegationPort, D as DelegationTarget, o as DoneEvent, E as ErrorEvent, F as FileEditEvent, I as IterationEvent, p as LoopFinishReason, q as LoopOutcome, r as LoopStrategyConfig, P as PartialToolCallEvent, s as ReflectionContext, t as ReflectionResult, u as ReflectionStrategyConfig, v as RunStartedEvent, w as ScoreVerdict, x as ScoredDelegation, y as Scorer, z as StateUpdateEvent, 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, Z as ladderReflectionStrategy, _ as loopStrategyConfigSchema, $ as noopReflectionStrategy, a0 as presentUIMessageStream, a1 as reflectionStrategyConfigSchema, a2 as resolveLoopStrategy, a3 as streamAgentResponse } from './delegation-scoring-CH9Mr9NF.js';
16
+ 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-y3fsG91f.js';
17
17
  import { RetryOptions } from '@theokit/sdk/retry';
18
18
  export * from '@theokit/sdk/retry';
19
19
  export { RetryOptions } from '@theokit/sdk/retry';
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ import {
31
31
  streamAgentResponse,
32
32
  streamAgentUIMessages,
33
33
  toolRuntimeName
34
- } from "./chunk-DFGIED4E.js";
34
+ } from "./chunk-G6GCS5XI.js";
35
35
  import {
36
36
  APPROVAL_MODES,
37
37
  AgentRunner,
@@ -91,7 +91,7 @@ import {
91
91
  withClockCap,
92
92
  withEphemeralAgent,
93
93
  withPreCompaction
94
- } from "./chunk-72QVLTDI.js";
94
+ } from "./chunk-KZPPH6LC.js";
95
95
  import "./chunk-MJ6FRILJ.js";
96
96
  import {
97
97
  AGENT_BRAND,
@@ -101,7 +101,7 @@ import {
101
101
  isAgentDefinition,
102
102
  resolveCompatSources,
103
103
  resolveSettingSources
104
- } from "./chunk-NKPNVQBF.js";
104
+ } from "./chunk-5WS66AW7.js";
105
105
  import "./chunk-M5J3Q6YC.js";
106
106
  import {
107
107
  ConfigurationError
@@ -62,10 +62,16 @@ interface SettingSourcesSelection {
62
62
  *
63
63
  * ## What this does NOT do today, stated here because the field is where it is read
64
64
  *
65
- * **Nothing reads the operator's root because of this flag.** `resolveSettingSources` forwards it
66
- * and `includesSetting` is called with exactly `"project"` and `"plugins"` — measured against
67
- * `@theokit/sdk@5.5.0`, not inferred: a grep of the published `dist` returns those two literals
68
- * and no `"user"`. So skills, subagents and rules under `~/.theokit/` do not reach a run.
65
+ * **This layer reads the operator's root because of this flag** (B-024). `resolveOperatorRoots`
66
+ * walks `~/.theokit/skills/` and `~/.theokit/agents/`, and the `~/.claude/` equivalents when the
67
+ * `claude-code` dialect is granted — the SAME grant that gates the project's `.claude/` surfaces,
68
+ * never a looser one. Every definition carries the root it came from, so an operator can tell one
69
+ * they wrote for this product from one they wrote for another.
70
+ *
71
+ * The SDK still does not consult `user`: `includesSetting` is called with exactly `"project"` and
72
+ * `"plugins"` — measured against the published `dist`, not inferred. That is why the read happens
73
+ * here. Until B-024 this field described a capability nothing delivered, which is the
74
+ * accepted-and-ignored failure `rules/foreign-config-surfaces.md` exists to remove.
69
75
  *
70
76
  * The admission already lived in `resolveSettingSources`' docblock, several hundred lines away,
71
77
  * while this line described the root as though the flag delivered it. Two docblocks disagreeing
@@ -268,10 +274,19 @@ declare const GATED: unique symbol;
268
274
  *
269
275
  * `includesSetting` is called with exactly `"project"` and `"plugins"`
270
276
  * (`theokit-sdk/packages/sdk/src/internal/local-agent/local-agent.ts:174-175`). `user`, `team` and
271
- * `mdm` are accepted by the option and never consulted, so forwarding them would be a name the
272
- * runtime discards. `user` is still resolved here because it costs nothing and the SDK may start
273
- * reading it; `team` and `mdm` are deliberately absent from {@link SettingSourcesSelection} rather
274
- * than plumbed through to be ignored.
277
+ * `mdm` are accepted by the option and not consulted BY THE SDK, so forwarding them would be a name
278
+ * its runtime discards. `team` and `mdm` are deliberately absent from {@link SettingSourcesSelection}
279
+ * rather than plumbed through to be ignored.
280
+ *
281
+ * **`user` is different now, and the difference is the whole of B-024.** This layer reads the
282
+ * operator's roots itself — `resolveOperatorRoots` in `config/operator-roots.ts` — so `user: true`
283
+ * reaches `~/.theokit/skills/` and `~/.theokit/agents/`, and reaches `~/.claude/` equivalents when
284
+ * the `claude-code` dialect is granted. It is no longer a flag that changes nothing: the SDK still
285
+ * does not consult it, and this layer does.
286
+ *
287
+ * The distinction matters for whoever reads this next. The sentence above was true and complete
288
+ * about the SDK while the FIELD's own docblock described a capability nobody delivered — two
289
+ * docblocks disagreeing about one option, with a consumer reading the reassuring one.
275
290
  */
276
291
  type GatedSettingSource = SettingSource & {
277
292
  readonly [GATED]: true;
package/dist/testing.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import { AgentOutputEvent } from '@theokit/presenter';
2
2
  export { AgentOutputEvent } from '@theokit/presenter';
3
3
  import { WireChunk } from '@theokit/presenter/wire';
4
- import { A as AgentDefinition } from './define-agent-D1zBG-Ys.js';
4
+ import { A as AgentDefinition } from './define-agent-y3fsG91f.js';
5
5
  import '@theokit/sdk';
6
6
  import 'zod';
7
- import './agent-compiler-B1F9iumK.js';
7
+ import './agent-compiler-D7-Xd6Zh.js';
8
8
  import '@theokit/sdk/subagents-loader';
9
9
  import '@theokit/sdk/errors';
10
10
  import './types-C16Wuh9E.js';
11
- import './setting-sources-gate-BoTngPIn.js';
11
+ import './setting-sources-gate-BJJiKq33.js';
12
12
  import './hook-handlers-Cw2FsnE5.js';
13
13
 
14
14
  /**
package/dist/testing.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  compileAgentDefinition
3
- } from "./chunk-NKPNVQBF.js";
3
+ } from "./chunk-5WS66AW7.js";
4
4
  import "./chunk-2SP5BB6U.js";
5
5
  import {
6
6
  __name
package/dist/tools.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  export { CatastrophicCommandError, CommandPolicy, ContextMatchError, ContextMatchReason, CreateApplyPatchToolOptions, CreateBraveWebSearchAdapterOptions, CreateCurrentTimeToolOptions, CreateEditFileToolOptions, CreateGenericHttpSearchAdapterOptions, CreateGitDiffToolOptions, CreateGitStatusToolOptions, CreateGlobToolOptions, CreateInteractiveShellToolOptions, CreateListDirToolOptions, CreateReadFileToolOptions, CreateRunVitestToolOptions, CreateSearchTextToolOptions, CreateShellToolOptions, CreateViewImageToolOptions, CreateWebFetchToolOptions, CreateWebSearchToolOptions, CreateWriteFileToolOptions, DEFAULT_MAX_IMAGE_BYTES, DEFAULT_TOOL_GUIDANCE, EnvContextOptions, PlanModeTool, PlanModeToolOptions, PlanModeToolWithStore, PlanNode, QuestionTool, QuestionToolOptions, ReadTracker, ReasoningTools, RedirectBlockedError, RepoMapOptions, ResolveAndScreenOptions, ScreenedFetchOptions, SessionArtifactStore, SessionArtifactStoreOptions, SsrfBlockedError, TodoItem, TodolistTool, ToolGuidanceMap, TruncationMode, TruncationOptions, TruncationResult, VitestSummary, WebSearchCallback, WebSearchResult, buildEnvContext, buildRepoMap, catastrophicShellReason, commandDenialReason, createApplyPatchTool, createBraveWebSearchAdapter, createCurrentTimeTool, createEditFileTool, createGenericHttpSearchAdapter, createGitDiffTool, createGitStatusTool, createGlobTool, createInteractiveShellTool, createListDirTool, createPlanModeTool, createQuestionTool, createReadFileTool, createRunVitestTool, createSearchTextTool, createSessionArtifactStore, createShellTool, createTodolistTool, createUpdatePlanTool, createViewImageTool, createWebFetchTool, createWebSearchTool, createWriteFileTool, createWriteStdinTool, denyCatastrophicCommands, formatCode, formatDiff, formatError, formatFileList, injectGuidance, isBlockedIp, isCommandAllowed, renderToolList, replaceUnique, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withName, withShellExitGuidance, withToolResultGuidance } from '@theokit/sdk-tools';
2
2
  import * as _theokit_sdk from '@theokit/sdk';
3
3
  import { TheokitAgentError } from '@theokit/sdk/errors';
4
- import { D as DelegationTarget, a as DelegateOptions } from './delegation-scoring-BTuTKWkZ.js';
4
+ import { D as DelegationTarget, a as DelegateOptions } from './delegation-scoring-CH9Mr9NF.js';
5
5
  import '@theokit/sdk/retry';
6
- import './agent-compiler-B1F9iumK.js';
6
+ import './agent-compiler-D7-Xd6Zh.js';
7
7
  import '@theokit/sdk/subagents-loader';
8
8
  import './types-C16Wuh9E.js';
9
9
  import 'zod';
10
- import './setting-sources-gate-BoTngPIn.js';
10
+ import './setting-sources-gate-BJJiKq33.js';
11
11
  import '@theokit/presenter/wire';
12
12
  import './hook-handlers-Cw2FsnE5.js';
13
13
 
package/dist/tools.js CHANGED
@@ -6,9 +6,9 @@ import {
6
6
  GuardrailViolationError,
7
7
  delegate,
8
8
  isPort
9
- } from "./chunk-72QVLTDI.js";
9
+ } from "./chunk-KZPPH6LC.js";
10
10
  import "./chunk-MJ6FRILJ.js";
11
- import "./chunk-NKPNVQBF.js";
11
+ import "./chunk-5WS66AW7.js";
12
12
  import "./chunk-M5J3Q6YC.js";
13
13
  import "./chunk-U72XTMYB.js";
14
14
  import "./chunk-2SP5BB6U.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theokit/agents",
3
- "version": "14.1.0",
3
+ "version": "14.3.0",
4
4
  "description": "AI agents as first-class citizens of the TheoKit pipeline. The AgentBuilder.create() authoring chain compiles to the @theokit/sdk runtime.",
5
5
  "repository": {
6
6
  "type": "git",