@theokit/agents 4.30.2 → 6.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/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 +25 -6
- package/dist/index.js +36 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-GGB5WXHS.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
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, GoalEvent, GoalLoopAgent, GoalOptions, GoalResult, JudgeCredentialError, JudgeResult, Provider, SDKAgent, SessionRecord, Squad, Tool, Verdict } from '@theokit/sdk';
|
|
3
|
+
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';
|
|
4
|
+
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
5
|
export * from '@theokit/sdk/errors';
|
|
4
6
|
export { ConfigurationError, BudgetExceededError as WindowBudgetExceededError } from '@theokit/sdk/errors';
|
|
5
|
-
import { PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition, BudgetTracker, CustomTool, GoalLoopAgent, GoalOptions, runGoalLoop, GoalEvent, GoalResult, InlineSkill } from '@theokit/sdk';
|
|
6
|
-
export { Agent, CustomTool, GoalEvent, GoalLoopAgent, GoalOptions, GoalResult, JudgeCredentialError, JudgeResult, Provider, SDKAgent, SessionRecord, Squad, Tool, Verdict } from '@theokit/sdk';
|
|
7
7
|
import { RetryOptions } from '@theokit/sdk/retry';
|
|
8
8
|
export * from '@theokit/sdk/retry';
|
|
9
9
|
import { CompressibleMessage } from '@theokit/sdk/compaction';
|
|
@@ -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,13 @@ 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
|
-
|
|
1121
|
+
type ListOptionsSemPaginacao = ListAgentsOptions & {
|
|
1122
|
+
limit?: never;
|
|
1123
|
+
cursor?: never;
|
|
1124
|
+
};
|
|
1125
|
+
type AgentComListaEstreitada = Omit<typeof Agent$1, 'list'> & {
|
|
1126
|
+
list(options?: ListOptionsSemPaginacao): Promise<Omit<ListResult<SDKAgentInfo>, 'nextCursor'>>;
|
|
1127
|
+
};
|
|
1128
|
+
declare const Agent: AgentComListaEstreitada;
|
|
1129
|
+
|
|
1130
|
+
export { type A2AAuth, type A2ACapabilities, type A2ASkill, type A2AToolConfig, AcpClient, AcpMessageDecoder, type AcpTransport, Agent, 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,11 +73,14 @@ 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";
|
|
80
80
|
|
|
81
|
+
// src/index.ts
|
|
82
|
+
import { Agent as AgentDoSdk } from "@theokit/sdk";
|
|
83
|
+
|
|
81
84
|
// src/capability/capability.ts
|
|
82
85
|
import { isDeepStrictEqual } from "util";
|
|
83
86
|
var CapabilityConflictError = class extends Error {
|
|
@@ -936,7 +939,7 @@ var AcpClient = class {
|
|
|
936
939
|
};
|
|
937
940
|
|
|
938
941
|
// src/index.ts
|
|
939
|
-
import {
|
|
942
|
+
import { Squad, Tool, Provider } from "@theokit/sdk";
|
|
940
943
|
import { SubAgent } from "@theokit/sdk/a2a";
|
|
941
944
|
import { assertNoSymlinkEscape, isForbiddenPath, safePathJoin } from "@theokit/sdk/path-safety";
|
|
942
945
|
import { CONTEXT_WINDOW_FLOOR, CONTEXT_WINDOW_MARGIN, ContextWindowMarginError, resolveEffectiveContextWindow } from "@theokit/sdk/compaction";
|
|
@@ -958,24 +961,45 @@ var InProcessApprovalRequiredError = class extends Error {
|
|
|
958
961
|
this.name = "InProcessApprovalRequiredError";
|
|
959
962
|
}
|
|
960
963
|
};
|
|
964
|
+
function resolvedorDaPostura(postura) {
|
|
965
|
+
if (postura === void 0) return void 0;
|
|
966
|
+
switch (postura.kind) {
|
|
967
|
+
case "interactive":
|
|
968
|
+
return postura.awaitApproval;
|
|
969
|
+
case "auto-approve":
|
|
970
|
+
return () => Promise.resolve({
|
|
971
|
+
approved: true,
|
|
972
|
+
reason: postura.reason
|
|
973
|
+
});
|
|
974
|
+
case "auto-reject":
|
|
975
|
+
return () => Promise.resolve({
|
|
976
|
+
approved: false,
|
|
977
|
+
reason: postura.reason
|
|
978
|
+
});
|
|
979
|
+
case "owned-by-surface":
|
|
980
|
+
return void 0;
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
__name(resolvedorDaPostura, "resolvedorDaPostura");
|
|
961
984
|
function streamAgentTurnInProcess(mod, apiKey, input, deps = {
|
|
962
985
|
stream: streamAgentUIMessages
|
|
963
986
|
}) {
|
|
964
987
|
const compiled = compileAgentModule(mod, input.source);
|
|
965
988
|
const gated = compiled.hitl;
|
|
966
|
-
if (gated && gated.size > 0 && !input.awaitApproval) {
|
|
989
|
+
if (gated && gated.size > 0 && !input.awaitApproval && input.approvals === void 0) {
|
|
967
990
|
throw new InProcessApprovalRequiredError([
|
|
968
991
|
...gated.keys()
|
|
969
992
|
]);
|
|
970
993
|
}
|
|
971
994
|
const resolve = input.awaitApproval;
|
|
972
|
-
const
|
|
995
|
+
const resolverDeAprovacao = resolve ? (approvalId, opts, toolName) => resolve({
|
|
996
|
+
approvalId,
|
|
997
|
+
toolName,
|
|
998
|
+
opts
|
|
999
|
+
}) : resolvedorDaPostura(input.approvals);
|
|
1000
|
+
const hitl = gated && gated.size > 0 && resolverDeAprovacao ? {
|
|
973
1001
|
gated,
|
|
974
|
-
awaitApproval:
|
|
975
|
-
approvalId,
|
|
976
|
-
toolName,
|
|
977
|
-
opts
|
|
978
|
-
}), "awaitApproval")
|
|
1002
|
+
awaitApproval: resolverDeAprovacao
|
|
979
1003
|
} : void 0;
|
|
980
1004
|
const sessionId = input.sessionId ?? crypto.randomUUID();
|
|
981
1005
|
return (async function* () {
|
|
@@ -999,6 +1023,9 @@ function streamAgentTurnInProcess(mod, apiKey, input, deps = {
|
|
|
999
1023
|
})();
|
|
1000
1024
|
}
|
|
1001
1025
|
__name(streamAgentTurnInProcess, "streamAgentTurnInProcess");
|
|
1026
|
+
|
|
1027
|
+
// src/index.ts
|
|
1028
|
+
var Agent = AgentDoSdk;
|
|
1002
1029
|
export {
|
|
1003
1030
|
AGENT_BRAND,
|
|
1004
1031
|
AcpClient,
|