@theokit/agents 13.0.0-next.9 → 13.1.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +1821 -0
  2. package/README.md +31 -0
  3. package/dist/{agent-compiler-DZorqtK2.d.ts → agent-compiler-B_Z3OZel.d.ts} +196 -194
  4. package/dist/ask.d.ts +1 -0
  5. package/dist/auth.d.ts +175 -1
  6. package/dist/auth.js +94 -0
  7. package/dist/auth.js.map +1 -1
  8. package/dist/{bridge-entry-B0FqqPlt.d.ts → bridge-entry-vzdHNu_x.d.ts} +72 -6
  9. package/dist/bridge.d.ts +6 -4
  10. package/dist/bridge.js +9 -4
  11. package/dist/{chunk-TZCHACY7.js → chunk-AAW4I45J.js} +118 -18
  12. package/dist/chunk-AAW4I45J.js.map +1 -0
  13. package/dist/{chunk-6WFRR24F.js → chunk-HBHZV3KL.js} +566 -342
  14. package/dist/chunk-HBHZV3KL.js.map +1 -0
  15. package/dist/chunk-M5DRNOIU.js +109 -0
  16. package/dist/chunk-M5DRNOIU.js.map +1 -0
  17. package/dist/chunk-M5J3Q6YC.js +17 -0
  18. package/dist/chunk-M5J3Q6YC.js.map +1 -0
  19. package/dist/{chunk-RKWCXVYG.js → chunk-MJ6FRILJ.js} +67 -5
  20. package/dist/chunk-MJ6FRILJ.js.map +1 -0
  21. package/dist/{chunk-LPS65NGG.js → chunk-PMMOOXR6.js} +33 -10
  22. package/dist/chunk-PMMOOXR6.js.map +1 -0
  23. package/dist/chunk-U72XTMYB.js +7 -0
  24. package/dist/chunk-U72XTMYB.js.map +1 -0
  25. package/dist/client-react.d.ts +1 -0
  26. package/dist/client.d.ts +1 -0
  27. package/dist/config.d.ts +205 -36
  28. package/dist/config.js +221 -18
  29. package/dist/config.js.map +1 -1
  30. package/dist/{define-agent-D9b3h3VU.d.ts → define-agent-Cm7UGHx-.d.ts} +27 -3
  31. package/dist/{delegation-scoring-MbnqL68u.d.ts → delegation-scoring-195_ROT3.d.ts} +14 -2
  32. package/dist/hooks.d.ts +0 -32
  33. package/dist/hooks.js +42 -14
  34. package/dist/hooks.js.map +1 -1
  35. package/dist/index.d.ts +191 -16
  36. package/dist/index.js +43 -5
  37. package/dist/index.js.map +1 -1
  38. package/dist/sandbox.js.map +1 -1
  39. package/dist/setting-sources-gate-DFu51i50.d.ts +278 -0
  40. package/dist/testing.d.ts +5 -2
  41. package/dist/testing.js +1 -1
  42. package/dist/tools.d.ts +4 -2
  43. package/dist/tools.js +22 -4
  44. package/dist/tools.js.map +1 -1
  45. package/dist/usage.d.ts +30 -0
  46. package/dist/usage.js +3 -0
  47. package/dist/usage.js.map +1 -1
  48. package/package.json +3 -3
  49. package/dist/chunk-6WFRR24F.js.map +0 -1
  50. package/dist/chunk-LPS65NGG.js.map +0 -1
  51. package/dist/chunk-RKWCXVYG.js.map +0 -1
  52. package/dist/chunk-TZCHACY7.js.map +0 -1
