@axlsdk/studio 0.9.0 → 0.10.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/README.md +174 -7
- package/dist/{chunk-EG74VI3M.js → chunk-RBTYI3TW.js} +142 -41
- package/dist/chunk-RBTYI3TW.js.map +1 -0
- package/dist/cli.cjs +152 -52
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/assets/{index-DDlRZgfC.js → index-jeUeToM_.js} +13 -13
- package/dist/client/index.html +2 -2
- package/dist/connection-manager-DbOgO_gK.d.cts +75 -0
- package/dist/connection-manager-DbOgO_gK.d.ts +75 -0
- package/dist/middleware.cjs +1058 -0
- package/dist/middleware.cjs.map +1 -0
- package/dist/middleware.d.cts +76 -0
- package/dist/middleware.d.ts +76 -0
- package/dist/middleware.js +173 -0
- package/dist/middleware.js.map +1 -0
- package/dist/server/index.cjs +140 -40
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +10 -62
- package/dist/server/index.d.ts +10 -62
- package/dist/server/index.js +1 -1
- package/package.json +16 -4
- package/dist/chunk-EG74VI3M.js.map +0 -1
package/README.md
CHANGED
|
@@ -163,36 +163,203 @@ Single endpoint at `ws://localhost:4400/ws` with channel multiplexing:
|
|
|
163
163
|
|
|
164
164
|
Channels: `execution:{id}`, `trace:{id}`, `trace:*`, `costs`, `decisions`.
|
|
165
165
|
|
|
166
|
+
## Embeddable Middleware
|
|
167
|
+
|
|
168
|
+
For applications using dependency injection (NestJS, etc.) or existing HTTP servers, Studio can be mounted as middleware instead of running as a standalone CLI.
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
import express from 'express';
|
|
172
|
+
import { AxlRuntime } from '@axlsdk/axl';
|
|
173
|
+
import { createStudioMiddleware } from '@axlsdk/studio/middleware';
|
|
174
|
+
|
|
175
|
+
const runtime = new AxlRuntime({ providers: ['openai'] });
|
|
176
|
+
// ... register workflows, agents, tools ...
|
|
177
|
+
|
|
178
|
+
const studio = createStudioMiddleware({
|
|
179
|
+
runtime,
|
|
180
|
+
basePath: '/studio',
|
|
181
|
+
// Your auth logic here — check a token, cookie, or header.
|
|
182
|
+
// This runs on WebSocket upgrades, which bypass Express middleware.
|
|
183
|
+
verifyUpgrade: (req) => {
|
|
184
|
+
const url = new URL(req.url!, `http://${req.headers.host}`);
|
|
185
|
+
return url.searchParams.get('token') === process.env.MY_SECRET;
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
const app = express();
|
|
190
|
+
app.use('/studio', studio.handler);
|
|
191
|
+
|
|
192
|
+
const server = app.listen(3000);
|
|
193
|
+
studio.upgradeWebSocket(server);
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Options
|
|
197
|
+
|
|
198
|
+
| Option | Type | Default | Description |
|
|
199
|
+
|--------|------|---------|-------------|
|
|
200
|
+
| `runtime` | `AxlRuntime` | required | The runtime instance to observe and control |
|
|
201
|
+
| `basePath` | `string` | `''` | URL path prefix (e.g., `'/studio'`) |
|
|
202
|
+
| `serveClient` | `boolean` | `true` | Serve the pre-built SPA |
|
|
203
|
+
| `verifyUpgrade` | `(req) => boolean \| Promise<boolean>` | — | Auth callback for WebSocket upgrades |
|
|
204
|
+
| `readOnly` | `boolean` | `false` | Disable all mutating endpoints |
|
|
205
|
+
|
|
206
|
+
### Return value
|
|
207
|
+
|
|
208
|
+
| Property | Description |
|
|
209
|
+
|----------|-------------|
|
|
210
|
+
| `handler` | Node.js `(req, res)` handler for Express/Fastify/Koa/raw HTTP |
|
|
211
|
+
| `handleWebSocket(ws)` | Handle an individual WebSocket (framework-agnostic) |
|
|
212
|
+
| `upgradeWebSocket(server)` | Attach WS upgrade handling to an `http.Server` |
|
|
213
|
+
| `app` | Underlying Hono app (for Hono-in-Hono mounting) |
|
|
214
|
+
| `connectionManager` | WS connection/channel manager |
|
|
215
|
+
| `close()` | Shut down middleware (removes listeners, closes connections) |
|
|
216
|
+
|
|
217
|
+
**Note:** `upgradeWebSocket(server)` is required for real-time features (trace streaming, cost updates, execution events, decision resolution). Without it, the Studio SPA loads but panels relying on live data will show no updates. If your framework manages WebSocket connections itself (NestJS gateway, Fastify plugin), use `handleWebSocket()` instead.
|
|
218
|
+
|
|
219
|
+
### Framework examples
|
|
220
|
+
|
|
221
|
+
#### NestJS
|
|
222
|
+
|
|
223
|
+
```typescript
|
|
224
|
+
import { Module, OnModuleInit, OnModuleDestroy } from '@nestjs/common';
|
|
225
|
+
import { HttpAdapterHost } from '@nestjs/core';
|
|
226
|
+
import { createStudioMiddleware, type StudioMiddleware } from '@axlsdk/studio/middleware';
|
|
227
|
+
|
|
228
|
+
@Module({ /* ... */ })
|
|
229
|
+
export class AppModule implements OnModuleInit, OnModuleDestroy {
|
|
230
|
+
private studio!: StudioMiddleware;
|
|
231
|
+
|
|
232
|
+
constructor(
|
|
233
|
+
private readonly httpAdapterHost: HttpAdapterHost,
|
|
234
|
+
private readonly runtime: AxlRuntime, // injected via custom provider
|
|
235
|
+
) {}
|
|
236
|
+
|
|
237
|
+
onModuleInit() {
|
|
238
|
+
this.studio = createStudioMiddleware({
|
|
239
|
+
runtime: this.runtime,
|
|
240
|
+
basePath: '/studio',
|
|
241
|
+
verifyUpgrade: (req) => req.headers['authorization'] === `Bearer ${process.env.MY_SECRET}`,
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
// Mount on the underlying Express instance — this is the recommended
|
|
245
|
+
// NestJS pattern for sub-application mounting (see NestJS HTTP adapter docs).
|
|
246
|
+
const expressApp = this.httpAdapterHost.httpAdapter.getInstance();
|
|
247
|
+
expressApp.use('/studio', this.studio.handler);
|
|
248
|
+
this.studio.upgradeWebSocket(this.httpAdapterHost.httpAdapter.getHttpServer());
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
onModuleDestroy() {
|
|
252
|
+
this.studio.close();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
#### Fastify
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
import Fastify from 'fastify';
|
|
261
|
+
import middie from '@fastify/middie';
|
|
262
|
+
import { createStudioMiddleware } from '@axlsdk/studio/middleware';
|
|
263
|
+
|
|
264
|
+
const studio = createStudioMiddleware({ runtime, basePath: '/studio' });
|
|
265
|
+
const fastify = Fastify();
|
|
266
|
+
|
|
267
|
+
await fastify.register(middie);
|
|
268
|
+
fastify.use('/studio', studio.handler);
|
|
269
|
+
|
|
270
|
+
await fastify.listen({ port: 3000 });
|
|
271
|
+
studio.upgradeWebSocket(fastify.server);
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
#### Raw Node.js
|
|
275
|
+
|
|
276
|
+
```typescript
|
|
277
|
+
import { createServer } from 'node:http';
|
|
278
|
+
import { createStudioMiddleware } from '@axlsdk/studio/middleware';
|
|
279
|
+
|
|
280
|
+
const studio = createStudioMiddleware({ runtime });
|
|
281
|
+
const server = createServer(studio.handler);
|
|
282
|
+
studio.upgradeWebSocket(server);
|
|
283
|
+
server.listen(3000);
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
#### Hono-in-Hono
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
289
|
+
import { Hono } from 'hono';
|
|
290
|
+
import { createStudioMiddleware, handleWsMessage } from '@axlsdk/studio/middleware';
|
|
291
|
+
|
|
292
|
+
const studio = createStudioMiddleware({ runtime, basePath: '/studio' });
|
|
293
|
+
const app = new Hono();
|
|
294
|
+
app.route('/studio', studio.app);
|
|
295
|
+
// Wire WebSocket via Hono's native WS support — see spec for full example
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Important: `basePath` must match your mount path
|
|
299
|
+
|
|
300
|
+
`basePath` tells the SPA where it's mounted in the browser URL. It must match the path in your framework's mount call:
|
|
301
|
+
|
|
302
|
+
```typescript
|
|
303
|
+
// These must match:
|
|
304
|
+
createStudioMiddleware({ basePath: '/studio' }) // tells the SPA
|
|
305
|
+
app.use('/studio', studio.handler) // tells Express
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
If they don't match, the SPA will load but API calls will fail (the SPA sends requests to the wrong path).
|
|
309
|
+
|
|
310
|
+
### Security
|
|
311
|
+
|
|
312
|
+
- **Always** provide `verifyUpgrade` — WebSocket upgrades bypass Express/Fastify/Koa middleware, so your auth middleware does NOT protect WebSocket connections
|
|
313
|
+
- Consider `readOnly: true` for production monitoring — view traces, costs, and schemas without execution capability
|
|
314
|
+
- CORS is not applied in embedded mode — the host framework owns CORS policy
|
|
315
|
+
- `basePath` is validated against unsafe characters and path traversal
|
|
316
|
+
|
|
317
|
+
### Migrating from the standalone CLI
|
|
318
|
+
|
|
319
|
+
If you currently use `npx @axlsdk/studio` with a config file:
|
|
320
|
+
|
|
321
|
+
1. Move runtime creation from `axl.config.ts` into your app's initialization code
|
|
322
|
+
2. Register workflows, agents, and tools on the runtime where they have access to your services
|
|
323
|
+
3. Call `createStudioMiddleware({ runtime, basePath: '/studio' })` and mount the handler
|
|
324
|
+
4. Call `upgradeWebSocket(server)` for WebSocket support
|
|
325
|
+
5. Remove the `axl-studio` CLI from your dev scripts
|
|
326
|
+
|
|
327
|
+
The `axl.config.ts` file is no longer needed. The standalone CLI continues to work for projects that don't need embedded middleware.
|
|
328
|
+
|
|
166
329
|
## Architecture
|
|
167
330
|
|
|
168
331
|
```
|
|
169
332
|
src/
|
|
170
333
|
cli.ts CLI entry — loads config, starts server
|
|
334
|
+
middleware.ts Embeddable middleware: createStudioMiddleware()
|
|
171
335
|
resolve-runtime.ts Config module interop (ESM default, CJS wrapping, named exports)
|
|
172
336
|
server/
|
|
173
|
-
index.ts createServer() — Hono app composition
|
|
337
|
+
index.ts createServer() — Hono app composition (basePath, readOnly, cors)
|
|
174
338
|
types.ts API types, WebSocket message types
|
|
175
339
|
cost-aggregator.ts Accumulates cost from trace events
|
|
176
340
|
middleware/
|
|
177
341
|
error-handler.ts Axl errors → JSON error envelope
|
|
178
342
|
routes/ One file per resource (health, workflows, agents, tools, etc.)
|
|
179
343
|
ws/
|
|
180
|
-
handler.ts WebSocket message routing
|
|
181
|
-
connection-manager.ts Channel subscriptions + broadcast
|
|
344
|
+
handler.ts WebSocket message routing (Hono adapter)
|
|
345
|
+
connection-manager.ts Channel subscriptions + broadcast (BroadcastTarget)
|
|
346
|
+
protocol.ts Shared WS protocol: handleWsMessage(), channel validation
|
|
182
347
|
client/
|
|
183
348
|
App.tsx React SPA — sidebar + 8 panel routes
|
|
184
349
|
lib/
|
|
185
|
-
api.ts Typed fetch wrappers
|
|
186
|
-
ws.ts WebSocket client with channel subscriptions
|
|
350
|
+
api.ts Typed fetch wrappers (reads window.__AXL_STUDIO_BASE__)
|
|
351
|
+
ws.ts WebSocket client with channel subscriptions (reads base path)
|
|
187
352
|
panels/ One directory per panel
|
|
188
353
|
```
|
|
189
354
|
|
|
190
|
-
**Server:** Hono HTTP server wrapping the user's `AxlRuntime`. REST endpoints for CRUD, WebSocket for live streaming.
|
|
355
|
+
**Server:** Hono HTTP server wrapping the user's `AxlRuntime`. REST endpoints for CRUD, WebSocket for live streaming. Supports standalone CLI and embeddable middleware modes.
|
|
191
356
|
|
|
192
|
-
**Client:** React 19 SPA with Tailwind CSS v4, TanStack Query, and react-router-dom. Pre-built at publish time and served as static assets.
|
|
357
|
+
**Client:** React 19 SPA with Tailwind CSS v4, TanStack Query, and react-router-dom. Pre-built at publish time and served as static assets. Reads `window.__AXL_STUDIO_BASE__` for runtime base path configuration.
|
|
193
358
|
|
|
194
359
|
**CLI:** Auto-detects and loads the user's config via `tsx` (with ESM-forcing resolve hook for `.ts` files), validates the runtime, starts the server, and optionally opens the browser.
|
|
195
360
|
|
|
361
|
+
**Middleware:** `createStudioMiddleware()` wraps the Hono app as a Node.js `(req, res)` handler via `@hono/node-server`. Adds `verifyUpgrade` for WS auth, `readOnly` mode, and `basePath` injection into the SPA.
|
|
362
|
+
|
|
196
363
|
## Development
|
|
197
364
|
|
|
198
365
|
```bash
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// src/server/index.ts
|
|
2
|
+
import { existsSync, readFileSync } from "fs";
|
|
3
|
+
import { resolve } from "path";
|
|
2
4
|
import { Hono as Hono12 } from "hono";
|
|
3
5
|
import { cors } from "hono/cors";
|
|
4
6
|
import { serveStatic } from "@hono/node-server/serve-static";
|
|
@@ -35,8 +37,13 @@ var ConnectionManager = class {
|
|
|
35
37
|
channels = /* @__PURE__ */ new Map();
|
|
36
38
|
/** ws -> set of subscribed channels (for cleanup) */
|
|
37
39
|
connections = /* @__PURE__ */ new Map();
|
|
40
|
+
maxConnections = 100;
|
|
38
41
|
/** Register a new WS connection. */
|
|
39
42
|
add(ws) {
|
|
43
|
+
if (this.connections.size >= this.maxConnections) {
|
|
44
|
+
ws.close?.();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
40
47
|
this.connections.set(ws, /* @__PURE__ */ new Set());
|
|
41
48
|
}
|
|
42
49
|
/** Remove a WS connection and all its subscriptions. */
|
|
@@ -52,15 +59,16 @@ var ConnectionManager = class {
|
|
|
52
59
|
}
|
|
53
60
|
this.connections.delete(ws);
|
|
54
61
|
}
|
|
55
|
-
/** Subscribe a connection to a channel. */
|
|
62
|
+
/** Subscribe a connection to a channel. No-op if the connection was not added. */
|
|
56
63
|
subscribe(ws, channel) {
|
|
64
|
+
if (!this.connections.has(ws)) return;
|
|
57
65
|
let subs = this.channels.get(channel);
|
|
58
66
|
if (!subs) {
|
|
59
67
|
subs = /* @__PURE__ */ new Set();
|
|
60
68
|
this.channels.set(channel, subs);
|
|
61
69
|
}
|
|
62
70
|
subs.add(ws);
|
|
63
|
-
this.connections.get(ws)
|
|
71
|
+
this.connections.get(ws).add(channel);
|
|
64
72
|
}
|
|
65
73
|
/** Unsubscribe a connection from a channel. */
|
|
66
74
|
unsubscribe(ws, channel) {
|
|
@@ -101,6 +109,14 @@ var ConnectionManager = class {
|
|
|
101
109
|
}
|
|
102
110
|
}
|
|
103
111
|
}
|
|
112
|
+
/** Close all connections and clear all state. Used during shutdown. */
|
|
113
|
+
closeAll() {
|
|
114
|
+
for (const ws of this.connections.keys()) {
|
|
115
|
+
ws.close?.();
|
|
116
|
+
}
|
|
117
|
+
this.connections.clear();
|
|
118
|
+
this.channels.clear();
|
|
119
|
+
}
|
|
104
120
|
/** Get the number of active connections. */
|
|
105
121
|
get connectionCount() {
|
|
106
122
|
return this.connections.size;
|
|
@@ -111,6 +127,52 @@ var ConnectionManager = class {
|
|
|
111
127
|
}
|
|
112
128
|
};
|
|
113
129
|
|
|
130
|
+
// src/server/ws/protocol.ts
|
|
131
|
+
var VALID_CHANNEL_PREFIXES = ["execution:", "trace:"];
|
|
132
|
+
var VALID_EXACT_CHANNELS = ["costs", "decisions"];
|
|
133
|
+
var MAX_CHANNEL_LENGTH = 256;
|
|
134
|
+
function handleWsMessage(raw, socket, connMgr) {
|
|
135
|
+
if (raw.length > 65536) {
|
|
136
|
+
return JSON.stringify({ type: "error", message: "Message too large" });
|
|
137
|
+
}
|
|
138
|
+
let msg;
|
|
139
|
+
try {
|
|
140
|
+
msg = JSON.parse(raw);
|
|
141
|
+
} catch {
|
|
142
|
+
return JSON.stringify({ type: "error", message: "Invalid JSON" });
|
|
143
|
+
}
|
|
144
|
+
switch (msg.type) {
|
|
145
|
+
case "subscribe": {
|
|
146
|
+
const error = validateChannel(msg.channel);
|
|
147
|
+
if (error) return JSON.stringify({ type: "error", message: error });
|
|
148
|
+
connMgr.subscribe(socket, msg.channel);
|
|
149
|
+
return JSON.stringify({ type: "subscribed", channel: msg.channel });
|
|
150
|
+
}
|
|
151
|
+
case "unsubscribe": {
|
|
152
|
+
const error = validateChannel(msg.channel);
|
|
153
|
+
if (error) return JSON.stringify({ type: "error", message: error });
|
|
154
|
+
connMgr.unsubscribe(socket, msg.channel);
|
|
155
|
+
return JSON.stringify({ type: "unsubscribed", channel: msg.channel });
|
|
156
|
+
}
|
|
157
|
+
case "ping":
|
|
158
|
+
return JSON.stringify({ type: "pong" });
|
|
159
|
+
default:
|
|
160
|
+
return JSON.stringify({ type: "error", message: "Unknown message type" });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function validateChannel(channel) {
|
|
164
|
+
if (typeof channel !== "string" || !channel) {
|
|
165
|
+
return "Missing or invalid channel";
|
|
166
|
+
}
|
|
167
|
+
if (channel.length > MAX_CHANNEL_LENGTH) {
|
|
168
|
+
return `Channel name exceeds ${MAX_CHANNEL_LENGTH} characters`;
|
|
169
|
+
}
|
|
170
|
+
if (!VALID_EXACT_CHANNELS.includes(channel) && !VALID_CHANNEL_PREFIXES.some((p) => channel.startsWith(p))) {
|
|
171
|
+
return `Invalid channel: ${channel}`;
|
|
172
|
+
}
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
|
|
114
176
|
// src/server/ws/handler.ts
|
|
115
177
|
function createWsHandlers(connMgr) {
|
|
116
178
|
return {
|
|
@@ -118,37 +180,8 @@ function createWsHandlers(connMgr) {
|
|
|
118
180
|
connMgr.add(ws);
|
|
119
181
|
},
|
|
120
182
|
onMessage(event, ws) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
msg = JSON.parse(String(event.data));
|
|
124
|
-
} catch {
|
|
125
|
-
const err = { type: "error", message: "Invalid JSON" };
|
|
126
|
-
ws.send(JSON.stringify(err));
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
switch (msg.type) {
|
|
130
|
-
case "subscribe": {
|
|
131
|
-
connMgr.subscribe(ws, msg.channel);
|
|
132
|
-
const reply = { type: "subscribed", channel: msg.channel };
|
|
133
|
-
ws.send(JSON.stringify(reply));
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
case "unsubscribe": {
|
|
137
|
-
connMgr.unsubscribe(ws, msg.channel);
|
|
138
|
-
const reply = { type: "unsubscribed", channel: msg.channel };
|
|
139
|
-
ws.send(JSON.stringify(reply));
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
case "ping": {
|
|
143
|
-
const reply = { type: "pong" };
|
|
144
|
-
ws.send(JSON.stringify(reply));
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
default: {
|
|
148
|
-
const err = { type: "error", message: `Unknown message type` };
|
|
149
|
-
ws.send(JSON.stringify(err));
|
|
150
|
-
}
|
|
151
|
-
}
|
|
183
|
+
const reply = handleWsMessage(String(event.data), ws, connMgr);
|
|
184
|
+
if (reply) ws.send(reply);
|
|
152
185
|
},
|
|
153
186
|
onClose(_event, ws) {
|
|
154
187
|
connMgr.remove(ws);
|
|
@@ -719,16 +752,48 @@ function createPlaygroundRoutes(connMgr) {
|
|
|
719
752
|
|
|
720
753
|
// src/server/index.ts
|
|
721
754
|
function createServer(options) {
|
|
722
|
-
const { runtime, staticRoot } = options;
|
|
755
|
+
const { runtime, staticRoot, basePath = "", readOnly = false } = options;
|
|
723
756
|
const app8 = new Hono12();
|
|
724
757
|
const connMgr = new ConnectionManager();
|
|
725
758
|
const costAggregator = new CostAggregator(connMgr);
|
|
726
|
-
|
|
759
|
+
if (options.cors !== false) {
|
|
760
|
+
app8.use("*", cors());
|
|
761
|
+
}
|
|
727
762
|
app8.use("*", errorHandler);
|
|
728
763
|
app8.use("*", async (c, next) => {
|
|
729
764
|
c.set("runtime", runtime);
|
|
730
765
|
await next();
|
|
731
766
|
});
|
|
767
|
+
if (readOnly) {
|
|
768
|
+
const blocked = [
|
|
769
|
+
"POST /api/workflows",
|
|
770
|
+
"POST /api/executions",
|
|
771
|
+
"POST /api/sessions",
|
|
772
|
+
"DELETE /api/sessions",
|
|
773
|
+
"PUT /api/memory",
|
|
774
|
+
"DELETE /api/memory",
|
|
775
|
+
"POST /api/decisions",
|
|
776
|
+
"POST /api/costs",
|
|
777
|
+
"POST /api/tools",
|
|
778
|
+
"POST /api/evals",
|
|
779
|
+
"POST /api/playground"
|
|
780
|
+
];
|
|
781
|
+
app8.use("/api/*", async (c, next) => {
|
|
782
|
+
const apiIdx = c.req.path.indexOf("/api/");
|
|
783
|
+
const apiPath = apiIdx >= 0 ? c.req.path.slice(apiIdx) : c.req.path;
|
|
784
|
+
const key = `${c.req.method} ${apiPath}`;
|
|
785
|
+
if (blocked.some((b) => key.startsWith(b))) {
|
|
786
|
+
return c.json(
|
|
787
|
+
{
|
|
788
|
+
ok: false,
|
|
789
|
+
error: { code: "READ_ONLY", message: "Studio is mounted in read-only mode" }
|
|
790
|
+
},
|
|
791
|
+
405
|
|
792
|
+
);
|
|
793
|
+
}
|
|
794
|
+
await next();
|
|
795
|
+
});
|
|
796
|
+
}
|
|
732
797
|
const api = new Hono12();
|
|
733
798
|
api.route("/", health_default);
|
|
734
799
|
api.route("/", createWorkflowRoutes(connMgr));
|
|
@@ -742,7 +807,7 @@ function createServer(options) {
|
|
|
742
807
|
api.route("/", evals_default);
|
|
743
808
|
api.route("/", createPlaygroundRoutes(connMgr));
|
|
744
809
|
app8.route("/api", api);
|
|
745
|
-
|
|
810
|
+
const traceListener = (event) => {
|
|
746
811
|
const traceEvent = event;
|
|
747
812
|
if (traceEvent.executionId) {
|
|
748
813
|
connMgr.broadcastWithWildcard(`trace:${traceEvent.executionId}`, traceEvent);
|
|
@@ -751,17 +816,53 @@ function createServer(options) {
|
|
|
751
816
|
if (traceEvent.type === "await_human") {
|
|
752
817
|
connMgr.broadcast("decisions", traceEvent);
|
|
753
818
|
}
|
|
754
|
-
}
|
|
819
|
+
};
|
|
820
|
+
runtime.on("trace", traceListener);
|
|
755
821
|
if (staticRoot) {
|
|
756
|
-
app8.use(
|
|
757
|
-
|
|
822
|
+
app8.use(
|
|
823
|
+
"/*",
|
|
824
|
+
serveStatic({
|
|
825
|
+
root: staticRoot,
|
|
826
|
+
rewriteRequestPath: basePath ? (path) => path.startsWith(basePath) ? path.slice(basePath.length) || "/" : path : void 0
|
|
827
|
+
})
|
|
828
|
+
);
|
|
829
|
+
if (basePath) {
|
|
830
|
+
const indexPath = resolve(staticRoot, "index.html");
|
|
831
|
+
if (!existsSync(indexPath)) {
|
|
832
|
+
console.warn(`[axl-studio] index.html not found at ${indexPath}`);
|
|
833
|
+
} else {
|
|
834
|
+
const indexHtml = readFileSync(indexPath, "utf-8");
|
|
835
|
+
const safeBasePath = JSON.stringify(basePath).replace(/</g, "\\u003c");
|
|
836
|
+
const injectedHtml = indexHtml.replace(
|
|
837
|
+
"</head>",
|
|
838
|
+
`<base href="${basePath}/">
|
|
839
|
+
<script>window.__AXL_STUDIO_BASE__=${safeBasePath}</script>
|
|
840
|
+
</head>`
|
|
841
|
+
);
|
|
842
|
+
if (injectedHtml === indexHtml) {
|
|
843
|
+
console.warn(
|
|
844
|
+
"[axl-studio] Could not inject basePath into index.html \u2014 </head> tag not found. The SPA may not route correctly."
|
|
845
|
+
);
|
|
846
|
+
}
|
|
847
|
+
app8.get("*", (c) => c.html(injectedHtml));
|
|
848
|
+
}
|
|
849
|
+
} else {
|
|
850
|
+
app8.get("*", serveStatic({ root: staticRoot, path: "/index.html" }));
|
|
851
|
+
}
|
|
758
852
|
}
|
|
759
|
-
return {
|
|
853
|
+
return {
|
|
854
|
+
app: app8,
|
|
855
|
+
connMgr,
|
|
856
|
+
costAggregator,
|
|
857
|
+
createWsHandlers: () => createWsHandlers(connMgr),
|
|
858
|
+
traceListener
|
|
859
|
+
};
|
|
760
860
|
}
|
|
761
861
|
|
|
762
862
|
export {
|
|
763
863
|
ConnectionManager,
|
|
864
|
+
handleWsMessage,
|
|
764
865
|
CostAggregator,
|
|
765
866
|
createServer
|
|
766
867
|
};
|
|
767
|
-
//# sourceMappingURL=chunk-
|
|
868
|
+
//# sourceMappingURL=chunk-RBTYI3TW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server/index.ts","../src/server/middleware/error-handler.ts","../src/server/ws/connection-manager.ts","../src/server/ws/protocol.ts","../src/server/ws/handler.ts","../src/server/cost-aggregator.ts","../src/server/routes/health.ts","../src/server/routes/workflows.ts","../src/server/routes/executions.ts","../src/server/routes/sessions.ts","../src/server/routes/agents.ts","../src/server/routes/tools.ts","../src/server/routes/memory.ts","../src/server/routes/decisions.ts","../src/server/routes/costs.ts","../src/server/routes/evals.ts","../src/server/routes/playground.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { Hono } from 'hono';\nimport { cors } from 'hono/cors';\nimport { serveStatic } from '@hono/node-server/serve-static';\nimport type { AxlRuntime } from '@axlsdk/axl';\nimport type { StudioEnv } from './types.js';\nimport { errorHandler } from './middleware/error-handler.js';\nimport { ConnectionManager } from './ws/connection-manager.js';\nimport { createWsHandlers } from './ws/handler.js';\nimport { CostAggregator } from './cost-aggregator.js';\nimport healthRoutes from './routes/health.js';\nimport { createWorkflowRoutes } from './routes/workflows.js';\nimport executionRoutes from './routes/executions.js';\nimport { createSessionRoutes } from './routes/sessions.js';\nimport agentRoutes from './routes/agents.js';\nimport toolRoutes from './routes/tools.js';\nimport memoryRoutes from './routes/memory.js';\nimport decisionRoutes from './routes/decisions.js';\nimport { createCostRoutes } from './routes/costs.js';\nimport evalRoutes from './routes/evals.js';\nimport { createPlaygroundRoutes } from './routes/playground.js';\n\nexport type { StudioEnv } from './types.js';\nexport { ConnectionManager } from './ws/connection-manager.js';\nexport type { BroadcastTarget } from './ws/connection-manager.js';\nexport { CostAggregator } from './cost-aggregator.js';\n\nexport type CreateServerOptions = {\n runtime: AxlRuntime;\n /** Root path for serving pre-built SPA static assets. */\n staticRoot?: string;\n /** Base URL path for client-side routing and API calls. Injected into index.html at serve time. */\n basePath?: string;\n /** When true, disable all mutating API endpoints. */\n readOnly?: boolean;\n /** Apply CORS headers. Default: true (standalone CLI). Set false for embedded middleware. */\n cors?: boolean;\n};\n\nexport function createServer(options: CreateServerOptions) {\n const { runtime, staticRoot, basePath = '', readOnly = false } = options;\n const app = new Hono<StudioEnv>();\n const connMgr = new ConnectionManager();\n const costAggregator = new CostAggregator(connMgr);\n\n // ── Middleware ──────────────────────────────────────────────────────\n if (options.cors !== false) {\n app.use('*', cors());\n }\n app.use('*', errorHandler);\n app.use('*', async (c, next) => {\n c.set('runtime', runtime);\n await next();\n });\n\n // ── Read-only mode ──────────────────────────────────────────────────\n if (readOnly) {\n const blocked = [\n 'POST /api/workflows',\n 'POST /api/executions',\n 'POST /api/sessions',\n 'DELETE /api/sessions',\n 'PUT /api/memory',\n 'DELETE /api/memory',\n 'POST /api/decisions',\n 'POST /api/costs',\n 'POST /api/tools',\n 'POST /api/evals',\n 'POST /api/playground',\n ];\n app.use('/api/*', async (c, next) => {\n // c.req.path returns the full path including any parent route prefix\n // (e.g., /studio/api/workflows when mounted via app.route('/studio', ...)).\n // Extract just the /api/... portion for matching.\n const apiIdx = c.req.path.indexOf('/api/');\n const apiPath = apiIdx >= 0 ? c.req.path.slice(apiIdx) : c.req.path;\n const key = `${c.req.method} ${apiPath}`;\n if (blocked.some((b) => key.startsWith(b))) {\n return c.json(\n {\n ok: false,\n error: { code: 'READ_ONLY', message: 'Studio is mounted in read-only mode' },\n },\n 405,\n );\n }\n await next();\n });\n }\n\n // ── API Routes ─────────────────────────────────────────────────────\n const api = new Hono<StudioEnv>();\n api.route('/', healthRoutes);\n api.route('/', createWorkflowRoutes(connMgr));\n api.route('/', executionRoutes);\n api.route('/', createSessionRoutes(connMgr));\n api.route('/', agentRoutes);\n api.route('/', toolRoutes);\n api.route('/', memoryRoutes);\n api.route('/', decisionRoutes);\n api.route('/', createCostRoutes(costAggregator));\n api.route('/', evalRoutes);\n api.route('/', createPlaygroundRoutes(connMgr));\n\n app.route('/api', api);\n\n // ── Trace event bridging ───────────────────────────────────────────\n const traceListener = (event: unknown) => {\n const traceEvent = event as {\n executionId?: string;\n type?: string;\n agent?: string;\n model?: string;\n workflow?: string;\n cost?: number;\n tokens?: { input?: number; output?: number; reasoning?: number };\n };\n\n // Broadcast to trace channels\n if (traceEvent.executionId) {\n connMgr.broadcastWithWildcard(`trace:${traceEvent.executionId}`, traceEvent);\n }\n\n // Feed cost aggregator\n costAggregator.onTrace(traceEvent);\n\n // Broadcast pending decisions\n if (traceEvent.type === 'await_human') {\n connMgr.broadcast('decisions', traceEvent);\n }\n };\n runtime.on('trace', traceListener);\n\n // ── Static SPA serving (production) ────────────────────────────────\n if (staticRoot) {\n // Serve static assets (JS, CSS, images).\n // When basePath is set and this app is mounted via Hono's app.route(),\n // c.req.path may include the full prefix. rewriteRequestPath strips it\n // so serveStatic resolves files relative to staticRoot correctly.\n app.use(\n '/*',\n serveStatic({\n root: staticRoot,\n rewriteRequestPath: basePath\n ? (path) => (path.startsWith(basePath) ? path.slice(basePath.length) || '/' : path)\n : undefined,\n }),\n );\n\n if (basePath) {\n // Read and inject base path into index.html at startup (not per-request).\n const indexPath = resolve(staticRoot, 'index.html');\n if (!existsSync(indexPath)) {\n console.warn(`[axl-studio] index.html not found at ${indexPath}`);\n } else {\n const indexHtml = readFileSync(indexPath, 'utf-8');\n\n // Escape all '<' as '\\u003c' to prevent </script> in basePath from\n // breaking out of the script tag. JSON.stringify alone is insufficient\n // because the HTML parser processes </script> before JavaScript runs.\n const safeBasePath = JSON.stringify(basePath).replace(/</g, '\\\\u003c');\n\n // Inject both:\n // 1. <base> tag so relative asset paths (./assets/main.js) resolve\n // correctly regardless of trailing slash on the mount URL.\n // 2. Runtime config script for React Router, API client, and WS client.\n const injectedHtml = indexHtml.replace(\n '</head>',\n `<base href=\"${basePath}/\">\\n` +\n `<script>window.__AXL_STUDIO_BASE__=${safeBasePath}</script>\\n</head>`,\n );\n\n if (injectedHtml === indexHtml) {\n console.warn(\n '[axl-studio] Could not inject basePath into index.html — ' +\n '</head> tag not found. The SPA may not route correctly.',\n );\n }\n\n app.get('*', (c) => c.html(injectedHtml));\n }\n } else {\n // SPA fallback: serve index.html for non-API, non-WS routes\n app.get('*', serveStatic({ root: staticRoot, path: '/index.html' }));\n }\n }\n\n return {\n app,\n connMgr,\n costAggregator,\n createWsHandlers: () => createWsHandlers(connMgr),\n traceListener,\n };\n}\n","import type { Context, Next } from 'hono';\nimport type { StudioEnv, ApiError } from '../types.js';\n\nexport async function errorHandler(c: Context<StudioEnv>, next: Next) {\n try {\n await next();\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n const code = (err as { code?: string }).code ?? 'INTERNAL_ERROR';\n\n // Determine HTTP status from error properties\n let status = 500;\n if ('status' in (err as object)) {\n const errStatus = (err as { status: unknown }).status;\n if (typeof errStatus === 'number' && errStatus >= 400 && errStatus < 600) {\n status = errStatus;\n }\n } else if (\n code === 'NOT_FOUND' ||\n message.includes('not found') ||\n message.includes('not registered')\n ) {\n status = 404;\n } else if (\n code === 'VALIDATION_ERROR' ||\n message.includes('Expected') ||\n message.includes('invalid')\n ) {\n status = 400;\n }\n\n const body: ApiError = {\n ok: false,\n error: { code, message },\n };\n\n return c.json(body, status as 400 | 404 | 500);\n }\n}\n","/**\n * Minimal interface for a connection that can receive broadcast messages.\n * Satisfied by WSContext (Hono), ws.WebSocket (Node.js), and the middleware's\n * adapted socket. Internal to ConnectionManager — not part of the public API.\n */\nexport interface BroadcastTarget {\n send(data: string): void;\n close?(): void;\n}\n\n/**\n * Manages WebSocket connections and channel subscriptions.\n * Supports channel multiplexing: clients subscribe/unsubscribe to channels\n * and receive events only for channels they're subscribed to.\n */\nexport class ConnectionManager {\n /** channel -> set of WS connections */\n private channels = new Map<string, Set<BroadcastTarget>>();\n /** ws -> set of subscribed channels (for cleanup) */\n private connections = new Map<BroadcastTarget, Set<string>>();\n private maxConnections = 100;\n\n /** Register a new WS connection. */\n add(ws: BroadcastTarget): void {\n if (this.connections.size >= this.maxConnections) {\n ws.close?.();\n return;\n }\n this.connections.set(ws, new Set());\n }\n\n /** Remove a WS connection and all its subscriptions. */\n remove(ws: BroadcastTarget): void {\n const channels = this.connections.get(ws);\n if (channels) {\n for (const ch of channels) {\n this.channels.get(ch)?.delete(ws);\n if (this.channels.get(ch)?.size === 0) {\n this.channels.delete(ch);\n }\n }\n }\n this.connections.delete(ws);\n }\n\n /** Subscribe a connection to a channel. No-op if the connection was not added. */\n subscribe(ws: BroadcastTarget, channel: string): void {\n if (!this.connections.has(ws)) return;\n let subs = this.channels.get(channel);\n if (!subs) {\n subs = new Set();\n this.channels.set(channel, subs);\n }\n subs.add(ws);\n this.connections.get(ws)!.add(channel);\n }\n\n /** Unsubscribe a connection from a channel. */\n unsubscribe(ws: BroadcastTarget, channel: string): void {\n this.channels.get(channel)?.delete(ws);\n if (this.channels.get(channel)?.size === 0) {\n this.channels.delete(channel);\n }\n this.connections.get(ws)?.delete(channel);\n }\n\n /** Broadcast data to all subscribers of a channel. */\n broadcast(channel: string, data: unknown): void {\n const subs = this.channels.get(channel);\n if (!subs || subs.size === 0) return;\n\n const msg = JSON.stringify({ type: 'event', channel, data });\n for (const ws of [...subs]) {\n try {\n ws.send(msg);\n } catch {\n // Connection closed — clean up\n this.remove(ws);\n }\n }\n }\n\n /** Broadcast to channel and all wildcard subscribers (e.g., trace:* matches trace:abc). */\n broadcastWithWildcard(channel: string, data: unknown): void {\n this.broadcast(channel, data);\n\n // Check for wildcard subscribers: \"prefix:*\" matches \"prefix:anything\"\n // Send with the actual channel name so wildcard subscribers know the source.\n const colonIdx = channel.indexOf(':');\n if (colonIdx > 0) {\n const wildcardChannel = channel.substring(0, colonIdx) + ':*';\n const subs = this.channels.get(wildcardChannel);\n if (!subs || subs.size === 0) return;\n\n const msg = JSON.stringify({ type: 'event', channel, data });\n for (const ws of [...subs]) {\n try {\n ws.send(msg);\n } catch {\n this.remove(ws);\n }\n }\n }\n }\n\n /** Close all connections and clear all state. Used during shutdown. */\n closeAll(): void {\n for (const ws of this.connections.keys()) {\n ws.close?.();\n }\n this.connections.clear();\n this.channels.clear();\n }\n\n /** Get the number of active connections. */\n get connectionCount(): number {\n return this.connections.size;\n }\n\n /** Check if any connections are subscribed to a channel. */\n hasSubscribers(channel: string): boolean {\n return (this.channels.get(channel)?.size ?? 0) > 0;\n }\n}\n","import type { BroadcastTarget } from './connection-manager.js';\nimport type { ConnectionManager } from './connection-manager.js';\n\n/** Channel prefixes that accept suffixes (e.g., execution:abc, trace:*). */\nconst VALID_CHANNEL_PREFIXES = ['execution:', 'trace:'];\n/** Channels that must match exactly (no suffix allowed). */\nconst VALID_EXACT_CHANNELS = ['costs', 'decisions'];\nconst MAX_CHANNEL_LENGTH = 256;\n\n/**\n * Handle a single WebSocket message according to the Studio protocol.\n * Returns a JSON string to send back to the client, or null for no response.\n *\n * Used by both the Hono WS handler (ws/handler.ts) and the Node.js\n * middleware (middleware.ts) to keep the protocol in one place.\n */\nexport function handleWsMessage(\n raw: string,\n socket: BroadcastTarget,\n connMgr: ConnectionManager,\n): string | null {\n // Reject oversized messages (64KB limit)\n if (raw.length > 65536) {\n return JSON.stringify({ type: 'error', message: 'Message too large' });\n }\n\n let msg: { type: string; channel?: string };\n try {\n msg = JSON.parse(raw);\n } catch {\n return JSON.stringify({ type: 'error', message: 'Invalid JSON' });\n }\n\n switch (msg.type) {\n case 'subscribe': {\n const error = validateChannel(msg.channel);\n if (error) return JSON.stringify({ type: 'error', message: error });\n connMgr.subscribe(socket, msg.channel!);\n return JSON.stringify({ type: 'subscribed', channel: msg.channel });\n }\n case 'unsubscribe': {\n const error = validateChannel(msg.channel);\n if (error) return JSON.stringify({ type: 'error', message: error });\n connMgr.unsubscribe(socket, msg.channel!);\n return JSON.stringify({ type: 'unsubscribed', channel: msg.channel });\n }\n case 'ping':\n return JSON.stringify({ type: 'pong' });\n default:\n return JSON.stringify({ type: 'error', message: 'Unknown message type' });\n }\n}\n\nfunction validateChannel(channel: unknown): string | null {\n if (typeof channel !== 'string' || !channel) {\n return 'Missing or invalid channel';\n }\n if (channel.length > MAX_CHANNEL_LENGTH) {\n return `Channel name exceeds ${MAX_CHANNEL_LENGTH} characters`;\n }\n if (\n !VALID_EXACT_CHANNELS.includes(channel as (typeof VALID_EXACT_CHANNELS)[number]) &&\n !VALID_CHANNEL_PREFIXES.some((p) => channel.startsWith(p))\n ) {\n return `Invalid channel: ${channel}`;\n }\n return null;\n}\n","import type { WSContext } from 'hono/ws';\nimport type { ConnectionManager } from './connection-manager.js';\nimport { handleWsMessage } from './protocol.js';\n\n/** Create WS event handlers for a Hono WebSocket connection. */\nexport function createWsHandlers(connMgr: ConnectionManager) {\n return {\n onOpen(_event: Event, ws: WSContext) {\n connMgr.add(ws);\n },\n\n onMessage(event: MessageEvent, ws: WSContext) {\n const reply = handleWsMessage(String(event.data), ws, connMgr);\n if (reply) ws.send(reply);\n },\n\n onClose(_event: CloseEvent, ws: WSContext) {\n connMgr.remove(ws);\n },\n\n onError(_event: Event, ws: WSContext) {\n connMgr.remove(ws);\n },\n };\n}\n","import type { CostData } from './types.js';\nimport type { ConnectionManager } from './ws/connection-manager.js';\n\n/**\n * Accumulates cost data from trace events.\n * Broadcasts updates to the 'costs' WS channel.\n */\nexport class CostAggregator {\n private data: CostData = {\n totalCost: 0,\n totalTokens: { input: 0, output: 0, reasoning: 0 },\n byAgent: {},\n byModel: {},\n byWorkflow: {},\n };\n\n constructor(private connMgr: ConnectionManager) {}\n\n /** Process a trace event and update cost data. */\n onTrace(event: {\n type?: string;\n agent?: string;\n model?: string;\n workflow?: string;\n cost?: number;\n tokens?: { input?: number; output?: number; reasoning?: number };\n }): void {\n if (!event.cost && !event.tokens) return;\n\n const cost = event.cost ?? 0;\n const tokens = event.tokens ?? {};\n\n this.data.totalCost += cost;\n this.data.totalTokens.input += tokens.input ?? 0;\n this.data.totalTokens.output += tokens.output ?? 0;\n this.data.totalTokens.reasoning += tokens.reasoning ?? 0;\n\n if (event.agent) {\n const entry = this.data.byAgent[event.agent] ?? { cost: 0, calls: 0 };\n entry.cost += cost;\n entry.calls += 1;\n this.data.byAgent[event.agent] = entry;\n }\n\n if (event.model) {\n const entry = this.data.byModel[event.model] ?? {\n cost: 0,\n calls: 0,\n tokens: { input: 0, output: 0 },\n };\n entry.cost += cost;\n entry.calls += 1;\n entry.tokens.input += tokens.input ?? 0;\n entry.tokens.output += tokens.output ?? 0;\n this.data.byModel[event.model] = entry;\n }\n\n if (event.workflow) {\n const entry = this.data.byWorkflow[event.workflow] ?? { cost: 0, executions: 0 };\n entry.cost += cost;\n if (event.type === 'workflow_start') entry.executions += 1;\n this.data.byWorkflow[event.workflow] = entry;\n }\n\n // Broadcast to WS subscribers\n this.connMgr.broadcast('costs', this.data);\n }\n\n /** Get current aggregated cost data. */\n getData(): CostData {\n return this.data;\n }\n\n /** Reset all accumulated data. */\n reset(): void {\n this.data = {\n totalCost: 0,\n totalTokens: { input: 0, output: 0, reasoning: 0 },\n byAgent: {},\n byModel: {},\n byWorkflow: {},\n };\n }\n}\n","import { Hono } from 'hono';\nimport type { StudioEnv } from '../types.js';\n\nconst app = new Hono<StudioEnv>();\n\napp.get('/health', (c) => {\n const runtime = c.get('runtime');\n return c.json({\n ok: true,\n data: {\n status: 'healthy',\n workflows: runtime.getWorkflowNames().length,\n agents: runtime.getAgents().length,\n tools: runtime.getTools().length,\n },\n });\n});\n\nexport default app;\n","import { Hono } from 'hono';\nimport { zodToJsonSchema } from '@axlsdk/axl';\nimport type { StudioEnv, WorkflowSummary } from '../types.js';\nimport type { ConnectionManager } from '../ws/connection-manager.js';\n\nexport function createWorkflowRoutes(connMgr: ConnectionManager) {\n const app = new Hono<StudioEnv>();\n\n // List all workflows\n app.get('/workflows', (c) => {\n const runtime = c.get('runtime');\n const workflows: WorkflowSummary[] = runtime.getWorkflows().map((w) => ({\n name: w.name,\n hasInputSchema: !!w.inputSchema,\n hasOutputSchema: !!w.outputSchema,\n }));\n return c.json({ ok: true, data: workflows });\n });\n\n // Get workflow detail (including schemas)\n app.get('/workflows/:name', (c) => {\n const runtime = c.get('runtime');\n const name = c.req.param('name');\n const workflow = runtime.getWorkflow(name);\n if (!workflow) {\n return c.json(\n { ok: false, error: { code: 'NOT_FOUND', message: `Workflow \"${name}\" not found` } },\n 404,\n );\n }\n\n return c.json({\n ok: true,\n data: {\n name: workflow.name,\n inputSchema: workflow.inputSchema ? zodToJsonSchema(workflow.inputSchema) : null,\n outputSchema: workflow.outputSchema ? zodToJsonSchema(workflow.outputSchema) : null,\n },\n });\n });\n\n // Execute a workflow\n app.post('/workflows/:name/execute', async (c) => {\n const runtime = c.get('runtime');\n const name = c.req.param('name');\n\n const workflow = runtime.getWorkflow(name);\n if (!workflow) {\n return c.json(\n { ok: false, error: { code: 'NOT_FOUND', message: `Workflow \"${name}\" not found` } },\n 404,\n );\n }\n\n const body = await c.req.json<{\n input?: unknown;\n stream?: boolean;\n metadata?: Record<string, unknown>;\n }>();\n\n if (body.stream) {\n // Streaming execution — pipe events to WS channel\n const stream = runtime.stream(name, body.input ?? {}, { metadata: body.metadata });\n const executionId = `stream-${Date.now()}`;\n\n // Forward stream events to WS\n (async () => {\n try {\n for await (const event of stream) {\n connMgr.broadcastWithWildcard(`execution:${executionId}`, event);\n }\n } catch (err) {\n connMgr.broadcastWithWildcard(`execution:${executionId}`, {\n type: 'error',\n message: err instanceof Error ? err.message : 'Stream error',\n });\n }\n })();\n\n return c.json({ ok: true, data: { executionId, streaming: true } });\n }\n\n const result = await runtime.execute(name, body.input ?? {}, { metadata: body.metadata });\n return c.json({ ok: true, data: { result } });\n });\n\n return app;\n}\n","import { Hono } from 'hono';\nimport type { StudioEnv } from '../types.js';\n\nconst app = new Hono<StudioEnv>();\n\n// List all executions\napp.get('/executions', (c) => {\n const runtime = c.get('runtime');\n const executions = runtime.getExecutions();\n return c.json({ ok: true, data: executions });\n});\n\n// Get execution by ID\napp.get('/executions/:id', async (c) => {\n const runtime = c.get('runtime');\n const id = c.req.param('id');\n const execution = await runtime.getExecution(id);\n if (!execution) {\n return c.json(\n { ok: false, error: { code: 'NOT_FOUND', message: `Execution \"${id}\" not found` } },\n 404,\n );\n }\n return c.json({ ok: true, data: execution });\n});\n\n// Abort a running execution\napp.post('/executions/:id/abort', (c) => {\n const runtime = c.get('runtime');\n const id = c.req.param('id');\n runtime.abort(id);\n return c.json({ ok: true, data: { aborted: true } });\n});\n\nexport default app;\n","import { Hono } from 'hono';\nimport type { StudioEnv, SessionSummary } from '../types.js';\nimport type { ConnectionManager } from '../ws/connection-manager.js';\n\nexport function createSessionRoutes(connMgr: ConnectionManager) {\n const app = new Hono<StudioEnv>();\n\n // List all sessions\n app.get('/sessions', async (c) => {\n const runtime = c.get('runtime');\n const store = runtime.getStateStore();\n if (!store.listSessions) {\n return c.json({ ok: true, data: [] });\n }\n const ids = await store.listSessions();\n const sessions: SessionSummary[] = [];\n for (const id of ids) {\n const history = await store.getSession(id);\n sessions.push({ id, messageCount: history.length });\n }\n return c.json({ ok: true, data: sessions });\n });\n\n // Get session history\n app.get('/sessions/:id', async (c) => {\n const runtime = c.get('runtime');\n const store = runtime.getStateStore();\n const id = c.req.param('id');\n const history = await store.getSession(id);\n const handoffHistory = await store.getSessionMeta(id, 'handoffHistory');\n return c.json({ ok: true, data: { id, history, handoffHistory: handoffHistory ?? [] } });\n });\n\n // Send message to session (non-streaming)\n app.post('/sessions/:id/send', async (c) => {\n const runtime = c.get('runtime');\n const id = c.req.param('id');\n const body = await c.req.json<{ message: string; workflow: string }>();\n\n const session = runtime.session(id);\n const result = await session.send(body.workflow, body.message);\n return c.json({ ok: true, data: { result } });\n });\n\n // Stream session message\n app.post('/sessions/:id/stream', async (c) => {\n const runtime = c.get('runtime');\n const id = c.req.param('id');\n const body = await c.req.json<{ message: string; workflow: string }>();\n\n const session = runtime.session(id);\n const stream = await session.stream(body.workflow, body.message);\n const executionId = `session-${id}-${Date.now()}`;\n\n // Forward stream events to WS\n (async () => {\n try {\n for await (const event of stream) {\n connMgr.broadcastWithWildcard(`execution:${executionId}`, event);\n }\n } catch (err) {\n connMgr.broadcastWithWildcard(`execution:${executionId}`, {\n type: 'error',\n message: err instanceof Error ? err.message : 'Stream error',\n });\n }\n })();\n\n return c.json({ ok: true, data: { executionId, streaming: true } });\n });\n\n // Delete session\n app.delete('/sessions/:id', async (c) => {\n const runtime = c.get('runtime');\n const store = runtime.getStateStore();\n const id = c.req.param('id');\n await store.deleteSession(id);\n return c.json({ ok: true, data: { deleted: true } });\n });\n\n return app;\n}\n","import { Hono } from 'hono';\nimport { zodToJsonSchema } from '@axlsdk/axl';\nimport type { StudioEnv, AgentSummary } from '../types.js';\n\nconst app = new Hono<StudioEnv>();\n\n// List all agents\napp.get('/agents', (c) => {\n const runtime = c.get('runtime');\n const agents: AgentSummary[] = runtime.getAgents().map((a) => ({\n name: a._name,\n model: a.resolveModel(),\n system: a.resolveSystem(),\n tools: a._config.tools?.map((t) => t.name) ?? [],\n handoffs:\n typeof a._config.handoffs === 'function'\n ? ['(dynamic)']\n : (a._config.handoffs?.map((h) => h.agent._name) ?? []),\n maxTurns: a._config.maxTurns,\n temperature: a._config.temperature,\n maxTokens: a._config.maxTokens,\n effort: a._config.effort,\n thinkingBudget: a._config.thinkingBudget,\n includeThoughts: a._config.includeThoughts,\n toolChoice: a._config.toolChoice,\n stop: a._config.stop,\n }));\n return c.json({ ok: true, data: agents });\n});\n\n// Get agent detail\napp.get('/agents/:name', (c) => {\n const runtime = c.get('runtime');\n const name = c.req.param('name');\n const agent = runtime.getAgent(name);\n if (!agent) {\n return c.json(\n { ok: false, error: { code: 'NOT_FOUND', message: `Agent \"${name}\" not found` } },\n 404,\n );\n }\n\n const cfg = agent._config;\n return c.json({\n ok: true,\n data: {\n name: agent._name,\n model: agent.resolveModel(),\n system: agent.resolveSystem(),\n tools:\n cfg.tools?.map((t) => ({\n name: t.name,\n description: t.description,\n inputSchema: zodToJsonSchema(t.inputSchema),\n })) ?? [],\n handoffs:\n typeof cfg.handoffs === 'function'\n ? [\n {\n agent: '(dynamic)',\n description: 'Resolved at runtime from metadata',\n mode: 'oneway' as const,\n },\n ]\n : (cfg.handoffs?.map((h) => ({\n agent: h.agent._name,\n description: h.description,\n mode: h.mode ?? 'oneway',\n })) ?? []),\n maxTurns: cfg.maxTurns,\n temperature: cfg.temperature,\n maxTokens: cfg.maxTokens,\n effort: cfg.effort,\n thinkingBudget: cfg.thinkingBudget,\n includeThoughts: cfg.includeThoughts,\n toolChoice: cfg.toolChoice,\n stop: cfg.stop,\n timeout: cfg.timeout,\n maxContext: cfg.maxContext,\n version: cfg.version,\n mcp: cfg.mcp,\n mcpTools: cfg.mcpTools,\n hasGuardrails: !!cfg.guardrails,\n guardrails: cfg.guardrails\n ? {\n hasInput: !!cfg.guardrails.input,\n hasOutput: !!cfg.guardrails.output,\n onBlock: cfg.guardrails.onBlock ?? 'throw',\n maxRetries: cfg.guardrails.maxRetries,\n }\n : null,\n },\n });\n});\n\nexport default app;\n","import { Hono } from 'hono';\nimport { zodToJsonSchema } from '@axlsdk/axl';\nimport type { StudioEnv, ToolSummary } from '../types.js';\n\nconst app = new Hono<StudioEnv>();\n\n// List all tools\napp.get('/tools', (c) => {\n const runtime = c.get('runtime');\n const tools: ToolSummary[] = runtime.getTools().map((t) => ({\n name: t.name,\n description: t.description,\n inputSchema: t.inputSchema ? zodToJsonSchema(t.inputSchema) : {},\n sensitive: t.sensitive ?? false,\n requireApproval: t.requireApproval ?? false,\n }));\n return c.json({ ok: true, data: tools });\n});\n\n// Get tool detail\napp.get('/tools/:name', (c) => {\n const runtime = c.get('runtime');\n const name = c.req.param('name');\n const tool = runtime.getTool(name);\n if (!tool) {\n return c.json(\n { ok: false, error: { code: 'NOT_FOUND', message: `Tool \"${name}\" not found` } },\n 404,\n );\n }\n\n return c.json({\n ok: true,\n data: {\n name: tool.name,\n description: tool.description,\n inputSchema: tool.inputSchema ? zodToJsonSchema(tool.inputSchema) : {},\n sensitive: tool.sensitive,\n requireApproval: tool.requireApproval,\n retry: tool.retry,\n hasHooks: !!tool.hooks,\n hooks: tool.hooks\n ? {\n hasBefore: !!tool.hooks.before,\n hasAfter: !!tool.hooks.after,\n }\n : null,\n },\n });\n});\n\n// Test a tool directly\napp.post('/tools/:name/test', async (c) => {\n const runtime = c.get('runtime');\n const name = c.req.param('name');\n const tool = runtime.getTool(name);\n if (!tool) {\n return c.json(\n { ok: false, error: { code: 'NOT_FOUND', message: `Tool \"${name}\" not found` } },\n 404,\n );\n }\n\n const body = await c.req.json<{ input: unknown }>();\n const ctx = runtime.createContext();\n const result = await tool.run(ctx, body.input);\n return c.json({ ok: true, data: { result } });\n});\n\nexport default app;\n","import { Hono } from 'hono';\nimport type { StudioEnv } from '../types.js';\n\nconst app = new Hono<StudioEnv>();\n\n// Get all memory entries for a scope\napp.get('/memory/:scope', async (c) => {\n const runtime = c.get('runtime');\n const store = runtime.getStateStore();\n const scope = c.req.param('scope');\n\n if (!store.getAllMemory) {\n return c.json({ ok: true, data: [] });\n }\n\n const entries = await store.getAllMemory(scope);\n return c.json({ ok: true, data: entries });\n});\n\n// Get a specific memory entry\napp.get('/memory/:scope/:key', async (c) => {\n const runtime = c.get('runtime');\n const store = runtime.getStateStore();\n const scope = c.req.param('scope');\n const key = c.req.param('key');\n\n if (!store.getMemory) {\n return c.json(\n { ok: false, error: { code: 'NOT_SUPPORTED', message: 'Memory not supported' } },\n 501,\n );\n }\n\n const value = await store.getMemory(scope, key);\n if (value === null) {\n return c.json(\n { ok: false, error: { code: 'NOT_FOUND', message: `Memory \"${scope}/${key}\" not found` } },\n 404,\n );\n }\n\n return c.json({ ok: true, data: { key, value } });\n});\n\n// Save a memory entry\napp.put('/memory/:scope/:key', async (c) => {\n const runtime = c.get('runtime');\n const store = runtime.getStateStore();\n const scope = c.req.param('scope');\n const key = c.req.param('key');\n\n if (!store.saveMemory) {\n return c.json(\n { ok: false, error: { code: 'NOT_SUPPORTED', message: 'Memory not supported' } },\n 501,\n );\n }\n\n const body = await c.req.json<{ value: unknown }>();\n await store.saveMemory(scope, key, body.value);\n return c.json({ ok: true, data: { saved: true } });\n});\n\n// Delete a memory entry\napp.delete('/memory/:scope/:key', async (c) => {\n const runtime = c.get('runtime');\n const store = runtime.getStateStore();\n const scope = c.req.param('scope');\n const key = c.req.param('key');\n\n if (!store.deleteMemory) {\n return c.json(\n { ok: false, error: { code: 'NOT_SUPPORTED', message: 'Memory not supported' } },\n 501,\n );\n }\n\n await store.deleteMemory(scope, key);\n return c.json({ ok: true, data: { deleted: true } });\n});\n\n// Semantic search\napp.post('/memory/search', async (c) => {\n // TODO: Connect to MemoryManager's vector search once exposed\n return c.json({\n ok: true,\n data: { results: [], message: 'Semantic search requires MemoryManager with vector store' },\n });\n});\n\nexport default app;\n","import { Hono } from 'hono';\nimport type { StudioEnv } from '../types.js';\n\nconst app = new Hono<StudioEnv>();\n\n// List pending decisions\napp.get('/decisions', async (c) => {\n const runtime = c.get('runtime');\n const decisions = await runtime.getPendingDecisions();\n return c.json({ ok: true, data: decisions });\n});\n\n// Resolve a pending decision\napp.post('/decisions/:executionId/resolve', async (c) => {\n const runtime = c.get('runtime');\n const executionId = c.req.param('executionId');\n const body = await c.req.json<{ approved: boolean; reason?: string }>();\n\n await runtime.resolveDecision(executionId, body);\n return c.json({ ok: true, data: { resolved: true } });\n});\n\nexport default app;\n","import { Hono } from 'hono';\nimport type { StudioEnv } from '../types.js';\nimport type { CostAggregator } from '../cost-aggregator.js';\n\nexport function createCostRoutes(costAggregator: CostAggregator) {\n const app = new Hono<StudioEnv>();\n\n app.get('/costs', (c) => {\n return c.json({ ok: true, data: costAggregator.getData() });\n });\n\n app.post('/costs/reset', (c) => {\n costAggregator.reset();\n return c.json({ ok: true, data: { reset: true } });\n });\n\n return app;\n}\n","import { Hono } from 'hono';\nimport type { StudioEnv } from '../types.js';\n\nconst app = new Hono<StudioEnv>();\n\n// List registered eval configs\napp.get('/evals', async (c) => {\n const runtime = c.get('runtime');\n const evals = runtime.getRegisteredEvals();\n return c.json({ ok: true, data: evals });\n});\n\n// Run a registered eval by name\napp.post('/evals/:name/run', async (c) => {\n const runtime = c.get('runtime');\n const name = c.req.param('name');\n\n const entry = runtime.getRegisteredEval(name);\n if (!entry) {\n return c.json(\n { ok: false, error: { code: 'NOT_FOUND', message: `Eval \"${name}\" not found` } },\n 404,\n );\n }\n\n try {\n const result = await runtime.runRegisteredEval(name);\n return c.json({ ok: true, data: result });\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return c.json({ ok: false, error: { code: 'EVAL_ERROR', message } }, 400);\n }\n});\n\n// Compare eval results\napp.post('/evals/compare', async (c) => {\n const runtime = c.get('runtime');\n const body = await c.req.json<{ baseline: unknown; candidate: unknown }>();\n\n try {\n const result = await runtime.evalCompare(body.baseline, body.candidate);\n return c.json({ ok: true, data: result });\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return c.json({ ok: false, error: { code: 'EVAL_ERROR', message } }, 400);\n }\n});\n\nexport default app;\n","import { Hono } from 'hono';\nimport type { StudioEnv } from '../types.js';\nimport type { ConnectionManager } from '../ws/connection-manager.js';\n\nexport function createPlaygroundRoutes(connMgr: ConnectionManager) {\n const app = new Hono<StudioEnv>();\n\n // Chat with an agent via session\n app.post('/playground/chat', async (c) => {\n const runtime = c.get('runtime');\n const body = await c.req.json<{\n sessionId?: string;\n message: string;\n workflow?: string;\n }>();\n\n const workflowName = body.workflow ?? runtime.getWorkflowNames()[0];\n if (!workflowName) {\n return c.json(\n { ok: false, error: { code: 'NO_WORKFLOW', message: 'No workflows registered' } },\n 400,\n );\n }\n const sessionId = body.sessionId ?? `playground-${Date.now()}`;\n const session = runtime.session(sessionId);\n\n // Stream the response\n const stream = await session.stream(workflowName, body.message);\n const executionId = `playground-${sessionId}-${Date.now()}`;\n\n // Forward stream events to WS\n (async () => {\n try {\n for await (const event of stream) {\n connMgr.broadcastWithWildcard(`execution:${executionId}`, event);\n }\n } catch (err) {\n connMgr.broadcastWithWildcard(`execution:${executionId}`, {\n type: 'error',\n message: err instanceof Error ? err.message : 'Stream error',\n });\n }\n })();\n\n return c.json({\n ok: true,\n data: { sessionId, executionId, streaming: true },\n });\n });\n\n return app;\n}\n"],"mappings":";AAAA,SAAS,YAAY,oBAAoB;AACzC,SAAS,eAAe;AACxB,SAAS,QAAAA,cAAY;AACrB,SAAS,YAAY;AACrB,SAAS,mBAAmB;;;ACD5B,eAAsB,aAAa,GAAuB,MAAY;AACpE,MAAI;AACF,UAAM,KAAK;AA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C;AAAA,MAC1C;AAAA,IACF,OAAO;AAEL,MAAAA,KAAI,IAAI,KAAK,YAAY,EAAE,MAAM,YAAY,MAAM,cAAc,CAAC,CAAC;AAAA,IACrE;AAAA,EACF;AAEA,SAAO;AAAA,IACL,KAAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA,kBAAkB,MAAM,iBAAiB,OAAO;AAAA,IAChD;AAAA,EACF;AACF;","names":["Hono","Hono","app","Hono","app","Hono","app","Hono","zodToJsonSchema","app","Hono","zodToJsonSchema","app","Hono","app","Hono","app","Hono","app","Hono","app","Hono","app","app","Hono"]}
|