@theokit/agents 13.0.0-next.9 → 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.
Files changed (52) hide show
  1. package/CHANGELOG.md +1682 -0
  2. package/README.md +31 -0
  3. package/dist/{agent-compiler-DZorqtK2.d.ts → agent-compiler-B0hb6HCo.d.ts} +177 -198
  4. package/dist/ask.d.ts +1 -0
  5. package/dist/auth.d.ts +148 -1
  6. package/dist/auth.js +36 -0
  7. package/dist/auth.js.map +1 -1
  8. package/dist/{bridge-entry-B0FqqPlt.d.ts → bridge-entry-DBkqwe6b.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-G7QBDGZ4.js} +93 -18
  12. package/dist/chunk-G7QBDGZ4.js.map +1 -0
  13. package/dist/chunk-HGVT4VCE.js +97 -0
  14. package/dist/chunk-HGVT4VCE.js.map +1 -0
  15. package/dist/{chunk-6WFRR24F.js → chunk-KTQID5V3.js} +560 -342
  16. package/dist/chunk-KTQID5V3.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 +163 -36
  28. package/dist/config.js +119 -7
  29. package/dist/config.js.map +1 -1
  30. package/dist/{define-agent-D9b3h3VU.d.ts → define-agent-DhwNmdej.d.ts} +27 -3
  31. package/dist/{delegation-scoring-MbnqL68u.d.ts → delegation-scoring-BzJEheml.d.ts} +1 -1
  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
@@ -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 { C as CompiledAgentOptions, b as CompiledTool } from './agent-compiler-DZorqtK2.js';
3
+ import { a as CompiledAgentOptions, b as CompiledTool } from './agent-compiler-B0hb6HCo.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/hooks.d.ts CHANGED
@@ -264,38 +264,6 @@ interface HookRunResult {
264
264
  */
265
265
  declare function runHookCommand(input: HookRunInput): Promise<HookRunResult>;
266
266
 
267
- /**
268
- * Hook inheritance for a delegated member — the authority a sub-agent runs under.
269
- *
270
- * ## Why this exists
271
- *
272
- * `delegate()` already merges the parent's TOOLS and clamps the parent's BUDGET into the member's
273
- * run. It did not carry the parent's HOOKS, so a member could call a tool the parent's
274
- * `pre_tool_call` gate had refused. The failure is silent and green: nothing throws, nothing warns,
275
- * and the member's own suite passes because the member never declared the gate.
276
- *
277
- * The only real consumer of this layer found it and closed it with sixteen lines of its own. Sixteen
278
- * lines standing between a squad and the parent's veto is not a consumer's job — it is authority
279
- * inheritance, and a consumer who does not know the rule exists has the hole and no way to see it.
280
- *
281
- * ## The composition rule: inheritance may only TIGHTEN
282
- *
283
- * A Chain of Responsibility over the two handler maps, with one asymmetry that carries the whole
284
- * security property: for `pre_tool_call`, BOTH gates run and the FIRST refusal wins. A member cannot
285
- * widen what the parent refused — if it could, the parent's gate would be decorative.
286
- *
287
- * A free function rather than a class: there is no state to hold and no second implementation to
288
- * swap. Wrapping a pure fold in a class would be the ceremony parsimony refuses (`parsimony-ladder`
289
- * rung 5), and this module's whole surface is one composition.
290
- *
291
- * ## Failure posture
292
- *
293
- * A gate that throws REFUSES. An inherited gate that opens on its own error is worse than no gate,
294
- * because it reads as protection — `error-handling.md § 2` forbids that swallow. Observers
295
- * (`post_tool_call`, session lifecycle) are fire-and-forget by contract, so a broken notifier is
296
- * isolated and never becomes the reason a turn failed.
297
- */
298
-
299
267
  /** The code-plugin envelope the SDK dispatches hooks through. */
300
268
  interface CodePlugin {
301
269
  readonly name: string;
package/dist/hooks.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  hooksPlugin,
7
7
  inheritHooks
8
- } from "./chunk-RKWCXVYG.js";
8
+ } from "./chunk-MJ6FRILJ.js";
9
9
  import {
10
10
  __name
11
11
  } from "./chunk-Z4QWC7IK.js";
@@ -113,6 +113,28 @@ function killGroup(pid) {
113
113
  }
114
114
  __name(killGroup, "killGroup");
115
115
 
116
+ // src/hooks/unwired-events.ts
117
+ var UNWIRED_EVENT_REASONS = Object.freeze({
118
+ transform_llm_output: Object.freeze({
119
+ seam: "Guardrail.checkOutput",
120
+ reason: "returning action 'redact' replaces the model's text and continues"
121
+ }),
122
+ pre_user_send: Object.freeze({
123
+ seam: "createToolHooksPlugin({ processInput })",
124
+ reason: "contributes text before the model, additively"
125
+ }),
126
+ on_session_end: Object.freeze({
127
+ seam: null,
128
+ reason: "no seam delivers this: the handler returns void and cannot refuse an ending"
129
+ })
130
+ });
131
+ function unwiredEventAdvice(event, reasons = UNWIRED_EVENT_REASONS) {
132
+ const entry = reasons[event];
133
+ if (entry === void 0) return "the handler does not exist yet.";
134
+ return entry.seam === null ? `${entry.reason}.` : `use ${entry.seam} instead: ${entry.reason}.`;
135
+ }
136
+ __name(unwiredEventAdvice, "unwiredEventAdvice");
137
+
116
138
  // src/hooks/hook-spec.ts