@@ -0,0 +1,278 @@
1
+ import { TrustPosture, SettingSource } from '@theokit/sdk';
2
+ import { TheokitAgentError } from '@theokit/sdk/errors';
3
+
4
+ /**
5
+ * M68 — the trust gate for `settingSources`.
6
+ *
7
+ * ## The defect this module closes
8
+ *
9
+ * `settingSources` enables on-disk config discovery. `'user'` reads `~/.theokit/` — the operator's
10
+ * own machine, which no third party controls. `'project'` reads `<cwd>/.theokit/`, **including
11
+ * `hooks.json`, which executes shell**.
12
+ *
13
+ * The previous API took `readonly SettingSource[]`, and its JSDoc justified the risk this way:
14
+ * *"it is opt-in because `.theokit/` is the app's own repo (informed consent)"*. That premise holds
15
+ * for a web app whose `cwd` is its own deploy. It does **not** hold for the class of product this
16
+ * framework addresses — an agent whose `cwd` is a repository the user just cloned. There `.theokit/`
17
+ * is attacker-controlled content, and enabling `'project'` is remote code execution on the first
18
+ * `build()`.
19
+ *
20
+ * Documenting it did not prevent it. The measured consumer (TheoCode) did not trust the API: it
21
+ * gated from the outside, with a `posture.allows` of its own (`chat.ts:386`, comment B-008). It
22
+ * already **had** the right decision and could not pass it through, because the API only accepted
23
+ * strings. The gate existed on its side and evaporated at the boundary.
24
+ *
25
+ * ## The evidence is the SDK's, not one invented here
26
+ *
27
+ * `TrustPosture` is `@theokit/sdk`'s own trust primitive, and `recordWiring`'s doc says *"a posture
28
+ * is the only thing in this package that retains a capability"*. A bespoke type would make two trust
29
+ * grammars coexist and drift apart (ADR 0063).
30
+ */
31
+ /**
32
+ * The framework's capability vocabulary — deliberately a single name (ADR 0065).
33
+ *
34
+ * `allows` is all-or-nothing in the SDK: every declared `K` gets the same boolean. A finer
35
+ * vocabulary (`hooks`, `skills`, `subagents`, `mcp`) would promise the consumer it can gate one
36
+ * without gating the other, and the primitive does not deliver that. An API that suggests a
37
+ * distinction the runtime does not make teaches the wrong thing, and the error only surfaces when
38
+ * somebody depends on the distinction.
39
+ */
40
+ type SettingSourceCapability = 'projectSettings';
41
+ /** Authorization to read config from the working directory. Requires the posture, never a claim. */
42
+ interface ProjectSettingsGrant {
43
+ /**
44
+ * Typically the output of `resolveTrustPosture` — which is what gives it `source` (`'env' |
45
+ * 'store' | 'default'`) and therefore a refusal that says WHERE the decision came from instead of
46
+ * merely denying.
47
+ */
48
+ readonly trustedBy: TrustPosture<SettingSourceCapability>;
49
+ }
50
+ /**
51
+ * Which on-disk config roots the agent may read.
52
+ *
53
+ * The asymmetry is the design: `user` is a boolean because `~/.theokit/` belongs to the operator;
54
+ * `project` requires evidence because `<cwd>/.theokit/` may not. Omitting a root is not enabling it
55
+ * — never "enabling without a gate". The asymmetry is inherited from the SDK itself, whose
56
+ * `TrustPostureInput.envOverride` documents that `false` and `undefined` both mean "the operator did
57
+ * not turn it on", not "turned it off".
58
+ */
59
+ interface SettingSourcesSelection {
60
+ /** `~/.theokit/` — the operator's machine. No gate: no third party controls it. */
61
+ readonly user?: boolean;
62
+ /** `<cwd>/.theokit/` — controlled by whoever wrote the open repository. Requires evidence. */
63
+ readonly project?: ProjectSettingsGrant;
64
+ /**
65
+ * `<cwd>/.theokit/plugins` and any declared foreign dialect's plugin root — executable bundles.
66
+ *
67
+ * Same grant as `project`, deliberately: `PluginsManager.refresh` loads code out of the same
68
+ * cwd-controlled tree, and the tree usually arrived with the clone.
69
+ *
70
+ * Absent from this interface until 2026-09-10, while `includesSetting` reads it
71
+ * (`local-agent.ts:175`) — so a consumer wanting plugins had to bypass this facade, which is the
72
+ * door it exists to close. `team` and `mdm` remain absent for the opposite reason: the SDK never
73
+ * reads them.
74
+ */
75
+ readonly plugins?: ProjectSettingsGrant;
76
+ /**
77
+ * `<cwd>/.claude/` — a FOREIGN configuration dialect, read only once declared
78
+ * (`usetheokit/theokit-sdk#524`).
79
+ *
80
+ * ## Two questions, and which half of this field answers each
81
+ *
82
+ * The SDK's docblock separates them, and the separation is the whole point of `compatSources`:
83
+ * a trust gate answers *"do I trust the code in this directory?"*; importing another product's
84
+ * configuration answers *"do I want it imported into this one?"*. They come apart in the ordinary
85
+ * case, because `.claude/` is populated in exactly the repository one trusts most — for a
86
+ * different tool, by a teammate who never heard of this runtime.
87
+ *
88
+ * So the two are answered by two different things here, and it matters which:
89
+ *
90
+ * | Question | Answered by |
91
+ * |---|---|
92
+ * | do I want the foreign dialect imported? | **declaring this field at all** — omitting is not enabling |
93
+ * | do I trust this directory's code to run? | the `TrustPosture` inside the grant |
94
+ *
95
+ * ## Why the grant is `ProjectSettingsGrant` and not a vocabulary of its own
96
+ *
97
+ * Not because the two questions are the same — they are not. Because a separate grant could not
98
+ * carry the distinction even if it existed: `TrustPosture.allows` is `Record<K, boolean>` and the
99
+ * SDK documents every value as moving together with the level, so a `'foreignDialects'` capability
100
+ * beside `'projectSettings'` would promise an operator they can grant one and withhold the other,
101
+ * and `resolveTrustPosture` would hand back the same boolean for both. That is precisely the
102
+ * failure ADR 0065 exists to prevent, and inventing the second name would commit it while looking
103
+ * like rigour.
104
+ *
105
+ * The consent half is therefore carried by the declaration, which is a real and sufficient
106
+ * boundary: an operator who trusts a repository completely still reads no `.claude/` until they
107
+ * write this field. What the grant adds on top is stricter than the SDK — there, listing a dialect
108
+ * is enough — and the extra strictness is deliberate: this reads a `hooks.json` that executes
109
+ * shell out of a directory that usually arrived with the clone.
110
+ */
111
+ readonly claudeCode?: ProjectSettingsGrant & {
112
+ /**
113
+ * #686 — WHICH surfaces of the foreign root to import. Absent means all of them, which is what
114
+ * every caller before this meant and still means.
115
+ *
116
+ * The distinction is the reason the grant exists. `.claude/` usually arrives with the clone and
117
+ * its `hooks.json` executes shell, so "take the skills, refuse the hooks" is the ordinary thing
118
+ * to want — and before this the only choices were all of it or none of it.
119
+ *
120
+ * Requires `@theokit/sdk >= 5.4.0`, which is where the narrowed form landed. On an older SDK the
121
+ * runtime drops an unrecognised shape in SILENCE, so declaring it there would import nothing at
122
+ * all rather than importing less — refused at resolve time instead.
123
+ */
124
+ readonly import?: readonly CompatSurface[];
125
+ };
126
+ }
127
+ /**
128
+ * The surfaces a foreign configuration root can contribute.
129
+ *
130
+ * Written out rather than imported, for the same reason as the `claude-code` literal below:
131
+ * `CompatSurface` does not exist in `@theokit/sdk@4.52.1`, this package's declared floor, and a gate
132
+ * that cannot build against its own minimum dependency is worse than a constant that has been
133
+ * checked. Verified against the published 5.4.0 `.d.ts`, where the union is
134
+ * `"hooks" | "plugins" | "skills" | "subagents"` — note `subagents`, not `agents`.
135
+ *
136
+ * The two unions therefore DIVERGE by one name, on purpose: the SDK has four, and `commands` is
137
+ * this layer's, because `<projectDir>/.claude/commands/*.md` is read here and never by the SDK.
138
+ * A caller who builds SDK `local` options directly cannot pass a value of this type — `TS2345`,
139
+ * with a compiler message that names the mismatch and not the reason. Derive the SDK's list from
140
+ * this one minus `commands` rather than writing four names beside five; a hand-copied list goes
141
+ * stale the day a surface is added, which is the divergence #704 existed to remove.
142
+ */
143
+ type CompatSurface = 'commands' | 'hooks' | 'plugins' | 'skills' | 'subagents';
144
+ /** What `resolveCompatSources` returns: the whole root, or the root narrowed to some surfaces. */
145
+ type ResolvedCompatSource = 'claude-code' | {
146
+ readonly kind: 'claude-code';
147
+ readonly import: readonly CompatSurface[];
148
+ };
149
+ /**
150
+ * Refusal to read the working directory for lack of trust.
151
+ *
152
+ * Descends from `TheokitAgentError` because typed errors are an unbreakable rule here — and because
153
+ * `isTransientError` only sees this hierarchy. A class extending plain `Error` would be invisible to
154
+ * the predicate that separates recoverable from unrecoverable (the defect M67 fixed in five
155
+ * classes).
156
+ */
157
+ declare class UntrustedSettingSourceError extends TheokitAgentError {
158
+ /** Where the trust decision came from: `'env' | 'store' | 'default'`. */
159
+ readonly trustSource: string;
160
+ /** The refused capability. */
161
+ readonly capability: SettingSourceCapability;
162
+ readonly name = "UntrustedSettingSourceError";
163
+ constructor(message: string,
164
+ /** Where the trust decision came from: `'env' | 'store' | 'default'`. */
165
+ trustSource: string,
166
+ /** The refused capability. */
167
+ capability: SettingSourceCapability);
168
+ }
169
+ /**
170
+ * Translate the declared selection into the `SettingSource`s the SDK accepts, refusing what the
171
+ * posture does not authorize.
172
+ *
173
+ * Refuses rather than ignores (ADR 0064). Ignoring would leave the product running in the belief
174
+ * that the repository's hooks are active — a silent failure mode, on the wrong side. The SDK already
175
+ * picked that side for the same problem: `recordWiring` throws `UngatedCapabilityError` when
176
+ * somebody registers a capability the posture does not gate.
177
+ *
178
+ * @throws {UntrustedSettingSourceError} when `project` is requested and the posture does not grant it.
179
+ */
180
+ declare const GATED: unique symbol;
181
+ /**
182
+ * A root that some `TrustPosture` authorised — mintable ONLY by {@link resolveSettingSources}.
183
+ *
184
+ * ## Why a brand rather than a check
185
+ *
186
+ * `define-agent.ts` claimed `CompiledAgentOptions.settingSources` "can only ever hold roots that
187
+ * some posture authorized". Measured 2026-09-10 against the emitted `.d.ts`:
188
+ * `setOnce(draft, 'settingSources', ['mdm','team','user','plugins'], 'cap')` typechecked CAST-FREE.
189
+ * A consumer writing a `Capability` — the documented way to extend the builder — reached the field
190
+ * directly, and `project`, the root this gate exists to protect, is one of the two the SDK reads.
191
+ *
192
+ * The obvious fix was to read `draft.provenance` and refuse a write from a capability. It does not
193
+ * work, measured: the LEGITIMATE builder path also writes through `setOnce`
194
+ * (`capability/agent-capabilities.ts:155`), so provenance names a capability either way. What
195
+ * actually differs is where the VALUE came from, and a brand is a value's provenance carried in its
196
+ * type.
197
+ *
198
+ * ## What it does not do
199
+ *
200
+ * `as never` defeats it, like every brand — and so does ANY REFLECTIVE WRITE: `Object.assign`,
201
+ * `Reflect.set`, `Object.defineProperty`. All three typecheck cast-free, measured, including from
202
+ * inside a `Capability.apply`. That is a TypeScript-wide hole rather than a design choice here —
203
+ * those APIs type their value as `any` or return `T & U` without checking `T`'s existing fields.
204
+ *
205
+ * Stated as a CLASS and not a list, after two rounds of naming one instance and calling it "the one
206
+ * named exception". A list of escapes is a list somebody adds to; the property is that reflection
207
+ * bypasses the type system, and enumerating members of that class understates it every time.
208
+ *
209
+ * TEN other routes are refused, and they are refused by a TEST rather than by this sentence:
210
+ * `tests/type/setting-sources-brand-escapes.test-d.ts` guards each one with a `@ts-expect-error`,
211
+ * so weakening the brand reports which route reopened instead of passing quietly. `setOnce` with a
212
+ * raw array, `setOnce` through a generic wrapper, a direct `draft.settingSources =`, a spread of an
213
+ * array literal, an object literal with `as`, `.concat`, `.map`, spread-widening, `satisfies`,
214
+ * and `.push`.
215
+ *
216
+ * The count said "nine" while the list held ten — the same off-by-one this branch has now made
217
+ * three times in a docblock. Counting them in a file that fails when the count is wrong is the
218
+ * point of moving the claim into a test.
219
+ *
220
+ * So this refuses the accident — a capability author reaching for the field because it is there —
221
+ * with the named exceptions above, and not a caller who has decided to bypass the gate. Naming them
222
+ * exception is the point: the comment this replaced claimed an invariant nothing enforced, and a
223
+ * replacement that overstated its own coverage would be the same defect one size smaller.
224
+ *
225
+ * ## Which roots the SDK actually READS
226
+ *
227
+ * `includesSetting` is called with exactly `"project"` and `"plugins"`
228
+ * (`theokit-sdk/packages/sdk/src/internal/local-agent/local-agent.ts:174-175`). `user`, `team` and
229
+ * `mdm` are accepted by the option and never consulted, so forwarding them would be a name the
230
+ * runtime discards. `user` is still resolved here because it costs nothing and the SDK may start
231
+ * reading it; `team` and `mdm` are deliberately absent from {@link SettingSourcesSelection} rather
232
+ * than plumbed through to be ignored.
233
+ */
234
+ type GatedSettingSource = SettingSource & {
235
+ readonly [GATED]: true;
236
+ };
237
+ /**
238
+ * A compat source some `TrustPosture` authorised — mintable ONLY by {@link resolveCompatSources}.
239
+ *
240
+ * The twin of {@link GatedSettingSource}, and it exists because B-004 branded one of the two fields
241
+ * one `SettingSourcesSelection` feeds and left the other bare. Measured 2026-09-11, with the
242
+ * `settingSources` route as the control: the control errored, and
243
+ * `setOnce(draft, 'compatSources', ['claude-code'], 'cap')` compiled CAST-FREE — while
244
+ * `agent-compiler.ts` told the reader that field "can only hold a source some posture granted".
245
+ *
246
+ * It carries more authority than its twin, not less: `applyLocalSources` forwards it to
247
+ * `Agent.create({ local: { compatSources } })`, which reads `<cwd>/.claude/` — `hooks.json`
248
+ * included, and that executes shell. The refusal thrown below spells that out; the brand is what
249
+ * stops a caller reaching the field without meeting the refusal at all.
250
+ *
251
+ * Same `GATED` symbol as the twin, so there is one brand in this module rather than two that must
252
+ * be kept in step. The escapes are the same CLASS the twin documents — `as never` and any
253
+ * reflective write — and are not re-listed here.
254
+ */
255
+ type GatedCompatSource = ResolvedCompatSource & {
256
+ readonly [GATED]: true;
257
+ };
258
+ declare function resolveSettingSources(selection: SettingSourcesSelection | undefined): readonly GatedSettingSource[];
259
+ /**
260
+ * The foreign configuration dialects this layer forwards, once the posture authorises them.
261
+ *
262
+ * ## Why it is a separate function and the same vocabulary
263
+ *
264
+ * Separate because the SDK takes them on a separate option (`local.compatSources`); the same
265
+ * `ProjectSettingsGrant` because the thing being authorised is identical — reading a `hooks.json`
266
+ * that executes shell out of a directory the operator does not necessarily control.
267
+ *
268
+ * ## What it deliberately does NOT do
269
+ *
270
+ * Validate the source NAME. The SDK DROPS an unrecognised name rather than turning it into
271
+ * `<cwd>/<name>`, so a typo fails closed there; turning that into a throw here would convert a safe
272
+ * default into a crash. This gate decides authorisation, never vocabulary.
273
+ *
274
+ * @throws {UntrustedSettingSourceError} when a source is requested and the posture does not grant it.
275
+ */
276
+ declare function resolveCompatSources(selection: SettingSourcesSelection | undefined): readonly GatedCompatSource[];
277
+
278
+ export { type CompatSurface as C, type GatedSettingSource as G, type ProjectSettingsGrant as P, type ResolvedCompatSource as R, type SettingSourcesSelection as S, UntrustedSettingSourceError as U, type GatedCompatSource as a, type SettingSourceCapability as b, resolveSettingSources as c, resolveCompatSources as r };
package/dist/testing.d.ts CHANGED
@@ -1,11 +1,14 @@
1
1
  import { AgentOutputEvent } from '@theokit/presenter';
