@theokit/agents 0.1.0-alpha.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.d.ts +374 -0
- package/dist/bridge.js +38 -0
- package/dist/bridge.js.map +1 -0
- package/dist/chunk-3LCIXX3T.js +185 -0
- package/dist/chunk-3LCIXX3T.js.map +1 -0
- package/dist/chunk-XUACDN32.js +342 -0
- package/dist/chunk-XUACDN32.js.map +1 -0
- package/dist/chunk-YK76AQNU.js +461 -0
- package/dist/chunk-YK76AQNU.js.map +1 -0
- package/dist/decorators.d.ts +244 -0
- package/dist/decorators.js +113 -0
- package/dist/decorators.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +147 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-DmtwLSF-.d.ts +135 -0
- package/package.json +45 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { A as AgentOptions, d as MainLoopOptions, c as MainLoopMeta, T as ToolOptions, n as ToolboxOptions, B as BudgetOptions, k as PolicyHandler, a as ApprovalOptions } from './mcp-DmtwLSF-.js';
|
|
2
|
+
export { G as Gateway, b as GatewayOptions, M as MCP, e as McpServerConfig, f as McpServersMap, g as Memory, h as MemoryOptions, i as MemoryProvider, j as MemoryScope, P as PlatformName, S as SessionStrategy, l as Skills, m as SkillsOptions, o as getGatewayConfig, p as getMcpConfig, q as getMemoryConfig, r as getSkillsConfig, s as resolveSessionId } from './mcp-DmtwLSF-.js';
|
|
3
|
+
import 'zod';
|
|
4
|
+
|
|
5
|
+
declare function Agent(options: AgentOptions): ClassDecorator;
|
|
6
|
+
declare function getAgentConfig(target: Function): AgentOptions | undefined;
|
|
7
|
+
|
|
8
|
+
declare function MainLoop(options?: MainLoopOptions): MethodDecorator;
|
|
9
|
+
declare function getMainLoop(target: Function): MainLoopMeta | undefined;
|
|
10
|
+
|
|
11
|
+
declare function Toolbox(options?: ToolboxOptions): ClassDecorator;
|
|
12
|
+
declare function Tool(options: ToolOptions): MethodDecorator;
|
|
13
|
+
declare function getToolboxConfig(target: Function): ToolboxOptions | undefined;
|
|
14
|
+
declare function getToolMethods(target: Function): (string | symbol)[];
|
|
15
|
+
declare function getToolConfig(target: Function, propertyKey: string | symbol): ToolOptions | undefined;
|
|
16
|
+
|
|
17
|
+
/** Mark a tool as requiring human approval before execution. */
|
|
18
|
+
declare const RequiresApproval: (value: ApprovalOptions) => MethodDecorator & ClassDecorator;
|
|
19
|
+
/** Require specific capabilities (permissions) to execute a tool. */
|
|
20
|
+
declare const RequiresCapability: (value: string[]) => MethodDecorator & ClassDecorator;
|
|
21
|
+
/** Set a cost budget for an agent or tool scope. */
|
|
22
|
+
declare const Budget: (value: BudgetOptions) => MethodDecorator & ClassDecorator;
|
|
23
|
+
/** Attach policy handler functions (CASL-style authorization). */
|
|
24
|
+
declare const Policy: (value: PolicyHandler[]) => MethodDecorator & ClassDecorator;
|
|
25
|
+
|
|
26
|
+
/** Enable distributed tracing for a tool/toolbox/agent. */
|
|
27
|
+
declare const Trace: (value: boolean) => MethodDecorator & ClassDecorator;
|
|
28
|
+
/** Enable audit logging for a tool/toolbox/agent. */
|
|
29
|
+
declare const Audit: (value: boolean) => MethodDecorator & ClassDecorator;
|
|
30
|
+
|
|
31
|
+
declare function SubAgents(agentClasses: Function[]): ClassDecorator;
|
|
32
|
+
declare function getSubAgents(target: Function): Function[];
|
|
33
|
+
|
|
34
|
+
type HookPoint = 'before:llm-call' | 'after:llm-call' | 'before:tool-call' | 'after:tool-call' | 'on:iteration' | 'on:complete' | 'on:error';
|
|
35
|
+
interface HookEntry {
|
|
36
|
+
point: HookPoint;
|
|
37
|
+
propertyKey: string | symbol;
|
|
38
|
+
}
|
|
39
|
+
declare function Hook(point: HookPoint): MethodDecorator;
|
|
40
|
+
declare function getHooks(target: Function): HookEntry[];
|
|
41
|
+
declare function getHooksByPoint(target: Function, point: HookPoint): HookEntry[];
|
|
42
|
+
|
|
43
|
+
type ConversationStorage = 'memory' | 'filesystem' | 'drizzle' | 'redis';
|
|
44
|
+
type CompactionStrategy = 'truncate' | 'summarize' | 'sliding-window';
|
|
45
|
+
interface ConversationOptions {
|
|
46
|
+
/** Storage backend for conversation history. */
|
|
47
|
+
storage?: ConversationStorage;
|
|
48
|
+
/** Maximum messages before compaction triggers (0 = no limit). */
|
|
49
|
+
maxHistory?: number;
|
|
50
|
+
/** How to compact when maxHistory is exceeded. */
|
|
51
|
+
compaction?: CompactionStrategy;
|
|
52
|
+
/** Time-to-live in milliseconds before conversation expires (0 = never). */
|
|
53
|
+
ttl?: number;
|
|
54
|
+
/** Number of recent messages to always preserve during compaction. */
|
|
55
|
+
preserveLastN?: number;
|
|
56
|
+
}
|
|
57
|
+
declare function Conversation(options?: ConversationOptions): ClassDecorator;
|
|
58
|
+
declare function getConversationConfig(target: Function): ConversationOptions | undefined;
|
|
59
|
+
|
|
60
|
+
type TimeoutAction = 'abort' | 'proceed' | 'retry';
|
|
61
|
+
interface HumanInTheLoopOptions {
|
|
62
|
+
/** Question shown to the human approver. */
|
|
63
|
+
question: string;
|
|
64
|
+
/** Timeout in milliseconds before onTimeout fires (default: 300_000 = 5 min). */
|
|
65
|
+
timeout?: number;
|
|
66
|
+
/** Action when timeout expires (default: 'abort'). */
|
|
67
|
+
onTimeout?: TimeoutAction;
|
|
68
|
+
/** Show the tool input to the approver (default: true). */
|
|
69
|
+
showInput?: boolean;
|
|
70
|
+
}
|
|
71
|
+
declare function HumanInTheLoop(options: HumanInTheLoopOptions): MethodDecorator;
|
|
72
|
+
declare function getHumanInTheLoopConfig(target: Function, propertyKey: string | symbol): HumanInTheLoopOptions | undefined;
|
|
73
|
+
|
|
74
|
+
type ContextCompactionStrategy = 'truncate-oldest' | 'summarize-oldest' | 'sliding-window' | 'priority-based';
|
|
75
|
+
interface ContextWindowOptions {
|
|
76
|
+
/** Maximum tokens before compaction triggers. */
|
|
77
|
+
maxTokens?: number;
|
|
78
|
+
/** How to compact when maxTokens is exceeded. */
|
|
79
|
+
compactionStrategy?: ContextCompactionStrategy;
|
|
80
|
+
/** Always preserve the system prompt during compaction (default: true). */
|
|
81
|
+
preserveSystemPrompt?: boolean;
|
|
82
|
+
/** Number of recent messages to always keep intact (default: 10). */
|
|
83
|
+
preserveLastN?: number;
|
|
84
|
+
/** Keep all tool results even during compaction (default: true). */
|
|
85
|
+
preserveToolResults?: boolean;
|
|
86
|
+
}
|
|
87
|
+
declare function ContextWindow(options?: ContextWindowOptions): ClassDecorator;
|
|
88
|
+
declare function getContextWindowConfig(target: Function): ContextWindowOptions | undefined;
|
|
89
|
+
|
|
90
|
+
/** Override the LLM model for an agent class or a specific tool method. */
|
|
91
|
+
declare const Model: (value: string) => MethodDecorator & ClassDecorator;
|
|
92
|
+
|
|
93
|
+
interface ArtifactOptions {
|
|
94
|
+
/** MIME type of the artifact output. */
|
|
95
|
+
mimeType: string;
|
|
96
|
+
/** Whether the artifact can be streamed in chunks (default: true). */
|
|
97
|
+
streamable?: boolean;
|
|
98
|
+
/** Maximum size in bytes (0 = no limit). */
|
|
99
|
+
maxSize?: number;
|
|
100
|
+
}
|
|
101
|
+
/** Return type for tools decorated with @Artifact. */
|
|
102
|
+
interface ArtifactResult {
|
|
103
|
+
/** The artifact content (string for text, Buffer for binary). */
|
|
104
|
+
content: string;
|
|
105
|
+
/** Optional filename hint for the client. */
|
|
106
|
+
filename?: string;
|
|
107
|
+
/** Optional metadata attached to the artifact. */
|
|
108
|
+
metadata?: Record<string, unknown>;
|
|
109
|
+
}
|
|
110
|
+
declare function Artifact(options: ArtifactOptions): MethodDecorator;
|
|
111
|
+
declare function getArtifactConfig(target: Function, propertyKey: string | symbol): ArtifactOptions | undefined;
|
|
112
|
+
|
|
113
|
+
type CheckpointStrategy = 'after-tool-call' | 'after-iteration' | 'manual';
|
|
114
|
+
type CheckpointStorage = 'memory' | 'filesystem' | 'drizzle' | 'redis';
|
|
115
|
+
interface CheckpointOptions {
|
|
116
|
+
/** Where to persist checkpoints. */
|
|
117
|
+
storage?: CheckpointStorage;
|
|
118
|
+
/** When to auto-checkpoint (default: 'after-tool-call'). */
|
|
119
|
+
strategy?: CheckpointStrategy;
|
|
120
|
+
/** Maximum checkpoints to retain per run (rolling window). */
|
|
121
|
+
maxCheckpoints?: number;
|
|
122
|
+
/** Time-to-live in ms before checkpoints expire (default: 3_600_000 = 1h). */
|
|
123
|
+
ttl?: number;
|
|
124
|
+
}
|
|
125
|
+
/** Serializable checkpoint state. */
|
|
126
|
+
interface CheckpointState {
|
|
127
|
+
id: string;
|
|
128
|
+
runId: string;
|
|
129
|
+
agentName: string;
|
|
130
|
+
step: number;
|
|
131
|
+
messages: unknown[];
|
|
132
|
+
toolResults: unknown[];
|
|
133
|
+
createdAt: number;
|
|
134
|
+
resumeToken: string;
|
|
135
|
+
}
|
|
136
|
+
declare function Checkpoint(options?: CheckpointOptions): ClassDecorator;
|
|
137
|
+
declare function getCheckpointConfig(target: Function): CheckpointOptions | undefined;
|
|
138
|
+
|
|
139
|
+
interface ObservableEntry {
|
|
140
|
+
channel: string;
|
|
141
|
+
propertyKey: string | symbol;
|
|
142
|
+
}
|
|
143
|
+
declare function Observable(channel: string): MethodDecorator;
|
|
144
|
+
declare function getObservables(target: Function): ObservableEntry[];
|
|
145
|
+
declare function getObservableByChannel(target: Function, channel: string): ObservableEntry | undefined;
|
|
146
|
+
|
|
147
|
+
interface FilesystemPermissions {
|
|
148
|
+
/** Glob patterns for allowed read paths. */
|
|
149
|
+
read?: string[];
|
|
150
|
+
/** Glob patterns for allowed write paths. */
|
|
151
|
+
write?: string[];
|
|
152
|
+
/** Glob patterns for DENIED paths (overrides read/write). */
|
|
153
|
+
deny?: string[];
|
|
154
|
+
}
|
|
155
|
+
interface CommandPermissions {
|
|
156
|
+
/** Command prefixes allowed to execute. */
|
|
157
|
+
allow?: string[];
|
|
158
|
+
/** Command prefixes denied (overrides allow). */
|
|
159
|
+
deny?: string[];
|
|
160
|
+
}
|
|
161
|
+
interface SandboxOptions {
|
|
162
|
+
/** Filesystem read/write permissions. */
|
|
163
|
+
filesystem?: FilesystemPermissions;
|
|
164
|
+
/** Shell command execution permissions. */
|
|
165
|
+
commands?: CommandPermissions;
|
|
166
|
+
/** Allow outbound network from tools (default: true). */
|
|
167
|
+
network?: boolean;
|
|
168
|
+
/** Maximum execution time per command in ms (default: 120_000). */
|
|
169
|
+
commandTimeout?: number;
|
|
170
|
+
/** Working directory root (default: process.cwd()). */
|
|
171
|
+
cwd?: string;
|
|
172
|
+
}
|
|
173
|
+
declare function Sandbox(options: SandboxOptions): ClassDecorator;
|
|
174
|
+
declare function getSandboxConfig(target: Function): SandboxOptions | undefined;
|
|
175
|
+
/**
|
|
176
|
+
* Check if a file path is allowed for the given operation.
|
|
177
|
+
* Deny patterns always win over allow patterns.
|
|
178
|
+
*/
|
|
179
|
+
declare function isPathAllowed(sandbox: SandboxOptions, filePath: string, operation: 'read' | 'write'): boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Check if a command is allowed to execute.
|
|
182
|
+
* Deny patterns always win over allow patterns.
|
|
183
|
+
*/
|
|
184
|
+
declare function isCommandAllowed(sandbox: SandboxOptions, command: string): boolean;
|
|
185
|
+
|
|
186
|
+
type EditFormatType = 'search-replace' | 'unified-diff' | 'full-file' | 'line-range';
|
|
187
|
+
/** Declare the edit format a tool produces. */
|
|
188
|
+
declare const EditFormat: (value: EditFormatType) => MethodDecorator & ClassDecorator;
|
|
189
|
+
|
|
190
|
+
type IndexStrategy = 'tree-sitter' | 'regex' | 'none';
|
|
191
|
+
type RelevanceStrategy = 'git-history' | 'import-graph' | 'semantic' | 'manual';
|
|
192
|
+
interface ProjectContextOptions {
|
|
193
|
+
/** Files that mark the project root (searched upward from cwd). */
|
|
194
|
+
rootMarkers?: string[];
|
|
195
|
+
/** How to index the codebase for structural understanding. */
|
|
196
|
+
indexStrategy?: IndexStrategy;
|
|
197
|
+
/** Maximum files to include in context per request. */
|
|
198
|
+
maxFilesInContext?: number;
|
|
199
|
+
/** How to rank file relevance when selecting context. */
|
|
200
|
+
relevanceStrategy?: RelevanceStrategy;
|
|
201
|
+
/** Glob patterns to exclude from indexing and context. */
|
|
202
|
+
ignorePatterns?: string[];
|
|
203
|
+
/** File extensions to include in indexing (default: all text files). */
|
|
204
|
+
includeExtensions?: string[];
|
|
205
|
+
}
|
|
206
|
+
declare function ProjectContext(options?: ProjectContextOptions): ClassDecorator;
|
|
207
|
+
declare function getProjectContextConfig(target: Function): ProjectContextOptions | undefined;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* applyDecorators() — compose multiple decorators into a single reusable decorator.
|
|
211
|
+
*
|
|
212
|
+
* NestJS-compatible utility. Enables creating "preset" decorators that bundle
|
|
213
|
+
* common configurations (auth + throttle + trace + memory + ...) into one decorator.
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```ts
|
|
217
|
+
* // Create a reusable preset
|
|
218
|
+
* const ProductionAgent = (name: string, route: string) => applyDecorators(
|
|
219
|
+
* Agent({ name, route, model: 'claude-sonnet-4-5-20250929' }),
|
|
220
|
+
* UseGuards(AuthGuard, TenantGuard),
|
|
221
|
+
* Throttle({ limit: 30, ttl: 60_000 }),
|
|
222
|
+
* Budget({ maxCostUsd: 5.00 }),
|
|
223
|
+
* Trace(true),
|
|
224
|
+
* )
|
|
225
|
+
*
|
|
226
|
+
* // Apply preset to any agent
|
|
227
|
+
* @ProductionAgent('support', '/api/agents/support')
|
|
228
|
+
* class SupportAgent {
|
|
229
|
+
* @MainLoop()
|
|
230
|
+
* async run() {}
|
|
231
|
+
* }
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
type AnyDecorator = ClassDecorator | MethodDecorator | PropertyDecorator;
|
|
235
|
+
/**
|
|
236
|
+
* Compose multiple decorators into a single decorator.
|
|
237
|
+
* Works for both class-level and method-level decorators.
|
|
238
|
+
*/
|
|
239
|
+
declare function applyDecorators(...decorators: AnyDecorator[]): ClassDecorator & MethodDecorator;
|
|
240
|
+
|
|
241
|
+
declare function Mixin(...mixinClasses: Function[]): ClassDecorator;
|
|
242
|
+
declare function getMixins(target: Function): Function[];
|
|
243
|
+
|
|
244
|
+
export { Agent, AgentOptions, ApprovalOptions, Artifact, type ArtifactOptions, type ArtifactResult, Audit, Budget, BudgetOptions, Checkpoint, type CheckpointOptions, type CheckpointState, type CheckpointStorage, type CheckpointStrategy, type CommandPermissions, type CompactionStrategy, type ContextCompactionStrategy, ContextWindow, type ContextWindowOptions, Conversation, type ConversationOptions, type ConversationStorage, EditFormat, type EditFormatType, type FilesystemPermissions, Hook, type HookEntry, type HookPoint, HumanInTheLoop, type HumanInTheLoopOptions, type IndexStrategy, MainLoop, MainLoopMeta, MainLoopOptions, Mixin, Model, Observable, type ObservableEntry, Policy, PolicyHandler, ProjectContext, type ProjectContextOptions, type RelevanceStrategy, RequiresApproval, RequiresCapability, Sandbox, type SandboxOptions, SubAgents, type TimeoutAction, Tool, ToolOptions, Toolbox, ToolboxOptions, Trace, applyDecorators, getAgentConfig, getArtifactConfig, getCheckpointConfig, getContextWindowConfig, getConversationConfig, getHooks, getHooksByPoint, getHumanInTheLoopConfig, getMainLoop, getMixins, getObservableByChannel, getObservables, getProjectContextConfig, getSandboxConfig, getSubAgents, getToolConfig, getToolMethods, getToolboxConfig, isCommandAllowed, isPathAllowed };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Artifact,
|
|
3
|
+
Checkpoint,
|
|
4
|
+
ContextWindow,
|
|
5
|
+
Conversation,
|
|
6
|
+
EditFormat,
|
|
7
|
+
Hook,
|
|
8
|
+
HumanInTheLoop,
|
|
9
|
+
MainLoop,
|
|
10
|
+
Model,
|
|
11
|
+
Observable,
|
|
12
|
+
ProjectContext,
|
|
13
|
+
Sandbox,
|
|
14
|
+
Tool,
|
|
15
|
+
Toolbox,
|
|
16
|
+
applyDecorators,
|
|
17
|
+
getArtifactConfig,
|
|
18
|
+
getCheckpointConfig,
|
|
19
|
+
getContextWindowConfig,
|
|
20
|
+
getConversationConfig,
|
|
21
|
+
getHooks,
|
|
22
|
+
getHooksByPoint,
|
|
23
|
+
getHumanInTheLoopConfig,
|
|
24
|
+
getMainLoop,
|
|
25
|
+
getObservableByChannel,
|
|
26
|
+
getObservables,
|
|
27
|
+
getProjectContextConfig,
|
|
28
|
+
getSandboxConfig,
|
|
29
|
+
getToolConfig,
|
|
30
|
+
getToolMethods,
|
|
31
|
+
getToolboxConfig,
|
|
32
|
+
isCommandAllowed,
|
|
33
|
+
isPathAllowed
|
|
34
|
+
} from "./chunk-XUACDN32.js";
|
|
35
|
+
import {
|
|
36
|
+
Agent,
|
|
37
|
+
Audit,
|
|
38
|
+
Budget,
|
|
39
|
+
Gateway,
|
|
40
|
+
MCP,
|
|
41
|
+
Memory,
|
|
42
|
+
Mixin,
|
|
43
|
+
Policy,
|
|
44
|
+
RequiresApproval,
|
|
45
|
+
RequiresCapability,
|
|
46
|
+
Skills,
|
|
47
|
+
SubAgents,
|
|
48
|
+
Trace,
|
|
49
|
+
getAgentConfig,
|
|
50
|
+
getGatewayConfig,
|
|
51
|
+
getMcpConfig,
|
|
52
|
+
getMemoryConfig,
|
|
53
|
+
getMixins,
|
|
54
|
+
getSkillsConfig,
|
|
55
|
+
getSubAgents,
|
|
56
|
+
resolveSessionId
|
|
57
|
+
} from "./chunk-3LCIXX3T.js";
|
|
58
|
+
export {
|
|
59
|
+
Agent,
|
|
60
|
+
Artifact,
|
|
61
|
+
Audit,
|
|
62
|
+
Budget,
|
|
63
|
+
Checkpoint,
|
|
64
|
+
ContextWindow,
|
|
65
|
+
Conversation,
|
|
66
|
+
EditFormat,
|
|
67
|
+
Gateway,
|
|
68
|
+
Hook,
|
|
69
|
+
HumanInTheLoop,
|
|
70
|
+
MCP,
|
|
71
|
+
MainLoop,
|
|
72
|
+
Memory,
|
|
73
|
+
Mixin,
|
|
74
|
+
Model,
|
|
75
|
+
Observable,
|
|
76
|
+
Policy,
|
|
77
|
+
ProjectContext,
|
|
78
|
+
RequiresApproval,
|
|
79
|
+
RequiresCapability,
|
|
80
|
+
Sandbox,
|
|
81
|
+
Skills,
|
|
82
|
+
SubAgents,
|
|
83
|
+
Tool,
|
|
84
|
+
Toolbox,
|
|
85
|
+
Trace,
|
|
86
|
+
applyDecorators,
|
|
87
|
+
getAgentConfig,
|
|
88
|
+
getArtifactConfig,
|
|
89
|
+
getCheckpointConfig,
|
|
90
|
+
getContextWindowConfig,
|
|
91
|
+
getConversationConfig,
|
|
92
|
+
getGatewayConfig,
|
|
93
|
+
getHooks,
|
|
94
|
+
getHooksByPoint,
|
|
95
|
+
getHumanInTheLoopConfig,
|
|
96
|
+
getMainLoop,
|
|
97
|
+
getMcpConfig,
|
|
98
|
+
getMemoryConfig,
|
|
99
|
+
getMixins,
|
|
100
|
+
getObservableByChannel,
|
|
101
|
+
getObservables,
|
|
102
|
+
getProjectContextConfig,
|
|
103
|
+
getSandboxConfig,
|
|
104
|
+
getSkillsConfig,
|
|
105
|
+
getSubAgents,
|
|
106
|
+
getToolConfig,
|
|
107
|
+
getToolMethods,
|
|
108
|
+
getToolboxConfig,
|
|
109
|
+
isCommandAllowed,
|
|
110
|
+
isPathAllowed,
|
|
111
|
+
resolveSessionId
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=decorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Agent, Artifact, ArtifactOptions, ArtifactResult, Audit, Budget, Checkpoint, CheckpointOptions, CheckpointState, CheckpointStorage, CheckpointStrategy, CommandPermissions, CompactionStrategy, ContextCompactionStrategy, ContextWindow, ContextWindowOptions, Conversation, ConversationOptions, ConversationStorage, EditFormat, EditFormatType, FilesystemPermissions, Hook, HookEntry, HookPoint, HumanInTheLoop, HumanInTheLoopOptions, IndexStrategy, MainLoop, Mixin, Model, Observable, ObservableEntry, Policy, ProjectContext, ProjectContextOptions, RelevanceStrategy, RequiresApproval, RequiresCapability, Sandbox, SandboxOptions, SubAgents, TimeoutAction, Tool, Toolbox, Trace, applyDecorators, getAgentConfig, getArtifactConfig, getCheckpointConfig, getContextWindowConfig, getConversationConfig, getHooks, getHooksByPoint, getHumanInTheLoopConfig, getMainLoop, getMixins, getObservableByChannel, getObservables, getProjectContextConfig, getSandboxConfig, getSubAgents, getToolConfig, getToolMethods, getToolboxConfig, isCommandAllowed, isPathAllowed } from './decorators.js';
|
|
2
|
+
export { A as AgentOptions, a as ApprovalOptions, B as BudgetOptions, G as Gateway, b as GatewayOptions, M as MCP, c as MainLoopMeta, d as MainLoopOptions, e as McpServerConfig, f as McpServersMap, g as Memory, h as MemoryOptions, i as MemoryProvider, j as MemoryScope, P as PlatformName, k as PolicyHandler, S as SessionStrategy, l as Skills, m as SkillsOptions, T as ToolOptions, n as ToolboxOptions, o as getGatewayConfig, p as getMcpConfig, q as getMemoryConfig, r as getSkillsConfig, s as resolveSessionId } from './mcp-DmtwLSF-.js';
|
|
3
|
+
export { AgentExecutionContext, AgentManifest, AgentManifestEntry, AgentManifestTool, AgentRoute, AgentRouteContext, AgentRunInfo, AgentStreamEvent, AgentWalkResult, AgentsPluginOptions, ApprovalRequiredEvent, ArtifactChunkEvent, ArtifactStartEvent, CheckpointSavedEvent, CompiledAgentOptions, CompiledTool, DoneEvent, ErrorEvent, FileEditEvent, IterationEvent, RunStartedEvent, StateUpdateEvent, StreamEvent, TextDeltaEvent, ThinkingEvent, ToolCallEvent, ToolResultEvent, ToolWalkResult, ToolboxWalkResult, agentsPlugin, compileAgent, compileTools, createAgentExecutionContext, generateAgentManifest, generateAgentRoutes, isAgentContext, isApprovalRequired, isDone, isError, isTextDelta, isToolCall, isToolResult, streamAgentResponse, validateUniqueRoutes, walkAgentMetadata } from './bridge.js';
|
|
4
|
+
import 'zod';
|
|
5
|
+
import '@theokit/http-decorators';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Artifact,
|
|
3
|
+
Checkpoint,
|
|
4
|
+
ContextWindow,
|
|
5
|
+
Conversation,
|
|
6
|
+
EditFormat,
|
|
7
|
+
Hook,
|
|
8
|
+
HumanInTheLoop,
|
|
9
|
+
MainLoop,
|
|
10
|
+
Model,
|
|
11
|
+
Observable,
|
|
12
|
+
ProjectContext,
|
|
13
|
+
Sandbox,
|
|
14
|
+
Tool,
|
|
15
|
+
Toolbox,
|
|
16
|
+
applyDecorators,
|
|
17
|
+
getArtifactConfig,
|
|
18
|
+
getCheckpointConfig,
|
|
19
|
+
getContextWindowConfig,
|
|
20
|
+
getConversationConfig,
|
|
21
|
+
getHooks,
|
|
22
|
+
getHooksByPoint,
|
|
23
|
+
getHumanInTheLoopConfig,
|
|
24
|
+
getMainLoop,
|
|
25
|
+
getObservableByChannel,
|
|
26
|
+
getObservables,
|
|
27
|
+
getProjectContextConfig,
|
|
28
|
+
getSandboxConfig,
|
|
29
|
+
getToolConfig,
|
|
30
|
+
getToolMethods,
|
|
31
|
+
getToolboxConfig,
|
|
32
|
+
isCommandAllowed,
|
|
33
|
+
isPathAllowed
|
|
34
|
+
} from "./chunk-XUACDN32.js";
|
|
35
|
+
import {
|
|
36
|
+
agentsPlugin,
|
|
37
|
+
compileAgent,
|
|
38
|
+
compileTools,
|
|
39
|
+
createAgentExecutionContext,
|
|
40
|
+
generateAgentManifest,
|
|
41
|
+
generateAgentRoutes,
|
|
42
|
+
isAgentContext,
|
|
43
|
+
isApprovalRequired,
|
|
44
|
+
isDone,
|
|
45
|
+
isError,
|
|
46
|
+
isTextDelta,
|
|
47
|
+
isToolCall,
|
|
48
|
+
isToolResult,
|
|
49
|
+
streamAgentResponse,
|
|
50
|
+
validateUniqueRoutes,
|
|
51
|
+
walkAgentMetadata
|
|
52
|
+
} from "./chunk-YK76AQNU.js";
|
|
53
|
+
import {
|
|
54
|
+
Agent,
|
|
55
|
+
Audit,
|
|
56
|
+
Budget,
|
|
57
|
+
Gateway,
|
|
58
|
+
MCP,
|
|
59
|
+
Memory,
|
|
60
|
+
Mixin,
|
|
61
|
+
Policy,
|
|
62
|
+
RequiresApproval,
|
|
63
|
+
RequiresCapability,
|
|
64
|
+
Skills,
|
|
65
|
+
SubAgents,
|
|
66
|
+
Trace,
|
|
67
|
+
getAgentConfig,
|
|
68
|
+
getGatewayConfig,
|
|
69
|
+
getMcpConfig,
|
|
70
|
+
getMemoryConfig,
|
|
71
|
+
getMixins,
|
|
72
|
+
getSkillsConfig,
|
|
73
|
+
getSubAgents,
|
|
74
|
+
resolveSessionId
|
|
75
|
+
} from "./chunk-3LCIXX3T.js";
|
|
76
|
+
export {
|
|
77
|
+
Agent,
|
|
78
|
+
Artifact,
|
|
79
|
+
Audit,
|
|
80
|
+
Budget,
|
|
81
|
+
Checkpoint,
|
|
82
|
+
ContextWindow,
|
|
83
|
+
Conversation,
|
|
84
|
+
EditFormat,
|
|
85
|
+
Gateway,
|
|
86
|
+
Hook,
|
|
87
|
+
HumanInTheLoop,
|
|
88
|
+
MCP,
|
|
89
|
+
MainLoop,
|
|
90
|
+
Memory,
|
|
91
|
+
Mixin,
|
|
92
|
+
Model,
|
|
93
|
+
Observable,
|
|
94
|
+
Policy,
|
|
95
|
+
ProjectContext,
|
|
96
|
+
RequiresApproval,
|
|
97
|
+
RequiresCapability,
|
|
98
|
+
Sandbox,
|
|
99
|
+
Skills,
|
|
100
|
+
SubAgents,
|
|
101
|
+
Tool,
|
|
102
|
+
Toolbox,
|
|
103
|
+
Trace,
|
|
104
|
+
agentsPlugin,
|
|
105
|
+
applyDecorators,
|
|
106
|
+
compileAgent,
|
|
107
|
+
compileTools,
|
|
108
|
+
createAgentExecutionContext,
|
|
109
|
+
generateAgentManifest,
|
|
110
|
+
generateAgentRoutes,
|
|
111
|
+
getAgentConfig,
|
|
112
|
+
getArtifactConfig,
|
|
113
|
+
getCheckpointConfig,
|
|
114
|
+
getContextWindowConfig,
|
|
115
|
+
getConversationConfig,
|
|
116
|
+
getGatewayConfig,
|
|
117
|
+
getHooks,
|
|
118
|
+
getHooksByPoint,
|
|
119
|
+
getHumanInTheLoopConfig,
|
|
120
|
+
getMainLoop,
|
|
121
|
+
getMcpConfig,
|
|
122
|
+
getMemoryConfig,
|
|
123
|
+
getMixins,
|
|
124
|
+
getObservableByChannel,
|
|
125
|
+
getObservables,
|
|
126
|
+
getProjectContextConfig,
|
|
127
|
+
getSandboxConfig,
|
|
128
|
+
getSkillsConfig,
|
|
129
|
+
getSubAgents,
|
|
130
|
+
getToolConfig,
|
|
131
|
+
getToolMethods,
|
|
132
|
+
getToolboxConfig,
|
|
133
|
+
isAgentContext,
|
|
134
|
+
isApprovalRequired,
|
|
135
|
+
isCommandAllowed,
|
|
136
|
+
isDone,
|
|
137
|
+
isError,
|
|
138
|
+
isPathAllowed,
|
|
139
|
+
isTextDelta,
|
|
140
|
+
isToolCall,
|
|
141
|
+
isToolResult,
|
|
142
|
+
resolveSessionId,
|
|
143
|
+
streamAgentResponse,
|
|
144
|
+
validateUniqueRoutes,
|
|
145
|
+
walkAgentMetadata
|
|
146
|
+
};
|
|
147
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { ZodTypeAny } from 'zod';
|
|
2
|
+
|
|
3
|
+
/** Configuration stored by @Agent() decorator. */
|
|
4
|
+
interface AgentOptions {
|
|
5
|
+
/** Unique agent name (kebab-case). */
|
|
6
|
+
name: string;
|
|
7
|
+
/** HTTP route prefix (e.g., '/api/agents/support'). */
|
|
8
|
+
route: string;
|
|
9
|
+
/** LLM model identifier (e.g., 'claude-sonnet-4-5-20250929'). */
|
|
10
|
+
model?: string;
|
|
11
|
+
/** Enable SSE streaming (default: true). */
|
|
12
|
+
stream?: boolean;
|
|
13
|
+
/** Maximum loop iterations before forcing a terminal response. */
|
|
14
|
+
maxIterations?: number;
|
|
15
|
+
/** Timeout in milliseconds for the entire agent run. */
|
|
16
|
+
timeoutMs?: number;
|
|
17
|
+
/** System prompt for the agent. */
|
|
18
|
+
systemPrompt?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Configuration stored by @MainLoop() decorator. */
|
|
21
|
+
interface MainLoopOptions {
|
|
22
|
+
/** Execution strategy. */
|
|
23
|
+
strategy?: 'simple-chat' | 'plan-act-reflect' | 'react';
|
|
24
|
+
/** Maximum iterations for this loop. */
|
|
25
|
+
maxIterations?: number;
|
|
26
|
+
/** Timeout in milliseconds. */
|
|
27
|
+
timeoutMs?: number;
|
|
28
|
+
}
|
|
29
|
+
/** Internal representation of a resolved @MainLoop. */
|
|
30
|
+
interface MainLoopMeta {
|
|
31
|
+
propertyKey: string | symbol;
|
|
32
|
+
strategy: 'simple-chat' | 'plan-act-reflect' | 'react';
|
|
33
|
+
maxIterations?: number;
|
|
34
|
+
timeoutMs?: number;
|
|
35
|
+
}
|
|
36
|
+
/** Configuration stored by @Toolbox() decorator. */
|
|
37
|
+
interface ToolboxOptions {
|
|
38
|
+
/** Namespace prefix for all tools in this toolbox (e.g., 'support'). */
|
|
39
|
+
namespace?: string;
|
|
40
|
+
}
|
|
41
|
+
/** Configuration stored by @Tool() decorator. */
|
|
42
|
+
interface ToolOptions {
|
|
43
|
+
/** Tool name (surfaced to LLM). */
|
|
44
|
+
name: string;
|
|
45
|
+
/** LLM-facing description. */
|
|
46
|
+
description: string;
|
|
47
|
+
/** Zod input schema — compiled to JSON Schema via defineTool(). */
|
|
48
|
+
input: ZodTypeAny;
|
|
49
|
+
/** Risk level (informational — feeds manifest + UI). */
|
|
50
|
+
risk?: 'low' | 'medium' | 'high';
|
|
51
|
+
}
|
|
52
|
+
/** Budget configuration for @Budget() decorator. */
|
|
53
|
+
interface BudgetOptions {
|
|
54
|
+
/** Maximum cost in USD for this scope. */
|
|
55
|
+
maxCostUsd: number;
|
|
56
|
+
/** Rolling window for budget tracking. */
|
|
57
|
+
window?: 'daily' | 'monthly';
|
|
58
|
+
}
|
|
59
|
+
/** Approval configuration for @RequiresApproval() decorator. */
|
|
60
|
+
interface ApprovalOptions {
|
|
61
|
+
/** Reason shown to the approver. */
|
|
62
|
+
reason: string;
|
|
63
|
+
}
|
|
64
|
+
/** Policy handler function type. */
|
|
65
|
+
type PolicyHandler = (user: {
|
|
66
|
+
roles: string[];
|
|
67
|
+
}) => boolean;
|
|
68
|
+
|
|
69
|
+
type PlatformName = 'telegram' | 'discord' | 'slack' | 'whatsapp' | 'teams' | 'email' | 'sms' | 'mattermost' | 'line' | 'matrix';
|
|
70
|
+
type SessionStrategy = 'per-user' | 'per-channel' | 'per-thread';
|
|
71
|
+
interface GatewayOptions {
|
|
72
|
+
/** Platform adapters this agent supports. */
|
|
73
|
+
platforms: PlatformName[];
|
|
74
|
+
/** How to resolve agentId from inbound events (default: 'per-user'). */
|
|
75
|
+
sessionStrategy?: SessionStrategy;
|
|
76
|
+
/** Auto-start typing indicator while agent processes (default: true). */
|
|
77
|
+
typing?: boolean;
|
|
78
|
+
}
|
|
79
|
+
declare function Gateway(options: GatewayOptions): ClassDecorator;
|
|
80
|
+
declare function getGatewayConfig(target: Function): GatewayOptions | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Resolve a stable agentId from a platform event based on the session strategy.
|
|
83
|
+
*
|
|
84
|
+
* Mirrors @theokit/gateway SessionRouter.defaultStrategy() but is configurable
|
|
85
|
+
* via the @Gateway decorator.
|
|
86
|
+
*/
|
|
87
|
+
declare function resolveSessionId(strategy: SessionStrategy, platform: string, sender: {
|
|
88
|
+
id: string;
|
|
89
|
+
}, channel: {
|
|
90
|
+
id: string;
|
|
91
|
+
type: 'dm' | 'group' | 'thread';
|
|
92
|
+
topicId?: string;
|
|
93
|
+
}): string;
|
|
94
|
+
|
|
95
|
+
type MemoryProvider = 'built-in' | 'honcho' | 'supermemory' | 'mem0';
|
|
96
|
+
type MemoryScope = 'per-user' | 'per-agent' | 'per-tenant' | 'global';
|
|
97
|
+
interface MemoryOptions {
|
|
98
|
+
/** Memory provider backend. */
|
|
99
|
+
provider?: MemoryProvider;
|
|
100
|
+
/** Enable semantic search via embeddings. */
|
|
101
|
+
embeddings?: boolean;
|
|
102
|
+
/** Enable full-text search (FTS5). */
|
|
103
|
+
fts?: boolean;
|
|
104
|
+
/** Memory isolation scope (default: 'per-user'). */
|
|
105
|
+
scope?: MemoryScope;
|
|
106
|
+
/** Maximum facts to retain per scope (0 = unlimited). */
|
|
107
|
+
maxFacts?: number;
|
|
108
|
+
}
|
|
109
|
+
declare function Memory(options?: MemoryOptions): ClassDecorator;
|
|
110
|
+
declare function getMemoryConfig(target: Function): MemoryOptions | undefined;
|
|
111
|
+
|
|
112
|
+
interface SkillsOptions {
|
|
113
|
+
/** Skill names to include (resolved from .theokit/skills/<name>/SKILL.md). */
|
|
114
|
+
include: string[];
|
|
115
|
+
/** Auto-discover all skills in .theokit/skills/ (default: false). */
|
|
116
|
+
autoDiscover?: boolean;
|
|
117
|
+
}
|
|
118
|
+
declare function Skills(namesOrOptions: string[] | SkillsOptions): ClassDecorator;
|
|
119
|
+
declare function getSkillsConfig(target: Function): SkillsOptions | undefined;
|
|
120
|
+
|
|
121
|
+
interface McpServerConfig {
|
|
122
|
+
/** Command to start the MCP server. */
|
|
123
|
+
command: string;
|
|
124
|
+
/** Arguments passed to the command. */
|
|
125
|
+
args?: string[];
|
|
126
|
+
/** Environment variables for the server process. */
|
|
127
|
+
env?: Record<string, string>;
|
|
128
|
+
/** Working directory for the server process. */
|
|
129
|
+
cwd?: string;
|
|
130
|
+
}
|
|
131
|
+
type McpServersMap = Record<string, McpServerConfig>;
|
|
132
|
+
declare function MCP(servers: McpServersMap): ClassDecorator;
|
|
133
|
+
declare function getMcpConfig(target: Function): McpServersMap | undefined;
|
|
134
|
+
|
|
135
|
+
export { type AgentOptions as A, type BudgetOptions as B, Gateway as G, MCP as M, type PlatformName as P, type SessionStrategy as S, type ToolOptions as T, type ApprovalOptions as a, type GatewayOptions as b, type MainLoopMeta as c, type MainLoopOptions as d, type McpServerConfig as e, type McpServersMap as f, Memory as g, type MemoryOptions as h, type MemoryProvider as i, type MemoryScope as j, type PolicyHandler as k, Skills as l, type SkillsOptions as m, type ToolboxOptions as n, getGatewayConfig as o, getMcpConfig as p, getMemoryConfig as q, getSkillsConfig as r, resolveSessionId as s };
|