117
139
  var HOOK_EVENTS = [
118
140
  "pre_tool_call",
@@ -157,13 +179,14 @@ function parseHookSpecs(input) {
157
179
  }
158
180
  __name(parseHookSpecs, "parseHookSpecs");
159
181
  var IGNORE_WARNING = /* @__PURE__ */ __name(() => void 0, "IGNORE_WARNING");
160
- var WIRED_EVENTS = /* @__PURE__ */ new Set([
182
+ var WIRED_EVENT_LIST = [
161
183
  "pre_tool_call",
162
184
  "post_tool_call",
163
185
  "transform_tool_result",
164
186
  "on_session_start",
165
187
  "post_assistant_reply"
166
- ]);
188
+ ];
189
+ var WIRED_EVENTS = new Set(WIRED_EVENT_LIST);
167
190
  function buildHookHandlers(specs, options) {
168
191
  const warn = options.onWarn ?? IGNORE_WARNING;
169
192
  if (!options.trusted) {
@@ -183,9 +206,7 @@ function buildHookHandlers(specs, options) {
183
206
  if (runnable.length === 0) return {};
184
207
  for (const spec of runnable) {
185
208
  if (!WIRED_EVENTS.has(spec.event)) {
186
- warn(`hook declared on "${spec.event}" will NOT fire: this engine wires ${[
187
- ...WIRED_EVENTS
188
- ].join(" and ")} only. The event is accepted by the schema and the approval is real \u2014 the handler does not exist yet.`);
209
+ warn(`hook declared on "${spec.event}" will NOT fire \u2014 ${unwiredEventAdvice(spec.event)}`);
189
210
  }
190
211
  }
191
212
  const handlers = {};
@@ -272,13 +293,7 @@ function buildHookHandlers(specs, options) {
272
293
  if (transformHooks.length > 0) {
273
294
  handlers.transform_tool_result = buildTransformHandler(transformHooks, options, warn, chainBudgetMs);
274
295
  }
275
- for (const event of OBSERVATIONAL_EVENTS) {
276
- const list = runnable.filter((spec) => spec.event === event);
277
- if (list.length === 0) continue;
278
- const fire = buildObservationalHandler(event, list, options, warn, chainBudgetMs);
279
- if (event === "on_session_start") handlers.on_session_start = fire;
280
- else handlers.post_assistant_reply = fire;
281
- }
296
+ assignObservationalHandlers(handlers, OBSERVATIONAL_EVENTS, (event, list) => buildObservationalHandler(event, list, options, warn, chainBudgetMs), runnable);
282
297
  return handlers;
283
298
  }
284
299
  __name(buildHookHandlers, "buildHookHandlers");
@@ -295,8 +310,13 @@ function identityOf(spec) {
295
310
  __name(identityOf, "identityOf");
296
311
  function matches(spec, toolName) {
297
312
  if (spec.matcher === void 0) return true;
313
+ const trimmed = spec.matcher.trim();
314
+ if (trimmed === "" || trimmed === "*") return true;
315
+ if (trimmed.includes(",")) {
316
+ return trimmed.split(",").map((name) => name.trim()).filter((name) => name !== "").includes(toolName);
317
+ }
298
318
  try {
299
- return new RegExp(spec.matcher).test(toolName);
319
+ return new RegExp(trimmed).test(toolName);
300
320
  } catch {
301
321
  return false;
302
322
  }
@@ -366,6 +386,14 @@ ${fenceHookOutput(feedback)}`;
366
386
  };
367
387
  }
368
388
  __name(buildTransformHandler, "buildTransformHandler");
389
+ function assignObservationalHandlers(handlers, events, make, specs = []) {
390
+ for (const event of events) {
391
+ const list = specs.filter((spec) => spec.event === event);
392
+ if (list.length === 0) continue;
393
+ handlers[event] = make(event, list);
394
+ }
395
+ }
396
+ __name(assignObservationalHandlers, "assignObservationalHandlers");
369
397
  function buildObservationalHandler(event, list, options, warn, chainBudgetMs) {
370
398
  return async () => {
371
399
  const started = Date.now();
package/dist/hooks.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/hooks/hook-spec.ts","../src/hooks/hook-fingerprint.ts","../src/hooks/hook-runner.ts","../src/hooks/approval-store.ts"],"mappings":";;;;;;;;;;;;;AA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I,MAAMC,QAAQJ,MAAAA,EAAS,OAAM,IAAIK,MAAM,uCAAA;AAC5C,aAAOL;IACT,GACA,CAAA,CAAE;AAEJ,SAAKlC,gBAAgB+B;AAErB,SAAK,WAAW,IAAIS,IAAIV,MAAMnB,IAAI,CAACD,MAAM;MAAC,GAAGA,EAAEL,KAAK,KAASK,EAAEE,WAAW;MAAIF;KAAE,CAAA;AAChF,WAAO,KAAK;EACd;EAEA,SAASY,SAAoC;AAC3CmB,oBAAgB,KAAK1C,MAAM,MAAM,GAAGoC,KAAKO,UAAU;SAAIpB,QAAQd,OAAM;OAAK,MAAM,CAAA,CAAA;CAAM;EACxF;AACF;","names":["randomBytes","TheokitAgentError","z","createHash","FIELD_SEPARATOR","hookFingerprint","identity","canonical","command","event","matcher","String","timeoutMs","join","createHash","update","digest","spawn","MAX_OUTPUT_BYTES","DRAIN_BUDGET_MS","CHAIN_BUDGET_MULTIPLIER","runHookCommand","input","Promise","resolve","child","spawn","command","cwd","shell","detached","env","stdio","stdout","stderr","truncated","timedOut","settled","capture","current","chunk","length","next","toString","slice","on","settle","exitCode","clearTimeout","timer","drainTimer","setTimeout","killGroup","pid","timeoutMs","undefined","code","stdin","end","process","kill","HOOK_EVENTS","DEFAULT_HOOK_TIMEOUT_MS","DEFAULT_CONTINUATION_BUDGET","hookSpecSchema","z","object","event","enum","command","string","min","refine","value","test","message","matcher","optional","timeout_ms","number","int","positive","default","strict","HookSpecError","TheokitAgentError","name","code","isRetryable","parseHookSpecs","input","parsed","array","safeParse","success","error","issues","map","issue","path","join","data","IGNORE_WARNING","undefined","WIRED_EVENTS","Set","buildHookHandlers","specs","options","warn","onWarn","trusted","length","String","fingerprintOf","fingerprint","hookFingerprint","runnable","filter","spec","approved","has","identityOf","handlers","chainBudgetMs","Math","max","CHAIN_BUDGET_MULTIPLIER","preHooks","pre_tool_call","ctx","started","Date","now","onVeto","tool","reason","block","matches","result","runHookCommand","cwd","timeoutMs","stdin","JSON","stringify","args","env","exitCode","fenceHookOutput","stdout","stderr","postHooks","post_tool_call","truncated","transformHooks","transform_tool_result","buildTransformHandler","OBSERVATIONAL_EVENTS","list","fire","buildObservationalHandler","on_session_start","post_assistant_reply","toolName","RegExp","output","nonce","randomBytes","toString","open","close","escaped","replaceAll","remaining","continuationBudget","results","out","targets","toolCalls","call","feedback","trim","realpathSync","join","resolve","slotOf","identity","event","matcher","canonicalScope","dir","realpathSync","resolve","HookApprovalStore","path","lastReadError","options","join","home","approvedFingerprints","scope","key","Set","values","filter","r","map","fingerprint","approvals","stateOf","inScope","some","hookFingerprint","slot","record","command","approve","records","set","undefined","approvedAt","Date","toISOString","revoke","delete","value","error","readSecureJson","raw","parsed","JSON","parse","Array","isArray","Error","Map","writeSecureJson","stringify"]}
1
+ {"version":3,"sources":["../src/hooks/hook-spec.ts","../src/hooks/hook-fingerprint.ts","../src/hooks/hook-runner.ts","../src/hooks/unwired-events.ts","../src/hooks/approval-store.ts"],"mappings":";;;;;;;;;;;;;AAAA,SAASA,mBAAmB;AAG5B,SAASC,yBAAyB;AAClC,SAASC,SAAS;;;ACJlB,SAASC,kBAAkB;AAsC3B,IAAMC,kBAAkB;AASjB,SAASC,gBAAgBC,UAAsB;AACpD,QAAMC,YAAY;IAChBD,SAASE;IACTF,SAASG;IACTH,SAASI,WAAW;IACpBC,OAAOL,SAASM,SAAS;IACzBC,KAAKT,eAAAA;AACP,SAAOU,WAAW,QAAA,EAAUC,OAAOR,WAAW,MAAA,EAAQS,OAAO,KAAA;AAC/D;AARgBX;;;AC/ChB,SAASY,aAAa;AA+Bf,IAAMC,mBAAmB;AAQzB,IAAMC,kBAAkB;AAGxB,IAAMC,0BAA0B;AAgCvC,eAAsBC,eAAeC,OAAmB;AACtD,SAAO,IAAIC,QAAuB,CAACC,aAAAA;AAcjC,UAAMC,QAAQC,MAAMJ,MAAMK,SAAS;MACjCC,KAAKN,MAAMM;MACXC,OAAO;;MAEPC,UAAU;MACVC,KAAKT,MAAMS;MACXC,OAAO;QAAC;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B;EACF;;;;;;;EAQA,QAAK;AACH,UAAM,EAAEQ,OAAOC,MAAK,IAAKC,eACvB,KAAKjC,MACL,CAACkC,QAAAA;AACC,YAAMC,SAAkBC,KAAKC,MAAMH,GAAAA;AACnC,UAAI,CAACI,MAAMC,QAAQJ,MAAAA,EAAS,OAAM,IAAIK,MAAM,uCAAA;AAC5C,aAAOL;IACT,GACA,CAAA,CAAE;AAEJ,SAAKlC,gBAAgB+B;AAErB,SAAK,WAAW,IAAIS,IAAIV,MAAMnB,IAAI,CAACD,MAAM;MAAC,GAAGA,EAAEL,KAAK,KAASK,EAAEE,WAAW;MAAIF;KAAE,CAAA;AAChF,WAAO,KAAK;EACd;EAEA,SAASY,SAAoC;AAC3CmB,oBAAgB,KAAK1C,MAAM,MAAM,GAAGoC,KAAKO,UAAU;SAAIpB,QAAQd,OAAM;OAAK,MAAM,CAAA,CAAA;CAAM;EACxF;AACF;","names":["randomBytes","TheokitAgentError","z","createHash","FIELD_SEPARATOR","hookFingerprint","identity","canonical","command","event","matcher","String","timeoutMs","join","createHash","update","digest","spawn","MAX_OUTPUT_BYTES","DRAIN_BUDGET_MS","CHAIN_BUDGET_MULTIPLIER","runHookCommand","input","Promise","resolve","child","spawn","command","cwd","shell","detached","env","stdio","stdout","stderr","truncated","timedOut","settled","capture","current","chunk","length","next","toString","slice","on","settle","exitCode","clearTimeout","timer","drainTimer","setTimeout","killGroup","pid","timeoutMs","undefined","code","stdin","end","process","kill","UNWIRED_EVENT_REASONS","Object","freeze","transform_llm_output","seam","reason","pre_user_send","on_session_end","unwiredEventAdvice","event","reasons","entry","undefined","HOOK_EVENTS","DEFAULT_HOOK_TIMEOUT_MS","DEFAULT_CONTINUATION_BUDGET","hookSpecSchema","z","object","event","enum","command","string","min","refine","value","test","message","matcher","optional","timeout_ms","number","int","positive","default","strict","HookSpecError","TheokitAgentError","name","code","isRetryable","parseHookSpecs","input","parsed","array","safeParse","success","error","issues","map","issue","path","join","data","IGNORE_WARNING","undefined","WIRED_EVENT_LIST","WIRED_EVENTS","Set","buildHookHandlers","specs","options","warn","onWarn","trusted","length","String","fingerprintOf","fingerprint","hookFingerprint","runnable","filter","spec","approved","has","identityOf","unwiredEventAdvice","handlers","chainBudgetMs","Math","max","CHAIN_BUDGET_MULTIPLIER","preHooks","pre_tool_call","ctx","started","Date","now","onVeto","tool","reason","block","matches","result","runHookCommand","cwd","timeoutMs","stdin","JSON","stringify","args","env","exitCode","fenceHookOutput","stdout","stderr","postHooks","post_tool_call","truncated","transformHooks","transform_tool_result","buildTransformHandler","assignObservationalHandlers","OBSERVATIONAL_EVENTS","list","buildObservationalHandler","toolName","trimmed","trim","includes","split","RegExp","fenceHookOutput","output","nonce","randomBytes","toString","open","close","escaped","replaceAll","OBSERVATIONAL_EVENTS","buildTransformHandler","transformHooks","options","warn","chainBudgetMs","remaining","continuationBudget","DEFAULT_CONTINUATION_BUDGET","results","ctx","out","started","Date","now","spec","targets","matcher","undefined","toolCalls","length","filter","call","matches","name","result","runHookCommand","command","cwd","timeoutMs","timeout_ms","stdin","JSON","stringify","tool","args","env","exitCode","feedback","stdout","trim","String","assignObservationalHandlers","handlers","events","make","specs","event","list","buildObservationalHandler","realpathSync","join","resolve","slotOf","identity","event","matcher","canonicalScope","dir","realpathSync","resolve","HookApprovalStore","path","lastReadError","options","join","home","approvedFingerprints","scope","key","Set","values","filter","r","map","fingerprint","approvals","stateOf","inScope","some","hookFingerprint","slot","record","command","approve","records","set","undefined","approvedAt","Date","toISOString","revoke","delete","value","error","readSecureJson","raw","parsed","JSON","parse","Array","isArray","Error","Map","writeSecureJson","stringify"]}
package/dist/index.d.ts CHANGED
@@ -1,19 +1,22 @@
1
1
  import { PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition, BudgetTracker, CustomTool, GoalLoopAgent, GoalOptions, runGoalLoop, GoalEvent, GoalResult, InlineSkill, Agent as Agent$1, ListAgentsOptions, ListResult, SDKAgentInfo } from '@theokit/sdk';
2
- export { CustomTool, DiagnosticsSink, GenerateObjectError, GoalEvent, GoalLoopAgent, GoalOptions, GoalResult, JudgeCredentialError, JudgeResult, LayerOrderError, McpAuthConfig, McpHttpServerConfig, McpOAuthConfig, McpServerConfig, McpStdioServerConfig, Provider, RunEvent, SDKAgent, SessionRecord, Squad, StreamObjectError, Tool, ToolError, ToolResultContentBlock, TrustLevel, TrustPosture, TrustPostureInput, TrustSource, UngatedCapabilityError, Verdict, WiredEntity, applySecurityFloor, auditEnvReachability, foldLayers, recordWiring, resolveTrustPosture, setDiagnosticsSink, verifyLayerOrdering } from '@theokit/sdk';
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-B0FqqPlt.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, G as SdkAgentHandle, I as SdkMessage, J as SdkSendOptions, K as SdkTurnHandle, N as Segment, O as ShouldAutoApproveOptions, T as ToolCallVeto, Q as ToolHooks, R as ToolHooksPlugin, W as WRITE_SCOPED_TOOLS, U as agentsPlugin, V as applyPosture, X as buildModelSelection, Y as compileAgentModule, Z as compileContextWindow, _ as compileLoadedAgentModule, $ as compileProjectContext, a0 as compileSkills, a1 as createAgentExecutionContext, a2 as createApiErrorHandler, a3 as createSdkAgentStream, a4 as createThinkTagExtractor, a5 as createToolHooksPlugin, a6 as extractThinkTagStream, a7 as generateAgentManifest, a8 as generateAgentRoutes, a9 as isAgentContext, aa as loadMcpJson, ab as mcpRegistry, ac as mcpToolApprovals, ad as projectContextMetadataOnlyKnobs, ae as reasoningEffortOf, af as resolveMcpServers, ag as runWithApiErrorHandling, ah as shouldAutoApprove, ai as toAgentFactory, aj as translateSdkEvent, ak as withClockCap, al as withEphemeralAgent } from './bridge-entry-B0FqqPlt.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-DBkqwe6b.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-DBkqwe6b.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, C as CompiledAgentOptions, b as CompiledTool, a as SettingSourcesSelection } from './agent-compiler-DZorqtK2.js';
11
- export { c as CompatSurface, d as CostBudgetExceededError, e as GuardrailAction, f as GuardrailPhase, g as GuardrailResult, h as GuardrailViolationError, H as HookApprovalGate, i as HookApprovalRequest, j as HookGateUnsupportedError, P as ProjectSettingsGrant, R as ResolvedCompatSource, k as SettingSourceCapability, l as SkillsRequestContext, S as SkillsSelection, T as ToolWalkResult, m as ToolboxWalkResult, U as UntrustedSettingSourceError, n as compileTools, r as resolveCompatSources, o as resolveEnabledSkills, p as resolveSettingSources } from './agent-compiler-DZorqtK2.js';
12
- import { L as LoopStrategy, R as ReflectionStrategy, b as RoundStreamFactory, S as StreamEvent, c as DelegationResult } from './delegation-scoring-MbnqL68u.js';
13
- 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-MbnqL68u.js';
14
- 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-D9b3h3VU.js';
10
+ import { G as Guardrail, a as CompiledAgentOptions, b as CompiledTool } from './agent-compiler-B0hb6HCo.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-B0hb6HCo.js';
12
+ import { S as SettingSourcesSelection } from './setting-sources-gate-DFu51i50.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-DFu51i50.js';
14
+ import { L as LoopStrategy, R as ReflectionStrategy, b as RoundStreamFactory, S as StreamEvent, c as DelegationResult } from './delegation-scoring-BzJEheml.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-BzJEheml.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-DhwNmdej.js';
15
17
  import { RetryOptions } from '@theokit/sdk/retry';
16
18
  export * from '@theokit/sdk/retry';
19
+ export { RetryOptions } from '@theokit/sdk/retry';
17
20
  import { CompressibleMessage } from '@theokit/sdk/compaction';
18
21
  export { CONTEXT_WINDOW_FLOOR, CONTEXT_WINDOW_MARGIN, CompressibleMessage, ContextWindowMarginError, ContextWindowSource, EffectiveContextWindow, resolveEffectiveContextWindow } from '@theokit/sdk/compaction';
19
22
  import { z } from 'zod';
@@ -23,7 +26,7 @@ export * from '@theokit/sdk/concurrency';
23
26
  export * from '@theokit/sdk/messages';
24
27
  export * from '@theokit/sdk/models';
25
28
  import { DiscoverSubagentsOptions } from '@theokit/sdk/subagents-loader';
26
- export { AgentDefinition as SubagentDefinition, discoverSubagents, loadSubagentDefinition } from '@theokit/sdk/subagents-loader';
29
+ export { DiscoverSubagentsOptions, AgentDefinition as SubagentDefinition, discoverSubagents, loadSubagentDefinition } from '@theokit/sdk/subagents-loader';
27
30
  export { H as HookHandlers } from './hook-handlers-Cw2FsnE5.js';
28
31
  import { WireChunk } from '@theokit/presenter/wire';
29
32
  export { WireChunk, WireDataPart } from '@theokit/presenter/wire';
@@ -80,19 +83,22 @@ declare function outputModeration(options: OutputModerationOptions): Guardrail;
80
83
  /**
81
84
  * M9 (theokit-ai-first) — the guardrail pipeline: apply guards in order at a boundary phase.
82
85
  *
83
- * Fail-fast (error-handling.md): a `block` throws {@link GuardrailViolationError} immediately.
84
- * A `redact` threads the transformed text into the next guard. Independent of the SDK runtime —
85
- * this runs at the framework boundary, before/after the SDK does its work.
86
+ * Fail-fast (error-handling.md): a `block` throws {@link GuardrailViolationError} immediately, and a
87
+ * `redact` with no replacement throws {@link MalformedGuardrailResultError} — B-008, where that case
88
+ * used to pass the original text through in silence. A well-formed `redact` threads its replacement
89
+ * into the next guard. Independent of the SDK runtime — this runs at the framework boundary.
86
90
  */
87
91
 
88
92
  /**
89
93
  * Run every guard's `checkInput` in order against `text`. Returns the (possibly redacted) text.
90
- * Throws {@link GuardrailViolationError} on the first `block`. Guards without `checkInput` are skipped.
94
+ * Throws on the first `block`, or on a `redact` that supplies no replacement. Guards without
95
+ * `checkInput` are skipped.
91
96
  */
92
97
  declare function runInputGuards(text: string, guards: readonly Guardrail[]): Promise<string>;
93
98
  /**
94
99
  * Run every guard's `checkOutput` in order against `text`. Returns the (possibly redacted) text.
95
- * Throws {@link GuardrailViolationError} on the first `block`. Guards without `checkOutput` are skipped.
100
+ * Throws on the first `block`, or on a `redact` that supplies no replacement. Guards without
101
+ * `checkOutput` are skipped.
96
102
  */
97
103
  declare function runOutputGuards(text: string, guards: readonly Guardrail[]): Promise<string>;
98
104
 
@@ -102,8 +108,104 @@ declare function runOutputGuards(text: string, guards: readonly Guardrail[]): Pr
102
108
  * @param inner the source stream (yields events, returns a result).
103
109
  * @param guards the guardrails; only those with `checkOutput` participate.
104
110
  * @param extractText pulls the human-visible text out of an event (return `undefined` for non-text).
111
+ * @param rebuildText builds ONE event carrying the moderated text, GIVEN the text-carrying event it
112
+ * replaces. Required, not optional (B-012): optional would let this function
113
+ * compute a redaction it cannot apply, which is the defect it was added to remove.
114
+ *
115
+ * **`extractText` MUST match exactly one event kind.** This is the parameter's
116
+ * real contract and it is a constraint, not a convenience.
117
+ *
118
+ * When it matches several, they COLLAPSE INTO ONE. Measured against the built
119
+ * artifact: `[thinking('CoT: the key is sk-abc'), message(' Here you go.')]`
120
+ * yields a single `message` reading `"CoT: the key is [R] Here you go."` — the
121
+ * model's private reasoning inside a visible event, and no `thinking` event
122
+ * survives. Reverse the order and the visible answer is swallowed into a
123
+ * `thinking` event instead.
124
+ *
125
+ * `replaced` does NOT prevent that, and an earlier version of this docblock, of
126
+ * the changeset and of a test comment all said it did. What it buys is narrower
127
+ * and worth having: the surviving event keeps the KIND and the metadata of the
128
+ * text-carrying event it replaces, instead of being rebuilt from the text alone.
129
+ * Without it, `[thinking, message]` collapsed into whatever kind `rebuildText`
130
+ * hard-coded; with it, the caller chooses. The collapse itself is unchanged.
131
+ *
132
+ * So a consumer who wants reasoning moderated must run a SECOND
133
+ * `moderateOutputStream` over that kind, not widen one `extractText` to cover
134
+ * both.
135
+ *
136
+ * `replaced` is ALWAYS an event, and used to be typed `E | undefined` for a case
137
+ * that cannot happen. The absence check below returns before `runOutputGuards` is
138
+ * ever called when no event carried text, so by the time `rebuildText` runs there
139
+ * is always a text-carrying event to replace. Proof, from the accumulation loop:
140
+ * `accumulated` grows only inside `if (text !== undefined)`, and `textAt` records
141
+ * that same predicate — so `!textAt.includes(true)` implies `accumulated === ''`,
142
+ * the absence check fires, and everything after it has `textAt.includes(true)`.
143
+ * The package's own test already pinned the opposite of the old wording
144
+ * (`rebuildText is never called for a channel that is not there`), and three
145
+ * shipping artifacts described the unreachable case as a live one.
146
+ *
147
+ * Note the boundary that IS real — an event whose extracted text is the EMPTY
148
+ * STRING is still text-carrying, and can be the one replaced. For
149
+ * `[text('secret'), text('')]` the moderated string lands on the trailing empty
150
+ * delta, so a `{ ...replaced }` caller inherits the terminator's metadata rather
151
+ * than the content-bearing event's.
152
+ * @param rebuildResult applies the moderated text to the generator's RETURN value.
153
+ *
154
+ * A stream has two channels and this function moderated one of them for a
155
+ * release. The events were redacted; `step.value` — the aggregate a caller
156
+ * reads from `run()`, or from the generator's return — was accumulated
157
+ * upstream from the PRE-moderation events and carried the original text.
158
+ * Measured against the built artifact: the guard computed `"the key is [R]"`
159
+ * and `run().response` was `"the key is sk-abc123"`.
160
+ *
161
+ * That is this function's own defect, verbatim, one channel over: the
162
+ * redaction was computed and not applied. Required for the same reason
163
+ * `rebuildText` is — optional would restore it under a nicer name — and
164
+ * passed rather than re-derived, because re-running `runOutputGuards` on the
165
+ * aggregate would apply a non-idempotent guard twice (a disclaimer appender
166
+ * would append two disclaimers).
167
+ *
168
+ * Return `result` unchanged when it carries no moderated text. That is
169
+ * correct and not a no-op only in that case; when it DOES carry the text,
170
+ * returning it unchanged drops the redaction, and no type can tell the two
171
+ * apart.
172
+ *
105
173
  */
106
- declare function moderateOutputStream<E, R>(inner: AsyncGenerator<E, R>, guards: readonly Guardrail[], extractText: (event: E) => string | undefined): AsyncGenerator<E, R>;
174
+ declare function moderateOutputStream<E, R>(inner: AsyncGenerator<E, R>, guards: readonly Guardrail[], extractText: (event: E) => string | undefined, rebuildText: (text: string, replaced: E) => E, rebuildResult: (text: string, result: R) => R): AsyncGenerator<E, R>;
175
+ /**
176
+ * The `extractText` for an event kind that announces itself as text — one implementation, used by
177
+ * every seam that moderates a stream.
178
+ *
179
+ * B-021 existed because there were two hand-written copies of `typeof e.content === 'string'`, in
180
+ * `AgentRunner.stream()` and in the served endpoint, and both returned `undefined` for a non-string.
181
+ * `moderateOutputStream` reads `undefined` as "this event carries no text", so the payload was never
182
+ * accumulated, never shown to a guard, and yielded verbatim — the DELIVER direction, with a guard
183
+ * declared to stop exactly that.
184
+ *
185
+ * Two different questions were collapsed into one answer:
186
+ *
187
+ * | The event | What the extractor must say |
188
+ * |---|---|
189
+ * | another kind entirely | `undefined` — not this channel |
190
+ * | this kind, content readable | the text |
191
+ * | this kind, content unreadable | **throw** — a guard cannot examine it |
192
+ *
193
+ * The third row is the one that was missing, and it cannot be expressed by a return value that also
194
+ * means "not this kind". Refused rather than coerced: coercing would moderate `"[object Object]"`,
195
+ * consulting a guard about a string the model never produced while the real payload rides along
196
+ * underneath.
197
+ *
198
+ * Reachable in practice rather than in theory — `StreamEvent` is `{ type: string; [key: string]:
199
+ * unknown }`, `event-translator.ts` casts an unvalidated provider content block to `{ text?: string
200
+ * }`, and a consumer-supplied `streamFactory` is a public option.
201
+ *
202
+ * Only consulted when a guard defines `checkOutput`: {@link moderateOutputStream} is a transparent
203
+ * pass-through otherwise, so an agent that declared no guard never meets this error however
204
+ * malformed the stream is.
205
+ */
206
+ declare function textPayloadExtractor<E extends {
207
+ type?: unknown;
208
+ }>(kind: string, read: (event: E) => unknown): (event: E) => string | undefined;
107
209
 
108
210
  /**
109
211
  * TranscriptCompactionStrategy — a named, callable transcript-compaction authoring layer
@@ -690,6 +792,24 @@ declare class GuardrailsCapability extends FieldCapability<'guardrails'> {
690
792
  * `'filesystem'` selects the SDK's durable store, so any other storage cannot resume across
691
793
  * requests. The warning moves WITH the feature — a declared checkpoint that silently cannot resume
692
794
  * is exactly the kind of no-op this project refuses to ship.
795
+ *
796
+ * ## This is RUN-STATE checkpointing. It is not file undo, and the name is shared (B-059)
797
+ *
798
+ * What this saves is the conversation: enough to RESUME a run. It does not snapshot the files an
799
+ * agent edited and cannot restore one.
800
+ *
801
+ * The distinction is written here because the word is the whole problem. Measured 2026-09-11:
802
+ * `rewindFiles`, `rewind_files`, `restoreFile` and `backup` return 0 files in this package, 0 in the
803
+ * SDK's `.d.ts` and 0 in `@theokit/sdk-tools`, while `checkpoint` returns six — all of them this
804
+ * subject. **Any parity checklist that greps for `checkpoint` is satisfied by the wrong one**, and
805
+ * reports a capability that does not exist.
806
+ *
807
+ * So a consumer building an interactive coding agent implements snapshot and restore themselves.
808
+ * There is no pre-write seam on the edit tools to hang it on either, which is the part that makes it
809
+ * a feature rather than a wiring job — and the reason it is stated here instead of half-built.
810
+ *
811
+ * Pinned by `tests/unit/run-state-checkpointing-is-not-file-undo.test.ts`, which goes red if a file
812
+ * surface ever appears — at which point this section should go with it.
693
813
  */
694
814
  declare class CheckpointCapability implements Capability {
695
815
  private readonly options;
@@ -711,6 +831,25 @@ declare class HumanInTheLoopCapability extends FieldCapability<'hitl'> {
711
831
  * draft (`createDraft` gives it `{}`), so a `setOnce` would conflict against the seed itself — the
712
832
  * same trap the pre-seeded `stream` sprang in M52. Merging also lets a preset declare a baseline
713
833
  * child set that a call site extends.
834
+ *
835
+ * ## How far this reaches
836
+ *
837
+ * **What it populates IS projected into `Agent.create`.** `assembleM8CreateOptions` forwards
838
+ * `compiled.agents` to `Agent.create({ agents })`, so declaring a sub-agent through this capability
839
+ * spawns one.
840
+ *
841
+ * That was not true until B-034. `M8CreateOptions` had no `agents` field, `agent-compiler.ts`
842
+ * recorded the gap as ADR D3 — "a resolver here is carried, not invoked" — and declaring a sub-agent
843
+ * through this capability compiled cleanly and spawned nothing, while the class crossed the public
844
+ * barrel alongside `SubagentDefinition`, `discoverSubagents`, `loadSubagentDefinition` and
845
+ * `listSubagentNames`. A consumer read the barrel, assembled the authoring chain and met silence:
846
+ * the "the type crossed, the capability did not" shape `bridge/index.ts` names four times by issue
847
+ * number. The deferral was a decision; the consumer discovering it at runtime was not.
848
+ *
849
+ * The children are SDK `AgentDefinition`s (`SubagentDefinition` on the barrel), the same shape the
850
+ * per-run door `RuntimeOverrides.agents` always took. A per-run value still WINS over this one —
851
+ * `sdk-adapter.ts` spreads `...m8, ...extra`, and a per-run override that lost to a compile-time
852
+ * value would be the opposite of what "override" promises.
714
853
  */
715
854
  declare class SubAgentsCapability implements Capability {
716
855
  private readonly children;
@@ -754,6 +893,42 @@ declare class HookApprovalCapability extends FieldCapability<'hookApproval'> {
754
893
  readonly name = "hook-approval";
755
894
  protected readonly field: "hookApproval";
756
895
  }
896
+ /**
897
+ * B-060 — `sessionStore`, the store the SDK resumes from.
898
+ *
899
+ * A `FieldCapability` like its neighbours: one field, set once. There is nothing to merge — two
900
+ * declared stores is a contradiction about where history lives, not a composition.
901
+ */
902
+ declare class SessionStoreCapability extends FieldCapability<'sessionStore'> {
903
+ readonly name = "session-store";
904
+ protected readonly field: "sessionStore";
905
+ }
906
+ /**
907
+ * B-056 — `canUseTool`, the seam that sees an `ask` verdict.
908
+ *
909
+ * A `FieldCapability`: one gate, set once. Two gates would be two answers to one question, and
910
+ * composing them would mean inventing a precedence nobody declared.
911
+ */
912
+ declare class CanUseToolCapability extends FieldCapability<'canUseTool'> {
913
+ readonly name = "can-use-tool";
914
+ protected readonly field: "canUseTool";
915
+ }
916
+ /**
917
+ * B-072 — OpenTelemetry settings, the door onto a tracer the SDK already runs.
918
+ *
919
+ * A `FieldCapability` because telemetry is one setting block set once: two of them would be two
920
+ * answers to "which service name do these spans carry", and composing them would mean inventing a
921
+ * precedence nobody declared — the same reasoning `CanUseToolCapability` records above.
922
+ *
923
+ * It exists because the waist gained `telemetry` and `capability-zero-behavior.test.ts` refuses to
924
+ * compile while a waist field has no capability expressing it. That gate is the reason this is a
925
+ * whole door rather than half of one: the projection alone would have let `defineAgent` reach the
926
+ * SDK while the capability path could not, and the two paths are asserted deep-equal.
927
+ */
928
+ declare class TelemetryCapability extends FieldCapability<'telemetry'> {
929
+ readonly name = "telemetry";
930
+ protected readonly field: "telemetry";
931
+ }
757
932
  declare class PluginsCapability extends FieldCapability<'plugins'> {
758
933
  readonly name = "plugins";
759
934
  protected readonly field: "plugins";
@@ -1375,4 +1550,4 @@ type AgentWithNarrowedList = Omit<typeof Agent$1, 'list'> & {
1375
1550
  type AgentWithNarrowedListAlias = AgentWithNarrowedList;
1376
1551
  declare const Agent: AgentWithNarrowedList;
1377
1552
 
1378
- export { type A2AAuth, type A2ACapabilities, type A2ASkill, type A2AToolConfig, AcpClient, AcpMessageDecoder, type AcpTransport, Agent, type AgentCard, type AgentConfig, AgentConfigCapability, AgentManifestEntry, AgentModule, AgentRunner, AgentRunnerBuilder, type AgentRunnerRunOptions, type AgentShape, type AgentWithNarrowedListAlias, ApprovalOptions, ApprovalPosture, type BuildAgentCardOptions, type Capability, CapabilityConflictError, CapabilityPreset, CapabilityRegistry, CheckpointCapability, type CompactionCallOptions, type CompactionStrategyConfig, CompiledAgentOptions, type CompiledAgentOptionsDraft, CompiledTool, ContextWindowCapability, type CostGuardOptions, DEFAULT_KEEP_TOKENS, DelegationResult, FieldCapability, type FinalizedDraft, GoalRunner, type GoalRunnerDeps, Guardrail, GuardrailsCapability, HitlDecision, HookApprovalCapability, HumanInTheLoopCapability, HumanInTheLoopOptions, type InProcessApprovalRequest, InProcessApprovalRequiredError, type InProcessAwaitApproval, type ListOptionsWithoutPaginationAlias, LoopStrategy, MCP_PROTOCOL_VERSION, MainLoopCapability, MainLoopMeta, type McpJsonSchema, type McpServerInfo, McpServersCapability, type McpToolDescriptor, MemoryCapability, ModelCapability, type NamedTool, type OutputModerationOptions, type PiiOptions, PluginsCapability, ProjectContextCapability, type PromptInjectionOptions, type ProvenanceEntry, ReasoningEffort, ReflectionStrategy, RoundStreamFactory, RunContextCapability, SettingSourcesCapability, SettingSourcesSelection, SkillsCapability, SkillsOptionsCapability, SkillsResolverCapability, type StreamAgentTurnDeps, type StreamAgentTurnInProcessInput, StreamEvent, SubAgentsCapability, type Summarize, type ToolComNome, type ToolDeclaration, ToolOptions, ToolboxCapability, type ToolboxSource, ToolsCapability, Toolset, ToolsetError, type TranscriptCompactionStrategy, UnknownCapabilityError, applyCapabilities, buildAgentCard, buildMcpToolDescriptors, compactionStrategyConfigSchema, costGuard, createA2ATool, createDraft, declareAgentShape, deriveConversationId, encodeAcpMessage, estimateTokens, formatGoalEvent, listSubagentNames, mcpServerInfo, moderateOutputStream, outputModeration, parseConversationId, piiDetector, promptInjectionDetector, resolveCompactionStrategy, runInputGuards, runOutputGuards, setOnce, streamAgentTurnInProcess, streamAgentUIMessages, tokenBudgetCompactionStrategy, unicodeNormalizer, wellKnownCardPath };
1553
+ export { type A2AAuth, type A2ACapabilities, type A2ASkill, type A2AToolConfig, AcpClient, AcpMessageDecoder, type AcpTransport, Agent, type AgentCard, type AgentConfig, AgentConfigCapability, AgentManifestEntry, AgentModule, AgentRunner, AgentRunnerBuilder, type AgentRunnerRunOptions, type AgentShape, type AgentWithNarrowedListAlias, ApprovalOptions, ApprovalPosture, type BuildAgentCardOptions, CanUseToolCapability, type Capability, CapabilityConflictError, CapabilityPreset, CapabilityRegistry, CheckpointCapability, type CompactionCallOptions, type CompactionStrategyConfig, CompiledAgentOptions, type CompiledAgentOptionsDraft, CompiledTool, ContextWindowCapability, ContextWindowOptions, type CostGuardOptions, DEFAULT_KEEP_TOKENS, DelegationResult, FieldCapability, type FinalizedDraft, GoalRunner, type GoalRunnerDeps, Guardrail, GuardrailsCapability, HitlDecision, HookApprovalCapability, HumanInTheLoopCapability, HumanInTheLoopOptions, type InProcessApprovalRequest, InProcessApprovalRequiredError, type InProcessAwaitApproval, type ListOptionsWithoutPaginationAlias, LoopStrategy, MCP_PROTOCOL_VERSION, MainLoopCapability, MainLoopMeta, type McpJsonSchema, type McpServerInfo, McpServersCapability, type McpToolDescriptor, MemoryCapability, ModelCapability, type NamedTool, type OutputModerationOptions, type PiiOptions, PluginsCapability, ProjectContextCapability, type PromptInjectionOptions, type ProvenanceEntry, ReasoningEffort, ReflectionStrategy, RoundStreamFactory, RunContextCapability, SessionStoreCapability, SettingSourcesCapability, SettingSourcesSelection, SkillsCapability, SkillsOptions, SkillsOptionsCapability, SkillsResolverCapability, type StreamAgentTurnDeps, type StreamAgentTurnInProcessInput, StreamEvent, SubAgentsCapability, type Summarize, TelemetryCapability, type ToolComNome, type ToolDeclaration, ToolOptions, ToolboxCapability, type ToolboxSource, ToolsCapability, Toolset, ToolsetError, type TranscriptCompactionStrategy, UnknownCapabilityError, applyCapabilities, buildAgentCard, buildMcpToolDescriptors, compactionStrategyConfigSchema, costGuard, createA2ATool, createDraft, declareAgentShape, deriveConversationId, encodeAcpMessage, estimateTokens, formatGoalEvent, listSubagentNames, mcpServerInfo, moderateOutputStream, outputModeration, parseConversationId, piiDetector, promptInjectionDetector, resolveCompactionStrategy, runInputGuards, runOutputGuards, setOnce, streamAgentTurnInProcess, streamAgentUIMessages, textPayloadExtractor, tokenBudgetCompactionStrategy, unicodeNormalizer, wellKnownCardPath };