@reminix/runtime 0.4.0 → 0.6.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/types.d.ts CHANGED
@@ -1,104 +1,210 @@
1
1
  /**
2
- * Handler types for Reminix agents and tools
2
+ * Type definitions for the Reminix Agent Runtime.
3
+ *
4
+ * These types define the contract between AI agents and the Reminix API.
3
5
  */
6
+ import { z } from 'zod/v4';
4
7
  /**
5
- * Message in a conversation
8
+ * Tool call function details.
6
9
  */
7
- export interface Message {
8
- role: 'user' | 'assistant' | 'system' | 'tool';
9
- content: string;
10
- metadata?: Record<string, unknown>;
11
- }
10
+ export declare const ToolCallFunctionSchema: z.ZodObject<{
11
+ name: z.ZodString;
12
+ arguments: z.ZodString;
13
+ }, z.core.$strip>;
14
+ export type ToolCallFunction = z.infer<typeof ToolCallFunctionSchema>;
12
15
  /**
13
- * Tool call made by an agent
16
+ * A tool call made by the assistant.
14
17
  */
15
- export interface ToolCall {
16
- id: string;
17
- name: string;
18
- arguments: Record<string, unknown>;
19
- }
18
+ export declare const ToolCallSchema: z.ZodObject<{
19
+ id: z.ZodString;
20
+ type: z.ZodLiteral<"function">;
21
+ function: z.ZodObject<{
22
+ name: z.ZodString;
23
+ arguments: z.ZodString;
24
+ }, z.core.$strip>;
25
+ }, z.core.$strip>;
26
+ export type ToolCall = z.infer<typeof ToolCallSchema>;
20
27
  /**
21
- * Context provides persistent resources to handlers
22
- */
23
- export interface Context {
24
- /** Chat/thread identifier */
25
- chatId: string;
26
- /** Thread identifier (optional) */
27
- threadId?: string;
28
- /** Memory store for persistent memory */
29
- memory: MemoryStore;
30
- /** Knowledge base for RAG/retrieval */
31
- knowledgeBase: KnowledgeBase;
32
- /** Available tools registry */
33
- tools?: ToolRegistry;
34
- /** User identifier */
35
- userId?: string;
36
- /** Session identifier */
37
- sessionId?: string;
38
- /** Additional metadata */
39
- metadata?: Record<string, unknown>;
40
- /** Extensible for future additions */
41
- [key: string]: unknown;
42
- }
28
+ * Valid message roles.
29
+ */
30
+ export declare const MessageRoleSchema: z.ZodEnum<{
31
+ system: "system";
32
+ user: "user";
33
+ assistant: "assistant";
34
+ tool: "tool";
35
+ }>;
36
+ export type MessageRole = z.infer<typeof MessageRoleSchema>;
43
37
  /**
44
- * Request represents the current invocation
38
+ * A chat message in a conversation.
45
39
  */
