@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
package/dist/bridge.d.ts
ADDED
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import { ExecutionContext } from '@theokit/http-decorators';
|
|
2
|
+
import { A as AgentOptions, T as ToolOptions, c as MainLoopMeta, a as ApprovalOptions, B as BudgetOptions, b as GatewayOptions, h as MemoryOptions, m as SkillsOptions, f as McpServersMap } from './mcp-DmtwLSF-.js';
|
|
3
|
+
import 'zod';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* AgentExecutionContext — extends http-decorators' ExecutionContext with agent-specific methods.
|
|
7
|
+
*
|
|
8
|
+
* Per ADR D2 (LSP): any guard that accepts ExecutionContext works unchanged with
|
|
9
|
+
* AgentExecutionContext. Agent-specific guards can narrow via isAgentContext().
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
interface AgentRunInfo {
|
|
13
|
+
id: string;
|
|
14
|
+
startedAt: Date;
|
|
15
|
+
}
|
|
16
|
+
interface AgentExecutionContext extends ExecutionContext {
|
|
17
|
+
/** The agent's configuration from @Agent() decorator. */
|
|
18
|
+
getAgent(): AgentOptions;
|
|
19
|
+
/** The current run information. */
|
|
20
|
+
getRun(): AgentRunInfo;
|
|
21
|
+
/** The tool being called, or null if in the main agent handler. */
|
|
22
|
+
getToolCall(): ToolOptions | null;
|
|
23
|
+
/** Type guard — always true for AgentExecutionContext. */
|
|
24
|
+
isAgentContext(): true;
|
|
25
|
+
}
|
|
26
|
+
/** Create an AgentExecutionContext from a base ExecutionContext + agent state. */
|
|
27
|
+
declare function createAgentExecutionContext(base: ExecutionContext, agent: AgentOptions, run: AgentRunInfo, toolCall?: ToolOptions): AgentExecutionContext;
|
|
28
|
+
/** Narrow an ExecutionContext to AgentExecutionContext if it is one. */
|
|
29
|
+
declare function isAgentContext(ctx: ExecutionContext): ctx is AgentExecutionContext;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Walk decorator metadata on agent + toolbox classes.
|
|
33
|
+
* Mirrors http-decorators' walkControllerMetadata() pattern.
|
|
34
|
+
*
|
|
35
|
+
* EC-1: throws if @Agent class is missing @MainLoop.
|
|
36
|
+
* EC-4: throws on duplicate routes across agents.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
interface AgentWalkResult {
|
|
40
|
+
agentConfig: AgentOptions;
|
|
41
|
+
mainLoop: MainLoopMeta;
|
|
42
|
+
toolboxes: ToolboxWalkResult[];
|
|
43
|
+
guards: Function[];
|
|
44
|
+
interceptors: Function[];
|
|
45
|
+
filters: Function[];
|
|
46
|
+
route: string;
|
|
47
|
+
gateway?: GatewayOptions;
|
|
48
|
+
subAgentClasses: Function[];
|
|
49
|
+
memory?: MemoryOptions;
|
|
50
|
+
skills?: SkillsOptions;
|
|
51
|
+
mcpServers?: McpServersMap;
|
|
52
|
+
}
|
|
53
|
+
interface ToolboxWalkResult {
|
|
54
|
+
class: Function;
|
|
55
|
+
namespace: string;
|
|
56
|
+
tools: ToolWalkResult[];
|
|
57
|
+
guards: Function[];
|
|
58
|
+
}
|
|
59
|
+
interface ToolWalkResult {
|
|
60
|
+
propertyKey: string | symbol;
|
|
61
|
+
config: ToolOptions;
|
|
62
|
+
guards: Function[];
|
|
63
|
+
approval?: ApprovalOptions;
|
|
64
|
+
capabilities?: string[];
|
|
65
|
+
budget?: BudgetOptions;
|
|
66
|
+
trace: boolean;
|
|
67
|
+
audit: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Walk all metadata on an agent class and its toolboxes.
|
|
71
|
+
* Memoized per AgentClass via WeakMap.
|
|
72
|
+
*
|
|
73
|
+
* @throws Error if @Agent is missing @MainLoop (EC-1)
|
|
74
|
+
*/
|
|
75
|
+
declare function walkAgentMetadata(AgentClass: Function, toolboxClasses?: Function[]): AgentWalkResult;
|
|
76
|
+
/**
|
|
77
|
+
* Validate that no two agents share the same route prefix.
|
|
78
|
+
*
|
|
79
|
+
* @throws Error on duplicate routes (EC-4)
|
|
80
|
+
*/
|
|
81
|
+
declare function validateUniqueRoutes(results: AgentWalkResult[]): void;
|
|
82
|
+
|
|
83
|
+
/** Minimal interface matching defineTool() result shape. */
|
|
84
|
+
interface CompiledTool {
|
|
85
|
+
name: string;
|
|
86
|
+
description: string;
|
|
87
|
+
inputSchema: unknown;
|
|
88
|
+
handler: (input: unknown) => string | Promise<string>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Compile @Tool metadata into tool definitions.
|
|
92
|
+
*
|
|
93
|
+
* @param toolboxes - Walked toolbox metadata
|
|
94
|
+
* @param toolboxInstances - Map of Toolbox class → instantiated object (for `this` binding)
|
|
95
|
+
*/
|
|
96
|
+
declare function compileTools(toolboxes: ToolboxWalkResult[], toolboxInstances: Map<Function, object>): CompiledTool[];
|
|
97
|
+
/** Compiled sub-agent definition matching SDK AgentDefinition shape. */
|
|
98
|
+
interface CompiledSubAgent {
|
|
99
|
+
model?: string;
|
|
100
|
+
systemPrompt?: string;
|
|
101
|
+
}
|
|
102
|
+
/** Compiled agent options ready for SDK Agent.create(). */
|
|
103
|
+
interface CompiledAgentOptions {
|
|
104
|
+
model?: string;
|
|
105
|
+
systemPrompt?: string;
|
|
106
|
+
tools: CompiledTool[];
|
|
107
|
+
agents: Record<string, CompiledSubAgent>;
|
|
108
|
+
memory?: MemoryOptions;
|
|
109
|
+
skills?: SkillsOptions;
|
|
110
|
+
mcpServers?: McpServersMap;
|
|
111
|
+
maxIterations?: number;
|
|
112
|
+
timeoutMs?: number;
|
|
113
|
+
stream: boolean;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Compile @Agent metadata into SDK-compatible options.
|
|
117
|
+
*
|
|
118
|
+
* EC-7: agents without toolboxes produce tools: [].
|
|
119
|
+
*/
|
|
120
|
+
declare function compileAgent(walkResult: AgentWalkResult, toolboxInstances?: Map<Function, object>): CompiledAgentOptions;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* SSE streaming handler — Web Standard Response with ReadableStream.
|
|
124
|
+
*
|
|
125
|
+
* Per ADR D4: SSE is the v1 transport.
|
|
126
|
+
* Per EC-2: uses ReadableStream with controller.enqueue() instead of res.write().
|
|
127
|
+
* Works natively on Node, Bun, Deno, CF Workers.
|
|
128
|
+
*/
|
|
129
|
+
/** Minimal event shape matching SDK's SDKMessage discriminated union. */
|
|
130
|
+
interface StreamEvent {
|
|
131
|
+
type: string;
|
|
132
|
+
[key: string]: unknown;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Create a Web Standard Response that streams SSE events.
|
|
136
|
+
* Each event becomes: `event: {type}\ndata: {json}\n\n`
|
|
137
|
+
*/
|
|
138
|
+
declare function streamAgentResponse(eventStream: AsyncIterable<StreamEvent>): Response;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Typed discriminated union for agent SSE stream events.
|
|
142
|
+
*
|
|
143
|
+
* Every event has a `type` field for discrimination.
|
|
144
|
+
* Clients narrow via `if (event.type === 'text_delta') event.content`.
|
|
145
|
+
*/
|
|
146
|
+
/** Partial text content from the LLM. */
|
|
147
|
+
interface TextDeltaEvent {
|
|
148
|
+
type: 'text_delta';
|
|
149
|
+
content: string;
|
|
150
|
+
}
|
|
151
|
+
/** Agent started a tool call. */
|
|
152
|
+
interface ToolCallEvent {
|
|
153
|
+
type: 'tool_call';
|
|
154
|
+
callId: string;
|
|
155
|
+
toolName: string;
|
|
156
|
+
input: unknown;
|
|
157
|
+
}
|
|
158
|
+
/** Tool execution completed. */
|
|
159
|
+
interface ToolResultEvent {
|
|
160
|
+
type: 'tool_result';
|
|
161
|
+
callId: string;
|
|
162
|
+
toolName: string;
|
|
163
|
+
output: string;
|
|
164
|
+
durationMs: number;
|
|
165
|
+
isError: boolean;
|
|
166
|
+
}
|
|
167
|
+
/** Extended thinking / reasoning (when model supports it). */
|
|
168
|
+
interface ThinkingEvent {
|
|
169
|
+
type: 'thinking';
|
|
170
|
+
content: string;
|
|
171
|
+
}
|
|
172
|
+
/** Agent loop iteration. */
|
|
173
|
+
interface IterationEvent {
|
|
174
|
+
type: 'iteration';
|
|
175
|
+
step: number;
|
|
176
|
+
totalSteps: number | null;
|
|
177
|
+
}
|
|
178
|
+
/** Human approval required before proceeding. */
|
|
179
|
+
interface ApprovalRequiredEvent {
|
|
180
|
+
type: 'approval_required';
|
|
181
|
+
callId: string;
|
|
182
|
+
toolName: string;
|
|
183
|
+
question: string;
|
|
184
|
+
input?: unknown;
|
|
185
|
+
callbackUrl: string;
|
|
186
|
+
timeoutMs: number;
|
|
187
|
+
}
|
|
188
|
+
/** Agent encountered an error. */
|
|
189
|
+
interface ErrorEvent {
|
|
190
|
+
type: 'error';
|
|
191
|
+
code: string;
|
|
192
|
+
message: string;
|
|
193
|
+
retryable: boolean;
|
|
194
|
+
}
|
|
195
|
+
/** Agent completed with a final result. */
|
|
196
|
+
interface DoneEvent {
|
|
197
|
+
type: 'done';
|
|
198
|
+
result: string;
|
|
199
|
+
usage: {
|
|
200
|
+
inputTokens: number;
|
|
201
|
+
outputTokens: number;
|
|
202
|
+
totalTokens: number;
|
|
203
|
+
};
|
|
204
|
+
durationMs: number;
|
|
205
|
+
}
|
|
206
|
+
/** Agent run started. */
|
|
207
|
+
interface RunStartedEvent {
|
|
208
|
+
type: 'run_started';
|
|
209
|
+
runId: string;
|
|
210
|
+
agentName: string;
|
|
211
|
+
model?: string;
|
|
212
|
+
}
|
|
213
|
+
/** Artifact generation started (code, document, diagram). */
|
|
214
|
+
interface ArtifactStartEvent {
|
|
215
|
+
type: 'artifact_start';
|
|
216
|
+
artifactId: string;
|
|
217
|
+
mimeType: string;
|
|
218
|
+
filename?: string;
|
|
219
|
+
metadata?: Record<string, unknown>;
|
|
220
|
+
}
|
|
221
|
+
/** Artifact content chunk (streamable artifacts). */
|
|
222
|
+
interface ArtifactChunkEvent {
|
|
223
|
+
type: 'artifact_chunk';
|
|
224
|
+
artifactId: string;
|
|
225
|
+
chunk: string;
|
|
226
|
+
isLast: boolean;
|
|
227
|
+
}
|
|
228
|
+
/** Real-time state update from @Observable channels. */
|
|
229
|
+
interface StateUpdateEvent {
|
|
230
|
+
type: 'state_update';
|
|
231
|
+
channel: string;
|
|
232
|
+
data: unknown;
|
|
233
|
+
}
|
|
234
|
+
/** Checkpoint saved (resumable agents). */
|
|
235
|
+
interface CheckpointSavedEvent {
|
|
236
|
+
type: 'checkpoint_saved';
|
|
237
|
+
checkpointId: string;
|
|
238
|
+
step: number;
|
|
239
|
+
resumeToken: string;
|
|
240
|
+
}
|
|
241
|
+
/** File edit produced by a code assistant tool. */
|
|
242
|
+
interface FileEditEvent {
|
|
243
|
+
type: 'file_edit';
|
|
244
|
+
file: string;
|
|
245
|
+
format: 'search-replace' | 'unified-diff' | 'full-file' | 'line-range';
|
|
246
|
+
search?: string;
|
|
247
|
+
replace?: string;
|
|
248
|
+
content?: string;
|
|
249
|
+
diff?: string;
|
|
250
|
+
startLine?: number;
|
|
251
|
+
endLine?: number;
|
|
252
|
+
}
|
|
253
|
+
/** Discriminated union of all agent stream events. */
|
|
254
|
+
type AgentStreamEvent = RunStartedEvent | TextDeltaEvent | ToolCallEvent | ToolResultEvent | ThinkingEvent | IterationEvent | ApprovalRequiredEvent | ArtifactStartEvent | ArtifactChunkEvent | StateUpdateEvent | CheckpointSavedEvent | FileEditEvent | ErrorEvent | DoneEvent;
|
|
255
|
+
/** Type guard helpers. */
|
|
256
|
+
declare function isTextDelta(e: AgentStreamEvent): e is TextDeltaEvent;
|
|
257
|
+
declare function isToolCall(e: AgentStreamEvent): e is ToolCallEvent;
|
|
258
|
+
declare function isToolResult(e: AgentStreamEvent): e is ToolResultEvent;
|
|
259
|
+
declare function isDone(e: AgentStreamEvent): e is DoneEvent;
|
|
260
|
+
declare function isError(e: AgentStreamEvent): e is ErrorEvent;
|
|
261
|
+
declare function isApprovalRequired(e: AgentStreamEvent): e is ApprovalRequiredEvent;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Auto-generate HTTP routes from @Agent metadata — Web Standard.
|
|
265
|
+
*
|
|
266
|
+
* Per ADR D5: @Agent({ route }) auto-generates two endpoints:
|
|
267
|
+
* - POST {route}/chat — send message, receive SSE stream
|
|
268
|
+
* - GET {route}/runs/:runId — get run status/result
|
|
269
|
+
*
|
|
270
|
+
* Routes are convention-based, generated at registration time.
|
|
271
|
+
*/
|
|
272
|
+
|
|
273
|
+
interface AgentRoute {
|
|
274
|
+
method: 'POST' | 'GET';
|
|
275
|
+
path: string;
|
|
276
|
+
handler: (request: Request) => Promise<Response>;
|
|
277
|
+
}
|
|
278
|
+
interface AgentRouteContext {
|
|
279
|
+
walkResult: AgentWalkResult;
|
|
280
|
+
compiledOptions: CompiledAgentOptions;
|
|
281
|
+
createRun: (message: string, sessionId: string) => AsyncIterable<StreamEvent>;
|
|
282
|
+
getRun?: (runId: string) => Promise<{
|
|
283
|
+
id: string;
|
|
284
|
+
status: string;
|
|
285
|
+
result?: string;
|
|
286
|
+
} | null>;
|
|
287
|
+
}
|
|
288
|
+
/** Generate HTTP routes for a single agent. Returns Web Standard handlers. */
|
|
289
|
+
declare function generateAgentRoutes(ctx: AgentRouteContext): AgentRoute[];
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Agent manifest generator — build-time JSON describing all agents, tools, guards, policies.
|
|
293
|
+
*
|
|
294
|
+
* Feeds: theokit agents list/inspect, TheoCloud deploy, UI agent consoles.
|
|
295
|
+
*/
|
|
296
|
+
|
|
297
|
+
interface AgentManifest {
|
|
298
|
+
version: '1.0';
|
|
299
|
+
generatedAt: string;
|
|
300
|
+
agents: AgentManifestEntry[];
|
|
301
|
+
}
|
|
302
|
+
interface AgentManifestEntry {
|
|
303
|
+
name: string;
|
|
304
|
+
route: string;
|
|
305
|
+
model?: string;
|
|
306
|
+
stream: boolean;
|
|
307
|
+
mainLoop: {
|
|
308
|
+
method: string;
|
|
309
|
+
strategy: string;
|
|
310
|
+
};
|
|
311
|
+
guards: string[];
|
|
312
|
+
interceptors: string[];
|
|
313
|
+
tools: AgentManifestTool[];
|
|
314
|
+
gateway?: {
|
|
315
|
+
platforms: string[];
|
|
316
|
+
sessionStrategy: string;
|
|
317
|
+
};
|
|
318
|
+
subAgents: string[];
|
|
319
|
+
memory?: {
|
|
320
|
+
provider: string;
|
|
321
|
+
embeddings: boolean;
|
|
322
|
+
fts: boolean;
|
|
323
|
+
scope: string;
|
|
324
|
+
};
|
|
325
|
+
skills?: string[];
|
|
326
|
+
mcpServers?: string[];
|
|
327
|
+
}
|
|
328
|
+
interface AgentManifestTool {
|
|
329
|
+
name: string;
|
|
330
|
+
description: string;
|
|
331
|
+
risk?: string;
|
|
332
|
+
approval: boolean;
|
|
333
|
+
capabilities?: string[];
|
|
334
|
+
trace: boolean;
|
|
335
|
+
audit: boolean;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Generate a serializable agent manifest from walked metadata.
|
|
339
|
+
* All Function references are converted to string names for JSON safety.
|
|
340
|
+
*/
|
|
341
|
+
declare function generateAgentManifest(walkResults: AgentWalkResult[]): AgentManifest;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* agentsPlugin() — TheoKit dev-server plugin for agent routes.
|
|
345
|
+
*
|
|
346
|
+
* Mirrors httpDecoratorsPlugin() pattern. Registers agent HTTP endpoints
|
|
347
|
+
* (POST /chat, GET /runs/:id) via the TheoKit plugin hook system.
|
|
348
|
+
*
|
|
349
|
+
* Per ADR D6: structural { name, register } shape (no compile-time theokit dep).
|
|
350
|
+
*/
|
|
351
|
+
|
|
352
|
+
interface AgentsPluginOptions {
|
|
353
|
+
/** Agent classes decorated with @Agent(). */
|
|
354
|
+
agents: Function[];
|
|
355
|
+
/** Toolbox classes (or use @Mixin on agents). */
|
|
356
|
+
toolboxes?: Function[];
|
|
357
|
+
/** Factory that creates agent runs — bridges to SDK Agent.create() + agent.send(). */
|
|
358
|
+
createRunFactory?: (compiled: CompiledAgentOptions, walkResult: AgentWalkResult) => (message: string, sessionId: string) => AsyncIterable<StreamEvent>;
|
|
359
|
+
}
|
|
360
|
+
interface PluginApp {
|
|
361
|
+
addHook(name: string, fn: (ctx: {
|
|
362
|
+
request: Request;
|
|
363
|
+
}) => Promise<Response | void>): void;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Create a TheoKit plugin that mounts agent routes.
|
|
367
|
+
* Web Standard Request/Response — runtime-agnostic.
|
|
368
|
+
*/
|
|
369
|
+
declare function agentsPlugin(opts: AgentsPluginOptions): {
|
|
370
|
+
name: string;
|
|
371
|
+
register(app: PluginApp): void;
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
export { type AgentExecutionContext, type AgentManifest, type AgentManifestEntry, type AgentManifestTool, type AgentRoute, type AgentRouteContext, type AgentRunInfo, type AgentStreamEvent, type AgentWalkResult, type AgentsPluginOptions, type ApprovalRequiredEvent, type ArtifactChunkEvent, type ArtifactStartEvent, type CheckpointSavedEvent, type CompiledAgentOptions, type CompiledTool, type DoneEvent, type ErrorEvent, type FileEditEvent, type IterationEvent, type RunStartedEvent, type StateUpdateEvent, type StreamEvent, type TextDeltaEvent, type ThinkingEvent, type ToolCallEvent, type ToolResultEvent, type ToolWalkResult, type ToolboxWalkResult, agentsPlugin, compileAgent, compileTools, createAgentExecutionContext, generateAgentManifest, generateAgentRoutes, isAgentContext, isApprovalRequired, isDone, isError, isTextDelta, isToolCall, isToolResult, streamAgentResponse, validateUniqueRoutes, walkAgentMetadata };
|
package/dist/bridge.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
agentsPlugin,
|
|
3
|
+
compileAgent,
|
|
4
|
+
compileTools,
|
|
5
|
+
createAgentExecutionContext,
|
|
6
|
+
generateAgentManifest,
|
|
7
|
+
generateAgentRoutes,
|
|
8
|
+
isAgentContext,
|
|
9
|
+
isApprovalRequired,
|
|
10
|
+
isDone,
|
|
11
|
+
isError,
|
|
12
|
+
isTextDelta,
|
|
13
|
+
isToolCall,
|
|
14
|
+
isToolResult,
|
|
15
|
+
streamAgentResponse,
|
|
16
|
+
validateUniqueRoutes,
|
|
17
|
+
walkAgentMetadata
|
|
18
|
+
} from "./chunk-YK76AQNU.js";
|
|
19
|
+
import "./chunk-3LCIXX3T.js";
|
|
20
|
+
export {
|
|
21
|
+
agentsPlugin,
|
|
22
|
+
compileAgent,
|
|
23
|
+
compileTools,
|
|
24
|
+
createAgentExecutionContext,
|
|
25
|
+
generateAgentManifest,
|
|
26
|
+
generateAgentRoutes,
|
|
27
|
+
isAgentContext,
|
|
28
|
+
isApprovalRequired,
|
|
29
|
+
isDone,
|
|
30
|
+
isError,
|
|
31
|
+
isTextDelta,
|
|
32
|
+
isToolCall,
|
|
33
|
+
isToolResult,
|
|
34
|
+
streamAgentResponse,
|
|
35
|
+
validateUniqueRoutes,
|
|
36
|
+
walkAgentMetadata
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/metadata/index.ts
|
|
5
|
+
import { setMeta, getMeta } from "@theokit/http-decorators";
|
|
6
|
+
|
|
7
|
+
// src/metadata/keys.ts
|
|
8
|
+
var AGENT_CONFIG = /* @__PURE__ */ Symbol.for("theokit:agents:config");
|
|
9
|
+
var AGENT_MAIN_LOOP = /* @__PURE__ */ Symbol.for("theokit:agents:main-loop");
|
|
10
|
+
var TOOLBOX_CONFIG = /* @__PURE__ */ Symbol.for("theokit:agents:toolbox");
|
|
11
|
+
var TOOL_CONFIG = /* @__PURE__ */ Symbol.for("theokit:agents:tool");
|
|
12
|
+
var TOOL_METHODS = /* @__PURE__ */ Symbol.for("theokit:agents:tool-methods");
|
|
13
|
+
|
|
14
|
+
// src/decorators/agent.ts
|
|
15
|
+
function Agent(options) {
|
|
16
|
+
return (target) => {
|
|
17
|
+
setMeta(AGENT_CONFIG, target, {
|
|
18
|
+
stream: true,
|
|
19
|
+
...options
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
__name(Agent, "Agent");
|
|
24
|
+
function getAgentConfig(target) {
|
|
25
|
+
return getMeta(AGENT_CONFIG, target);
|
|
26
|
+
}
|
|
27
|
+
__name(getAgentConfig, "getAgentConfig");
|
|
28
|
+
|
|
29
|
+
// src/decorators/policies.ts
|
|
30
|
+
import { createDecorator } from "@theokit/http-decorators";
|
|
31
|
+
var RequiresApproval = createDecorator();
|
|
32
|
+
var RequiresCapability = createDecorator();
|
|
33
|
+
var Budget = createDecorator();
|
|
34
|
+
var Policy = createDecorator();
|
|
35
|
+
|
|
36
|
+
// src/decorators/observability.ts
|
|
37
|
+
import { createDecorator as createDecorator2 } from "@theokit/http-decorators";
|
|
38
|
+
var Trace = createDecorator2();
|
|
39
|
+
var Audit = createDecorator2();
|
|
40
|
+
|
|
41
|
+
// src/decorators/gateway.ts
|
|
42
|
+
var GATEWAY_CONFIG = /* @__PURE__ */ Symbol.for("theokit:agents:gateway");
|
|
43
|
+
function Gateway(options) {
|
|
44
|
+
return (target) => {
|
|
45
|
+
setMeta(GATEWAY_CONFIG, target, {
|
|
46
|
+
typing: true,
|
|
47
|
+
sessionStrategy: "per-user",
|
|
48
|
+
...options
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
__name(Gateway, "Gateway");
|
|
53
|
+
function getGatewayConfig(target) {
|
|
54
|
+
return getMeta(GATEWAY_CONFIG, target);
|
|
55
|
+
}
|
|
56
|
+
__name(getGatewayConfig, "getGatewayConfig");
|
|
57
|
+
function resolveSessionId(strategy, platform, sender, channel) {
|
|
58
|
+
switch (strategy) {
|
|
59
|
+
case "per-user":
|
|
60
|
+
return `${platform}-dm-${sender.id}`;
|
|
61
|
+
case "per-channel":
|
|
62
|
+
return `${platform}-grp-${channel.id}`;
|
|
63
|
+
case "per-thread":
|
|
64
|
+
return `${platform}-tpc-${channel.id}-${channel.topicId ?? "main"}`;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
__name(resolveSessionId, "resolveSessionId");
|
|
68
|
+
|
|
69
|
+
// src/decorators/sub-agents.ts
|
|
70
|
+
var SUB_AGENTS = /* @__PURE__ */ Symbol.for("theokit:agents:sub-agents");
|
|
71
|
+
function SubAgents(agentClasses) {
|
|
72
|
+
return (target) => {
|
|
73
|
+
for (const cls of agentClasses) {
|
|
74
|
+
const config = getAgentConfig(cls);
|
|
75
|
+
if (!config) {
|
|
76
|
+
throw new Error(`[@theokit/agents] @SubAgents on ${target.name}: class ${cls.name} is missing @Agent() decorator.`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
setMeta(SUB_AGENTS, target, agentClasses);
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
__name(SubAgents, "SubAgents");
|
|
83
|
+
function getSubAgents(target) {
|
|
84
|
+
return getMeta(SUB_AGENTS, target) ?? [];
|
|
85
|
+
}
|
|
86
|
+
__name(getSubAgents, "getSubAgents");
|
|
87
|
+
|
|
88
|
+
// src/decorators/memory.ts
|
|
89
|
+
var MEMORY_CONFIG = /* @__PURE__ */ Symbol.for("theokit:agents:memory");
|
|
90
|
+
function Memory(options = {}) {
|
|
91
|
+
return (target) => {
|
|
92
|
+
setMeta(MEMORY_CONFIG, target, {
|
|
93
|
+
provider: "built-in",
|
|
94
|
+
embeddings: false,
|
|
95
|
+
fts: false,
|
|
96
|
+
scope: "per-user",
|
|
97
|
+
...options
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
__name(Memory, "Memory");
|
|
102
|
+
function getMemoryConfig(target) {
|
|
103
|
+
return getMeta(MEMORY_CONFIG, target);
|
|
104
|
+
}
|
|
105
|
+
__name(getMemoryConfig, "getMemoryConfig");
|
|
106
|
+
|
|
107
|
+
// src/decorators/skills.ts
|
|
108
|
+
var SKILLS_CONFIG = /* @__PURE__ */ Symbol.for("theokit:agents:skills");
|
|
109
|
+
function Skills(namesOrOptions) {
|
|
110
|
+
return (target) => {
|
|
111
|
+
const options = Array.isArray(namesOrOptions) ? {
|
|
112
|
+
include: namesOrOptions,
|
|
113
|
+
autoDiscover: false
|
|
114
|
+
} : namesOrOptions;
|
|
115
|
+
setMeta(SKILLS_CONFIG, target, options);
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
__name(Skills, "Skills");
|
|
119
|
+
function getSkillsConfig(target) {
|
|
120
|
+
return getMeta(SKILLS_CONFIG, target);
|
|
121
|
+
}
|
|
122
|
+
__name(getSkillsConfig, "getSkillsConfig");
|
|
123
|
+
|
|
124
|
+
// src/decorators/mcp.ts
|
|
125
|
+
var MCP_CONFIG = /* @__PURE__ */ Symbol.for("theokit:agents:mcp");
|
|
126
|
+
function MCP(servers) {
|
|
127
|
+
return (target) => {
|
|
128
|
+
setMeta(MCP_CONFIG, target, servers);
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
__name(MCP, "MCP");
|
|
132
|
+
function getMcpConfig(target) {
|
|
133
|
+
return getMeta(MCP_CONFIG, target);
|
|
134
|
+
}
|
|
135
|
+
__name(getMcpConfig, "getMcpConfig");
|
|
136
|
+
|
|
137
|
+
// src/decorators/mixin.ts
|
|
138
|
+
var MIXIN_CLASSES = /* @__PURE__ */ Symbol.for("theokit:agents:mixins");
|
|
139
|
+
function Mixin(...mixinClasses) {
|
|
140
|
+
return (target) => {
|
|
141
|
+
const existing = getMeta(MIXIN_CLASSES, target) ?? [];
|
|
142
|
+
setMeta(MIXIN_CLASSES, target, [
|
|
143
|
+
...existing,
|
|
144
|
+
...mixinClasses
|
|
145
|
+
]);
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
__name(Mixin, "Mixin");
|
|
149
|
+
function getMixins(target) {
|
|
150
|
+
return getMeta(MIXIN_CLASSES, target) ?? [];
|
|
151
|
+
}
|
|
152
|
+
__name(getMixins, "getMixins");
|
|
153
|
+
|
|
154
|
+
export {
|
|
155
|
+
__name,
|
|
156
|
+
AGENT_CONFIG,
|
|
157
|
+
AGENT_MAIN_LOOP,
|
|
158
|
+
TOOLBOX_CONFIG,
|
|
159
|
+
TOOL_CONFIG,
|
|
160
|
+
TOOL_METHODS,
|
|
161
|
+
setMeta,
|
|
162
|
+
getMeta,
|
|
163
|
+
Agent,
|
|
164
|
+
getAgentConfig,
|
|
165
|
+
RequiresApproval,
|
|
166
|
+
RequiresCapability,
|
|
167
|
+
Budget,
|
|
168
|
+
Policy,
|
|
169
|
+
Trace,
|
|
170
|
+
Audit,
|
|
171
|
+
Gateway,
|
|
172
|
+
getGatewayConfig,
|
|
173
|
+
resolveSessionId,
|
|
174
|
+
SubAgents,
|
|
175
|
+
getSubAgents,
|
|
176
|
+
Memory,
|
|
177
|
+
getMemoryConfig,
|
|
178
|
+
Skills,
|
|
179
|
+
getSkillsConfig,
|
|
180
|
+
MCP,
|
|
181
|
+
getMcpConfig,
|
|
182
|
+
Mixin,
|
|
183
|
+
getMixins
|
|
184
|
+
};
|
|
185
|
+
//# sourceMappingURL=chunk-3LCIXX3T.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/metadata/index.ts","../src/metadata/keys.ts","../src/decorators/agent.ts","../src/decorators/policies.ts","../src/decorators/observability.ts","../src/decorators/gateway.ts","../src/decorators/sub-agents.ts","../src/decorators/memory.ts","../src/decorators/skills.ts","../src/decorators/mcp.ts","../src/decorators/mixin.ts"],"sourcesContent":["// Re-export setMeta/getMeta from http-decorators (DRY — single metadata engine)\n// Relative path for workspace-local usage; vitest resolves via alias\nexport { setMeta, getMeta } from '@theokit/http-decorators'\n\nexport * from './keys.js'\n","/** Symbol.for metadata keys for agent decorators — cross-module safe with SWC loader. */\n\nexport const AGENT_CONFIG = Symbol.for('theokit:agents:config')\nexport const AGENT_MAIN_LOOP = Symbol.for('theokit:agents:main-loop')\nexport const TOOLBOX_CONFIG = Symbol.for('theokit:agents:toolbox')\nexport const TOOL_CONFIG = Symbol.for('theokit:agents:tool')\nexport const TOOL_METHODS = Symbol.for('theokit:agents:tool-methods')\n","/**\n * @Agent() — marks a class as an AI agent controller.\n *\n * Stores AgentOptions metadata. The compiler reads this to call\n * Agent.create() from @theokit/sdk at registration time.\n *\n * @example\n * ```ts\n * @Agent({ name: 'support-agent', route: '/api/agents/support', model: 'claude-sonnet-4-5-20250929' })\n * @UseGuards(AuthGuard)\n * class SupportAgent {\n * @MainLoop()\n * async run(ctx: AgentContext) { ... }\n * }\n * ```\n */\nimport { setMeta, getMeta, AGENT_CONFIG } from '../metadata/index.js'\nimport type { AgentOptions } from '../types.js'\n\nexport function Agent(options: AgentOptions): ClassDecorator {\n return (target: Function) => {\n setMeta(AGENT_CONFIG, target, { stream: true, ...options })\n }\n}\n\nexport function getAgentConfig(target: Function): AgentOptions | undefined {\n return getMeta<AgentOptions>(AGENT_CONFIG, target)\n}\n","/**\n * Agent-native policy decorators — built on http-decorators' createDecorator<T>().\n *\n * These decorators work with Reflector.getAllAndOverride() for hierarchical\n * resolution: tool → toolbox → agent (method-level overrides class-level).\n */\nimport { createDecorator } from '@theokit/http-decorators'\n\nimport type { ApprovalOptions, BudgetOptions, PolicyHandler } from '../types.js'\n\n/** Mark a tool as requiring human approval before execution. */\nexport const RequiresApproval = createDecorator<ApprovalOptions>()\n\n/** Require specific capabilities (permissions) to execute a tool. */\nexport const RequiresCapability = createDecorator<string[]>()\n\n/** Set a cost budget for an agent or tool scope. */\nexport const Budget = createDecorator<BudgetOptions>()\n\n/** Attach policy handler functions (CASL-style authorization). */\nexport const Policy = createDecorator<PolicyHandler[]>()\n","/**\n * Observability decorators for agent tracing and auditing.\n */\nimport { createDecorator } from '@theokit/http-decorators'\n\n/** Enable distributed tracing for a tool/toolbox/agent. */\nexport const Trace = createDecorator<boolean>()\n\n/** Enable audit logging for a tool/toolbox/agent. */\nexport const Audit = createDecorator<boolean>()\n","/**\n * @Gateway() — declares which platform adapters an agent supports.\n *\n * Stores gateway configuration metadata on the agent class.\n * The GatewayRunner reads this to auto-wire adapters without manual plumbing.\n *\n * @example\n * ```ts\n * @Agent({ name: 'support', route: '/api/agents/support' })\n * @Gateway({\n * platforms: ['telegram', 'discord', 'slack'],\n * sessionStrategy: 'per-user',\n * })\n * @UseGuards(AuthGuard)\n * class SupportAgent {\n * @MainLoop()\n * async run(ctx: AgentContext) { ... }\n * }\n * ```\n */\nimport { setMeta, getMeta } from '../metadata/index.js'\n\nconst GATEWAY_CONFIG = Symbol.for('theokit:agents:gateway')\n\nexport type PlatformName =\n | 'telegram'\n | 'discord'\n | 'slack'\n | 'whatsapp'\n | 'teams'\n | 'email'\n | 'sms'\n | 'mattermost'\n | 'line'\n | 'matrix'\n\nexport type SessionStrategy =\n | 'per-user' // telegram-dm-{userId}\n | 'per-channel' // telegram-grp-{channelId}\n | 'per-thread' // telegram-tpc-{channelId}-{topicId}\n\nexport interface GatewayOptions {\n /** Platform adapters this agent supports. */\n platforms: PlatformName[]\n /** How to resolve agentId from inbound events (default: 'per-user'). */\n sessionStrategy?: SessionStrategy\n /** Auto-start typing indicator while agent processes (default: true). */\n typing?: boolean\n}\n\nexport function Gateway(options: GatewayOptions): ClassDecorator {\n return (target: Function) => {\n setMeta(GATEWAY_CONFIG, target, { typing: true, sessionStrategy: 'per-user', ...options })\n }\n}\n\nexport function getGatewayConfig(target: Function): GatewayOptions | undefined {\n return getMeta<GatewayOptions>(GATEWAY_CONFIG, target)\n}\n\n/**\n * Resolve a stable agentId from a platform event based on the session strategy.\n *\n * Mirrors @theokit/gateway SessionRouter.defaultStrategy() but is configurable\n * via the @Gateway decorator.\n */\nexport function resolveSessionId(\n strategy: SessionStrategy,\n platform: string,\n sender: { id: string },\n channel: { id: string; type: 'dm' | 'group' | 'thread'; topicId?: string },\n): string {\n switch (strategy) {\n case 'per-user':\n return `${platform}-dm-${sender.id}`\n case 'per-channel':\n return `${platform}-grp-${channel.id}`\n case 'per-thread':\n return `${platform}-tpc-${channel.id}-${channel.topicId ?? 'main'}`\n }\n}\n","/**\n * @SubAgents() — declares child agents that a parent agent can handoff to.\n *\n * Compiles to the SDK's `AgentOptions.agents` map. The parent agent\n * can delegate work to sub-agents via the built-in Agent tool.\n *\n * @example\n * ```ts\n * @Agent({ name: 'orchestrator', route: '/api/agents/orchestrator' })\n * @SubAgents([ResearchAgent, CoderAgent, ReviewerAgent])\n * class OrchestratorAgent {\n * @MainLoop({ strategy: 'plan-act-reflect' })\n * async run(ctx: AgentContext) { ... }\n * }\n * ```\n *\n * Each referenced class MUST be decorated with @Agent().\n * The compiler reads their metadata to build the SDK agents map.\n */\nimport { setMeta, getMeta } from '../metadata/index.js'\n\nimport { getAgentConfig } from './agent.js'\n\nconst SUB_AGENTS = Symbol.for('theokit:agents:sub-agents')\n\nexport function SubAgents(agentClasses: Function[]): ClassDecorator {\n return (target: Function) => {\n // Validate at decoration time: all classes must have @Agent\n for (const cls of agentClasses) {\n const config = getAgentConfig(cls)\n if (!config) {\n throw new Error(\n `[@theokit/agents] @SubAgents on ${target.name}: class ${cls.name} is missing @Agent() decorator.`,\n )\n }\n }\n setMeta(SUB_AGENTS, target, agentClasses)\n }\n}\n\nexport function getSubAgents(target: Function): Function[] {\n return getMeta<Function[]>(SUB_AGENTS, target) ?? []\n}\n","/**\n * @Memory() — declares persistent memory configuration for an agent.\n *\n * Compiles to SDK's MemorySettings in Agent.create({ memory }).\n * Memory is per-agent, scoped by session strategy.\n *\n * @example\n * ```ts\n * @Agent({ name: 'support', route: '/api/agents/support' })\n * @Memory({ provider: 'built-in', embeddings: true, fts: true, scope: 'per-user' })\n * class SupportAgent { ... }\n * ```\n */\nimport { setMeta, getMeta } from '../metadata/index.js'\n\nconst MEMORY_CONFIG = Symbol.for('theokit:agents:memory')\n\nexport type MemoryProvider = 'built-in' | 'honcho' | 'supermemory' | 'mem0'\nexport type MemoryScope = 'per-user' | 'per-agent' | 'per-tenant' | 'global'\n\nexport interface MemoryOptions {\n /** Memory provider backend. */\n provider?: MemoryProvider\n /** Enable semantic search via embeddings. */\n embeddings?: boolean\n /** Enable full-text search (FTS5). */\n fts?: boolean\n /** Memory isolation scope (default: 'per-user'). */\n scope?: MemoryScope\n /** Maximum facts to retain per scope (0 = unlimited). */\n maxFacts?: number\n}\n\nexport function Memory(options: MemoryOptions = {}): ClassDecorator {\n return (target: Function) => {\n setMeta(MEMORY_CONFIG, target, {\n provider: 'built-in',\n embeddings: false,\n fts: false,\n scope: 'per-user',\n ...options,\n })\n }\n}\n\nexport function getMemoryConfig(target: Function): MemoryOptions | undefined {\n return getMeta<MemoryOptions>(MEMORY_CONFIG, target)\n}\n","/**\n * @Skills() — declares markdown skill files injected into the agent's system prompt.\n *\n * Compiles to SDK's SkillsSettings in Agent.create({ skills }).\n * Skills are .theokit/skills/<name>/SKILL.md files discovered at agent creation.\n *\n * @example\n * ```ts\n * @Agent({ name: 'support', route: '/api/agents/support' })\n * @Skills(['customer-service', 'refund-policy', 'escalation-protocol'])\n * class SupportAgent { ... }\n * ```\n */\nimport { setMeta, getMeta } from '../metadata/index.js'\n\nconst SKILLS_CONFIG = Symbol.for('theokit:agents:skills')\n\nexport interface SkillsOptions {\n /** Skill names to include (resolved from .theokit/skills/<name>/SKILL.md). */\n include: string[]\n /** Auto-discover all skills in .theokit/skills/ (default: false). */\n autoDiscover?: boolean\n}\n\nexport function Skills(namesOrOptions: string[] | SkillsOptions): ClassDecorator {\n return (target: Function) => {\n const options: SkillsOptions = Array.isArray(namesOrOptions)\n ? { include: namesOrOptions, autoDiscover: false }\n : namesOrOptions\n setMeta(SKILLS_CONFIG, target, options)\n }\n}\n\nexport function getSkillsConfig(target: Function): SkillsOptions | undefined {\n return getMeta<SkillsOptions>(SKILLS_CONFIG, target)\n}\n","/**\n * @MCP() — declares Model Context Protocol servers available to an agent.\n *\n * Compiles to SDK's mcpServers in Agent.create({ mcpServers }).\n * Each key is a server name; the value is the server configuration.\n *\n * @example\n * ```ts\n * @Agent({ name: 'dev', route: '/api/agents/dev' })\n * @MCP({\n * github: { command: 'npx', args: ['-y', '@modelcontextprotocol/server-github'] },\n * filesystem: { command: 'npx', args: ['-y', '@mcp/server-filesystem', '/workspace'] },\n * })\n * class DevAgent { ... }\n * ```\n */\nimport { setMeta, getMeta } from '../metadata/index.js'\n\nconst MCP_CONFIG = Symbol.for('theokit:agents:mcp')\n\nexport interface McpServerConfig {\n /** Command to start the MCP server. */\n command: string\n /** Arguments passed to the command. */\n args?: string[]\n /** Environment variables for the server process. */\n env?: Record<string, string>\n /** Working directory for the server process. */\n cwd?: string\n}\n\nexport type McpServersMap = Record<string, McpServerConfig>\n\nexport function MCP(servers: McpServersMap): ClassDecorator {\n return (target: Function) => {\n setMeta(MCP_CONFIG, target, servers)\n }\n}\n\nexport function getMcpConfig(target: Function): McpServersMap | undefined {\n return getMeta<McpServersMap>(MCP_CONFIG, target)\n}\n","/**\n * @Mixin() — compose reusable capability classes into an agent.\n *\n * Mixins are classes with @Tool methods that can be shared across agents.\n * @Mixin copies tool metadata from mixin classes to the decorated agent,\n * making those tools available without inheritance.\n *\n * @example\n * ```ts\n * // Define reusable capabilities\n * class WithSearchCapability {\n * @Tool({ name: 'web_search', description: 'Search', input: z.object({...}) })\n * async webSearch(input) { ... }\n * }\n *\n * class WithFileSystem {\n * @Tool({ name: 'read_file', description: 'Read', input: z.object({...}) })\n * async readFile(input) { ... }\n * }\n *\n * // Compose into agent\n * @Agent({ name: 'research', route: '/research' })\n * @Mixin(WithSearchCapability, WithFileSystem)\n * class ResearchAgent {\n * @MainLoop()\n * async run() {}\n * }\n * ```\n */\nimport { setMeta, getMeta } from '../metadata/index.js'\n\nconst MIXIN_CLASSES = Symbol.for('theokit:agents:mixins')\n\nexport function Mixin(...mixinClasses: Function[]): ClassDecorator {\n return (target: Function) => {\n const existing = getMeta<Function[]>(MIXIN_CLASSES, target) ?? []\n setMeta(MIXIN_CLASSES, target, [...existing, ...mixinClasses])\n }\n}\n\nexport function getMixins(target: Function): Function[] {\n return getMeta<Function[]>(MIXIN_CLASSES, target) ?? []\n}\n"],"mappings":"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","names":["setMeta","getMeta","AGENT_CONFIG","Symbol","for","AGENT_MAIN_LOOP","TOOLBOX_CONFIG","TOOL_CONFIG","TOOL_METHODS","Agent","options","target","setMeta","AGENT_CONFIG","stream","getAgentConfig","getMeta","createDecorator","RequiresApproval","RequiresCapability","Budget","Policy","createDecorator","Trace","Audit","GATEWAY_CONFIG","Symbol","for","Gateway","options","target","setMeta","typing","sessionStrategy","getGatewayConfig","getMeta","resolveSessionId","strategy","platform","sender","channel","id","topicId","SUB_AGENTS","Symbol","for","SubAgents","agentClasses","target","cls","config","getAgentConfig","Error","name","setMeta","getSubAgents","getMeta","MEMORY_CONFIG","Symbol","for","Memory","options","target","setMeta","provider","embeddings","fts","scope","getMemoryConfig","getMeta","SKILLS_CONFIG","Symbol","for","Skills","namesOrOptions","target","options","Array","isArray","include","autoDiscover","setMeta","getSkillsConfig","getMeta","MCP_CONFIG","Symbol","for","MCP","servers","target","setMeta","getMcpConfig","getMeta","MIXIN_CLASSES","Symbol","for","Mixin","mixinClasses","target","existing","getMeta","setMeta","getMixins"]}
|