2
+ export { AgentOutputEvent } from '@theokit/presenter';
2
3
  import { WireChunk } from '@theokit/presenter/wire';
3
- import { A as AgentDefinition } from './define-agent-D9b3h3VU.js';
4
+ import { A as AgentDefinition } from './define-agent-Cm7UGHx-.js';
4
5
  import '@theokit/sdk';
5
6
  import 'zod';
6
- import './agent-compiler-DZorqtK2.js';
7
+ import './agent-compiler-B_Z3OZel.js';
8
+ import '@theokit/sdk/subagents-loader';
7
9
  import '@theokit/sdk/errors';
8
10
  import './types-C16Wuh9E.js';
11
+ import './setting-sources-gate-DFu51i50.js';
9
12
  import './hook-handlers-Cw2FsnE5.js';
10
13
 
11
14
  /**
package/dist/testing.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  compileAgentDefinition
3
- } from "./chunk-LPS65NGG.js";
3
+ } from "./chunk-PMMOOXR6.js";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-Z4QWC7IK.js";
package/dist/tools.d.ts CHANGED
@@ -1,11 +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-MbnqL68u.js';
4
+ import { D as DelegationTarget, a as DelegateOptions } from './delegation-scoring-195_ROT3.js';
5
5
  import '@theokit/sdk/retry';
6
- import './agent-compiler-DZorqtK2.js';
6
+ import './agent-compiler-B_Z3OZel.js';
7
+ import '@theokit/sdk/subagents-loader';
7
8
  import './types-C16Wuh9E.js';
8
9
  import 'zod';
10
+ import './setting-sources-gate-DFu51i50.js';
9
11
  import '@theokit/presenter/wire';
10
12
  import './hook-handlers-Cw2FsnE5.js';
11
13
 
package/dist/tools.js CHANGED
@@ -2,11 +2,15 @@ import {
2
2
  DelegationBudgetExceededError,
3
3
  DelegationError,
4
4
  DelegationTimeoutError,
5
+ GuardrailError,
6
+ GuardrailViolationError,
5
7
  delegate,
6
8
  isPort
7
- } from "./chunk-6WFRR24F.js";
8
- import "./chunk-RKWCXVYG.js";
9
- import "./chunk-LPS65NGG.js";
9
+ } from "./chunk-HBHZV3KL.js";
10
+ import "./chunk-MJ6FRILJ.js";
11
+ import "./chunk-PMMOOXR6.js";
12
+ import "./chunk-M5J3Q6YC.js";
13
+ import "./chunk-U72XTMYB.js";
10
14
  import "./chunk-OXNDJSAJ.js";
11
15
  import {
12
16
  __name
@@ -50,9 +54,23 @@ function errorCodeOf(error) {
50
54
  if (error instanceof DelegationBudgetExceededError) return "delegation_budget_exceeded";
51
55
  if (error instanceof DelegationTimeoutError) return "delegation_timeout";
52
56
  if (error instanceof DelegationError) return "delegation_failed";
57
+ if (error instanceof GuardrailViolationError) return "guardrail_violation";
58
+ if (error instanceof GuardrailError) return "guardrail_error";
53
59
  return void 0;
54
60
  }
55
61
  __name(errorCodeOf, "errorCodeOf");
62
+ var REFUSED_BY_POLICY = "the delegated task was refused by a policy guard";
63
+ var MESSAGE_MAY_CROSS = /* @__PURE__ */ new Set([
64
+ // A budget or a timeout is a fact about the WORK, and the number in it is what the model acts on.
65
+ "delegation_budget_exceeded",
66
+ "delegation_timeout",
67
+ "delegation_failed"
68
+ ]);
69
+ function messageForModel(code, error) {
70
+ if (!MESSAGE_MAY_CROSS.has(code)) return REFUSED_BY_POLICY;
71
+ return error instanceof Error ? error.message : String(error);
72
+ }
73
+ __name(messageForModel, "messageForModel");
56
74
  function describeRoster(roster) {
57
75
  return roster.map((entry) => entry.name).join(", ");
58
76
  }