46
- export interface Request {
47
- /** Conversation messages */
48
- messages: Message[];
49
- /** Additional metadata for this request */
50
- metadata?: Record<string, unknown>;
51
- }
40
+ export declare const ChatMessageSchema: z.ZodObject<{
41
+ role: z.ZodEnum<{
42
+ system: "system";
43
+ user: "user";
44
+ assistant: "assistant";
45
+ tool: "tool";
46
+ }>;
47
+ content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodAny>, z.ZodNull]>;
48
+ name: z.ZodOptional<z.ZodString>;
49
+ tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
50
+ id: z.ZodString;
51
+ type: z.ZodLiteral<"function">;
52
+ function: z.ZodObject<{
53
+ name: z.ZodString;
54
+ arguments: z.ZodString;
55
+ }, z.core.$strip>;
56
+ }, z.core.$strip>>>;
57
+ tool_call_id: z.ZodOptional<z.ZodString>;
58
+ }, z.core.$strip>;
59
+ export type ChatMessage = z.infer<typeof ChatMessageSchema>;
52
60
  /**
53
- * Response from a handler
54
- */
55
- export interface Response {
56
- /** Response messages */
57
- messages: Message[];
58
- /** Optional metadata (tokens, model, latency, etc.) */
59
- metadata?: {
60
- tokensUsed?: number;
61
- model?: string;
62
- latency?: number;
63
- [key: string]: unknown;
64
- };
65
- /** Tool calls made by the agent */
66
- toolCalls?: ToolCall[];
67
- /** State updates */
68
- stateUpdates?: Record<string, unknown>;
69
- /** Extensible for future additions */
70
- [key: string]: unknown;
61
+ * An assistant message returned by chat handlers.
62
+ */
63
+ export declare const AssistantMessageSchema: z.ZodObject<{
64
+ role: z.ZodLiteral<"assistant">;
65
+ content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodAny>, z.ZodNull]>;
66
+ tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
67
+ id: z.ZodString;
68
+ type: z.ZodLiteral<"function">;
69
+ function: z.ZodObject<{
70
+ name: z.ZodString;
71
+ arguments: z.ZodString;
72
+ }, z.core.$strip>;
73
+ }, z.core.$strip>>>;
74
+ }, z.core.$strip>;
75
+ export type AssistantMessage = z.infer<typeof AssistantMessageSchema>;
76
+ /**
77
+ * Request body for invoke endpoint.
78
+ */
79
+ export declare const InvokeRequestSchema: z.ZodObject<{
80
+ input: z.ZodRecord<z.ZodString, z.ZodAny>;
81
+ stream: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
82
+ }, z.core.$strip>;
83
+ export type InvokeRequest = z.infer<typeof InvokeRequestSchema>;
84
+ /**
85
+ * Request body for chat endpoint.
86
+ */
87
+ export declare const ChatRequestSchema: z.ZodObject<{
88
+ messages: z.ZodArray<z.ZodObject<{
89
+ role: z.ZodEnum<{
90
+ system: "system";
91
+ user: "user";
92
+ assistant: "assistant";
93
+ tool: "tool";
94
+ }>;
95
+ content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodAny>, z.ZodNull]>;
96
+ name: z.ZodOptional<z.ZodString>;
97
+ tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
98
+ id: z.ZodString;
99
+ type: z.ZodLiteral<"function">;
100
+ function: z.ZodObject<{
101
+ name: z.ZodString;
102
+ arguments: z.ZodString;
103
+ }, z.core.$strip>;
104
+ }, z.core.$strip>>>;
105
+ tool_call_id: z.ZodOptional<z.ZodString>;
106
+ }, z.core.$strip>>;
107
+ stream: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
108
+ }, z.core.$strip>;
109
+ export type ChatRequest = z.infer<typeof ChatRequestSchema>;
110
+ /**
111
+ * Response from invoke handler (non-streaming).
112
+ */
113
+ export declare const InvokeResponseSchema: z.ZodObject<{
114
+ output: z.ZodAny;
115
+ }, z.core.$strip>;
116
+ export type InvokeResponse = z.infer<typeof InvokeResponseSchema>;
117
+ /**
118
+ * Response from chat handler (non-streaming).
119
+ */
120
+ export declare const ChatResponseSchema: z.ZodObject<{
121
+ message: z.ZodObject<{
122
+ role: z.ZodLiteral<"assistant">;
123
+ content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodAny>, z.ZodNull]>;
124
+ tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
125
+ id: z.ZodString;
126
+ type: z.ZodLiteral<"function">;
127
+ function: z.ZodObject<{
128
+ name: z.ZodString;
129
+ arguments: z.ZodString;
130
+ }, z.core.$strip>;
131
+ }, z.core.$strip>>>;
132
+ }, z.core.$strip>;
133
+ }, z.core.$strip>;
134
+ export type ChatResponse = z.infer<typeof ChatResponseSchema>;
135
+ /**
136
+ * A streaming chunk.
137
+ */
138
+ export declare const StreamChunkSchema: z.ZodObject<{
139
+ chunk: z.ZodString;
140
+ }, z.core.$strip>;
141
+ export type StreamChunk = z.infer<typeof StreamChunkSchema>;
142
+ /**
143
+ * Input data passed to invoke handlers.
144
+ */
145
+ export type InvokeInput = Record<string, unknown>;
146
+ /**
147
+ * Result from an invoke handler - either a response or an async generator for streaming.
148
+ */
149
+ export type InvokeResult = InvokeResponse | AsyncGenerator<StreamChunk, void, unknown>;
150
+ /**
151
+ * Result from a chat handler - either a response or an async generator for streaming.
152
+ */
153
+ export type ChatResult = ChatResponse | AsyncGenerator<StreamChunk, void, unknown>;
154
+ /**
155
+ * Handler function for invoke requests.
156
+ */
157
+ export type InvokeHandler = (input: InvokeInput) => InvokeResult | Promise<InvokeResult>;
158
+ /**
159
+ * Handler function for chat requests.
160
+ */
161
+ export type ChatHandler = (messages: ChatMessage[]) => ChatResult | Promise<ChatResult>;
162
+ /**
163
+ * Individual agent health status.
164
+ */
165
+ export interface AgentHealth {
166
+ name: string;
167
+ invoke: boolean;
168
+ chat: boolean;
71
169
  }
