@theokit/agents 13.0.0-next.8 → 13.0.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 +1707 -0
- package/README.md +31 -0
- package/dist/{agent-compiler-C2jIZ4CZ.d.ts → agent-compiler-B0hb6HCo.d.ts} +182 -26
- package/dist/ask.d.ts +1 -0
- package/dist/auth.d.ts +148 -1
- package/dist/auth.js +36 -0
- package/dist/auth.js.map +1 -1
- package/dist/{bridge-entry-BJ86tO6e.d.ts → bridge-entry-DBkqwe6b.d.ts} +72 -6
- package/dist/bridge.d.ts +6 -4
- package/dist/bridge.js +9 -4
- package/dist/{chunk-3GQJ2BHT.js → chunk-G7QBDGZ4.js} +93 -18
- package/dist/chunk-G7QBDGZ4.js.map +1 -0
- package/dist/chunk-HGVT4VCE.js +97 -0
- package/dist/chunk-HGVT4VCE.js.map +1 -0
- package/dist/{chunk-NZTLBLHB.js → chunk-KTQID5V3.js} +560 -342
- package/dist/chunk-KTQID5V3.js.map +1 -0
- package/dist/chunk-M5J3Q6YC.js +17 -0
- package/dist/chunk-M5J3Q6YC.js.map +1 -0
- package/dist/{chunk-RKWCXVYG.js → chunk-MJ6FRILJ.js} +67 -5
- package/dist/chunk-MJ6FRILJ.js.map +1 -0
- package/dist/{chunk-X4IGZHOV.js → chunk-PMMOOXR6.js} +43 -8
- package/dist/chunk-PMMOOXR6.js.map +1 -0
- package/dist/chunk-U72XTMYB.js +7 -0
- package/dist/chunk-U72XTMYB.js.map +1 -0
- package/dist/client-react.d.ts +1 -0
- package/dist/client.d.ts +1 -0
- package/dist/config.d.ts +163 -36
- package/dist/config.js +119 -7
- package/dist/config.js.map +1 -1
- package/dist/{define-agent-WYnUlWaH.d.ts → define-agent-DhwNmdej.d.ts} +28 -153
- package/dist/{delegation-scoring-BrBQXvIp.d.ts → delegation-scoring-BzJEheml.d.ts} +1 -1
- package/dist/hooks.d.ts +0 -32
- package/dist/hooks.js +42 -14
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +191 -17
- package/dist/index.js +43 -5
- package/dist/index.js.map +1 -1
- package/dist/sandbox.js.map +1 -1
- package/dist/setting-sources-gate-DFu51i50.d.ts +278 -0
- package/dist/testing.d.ts +5 -2
- package/dist/testing.js +1 -1
- package/dist/tools.d.ts +4 -2
- package/dist/tools.js +22 -4
- package/dist/tools.js.map +1 -1
- package/dist/usage.d.ts +30 -0
- package/dist/usage.js +3 -0
- package/dist/usage.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-3GQJ2BHT.js.map +0 -1
- package/dist/chunk-NZTLBLHB.js.map +0 -1
- package/dist/chunk-RKWCXVYG.js.map +0 -1
- package/dist/chunk-X4IGZHOV.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-
|
|
4
|
+
import { A as AgentDefinition } from './define-agent-DhwNmdej.js';
|
|
4
5
|
import '@theokit/sdk';
|
|
5
6
|
import 'zod';
|
|
6
|
-
import './agent-compiler-
|
|
7
|
+
import './agent-compiler-B0hb6HCo.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
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-
|
|
4
|
+
import { D as DelegationTarget, a as DelegateOptions } from './delegation-scoring-BzJEheml.js';
|
|
5
5
|
import '@theokit/sdk/retry';
|
|
6
|
-
import './agent-compiler-
|
|
6
|
+
import './agent-compiler-B0hb6HCo.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-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-KTQID5V3.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:
|
|
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":"
|
|
1
|
+
{"version":3,"sources":["../src/tools-entry.ts","../src/tools/delegate-tool.ts"],"mappings":";;;;;;;;;;;;;;;;;;;AAuBA,SACEA,iBACAC,cACAC,0BACAC,yBACAC,qBACAC,mBACAC,sBACAC,6BACAC,uBACAC,oBACAC,gCACAC,mBACAC,qBACAC,gBACAC,4BACAC,mBACAC,oBACAC,oBACAC,oBACAC,qBACAC,sBACAC,4BACAC,iBACAC,oBACAC,sBACAC,qBACAC,oBACAC,qBACAC,qBACAC,sBACAC,yBACAC,uBACAC,0BACAC,YACAC,YACAC,aACAC,gBACAC,gBACAC,aACAC,kBACAC,aACAC,gBACAC,sBACAC,gBACAC,eACAC,kBACAC,eACAC,kBACAC,sBACAC,gBACAC,qBACAC,iBACAC,UACAC,uBACAC,8BACK;;;AC7DP,SAASC,YAAY;AACrB,SAASC,yBAAyB;AAClC,SAASC,SAAS;AAoBX,IAAMC,0BAAN,cAAsCC,kBAAAA;EAxC7C,OAwC6CA;;;;EACzBC,OAAO;EAEzB,YACEC,SACSC,MACT;AACA,UAAMD,OAAAA,GAAAA,KAFGC,OAAAA;EAGX;AACF;AAwBA,SAASC,mBACPC,QACAC,UAAqC;AAErC,MAAID,OAAOE,WAAW,GAAG;AACvB,UAAM,IAAIR,wBACR,6HACA,cAAA;EAEJ;AAEA,QAAMS,OAAO,oBAAIC,IAAAA;AACjB,aAAW,EAAER,KAAI,KAAMI,QAAQ;AAC7B,QAAIG,KAAKE,IAAIT,IAAAA,GAAO;AAGlB,YAAM,IAAIF,wBACR,6CAA6CY,KAAKC,UAAUX,IAAAA,CAAAA,qDAC5D,gBAAA;IAEJ;AACAO,SAAKK,IAAIZ,IAAAA;EACX;AAEA,QAAMa,kBAAkBT,OAAOU,KAAK,CAACC,UAAU,CAACC,OAAOD,MAAME,MAAM,CAAA;AAKnE,MAAIJ,mBAAmBR,UAAUa,WAA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;IACAqC,aACEA,eACA,oDAAoDL,eAAe5B,MAAAA,CAAAA;IAIrEqC;IACAW,SAAS,8BAAOC,QAAAA;AAMd,YAAM,EAAET,OAAOG,KAAI,IAAKN,YAAYa,MAAMD,GAAAA;AAE1C,YAAMpC,SAASqB,OAAOiB,IAAIX,KAAAA;AAC1B,UAAI,CAAC3B,QAAQ;AAQX,cAAM,IAAInB,wBACR,2BAA2BY,KAAKC,UAAUiC,KAAAA,CAAAA,4BAA6BZ,eAAe5B,MAAAA,CAAAA,KACtF,eAAA;MAEJ;AAEA,UAAI;AACF,cAAMoD,SAA2BxC,OAAOC,MAAAA,IACpC,MAAMA,OAAOwC,IAAIV,IAAAA,IACjB,MAAMW,SAASzC,QAAQ8B,MAAM1C,YAAY,CAAC,CAAA;AAE9C,eAAOK,KAAKC,UAAU;UAAEgD,IAAI;UAAMC,UAAUJ,OAAOI;QAAS,CAAA;MAC9D,SAASxC,OAAO;AACd,cAAMlB,OAAOiB,YAAYC,KAAAA;AACzB,YAAIlB,SAASwB,QAAW;AAGtB,gBAAMN;QACR;AAKA,eAAOV,KAAKC,UAAU;UAAEgD,IAAI;UAAOvC,OAAOlB;UAAMD,SAAS4B,gBAAgB3B,MAAMkB,KAAAA;QAAO,CAAA;MACxF;IACF,GA1CS;EA2CX,CAAA;AACF;AAzEgBe;","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,O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AAe;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
|
|
3
|
+
"version": "13.0.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
|
|
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
|
|
132
|
+
"@theokit/presenter": "0.9.0"
|
|
133
133
|
},
|
|
134
134
|
"publishConfig": {
|
|
135
135
|
"access": "public",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts","../src/bridge/compile-context-window.ts","../src/bridge/compile-skills.ts","../src/bridge/agent-compiler.ts","../src/bridge/agent-execution-context.ts","../src/bridge/present-ui-message-stream.ts","../src/bridge/hitl-call-correlation.ts","../src/bridge/agent-sse-handler.ts","../src/bridge/agent-stream-events.ts","../src/bridge/agent-route-generator.ts","../src/bridge/agent-builder.ts","../src/bridge/agent-endpoint.ts","../src/bridge/api-error-handler.ts","../src/bridge/mcp-resolver.ts","../src/bridge/mcp-file.ts","../src/manifest/agent-manifest.ts","../src/theokit-plugin.ts"],"mappings":";;;;;;;;;;;;;;AAiBA,SAASA,0BAA0B;;;ACiCnC,IAAMC,iBAAiB;EACrB;EACA;EACA;EACA;;AAUK,S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,QAAIpB,EAAEyD,MAAO,QAAOzD,EAAEyD,MAAMG,KAAKpC,QAAAA;AACjC,WAAOxB,EAAEqD,SAAS7B;EACpB,CAAA;AACF;AAVSD;","names":["ConfigurationError","STRATEGY_KNOBS","compileContextWindow","options","context","maxTokens","opts","metadataOnlyKnobs","filter","knob","undefined","compileSkills","options","autoDiscover","autoInject","enabled","include","SDK_TOOL_NAME","SDK_TOOL_NAME_MAX_LENGTH","SDK_TOOL_NAME_CHARSET","SDK_RESERVED_TOOL_NAMES","Set","SDK_RESERVED_TOOL_PREFIX","toolRuntimeName","namespace","toolName","trim","length","where","ConfigurationError","name","test","String","has","startsWith","join","compileHitlGates","toolboxes","gates","Map","tb","tool","tools","hitl","set","config","compileTools","toolboxInstances","instance","get","class","handler","propertyKey","push","description","inputSchema","input","call","createAgentExecutionContext","base","agent","run","toolCall","getRequest","getUrl","getClass","getMethodName","getAgent","getRun","getToolCall","isAgentContext","ctx","UIMessageStreamPresenter","WIRE_APPROVAL_DETAIL_PART","claim","queues","toolName","queue","get","undefined","claimed","shift","length","delete","enqueue","id","set","push","forget","at","indexOf","splice","HitlCallCorrelation","Map","announceToolCall","callId","announced","approvalToolCallId","approvalId","resultToolCallId","toAgentOutputEvent","e","type","text","content","callId","name","toolName","input","result","output","isError","doneToMetadata","event","usage","durationMs","cost","undefined","stopReason","model","ERROR_CODE_DATA_PART","INPUT_REQUESTED_DATA_PART","TASK_PROGRESS_DATA_PART","SHELL_OUTPUT_DATA_PART","dataPart","data","transient","UNMASKED_CODES","Set","MASK_ERROR","error","code","has","message","errorChunks","errorText","diagnosticDataPart","checkpointId","resumeToken","step","requestId","status","correlateToolIds","correlation","announceToolCall","resultToolCallId","presentUIMessageStream","events","opts","onError","presenter","UIMessageStreamPresenter","textId","HitlCallCorrelation","turnMetadata","correlated","present","closeBlock","toolCallId","approvalToolCallId","hasSeen","markSeen","dynamic","WIRE_APPROVAL_DETAIL_PART","approvalId","question","timeoutMs","diagnostic","err","codeOrUndefined","String","finish","encoder","TextEncoder","DONE_FRAME","streamAgentResponse","eventStream","opts","stream","ReadableStream","start","controller","closed","safeEnqueue","chunk","enqueue","chunks","presentUIMessageStream","textId","crypto","randomUUID","onError","undefined","data","JSON","stringify","encode","type","close","Response","status","headers","isTextDelta","e","type","isToolCall","isPartialToolCall","isToolResult","isDone","isError","isApprovalRequired","generateAgentRoutes","ctx","walkResult","createRun","getRun","basePath","route","replace","routes","push","method","path","handler","request","body","json","message","length","Response","JSON","stringify","error","code","status","headers","rawSessionId","sessionId","Date","now","streamAgentResponse","url","URL","runId","pathname","split","pop","run","ContextualTool","of","tool","_requiredContext","makeBuilder","config","runtime","input","schema","model","id","system","prompt","reasoningEffort","effort","maxIterations","limit","context","value","tools","list","when","condition","apply","builder","guardrail","g","guardrails","gs","approval","toolName","options","approvals","map","skills","selection","settingSources","hookApproval","gate","memory","settings","hooks","plugins","mcp","servers","mcpServers","use","preset","build","defineAgent","AgentBuilder","create","TheokitAgentError","AgentDefinitionError","TheokitAgentError","name","source","code","isRetryable","extractDefaultExport","mod","default","isCompiledAgentOptions","value","v","Array","isArray","tools","agents","compileAgentModule","def","isAgentDefinition","compileAgentDefinition","compileLoadedAgentModule","asAgentStream","events","e","EventQueue","push","item","r","shift","done","close","splice","undefined","drain","length","next","Promise","resolve","appendCheckpointSaved","sessionId","emitted","checkpoint","type","checkpointId","crypto","randomUUID","step","resumeToken","ev","streamAgentUIMessages","compiled","apiKey","input","textId","overrides","cwd","baseDir","images","onRunEvent","retry","signal","exposeUsageToTools","hitl","gated","size","createSdkAgentStream","message","queue","addEventListener","once","plugin","createHitlPlugin","emit","awaitApproval","sdkStream","plugins","err","Error","String","retryable","durableCheckpoint","storage","presentUIMessageStream","onError","DEFAULT_MAX_ATTEMPTS","runWithApiErrorHandling","thunk","policy","maxAttempts","attempt","error","decision","processApiError","retry","fallback","undefined","createApiErrorHandler","resolveMcpServers","selection","ctx","undefined","resolved","Error","mcpRegistry","config","registry","apps","composio","command","args","length","join","env","COMPOSIO_API_KEY","apiKey","profile","MCP_RUN_API_KEY","JSON","stringify","mcpToolApprovals","specs","out","tool","spec","Object","entries","question","existsSync","readFileSync","join","TheokitAgentError","warningChannel","opts","onWarn","warning","process","stderr","write","McpFileError","TheokitAgentError","name","message","MCP_FILENAME","loadMcpJson","cwd","path","join","existsSync","text","readFileSync","err","describeIt","parsed","JSON","parse","parseMcpJson","raw","source","Array","isArray","serversRaw","mcpServers","undefined","out","entryRaw","Object","entries","reason","validateEntry","buildEntry","entry","hasUrl","url","hasCommand","command","validateRemote","validateStdio","length","args","isStringArray","env","isStringRecord","URL","type","headers","requestTimeoutMs","remote","auth","stdio","Error","String","v","every","x","values","generateAgentManifest","sources","version","generatedAt","Date","toISOString","agents","map","r","name","agentConfig","route","model","stream","mainLoop","method","String","propertyKey","strategy","guards","g","interceptors","i","tools","toolboxes","flatMap","tb","t","namespace","config","description","risk","approval","undefined","capabilities","trace","audit","gateway","platforms","sessionStrategy","subAgents","subAgentClasses","cls","memory","provider","embeddings","fts","scope","skills","include","mcpServers","Object","keys","validateUniqueRoutes","results","seen","Map","r","existing","get","route","undefined","Error","agentConfig","name","set","agentsPlugin","opts","routes","register","app","addHook","pluginCtx","initRoutes","request","url","URL","method","toUpperCase","matched","matchRoute","pathname","handler","allRoutes","routeIdentities","entry","agents","push","createRun","createRunFactory","compiled","defaultCreateRun","generateAgentRoutes","walkResult","compiledOptions","compileRoutePatterns","_message","_sessionId","Promise","resolve","type","runId","Date","now","agentName","model","code","message","retryable","map","path","includes","regexSource","replace","regex","RegExp","find","test"]}
|