@theokit/agents 0.36.0 → 0.38.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-DYXCEzdJ.d.ts → bridge-entry-C20NAna5.d.ts} +12 -6
- package/dist/bridge.d.ts +1 -1
- package/dist/bridge.js +1 -1
- package/dist/{chunk-RJTRE6BD.js → chunk-YRVPQ6QC.js} +20 -6
- package/dist/chunk-YRVPQ6QC.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-RJTRE6BD.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExecutionContext } from '@theokit/http';
|
|
2
2
|
import { A as AgentOptions, g as ToolOptions, M as MainLoopMeta, a as ApprovalOptions, B as BudgetOptions, H as HumanInTheLoopOptions, t as GatewayOptions, z as MemoryOptions, O as SkillsOptions, r as ContextWindowOptions, K as ProjectContextOptions, x as McpServersMap, G as Guardrail, o as CompactionDecoratorConfig, j as CheckpointOptions, R as ReasoningEffort } from './types-DVA4LQsA.js';
|
|
3
|
-
import { SystemPromptResolver, ConversationStorageAdapter, SkillsSettings, ContextSettings, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker, CustomTool, ModelSelection } from '@theokit/sdk';
|
|
3
|
+
import { InlineSkill, SystemPromptResolver, ConversationStorageAdapter, SkillsSettings, ContextSettings, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker, CustomTool, ModelSelection } from '@theokit/sdk';
|
|
4
4
|
import { UIMessageChunk } from 'ai';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { RetryOptions } from '@theokit/sdk/retry';
|
|
@@ -112,17 +112,23 @@ declare function validateUniqueRoutes(results: AgentWalkResult[]): void;
|
|
|
112
112
|
* different users. A selection is either a static list or a function of the request context (the M7
|
|
113
113
|
* run-context). Discovery + injection stay in the SDK; this only CHOOSES the enabled set per call.
|
|
114
114
|
*/
|
|
115
|
+
|
|
115
116
|
/** The request context handed to a skills resolver (the M7 run-context — opaque per-request data). */
|
|
116
117
|
type SkillsRequestContext = Record<string, unknown>;
|
|
117
118
|
/**
|
|
118
|
-
* How the
|
|
119
|
-
* - `string
|
|
120
|
-
* -
|
|
119
|
+
* How the skill set is chosen:
|
|
120
|
+
* - a static array of `string` (filesystem skill NAMES → `skills.enabled`) and/or `InlineSkill`
|
|
121
|
+
* objects from `createSkill` (code-defined skills → `skills.inline`, injected into the `<skills>`
|
|
122
|
+
* block). A mixed list is split at compile time.
|
|
123
|
+
* - a function — resolved per request from the {@link SkillsRequestContext} (sync or async). The
|
|
124
|
+
* resolver returns filesystem skill NAMES (inline skills are static — declared on the agent).
|
|
121
125
|
*/
|
|
122
|
-
type SkillsSelection = readonly string[] | ((ctx: SkillsRequestContext) => readonly string[] | Promise<readonly string[]>);
|
|
126
|
+
type SkillsSelection = readonly (string | InlineSkill)[] | ((ctx: SkillsRequestContext) => readonly string[] | Promise<readonly string[]>);
|
|
123
127
|
/**
|
|
124
128
|
* Resolve the enabled skill names for a request. Returns `undefined` when no selection is given (the
|
|
125
|
-
* SDK then enables every discovered skill). Fails fast if a resolver returns a non-array.
|
|
129
|
+
* SDK then enables every discovered skill). Fails fast if a resolver returns a non-array. The static
|
|
130
|
+
* array is compiled ahead of time (see `compileSkillsSelection`), so this is exercised for the
|
|
131
|
+
* resolver form; a static array is defensively narrowed to its string (name) members.
|
|
126
132
|
*/
|
|
127
133
|
declare function resolveEnabledSkills(selection: SkillsSelection | undefined, ctx: SkillsRequestContext): Promise<string[] | undefined>;
|
|
128
134
|
|
package/dist/bridge.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { c as AGENT_BRAND, d as AfterToolCallContext, e as AgentBuilder, f as AgentDefinition, g as AgentDefinitionError, h as AgentExecutionContext, i as AgentManifest, A as AgentManifestEntry, j as AgentManifestTool, k as AgentRoute, l as AgentRouteContext, m as AgentRunInfo, n as AgentStreamEvent, o as AgentWalkResult, p as AgentWarningCode, q as AgentsPluginOptions, r as ApiErrorContext, s as ApiErrorDecision, t as ApiErrorPolicy, u as ApprovalRequiredEvent, v as ArtifactChunkEvent, w as ArtifactStartEvent, B as BackgroundDelegation, x as BeforeToolCallContext, y as BudgetExceededError, z as CheckpointSavedEvent, C as CompiledAgentOptions, E as CompiledContextWindow, a as CompiledTool, F as ContextualTool, H as DefineAgentConfig, I as DelegateFn, J as DelegateOptions, K as DelegationError, D as DelegationResult, M as DoneEvent, N as ErrorEvent, O as FileEditEvent, Q as InferAgentInput, T as InferAgentToolNames, U as IterationEvent, V as LLMCallContext, Z as McpApprovalSpec, _ as McpRegistryConfig, $ as McpRequestContext, a0 as McpSelection, a1 as PartialToolCallEvent, a2 as ProcessInputContext, a6 as RunStartedEvent, a7 as ScoreVerdict, a8 as ScoredDelegation, a9 as Scorer, aa as SdkMessage, ab as Segment, ae as StateUpdateEvent, S as StreamEvent, af as TextDeltaEvent, ag as ThinkingEvent, ah as ToolCallEvent, ai as ToolCallVeto, aj as ToolHooks, ak as ToolHooksPlugin, al as ToolResultEvent, am as ToolWalkResult, an as ToolboxWalkResult, ao as agent, ap as agentsPlugin, aq as buildModelSelection, ar as compileAgent, as as compileAgentDefinition, at as compileAgentModule, au as compileContextWindow, av as compileProjectContext, aw as compileSkills, ax as compileTools, ay as contextualTool, az as createAgentExecutionContext, aA as createApiErrorHandler, aB as createSdkAgentStream, aC as createThinkTagExtractor, aD as createToolHooksPlugin, aE as delegate, aF as delegateBackground, aG as delegateWithScoring, aH as extractThinkTagStream, aI as generateAgentManifest, aJ as generateAgentRoutes, aK as isAgentContext, aL as isAgentDefinition, aM as isApprovalRequired, aN as isDone, aO as isError, aP as isPartialToolCall, aQ as isTextDelta, aR as isToolCall, aS as isToolResult, aV as mcpRegistry, aW as mcpToolApprovals, aY as projectContextMetadataOnlyKnobs, b0 as resolveMcpServers, b1 as runWithApiErrorHandling, b2 as streamAgentResponse, b3 as streamAgentUIMessages, b4 as translateSdkEvent, b5 as translateToUIMessageStream, b6 as validateUniqueRoutes, b7 as walkAgentMetadata } from './bridge-entry-
|
|
1
|
+
export { c as AGENT_BRAND, d as AfterToolCallContext, e as AgentBuilder, f as AgentDefinition, g as AgentDefinitionError, h as AgentExecutionContext, i as AgentManifest, A as AgentManifestEntry, j as AgentManifestTool, k as AgentRoute, l as AgentRouteContext, m as AgentRunInfo, n as AgentStreamEvent, o as AgentWalkResult, p as AgentWarningCode, q as AgentsPluginOptions, r as ApiErrorContext, s as ApiErrorDecision, t as ApiErrorPolicy, u as ApprovalRequiredEvent, v as ArtifactChunkEvent, w as ArtifactStartEvent, B as BackgroundDelegation, x as BeforeToolCallContext, y as BudgetExceededError, z as CheckpointSavedEvent, C as CompiledAgentOptions, E as CompiledContextWindow, a as CompiledTool, F as ContextualTool, H as DefineAgentConfig, I as DelegateFn, J as DelegateOptions, K as DelegationError, D as DelegationResult, M as DoneEvent, N as ErrorEvent, O as FileEditEvent, Q as InferAgentInput, T as InferAgentToolNames, U as IterationEvent, V as LLMCallContext, Z as McpApprovalSpec, _ as McpRegistryConfig, $ as McpRequestContext, a0 as McpSelection, a1 as PartialToolCallEvent, a2 as ProcessInputContext, a6 as RunStartedEvent, a7 as ScoreVerdict, a8 as ScoredDelegation, a9 as Scorer, aa as SdkMessage, ab as Segment, ae as StateUpdateEvent, S as StreamEvent, af as TextDeltaEvent, ag as ThinkingEvent, ah as ToolCallEvent, ai as ToolCallVeto, aj as ToolHooks, ak as ToolHooksPlugin, al as ToolResultEvent, am as ToolWalkResult, an as ToolboxWalkResult, ao as agent, ap as agentsPlugin, aq as buildModelSelection, ar as compileAgent, as as compileAgentDefinition, at as compileAgentModule, au as compileContextWindow, av as compileProjectContext, aw as compileSkills, ax as compileTools, ay as contextualTool, az as createAgentExecutionContext, aA as createApiErrorHandler, aB as createSdkAgentStream, aC as createThinkTagExtractor, aD as createToolHooksPlugin, aE as delegate, aF as delegateBackground, aG as delegateWithScoring, aH as extractThinkTagStream, aI as generateAgentManifest, aJ as generateAgentRoutes, aK as isAgentContext, aL as isAgentDefinition, aM as isApprovalRequired, aN as isDone, aO as isError, aP as isPartialToolCall, aQ as isTextDelta, aR as isToolCall, aS as isToolResult, aV as mcpRegistry, aW as mcpToolApprovals, aY as projectContextMetadataOnlyKnobs, b0 as resolveMcpServers, b1 as runWithApiErrorHandling, b2 as streamAgentResponse, b3 as streamAgentUIMessages, b4 as translateSdkEvent, b5 as translateToUIMessageStream, b6 as validateUniqueRoutes, b7 as walkAgentMetadata } from './bridge-entry-C20NAna5.js';
|
|
2
2
|
import '@theokit/http';
|
|
3
3
|
import './types-DVA4LQsA.js';
|
|
4
4
|
import '@theokit/sdk';
|
package/dist/bridge.js
CHANGED
|
@@ -999,7 +999,10 @@ async function loadSdkRuntime() {
|
|
|
999
999
|
Agent: sdk.Agent,
|
|
1000
1000
|
defineTool: sdk.defineTool,
|
|
1001
1001
|
InMemoryConversationStorage: InMemory,
|
|
1002
|
-
FileSystemConversationStorage: "FileSystemConversationStorage" in sdk ? sdk.FileSystemConversationStorage : InMemory
|
|
1002
|
+
FileSystemConversationStorage: "FileSystemConversationStorage" in sdk ? sdk.FileSystemConversationStorage : InMemory,
|
|
1003
|
+
..."defineSkillReadTool" in sdk ? {
|
|
1004
|
+
defineSkillReadTool: sdk.defineSkillReadTool
|
|
1005
|
+
} : {}
|
|
1003
1006
|
};
|
|
1004
1007
|
} catch (err) {
|
|
1005
1008
|
console.warn("[theokit] @theokit/sdk import failed:", err);
|
|
@@ -1197,6 +1200,10 @@ function createSdkAgentStream(compiled, compiledTools, apiKey, overrides = {}) {
|
|
|
1197
1200
|
}
|
|
1198
1201
|
const { InMemoryConversationStorage, FileSystemConversationStorage } = rt;
|
|
1199
1202
|
const sdkTools = buildSdkTools(compiledTools, rt.defineTool, overrides.sdkTools, runContext);
|
|
1203
|
+
const inlineSkills = compiled.skills?.inline;
|
|
1204
|
+
if (inlineSkills !== void 0 && inlineSkills.length > 0 && rt.defineSkillReadTool !== void 0 && !compiledTools.some((t) => t.name === "skill_read")) {
|
|
1205
|
+
sdkTools.push(rt.defineSkillReadTool(inlineSkills));
|
|
1206
|
+
}
|
|
1200
1207
|
let runContextSource;
|
|
1201
1208
|
if (overrides.runContext !== void 0) {
|
|
1202
1209
|
runContextSource = "per-run";
|
|
@@ -1505,12 +1512,19 @@ function compileSkillsSelection(skills) {
|
|
|
1505
1512
|
if (typeof skills === "function") return {
|
|
1506
1513
|
skillsResolver: skills
|
|
1507
1514
|
};
|
|
1515
|
+
const enabled = [];
|
|
1516
|
+
const inline = [];
|
|
1517
|
+
for (const entry of skills) {
|
|
1518
|
+
if (typeof entry === "string") enabled.push(entry);
|
|
1519
|
+
else inline.push(entry);
|
|
1520
|
+
}
|
|
1508
1521
|
return {
|
|
1509
1522
|
skills: {
|
|
1510
|
-
enabled
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1523
|
+
enabled,
|
|
1524
|
+
autoInject: true,
|
|
1525
|
+
...inline.length > 0 ? {
|
|
1526
|
+
inline
|
|
1527
|
+
} : {}
|
|
1514
1528
|
}
|
|
1515
1529
|
};
|
|
1516
1530
|
}
|
|
@@ -2969,4 +2983,4 @@ export {
|
|
|
2969
2983
|
generateAgentManifest,
|
|
2970
2984
|
agentsPlugin
|
|
2971
2985
|
};
|
|
2972
|
-
//# sourceMappingURL=chunk-
|
|
2986
|
+
//# sourceMappingURL=chunk-YRVPQ6QC.js.map
|