@theokit/agents 4.30.2 → 5.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/LICENSE +201 -0
- package/dist/{bridge-entry-BL74g1Em.d.ts → bridge-entry-DD_j60GX.d.ts} +78 -42
- package/dist/bridge.d.ts +1 -1
- package/dist/bridge.js +1 -1
- package/dist/{chunk-GGB5WXHS.js → chunk-JXR45RAW.js} +166 -101
- package/dist/chunk-JXR45RAW.js.map +1 -0
- package/dist/index.d.ts +14 -4
- package/dist/index.js +29 -8
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
- package/dist/chunk-GGB5WXHS.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as Guardrail, L as LoopStrategy, R as ReflectionStrategy, C as CompiledAgentOptions, M as MainLoopMeta, a as CompiledTool, b as ReasoningEffort, c as RoundStreamFactory, S as StreamEvent, D as DelegationResult, d as ContextWindowOptions, e as SkillsOptions, T as ToolOptions, A as ApprovalOptions, H as HumanInTheLoopOptions, f as AgentManifestEntry, g as HitlDecision, s as streamAgentUIMessages } from './bridge-entry-
|
|
2
|
-
export {
|
|
1
|
+
import { G as Guardrail, L as LoopStrategy, R as ReflectionStrategy, C as CompiledAgentOptions, M as MainLoopMeta, a as CompiledTool, b as ReasoningEffort, c as RoundStreamFactory, S as StreamEvent, D as DelegationResult, d as ContextWindowOptions, e as SkillsOptions, T as ToolOptions, A as ApprovalOptions, H as HumanInTheLoopOptions, f as AgentManifestEntry, g as HitlDecision, s as streamAgentUIMessages, h as ApprovalPosture } from './bridge-entry-DD_j60GX.js';
|
|
2
|
+
export { i as AGENT_BRAND, j as AfterToolCallContext, k as AgentBuilder, l as AgentDefinition, m as AgentDefinitionError, n as AgentExecutionContext, o as AgentManifest, p as AgentManifestSource, q as AgentManifestTool, r as AgentOptions, 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, F as ApprovalRequiredEvent, I as ArtifactChunkEvent, J as ArtifactStartEvent, K as BackgroundDelegation, N as BeforeToolCallContext, O as BudgetExceededError, P as BudgetOptions, Q as CheckpointSavedEvent, U as CompiledContextWindow, V as ContextualTool, W as CostBudgetExceededError, X as DEFAULT_MAX_ITERATIONS, Y as DefineAgentConfig, Z as DefinicaoOuThunk, _ as DelegateFn, $ as DelegateOptions, a0 as DelegationBudgetExceededError, a1 as DelegationError, a2 as DoneEvent, a3 as ErrorEvent, a4 as FileEditEvent, a5 as GuardrailAction, a6 as GuardrailPhase, a7 as GuardrailResult, a8 as GuardrailViolationError, a9 as HookHandlers, aa as InferAgentInput, ab as InferAgentToolNames, ac as IterationEvent, ad as LLMCallContext, ae as LoopFinishReason, af as LoopOutcome, ag as LoopStrategyConfig, ah as MainLoopOptions, ai as McpApprovalSpec, aj as McpRegistryConfig, ak as McpRequestContext, al as McpSelection, am as PartialToolCallEvent, an as PolicyHandler, ao as ProcessInputContext, ap as ReflectionContext, aq as ReflectionResult, ar as ReflectionStrategyConfig, as as RunStartedEvent, at as ScoreVerdict, au as ScoredDelegation, av as Scorer, aw as SdkAgentHandle, ax as SdkMessage, ay as SdkSendOptions, az as SdkTurnHandle, aA as Segment, aB as SkillsRequestContext, aC as SkillsSelection, aD as StateUpdateEvent, aE as TextDeltaEvent, aF as ThinkingEvent, aG as TimeoutAction, aH as ToolCallEvent, aI as ToolCallVeto, aJ as ToolHooks, aK as ToolHooksPlugin, aL as ToolResultEvent, aM as ToolWalkResult, aN as ToolboxOptions, aO as ToolboxWalkResult, aP as agentsPlugin, aQ as buildModelSelection, aR as compileAgentDefinition, aS as compileAgentModule, aT as compileContextWindow, aU as compileProjectContext, aV as compileSkills, aW as compileTools, aX as createAgentExecutionContext, aY as createApiErrorHandler, aZ as createSdkAgentStream, a_ as createThinkTagExtractor, a$ as createToolHooksPlugin, b0 as delegate, b1 as delegateBackground, b2 as delegateWithScoring, b3 as extractThinkTagStream, b4 as generateAgentManifest, b5 as generateAgentRoutes, b6 as isAgentContext, b7 as isAgentDefinition, b8 as isApprovalRequired, b9 as isDone, ba as isError, bb as isPartialToolCall, bc as isTextDelta, bd as isToolCall, be as isToolResult, bf as ladderReflectionStrategy, bg as loopStrategyConfigSchema, bh as mcpRegistry, bi as mcpToolApprovals, bj as noopReflectionStrategy, bk as presentUIMessageStream, bl as projectContextMetadataOnlyKnobs, bm as reflectionStrategyConfigSchema, bn as resolveEnabledSkills, bo as resolveLoopStrategy, bp as resolveMcpServers, bq as runWithApiErrorHandling, br as streamAgentResponse, bs as toAgentFactory, bt as translateSdkEvent } from './bridge-entry-DD_j60GX.js';
|
|
3
3
|
export * from '@theokit/sdk/errors';
|
|
4
4
|
export { ConfigurationError, BudgetExceededError as WindowBudgetExceededError } from '@theokit/sdk/errors';
|
|
5
5
|
import { PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition, BudgetTracker, CustomTool, GoalLoopAgent, GoalOptions, runGoalLoop, GoalEvent, GoalResult, InlineSkill } from '@theokit/sdk';
|
|
@@ -14,7 +14,7 @@ export { assertNoSymlinkEscape, isForbiddenPath, safePathJoin } from '@theokit/s
|
|
|
14
14
|
export * from '@theokit/sdk/concurrency';
|
|
15
15
|
export * from '@theokit/sdk/messages';
|
|
16
16
|
export * from '@theokit/sdk/models';
|
|
17
|
-
export { discoverSubagents, loadSubagentDefinition } from '@theokit/sdk/subagents-loader';
|
|
17
|
+
export { AgentDefinition as SubagentDefinition, discoverSubagents, loadSubagentDefinition } from '@theokit/sdk/subagents-loader';
|
|
18
18
|
import { UIMessageChunk } from 'ai';
|
|
19
19
|
import '@theokit/http';
|
|
20
20
|
|
|
@@ -1083,6 +1083,16 @@ interface StreamAgentTurnInProcessInput {
|
|
|
1083
1083
|
* gated agent is a fail-fast error, never a silent bypass (Rule 8, the #99 lesson).
|
|
1084
1084
|
*/
|
|
1085
1085
|
awaitApproval?: InProcessAwaitApproval;
|
|
1086
|
+
/**
|
|
1087
|
+
* M96 — the declared {@link ApprovalPosture}, ADDITIVE by design (ADR D2 of the M96 plan).
|
|
1088
|
+
*
|
|
1089
|
+
* Omitting it preserves today's behaviour byte for byte, including the fail-closed refusal above:
|
|
1090
|
+
* this bridge was already the CORRECT side of the divergence the milestone closes, so breaking its
|
|
1091
|
+
* signature would charge five call sites — one of them outside this repo — a migration that fixes
|
|
1092
|
+
* no defect. What it lacked was the other half: the permissive posture was INEXPRESSIBLE here
|
|
1093
|
+
* while `toAgentFactory` reached it by omission. Naming it closes that asymmetry.
|
|
1094
|
+
*/
|
|
1095
|
+
approvals?: ApprovalPosture;
|
|
1086
1096
|
/** Labels a fail-fast `AgentDefinitionError` (the file path). */
|
|
1087
1097
|
source?: string;
|
|
1088
1098
|
/** Abort signal forwarded to the SDK stream (client disconnect / window close). */
|
|
@@ -1108,4 +1118,4 @@ declare class InProcessApprovalRequiredError extends Error {
|
|
|
1108
1118
|
*/
|
|
1109
1119
|
declare function streamAgentTurnInProcess(mod: unknown, apiKey: string, input: StreamAgentTurnInProcessInput, deps?: StreamAgentTurnDeps): AsyncGenerator<UIMessageChunk>;
|
|
1110
1120
|
|
|
1111
|
-
export { type A2AAuth, type A2ACapabilities, type A2ASkill, type A2AToolConfig, AcpClient, AcpMessageDecoder, type AcpTransport, type AgentCard, type AgentConfig, AgentConfigCapability, AgentManifestEntry, AgentRunner, AgentRunnerBuilder, type AgentRunnerRunOptions, ApprovalOptions, 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, HumanInTheLoopCapability, HumanInTheLoopOptions, type InProcessApprovalRequest, InProcessApprovalRequiredError, type InProcessAwaitApproval, LoopStrategy, MCP_PROTOCOL_VERSION, MainLoopCapability, MainLoopMeta, type McpJsonSchema, type McpServerInfo, McpServersCapability, type McpToolDescriptor, MemoryCapability, ModelCapability, type OutputModerationOptions, type PiiOptions, PluginsCapability, ProjectContextCapability, type PromptInjectionOptions, type ProvenanceEntry, ReasoningEffort, ReflectionStrategy, RoundStreamFactory, RunContextCapability, SettingSourcesCapability, 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, deriveConversationId, encodeAcpMessage, estimateTokens, mcpServerInfo, moderateOutputStream, outputModeration, parseConversationId, piiDetector, promptInjectionDetector, resolveCompactionStrategy, runInputGuards, runOutputGuards, setOnce, streamAgentTurnInProcess, streamAgentUIMessages, tokenBudgetCompactionStrategy, unicodeNormalizer, wellKnownCardPath };
|
|
1121
|
+
export { type A2AAuth, type A2ACapabilities, type A2ASkill, type A2AToolConfig, AcpClient, AcpMessageDecoder, type AcpTransport, type AgentCard, type AgentConfig, AgentConfigCapability, AgentManifestEntry, AgentRunner, AgentRunnerBuilder, type AgentRunnerRunOptions, 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, HumanInTheLoopCapability, HumanInTheLoopOptions, type InProcessApprovalRequest, InProcessApprovalRequiredError, type InProcessAwaitApproval, LoopStrategy, MCP_PROTOCOL_VERSION, MainLoopCapability, MainLoopMeta, type McpJsonSchema, type McpServerInfo, McpServersCapability, type McpToolDescriptor, MemoryCapability, ModelCapability, type OutputModerationOptions, type PiiOptions, PluginsCapability, ProjectContextCapability, type PromptInjectionOptions, type ProvenanceEntry, ReasoningEffort, ReflectionStrategy, RoundStreamFactory, RunContextCapability, SettingSourcesCapability, 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, deriveConversationId, encodeAcpMessage, estimateTokens, mcpServerInfo, moderateOutputStream, outputModeration, parseConversationId, piiDetector, promptInjectionDetector, resolveCompactionStrategy, runInputGuards, runOutputGuards, setOnce, streamAgentTurnInProcess, streamAgentUIMessages, tokenBudgetCompactionStrategy, unicodeNormalizer, wellKnownCardPath };
|
package/dist/index.js
CHANGED
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
toolRuntimeName,
|
|
74
74
|
translateSdkEvent,
|
|
75
75
|
unicodeNormalizer
|
|
76
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-JXR45RAW.js";
|
|
77
77
|
import {
|
|
78
78
|
__name
|
|
79
79
|
} from "./chunk-7QVYU63E.js";
|
|
@@ -958,24 +958,45 @@ var InProcessApprovalRequiredError = class extends Error {
|
|
|
958
958
|
this.name = "InProcessApprovalRequiredError";
|
|
959
959
|
}
|
|
960
960
|
};
|
|
961
|
+
function resolvedorDaPostura(postura) {
|
|
962
|
+
if (postura === void 0) return void 0;
|
|
963
|
+
switch (postura.kind) {
|
|
964
|
+
case "interactive":
|
|
965
|
+
return postura.awaitApproval;
|
|
966
|
+
case "auto-approve":
|
|
967
|
+
return () => Promise.resolve({
|
|
968
|
+
approved: true,
|
|
969
|
+
reason: postura.reason
|
|
970
|
+
});
|
|
971
|
+
case "auto-reject":
|
|
972
|
+
return () => Promise.resolve({
|
|
973
|
+
approved: false,
|
|
974
|
+
reason: postura.reason
|
|
975
|
+
});
|
|
976
|
+
case "owned-by-surface":
|
|
977
|
+
return void 0;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
__name(resolvedorDaPostura, "resolvedorDaPostura");
|
|
961
981
|
function streamAgentTurnInProcess(mod, apiKey, input, deps = {
|
|
962
982
|
stream: streamAgentUIMessages
|
|
963
983
|
}) {
|
|
964
984
|
const compiled = compileAgentModule(mod, input.source);
|
|
965
985
|
const gated = compiled.hitl;
|
|
966
|
-
if (gated && gated.size > 0 && !input.awaitApproval) {
|
|
986
|
+
if (gated && gated.size > 0 && !input.awaitApproval && input.approvals === void 0) {
|
|
967
987
|
throw new InProcessApprovalRequiredError([
|
|
968
988
|
...gated.keys()
|
|
969
989
|
]);
|
|
970
990
|
}
|
|
971
991
|
const resolve = input.awaitApproval;
|
|
972
|
-
const
|
|
992
|
+
const resolverDeAprovacao = resolve ? (approvalId, opts, toolName) => resolve({
|
|
993
|
+
approvalId,
|
|
994
|
+
toolName,
|
|
995
|
+
opts
|
|
996
|
+
}) : resolvedorDaPostura(input.approvals);
|
|
997
|
+
const hitl = gated && gated.size > 0 && resolverDeAprovacao ? {
|
|
973
998
|
gated,
|
|
974
|
-
awaitApproval:
|
|
975
|
-
approvalId,
|
|
976
|
-
toolName,
|
|
977
|
-
opts
|
|
978
|
-
}), "awaitApproval")
|
|
999
|
+
awaitApproval: resolverDeAprovacao
|
|
979
1000
|
} : void 0;
|
|
980
1001
|
const sessionId = input.sessionId ?? crypto.randomUUID();
|
|
981
1002
|
return (async function* () {
|