72
170
  /**
73
- * Memory store interface
171
+ * Overall health response for the runtime.
74
172
  */
75
- export interface MemoryStore {
76
- get(key: string): Promise<unknown>;
77
- set(key: string, value: unknown): Promise<void>;
78
- delete(key: string): Promise<void>;
79
- clear(): Promise<void>;
173
+ export interface HealthResponse {
174
+ status: 'healthy';
175
+ agents: string[];
80
176
  }
81
177
  /**
82
- * Knowledge base interface
178
+ * User-defined metadata for an agent.
83
179
  */
84
- export interface KnowledgeBase {
85
- search(query: string, options?: Record<string, unknown>): Promise<unknown[]>;
86
- add(content: string, metadata?: Record<string, unknown>): Promise<void>;
87
- delete(id: string): Promise<void>;
180
+ export interface AgentMetadata {
181
+ framework?: string;
182
+ model?: string;
183
+ description?: string;
184
+ [key: string]: unknown;
88
185
  }
89
186
  /**
90
- * Tool registry interface
187
+ * Agent information returned by the discovery endpoint.
91
188
  */
92
- export interface ToolRegistry {
93
- get(name: string): ToolHandler | undefined;
94
- list(): string[];
189
+ export interface AgentInfo {
190
+ name: string;
191
+ invoke: boolean;
192
+ chat: boolean;
193
+ metadata: Record<string, unknown>;
95
194
  }
96
195
  /**
97
- * Tool handler function signature
196
+ * Runtime information returned by the discovery endpoint.
98
197
  */
99
- export type ToolHandler = (context: Context, request: Request) => Promise<Response>;
198
+ export interface RuntimeInfo {
199
+ version: string;
200
+ language: 'typescript';
201
+ framework: 'hono';
202
+ }
100
203
  /**
101
- * Agent handler function signature
204
+ * Response from the /_discover endpoint.
102
205
  */
103
- export type AgentHandler = (context: Context, request: Request) => Promise<Response>;
206
+ export interface DiscoverResponse {
207
+ runtime: RuntimeInfo;
208
+ agents: AgentInfo[];
209
+ }
104
210
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,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,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,EAAE,SAAS,EAAE,CAAC;CACrB"}
package/dist/types.js CHANGED
@@ -1,5 +1,85 @@
1
1
  /**
2
- * Handler types for Reminix agents and tools
2
+ * Type definitions for the Reminix Agent Runtime.
3
+ *
4
+ * These types define the contract between AI agents and the Reminix API.
3
5
  */
4
- export {};
6
+ import { z } from 'zod/v4';
7
+ // =============================================================================
8
+ // Message Types
9
+ // =============================================================================
10
+ /**
11
+ * Tool call function details.
12
+ */
13
+ export const ToolCallFunctionSchema = z.object({
14
+ name: z.string(),
15
+ arguments: z.string(),
16
+ });
17
+ /**
18
+ * A tool call made by the assistant.
19
+ */
20
+ export const ToolCallSchema = z.object({
21
+ id: z.string(),
22
+ type: z.literal('function'),
23
+ function: ToolCallFunctionSchema,
24
+ });
25
+ /**
26
+ * Valid message roles.
27
+ */
28
+ export const MessageRoleSchema = z.enum(['system', 'user', 'assistant', 'tool']);
29
+ /**
30
+ * A chat message in a conversation.
31
+ */
32
+ export const ChatMessageSchema = z.object({
33
+ role: MessageRoleSchema,
34
+ content: z.union([z.string(), z.array(z.any()), z.null()]),
35
+ name: z.string().optional(),
36
+ tool_calls: z.array(ToolCallSchema).optional(),
37
+ tool_call_id: z.string().optional(),
38
+ });
39
+ /**
40
+ * An assistant message returned by chat handlers.
41
+ */
42
+ export const AssistantMessageSchema = z.object({
43
+ role: z.literal('assistant'),
44
+ content: z.union([z.string(), z.array(z.any()), z.null()]),
45
+ tool_calls: z.array(ToolCallSchema).optional(),
46
+ });
47
+ // =============================================================================
48
+ // Request Types
49
+ // =============================================================================
50
+ /**
51
+ * Request body for invoke endpoint.
52
+ */
53
+ export const InvokeRequestSchema = z.object({
54
+ input: z.record(z.string(), z.any()),
55
+ stream: z.boolean().optional().default(false),
56
+ });
57
+ /**
58
+ * Request body for chat endpoint.
59
+ */
60
+ export const ChatRequestSchema = z.object({
61
+ messages: z.array(ChatMessageSchema).nonempty(),
62
+ stream: z.boolean().optional().default(false),
63
+ });
64
+ // =============================================================================
65
+ // Response Types
66
+ // =============================================================================
67
+ /**
68
+ * Response from invoke handler (non-streaming).
69
+ */
70
+ export const InvokeResponseSchema = z.object({
71
+ output: z.any(),
72
+ });
73
+ /**
74
+ * Response from chat handler (non-streaming).
75
+ */
76
+ export const ChatResponseSchema = z.object({
77
+ message: AssistantMessageSchema,
78
+ });
79
+ /**
80
+ * A streaming chunk.
81
+ */
82
+ export const StreamChunkSchema = z.object({
83
+ chunk: z.string(),
84
+ });
5
85
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,gFAAgF;AAChF,gBAAgB;AAChB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,C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
4
+ */
5
+ export declare const VERSION = "0.6.0";
6
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,OAAO,UAAU,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Runtime version - auto-generated by bump-version script.
3
+ * Do not edit manually.
4
+ */
5
+ export const VERSION = '0.6.0';
6
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@reminix/runtime",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
- "description": "Reminix runtime for building handlers",
5
+ "description": "Reminix Agent Runtime - Build AI agents that integrate with Reminix",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "exports": {
@@ -18,8 +18,8 @@
18
18
  "keywords": [
19
19
  "reminix",
20
20
  "runtime",
21
- "types",
22
- "handler",
21
+ "agent",
22
+ "ai",
23
23
  "typescript"
24
24
  ],
25
25
  "author": "Reminix <support@reminix.com>",
@@ -30,11 +30,17 @@
30
30
  "directory": "packages/runtime"
31
31
  },
32
32
  "homepage": "https://github.com/reminix-ai/reminix-typescript",
33
- "dependencies": {},
33
+ "dependencies": {
34
+ "@hono/node-server": "^1.19.7",
35
+ "hono": "^4.11.3",
36
+ "zod": "^4.3.5"
37
+ },
34
38
  "devDependencies": {
35
- "@types/jest": "^29.5.0",
36
- "vitest": "^4.0.16",
37
- "tsd": "^0.33.0"
39
+ "@types/node": "^22.0.0",
40
+ "vitest": "^4.0.16"
41
+ },
42
+ "engines": {
43
+ "node": ">=18.0.0"
38
44
  },
39
45
  "publishConfig": {
40
46
  "access": "public"
@@ -1,17 +0,0 @@
1
- /**
2
- * Core handler execution logic
3
- */
4
- import type { AgentHandler, ToolHandler, Context, Request, Response } from './types';
5
- /**
6
- * Execute an agent handler
7
- */
8
- export declare function executeAgent(handler: AgentHandler, context: Context, request: Request): Promise<Response>;
9
- /**
10
- * Execute a tool handler
11
- */
12
- export declare function executeTool(handler: ToolHandler, context: Context, request: Request): Promise<Response>;
13
- /**
14
- * Execute a handler (agent or tool)
15
- */
16
- export declare function executeHandler(handler: AgentHandler | ToolHandler, context: Context, request: Request): Promise<Response>;
17
- //# sourceMappingURL=executor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAErF;;GAEG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,QAAQ,CAAC,CAEnB;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,QAAQ,CAAC,CAEnB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,YAAY,GAAG,WAAW,EACnC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,QAAQ,CAAC,CAEnB"}
package/dist/executor.js DELETED
@@ -1,22 +0,0 @@
1
- /**
2
- * Core handler execution logic
3
- */
4
- /**
5
- * Execute an agent handler
6
- */
7
- export async function executeAgent(handler, context, request) {
8
- return await handler(context, request);
9
- }
10
- /**
11
- * Execute a tool handler
12
- */
13
- export async function executeTool(handler, context, request) {
14
- return await handler(context, request);
15
- }
16
- /**
17
- * Execute a handler (agent or tool)
18
- */
19
- export async function executeHandler(handler, context, request) {
20
- return await handler(context, request);
21
- }
22
- //# sourceMappingURL=executor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAAqB,EACrB,OAAgB,EAChB,OAAgB;IAEhB,OAAO,MAAM,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAoB,EACpB,OAAgB,EAChB,OAAgB;IAEhB,OAAO,MAAM,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAAmC,EACnC,OAAgB,EAChB,OAAgB;IAEhB,OAAO,MAAM,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC"}
package/dist/loader.d.ts DELETED
@@ -1,19 +0,0 @@
1
- /**
2
- * Load handler from file
3
- */
4
- import type { AgentHandler, ToolHandler } from './types';
5
- export interface LoadedHandler {
6
- agents?: Record<string, AgentHandler>;
7
- tools?: Record<string, ToolHandler>;
8
- prompts?: Record<string, unknown>;
9
- }
10
- /**
11
- * Load handler from a file path
12
- * Supports both TypeScript (.ts) and JavaScript (.js) files
13
- */
14
- export declare function loadHandler(handlerPath: string): Promise<LoadedHandler>;
15
- /**
16
- * Check if a path is a file (not a directory)
17
- */
18
- export declare function isFile(path: string): boolean;
19
- //# sourceMappingURL=loader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEzD,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAqC7E;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAO5C"}
package/dist/loader.js DELETED
@@ -1,52 +0,0 @@
1
- /**
2
- * Load handler from file
3
- */
4
- import { pathToFileURL } from 'url';
5
- import { statSync } from 'fs';
6
- /**
7
- * Load handler from a file path
8
- * Supports both TypeScript (.ts) and JavaScript (.js) files
9
- */
10
- export async function loadHandler(handlerPath) {
11
- try {
12
- // Convert file path to file URL for ES modules
13
- const fileUrl = pathToFileURL(handlerPath).href;
14
- // Dynamic import of the handler module
15
- const module = await import(fileUrl);
16
- // Extract agents, tools, and prompts
17
- const loaded = {};
18
- if (module.agents) {
19
- loaded.agents = module.agents;
20
- }
21
- if (module.tools) {
22
- loaded.tools = module.tools;
23
- }
24
- if (module.prompts) {
25
- loaded.prompts = module.prompts;
26
- }
27
- // Validate that at least one export exists
28
- if (!loaded.agents && !loaded.tools && !loaded.prompts) {
29
- throw new Error(`Handler file "${handlerPath}" must export at least one of: agents, tools, or prompts`);
30
- }
31
- return loaded;
32
- }
33
- catch (error) {
34
- if (error instanceof Error) {
35
- throw new Error(`Failed to load handler from "${handlerPath}": ${error.message}`);
36
- }
37
- throw error;
38
- }
39
- }
40
- /**
41
- * Check if a path is a file (not a directory)
42
- */
43
- export function isFile(path) {
44
- try {
45
- const stats = statSync(path);
46
- return stats.isFile();
47
- }
48
- catch {
49
- return false;
50
- }
51
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CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,MAAM,CAAC,IAAY;IACjC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC7B,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -1,24 +0,0 @@
1
- /**
2
- * Registry for auto-discovering agents, tools, and prompts from directories
3
- */
4
- import type { AgentHandler, ToolHandler } from './types';
5
- export interface Registry {
6
- agents: Record<string, AgentHandler>;
7
- tools: Record<string, ToolHandler>;
8
- prompts: Record<string, unknown>;
9
- }
10
- /**
11
- * Auto-discover and load handlers from a directory structure
12
- *
13
- * Expected structure:
14
- * handler/
15
- * agents/
16
- * chatbot.ts
17
- * assistant.ts
18
- * tools/
19
- * search.ts
20
- * prompts/
21
- * system.ts
22
- */
23
- export declare function discoverRegistry(handlerPath: string): Promise<Registry>;
24
- //# sourceMappingURL=registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEzD,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CA4E7E"}