@theokit/agents 6.4.0 → 6.4.2

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.
@@ -2082,7 +2082,16 @@ type McpApprovalSpec = HumanInTheLoopOptions | string;
2082
2082
  */
2083
2083
  declare function mcpToolApprovals(specs: Record<string, McpApprovalSpec>): Record<string, HumanInTheLoopOptions>;
2084
2084
 
2085
- /** Canal por onde uma entrada omitida é NOMEADA. Sem ele, estreitar o raio viraria fail-open. */
2085
+ /**
2086
+ * Canal por onde uma entrada omitida é NOMEADA. Sem ele, estreitar o raio viraria fail-open.
2087
+ *
2088
+ * **`onWarn` é opcional, o AVISO não é.** Omitido, os avisos vão para `stderr` — nunca para lugar
2089
+ * nenhum. O review do M112 mediu por que isso importa: o único chamador de produção
2090
+ * (`agents/chat.ts:530` do agent-builder) **não passava** `onWarn`, e toda a defesa contra
2091
+ * `error-handling.md § 2` — repetida em quatro artefatos — dependia da frase *"o erro segue visível
2092
+ * pelo canal"*. Sem assinante, a entrada era descartada em silêncio absoluto: o usuário veria "a tool
2093
+ * sumiu" e nada mais.
2094
+ */
2086
2095
  interface LoadMcpJsonOptions {
2087
2096
  onWarn?: (aviso: string) => void;
2088
2097
  }
@@ -2255,4 +2264,4 @@ declare function agentsPlugin(opts: AgentsPluginOptions): {
2255
2264
  register(app: PluginApp): void;
2256
2265
  };
2257
2266
 
