@agentuity/runtime 0.0.6
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/AGENTS.md +128 -0
- package/README.md +221 -0
- package/dist/_config.d.ts +61 -0
- package/dist/_config.d.ts.map +1 -0
- package/dist/_context.d.ts +33 -0
- package/dist/_context.d.ts.map +1 -0
- package/dist/_idle.d.ts +7 -0
- package/dist/_idle.d.ts.map +1 -0
- package/dist/_server.d.ts +17 -0
- package/dist/_server.d.ts.map +1 -0
- package/dist/_services.d.ts +2 -0
- package/dist/_services.d.ts.map +1 -0
- package/dist/_util.d.ts +16 -0
- package/dist/_util.d.ts.map +1 -0
- package/dist/_waituntil.d.ts +20 -0
- package/dist/_waituntil.d.ts.map +1 -0
- package/dist/agent.d.ts +88 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/app.d.ts +24 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/logger/console.d.ts +50 -0
- package/dist/logger/console.d.ts.map +1 -0
- package/dist/logger/index.d.ts +4 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/internal.d.ts +79 -0
- package/dist/logger/internal.d.ts.map +1 -0
- package/dist/logger/logger.d.ts +41 -0
- package/dist/logger/logger.d.ts.map +1 -0
- package/dist/logger/user.d.ts +8 -0
- package/dist/logger/user.d.ts.map +1 -0
- package/dist/logger/util.d.ts +11 -0
- package/dist/logger/util.d.ts.map +1 -0
- package/dist/otel/config.d.ts +17 -0
- package/dist/otel/config.d.ts.map +1 -0
- package/dist/otel/console.d.ts +26 -0
- package/dist/otel/console.d.ts.map +1 -0
- package/dist/otel/fetch.d.ts +12 -0
- package/dist/otel/fetch.d.ts.map +1 -0
- package/dist/otel/http.d.ts +16 -0
- package/dist/otel/http.d.ts.map +1 -0
- package/dist/otel/logger.d.ts +36 -0
- package/dist/otel/logger.d.ts.map +1 -0
- package/dist/otel/otel.d.ts +58 -0
- package/dist/otel/otel.d.ts.map +1 -0
- package/dist/router.d.ts +37 -0
- package/dist/router.d.ts.map +1 -0
- package/package.json +58 -0
- package/src/_config.ts +101 -0
- package/src/_context.ts +86 -0
- package/src/_idle.ts +26 -0
- package/src/_server.ts +279 -0
- package/src/_services.ts +164 -0
- package/src/_util.ts +63 -0
- package/src/_waituntil.ts +246 -0
- package/src/agent.ts +287 -0
- package/src/app.ts +31 -0
- package/src/index.ts +5 -0
- package/src/logger/console.ts +111 -0
- package/src/logger/index.ts +3 -0
- package/src/logger/internal.ts +165 -0
- package/src/logger/logger.ts +44 -0
- package/src/logger/user.ts +11 -0
- package/src/logger/util.ts +80 -0
- package/src/otel/config.ts +81 -0
- package/src/otel/console.ts +56 -0
- package/src/otel/fetch.ts +103 -0
- package/src/otel/http.ts +51 -0
- package/src/otel/logger.ts +238 -0
- package/src/otel/otel.ts +317 -0
- package/src/router.ts +302 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Agent Guidelines for @agentuity/runtime
|
|
2
|
+
|
|
3
|
+
## Package Overview
|
|
4
|
+
|
|
5
|
+
Server runtime for building Agentuity applications. Built on Hono framework and optimized for Bun runtime with OpenTelemetry observability.
|
|
6
|
+
|
|
7
|
+
## Commands
|
|
8
|
+
|
|
9
|
+
- **Build**: `bun run build` (compiles for Bun target)
|
|
10
|
+
- **Typecheck**: `bun run typecheck` (runs TypeScript type checking)
|
|
11
|
+
- **Clean**: `bun run clean` (removes dist/)
|
|
12
|
+
|
|
13
|
+
## Architecture
|
|
14
|
+
|
|
15
|
+
- **Runtime**: Bun server runtime
|
|
16
|
+
- **Framework**: Hono (lightweight web framework)
|
|
17
|
+
- **Build target**: Bun runtime
|
|
18
|
+
- **Dependencies**: `@agentuity/core`, Hono, OpenTelemetry
|
|
19
|
+
- **Observability**: Built-in OpenTelemetry for logs, traces, and metrics
|
|
20
|
+
|
|
21
|
+
## Structure
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
src/
|
|
25
|
+
├── index.ts # Main exports
|
|
26
|
+
├── app.ts # createApp() function
|
|
27
|
+
├── agent.ts # Agent types and defineAgent()
|
|
28
|
+
├── router.ts # createRouter() with extended methods
|
|
29
|
+
├── logger.ts # Logging utilities
|
|
30
|
+
├── _server.ts # Internal server creation
|
|
31
|
+
├── _context.ts # Internal context management
|
|
32
|
+
└── _util.ts # Internal utilities
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Code Style
|
|
36
|
+
|
|
37
|
+
- **Hono patterns** - Follow Hono's context-based API design
|
|
38
|
+
- **Type safety** - Extensive use of TypeScript generics
|
|
39
|
+
- **Middleware pattern** - Support Hono middleware
|
|
40
|
+
- **Async handlers** - All handlers can be async
|
|
41
|
+
- **OpenTelemetry** - Use tracer/logger from context
|
|
42
|
+
|
|
43
|
+
## Important Conventions
|
|
44
|
+
|
|
45
|
+
- **Agent context** - Every agent handler receives `AgentContext` as first parameter
|
|
46
|
+
- **Schema validation** - Support StandardSchemaV1 (works with Zod, Valibot, etc.)
|
|
47
|
+
- **Streaming support** - Agents can return ReadableStream for streaming responses
|
|
48
|
+
- **WebSocket support** - Use `router.websocket()` for WebSocket routes
|
|
49
|
+
- **SSE support** - Use `router.sse()` for Server-Sent Events
|
|
50
|
+
- **Session tracking** - Each request gets unique sessionId
|
|
51
|
+
- **Storage abstractions** - Provide kv, objectstore, stream, vector interfaces
|
|
52
|
+
|
|
53
|
+
## Agent Definition Pattern
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { defineAgent } from '@agentuity/runtime';
|
|
57
|
+
import { z } from 'zod';
|
|
58
|
+
|
|
59
|
+
export default defineAgent({
|
|
60
|
+
metadata: {
|
|
61
|
+
id: 'unique-id',
|
|
62
|
+
identifier: 'folder-name',
|
|
63
|
+
name: 'Human Name',
|
|
64
|
+
description: 'What it does',
|
|
65
|
+
filename: __filename,
|
|
66
|
+
version: 'hash-or-version',
|
|
67
|
+
},
|
|
68
|
+
inputSchema: z.object({
|
|
69
|
+
/* ... */
|
|
70
|
+
}),
|
|
71
|
+
outputSchema: z.object({
|
|
72
|
+
/* ... */
|
|
73
|
+
}),
|
|
74
|
+
handler: async (ctx, input) => {
|
|
75
|
+
// ctx.logger, ctx.tracer, ctx.kv, etc.
|
|
76
|
+
return output;
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Router Extensions
|
|
82
|
+
|
|
83
|
+
The `createRouter()` function returns an extended Hono instance with:
|
|
84
|
+
|
|
85
|
+
- **Standard HTTP methods**: `get`, `post`, `put`, `delete`, `patch`
|
|
86
|
+
- **Streaming**: `stream(path, handler)` - Returns ReadableStream
|
|
87
|
+
- **WebSocket**: `websocket(path, handler)` - WebSocket connections
|
|
88
|
+
- **SSE**: `sse(path, handler)` - Server-Sent Events
|
|
89
|
+
|
|
90
|
+
## AgentContext API
|
|
91
|
+
|
|
92
|
+
Every agent handler receives:
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
interface AgentContext {
|
|
96
|
+
logger: Logger; // Structured logger
|
|
97
|
+
tracer: Tracer; // OpenTelemetry tracer
|
|
98
|
+
sessionId: string; // Unique session ID
|
|
99
|
+
kv: KeyValueStorage; // Key-value storage
|
|
100
|
+
objectstore: ObjectStorage; // Object storage
|
|
101
|
+
stream: StreamStorage; // Stream storage
|
|
102
|
+
vector: VectorStorage; // Vector storage
|
|
103
|
+
agent: AgentRegistry; // Access other agents
|
|
104
|
+
waitUntil: (promise) => void; // Background tasks
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Observability
|
|
109
|
+
|
|
110
|
+
- **Logging**: Use `ctx.logger.info/warn/error()` not console.log
|
|
111
|
+
- **Tracing**: Create spans with `ctx.tracer.startSpan()`
|
|
112
|
+
- **Metrics**: Access via `c.var.meter` in Hono context
|
|
113
|
+
- **Environment**: Metrics/traces sent to OTLP endpoints
|
|
114
|
+
|
|
115
|
+
## Testing
|
|
116
|
+
|
|
117
|
+
- Use Bun's test runner: `bun test`
|
|
118
|
+
- Mock storage interfaces (kv, objectstore, etc.)
|
|
119
|
+
- Test agent handlers with mock context
|
|
120
|
+
- Use Hono's testing utilities for routes
|
|
121
|
+
|
|
122
|
+
## Publishing Checklist
|
|
123
|
+
|
|
124
|
+
1. Run `bun run build` to compile for Bun runtime
|
|
125
|
+
2. Verify OpenTelemetry dependencies are correct versions
|
|
126
|
+
3. Test with real Hono server
|
|
127
|
+
4. Must publish **after** @agentuity/core
|
|
128
|
+
5. Ensure React is only in devDependencies (for type checking web components)
|
package/README.md
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# @agentuity/runtime
|
|
2
|
+
|
|
3
|
+
Server runtime for building Agentuity applications with Bun and Hono.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @agentuity/runtime
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
`@agentuity/runtime` provides the server-side runtime for Agentuity applications. Built on [Hono](https://hono.dev/) and optimized for [Bun](https://bun.sh/), it enables you to create type-safe agents with automatic routing, validation, and observability.
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
### Creating an Application
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { createApp } from '@agentuity/runtime';
|
|
21
|
+
|
|
22
|
+
const { app, server, logger } = createApp();
|
|
23
|
+
|
|
24
|
+
// Start the server
|
|
25
|
+
server.listen(3000);
|
|
26
|
+
logger.info('Server running on http://localhost:3000');
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Defining an Agent
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { type AgentContext, createAgent } from '@agentuity/runtime';
|
|
33
|
+
import { z } from 'zod';
|
|
34
|
+
|
|
35
|
+
const agent = createAgent({
|
|
36
|
+
schema: {
|
|
37
|
+
input: z.object({
|
|
38
|
+
message: z.string(),
|
|
39
|
+
}),
|
|
40
|
+
output: z.object({
|
|
41
|
+
response: z.string(),
|
|
42
|
+
}),
|
|
43
|
+
},
|
|
44
|
+
handler: async (ctx: AgentContext, input) => {
|
|
45
|
+
ctx.logger.info('Processing message:', input.message);
|
|
46
|
+
return { response: `You said: ${input.message}` };
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export default agent;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Creating Custom Routes
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { createRouter } from '@agentuity/runtime';
|
|
57
|
+
|
|
58
|
+
const router = createRouter();
|
|
59
|
+
|
|
60
|
+
router.get('/hello', (c) => {
|
|
61
|
+
return c.json({ message: 'Hello, world!' });
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
router.post('/data', async (c) => {
|
|
65
|
+
const body = await c.req.json();
|
|
66
|
+
return c.json({ received: body });
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export default router;
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Streaming Responses
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
router.stream('/events', async (c) => {
|
|
76
|
+
return new ReadableStream({
|
|
77
|
+
start(controller) {
|
|
78
|
+
controller.enqueue('Event 1\n');
|
|
79
|
+
controller.enqueue('Event 2\n');
|
|
80
|
+
controller.close();
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### WebSocket Support
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
router.websocket('/chat', (c) => (ws) => {
|
|
90
|
+
ws.onOpen(() => {
|
|
91
|
+
console.log('Client connected');
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
ws.onMessage((event) => {
|
|
95
|
+
const data = JSON.parse(event.data);
|
|
96
|
+
ws.send(JSON.stringify({ echo: data }));
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
ws.onClose(() => {
|
|
100
|
+
console.log('Client disconnected');
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Server-Sent Events (SSE)
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
router.sse('/updates', (c) => async (stream) => {
|
|
109
|
+
for (let i = 0; i < 10; i++) {
|
|
110
|
+
await stream.writeSSE({
|
|
111
|
+
data: JSON.stringify({ count: i }),
|
|
112
|
+
event: 'update',
|
|
113
|
+
});
|
|
114
|
+
await stream.sleep(1000);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## API Reference
|
|
120
|
+
|
|
121
|
+
### createApp(config?)
|
|
122
|
+
|
|
123
|
+
Creates a new Agentuity application instance.
|
|
124
|
+
|
|
125
|
+
**Returns:**
|
|
126
|
+
|
|
127
|
+
- `app` - Hono application instance
|
|
128
|
+
- `server` - Server instance with `listen()` method
|
|
129
|
+
- `logger` - Structured logger
|
|
130
|
+
|
|
131
|
+
### createAgent(config)
|
|
132
|
+
|
|
133
|
+
Creates a type-safe agent with input/output validation.
|
|
134
|
+
|
|
135
|
+
**Config:**
|
|
136
|
+
|
|
137
|
+
- `schema.input?` - Schema for input validation (Zod, Valibot, etc.)
|
|
138
|
+
- `schema.output?` - Schema for output validation
|
|
139
|
+
- `handler` - Agent handler function `(ctx: AgentContext, input) => output`
|
|
140
|
+
|
|
141
|
+
### createRouter()
|
|
142
|
+
|
|
143
|
+
Creates a new router for defining custom API routes.
|
|
144
|
+
|
|
145
|
+
**Methods:**
|
|
146
|
+
|
|
147
|
+
- `get/post/put/delete/patch` - HTTP method handlers
|
|
148
|
+
- `stream(path, handler)` - Streaming response handler
|
|
149
|
+
- `websocket(path, handler)` - WebSocket handler
|
|
150
|
+
- `sse(path, handler)` - Server-Sent Events handler
|
|
151
|
+
|
|
152
|
+
### AgentContext
|
|
153
|
+
|
|
154
|
+
Context object available in agent handlers:
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
interface AgentContext {
|
|
158
|
+
logger: Logger; // Structured logger
|
|
159
|
+
tracer: Tracer; // OpenTelemetry tracer
|
|
160
|
+
sessionId: string; // Unique session ID
|
|
161
|
+
kv: KeyValueStorage; // Key-value storage
|
|
162
|
+
objectstore: ObjectStorage; // Object storage
|
|
163
|
+
stream: StreamStorage; // Stream storage
|
|
164
|
+
vector: VectorStorage; // Vector storage
|
|
165
|
+
agent: AgentRegistry; // Access to other agents
|
|
166
|
+
waitUntil: (promise) => void; // Defer cleanup tasks
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Storage Services
|
|
171
|
+
|
|
172
|
+
Agentuity provides built-in storage abstractions:
|
|
173
|
+
|
|
174
|
+
- **KeyValueStorage** - Simple key-value storage
|
|
175
|
+
- **ObjectStorage** - Object/blob storage
|
|
176
|
+
- **StreamStorage** - Streaming data storage
|
|
177
|
+
- **VectorStorage** - Vector embeddings storage
|
|
178
|
+
|
|
179
|
+
Access these via the agent context:
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
const agent = createAgent({
|
|
183
|
+
schema: {
|
|
184
|
+
output: z.object({ value: z.string().optional() }),
|
|
185
|
+
},
|
|
186
|
+
handler: async (ctx, input) => {
|
|
187
|
+
await ctx.kv.set('key', 'value');
|
|
188
|
+
const value = await ctx.kv.get('key');
|
|
189
|
+
return { value };
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Observability
|
|
195
|
+
|
|
196
|
+
Built-in OpenTelemetry support for logging, tracing, and metrics:
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
const agent = createAgent({
|
|
200
|
+
schema: {
|
|
201
|
+
output: z.object({ success: z.boolean() }),
|
|
202
|
+
},
|
|
203
|
+
handler: async (ctx, input) => {
|
|
204
|
+
ctx.logger.info('Processing request');
|
|
205
|
+
|
|
206
|
+
const span = ctx.tracer.startSpan('custom-operation');
|
|
207
|
+
// ... do work ...
|
|
208
|
+
span.end();
|
|
209
|
+
|
|
210
|
+
return { success: true };
|
|
211
|
+
},
|
|
212
|
+
});
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## TypeScript
|
|
216
|
+
|
|
217
|
+
Fully typed with TypeScript. Input and output types are automatically inferred from your schemas.
|
|
218
|
+
|
|
219
|
+
## License
|
|
220
|
+
|
|
221
|
+
MIT
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the SDK Version that was used to build this app
|
|
3
|
+
*
|
|
4
|
+
* @returns string
|
|
5
|
+
*/
|
|
6
|
+
export declare function getSDKVersion(): string;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the App Name that was used when this app was built
|
|
9
|
+
*
|
|
10
|
+
* @returns string
|
|
11
|
+
*/
|
|
12
|
+
export declare function getAppName(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the App Version that was used when this app was built
|
|
15
|
+
*
|
|
16
|
+
* @returns string
|
|
17
|
+
*/
|
|
18
|
+
export declare function getAppVersion(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the Organization ID for this app
|
|
21
|
+
*
|
|
22
|
+
* @returns string
|
|
23
|
+
*/
|
|
24
|
+
export declare function getOrganizationId(): string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the Project ID for this app
|
|
27
|
+
*
|
|
28
|
+
* @returns string
|
|
29
|
+
*/
|
|
30
|
+
export declare function getProjectId(): string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the Deployment ID for this app that was deployed
|
|
33
|
+
*
|
|
34
|
+
* @returns string | undefined
|
|
35
|
+
*/
|
|
36
|
+
export declare function getDeploymentId(): string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Returns true if the app is running in dev mode
|
|
39
|
+
*
|
|
40
|
+
* @returns boolean
|
|
41
|
+
*/
|
|
42
|
+
export declare function isDevMode(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Returns true if the app is running in production mode
|
|
45
|
+
*
|
|
46
|
+
* @returns boolean
|
|
47
|
+
*/
|
|
48
|
+
export declare function isProduction(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the CLI version that was used when this app was built
|
|
51
|
+
*
|
|
52
|
+
* @returns string
|
|
53
|
+
*/
|
|
54
|
+
export declare function getCLIVersion(): string;
|
|
55
|
+
/**
|
|
56
|
+
* Returns the environment setting for this app
|
|
57
|
+
*
|
|
58
|
+
* @returns string
|
|
59
|
+
*/
|
|
60
|
+
export declare function getEnvironment(): string;
|
|
61
|
+
//# sourceMappingURL=_config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_config.d.ts","sourceRoot":"","sources":["../src/_config.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,MAAM,GAAG,SAAS,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,MAAM,GAAG,SAAS,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Tracer } from '@opentelemetry/api';
|
|
2
|
+
import type { KeyValueStorage, ObjectStorage, StreamStorage, VectorStorage } from '@agentuity/core';
|
|
3
|
+
import type { AgentContext, AgentName } from './agent';
|
|
4
|
+
import type { Logger } from './logger';
|
|
5
|
+
export interface RequestAgentContextArgs<TAgentMap, TAgent> {
|
|
6
|
+
sessionId: string;
|
|
7
|
+
agent: TAgentMap;
|
|
8
|
+
current: TAgent;
|
|
9
|
+
agentName: AgentName;
|
|
10
|
+
logger: Logger;
|
|
11
|
+
tracer: Tracer;
|
|
12
|
+
setHeader: (k: string, v: string) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare class RequestAgentContext<TAgentMap, TAgent> implements AgentContext {
|
|
15
|
+
agent: TAgentMap;
|
|
16
|
+
current: TAgent;
|
|
17
|
+
agentName: AgentName;
|
|
18
|
+
logger: Logger;
|
|
19
|
+
sessionId: string;
|
|
20
|
+
tracer: Tracer;
|
|
21
|
+
kv: KeyValueStorage;
|
|
22
|
+
objectstore: ObjectStorage;
|
|
23
|
+
stream: StreamStorage;
|
|
24
|
+
vector: VectorStorage;
|
|
25
|
+
private waituntilHandler;
|
|
26
|
+
constructor(args: RequestAgentContextArgs<TAgentMap, TAgent>);
|
|
27
|
+
waitUntil(callback: Promise<void> | (() => void | Promise<void>)): void;
|
|
28
|
+
waitUntilAll(): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
export declare const inAgentContext: () => boolean;
|
|
31
|
+
export declare const getAgentContext: () => AgentContext;
|
|
32
|
+
export declare const runInAgentContext: <TAgentMap, TAgent>(ctxObject: Record<string, unknown>, args: RequestAgentContextArgs<TAgentMap, TAgent>, next: () => Promise<void>) => Promise<void>;
|
|
33
|
+
//# sourceMappingURL=_context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_context.d.ts","sourceRoot":"","sources":["../src/_context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa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E,MAAM,EAClD,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,MAAM,uBAAuB,CAAC,SAAS,EAAE,MAAM,CAAC,EAChD,MAAM,MAAM,OAAO,CAAC,IAAI,CAAC,kBAgBzB,CAAC"}
|
package/dist/_idle.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_idle.d.ts","sourceRoot":"","sources":["../src/_idle.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,MAAM,YAiBrB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Tracer } from '@opentelemetry/api';
|
|
2
|
+
import type { SpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
3
|
+
import { Hono } from 'hono';
|
|
4
|
+
import type { BunWebSocketData } from 'hono/bun';
|
|
5
|
+
import type { AppConfig, Env } from './app';
|
|
6
|
+
import type { Logger } from './logger';
|
|
7
|
+
export declare function getServer(): Bun.Server<BunWebSocketData> | null;
|
|
8
|
+
export declare function getApp(): Hono<any, import("hono/types").BlankSchema, "/"> | null;
|
|
9
|
+
export declare function getLogger(): Logger | null;
|
|
10
|
+
export declare function getTracer(): Tracer | null;
|
|
11
|
+
/**
|
|
12
|
+
* add a custom span processor that will be added to the otel configuration. this method must be
|
|
13
|
+
* called before the createApp is called for it to be added.
|
|
14
|
+
*/
|
|
15
|
+
export declare function addSpanProcessor(processor: SpanProcessor): void;
|
|
16
|
+
export declare const createServer: <E extends Env>(app: Hono<E>, _config?: AppConfig) => Bun.Server<BunWebSocketData>;
|
|
17
|
+
//# sourceMappingURL=_server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_server.d.ts","sourceRoot":"","sources":["../src/_server.ts"],"names":[],"mappings":"AACA,OAAO,EAKN,KAAK,MAAM,EAGX,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAavC,wBAAgB,SAAS,wCAExB;AAED,wBAAgB,MAAM,4DAErB;AAED,wBAAgB,SAAS,kBAExB;AAED,wBAAgB,SAAS,kBAExB;AAcD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,aAAa,QAExD;AA2CD,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,GAAG,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,UAAU,SAAS,iCA8G5E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_services.d.ts","sourceRoot":"","sources":["../src/_services.ts"],"names":[],"mappings":"AA8IA,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,GAAG,QAqBtC"}
|
package/dist/_util.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Context } from 'hono';
|
|
2
|
+
export declare function returnResponse(ctx: Context, result: any): Response;
|
|
3
|
+
/**
|
|
4
|
+
* SHA256 hash of the given values
|
|
5
|
+
*
|
|
6
|
+
* @param val one or more strings to hash
|
|
7
|
+
* @returns hash string in hex format
|
|
8
|
+
*/
|
|
9
|
+
export declare function hash(...val: string[]): string;
|
|
10
|
+
/**
|
|
11
|
+
* Safely stringify an object to JSON, handling circular references
|
|
12
|
+
* @param obj - The object to stringify
|
|
13
|
+
* @returns JSON string representation
|
|
14
|
+
*/
|
|
15
|
+
export declare function safeStringify(obj: unknown): string;
|
|
16
|
+
//# sourceMappingURL=_util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_util.d.ts","sourceRoot":"","sources":["../src/_util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGpC,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,YAMvD;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,CAI7C;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAkClD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Tracer } from '@opentelemetry/api';
|
|
2
|
+
import type { Logger } from './logger';
|
|
3
|
+
/**
|
|
4
|
+
* returns true if wait until is pending
|
|
5
|
+
* @returns boolean
|
|
6
|
+
*/
|
|
7
|
+
export declare function hasWaitUntilPending(): boolean;
|
|
8
|
+
export default class WaitUntilHandler {
|
|
9
|
+
private promises;
|
|
10
|
+
private tracer;
|
|
11
|
+
private started;
|
|
12
|
+
private hasCalledWaitUntilAll;
|
|
13
|
+
private setHeader;
|
|
14
|
+
constructor(setHeader: (k: string, v: string) => void, tracer: Tracer);
|
|
15
|
+
waitUntil(promise: Promise<void> | (() => void | Promise<void>)): void;
|
|
16
|
+
hasPending(): boolean;
|
|
17
|
+
private markSessionCompleted;
|
|
18
|
+
waitUntilAll(logger: Logger, sessionId: string): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=_waituntil.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_waituntil.d.ts","sourceRoot":"","sources":["../src/_waituntil.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,MAAM,EAAS,MAAM,oBAAoB,CAAC;AACjF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAKvC;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAG7C;AAED,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACpC,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,qBAAqB,CAAS;IACtC,OAAO,CAAC,SAAS,CAAiC;gBAE/B,SAAS,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,EAAE,MAAM,EAAE,MAAM;IAOrE,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI;IAsCtE,UAAU,IAAI,OAAO;YAId,oBAAoB;IAKrB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAyK3E"}
|
package/dist/agent.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { StandardSchemaV1, KeyValueStorage, ObjectStorage, StreamStorage, VectorStorage } from '@agentuity/core';
|
|
2
|
+
import { type Tracer } from '@opentelemetry/api';
|
|
3
|
+
import type { MiddlewareHandler } from 'hono';
|
|
4
|
+
import type { Logger } from './logger';
|
|
5
|
+
export interface AgentContext {
|
|
6
|
+
waitUntil: (promise: Promise<void> | (() => void | Promise<void>)) => void;
|
|
7
|
+
agent?: any;
|
|
8
|
+
current?: any;
|
|
9
|
+
agentName?: AgentName;
|
|
10
|
+
logger: Logger;
|
|
11
|
+
sessionId: string;
|
|
12
|
+
tracer: Tracer;
|
|
13
|
+
kv: KeyValueStorage;
|
|
14
|
+
objectstore: ObjectStorage;
|
|
15
|
+
stream: StreamStorage;
|
|
16
|
+
vector: VectorStorage;
|
|
17
|
+
}
|
|
18
|
+
interface AgentMetadata {
|
|
19
|
+
/**
|
|
20
|
+
* the unique identifier for this agent and project
|
|
21
|
+
*/
|
|
22
|
+
id: string;
|
|
23
|
+
/**
|
|
24
|
+
* the folder name for the agent
|
|
25
|
+
*/
|
|
26
|
+
identifier: string;
|
|
27
|
+
/**
|
|
28
|
+
* the human readable name for the agent (identifier is used if not specified)
|
|
29
|
+
*/
|
|
30
|
+
name: string;
|
|
31
|
+
/**
|
|
32
|
+
* the human readable description for the agent (empty if not provided)
|
|
33
|
+
*/
|
|
34
|
+
description: string;
|
|
35
|
+
/**
|
|
36
|
+
* the relative path to the agent from the root project directory
|
|
37
|
+
*/
|
|
38
|
+
filename: string;
|
|
39
|
+
/**
|
|
40
|
+
* a unique version for the agent. computed as the SHA256 contents of the file.
|
|
41
|
+
*/
|
|
42
|
+
version: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The Agent handler interface.
|
|
46
|
+
*/
|
|
47
|
+
export type Agent<TInput extends StandardSchemaV1 | undefined = any, TOutput extends StandardSchemaV1 | undefined = any, TStream extends boolean = false> = {
|
|
48
|
+
metadata: AgentMetadata;
|
|
49
|
+
handler: (ctx: AgentContext, ...args: any[]) => any | Promise<any>;
|
|
50
|
+
} & (TInput extends StandardSchemaV1 ? {
|
|
51
|
+
inputSchema: TInput;
|
|
52
|
+
} : {
|
|
53
|
+
inputSchema?: never;
|
|
54
|
+
}) & (TOutput extends StandardSchemaV1 ? {
|
|
55
|
+
outputSchema: TOutput;
|
|
56
|
+
} : {
|
|
57
|
+
outputSchema?: never;
|
|
58
|
+
}) & (TStream extends true ? {
|
|
59
|
+
stream: true;
|
|
60
|
+
} : {
|
|
61
|
+
stream?: false;
|
|
62
|
+
});
|
|
63
|
+
type InferSchemaInput<T> = T extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<T> : never;
|
|
64
|
+
type InferStreamOutput<TOutput, TStream extends boolean> = TStream extends true ? TOutput extends StandardSchemaV1 ? ReadableStream<StandardSchemaV1.InferOutput<TOutput>> : ReadableStream<unknown> : TOutput extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<TOutput> : void;
|
|
65
|
+
export interface AgentRunner<TInput extends StandardSchemaV1 | undefined = any, TOutput extends StandardSchemaV1 | undefined = any, TStream extends boolean = false> {
|
|
66
|
+
metadata: AgentMetadata;
|
|
67
|
+
run: undefined extends TInput ? () => Promise<InferStreamOutput<Exclude<TOutput, undefined>, TStream>> : (input: InferSchemaInput<Exclude<TInput, undefined>>) => Promise<InferStreamOutput<Exclude<TOutput, undefined>, TStream>>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Union type of all registered agent names.
|
|
71
|
+
* Falls back to `string` when no agents are registered (before augmentation).
|
|
72
|
+
* After augmentation, this becomes a strict union of agent names for full type safety.
|
|
73
|
+
*/
|
|
74
|
+
export type AgentName = string;
|
|
75
|
+
export type AgentRegistry = Record<AgentName, AgentRunner>;
|
|
76
|
+
export declare const registerAgent: (name: AgentName, agent: Agent) => void;
|
|
77
|
+
export declare function createAgent<TInput extends StandardSchemaV1 | undefined = undefined, TOutput extends StandardSchemaV1 | undefined = undefined, TStream extends boolean = false>(config: {
|
|
78
|
+
schema?: {
|
|
79
|
+
input?: TInput;
|
|
80
|
+
output?: TOutput;
|
|
81
|
+
stream?: TStream;
|
|
82
|
+
};
|
|
83
|
+
metadata?: Partial<Omit<AgentMetadata, 'id'>>;
|
|
84
|
+
handler: TInput extends StandardSchemaV1 ? TStream extends true ? TOutput extends StandardSchemaV1 ? (c: AgentContext, input: StandardSchemaV1.InferOutput<TInput>) => Promise<ReadableStream<StandardSchemaV1.InferOutput<TOutput>>> | ReadableStream<StandardSchemaV1.InferOutput<TOutput>> : (c: AgentContext, input: StandardSchemaV1.InferOutput<TInput>) => Promise<ReadableStream<unknown>> | ReadableStream<unknown> : TOutput extends StandardSchemaV1 ? (c: AgentContext, input: StandardSchemaV1.InferOutput<TInput>) => Promise<StandardSchemaV1.InferOutput<TOutput>> | StandardSchemaV1.InferOutput<TOutput> : (c: AgentContext, input: StandardSchemaV1.InferOutput<TInput>) => Promise<void> | void : TStream extends true ? TOutput extends StandardSchemaV1 ? (c: AgentContext) => Promise<ReadableStream<StandardSchemaV1.InferOutput<TOutput>>> | ReadableStream<StandardSchemaV1.InferOutput<TOutput>> : (c: AgentContext) => Promise<ReadableStream<unknown>> | ReadableStream<unknown> : TOutput extends StandardSchemaV1 ? (c: AgentContext) => Promise<StandardSchemaV1.InferOutput<TOutput>> | StandardSchemaV1.InferOutput<TOutput> : (c: AgentContext) => Promise<void> | void;
|
|
85
|
+
}): Agent<TInput, TOutput, TStream>;
|
|
86
|
+
export declare const createAgentMiddleware: (agentName: AgentName) => MiddlewareHandler;
|
|
87
|
+
export {};
|
|
88
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,aAAa,EACb,aAAa,EACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAS,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EAAW,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAEvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,WAAW,YAAY;IAI5B,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC;IAC3E,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,eAAe,CAAC;IACpB,WAAW,EAAE,aAAa,CAAC;IAC3B,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,aAAa,CAAC;CACtB;AAED,UAAU,aAAa;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CAAC,GAChF,OAAO,SAAS,gBAAgB,GAC/B,CACA,CAAC,EAAE,YAAY,KAEb,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,GAC9C,gBAAgB,CAAC,WAAW,CAAC,OAAO,CAAC,GACvC,CAAC,CAAC,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC/C,GAAG,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAmDlC;AA2BD,eAAO,MAAM,qBAAqB,GAAI,WAAW,SAAS,KAAG,iBAmD5D,CAAC"}
|
package/dist/app.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Env as HonoEnv, Hono } from 'hono';
|
|
2
|
+
import type { Logger } from './logger';
|
|
3
|
+
import { type Meter, type Tracer } from '@opentelemetry/api';
|
|
4
|
+
export interface AppConfig {
|
|
5
|
+
}
|
|
6
|
+
export interface Variables {
|
|
7
|
+
logger: Logger;
|
|
8
|
+
meter: Meter;
|
|
9
|
+
tracer: Tracer;
|
|
10
|
+
}
|
|
11
|
+
export interface Env extends HonoEnv {
|
|
12
|
+
Variables: Variables;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* create a new app instance
|
|
16
|
+
*
|
|
17
|
+
* @returns App instance
|
|
18
|
+
*/
|
|
19
|
+
export declare function createApp(config?: AppConfig): {
|
|
20
|
+
app: Hono<Env, import("hono/types").BlankSchema, "/">;
|
|
21
|
+
server: Bun.Server<import("hono/bun").BunWebSocketData>;
|
|
22
|
+
logger: Logger;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,IAAI,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAEjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG7D,MAAM,WAAW,SAAS;CAEzB;AAED,MAAM,WAAW,SAAS;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,GAAI,SAAQ,OAAO;IACnC,SAAS,EAAE,SAAS,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,CAAC,EAAE,SAAS;;;;EAK3C"}
|