@agentuity/runtime 0.0.101 → 0.0.102
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 +34 -212
- package/dist/app.d.ts +61 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/middleware.d.ts +59 -3
- package/dist/middleware.d.ts.map +1 -1
- package/dist/middleware.js +133 -24
- package/dist/middleware.js.map +1 -1
- package/dist/services/local/vector.d.ts +5 -1
- package/dist/services/local/vector.d.ts.map +1 -1
- package/dist/services/local/vector.js +112 -0
- package/dist/services/local/vector.js.map +1 -1
- package/package.json +5 -5
- package/src/app.ts +65 -0
- package/src/index.ts +7 -1
- package/src/middleware.ts +146 -25
- package/src/services/local/vector.ts +160 -0
package/AGENTS.md
CHANGED
|
@@ -2,99 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
## Package Overview
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Hono-based server runtime for Agentuity applications, optimized for Bun with OpenTelemetry observability.
|
|
6
6
|
|
|
7
7
|
## Commands
|
|
8
8
|
|
|
9
|
-
- **Build**: `bun run build`
|
|
10
|
-
- **Typecheck**: `bun run typecheck`
|
|
11
|
-
- **
|
|
9
|
+
- **Build**: `bun run build`
|
|
10
|
+
- **Typecheck**: `bun run typecheck`
|
|
11
|
+
- **Test**: `bun test`
|
|
12
|
+
- **Clean**: `bun run clean`
|
|
12
13
|
|
|
13
14
|
## Architecture
|
|
14
15
|
|
|
15
|
-
- **Runtime**: Bun
|
|
16
|
-
- **Framework**: Hono
|
|
17
|
-
- **Build target**: Bun runtime
|
|
16
|
+
- **Runtime**: Bun (required for native WebSocket)
|
|
17
|
+
- **Framework**: Hono
|
|
18
18
|
- **Dependencies**: `@agentuity/core`, Hono, OpenTelemetry
|
|
19
|
-
- **
|
|
20
|
-
- **WebSocket**: Native Bun WebSocket via `hono/bun` (production and development)
|
|
21
|
-
- **Dev Mode**: Integrates with Vite asset server for HMR (proxied through Bun server)
|
|
19
|
+
- **Features**: WebSocket, SSE, streaming, storage abstractions (kv, vector, stream)
|
|
22
20
|
|
|
23
|
-
##
|
|
21
|
+
## Code Conventions
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
├── agent.ts # Agent types and createAgent()
|
|
30
|
-
├── router.ts # createRouter() with extended methods
|
|
31
|
-
├── logger.ts # Logging utilities
|
|
32
|
-
├── _server.ts # Internal server creation
|
|
33
|
-
├── _context.ts # Internal context management
|
|
34
|
-
└── _util.ts # Internal utilities
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Code Style
|
|
38
|
-
|
|
39
|
-
- **Hono patterns** - Follow Hono's context-based API design
|
|
40
|
-
- **Type safety** - Extensive use of TypeScript generics
|
|
41
|
-
- **Middleware pattern** - Support Hono middleware
|
|
42
|
-
- **Async handlers** - All handlers can be async
|
|
43
|
-
- **OpenTelemetry** - Use tracer/logger from context
|
|
44
|
-
|
|
45
|
-
## Important Conventions
|
|
46
|
-
|
|
47
|
-
- **Agent context** - Every agent handler receives `AgentContext` as first parameter
|
|
48
|
-
- **Schema validation** - Support StandardSchemaV1 (works with Zod, Valibot, etc.)
|
|
49
|
-
- **Route validation** - Use `agent.validator()` for automatic input validation with full type safety
|
|
50
|
-
- **Streaming support** - Agents can return ReadableStream for streaming responses
|
|
51
|
-
- **WebSocket support** - Use `router.websocket()` for WebSocket routes
|
|
52
|
-
- **SSE support** - Use `router.sse()` for Server-Sent Events
|
|
53
|
-
- **Session tracking** - Each request gets unique sessionId
|
|
54
|
-
- **Storage abstractions** - Provide kv, stream, vector interfaces
|
|
55
|
-
|
|
56
|
-
## Route Validation
|
|
23
|
+
- **Agent context**: Every handler receives `AgentContext` with logger, tracer, storage
|
|
24
|
+
- **Schema validation**: Use `agent.validator()` for automatic input validation
|
|
25
|
+
- **Observability**: Use `ctx.logger` not `console.log`
|
|
26
|
+
- **Type inference**: Let TypeScript infer handler types from schemas
|
|
57
27
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
```typescript
|
|
61
|
-
import { createRouter } from '@agentuity/runtime';
|
|
62
|
-
import myAgent from './my-agent';
|
|
63
|
-
|
|
64
|
-
const router = createRouter();
|
|
65
|
-
|
|
66
|
-
// Automatic validation using agent's input schema
|
|
67
|
-
router.post('/', myAgent.validator(), async (c) => {
|
|
68
|
-
const data = c.req.valid('json'); // Fully typed from agent schema!
|
|
69
|
-
const output = await myAgent.run(data);
|
|
70
|
-
return c.json(output);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
// Override with custom schema
|
|
74
|
-
router.post(
|
|
75
|
-
'/custom',
|
|
76
|
-
agent.validator({
|
|
77
|
-
input: z.object({ custom: z.string() }),
|
|
78
|
-
}),
|
|
79
|
-
async (c) => {
|
|
80
|
-
const data = c.req.valid('json'); // Typed as { custom: string }
|
|
81
|
-
return c.json(data);
|
|
82
|
-
}
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
// GET routes don't need validation
|
|
86
|
-
router.get('/', async (c) => {
|
|
87
|
-
return c.json({ hello: 'world' });
|
|
88
|
-
});
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
The validator supports three overload signatures:
|
|
92
|
-
|
|
93
|
-
- `agent.validator()` - Uses agent's input/output schemas
|
|
94
|
-
- `agent.validator({ output: schema })` - Output-only validation (GET-compatible)
|
|
95
|
-
- `agent.validator({ input: schema, output?: schema })` - Custom input/output schemas
|
|
96
|
-
|
|
97
|
-
## Agent Definition Pattern
|
|
28
|
+
## Agent Pattern
|
|
98
29
|
|
|
99
30
|
```typescript
|
|
100
31
|
import { createAgent } from '@agentuity/runtime';
|
|
@@ -103,150 +34,41 @@ import { s } from '@agentuity/schema';
|
|
|
103
34
|
export default createAgent('my-agent', {
|
|
104
35
|
description: 'What this agent does',
|
|
105
36
|
schema: {
|
|
106
|
-
input: s.object({
|
|
107
|
-
|
|
108
|
-
}),
|
|
109
|
-
output: s.object({
|
|
110
|
-
/* ... */
|
|
111
|
-
}),
|
|
37
|
+
input: s.object({ name: s.string() }),
|
|
38
|
+
output: s.object({ id: s.string() }),
|
|
112
39
|
},
|
|
113
40
|
handler: async (ctx, input) => {
|
|
114
|
-
// ctx.logger, ctx.
|
|
115
|
-
return
|
|
41
|
+
// ctx.logger, ctx.kv, ctx.tracer available
|
|
42
|
+
return { id: `user-${input.name}` };
|
|
116
43
|
},
|
|
117
44
|
});
|
|
118
45
|
```
|
|
119
46
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
## Router Extensions
|
|
123
|
-
|
|
124
|
-
The `createRouter()` function returns an extended Hono instance with:
|
|
125
|
-
|
|
126
|
-
- **Standard HTTP methods**: `get`, `post`, `put`, `delete`, `patch`
|
|
127
|
-
- **Streaming**: `stream(path, handler)` - Returns ReadableStream
|
|
128
|
-
- **WebSocket**: `websocket(path, handler)` - WebSocket connections
|
|
129
|
-
- **SSE**: `sse(path, handler)` - Server-Sent Events
|
|
130
|
-
|
|
131
|
-
## AgentContext API
|
|
132
|
-
|
|
133
|
-
Every agent handler receives:
|
|
47
|
+
## Route Validation
|
|
134
48
|
|
|
135
49
|
```typescript
|
|
136
|
-
|
|
137
|
-
logger: Logger; // Structured logger
|
|
138
|
-
tracer: Tracer; // OpenTelemetry tracer
|
|
139
|
-
sessionId: string; // Unique session ID
|
|
140
|
-
kv: KeyValueStorage; // Key-value storage
|
|
141
|
-
stream: StreamStorage; // Stream storage
|
|
142
|
-
vector: VectorStorage; // Vector storage
|
|
143
|
-
state: Map<string, unknown>; // Request-scoped state
|
|
144
|
-
thread: Thread; // Thread information
|
|
145
|
-
session: Session; // Session information
|
|
146
|
-
config: TConfig; // Agent-specific config from setup
|
|
147
|
-
app: TAppState; // Application state from createApp
|
|
148
|
-
waitUntil: (promise) => void; // Background tasks
|
|
149
|
-
}
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
## Observability
|
|
153
|
-
|
|
154
|
-
- **Logging**: Use `ctx.logger.info/warn/error()` not console.log
|
|
155
|
-
- **Tracing**: Create spans with `ctx.tracer.startSpan()`
|
|
156
|
-
- **Metrics**: Access via `c.var.meter` in Hono context
|
|
157
|
-
- **Environment**: Metrics/traces sent to OTLP endpoints
|
|
158
|
-
|
|
159
|
-
## Type Safety
|
|
160
|
-
|
|
161
|
-
**End-to-end type safety is a core feature of the runtime.** When you use `createAgent()` with schemas and `agent.validator()` in routes, TypeScript automatically infers correct types throughout your application.
|
|
162
|
-
|
|
163
|
-
### What IS Type-Safe ✅
|
|
164
|
-
|
|
165
|
-
1. **Route handler input types** - `c.req.valid('json')` is automatically typed from agent schema
|
|
166
|
-
2. **Agent handler types** - Both `ctx` and `input` parameters are fully typed
|
|
167
|
-
3. **Runtime validation** - Input/output validation happens automatically
|
|
168
|
-
4. **Schema overrides** - Custom schemas in `agent.validator({ input, output })` maintain type safety
|
|
169
|
-
5. **Multiple agents** - Each route maintains independent type safety
|
|
170
|
-
|
|
171
|
-
### Type Inference Best Practices
|
|
172
|
-
|
|
173
|
-
**CRITICAL:** Do NOT add type annotations to agent handler parameters - let TypeScript infer them:
|
|
50
|
+
const router = createRouter();
|
|
174
51
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
input: z.object({ name: z.string(), age: z.number() }),
|
|
180
|
-
output: z.object({ id: z.string() }),
|
|
181
|
-
},
|
|
182
|
-
handler: async (ctx, input) => {
|
|
183
|
-
// ctx is typed as AgentContext
|
|
184
|
-
// input is typed as { name: string, age: number }
|
|
185
|
-
return { id: `user-${input.name}` };
|
|
186
|
-
},
|
|
52
|
+
// Automatic validation from agent schema
|
|
53
|
+
router.post('/', myAgent.validator(), async (c) => {
|
|
54
|
+
const data = c.req.valid('json'); // Fully typed!
|
|
55
|
+
return c.json(await myAgent.run(data));
|
|
187
56
|
});
|
|
188
|
-
|
|
189
|
-
// ❌ WRONG: Explicit types defeat inference
|
|
190
|
-
handler: async (ctx: AgentContext, input: any) => { ... }
|
|
191
57
|
```
|
|
192
58
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
For best type inference with Hono, use method chaining:
|
|
196
|
-
|
|
197
|
-
```typescript
|
|
198
|
-
// ✅ RECOMMENDED: Method chaining preserves types
|
|
199
|
-
const app = new Hono()
|
|
200
|
-
.post('/users', userAgent.validator(), handler)
|
|
201
|
-
.get('/users/:id', userAgent.validator({ output: UserSchema }), handler);
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
### Testing Type Safety
|
|
205
|
-
|
|
206
|
-
**IMPORTANT:** Due to Hono's `testClient()` type inference limitations with method-chained apps, use `app.request()` for testing:
|
|
59
|
+
## Type Safety
|
|
207
60
|
|
|
208
|
-
|
|
209
|
-
// ✅ CORRECT: Use app.request() for testing
|
|
210
|
-
test('creates user', async () => {
|
|
211
|
-
const app = new Hono().post('/users', agent.validator(), async (c) => {
|
|
212
|
-
const data = c.req.valid('json'); // Fully typed!
|
|
213
|
-
return c.json({ id: `user-${data.name}` });
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
const res = await app.request('/users', {
|
|
217
|
-
method: 'POST',
|
|
218
|
-
headers: { 'Content-Type': 'application/json' },
|
|
219
|
-
body: JSON.stringify({ name: 'Alice', age: 30 }),
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
expect(res.status).toBe(200);
|
|
223
|
-
const result = await res.json();
|
|
224
|
-
expect(result.id).toBe('user-Alice');
|
|
225
|
-
});
|
|
61
|
+
**CRITICAL:** Do NOT add type annotations to handler parameters - let TypeScript infer them.
|
|
226
62
|
|
|
227
|
-
|
|
228
|
-
import { testClient } from 'hono/testing';
|
|
229
|
-
const client = testClient(app); // Returns unknown type
|
|
230
|
-
```
|
|
63
|
+
See [TYPE_SAFETY.md](TYPE_SAFETY.md) for detailed documentation.
|
|
231
64
|
|
|
232
|
-
|
|
65
|
+
## Testing
|
|
233
66
|
|
|
234
|
-
|
|
67
|
+
- Use `app.request()` for route testing (NOT `testClient()`)
|
|
68
|
+
- Mock contexts from `test/helpers/test-context.ts`
|
|
69
|
+
- Import from `../src/` in tests
|
|
235
70
|
|
|
236
|
-
##
|
|
71
|
+
## Publishing
|
|
237
72
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
- **Test imports**: Import from `../src/` not `../`
|
|
241
|
-
- **Mock contexts**: Use `TestAgentContext` from `test/helpers/test-context.ts`
|
|
242
|
-
- **Mock services**: Use mock storage interfaces (kv, stream, vector, etc.)
|
|
243
|
-
- **Route testing**: Use `app.request()` for testing routes (NOT `testClient()`)
|
|
244
|
-
- **Type verification**: Let TypeScript infer agent handler types - do NOT add type annotations
|
|
245
|
-
|
|
246
|
-
## Publishing Checklist
|
|
247
|
-
|
|
248
|
-
1. Run `bun run build` to compile for Bun runtime
|
|
249
|
-
2. Verify OpenTelemetry dependencies are correct versions
|
|
250
|
-
3. Test with real Hono server
|
|
251
|
-
4. Must publish **after** @agentuity/core
|
|
252
|
-
5. Ensure React is only in devDependencies (for type checking web components)
|
|
73
|
+
1. Run build, typecheck, test
|
|
74
|
+
2. Publish **after** `@agentuity/core`
|
package/dist/app.d.ts
CHANGED
|
@@ -1,17 +1,78 @@
|
|
|
1
1
|
import { type Env as HonoEnv } from 'hono';
|
|
2
2
|
import type { cors } from 'hono/cors';
|
|
3
|
+
import type { compress } from 'hono/compress';
|
|
3
4
|
import type { Logger } from './logger';
|
|
4
5
|
import type { Meter, Tracer } from '@opentelemetry/api';
|
|
5
6
|
import type { KeyValueStorage, SessionEventProvider, EvalRunEventProvider, StreamStorage, VectorStorage, SessionStartEvent } from '@agentuity/core';
|
|
6
7
|
import type { Email } from './io/email';
|
|
7
8
|
import type { ThreadProvider, SessionProvider, Session, Thread } from './session';
|
|
8
9
|
import type WaitUntilHandler from './_waituntil';
|
|
10
|
+
import type { Context } from 'hono';
|
|
9
11
|
type CorsOptions = Parameters<typeof cors>[0];
|
|
12
|
+
type HonoCompressOptions = Parameters<typeof compress>[0];
|
|
13
|
+
/**
|
|
14
|
+
* Configuration options for response compression middleware.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const app = await createApp({
|
|
19
|
+
* compression: {
|
|
20
|
+
* enabled: true,
|
|
21
|
+
* threshold: 1024,
|
|
22
|
+
* }
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export interface CompressionConfig {
|
|
27
|
+
/**
|
|
28
|
+
* Enable or disable compression globally.
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
enabled?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Minimum response body size in bytes before compression is attempted.
|
|
34
|
+
* Responses smaller than this threshold will not be compressed.
|
|
35
|
+
* @default 1024
|
|
36
|
+
*/
|
|
37
|
+
threshold?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Optional filter function to skip compression for specific requests.
|
|
40
|
+
* Return false to skip compression for the request.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* filter: (c) => !c.req.path.startsWith('/internal')
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
filter?: (c: Context) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Raw options passed through to Hono's compress middleware.
|
|
50
|
+
* These are merged with Agentuity's defaults.
|
|
51
|
+
*/
|
|
52
|
+
honoOptions?: HonoCompressOptions;
|
|
53
|
+
}
|
|
10
54
|
export interface AppConfig<TAppState = Record<string, never>> {
|
|
11
55
|
/**
|
|
12
56
|
* Override the default cors settings
|
|
13
57
|
*/
|
|
14
58
|
cors?: CorsOptions;
|
|
59
|
+
/**
|
|
60
|
+
* Configure response compression.
|
|
61
|
+
* Set to `false` to disable compression entirely.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const app = await createApp({
|
|
66
|
+
* compression: {
|
|
67
|
+
* threshold: 2048,
|
|
68
|
+
* }
|
|
69
|
+
* });
|
|
70
|
+
*
|
|
71
|
+
* // Or disable compression:
|
|
72
|
+
* const app = await createApp({ compression: false });
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
compression?: CompressionConfig | false;
|
|
15
76
|
/**
|
|
16
77
|
* Override the default services
|
|
17
78
|
*/
|
package/dist/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,IAAI,OAAO,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EACX,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAClF,OAAO,KAAK,gBAAgB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,IAAI,OAAO,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,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AQ,EAAE,CAAC,SAAS,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAClF,IAAI,CAAC;CACR;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,SAAS,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAChE,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,GAC3B,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAiF/B;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,SAAS,GAAG,GAAG,KAAK,SAAS,CAExD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,SAAS,GAAG,GAAG,KAAK,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,CAEhF;AAED;;;GAGG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAMjD"}
|
package/dist/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAsKA;;;GAGG;AACH,MAAM,UAAU,MAAM;IACrB,OAAO,IAAI,CAAC;AACb,CAAC;AAED,yCAAyC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EACN,gBAAgB,IAAI,sBAAsB,EAC1C,mBAAmB,IAAI,yBAAyB,GAChD,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AA0DjD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC9B,MAA6B;IAE7B,6BAA6B;IAC7B,M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;QACR,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,gBAAgB,EAAE,sBAAsB;QACxC,mBAAmB,EAAE,yBAAyB;KAC9C,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW;IAC1B,OAAQ,UAAkB,CAAC,uBAAuB,IAAK,EAAgB,CAAC;AACzE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY;IAC3B,OAAQ,UAAkB,CAAC,wBAAwB,CAAC;AACrD,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW;IAChC,MAAM,QAAQ,GAAI,UAAkB,CAAC,sBAAsB,CAAC;IAC5D,IAAI,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;QAC5B,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;AACF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { type AgentEventName, type AgentEventCallback, type AgentRuntimeState, type CreateEvalConfig, type AgentValidator, type Agent, type CreateAgentConfig, type AgentRunner, getGlobalRuntimeState, getAgentRuntime, type AgentName, type AgentRegistry, registerAgent, setAgentConfig, getAgentConfig, type CreateAgentConfigExplicit, createAgent, populateAgentsRegistry, createAgentMiddleware, getAgents, runAgentSetups, runAgentShutdowns, runInAgentContext, } from './agent';
|
|
2
|
-
export { type AppConfig, type Variables, type TriggerType, type PrivateVariables, type Env, type AppResult, createApp, getApp, getAppState, getAppConfig, runShutdown, fireEvent, } from './app';
|
|
2
|
+
export { type AppConfig, type CompressionConfig, type Variables, type TriggerType, type PrivateVariables, type Env, type AppResult, createApp, getApp, getAppState, getAppConfig, runShutdown, fireEvent, } from './app';
|
|
3
3
|
export { addEventListener, removeEventListener } from './_events';
|
|
4
|
-
export { createBaseMiddleware, createCorsMiddleware, createOtelMiddleware } from './middleware';
|
|
4
|
+
export { createBaseMiddleware, createCorsMiddleware, createOtelMiddleware, createCompressionMiddleware, } from './middleware';
|
|
5
5
|
export { register } from './otel/config';
|
|
6
6
|
export { createServices } from './_services';
|
|
7
7
|
export { enableProcessExitProtection } from './_process-protection';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,qBAAqB,EACrB,eAAe,EACf,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,aAAa,EACb,cAAc,EACd,cAAc,EACd,KAAK,yBAAyB,EAC9B,WAAW,EACX,sBAAsB,EACtB,qBAAqB,EACrB,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACN,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,GAAG,EACR,KAAK,SAAS,EACd,SAAS,EACT,MAAM,EACN,WAAW,EACX,YAAY,EACZ,WAAW,EACX,SAAS,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGlE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,qBAAqB,EACrB,eAAe,EACf,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,aAAa,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C"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ export { getGlobalRuntimeState, getAgentRuntime, registerAgent, setAgentConfig,
|
|
|
4
4
|
export { createApp, getApp, getAppState, getAppConfig, runShutdown, fireEvent, } from './app';
|
|
5
5
|
export { addEventListener, removeEventListener } from './_events';
|
|
6
6
|
// middleware.ts exports (Vite-native)
|
|
7
|
-
export { createBaseMiddleware, createCorsMiddleware, createOtelMiddleware } from './middleware';
|
|
7
|
+
export { createBaseMiddleware, createCorsMiddleware, createOtelMiddleware, createCompressionMiddleware, } from './middleware';
|
|
8
8
|
// Internal exports needed by generated entry files
|
|
9
9
|
export { register } from './otel/config';
|
|
10
10
|
export { createServices } from './_services';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,EASN,qBAAqB,EACrB,eAAe,EAGf,aAAa,EACb,cAAc,EACd,cAAc,EAEd,WAAW,EACX,sBAAsB,EACtB,qBAAqB,EACrB,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,SAAS,CAAC;AAEjB,iDAAiD;AACjD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,EASN,qBAAqB,EACrB,eAAe,EAGf,aAAa,EACb,cAAc,EACd,cAAc,EAEd,WAAW,EACX,sBAAsB,EACtB,qBAAqB,EACrB,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,SAAS,CAAC;AAEjB,iDAAiD;AACjD,OAAO,EAQN,SAAS,EACT,MAAM,EACN,WAAW,EACX,YAAY,EACZ,WAAW,EACX,SAAS,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AA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ACnB,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE/C,2BAA2B;AAC3B,OAAO,EACN,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,6BAA6B,GAC7B,MAAM,oBAAoB,CAAC;AAE5B,uBAAuB;AACvB,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AA6C7F,uEAAuE;AACvE,iFAAiF;AACjF,2CAA2C;AAC3C,OAAO,EAAE,mBAAmB,EAAgC,MAAM,mBAAmB,CAAC"}
|
package/dist/middleware.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Extracted from _server.ts to be used by generated entry files
|
|
4
4
|
*/
|
|
5
5
|
import { cors } from 'hono/cors';
|
|
6
|
-
import type { Env } from './app';
|
|
6
|
+
import type { Env, CompressionConfig } from './app';
|
|
7
7
|
import type { Logger } from './logger';
|
|
8
8
|
import { Meter, Tracer } from '@opentelemetry/api';
|
|
9
9
|
export declare const AGENT_CONTEXT_PROPERTIES: readonly ["logger", "tracer", "sessionId", "kv", "stream", "vector", "state", "thread", "session", "config", "app", "waitUntil"];
|
|
@@ -18,12 +18,68 @@ export interface MiddlewareConfig {
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function createBaseMiddleware(config: MiddlewareConfig): import("hono").MiddlewareHandler<Env<any>, string, {}, Response>;
|
|
20
20
|
/**
|
|
21
|
-
* Create CORS middleware
|
|
21
|
+
* Create CORS middleware with lazy config resolution.
|
|
22
|
+
*
|
|
23
|
+
* Handles Cross-Origin Resource Sharing (CORS) headers for API routes.
|
|
24
|
+
* Config is resolved at request time, allowing it to be set via createApp().
|
|
25
|
+
* Static options passed here take precedence over app config.
|
|
26
|
+
*
|
|
27
|
+
* Default behavior:
|
|
28
|
+
* - Reflects the request origin (allows any origin)
|
|
29
|
+
* - Allows common headers: Content-Type, Authorization, Accept, Origin, X-Requested-With
|
|
30
|
+
* - Allows all standard HTTP methods
|
|
31
|
+
* - Enables credentials
|
|
32
|
+
* - Sets max-age to 600 seconds (10 minutes)
|
|
33
|
+
*
|
|
34
|
+
* @param staticOptions - Optional static CORS options that override app config
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* // Use with default settings
|
|
39
|
+
* app.use('/api/*', createCorsMiddleware());
|
|
40
|
+
*
|
|
41
|
+
* // Or configure via createApp
|
|
42
|
+
* const app = await createApp({
|
|
43
|
+
* cors: {
|
|
44
|
+
* origin: 'https://example.com',
|
|
45
|
+
* allowHeaders: ['Content-Type', 'Authorization', 'X-Custom-Header'],
|
|
46
|
+
* maxAge: 3600,
|
|
47
|
+
* }
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* // Or pass static options directly (overrides app config)
|
|
51
|
+
* app.use('/api/*', createCorsMiddleware({
|
|
52
|
+
* origin: ['https://app.example.com', 'https://admin.example.com'],
|
|
53
|
+
* credentials: true,
|
|
54
|
+
* }));
|
|
55
|
+
* ```
|
|
22
56
|
*/
|
|
23
|
-
export declare function createCorsMiddleware(
|
|
57
|
+
export declare function createCorsMiddleware(staticOptions?: Parameters<typeof cors>[0]): import("hono").MiddlewareHandler<Env<any>, string, {}, Response>;
|
|
24
58
|
/**
|
|
25
59
|
* Create OpenTelemetry middleware for session/thread tracking
|
|
26
60
|
* This is the critical middleware that creates AgentContext
|
|
27
61
|
*/
|
|
28
62
|
export declare function createOtelMiddleware(): import("hono").MiddlewareHandler<Env<any>, string, {}, Response>;
|
|
63
|
+
/**
|
|
64
|
+
* Create compression middleware with lazy config resolution.
|
|
65
|
+
*
|
|
66
|
+
* Compresses response bodies using gzip or deflate based on the Accept-Encoding header.
|
|
67
|
+
* Config is resolved at request time, allowing it to be set via createApp().
|
|
68
|
+
*
|
|
69
|
+
* @param staticConfig - Optional static config that overrides app config
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* // Use with default settings
|
|
74
|
+
* app.use('*', createCompressionMiddleware());
|
|
75
|
+
*
|
|
76
|
+
* // Or configure via createApp
|
|
77
|
+
* const app = await createApp({
|
|
78
|
+
* compression: {
|
|
79
|
+
* threshold: 2048,
|
|
80
|
+
* }
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function createCompressionMiddleware(staticConfig?: CompressionConfig): import("hono").MiddlewareHandler<Env<any>, string, {}, Response>;
|
|
29
85
|
//# sourceMappingURL=middleware.d.ts.map
|
package/dist/middleware.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,KAAK,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAMvC,OAAO,EAMN,KAAK,EACL,MAAM,EACN,MAAM,oBAAoB,CAAC;AAU5B,eAAO,MAAM,wBAAwB,kIAa3B,CAAC;AAuBX,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,CAAC,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;CACzC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,oEA8C5D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,oEAoC9E;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,qEAoKnC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,CAAC,EAAE,iBAAiB,oEAkD3E"}
|