2258
- export { type DelegateOptions as $, type ApprovalOptions as A, type ApiErrorDecision as B, type CompiledAgentOptions as C, type DelegationResult as D, type ApiErrorPolicy as E, type ApprovalRequiredEvent as F, type Guardrail as G, type HumanInTheLoopOptions as H, type ArtifactChunkEvent as I, type ArtifactStartEvent as J, type BackgroundDelegation as K, type LoopStrategy as L, type MainLoopMeta as M, type BeforeToolCallContext as N, BudgetExceededError as O, type BudgetOptions as P, type CheckpointSavedEvent as Q, type ReflectionStrategy as R, type StreamEvent as S, type ToolOptions as T, type CompiledContextWindow as U, ContextualTool as V, CostBudgetExceededError as W, DEFAULT_MAX_ITERATIONS as X, type DefineAgentConfig as Y, type DefinicaoOuThunk as Z, type DelegateFn as _, type CompiledTool as a, createThinkTagExtractor as a$, DelegationBudgetExceededError as a0, DelegationError as a1, type DoneEvent as a2, type ErrorEvent as a3, type FileEditEvent as a4, type GuardrailAction as a5, type GuardrailPhase as a6, type GuardrailResult as a7, GuardrailViolationError as a8, type HookHandlers as a9, type SdkTurnHandle as aA, type Segment as aB, type SkillsRequestContext as aC, type SkillsSelection as aD, type StateUpdateEvent as aE, type TextDeltaEvent as aF, type ThinkingEvent as aG, type TimeoutAction as aH, type ToolCallEvent as aI, type ToolCallVeto as aJ, type ToolHooks as aK, type ToolHooksPlugin as aL, type ToolResultEvent as aM, type ToolWalkResult as aN, type ToolboxOptions as aO, type ToolboxWalkResult as aP, agentsPlugin as aQ, buildModelSelection as aR, compileAgentDefinition as aS, compileAgentModule as aT, compileContextWindow as aU, compileProjectContext as aV, compileSkills as aW, compileTools as aX, createAgentExecutionContext as aY, createApiErrorHandler as aZ, createSdkAgentStream as a_, type InferAgentInput as aa, type InferAgentToolNames as ab, type IterationEvent as ac, type LLMCallContext as ad, type LoopFinishReason as ae, type LoopOutcome as af, type LoopStrategyConfig as ag, type MainLoopOptions as ah, type McpApprovalSpec as ai, McpFileError as aj, type McpRegistryConfig as ak, type McpRequestContext as al, type McpSelection as am, type PartialToolCallEvent as an, type PolicyHandler as ao, type ProcessInputContext as ap, type ReflectionContext as aq, type ReflectionResult as ar, type ReflectionStrategyConfig as as, type RunStartedEvent as at, type ScoreVerdict as au, type ScoredDelegation as av, type Scorer as aw, type SdkAgentHandle as ax, type SdkMessage as ay, type SdkSendOptions as az, type ReasoningEffort as b, createToolHooksPlugin as b0, delegate as b1, delegateBackground as b2, delegateWithScoring as b3, extractThinkTagStream as b4, generateAgentManifest as b5, generateAgentRoutes as b6, isAgentContext as b7, isAgentDefinition as b8, isApprovalRequired as b9, isDone as ba, isError as bb, isPartialToolCall as bc, isTextDelta as bd, isToolCall as be, isToolResult as bf, ladderReflectionStrategy as bg, loadMcpJson as bh, loopStrategyConfigSchema as bi, mcpRegistry as bj, mcpToolApprovals as bk, noopReflectionStrategy as bl, presentUIMessageStream as bm, projectContextMetadataOnlyKnobs as bn, reasoningEffortOf as bo, reflectionStrategyConfigSchema as bp, resolveEnabledSkills as bq, resolveLoopStrategy as br, resolveMcpServers as bs, runWithApiErrorHandling as bt, streamAgentResponse as bu, toAgentFactory as bv, translateSdkEvent as bw, type RoundStreamFactory as c, type ContextWindowOptions as d, type SkillsOptions as e, type AgentManifestEntry as f, type HitlDecision as g, type ApprovalPosture as h, AGENT_BRAND as i, type AfterToolCallContext as j, AgentBuilder as k, type AgentDefinition as l, AgentDefinitionError as m, type AgentExecutionContext as n, type AgentManifest as o, type AgentManifestSource as p, type AgentManifestTool as q, type AgentOptions as r, streamAgentUIMessages as s, type AgentRoute as t, type AgentRouteContext as u, type AgentRunInfo as v, type AgentStreamEvent as w, type AgentTurnMetadata as x, type AgentsPluginOptions as y, type ApiErrorContext as z };
2267
+ export { type DelegateOptions as $, type ApprovalOptions as A, type ApiErrorDecision as B, type CompiledAgentOptions as C, type DelegationResult as D, type ApiErrorPolicy as E, type ApprovalRequiredEvent as F, type Guardrail as G, type HumanInTheLoopOptions as H, type ArtifactChunkEvent as I, type ArtifactStartEvent as J, type BackgroundDelegation as K, type LoopStrategy as L, type MainLoopMeta as M, type BeforeToolCallContext as N, BudgetExceededError as O, type BudgetOptions as P, type CheckpointSavedEvent as Q, type ReflectionStrategy as R, type StreamEvent as S, type ToolOptions as T, type CompiledContextWindow as U, ContextualTool as V, CostBudgetExceededError as W, DEFAULT_MAX_ITERATIONS as X, type DefineAgentConfig as Y, type DefinicaoOuThunk as Z, type DelegateFn as _, type CompiledTool as a, createSdkAgentStream as a$, DelegationBudgetExceededError as a0, DelegationError as a1, type DoneEvent as a2, type ErrorEvent as a3, type FileEditEvent as a4, type GuardrailAction as a5, type GuardrailPhase as a6, type GuardrailResult as a7, GuardrailViolationError as a8, type HookHandlers as a9, type SdkSendOptions as aA, type SdkTurnHandle as aB, type Segment as aC, type SkillsRequestContext as aD, type SkillsSelection as aE, type StateUpdateEvent as aF, type TextDeltaEvent as aG, type ThinkingEvent as aH, type TimeoutAction as aI, type ToolCallEvent as aJ, type ToolCallVeto as aK, type ToolHooks as aL, type ToolHooksPlugin as aM, type ToolResultEvent as aN, type ToolWalkResult as aO, type ToolboxOptions as aP, type ToolboxWalkResult as aQ, agentsPlugin as aR, buildModelSelection as aS, compileAgentDefinition as aT, compileAgentModule as aU, compileContextWindow as aV, compileProjectContext as aW, compileSkills as aX, compileTools as aY, createAgentExecutionContext as aZ, createApiErrorHandler as a_, type InferAgentInput as aa, type InferAgentToolNames as ab, type IterationEvent as ac, type LLMCallContext as ad, type LoopFinishReason as ae, type LoopOutcome as af, type LoopStrategyConfig as ag, type MainLoopOptions as ah, type McpApprovalSpec as ai, McpFileError as aj, type McpRegistryConfig as ak, type McpRequestContext as al, type McpSelection as am, type McpServersMap as an, type PartialToolCallEvent as ao, type PolicyHandler as ap, type ProcessInputContext as aq, type ReflectionContext as ar, type ReflectionResult as as, type ReflectionStrategyConfig as at, type RunStartedEvent as au, type ScoreVerdict as av, type ScoredDelegation as aw, type Scorer as ax, type SdkAgentHandle as ay, type SdkMessage as az, type ReasoningEffort as b, createThinkTagExtractor as b0, createToolHooksPlugin as b1, delegate as b2, delegateBackground as b3, delegateWithScoring as b4, extractThinkTagStream as b5, generateAgentManifest as b6, generateAgentRoutes as b7, isAgentContext as b8, isAgentDefinition as b9, isApprovalRequired as ba, isDone as bb, isError as bc, isPartialToolCall as bd, isTextDelta as be, isToolCall as bf, isToolResult as bg, ladderReflectionStrategy as bh, loadMcpJson as bi, loopStrategyConfigSchema as bj, mcpRegistry as bk, mcpToolApprovals as bl, noopReflectionStrategy as bm, presentUIMessageStream as bn, projectContextMetadataOnlyKnobs as bo, reasoningEffortOf as bp, reflectionStrategyConfigSchema as bq, resolveEnabledSkills as br, resolveLoopStrategy as bs, resolveMcpServers as bt, runWithApiErrorHandling as bu, streamAgentResponse as bv, toAgentFactory as bw, translateSdkEvent as bx, type RoundStreamFactory as c, type ContextWindowOptions as d, type SkillsOptions as e, type AgentManifestEntry as f, type HitlDecision as g, type ApprovalPosture as h, AGENT_BRAND as i, type AfterToolCallContext as j, AgentBuilder as k, type AgentDefinition as l, AgentDefinitionError as m, type AgentExecutionContext as n, type AgentManifest as o, type AgentManifestSource as p, type AgentManifestTool as q, type AgentOptions as r, streamAgentUIMessages as s, type AgentRoute as t, type AgentRouteContext as u, type AgentRunInfo as v, type AgentStreamEvent as w, type AgentTurnMetadata as x, type AgentsPluginOptions as y, type ApiErrorContext as z };
package/dist/bridge.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { i as AGENT_BRAND, j as AfterToolCallContext, k as AgentBuilder, l as AgentDefinition, m as AgentDefinitionError, n as AgentExecutionContext, o as AgentManifest, f as AgentManifestEntry, p as AgentManifestSource, q as AgentManifestTool, t as AgentRoute, u as AgentRouteContext, v as AgentRunInfo, w as AgentStreamEvent, x as AgentTurnMetadata, y as AgentsPluginOptions, z as ApiErrorContext, B as ApiErrorDecision, E as ApiErrorPolicy, h as ApprovalPosture, F as ApprovalRequiredEvent, I as ArtifactChunkEvent, J as ArtifactStartEvent, K as BackgroundDelegation, N as BeforeToolCallContext, O as BudgetExceededError, Q as CheckpointSavedEvent, C as CompiledAgentOptions, U as CompiledContextWindow, a as CompiledTool, V as ContextualTool, Y as DefineAgentConfig, Z as DefinicaoOuThunk, _ as DelegateFn, $ as DelegateOptions, a0 as DelegationBudgetExceededError, a1 as DelegationError, D as DelegationResult, a2 as DoneEvent, a3 as ErrorEvent, a4 as FileEditEvent, aa as InferAgentInput, ab as InferAgentToolNames, ac as IterationEvent, ad as LLMCallContext, ai as McpApprovalSpec, aj as McpFileError, ak as McpRegistryConfig, al as McpRequestContext, am as McpSelection, an as PartialToolCallEvent, ap as ProcessInputContext, at as RunStartedEvent, au as ScoreVerdict, av as ScoredDelegation, aw as Scorer, ax as SdkAgentHandle, ay as SdkMessage, az as SdkSendOptions, aA as SdkTurnHandle, aB as Segment, aE as StateUpdateEvent, S as StreamEvent, aF as TextDeltaEvent, aG as ThinkingEvent, aI as ToolCallEvent, aJ as ToolCallVeto, aK as ToolHooks, aL as ToolHooksPlugin, aM as ToolResultEvent, aN as ToolWalkResult, aP as ToolboxWalkResult, aQ as agentsPlugin, aR as buildModelSelection, aS as compileAgentDefinition, aT as compileAgentModule, aU as compileContextWindow, aV as compileProjectContext, aW as compileSkills, aX as compileTools, aY as createAgentExecutionContext, aZ as createApiErrorHandler, a_ as createSdkAgentStream, a$ as createThinkTagExtractor, b0 as createToolHooksPlugin, b1 as delegate, b2 as delegateBackground, b3 as delegateWithScoring, b4 as extractThinkTagStream, b5 as generateAgentManifest, b6 as generateAgentRoutes, b7 as isAgentContext, b8 as isAgentDefinition, b9 as isApprovalRequired, ba as isDone, bb as isError, bc as isPartialToolCall, bd as isTextDelta, be as isToolCall, bf as isToolResult, bh as loadMcpJson, bj as mcpRegistry, bk as mcpToolApprovals, bm as presentUIMessageStream, bn as projectContextMetadataOnlyKnobs, bo as reasoningEffortOf, bs as resolveMcpServers, bt as runWithApiErrorHandling, bu as streamAgentResponse, s as streamAgentUIMessages, bv as toAgentFactory, bw as translateSdkEvent } from './bridge-entry-ok33yXie.js';
1
+ export { i as AGENT_BRAND, j as AfterToolCallContext, k as AgentBuilder, l as AgentDefinition, m as AgentDefinitionError, n as AgentExecutionContext, o as AgentManifest, f as AgentManifestEntry, p as AgentManifestSource, q as AgentManifestTool, t as AgentRoute, u as AgentRouteContext, v as AgentRunInfo, w as AgentStreamEvent, x as AgentTurnMetadata, y as AgentsPluginOptions, z as ApiErrorContext, B as ApiErrorDecision, E as ApiErrorPolicy, h as ApprovalPosture, F as ApprovalRequiredEvent, I as ArtifactChunkEvent, J as ArtifactStartEvent, K as BackgroundDelegation, N as BeforeToolCallContext, O as BudgetExceededError, Q as CheckpointSavedEvent, C as CompiledAgentOptions, U as CompiledContextWindow, a as CompiledTool, V as ContextualTool, Y as DefineAgentConfig, Z as DefinicaoOuThunk, _ as DelegateFn, $ as DelegateOptions, a0 as DelegationBudgetExceededError, a1 as DelegationError, D as DelegationResult, a2 as DoneEvent, a3 as ErrorEvent, a4 as FileEditEvent, aa as InferAgentInput, ab as InferAgentToolNames, ac as IterationEvent, ad as LLMCallContext, ai as McpApprovalSpec, aj as McpFileError, ak as McpRegistryConfig, al as McpRequestContext, am as McpSelection, ao as PartialToolCallEvent, aq as ProcessInputContext, au as RunStartedEvent, av as ScoreVerdict, aw as ScoredDelegation, ax as Scorer, ay as SdkAgentHandle, az as SdkMessage, aA as SdkSendOptions, aB as SdkTurnHandle, aC as Segment, aF as StateUpdateEvent, S as StreamEvent, aG as TextDeltaEvent, aH as ThinkingEvent, aJ as ToolCallEvent, aK as ToolCallVeto, aL as ToolHooks, aM as ToolHooksPlugin, aN as ToolResultEvent, aO as ToolWalkResult, aQ as ToolboxWalkResult, aR as agentsPlugin, aS as buildModelSelection, aT as compileAgentDefinition, aU as compileAgentModule, aV as compileContextWindow, aW as compileProjectContext, aX as compileSkills, aY as compileTools, aZ as createAgentExecutionContext, a_ as createApiErrorHandler, a$ as createSdkAgentStream, b0 as createThinkTagExtractor, b1 as createToolHooksPlugin, b2 as delegate, b3 as delegateBackground, b4 as delegateWithScoring, b5 as extractThinkTagStream, b6 as generateAgentManifest, b7 as generateAgentRoutes, b8 as isAgentContext, b9 as isAgentDefinition, ba as isApprovalRequired, bb as isDone, bc as isError, bd as isPartialToolCall, be as isTextDelta, bf as isToolCall, bg as isToolResult, bi as loadMcpJson, bk as mcpRegistry, bl as mcpToolApprovals, bn as presentUIMessageStream, bo as projectContextMetadataOnlyKnobs, bp as reasoningEffortOf, bt as resolveMcpServers, bu as runWithApiErrorHandling, bv as streamAgentResponse, s as streamAgentUIMessages, bw as toAgentFactory, bx as translateSdkEvent } from './bridge-entry-B-DQXIgk.js';
2
2
  import '@theokit/http';