@@ -93,7 +111,7 @@ function createDelegateTool(options) {
93
111
  return JSON.stringify({
94
112
  ok: false,
95
113
  error: code,
96
- message: error instanceof Error ? error.message : String(error)
114
+ message: messageForModel(code, error)
97
115
  });
98
116
  }
99
117
  }, "handler")
package/dist/tools.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/tools-entry.ts","../src/tools/delegate-tool.ts"],"mappings":"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","names":["buildEnvContext","buildRepoMap","CatastrophicCommandError","catastrophicShellReason","commandDenialReason","ContextMatchError","createApplyPatchTool","createBraveWebSearchAdapter","createCurrentTimeTool","createEditFileTool","createGenericHttpSearchAdapter","createGitDiffTool","createGitStatusTool","createGlobTool","createInteractiveShellTool","createListDirTool","createPlanModeTool","createQuestionTool","createReadFileTool","createRunVitestTool","createSearchTextTool","createSessionArtifactStore","createShellTool","createTodolistTool","createUpdatePlanTool","createViewImageTool","createWebFetchTool","createWebSearchTool","createWriteFileTool","createWriteStdinTool","DEFAULT_MAX_IMAGE_BYTES","DEFAULT_TOOL_GUIDANCE","denyCatastrophicCommands","formatCode","formatDiff","formatError","formatFileList","injectGuidance","isBlockedIp","isCommandAllowed","ReadTracker","ReasoningTools","RedirectBlockedError","renderToolList","replaceUnique","resolveAndScreen","screenedFetch","SsrfBlockedError","todoItemsToPlanNodes","truncateOutput","withDefaultGuidance","withDescription","withName","withShellExitGuidance","withToolResultGuidance","Tool","TheokitAgentError","z","DelegateToolConfigError","TheokitAgentError","name","message","code","assertUsableRoster","roster","defaults","length","seen","Set","has","JSON","stringify","add","needsCredential","some","entry","isPort","target","apiKey","errorCodeOf","error","DelegationBudgetExceededError","DelegationTimeoutError","DelegationError","undefined","describeRoster","map","join","createDelegateTool","options","description","byName","Map","names","inputSchema","z","object","agent","enum","describe","task","string","min","Tool","create","handler","raw","parse","get","result","run","delegate","ok","response","Error","String"]}
1
+ {"version":3,"sources":["../src/tools-entry.ts","../src/tools/delegate-tool.ts"],"mappings":"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","names":["buildEnvContext","buildRepoMap","CatastrophicCommandError","catastrophicShellReason","commandDenialReason","ContextMatchError","createApplyPatchTool","createBraveWebSearchAdapter","createCurrentTimeTool","createEditFileTool","createGenericHttpSearchAdapter","createGitDiffTool","createGitStatusTool","createGlobTool","createInteractiveShellTool","createListDirTool","createPlanModeTool","createQuestionTool","createReadFileTool","createRunVitestTool","createSearchTextTool","createSessionArtifactStore","createShellTool","createTodolistTool","createUpdatePlanTool","createViewImageTool","createWebFetchTool","createWebSearchTool","createWriteFileTool","createWriteStdinTool","DEFAULT_MAX_IMAGE_BYTES","DEFAULT_TOOL_GUIDANCE","denyCatastrophicCommands","formatCode","formatDiff","formatError","formatFileList","injectGuidance","isBlockedIp","isCommandAllowed","ReadTracker","ReasoningTools","RedirectBlockedError","renderToolList","replaceUnique","resolveAndScreen","screenedFetch","SsrfBlockedError","todoItemsToPlanNodes","truncateOutput","withDefaultGuidance","withDescription","withName","withShellExitGuidance","withToolResultGuidance","Tool","TheokitAgentError","z","DelegateToolConfigError","TheokitAgentError","name","message","code","assertUsableRoster","roster","defaults","length","seen","Set","has","JSON","stringify","add","needsCredential","some","entry","isPort","target","apiKey","errorCodeOf","error","DelegationBudgetExceededError","DelegationTimeoutError","DelegationError","GuardrailViolationError","GuardrailError","undefined","REFUSED_BY_POLICY","MESSAGE_MAY_CROSS","messageForModel","Error","String","describeRoster","map","join","createDelegateTool","options","description","byName","Map","names","inputSchema","z","object","agent","enum","describe","task","string","min","Tool","create","handler","raw","parse","get","result","run","delegate","ok","response"]}
package/dist/usage.d.ts CHANGED
@@ -27,9 +27,28 @@ interface UsageRecord {
27
27
  userId?: string;
28
28
  /** Model id (`claude-sonnet-4-5-20250929`). */
29
29
  model: string;
30
+ /**
31
+ * The token split this cost is for.
32
+ *
33
+ * `cacheRead` and `cacheWrite` are OPTIONAL and absent by default. Cached reads are billed at a
34
+ * fraction of input tokens, so two runs with identical `input` totals and different cache ratios
35
+ * cost different amounts — and a record that carried only the totals stated a number it could not
36
+ * explain. The audit trail showed the figure and not the reason.
37
+ *
38
+ * ABSENT, never `0`, when a provider does not report cache usage. "Not reported" and "reported as
39
+ * zero" are different facts, and defaulting would claim a measurement nobody made — the same
40
+ * strictness `RunUsageSnapshot` keeps by returning `undefined` before a provider has spoken.
41
+ *
42
+ * The spellings are this layer's own (`cacheRead`/`cacheWrite`), matching `DoneEvent.usage`'s
43
+ * `cacheReadTokens`/`cacheWriteTokens` rather than the wire's
44
+ * `cache_read_input_tokens`. A survey looking for the wire spellings measured zero here and
45
+ * concluded the concept was absent; it has been carried on the stream since V4-O.
46
+ */
30
47
  tokens: {
31
48
  input: number;
32
49
  output: number;
50
+ cacheRead?: number;
51
+ cacheWrite?: number;
33
52
  };
34
53
  /** USD in fractional dollars. */
35
54
  costUsd: number;
@@ -56,6 +75,17 @@ interface UsageQuery {
56
75
  from: Date;
57
76
  to: Date;
58
77
  };
78
+ /**
79
+ * Narrow to one model — what a per-model cost breakdown is.
80
+ *
81
+ * It is a QUERY rather than a second shape on {@link UsageResult}, because a breakdown returned
82
+ * alongside a total is two numbers that can disagree. One source, asked a different question,
83
+ * cannot.
84
+ *
85
+ * A TOOL record has no model and is already excluded from the LLM totals; narrowing by model
86
+ * cannot resurrect one.
87
+ */
88
+ model?: string;
59
89
  }
