@theokit/agents 6.3.1 → 6.4.1
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/dist/{bridge-entry-BlKfMDWb.d.ts → bridge-entry-C_jckCIk.d.ts} +8 -14
- package/dist/bridge.d.ts +1 -1
- package/dist/bridge.js +1 -1
- package/dist/{chunk-MDFEPVAN.js → chunk-C5RUE4DB.js} +44 -22
- package/dist/{chunk-MDFEPVAN.js.map → chunk-C5RUE4DB.js.map} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExecutionContext } from '@theokit/http';
|
|
2
|
-
import { SystemPromptResolver, InlineSkill, SettingSource, MemorySettings, SkillsSettings, ContextSettings, PreToolCallContext, PreToolCallDecision, PostToolCallContext, ToolResultTransformContext, TransformContext, SessionLifecycleContext, PreUserSendContext, PreUserSendResult, PostAssistantReplyContext, CustomTool, ModelSelection, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker } from '@theokit/sdk';
|
|
2
|
+
import { McpServerConfig, SystemPromptResolver, InlineSkill, SettingSource, MemorySettings, SkillsSettings, ContextSettings, PreToolCallContext, PreToolCallDecision, PostToolCallContext, ToolResultTransformContext, TransformContext, SessionLifecycleContext, PreUserSendContext, PreUserSendResult, PostAssistantReplyContext, CustomTool, ModelSelection, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker } from '@theokit/sdk';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { UIMessageChunk } from 'ai';
|
|
5
5
|
import { RetryOptions } from '@theokit/sdk/retry';
|
|
@@ -128,17 +128,7 @@ interface HumanInTheLoopOptions {
|
|
|
128
128
|
*/
|
|
129
129
|
payloadSchema?: Record<string, unknown>;
|
|
130
130
|
}
|
|
131
|
-
|
|
132
|
-
interface McpServerConfig {
|
|
133
|
-
/** Command to start the MCP server. */
|
|
134
|
-
command: string;
|
|
135
|
-
/** Arguments passed to the command. */
|
|
136
|
-
args?: string[];
|
|
137
|
-
/** Environment variables for the server process. */
|
|
138
|
-
env?: Record<string, string>;
|
|
139
|
-
/** Working directory for the server process. */
|
|
140
|
-
cwd?: string;
|
|
141
|
-
}
|
|
131
|
+
|
|
142
132
|
type McpServersMap = Record<string, McpServerConfig>;
|
|
143
133
|
/** M53 — moved from the `@ProjectContext` decorator being deleted; read by the compiler. */
|
|
144
134
|
type IndexStrategy = 'tree-sitter' | 'regex' | 'none';
|
|
@@ -2092,6 +2082,10 @@ type McpApprovalSpec = HumanInTheLoopOptions | string;
|
|
|
2092
2082
|
*/
|
|
2093
2083
|
declare function mcpToolApprovals(specs: Record<string, McpApprovalSpec>): Record<string, HumanInTheLoopOptions>;
|
|
2094
2084
|
|
|
2085
|
+
/** Canal por onde uma entrada omitida é NOMEADA. Sem ele, estreitar o raio viraria fail-open. */
|
|
2086
|
+
interface LoadMcpJsonOptions {
|
|
2087
|
+
onWarn?: (aviso: string) => void;
|
|
2088
|
+
}
|
|
2095
2089
|
/**
|
|
2096
2090
|
* Raised when `<cwd>/.mcp.json` exists but cannot be read, is not valid JSON, or does not match the
|
|
2097
2091
|
* expected shape — never swallowed.
|
|
@@ -2114,7 +2108,7 @@ declare class McpFileError extends TheokitAgentError {
|
|
|
2114
2108
|
*
|
|
2115
2109
|
* Reading is explicit — this module has no import-time side effect.
|
|
2116
2110
|
*/
|
|
2117
|
-
declare function loadMcpJson(cwd: string): McpServersMap;
|
|
2111
|
+
declare function loadMcpJson(cwd: string, opts?: LoadMcpJsonOptions): McpServersMap;
|
|
2118
2112
|
|
|
2119
2113
|
/**
|
|
2120
2114
|
* Agent manifest generator — build-time JSON describing all agents, tools, guards, policies.
|
|
@@ -2261,4 +2255,4 @@ declare function agentsPlugin(opts: AgentsPluginOptions): {
|
|
|
2261
2255
|
register(app: PluginApp): void;
|
|
2262
2256
|
};
|
|
2263
2257
|
|
|
2264
|
-
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,
|
|
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, 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,
|
|
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-C_jckCIk.js';
|
|
2
2
|
import '@theokit/http';
|
|
3
3
|
import '@theokit/sdk';
|
|
4
4
|
import 'zod';
|
package/dist/bridge.js
CHANGED
|
@@ -3425,7 +3425,7 @@ var McpFileError = class extends TheokitAgentError {
|
|
|
3425
3425
|
}
|
|
3426
3426
|
};
|
|
3427
3427
|
var MCP_FILENAME = ".mcp.json";
|
|
3428
|
-
function loadMcpJson(cwd) {
|
|
3428
|
+
function loadMcpJson(cwd, opts = {}) {
|
|
3429
3429
|
const path = join(cwd, MCP_FILENAME);
|
|
3430
3430
|
if (!existsSync(path)) return {};
|
|
3431
3431
|
let text;
|
|
@@ -3440,10 +3440,10 @@ function loadMcpJson(cwd) {
|
|
|
3440
3440
|
} catch (err) {
|
|
3441
3441
|
throw new McpFileError(`${path} is not valid JSON: ${descrever(err)}`);
|
|
3442
3442
|
}
|
|
3443
|
-
return parseMcpJson(parsed, path);
|
|
3443
|
+
return parseMcpJson(parsed, path, opts.onWarn);
|
|
3444
3444
|
}
|
|
3445
3445
|
__name(loadMcpJson, "loadMcpJson");
|
|
3446
|
-
function parseMcpJson(raw, source) {
|
|
3446
|
+
function parseMcpJson(raw, source, onWarn) {
|
|
3447
3447
|
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
3448
3448
|
throw new McpFileError(`${source}: root must be a JSON object with an "mcpServers" key.`);
|
|
3449
3449
|
}
|
|
@@ -3454,37 +3454,59 @@ function parseMcpJson(raw, source) {
|
|
|
3454
3454
|
}
|
|
3455
3455
|
const out = {};
|
|
3456
3456
|
for (const [name, entryRaw] of Object.entries(serversRaw)) {
|
|
3457
|
-
|
|
3457
|
+
const motivo = validarEntrada(name, entryRaw);
|
|
3458
|
+
if (motivo !== void 0) {
|
|
3459
|
+
onWarn?.(`${source}: server "${name}" ignorado \u2014 ${motivo}`);
|
|
3460
|
+
continue;
|
|
3461
|
+
}
|
|
3462
|
+
out[name] = entryRaw;
|
|
3458
3463
|
}
|
|
3459
3464
|
return out;
|
|
3460
3465
|
}
|
|
3461
3466
|
__name(parseMcpJson, "parseMcpJson");
|
|
3462
|
-
function
|
|
3467
|
+
function validarEntrada(name, entryRaw) {
|
|
3463
3468
|
if (typeof entryRaw !== "object" || entryRaw === null || Array.isArray(entryRaw)) {
|
|
3464
|
-
|
|
3469
|
+
return "a entrada deve ser um objeto.";
|
|
3465
3470
|
}
|
|
3466
3471
|
const entry = entryRaw;
|
|
3472
|
+
const temUrl = entry.url !== void 0;
|
|
3473
|
+
const temCommand = entry.command !== void 0;
|
|
3474
|
+
if (temUrl && temCommand) return 'declara "command" e "url" ao mesmo tempo \u2014 escolha um transporte.';
|
|
3475
|
+
if (!temUrl && !temCommand) return 'requer "command" (stdio) ou "url" (http/sse).';
|
|
3476
|
+
return temUrl ? validarRemoto(entry) : validarStdio(entry);
|
|
3477
|
+
}
|
|
3478
|
+
__name(validarEntrada, "validarEntrada");
|
|
3479
|
+
function validarStdio(entry) {
|
|
3467
3480
|
if (typeof entry.command !== "string" || entry.command.length === 0) {
|
|
3468
|
-
|
|
3481
|
+
return 'campo "command" deve ser uma string n\xE3o vazia.';
|
|
3482
|
+
}
|
|
3483
|
+
if (entry.args !== void 0 && !isStringArray(entry.args)) return 'campo "args" deve ser array de strings.';
|
|
3484
|
+
if (entry.env !== void 0 && !isStringRecord(entry.env)) return 'campo "env" deve ser um mapa de strings.';
|
|
3485
|
+
if (entry.cwd !== void 0 && typeof entry.cwd !== "string") return 'campo "cwd" deve ser string.';
|
|
3486
|
+
return void 0;
|
|
3487
|
+
}
|
|
3488
|
+
__name(validarStdio, "validarStdio");
|
|
3489
|
+
function validarRemoto(entry) {
|
|
3490
|
+
if (typeof entry.url !== "string" || entry.url.length === 0) {
|
|
3491
|
+
return 'campo "url" deve ser uma string n\xE3o vazia.';
|
|
3469
3492
|
}
|
|
3470
|
-
|
|
3471
|
-
|
|
3493
|
+
try {
|
|
3494
|
+
new URL(entry.url);
|
|
3495
|
+
} catch {
|
|
3496
|
+
return 'campo "url" n\xE3o \xE9 uma URL v\xE1lida.';
|
|
3472
3497
|
}
|
|
3473
|
-
if (entry.
|
|
3474
|
-
|
|
3498
|
+
if (entry.type !== void 0 && entry.type !== "http" && entry.type !== "sse") {
|
|
3499
|
+
return 'campo "type" deve ser "http" ou "sse".';
|
|
3475
3500
|
}
|
|
3476
|
-
if (entry.
|
|
3477
|
-
|
|
3501
|
+
if (entry.headers !== void 0 && !isStringRecord(entry.headers)) {
|
|
3502
|
+
return 'campo "headers" deve ser um mapa de strings.';
|
|
3478
3503
|
}
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
}
|
|
3482
|
-
|
|
3483
|
-
if (entry.env !== void 0) built.env = entry.env;
|
|
3484
|
-
if (entry.cwd !== void 0) built.cwd = entry.cwd;
|
|
3485
|
-
return built;
|
|
3504
|
+
if (entry.requestTimeoutMs !== void 0 && typeof entry.requestTimeoutMs !== "number") {
|
|
3505
|
+
return 'campo "requestTimeoutMs" deve ser n\xFAmero.';
|
|
3506
|
+
}
|
|
3507
|
+
return void 0;
|
|
3486
3508
|
}
|
|
3487
|
-
__name(
|
|
3509
|
+
__name(validarRemoto, "validarRemoto");
|
|
3488
3510
|
function descrever(err) {
|
|
3489
3511
|
return err instanceof Error ? err.message : String(err);
|
|
3490
3512
|
}
|
|
@@ -3710,4 +3732,4 @@ export {
|
|
|
3710
3732
|
generateAgentManifest,
|
|
3711
3733
|
agentsPlugin
|
|
3712
3734
|
};
|
|
3713
|
-
//# sourceMappingURL=chunk-
|
|
3735
|
+
//# sourceMappingURL=chunk-C5RUE4DB.js.map
|