3
3
  import '@theokit/sdk';
4
4
  import 'zod';
package/dist/bridge.js CHANGED
@@ -47,7 +47,7 @@ import {
47
47
  streamAgentUIMessages,
48
48
  toAgentFactory,
49
49
  translateSdkEvent
50
- } from "./chunk-C5RUE4DB.js";
50
+ } from "./chunk-UJPG3K26.js";
51
51
  import "./chunk-7QVYU63E.js";
52
52
  export {
53
53
  AGENT_BRAND,
@@ -3415,6 +3415,13 @@ __name(mcpToolApprovals, "mcpToolApprovals");
3415
3415
  import { existsSync, readFileSync } from "fs";
3416
3416
  import { join } from "path";
3417
3417
  import { TheokitAgentError } from "@theokit/sdk/errors";
3418
+ function canalDeAviso(opts) {
3419
+ return opts.onWarn ?? ((aviso) => {
3420
+ process.stderr.write(`[@theokit/agents] ${aviso}
3421
+ `);
3422
+ });
3423
+ }
3424
+ __name(canalDeAviso, "canalDeAviso");
3418
3425
  var McpFileError = class extends TheokitAgentError {
3419
3426
  static {
3420
3427
  __name(this, "McpFileError");
@@ -3440,7 +3447,7 @@ function loadMcpJson(cwd, opts = {}) {
3440
3447
  } catch (err) {
3441
3448
  throw new McpFileError(`${path} is not valid JSON: ${descrever(err)}`);
3442
3449
  }
3443
- return parseMcpJson(parsed, path, opts.onWarn);
3450
+ return parseMcpJson(parsed, path, canalDeAviso(opts));
3444
3451
  }
3445
3452
  __name(loadMcpJson, "loadMcpJson");
3446
3453
  function parseMcpJson(raw, source, onWarn) {
@@ -3456,10 +3463,10 @@ function parseMcpJson(raw, source, onWarn) {
3456
3463
  for (const [name, entryRaw] of Object.entries(serversRaw)) {
3457
3464
  const motivo = validarEntrada(name, entryRaw);
3458
3465
  if (motivo !== void 0) {
3459
- onWarn?.(`${source}: server "${name}" ignorado \u2014 ${motivo}`);
3466
+ onWarn(`${source}: server "${name}" ignorado \u2014 ${motivo}`);
3460
3467
  continue;
3461
3468
  }
3462
- out[name] = entryRaw;
3469
+ out[name] = montarEntrada(entryRaw);
3463
3470
  }
3464
3471
  return out;
3465
3472
  }
@@ -3507,6 +3514,26 @@ function validarRemoto(entry) {
3507
3514
  return void 0;
3508
3515
  }
3509
3516
  __name(validarRemoto, "validarRemoto");
3517
+ function montarEntrada(entry) {
3518
+ if (entry.url !== void 0) {
3519
+ const remoto = {
3520
+ url: entry.url
3521
+ };
3522
+ if (entry.type !== void 0) remoto.type = entry.type;
3523
+ if (entry.headers !== void 0) remoto.headers = entry.headers;
3524
+ if (entry.auth !== void 0) remoto.auth = entry.auth;
3525
+ if (entry.requestTimeoutMs !== void 0) remoto.requestTimeoutMs = entry.requestTimeoutMs;
3526
+ return remoto;
3527
+ }
3528
+ const stdio = {
3529
+ command: entry.command
3530
+ };
3531
+ if (entry.args !== void 0) stdio.args = entry.args;
3532
+ if (entry.env !== void 0) stdio.env = entry.env;
3533
+ if (entry.cwd !== void 0) stdio.cwd = entry.cwd;
3534
+ return stdio;
3535
+ }
3536
+ __name(montarEntrada, "montarEntrada");
3510
3537
  function descrever(err) {
3511
3538
  return err instanceof Error ? err.message : String(err);
3512
3539
  }
@@ -3732,4 +3759,4 @@ export {
3732
3759
  generateAgentManifest,
3733
3760
  agentsPlugin
3734
3761
  };
3735
- //# sourceMappingURL=chunk-C5RUE4DB.js.map
3762
+ //# sourceMappingURL=chunk-UJPG3K26.js.map