60
90
  interface UsageResult {
61
91
  totalTokens: number;
package/dist/usage.js CHANGED
@@ -48,6 +48,9 @@ var InMemoryUsageStorage = class {
48
48
  };
49
49
  function matches(record, query) {
50
50
  if (query.userId !== void 0 && record.userId !== query.userId) return false;
51
+ if (query.model !== void 0 && record.kind !== "tool" && record.model !== query.model) {
52
+ return false;
53
+ }
51
54
  if (query.period === void 0) return true;
52
55
  return record.timestamp >= query.period.from && record.timestamp <= query.period.to;
53
56
  }
package/dist/usage.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/usage/in-memory-usage.ts"],"mappings":";;;;;;;;AAmBO,IAAMA,uBAAN,MAAMA;EAXb,OAWaA;;;EACFC,OAAO;EACP,WAA8C,CAAA;EAEvDC,OAAOC,OAAqD;AAG1D,UAAMC,aACJ,UAAUD,SAASA,MAAME,SAAS,SAAS;MAAE,GAAGF;IAAM,IAAI;MAAE,GAAGA;MAAOE,MAAM;IAAe;AAC7F,SAAK,SAASC,KAAKF,UAAAA;AACnB,WAAOG,QAAQC,QAAO;EACxB;EAEAC,SAASC,QAAoB,CAAC,GAAyB;AACrD,UAAMC,WAAW,KAAK,SAASC,OAAO,CAACV,WAAWW,QAAQX,QAAQQ,KAAAA,CAAAA;AAClE,UAAMI,MAAMH,SAASC,OAAO,CAACV,WAAkCA,OAAOG,SAAS,MAAA;AAC/E,WAAOE,QAAQC,QAAQ;MACrBO,aAAaD,IAAIE,OAAO,CAACC,KAAKC,MAAMD,MAAMC,EAAEC,OAAOhB,QAAQe,EAAEC,OAAOC,QAAQ,CAAA;MAC5EC,cAAcP,IAAIE,OAAO,CAACC,KAAKC,MAAMD,MAAMC,EAAEI,SAAS,CAAA;MACtDC,MAAMT,IAAIU;IACZ,CAAA;EACF;;;;;;;;EASAC,cAAuC;AACrC,aAASC,IAAI,KAAK,SAASF,SAAS,GAAGE,KAAK,GAAGA,KAAK,GAAG;AACrD,YAAMxB,SAAS,KAAK,SAASwB,CAAAA;AAC7B,UAAIxB,OAAOG,SAAS,OAAQ,QAAOH;IACrC;AACA,WAAOyB;EACT;AACF;AAEA,SAASd,QAAQX,QAAuCQ,OAAiB;AAGvE,MAAIA,MAAMkB,WAAWD,UAAazB,OAAO0B,WAAWlB,MAAMkB,OAAQ,QAAO;AACzE,MAAIlB,MAAMmB,WAAWF,OAAW,QAAO;AACvC,SAAOzB,OAAO4B,aAAapB,MAAMmB,OAAOE,QAAQ7B,OAAO4B,aAAapB,MAAMmB,OAAOG;AACnF;AANSnB;","names":["InMemoryUsageStorage","name","record","input","normalised","kind","push","Promise","resolve","getUsage","query","matching","filter","matches","llm","totalTokens","reduce","sum","r","tokens","output","totalCostUsd","costUsd","runs","length","latestUsage","i","undefined","userId","period","timestamp","from","to"]}
1
+ {"version":3,"sources":["../src/usage/in-memory-usage.ts"],"mappings":";;;;;;;;AAmBO,IAAMA,uBAAN,MAAMA;EAXb,OAWaA;;;EACFC,OAAO;EACP,WAA8C,CAAA;EAEvDC,OAAOC,OAAqD;AAG1D,UAAMC,aACJ,UAAUD,SAASA,MAAME,SAAS,SAAS;MAAE,GAAGF;IAAM,IAAI;MAAE,GAAGA;MAAOE,MAAM;IAAe;AAC7F,SAAK,SAASC,KAAKF,UAAAA;AACnB,WAAOG,QAAQC,QAAO;EACxB;EAEAC,SAASC,QAAoB,CAAC,GAAyB;AACrD,UAAMC,WAAW,KAAK,SAASC,OAAO,CAACV,WAAWW,QAAQX,QAAQQ,KAAAA,CAAAA;AAClE,UAAMI,MAAMH,SAASC,OAAO,CAACV,WAAkCA,OAAOG,SAAS,MAAA;AAC/E,WAAOE,QAAQC,QAAQ;MACrBO,aAAaD,IAAIE,OAAO,CAACC,KAAKC,MAAMD,MAAMC,EAAEC,OAAOhB,QAAQe,EAAEC,OAAOC,QAAQ,CAAA;MAC5EC,cAAcP,IAAIE,OAAO,CAACC,KAAKC,MAAMD,MAAMC,EAAEI,SAAS,CAAA;MACtDC,MAAMT,IAAIU;IACZ,CAAA;EACF;;;;;;;;EASAC,cAAuC;AACrC,aAASC,IAAI,KAAK,SAASF,SAAS,GAAGE,KAAK,GAAGA,KAAK,GAAG;AACrD,YAAMxB,SAAS,KAAK,SAASwB,CAAAA;AAC7B,UAAIxB,OAAOG,SAAS,OAAQ,QAAOH;IACrC;AACA,WAAOyB;EACT;AACF;AAEA,SAASd,QAAQX,QAAuCQ,OAAiB;AAGvE,MAAIA,MAAMkB,WAAWD,UAAazB,OAAO0B,WAAWlB,MAAMkB,OAAQ,QAAO;AAMzE,MAAIlB,MAAMmB,UAAUF,UAAazB,OAAOG,SAAS,UAAUH,OAAO2B,UAAUnB,MAAMmB,OAAO;AACvF,WAAO;EACT;AACA,MAAInB,MAAMoB,WAAWH,OAAW,QAAO;AACvC,SAAOzB,OAAO6B,aAAarB,MAAMoB,OAAOE,QAAQ9B,OAAO6B,aAAarB,MAAMoB,OAAOG;AACnF;AAdSpB;","names":["InMemoryUsageStorage","name","record","input","normalised","kind","push","Promise","resolve","getUsage","query","matching","filter","matches","llm","totalTokens","reduce","sum","r","tokens","output","totalCostUsd","costUsd","runs","length","latestUsage","i","undefined","userId","model","period","timestamp","from","to"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theokit/agents",
3
- "version": "13.0.0-next.9",
3
+ "version": "13.1.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",
@@ -121,7 +121,7 @@
121
121
  "typescript": "^5.9.3",
122
122
  "vitest": "^4.1.9",
123
123
  "zod": "^4.4.3",
124
- "@theokit/http": "2.1.0-next.0"
124
+ "@theokit/http": "2.1.0"
125
125
  },
126
126
  "engines": {
127
127
  "node": ">=22.12.0"
@@ -129,7 +129,7 @@
129
129
  "dependencies": {
130
130
  "@theokit/sdk": "^4.52.1 || ^5.0.0",
131
131
  "@theokit/sdk-tools": "^0.27.1",
132
- "@theokit/presenter": "0.9.0-next.0"
132
+ "@theokit/presenter": "0.9.0"
133
133
  },
134
134
  "publishConfig": {
135
135
  "access": "public",