@axlsdk/studio 0.17.6 → 0.17.7
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 +7 -2
- package/dist/{chunk-LLJHLJ63.js → chunk-WUCCIBQ6.js} +187 -117
- package/dist/chunk-WUCCIBQ6.js.map +1 -0
- package/dist/cli.cjs +190 -120
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/{connection-manager-DAuqk9lM.d.cts → connection-manager-8TQqoUtk.d.cts} +11 -0
- package/dist/{connection-manager-DAuqk9lM.d.ts → connection-manager-8TQqoUtk.d.ts} +11 -0
- package/dist/middleware.cjs +189 -119
- package/dist/middleware.cjs.map +1 -1
- package/dist/middleware.d.cts +1 -1
- package/dist/middleware.d.ts +1 -1
- package/dist/middleware.js +1 -1
- package/dist/server/index.cjs +186 -116
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +5 -2
- package/dist/server/index.d.ts +5 -2
- package/dist/server/index.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-LLJHLJ63.js.map +0 -1
package/dist/middleware.cjs
CHANGED
|
@@ -74,6 +74,14 @@ function redactExecutionInfo(info, redact) {
|
|
|
74
74
|
...info,
|
|
75
75
|
...info.result !== void 0 ? { result: REDACTED } : {},
|
|
76
76
|
...info.error !== void 0 ? { error: REDACTED } : {},
|
|
77
|
+
// `metadata` carries operator-supplied tags (userId/tenantId/correlation
|
|
78
|
+
// ids per the docs) — exactly the surface trace.redact is supposed to
|
|
79
|
+
// protect. Without this scrub, REST consumers see the metadata bag
|
|
80
|
+
// even when redaction is enabled, while events[*].data.* is properly
|
|
81
|
+
// scrubbed. Use a `{ redacted: true }` marker to keep the field
|
|
82
|
+
// queryable/serializable rather than dropping it (mirrors
|
|
83
|
+
// `redactPendingDecision` on `decision.metadata`).
|
|
84
|
+
...info.metadata !== void 0 ? { metadata: { redacted: true } } : {},
|
|
77
85
|
events: info.events.map((e) => redactStreamEvent(e, true))
|
|
78
86
|
};
|
|
79
87
|
}
|
|
@@ -324,6 +332,24 @@ var ConnectionManager = class {
|
|
|
324
332
|
}
|
|
325
333
|
}
|
|
326
334
|
}
|
|
335
|
+
/** Drop the replay buffer for a channel immediately (cancels any pending
|
|
336
|
+
* TTL timer). Used by the executions DELETE route to scrub buffered
|
|
337
|
+
* events when an operator runs a GDPR delete — otherwise events for the
|
|
338
|
+
* deleted execution remain replayable to late subscribers for up to
|
|
339
|
+
* `BUFFER_TTL_MS` after stream completion. No-op when no buffer exists.
|
|
340
|
+
*/
|
|
341
|
+
clearChannelBuffer(channel) {
|
|
342
|
+
const buffer = this.buffers.get(channel);
|
|
343
|
+
if (!buffer) return;
|
|
344
|
+
if (buffer.timer) clearTimeout(buffer.timer);
|
|
345
|
+
this.buffers.delete(channel);
|
|
346
|
+
}
|
|
347
|
+
/** @internal Inspection hook for tests — returns whether a replay buffer
|
|
348
|
+
* currently exists for `channel`. Not part of the public API; embedders
|
|
349
|
+
* should not rely on it. */
|
|
350
|
+
_hasReplayBuffer(channel) {
|
|
351
|
+
return this.buffers.has(channel);
|
|
352
|
+
}
|
|
327
353
|
/** Unsubscribe a connection from a channel. */
|
|
328
354
|
unsubscribe(ws, channel) {
|
|
329
355
|
this.channels.get(channel)?.delete(ws);
|
|
@@ -582,6 +608,7 @@ var TraceAggregator = class {
|
|
|
582
608
|
snaps;
|
|
583
609
|
interval;
|
|
584
610
|
listener;
|
|
611
|
+
deleteListener;
|
|
585
612
|
options;
|
|
586
613
|
constructor(options) {
|
|
587
614
|
this.options = options;
|
|
@@ -599,6 +626,12 @@ var TraceAggregator = class {
|
|
|
599
626
|
this.snaps.fold(event.timestamp, (prev) => this.options.reducer(prev, event));
|
|
600
627
|
};
|
|
601
628
|
this.options.runtime.on("trace", this.listener);
|
|
629
|
+
this.deleteListener = () => {
|
|
630
|
+
this.rebuild().catch(
|
|
631
|
+
(err) => console.error("[axl-studio] rebuild on execution_deleted failed:", err)
|
|
632
|
+
);
|
|
633
|
+
};
|
|
634
|
+
this.options.runtime.on("execution_deleted", this.deleteListener);
|
|
602
635
|
this.interval = setInterval(
|
|
603
636
|
() => this.rebuild().catch((err) => console.error("[axl-studio] rebuild failed:", err)),
|
|
604
637
|
REBUILD_INTERVAL_MS
|
|
@@ -631,6 +664,7 @@ var TraceAggregator = class {
|
|
|
631
664
|
}
|
|
632
665
|
close() {
|
|
633
666
|
if (this.listener) this.options.runtime.off("trace", this.listener);
|
|
667
|
+
if (this.deleteListener) this.options.runtime.off("execution_deleted", this.deleteListener);
|
|
634
668
|
if (this.interval) clearInterval(this.interval);
|
|
635
669
|
}
|
|
636
670
|
};
|
|
@@ -640,6 +674,7 @@ var ExecutionAggregator = class {
|
|
|
640
674
|
snaps;
|
|
641
675
|
interval;
|
|
642
676
|
listener;
|
|
677
|
+
deleteListener;
|
|
643
678
|
options;
|
|
644
679
|
/** Generation counter to prevent stale async fold after rebuild. */
|
|
645
680
|
generation = 0;
|
|
@@ -666,6 +701,12 @@ var ExecutionAggregator = class {
|
|
|
666
701
|
}).catch((err) => console.error("[axl-studio] execution fold failed:", err));
|
|
667
702
|
};
|
|
668
703
|
this.options.runtime.on("trace", this.listener);
|
|
704
|
+
this.deleteListener = () => {
|
|
705
|
+
this.rebuild().catch(
|
|
706
|
+
(err) => console.error("[axl-studio] rebuild on execution_deleted failed:", err)
|
|
707
|
+
);
|
|
708
|
+
};
|
|
709
|
+
this.options.runtime.on("execution_deleted", this.deleteListener);
|
|
669
710
|
this.interval = setInterval(
|
|
670
711
|
() => this.rebuild().catch((err) => console.error("[axl-studio] rebuild failed:", err)),
|
|
671
712
|
REBUILD_INTERVAL_MS
|
|
@@ -697,6 +738,7 @@ var ExecutionAggregator = class {
|
|
|
697
738
|
}
|
|
698
739
|
close() {
|
|
699
740
|
if (this.listener) this.options.runtime.off("trace", this.listener);
|
|
741
|
+
if (this.deleteListener) this.options.runtime.off("execution_deleted", this.deleteListener);
|
|
700
742
|
if (this.interval) clearInterval(this.interval);
|
|
701
743
|
}
|
|
702
744
|
};
|
|
@@ -706,6 +748,7 @@ var EvalAggregator = class {
|
|
|
706
748
|
snaps;
|
|
707
749
|
interval;
|
|
708
750
|
listener;
|
|
751
|
+
deleteListener;
|
|
709
752
|
options;
|
|
710
753
|
constructor(options) {
|
|
711
754
|
this.options = options;
|
|
@@ -723,6 +766,12 @@ var EvalAggregator = class {
|
|
|
723
766
|
this.snaps.fold(entry.timestamp, (prev) => this.options.reducer(prev, entry));
|
|
724
767
|
};
|
|
725
768
|
this.options.runtime.on("eval_result", this.listener);
|
|
769
|
+
this.deleteListener = () => {
|
|
770
|
+
this.rebuild().catch(
|
|
771
|
+
(err) => console.error("[axl-studio] rebuild on eval_deleted failed:", err)
|
|
772
|
+
);
|
|
773
|
+
};
|
|
774
|
+
this.options.runtime.on("eval_deleted", this.deleteListener);
|
|
726
775
|
this.interval = setInterval(
|
|
727
776
|
() => this.rebuild().catch((err) => console.error("[axl-studio] rebuild failed:", err)),
|
|
728
777
|
REBUILD_INTERVAL_MS
|
|
@@ -753,6 +802,7 @@ var EvalAggregator = class {
|
|
|
753
802
|
}
|
|
754
803
|
close() {
|
|
755
804
|
if (this.listener) this.options.runtime.off("eval_result", this.listener);
|
|
805
|
+
if (this.deleteListener) this.options.runtime.off("eval_deleted", this.deleteListener);
|
|
756
806
|
if (this.interval) clearInterval(this.interval);
|
|
757
807
|
}
|
|
758
808
|
};
|
|
@@ -1095,8 +1145,8 @@ function reduceTraceStats(acc, event) {
|
|
|
1095
1145
|
// src/server/routes/health.ts
|
|
1096
1146
|
var import_hono = require("hono");
|
|
1097
1147
|
function createHealthRoutes(readOnly) {
|
|
1098
|
-
const
|
|
1099
|
-
|
|
1148
|
+
const app5 = new import_hono.Hono();
|
|
1149
|
+
app5.get("/health", (c) => {
|
|
1100
1150
|
const runtime = c.get("runtime");
|
|
1101
1151
|
return c.json({
|
|
1102
1152
|
ok: true,
|
|
@@ -1109,15 +1159,15 @@ function createHealthRoutes(readOnly) {
|
|
|
1109
1159
|
}
|
|
1110
1160
|
});
|
|
1111
1161
|
});
|
|
1112
|
-
return
|
|
1162
|
+
return app5;
|
|
1113
1163
|
}
|
|
1114
1164
|
|
|
1115
1165
|
// src/server/routes/workflows.ts
|
|
1116
1166
|
var import_hono2 = require("hono");
|
|
1117
1167
|
var import_axl3 = require("@axlsdk/axl");
|
|
1118
1168
|
function createWorkflowRoutes(connMgr) {
|
|
1119
|
-
const
|
|
1120
|
-
|
|
1169
|
+
const app5 = new import_hono2.Hono();
|
|
1170
|
+
app5.get("/workflows", (c) => {
|
|
1121
1171
|
const runtime = c.get("runtime");
|
|
1122
1172
|
const workflows = runtime.getWorkflows().map((w) => ({
|
|
1123
1173
|
name: w.name,
|
|
@@ -1126,7 +1176,7 @@ function createWorkflowRoutes(connMgr) {
|
|
|
1126
1176
|
}));
|
|
1127
1177
|
return c.json({ ok: true, data: workflows });
|
|
1128
1178
|
});
|
|
1129
|
-
|
|
1179
|
+
app5.get("/workflows/:name", (c) => {
|
|
1130
1180
|
const runtime = c.get("runtime");
|
|
1131
1181
|
const name = c.req.param("name");
|
|
1132
1182
|
const workflow = runtime.getWorkflow(name);
|
|
@@ -1145,7 +1195,7 @@ function createWorkflowRoutes(connMgr) {
|
|
|
1145
1195
|
}
|
|
1146
1196
|
});
|
|
1147
1197
|
});
|
|
1148
|
-
|
|
1198
|
+
app5.post("/workflows/:name/execute", async (c) => {
|
|
1149
1199
|
const runtime = c.get("runtime");
|
|
1150
1200
|
const name = c.req.param("name");
|
|
1151
1201
|
const workflow = runtime.getWorkflow(name);
|
|
@@ -1176,70 +1226,89 @@ function createWorkflowRoutes(connMgr) {
|
|
|
1176
1226
|
data: { result: redactValue(result, runtime.isRedactEnabled()) }
|
|
1177
1227
|
});
|
|
1178
1228
|
});
|
|
1179
|
-
return
|
|
1229
|
+
return app5;
|
|
1180
1230
|
}
|
|
1181
1231
|
|
|
1182
1232
|
// src/server/routes/executions.ts
|
|
1183
1233
|
var import_hono3 = require("hono");
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1234
|
+
function createExecutionRoutes(connMgr) {
|
|
1235
|
+
const app5 = new import_hono3.Hono();
|
|
1236
|
+
app5.get("/executions", async (c) => {
|
|
1237
|
+
const runtime = c.get("runtime");
|
|
1238
|
+
const executions = await runtime.getExecutions();
|
|
1239
|
+
return c.json({
|
|
1240
|
+
ok: true,
|
|
1241
|
+
data: redactExecutionList(executions, runtime.isRedactEnabled())
|
|
1242
|
+
});
|
|
1191
1243
|
});
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1244
|
+
app5.get("/executions/:id", async (c) => {
|
|
1245
|
+
const runtime = c.get("runtime");
|
|
1246
|
+
const id = c.req.param("id");
|
|
1247
|
+
const execution = await runtime.getExecution(id);
|
|
1248
|
+
if (!execution) {
|
|
1249
|
+
return c.json(
|
|
1250
|
+
{ ok: false, error: { code: "NOT_FOUND", message: `Execution "${id}" not found` } },
|
|
1251
|
+
404
|
|
1252
|
+
);
|
|
1253
|
+
}
|
|
1254
|
+
const sinceParam = c.req.query("since");
|
|
1255
|
+
let paged = execution;
|
|
1256
|
+
if (sinceParam !== void 0) {
|
|
1257
|
+
const since = Number(sinceParam);
|
|
1258
|
+
if (!Number.isFinite(since) || !Number.isInteger(since)) {
|
|
1259
|
+
return c.json(
|
|
1260
|
+
{
|
|
1261
|
+
ok: false,
|
|
1262
|
+
error: {
|
|
1263
|
+
code: "INVALID_PARAM",
|
|
1264
|
+
message: `\`since\` must be a finite integer (got "${sinceParam}")`,
|
|
1265
|
+
param: "since"
|
|
1266
|
+
}
|
|
1267
|
+
},
|
|
1268
|
+
400
|
|
1269
|
+
);
|
|
1270
|
+
}
|
|
1271
|
+
paged = {
|
|
1272
|
+
...execution,
|
|
1273
|
+
events: execution.events.filter((e) => e.step > since)
|
|
1274
|
+
};
|
|
1275
|
+
}
|
|
1276
|
+
return c.json({
|
|
1277
|
+
ok: true,
|
|
1278
|
+
data: redactExecutionInfo(paged, runtime.isRedactEnabled())
|
|
1279
|
+
});
|
|
1280
|
+
});
|
|
1281
|
+
app5.post("/executions/:id/abort", (c) => {
|
|
1282
|
+
const runtime = c.get("runtime");
|
|
1283
|
+
const id = c.req.param("id");
|
|
1284
|
+
runtime.abort(id);
|
|
1285
|
+
return c.json({ ok: true, data: { aborted: true } });
|
|
1286
|
+
});
|
|
1287
|
+
app5.delete("/executions/:id", async (c) => {
|
|
1288
|
+
const runtime = c.get("runtime");
|
|
1289
|
+
const id = c.req.param("id");
|
|
1290
|
+
const deleted = await runtime.deleteExecution(id);
|
|
1291
|
+
if (!deleted) {
|
|
1208
1292
|
return c.json(
|
|
1209
1293
|
{
|
|
1210
1294
|
ok: false,
|
|
1211
|
-
error: {
|
|
1212
|
-
code: "INVALID_PARAM",
|
|
1213
|
-
message: `\`since\` must be a finite integer (got "${sinceParam}")`,
|
|
1214
|
-
param: "since"
|
|
1215
|
-
}
|
|
1295
|
+
error: { code: "NOT_FOUND", message: `Execution "${id}" not found` }
|
|
1216
1296
|
},
|
|
1217
|
-
|
|
1297
|
+
404
|
|
1218
1298
|
);
|
|
1219
1299
|
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
events: execution.events.filter((e) => e.step > since)
|
|
1223
|
-
};
|
|
1224
|
-
}
|
|
1225
|
-
return c.json({
|
|
1226
|
-
ok: true,
|
|
1227
|
-
data: redactExecutionInfo(paged, runtime.isRedactEnabled())
|
|
1300
|
+
connMgr?.clearChannelBuffer(`execution:${id}`);
|
|
1301
|
+
return c.json({ ok: true, data: { id, deleted: true } });
|
|
1228
1302
|
});
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
const id = c.req.param("id");
|
|
1233
|
-
runtime.abort(id);
|
|
1234
|
-
return c.json({ ok: true, data: { aborted: true } });
|
|
1235
|
-
});
|
|
1236
|
-
var executions_default = app;
|
|
1303
|
+
return app5;
|
|
1304
|
+
}
|
|
1305
|
+
var executions_default = createExecutionRoutes();
|
|
1237
1306
|
|
|
1238
1307
|
// src/server/routes/sessions.ts
|
|
1239
1308
|
var import_hono4 = require("hono");
|
|
1240
1309
|
function createSessionRoutes(connMgr) {
|
|
1241
|
-
const
|
|
1242
|
-
|
|
1310
|
+
const app5 = new import_hono4.Hono();
|
|
1311
|
+
app5.get("/sessions", async (c) => {
|
|
1243
1312
|
const runtime = c.get("runtime");
|
|
1244
1313
|
const store = runtime.getStateStore();
|
|
1245
1314
|
if (!store.listSessions) {
|
|
@@ -1253,7 +1322,7 @@ function createSessionRoutes(connMgr) {
|
|
|
1253
1322
|
}
|
|
1254
1323
|
return c.json({ ok: true, data: sessions });
|
|
1255
1324
|
});
|
|
1256
|
-
|
|
1325
|
+
app5.get("/sessions/:id", async (c) => {
|
|
1257
1326
|
const runtime = c.get("runtime");
|
|
1258
1327
|
const store = runtime.getStateStore();
|
|
1259
1328
|
const id = c.req.param("id");
|
|
@@ -1270,7 +1339,7 @@ function createSessionRoutes(connMgr) {
|
|
|
1270
1339
|
}
|
|
1271
1340
|
});
|
|
1272
1341
|
});
|
|
1273
|
-
|
|
1342
|
+
app5.post("/sessions/:id/send", async (c) => {
|
|
1274
1343
|
const runtime = c.get("runtime");
|
|
1275
1344
|
const id = c.req.param("id");
|
|
1276
1345
|
const body = await c.req.json();
|
|
@@ -1278,7 +1347,7 @@ function createSessionRoutes(connMgr) {
|
|
|
1278
1347
|
const result = await session.send(body.workflow, body.message);
|
|
1279
1348
|
return c.json({ ok: true, data: { result } });
|
|
1280
1349
|
});
|
|
1281
|
-
|
|
1350
|
+
app5.post("/sessions/:id/stream", async (c) => {
|
|
1282
1351
|
const runtime = c.get("runtime");
|
|
1283
1352
|
const id = c.req.param("id");
|
|
1284
1353
|
const body = await c.req.json();
|
|
@@ -1292,21 +1361,21 @@ function createSessionRoutes(connMgr) {
|
|
|
1292
1361
|
})();
|
|
1293
1362
|
return c.json({ ok: true, data: { executionId, streaming: true } });
|
|
1294
1363
|
});
|
|
1295
|
-
|
|
1364
|
+
app5.delete("/sessions/:id", async (c) => {
|
|
1296
1365
|
const runtime = c.get("runtime");
|
|
1297
1366
|
const store = runtime.getStateStore();
|
|
1298
1367
|
const id = c.req.param("id");
|
|
1299
1368
|
await store.deleteSession(id);
|
|
1300
1369
|
return c.json({ ok: true, data: { deleted: true } });
|
|
1301
1370
|
});
|
|
1302
|
-
return
|
|
1371
|
+
return app5;
|
|
1303
1372
|
}
|
|
1304
1373
|
|
|
1305
1374
|
// src/server/routes/agents.ts
|
|
1306
1375
|
var import_hono5 = require("hono");
|
|
1307
1376
|
var import_axl4 = require("@axlsdk/axl");
|
|
1308
|
-
var
|
|
1309
|
-
|
|
1377
|
+
var app = new import_hono5.Hono();
|
|
1378
|
+
app.get("/agents", (c) => {
|
|
1310
1379
|
const runtime = c.get("runtime");
|
|
1311
1380
|
const agents = runtime.getAgents().map((a) => ({
|
|
1312
1381
|
name: a._name,
|
|
@@ -1325,7 +1394,7 @@ app2.get("/agents", (c) => {
|
|
|
1325
1394
|
}));
|
|
1326
1395
|
return c.json({ ok: true, data: agents });
|
|
1327
1396
|
});
|
|
1328
|
-
|
|
1397
|
+
app.get("/agents/:name", (c) => {
|
|
1329
1398
|
const runtime = c.get("runtime");
|
|
1330
1399
|
const name = c.req.param("name");
|
|
1331
1400
|
const agent = runtime.getAgent(name);
|
|
@@ -1381,13 +1450,13 @@ app2.get("/agents/:name", (c) => {
|
|
|
1381
1450
|
}
|
|
1382
1451
|
});
|
|
1383
1452
|
});
|
|
1384
|
-
var agents_default =
|
|
1453
|
+
var agents_default = app;
|
|
1385
1454
|
|
|
1386
1455
|
// src/server/routes/tools.ts
|
|
1387
1456
|
var import_hono6 = require("hono");
|
|
1388
1457
|
var import_axl5 = require("@axlsdk/axl");
|
|
1389
|
-
var
|
|
1390
|
-
|
|
1458
|
+
var app2 = new import_hono6.Hono();
|
|
1459
|
+
app2.get("/tools", (c) => {
|
|
1391
1460
|
const runtime = c.get("runtime");
|
|
1392
1461
|
const tools = runtime.getTools().map((t) => ({
|
|
1393
1462
|
name: t.name,
|
|
@@ -1398,7 +1467,7 @@ app3.get("/tools", (c) => {
|
|
|
1398
1467
|
}));
|
|
1399
1468
|
return c.json({ ok: true, data: tools });
|
|
1400
1469
|
});
|
|
1401
|
-
|
|
1470
|
+
app2.get("/tools/:name", (c) => {
|
|
1402
1471
|
const runtime = c.get("runtime");
|
|
1403
1472
|
const name = c.req.param("name");
|
|
1404
1473
|
const tool = runtime.getTool(name);
|
|
@@ -1425,7 +1494,7 @@ app3.get("/tools/:name", (c) => {
|
|
|
1425
1494
|
}
|
|
1426
1495
|
});
|
|
1427
1496
|
});
|
|
1428
|
-
|
|
1497
|
+
app2.post("/tools/:name/test", async (c) => {
|
|
1429
1498
|
const runtime = c.get("runtime");
|
|
1430
1499
|
const name = c.req.param("name");
|
|
1431
1500
|
const tool = runtime.getTool(name);
|
|
@@ -1443,12 +1512,12 @@ app3.post("/tools/:name/test", async (c) => {
|
|
|
1443
1512
|
data: { result: redactValue(result, runtime.isRedactEnabled()) }
|
|
1444
1513
|
});
|
|
1445
1514
|
});
|
|
1446
|
-
var tools_default =
|
|
1515
|
+
var tools_default = app2;
|
|
1447
1516
|
|
|
1448
1517
|
// src/server/routes/memory.ts
|
|
1449
1518
|
var import_hono7 = require("hono");
|
|
1450
|
-
var
|
|
1451
|
-
|
|
1519
|
+
var app3 = new import_hono7.Hono();
|
|
1520
|
+
app3.get("/memory/:scope", async (c) => {
|
|
1452
1521
|
const runtime = c.get("runtime");
|
|
1453
1522
|
const store = runtime.getStateStore();
|
|
1454
1523
|
const scope = c.req.param("scope");
|
|
@@ -1458,7 +1527,7 @@ app4.get("/memory/:scope", async (c) => {
|
|
|
1458
1527
|
const entries = await store.getAllMemory(scope);
|
|
1459
1528
|
return c.json({ ok: true, data: redactMemoryList(entries, runtime.isRedactEnabled()) });
|
|
1460
1529
|
});
|
|
1461
|
-
|
|
1530
|
+
app3.get("/memory/:scope/:key", async (c) => {
|
|
1462
1531
|
const runtime = c.get("runtime");
|
|
1463
1532
|
const store = runtime.getStateStore();
|
|
1464
1533
|
const scope = c.req.param("scope");
|
|
@@ -1481,7 +1550,7 @@ app4.get("/memory/:scope/:key", async (c) => {
|
|
|
1481
1550
|
data: { key, value: redactMemoryValue(value, runtime.isRedactEnabled()) }
|
|
1482
1551
|
});
|
|
1483
1552
|
});
|
|
1484
|
-
|
|
1553
|
+
app3.put("/memory/:scope/:key", async (c) => {
|
|
1485
1554
|
const runtime = c.get("runtime");
|
|
1486
1555
|
const store = runtime.getStateStore();
|
|
1487
1556
|
const scope = c.req.param("scope");
|
|
@@ -1496,7 +1565,7 @@ app4.put("/memory/:scope/:key", async (c) => {
|
|
|
1496
1565
|
await store.saveMemory(scope, key, body.value);
|
|
1497
1566
|
return c.json({ ok: true, data: { saved: true } });
|
|
1498
1567
|
});
|
|
1499
|
-
|
|
1568
|
+
app3.delete("/memory/:scope/:key", async (c) => {
|
|
1500
1569
|
const runtime = c.get("runtime");
|
|
1501
1570
|
const store = runtime.getStateStore();
|
|
1502
1571
|
const scope = c.req.param("scope");
|
|
@@ -1510,18 +1579,18 @@ app4.delete("/memory/:scope/:key", async (c) => {
|
|
|
1510
1579
|
await store.deleteMemory(scope, key);
|
|
1511
1580
|
return c.json({ ok: true, data: { deleted: true } });
|
|
1512
1581
|
});
|
|
1513
|
-
|
|
1582
|
+
app3.post("/memory/search", async (c) => {
|
|
1514
1583
|
return c.json({
|
|
1515
1584
|
ok: true,
|
|
1516
1585
|
data: { results: [], message: "Semantic search requires MemoryManager with vector store" }
|
|
1517
1586
|
});
|
|
1518
1587
|
});
|
|
1519
|
-
var memory_default =
|
|
1588
|
+
var memory_default = app3;
|
|
1520
1589
|
|
|
1521
1590
|
// src/server/routes/decisions.ts
|
|
1522
1591
|
var import_hono8 = require("hono");
|
|
1523
|
-
var
|
|
1524
|
-
|
|
1592
|
+
var app4 = new import_hono8.Hono();
|
|
1593
|
+
app4.get("/decisions", async (c) => {
|
|
1525
1594
|
const runtime = c.get("runtime");
|
|
1526
1595
|
const decisions = await runtime.getPendingDecisions();
|
|
1527
1596
|
return c.json({
|
|
@@ -1529,27 +1598,27 @@ app5.get("/decisions", async (c) => {
|
|
|
1529
1598
|
data: redactPendingDecisionList(decisions, runtime.isRedactEnabled())
|
|
1530
1599
|
});
|
|
1531
1600
|
});
|
|
1532
|
-
|
|
1601
|
+
app4.post("/decisions/:executionId/resolve", async (c) => {
|
|
1533
1602
|
const runtime = c.get("runtime");
|
|
1534
1603
|
const executionId = c.req.param("executionId");
|
|
1535
1604
|
const body = await c.req.json();
|
|
1536
1605
|
await runtime.resolveDecision(executionId, body);
|
|
1537
1606
|
return c.json({ ok: true, data: { resolved: true } });
|
|
1538
1607
|
});
|
|
1539
|
-
var decisions_default =
|
|
1608
|
+
var decisions_default = app4;
|
|
1540
1609
|
|
|
1541
1610
|
// src/server/routes/costs.ts
|
|
1542
1611
|
var import_hono9 = require("hono");
|
|
1543
1612
|
function createCostRoutes(costAggregator) {
|
|
1544
|
-
const
|
|
1545
|
-
|
|
1613
|
+
const app5 = new import_hono9.Hono();
|
|
1614
|
+
app5.get("/costs", (c) => {
|
|
1546
1615
|
if (c.req.query("windows") === "all") {
|
|
1547
1616
|
return c.json({ ok: true, data: costAggregator.getAllSnapshots() });
|
|
1548
1617
|
}
|
|
1549
1618
|
const window = parseWindowParam(c.req.query("window"));
|
|
1550
1619
|
return c.json({ ok: true, data: costAggregator.getSnapshot(window) });
|
|
1551
1620
|
});
|
|
1552
|
-
|
|
1621
|
+
app5.post("/costs/reset", (c) => {
|
|
1553
1622
|
return c.json(
|
|
1554
1623
|
{
|
|
1555
1624
|
ok: false,
|
|
@@ -1561,22 +1630,22 @@ function createCostRoutes(costAggregator) {
|
|
|
1561
1630
|
410
|
|
1562
1631
|
);
|
|
1563
1632
|
});
|
|
1564
|
-
return
|
|
1633
|
+
return app5;
|
|
1565
1634
|
}
|
|
1566
1635
|
|
|
1567
1636
|
// src/server/routes/evals.ts
|
|
1568
1637
|
var import_node_crypto = require("crypto");
|
|
1569
1638
|
var import_hono10 = require("hono");
|
|
1570
1639
|
function createEvalRoutes(connMgr, evalLoader) {
|
|
1571
|
-
const
|
|
1640
|
+
const app5 = new import_hono10.Hono();
|
|
1572
1641
|
const activeRuns = /* @__PURE__ */ new Map();
|
|
1573
|
-
|
|
1642
|
+
app5.get("/evals", async (c) => {
|
|
1574
1643
|
if (evalLoader) await evalLoader();
|
|
1575
1644
|
const runtime = c.get("runtime");
|
|
1576
1645
|
const evals = runtime.getRegisteredEvals();
|
|
1577
1646
|
return c.json({ ok: true, data: evals });
|
|
1578
1647
|
});
|
|
1579
|
-
|
|
1648
|
+
app5.get("/evals/history", async (c) => {
|
|
1580
1649
|
const runtime = c.get("runtime");
|
|
1581
1650
|
const history = await runtime.getEvalHistory();
|
|
1582
1651
|
return c.json({
|
|
@@ -1584,7 +1653,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1584
1653
|
data: redactEvalHistoryList(history, runtime.isRedactEnabled())
|
|
1585
1654
|
});
|
|
1586
1655
|
});
|
|
1587
|
-
|
|
1656
|
+
app5.delete("/evals/history/:id", async (c) => {
|
|
1588
1657
|
const runtime = c.get("runtime");
|
|
1589
1658
|
const id = c.req.param("id");
|
|
1590
1659
|
const deleted = await runtime.deleteEvalResult(id);
|
|
@@ -1599,7 +1668,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1599
1668
|
}
|
|
1600
1669
|
return c.json({ ok: true, data: { id, deleted: true } });
|
|
1601
1670
|
});
|
|
1602
|
-
|
|
1671
|
+
app5.post("/evals/:name/run", async (c) => {
|
|
1603
1672
|
if (evalLoader) await evalLoader();
|
|
1604
1673
|
const runtime = c.get("runtime");
|
|
1605
1674
|
const name = c.req.param("name");
|
|
@@ -1797,7 +1866,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1797
1866
|
);
|
|
1798
1867
|
}
|
|
1799
1868
|
});
|
|
1800
|
-
|
|
1869
|
+
app5.post("/evals/runs/:evalRunId/cancel", (c) => {
|
|
1801
1870
|
const evalRunId = c.req.param("evalRunId");
|
|
1802
1871
|
const ac = activeRuns.get(evalRunId);
|
|
1803
1872
|
if (!ac) {
|
|
@@ -1810,7 +1879,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1810
1879
|
activeRuns.delete(evalRunId);
|
|
1811
1880
|
return c.json({ ok: true, data: { cancelled: true } });
|
|
1812
1881
|
});
|
|
1813
|
-
|
|
1882
|
+
app5.post("/evals/:name/rescore", async (c) => {
|
|
1814
1883
|
if (evalLoader) await evalLoader();
|
|
1815
1884
|
const runtime = c.get("runtime");
|
|
1816
1885
|
const redactOn = runtime.isRedactEnabled();
|
|
@@ -1862,7 +1931,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1862
1931
|
);
|
|
1863
1932
|
}
|
|
1864
1933
|
});
|
|
1865
|
-
|
|
1934
|
+
app5.post("/evals/compare", async (c) => {
|
|
1866
1935
|
const runtime = c.get("runtime");
|
|
1867
1936
|
const redactOn = runtime.isRedactEnabled();
|
|
1868
1937
|
const body = await c.req.json();
|
|
@@ -1945,7 +2014,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1945
2014
|
);
|
|
1946
2015
|
}
|
|
1947
2016
|
});
|
|
1948
|
-
|
|
2017
|
+
app5.post("/evals/import", async (c) => {
|
|
1949
2018
|
const runtime = c.get("runtime");
|
|
1950
2019
|
const body = await c.req.json();
|
|
1951
2020
|
const bad = (message) => c.json({ ok: false, error: { code: "BAD_REQUEST", message } }, 400);
|
|
@@ -2023,7 +2092,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
2023
2092
|
for (const ac of activeRuns.values()) ac.abort();
|
|
2024
2093
|
activeRuns.clear();
|
|
2025
2094
|
}
|
|
2026
|
-
return { app:
|
|
2095
|
+
return { app: app5, closeActiveRuns };
|
|
2027
2096
|
}
|
|
2028
2097
|
|
|
2029
2098
|
// src/server/routes/playground.ts
|
|
@@ -15807,8 +15876,8 @@ var DEMO_SCHEMA_BY_AGENT = {
|
|
|
15807
15876
|
})
|
|
15808
15877
|
};
|
|
15809
15878
|
function createPlaygroundRoutes(connMgr) {
|
|
15810
|
-
const
|
|
15811
|
-
|
|
15879
|
+
const app5 = new import_hono11.Hono();
|
|
15880
|
+
app5.post("/playground/chat", async (c) => {
|
|
15812
15881
|
const runtime = c.get("runtime");
|
|
15813
15882
|
const body = await c.req.json();
|
|
15814
15883
|
if (!body.message || typeof body.message !== "string" || !body.message.trim()) {
|
|
@@ -15888,46 +15957,46 @@ function createPlaygroundRoutes(connMgr) {
|
|
|
15888
15957
|
data: { sessionId, executionId, streaming: true }
|
|
15889
15958
|
});
|
|
15890
15959
|
});
|
|
15891
|
-
return
|
|
15960
|
+
return app5;
|
|
15892
15961
|
}
|
|
15893
15962
|
|
|
15894
15963
|
// src/server/routes/eval-trends.ts
|
|
15895
15964
|
var import_hono12 = require("hono");
|
|
15896
15965
|
function createEvalTrendsRoutes(aggregator) {
|
|
15897
|
-
const
|
|
15898
|
-
|
|
15966
|
+
const app5 = new import_hono12.Hono();
|
|
15967
|
+
app5.get("/eval-trends", (c) => {
|
|
15899
15968
|
const window = parseWindowParam(c.req.query("window"));
|
|
15900
15969
|
return c.json({ ok: true, data: aggregator.getSnapshot(window) });
|
|
15901
15970
|
});
|
|
15902
|
-
return
|
|
15971
|
+
return app5;
|
|
15903
15972
|
}
|
|
15904
15973
|
|
|
15905
15974
|
// src/server/routes/workflow-stats.ts
|
|
15906
15975
|
var import_hono13 = require("hono");
|
|
15907
15976
|
function createWorkflowStatsRoutes(aggregator) {
|
|
15908
|
-
const
|
|
15909
|
-
|
|
15977
|
+
const app5 = new import_hono13.Hono();
|
|
15978
|
+
app5.get("/workflow-stats", (c) => {
|
|
15910
15979
|
const window = parseWindowParam(c.req.query("window"));
|
|
15911
15980
|
return c.json({ ok: true, data: enrichWorkflowStats(aggregator.getSnapshot(window)) });
|
|
15912
15981
|
});
|
|
15913
|
-
return
|
|
15982
|
+
return app5;
|
|
15914
15983
|
}
|
|
15915
15984
|
|
|
15916
15985
|
// src/server/routes/trace-stats.ts
|
|
15917
15986
|
var import_hono14 = require("hono");
|
|
15918
15987
|
function createTraceStatsRoutes(aggregator) {
|
|
15919
|
-
const
|
|
15920
|
-
|
|
15988
|
+
const app5 = new import_hono14.Hono();
|
|
15989
|
+
app5.get("/trace-stats", (c) => {
|
|
15921
15990
|
const window = parseWindowParam(c.req.query("window"));
|
|
15922
15991
|
return c.json({ ok: true, data: aggregator.getSnapshot(window) });
|
|
15923
15992
|
});
|
|
15924
|
-
return
|
|
15993
|
+
return app5;
|
|
15925
15994
|
}
|
|
15926
15995
|
|
|
15927
15996
|
// src/server/index.ts
|
|
15928
15997
|
function createServer(options) {
|
|
15929
15998
|
const { runtime, staticRoot, basePath = "", readOnly = false } = options;
|
|
15930
|
-
const
|
|
15999
|
+
const app5 = new import_hono15.Hono();
|
|
15931
16000
|
const connMgr = new ConnectionManager(options.bufferCaps);
|
|
15932
16001
|
const windows = ["24h", "7d", "30d", "all"];
|
|
15933
16002
|
const costAggregator = new TraceAggregator({
|
|
@@ -15964,10 +16033,10 @@ function createServer(options) {
|
|
|
15964
16033
|
windows
|
|
15965
16034
|
});
|
|
15966
16035
|
if (options.cors !== false) {
|
|
15967
|
-
|
|
16036
|
+
app5.use("*", (0, import_cors.cors)());
|
|
15968
16037
|
}
|
|
15969
|
-
|
|
15970
|
-
|
|
16038
|
+
app5.use("*", errorHandler);
|
|
16039
|
+
app5.use("*", async (c, next) => {
|
|
15971
16040
|
c.set("runtime", runtime);
|
|
15972
16041
|
await next();
|
|
15973
16042
|
});
|
|
@@ -15975,6 +16044,7 @@ function createServer(options) {
|
|
|
15975
16044
|
const blocked = [
|
|
15976
16045
|
/^POST \/api\/workflows(\/|$)/,
|
|
15977
16046
|
/^POST \/api\/executions(\/|$)/,
|
|
16047
|
+
/^DELETE \/api\/executions\/[^/]+$/,
|
|
15978
16048
|
/^POST \/api\/sessions(\/|$)/,
|
|
15979
16049
|
/^DELETE \/api\/sessions(\/|$)/,
|
|
15980
16050
|
/^PUT \/api\/memory(\/|$)/,
|
|
@@ -15988,7 +16058,7 @@ function createServer(options) {
|
|
|
15988
16058
|
/^DELETE \/api\/evals\/history\/[^/]+$/,
|
|
15989
16059
|
/^POST \/api\/playground(\/|$)/
|
|
15990
16060
|
];
|
|
15991
|
-
|
|
16061
|
+
app5.use("/api/*", async (c, next) => {
|
|
15992
16062
|
const apiIdx = c.req.path.indexOf("/api/");
|
|
15993
16063
|
const apiPath = apiIdx >= 0 ? c.req.path.slice(apiIdx) : c.req.path;
|
|
15994
16064
|
const key = `${c.req.method} ${apiPath}`;
|
|
@@ -16007,7 +16077,7 @@ function createServer(options) {
|
|
|
16007
16077
|
const api = new import_hono15.Hono();
|
|
16008
16078
|
api.route("/", createHealthRoutes(readOnly));
|
|
16009
16079
|
api.route("/", createWorkflowRoutes(connMgr));
|
|
16010
|
-
api.route("/",
|
|
16080
|
+
api.route("/", createExecutionRoutes(connMgr));
|
|
16011
16081
|
api.route("/", createSessionRoutes(connMgr));
|
|
16012
16082
|
api.route("/", agents_default);
|
|
16013
16083
|
api.route("/", tools_default);
|
|
@@ -16020,7 +16090,7 @@ function createServer(options) {
|
|
|
16020
16090
|
const { app: evalApp, closeActiveRuns } = createEvalRoutes(connMgr, options.evalLoader);
|
|
16021
16091
|
api.route("/", evalApp);
|
|
16022
16092
|
api.route("/", createPlaygroundRoutes(connMgr));
|
|
16023
|
-
|
|
16093
|
+
app5.route("/api", api);
|
|
16024
16094
|
const traceListener = (event) => {
|
|
16025
16095
|
try {
|
|
16026
16096
|
const traceEvent = event;
|
|
@@ -16074,7 +16144,7 @@ function createServer(options) {
|
|
|
16074
16144
|
root: staticRoot,
|
|
16075
16145
|
rewriteRequestPath: basePath ? (path) => path.startsWith(basePath) ? path.slice(basePath.length) || "/" : path : void 0
|
|
16076
16146
|
});
|
|
16077
|
-
|
|
16147
|
+
app5.use("/*", async (c, next) => {
|
|
16078
16148
|
const reqPath = c.req.path;
|
|
16079
16149
|
const resolved = basePath && reqPath.startsWith(basePath) ? reqPath.slice(basePath.length) || "/" : reqPath;
|
|
16080
16150
|
if (resolved === "/" || resolved === "/index.html" || resolved === "/ws") {
|
|
@@ -16083,7 +16153,7 @@ function createServer(options) {
|
|
|
16083
16153
|
return staticHandler(c, next);
|
|
16084
16154
|
});
|
|
16085
16155
|
if (spaHtml) {
|
|
16086
|
-
|
|
16156
|
+
app5.get("*", async (c, next) => {
|
|
16087
16157
|
const resolved = basePath && c.req.path.startsWith(basePath) ? c.req.path.slice(basePath.length) || "/" : c.req.path;
|
|
16088
16158
|
if (resolved === "/ws") return next();
|
|
16089
16159
|
return c.html(spaHtml);
|
|
@@ -16091,7 +16161,7 @@ function createServer(options) {
|
|
|
16091
16161
|
}
|
|
16092
16162
|
}
|
|
16093
16163
|
return {
|
|
16094
|
-
app:
|
|
16164
|
+
app: app5,
|
|
16095
16165
|
connMgr,
|
|
16096
16166
|
costAggregator,
|
|
16097
16167
|
workflowStatsAggregator,
|
|
@@ -16250,7 +16320,7 @@ function createStudioMiddleware(options) {
|
|
|
16250
16320
|
);
|
|
16251
16321
|
}
|
|
16252
16322
|
const evalLoader = options.evals ? createEvalLoader(options.evals, runtime) : void 0;
|
|
16253
|
-
const { app:
|
|
16323
|
+
const { app: app5, connMgr, traceListener, closeActiveRuns, closeAggregators } = createServer({
|
|
16254
16324
|
runtime,
|
|
16255
16325
|
staticRoot,
|
|
16256
16326
|
basePath,
|
|
@@ -16268,7 +16338,7 @@ function createStudioMiddleware(options) {
|
|
|
16268
16338
|
"[axl-studio] WARNING: Studio middleware mounted in production without verifyUpgrade. WebSocket connections are not authenticated. All registered workflows, tools, and agents are accessible. See https://axlsdk.com/docs/studio/security"
|
|
16269
16339
|
);
|
|
16270
16340
|
}
|
|
16271
|
-
const listener = (0, import_node_server.getRequestListener)(
|
|
16341
|
+
const listener = (0, import_node_server.getRequestListener)(app5.fetch, {
|
|
16272
16342
|
overrideGlobalObjects: false
|
|
16273
16343
|
});
|
|
16274
16344
|
let closed = false;
|
|
@@ -16393,7 +16463,7 @@ function createStudioMiddleware(options) {
|
|
|
16393
16463
|
handler,
|
|
16394
16464
|
handleWebSocket,
|
|
16395
16465
|
upgradeWebSocket,
|
|
16396
|
-
app:
|
|
16466
|
+
app: app5,
|
|
16397
16467
|
connectionManager: connMgr,
|
|
16398
16468
|
close
|
|
16399
16469
|
};
|