@axlsdk/studio 0.17.5 → 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/cli.cjs
CHANGED
|
@@ -67,6 +67,14 @@ function redactExecutionInfo(info, redact) {
|
|
|
67
67
|
...info,
|
|
68
68
|
...info.result !== void 0 ? { result: REDACTED } : {},
|
|
69
69
|
...info.error !== void 0 ? { error: REDACTED } : {},
|
|
70
|
+
// `metadata` carries operator-supplied tags (userId/tenantId/correlation
|
|
71
|
+
// ids per the docs) — exactly the surface trace.redact is supposed to
|
|
72
|
+
// protect. Without this scrub, REST consumers see the metadata bag
|
|
73
|
+
// even when redaction is enabled, while events[*].data.* is properly
|
|
74
|
+
// scrubbed. Use a `{ redacted: true }` marker to keep the field
|
|
75
|
+
// queryable/serializable rather than dropping it (mirrors
|
|
76
|
+
// `redactPendingDecision` on `decision.metadata`).
|
|
77
|
+
...info.metadata !== void 0 ? { metadata: { redacted: true } } : {},
|
|
70
78
|
events: info.events.map((e) => redactStreamEvent(e, true))
|
|
71
79
|
};
|
|
72
80
|
}
|
|
@@ -317,6 +325,24 @@ var ConnectionManager = class {
|
|
|
317
325
|
}
|
|
318
326
|
}
|
|
319
327
|
}
|
|
328
|
+
/** Drop the replay buffer for a channel immediately (cancels any pending
|
|
329
|
+
* TTL timer). Used by the executions DELETE route to scrub buffered
|
|
330
|
+
* events when an operator runs a GDPR delete — otherwise events for the
|
|
331
|
+
* deleted execution remain replayable to late subscribers for up to
|
|
332
|
+
* `BUFFER_TTL_MS` after stream completion. No-op when no buffer exists.
|
|
333
|
+
*/
|
|
334
|
+
clearChannelBuffer(channel) {
|
|
335
|
+
const buffer = this.buffers.get(channel);
|
|
336
|
+
if (!buffer) return;
|
|
337
|
+
if (buffer.timer) clearTimeout(buffer.timer);
|
|
338
|
+
this.buffers.delete(channel);
|
|
339
|
+
}
|
|
340
|
+
/** @internal Inspection hook for tests — returns whether a replay buffer
|
|
341
|
+
* currently exists for `channel`. Not part of the public API; embedders
|
|
342
|
+
* should not rely on it. */
|
|
343
|
+
_hasReplayBuffer(channel) {
|
|
344
|
+
return this.buffers.has(channel);
|
|
345
|
+
}
|
|
320
346
|
/** Unsubscribe a connection from a channel. */
|
|
321
347
|
unsubscribe(ws, channel) {
|
|
322
348
|
this.channels.get(channel)?.delete(ws);
|
|
@@ -575,6 +601,7 @@ var TraceAggregator = class {
|
|
|
575
601
|
snaps;
|
|
576
602
|
interval;
|
|
577
603
|
listener;
|
|
604
|
+
deleteListener;
|
|
578
605
|
options;
|
|
579
606
|
constructor(options) {
|
|
580
607
|
this.options = options;
|
|
@@ -592,6 +619,12 @@ var TraceAggregator = class {
|
|
|
592
619
|
this.snaps.fold(event.timestamp, (prev) => this.options.reducer(prev, event));
|
|
593
620
|
};
|
|
594
621
|
this.options.runtime.on("trace", this.listener);
|
|
622
|
+
this.deleteListener = () => {
|
|
623
|
+
this.rebuild().catch(
|
|
624
|
+
(err) => console.error("[axl-studio] rebuild on execution_deleted failed:", err)
|
|
625
|
+
);
|
|
626
|
+
};
|
|
627
|
+
this.options.runtime.on("execution_deleted", this.deleteListener);
|
|
595
628
|
this.interval = setInterval(
|
|
596
629
|
() => this.rebuild().catch((err) => console.error("[axl-studio] rebuild failed:", err)),
|
|
597
630
|
REBUILD_INTERVAL_MS
|
|
@@ -624,6 +657,7 @@ var TraceAggregator = class {
|
|
|
624
657
|
}
|
|
625
658
|
close() {
|
|
626
659
|
if (this.listener) this.options.runtime.off("trace", this.listener);
|
|
660
|
+
if (this.deleteListener) this.options.runtime.off("execution_deleted", this.deleteListener);
|
|
627
661
|
if (this.interval) clearInterval(this.interval);
|
|
628
662
|
}
|
|
629
663
|
};
|
|
@@ -633,6 +667,7 @@ var ExecutionAggregator = class {
|
|
|
633
667
|
snaps;
|
|
634
668
|
interval;
|
|
635
669
|
listener;
|
|
670
|
+
deleteListener;
|
|
636
671
|
options;
|
|
637
672
|
/** Generation counter to prevent stale async fold after rebuild. */
|
|
638
673
|
generation = 0;
|
|
@@ -659,6 +694,12 @@ var ExecutionAggregator = class {
|
|
|
659
694
|
}).catch((err) => console.error("[axl-studio] execution fold failed:", err));
|
|
660
695
|
};
|
|
661
696
|
this.options.runtime.on("trace", this.listener);
|
|
697
|
+
this.deleteListener = () => {
|
|
698
|
+
this.rebuild().catch(
|
|
699
|
+
(err) => console.error("[axl-studio] rebuild on execution_deleted failed:", err)
|
|
700
|
+
);
|
|
701
|
+
};
|
|
702
|
+
this.options.runtime.on("execution_deleted", this.deleteListener);
|
|
662
703
|
this.interval = setInterval(
|
|
663
704
|
() => this.rebuild().catch((err) => console.error("[axl-studio] rebuild failed:", err)),
|
|
664
705
|
REBUILD_INTERVAL_MS
|
|
@@ -690,6 +731,7 @@ var ExecutionAggregator = class {
|
|
|
690
731
|
}
|
|
691
732
|
close() {
|
|
692
733
|
if (this.listener) this.options.runtime.off("trace", this.listener);
|
|
734
|
+
if (this.deleteListener) this.options.runtime.off("execution_deleted", this.deleteListener);
|
|
693
735
|
if (this.interval) clearInterval(this.interval);
|
|
694
736
|
}
|
|
695
737
|
};
|
|
@@ -699,6 +741,7 @@ var EvalAggregator = class {
|
|
|
699
741
|
snaps;
|
|
700
742
|
interval;
|
|
701
743
|
listener;
|
|
744
|
+
deleteListener;
|
|
702
745
|
options;
|
|
703
746
|
constructor(options) {
|
|
704
747
|
this.options = options;
|
|
@@ -716,6 +759,12 @@ var EvalAggregator = class {
|
|
|
716
759
|
this.snaps.fold(entry.timestamp, (prev) => this.options.reducer(prev, entry));
|
|
717
760
|
};
|
|
718
761
|
this.options.runtime.on("eval_result", this.listener);
|
|
762
|
+
this.deleteListener = () => {
|
|
763
|
+
this.rebuild().catch(
|
|
764
|
+
(err) => console.error("[axl-studio] rebuild on eval_deleted failed:", err)
|
|
765
|
+
);
|
|
766
|
+
};
|
|
767
|
+
this.options.runtime.on("eval_deleted", this.deleteListener);
|
|
719
768
|
this.interval = setInterval(
|
|
720
769
|
() => this.rebuild().catch((err) => console.error("[axl-studio] rebuild failed:", err)),
|
|
721
770
|
REBUILD_INTERVAL_MS
|
|
@@ -746,6 +795,7 @@ var EvalAggregator = class {
|
|
|
746
795
|
}
|
|
747
796
|
close() {
|
|
748
797
|
if (this.listener) this.options.runtime.off("eval_result", this.listener);
|
|
798
|
+
if (this.deleteListener) this.options.runtime.off("eval_deleted", this.deleteListener);
|
|
749
799
|
if (this.interval) clearInterval(this.interval);
|
|
750
800
|
}
|
|
751
801
|
};
|
|
@@ -1088,8 +1138,8 @@ function reduceTraceStats(acc, event) {
|
|
|
1088
1138
|
// src/server/routes/health.ts
|
|
1089
1139
|
var import_hono = require("hono");
|
|
1090
1140
|
function createHealthRoutes(readOnly) {
|
|
1091
|
-
const
|
|
1092
|
-
|
|
1141
|
+
const app5 = new import_hono.Hono();
|
|
1142
|
+
app5.get("/health", (c) => {
|
|
1093
1143
|
const runtime = c.get("runtime");
|
|
1094
1144
|
return c.json({
|
|
1095
1145
|
ok: true,
|
|
@@ -1102,15 +1152,15 @@ function createHealthRoutes(readOnly) {
|
|
|
1102
1152
|
}
|
|
1103
1153
|
});
|
|
1104
1154
|
});
|
|
1105
|
-
return
|
|
1155
|
+
return app5;
|
|
1106
1156
|
}
|
|
1107
1157
|
|
|
1108
1158
|
// src/server/routes/workflows.ts
|
|
1109
1159
|
var import_hono2 = require("hono");
|
|
1110
1160
|
var import_axl3 = require("@axlsdk/axl");
|
|
1111
1161
|
function createWorkflowRoutes(connMgr) {
|
|
1112
|
-
const
|
|
1113
|
-
|
|
1162
|
+
const app5 = new import_hono2.Hono();
|
|
1163
|
+
app5.get("/workflows", (c) => {
|
|
1114
1164
|
const runtime = c.get("runtime");
|
|
1115
1165
|
const workflows = runtime.getWorkflows().map((w) => ({
|
|
1116
1166
|
name: w.name,
|
|
@@ -1119,7 +1169,7 @@ function createWorkflowRoutes(connMgr) {
|
|
|
1119
1169
|
}));
|
|
1120
1170
|
return c.json({ ok: true, data: workflows });
|
|
1121
1171
|
});
|
|
1122
|
-
|
|
1172
|
+
app5.get("/workflows/:name", (c) => {
|
|
1123
1173
|
const runtime = c.get("runtime");
|
|
1124
1174
|
const name = c.req.param("name");
|
|
1125
1175
|
const workflow = runtime.getWorkflow(name);
|
|
@@ -1138,7 +1188,7 @@ function createWorkflowRoutes(connMgr) {
|
|
|
1138
1188
|
}
|
|
1139
1189
|
});
|
|
1140
1190
|
});
|
|
1141
|
-
|
|
1191
|
+
app5.post("/workflows/:name/execute", async (c) => {
|
|
1142
1192
|
const runtime = c.get("runtime");
|
|
1143
1193
|
const name = c.req.param("name");
|
|
1144
1194
|
const workflow = runtime.getWorkflow(name);
|
|
@@ -1169,70 +1219,89 @@ function createWorkflowRoutes(connMgr) {
|
|
|
1169
1219
|
data: { result: redactValue(result, runtime.isRedactEnabled()) }
|
|
1170
1220
|
});
|
|
1171
1221
|
});
|
|
1172
|
-
return
|
|
1222
|
+
return app5;
|
|
1173
1223
|
}
|
|
1174
1224
|
|
|
1175
1225
|
// src/server/routes/executions.ts
|
|
1176
1226
|
var import_hono3 = require("hono");
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1227
|
+
function createExecutionRoutes(connMgr) {
|
|
1228
|
+
const app5 = new import_hono3.Hono();
|
|
1229
|
+
app5.get("/executions", async (c) => {
|
|
1230
|
+
const runtime = c.get("runtime");
|
|
1231
|
+
const executions = await runtime.getExecutions();
|
|
1232
|
+
return c.json({
|
|
1233
|
+
ok: true,
|
|
1234
|
+
data: redactExecutionList(executions, runtime.isRedactEnabled())
|
|
1235
|
+
});
|
|
1184
1236
|
});
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1237
|
+
app5.get("/executions/:id", async (c) => {
|
|
1238
|
+
const runtime = c.get("runtime");
|
|
1239
|
+
const id = c.req.param("id");
|
|
1240
|
+
const execution = await runtime.getExecution(id);
|
|
1241
|
+
if (!execution) {
|
|
1242
|
+
return c.json(
|
|
1243
|
+
{ ok: false, error: { code: "NOT_FOUND", message: `Execution "${id}" not found` } },
|
|
1244
|
+
404
|
|
1245
|
+
);
|
|
1246
|
+
}
|
|
1247
|
+
const sinceParam = c.req.query("since");
|
|
1248
|
+
let paged = execution;
|
|
1249
|
+
if (sinceParam !== void 0) {
|
|
1250
|
+
const since = Number(sinceParam);
|
|
1251
|
+
if (!Number.isFinite(since) || !Number.isInteger(since)) {
|
|
1252
|
+
return c.json(
|
|
1253
|
+
{
|
|
1254
|
+
ok: false,
|
|
1255
|
+
error: {
|
|
1256
|
+
code: "INVALID_PARAM",
|
|
1257
|
+
message: `\`since\` must be a finite integer (got "${sinceParam}")`,
|
|
1258
|
+
param: "since"
|
|
1259
|
+
}
|
|
1260
|
+
},
|
|
1261
|
+
400
|
|
1262
|
+
);
|
|
1263
|
+
}
|
|
1264
|
+
paged = {
|
|
1265
|
+
...execution,
|
|
1266
|
+
events: execution.events.filter((e) => e.step > since)
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
return c.json({
|
|
1270
|
+
ok: true,
|
|
1271
|
+
data: redactExecutionInfo(paged, runtime.isRedactEnabled())
|
|
1272
|
+
});
|
|
1273
|
+
});
|
|
1274
|
+
app5.post("/executions/:id/abort", (c) => {
|
|
1275
|
+
const runtime = c.get("runtime");
|
|
1276
|
+
const id = c.req.param("id");
|
|
1277
|
+
runtime.abort(id);
|
|
1278
|
+
return c.json({ ok: true, data: { aborted: true } });
|
|
1279
|
+
});
|
|
1280
|
+
app5.delete("/executions/:id", async (c) => {
|
|
1281
|
+
const runtime = c.get("runtime");
|
|
1282
|
+
const id = c.req.param("id");
|
|
1283
|
+
const deleted = await runtime.deleteExecution(id);
|
|
1284
|
+
if (!deleted) {
|
|
1201
1285
|
return c.json(
|
|
1202
1286
|
{
|
|
1203
1287
|
ok: false,
|
|
1204
|
-
error: {
|
|
1205
|
-
code: "INVALID_PARAM",
|
|
1206
|
-
message: `\`since\` must be a finite integer (got "${sinceParam}")`,
|
|
1207
|
-
param: "since"
|
|
1208
|
-
}
|
|
1288
|
+
error: { code: "NOT_FOUND", message: `Execution "${id}" not found` }
|
|
1209
1289
|
},
|
|
1210
|
-
|
|
1290
|
+
404
|
|
1211
1291
|
);
|
|
1212
1292
|
}
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
events: execution.events.filter((e) => e.step > since)
|
|
1216
|
-
};
|
|
1217
|
-
}
|
|
1218
|
-
return c.json({
|
|
1219
|
-
ok: true,
|
|
1220
|
-
data: redactExecutionInfo(paged, runtime.isRedactEnabled())
|
|
1293
|
+
connMgr?.clearChannelBuffer(`execution:${id}`);
|
|
1294
|
+
return c.json({ ok: true, data: { id, deleted: true } });
|
|
1221
1295
|
});
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
const id = c.req.param("id");
|
|
1226
|
-
runtime.abort(id);
|
|
1227
|
-
return c.json({ ok: true, data: { aborted: true } });
|
|
1228
|
-
});
|
|
1229
|
-
var executions_default = app;
|
|
1296
|
+
return app5;
|
|
1297
|
+
}
|
|
1298
|
+
var executions_default = createExecutionRoutes();
|
|
1230
1299
|
|
|
1231
1300
|
// src/server/routes/sessions.ts
|
|
1232
1301
|
var import_hono4 = require("hono");
|
|
1233
1302
|
function createSessionRoutes(connMgr) {
|
|
1234
|
-
const
|
|
1235
|
-
|
|
1303
|
+
const app5 = new import_hono4.Hono();
|
|
1304
|
+
app5.get("/sessions", async (c) => {
|
|
1236
1305
|
const runtime = c.get("runtime");
|
|
1237
1306
|
const store = runtime.getStateStore();
|
|
1238
1307
|
if (!store.listSessions) {
|
|
@@ -1246,7 +1315,7 @@ function createSessionRoutes(connMgr) {
|
|
|
1246
1315
|
}
|
|
1247
1316
|
return c.json({ ok: true, data: sessions });
|
|
1248
1317
|
});
|
|
1249
|
-
|
|
1318
|
+
app5.get("/sessions/:id", async (c) => {
|
|
1250
1319
|
const runtime = c.get("runtime");
|
|
1251
1320
|
const store = runtime.getStateStore();
|
|
1252
1321
|
const id = c.req.param("id");
|
|
@@ -1263,7 +1332,7 @@ function createSessionRoutes(connMgr) {
|
|
|
1263
1332
|
}
|
|
1264
1333
|
});
|
|
1265
1334
|
});
|
|
1266
|
-
|
|
1335
|
+
app5.post("/sessions/:id/send", async (c) => {
|
|
1267
1336
|
const runtime = c.get("runtime");
|
|
1268
1337
|
const id = c.req.param("id");
|
|
1269
1338
|
const body = await c.req.json();
|
|
@@ -1271,7 +1340,7 @@ function createSessionRoutes(connMgr) {
|
|
|
1271
1340
|
const result = await session.send(body.workflow, body.message);
|
|
1272
1341
|
return c.json({ ok: true, data: { result } });
|
|
1273
1342
|
});
|
|
1274
|
-
|
|
1343
|
+
app5.post("/sessions/:id/stream", async (c) => {
|
|
1275
1344
|
const runtime = c.get("runtime");
|
|
1276
1345
|
const id = c.req.param("id");
|
|
1277
1346
|
const body = await c.req.json();
|
|
@@ -1285,21 +1354,21 @@ function createSessionRoutes(connMgr) {
|
|
|
1285
1354
|
})();
|
|
1286
1355
|
return c.json({ ok: true, data: { executionId, streaming: true } });
|
|
1287
1356
|
});
|
|
1288
|
-
|
|
1357
|
+
app5.delete("/sessions/:id", async (c) => {
|
|
1289
1358
|
const runtime = c.get("runtime");
|
|
1290
1359
|
const store = runtime.getStateStore();
|
|
1291
1360
|
const id = c.req.param("id");
|
|
1292
1361
|
await store.deleteSession(id);
|
|
1293
1362
|
return c.json({ ok: true, data: { deleted: true } });
|
|
1294
1363
|
});
|
|
1295
|
-
return
|
|
1364
|
+
return app5;
|
|
1296
1365
|
}
|
|
1297
1366
|
|
|
1298
1367
|
// src/server/routes/agents.ts
|
|
1299
1368
|
var import_hono5 = require("hono");
|
|
1300
1369
|
var import_axl4 = require("@axlsdk/axl");
|
|
1301
|
-
var
|
|
1302
|
-
|
|
1370
|
+
var app = new import_hono5.Hono();
|
|
1371
|
+
app.get("/agents", (c) => {
|
|
1303
1372
|
const runtime = c.get("runtime");
|
|
1304
1373
|
const agents = runtime.getAgents().map((a) => ({
|
|
1305
1374
|
name: a._name,
|
|
@@ -1318,7 +1387,7 @@ app2.get("/agents", (c) => {
|
|
|
1318
1387
|
}));
|
|
1319
1388
|
return c.json({ ok: true, data: agents });
|
|
1320
1389
|
});
|
|
1321
|
-
|
|
1390
|
+
app.get("/agents/:name", (c) => {
|
|
1322
1391
|
const runtime = c.get("runtime");
|
|
1323
1392
|
const name = c.req.param("name");
|
|
1324
1393
|
const agent = runtime.getAgent(name);
|
|
@@ -1374,13 +1443,13 @@ app2.get("/agents/:name", (c) => {
|
|
|
1374
1443
|
}
|
|
1375
1444
|
});
|
|
1376
1445
|
});
|
|
1377
|
-
var agents_default =
|
|
1446
|
+
var agents_default = app;
|
|
1378
1447
|
|
|
1379
1448
|
// src/server/routes/tools.ts
|
|
1380
1449
|
var import_hono6 = require("hono");
|
|
1381
1450
|
var import_axl5 = require("@axlsdk/axl");
|
|
1382
|
-
var
|
|
1383
|
-
|
|
1451
|
+
var app2 = new import_hono6.Hono();
|
|
1452
|
+
app2.get("/tools", (c) => {
|
|
1384
1453
|
const runtime = c.get("runtime");
|
|
1385
1454
|
const tools = runtime.getTools().map((t) => ({
|
|
1386
1455
|
name: t.name,
|
|
@@ -1391,7 +1460,7 @@ app3.get("/tools", (c) => {
|
|
|
1391
1460
|
}));
|
|
1392
1461
|
return c.json({ ok: true, data: tools });
|
|
1393
1462
|
});
|
|
1394
|
-
|
|
1463
|
+
app2.get("/tools/:name", (c) => {
|
|
1395
1464
|
const runtime = c.get("runtime");
|
|
1396
1465
|
const name = c.req.param("name");
|
|
1397
1466
|
const tool = runtime.getTool(name);
|
|
@@ -1418,7 +1487,7 @@ app3.get("/tools/:name", (c) => {
|
|
|
1418
1487
|
}
|
|
1419
1488
|
});
|
|
1420
1489
|
});
|
|
1421
|
-
|
|
1490
|
+
app2.post("/tools/:name/test", async (c) => {
|
|
1422
1491
|
const runtime = c.get("runtime");
|
|
1423
1492
|
const name = c.req.param("name");
|
|
1424
1493
|
const tool = runtime.getTool(name);
|
|
@@ -1436,12 +1505,12 @@ app3.post("/tools/:name/test", async (c) => {
|
|
|
1436
1505
|
data: { result: redactValue(result, runtime.isRedactEnabled()) }
|
|
1437
1506
|
});
|
|
1438
1507
|
});
|
|
1439
|
-
var tools_default =
|
|
1508
|
+
var tools_default = app2;
|
|
1440
1509
|
|
|
1441
1510
|
// src/server/routes/memory.ts
|
|
1442
1511
|
var import_hono7 = require("hono");
|
|
1443
|
-
var
|
|
1444
|
-
|
|
1512
|
+
var app3 = new import_hono7.Hono();
|
|
1513
|
+
app3.get("/memory/:scope", async (c) => {
|
|
1445
1514
|
const runtime = c.get("runtime");
|
|
1446
1515
|
const store = runtime.getStateStore();
|
|
1447
1516
|
const scope = c.req.param("scope");
|
|
@@ -1451,7 +1520,7 @@ app4.get("/memory/:scope", async (c) => {
|
|
|
1451
1520
|
const entries = await store.getAllMemory(scope);
|
|
1452
1521
|
return c.json({ ok: true, data: redactMemoryList(entries, runtime.isRedactEnabled()) });
|
|
1453
1522
|
});
|
|
1454
|
-
|
|
1523
|
+
app3.get("/memory/:scope/:key", async (c) => {
|
|
1455
1524
|
const runtime = c.get("runtime");
|
|
1456
1525
|
const store = runtime.getStateStore();
|
|
1457
1526
|
const scope = c.req.param("scope");
|
|
@@ -1474,7 +1543,7 @@ app4.get("/memory/:scope/:key", async (c) => {
|
|
|
1474
1543
|
data: { key, value: redactMemoryValue(value, runtime.isRedactEnabled()) }
|
|
1475
1544
|
});
|
|
1476
1545
|
});
|
|
1477
|
-
|
|
1546
|
+
app3.put("/memory/:scope/:key", async (c) => {
|
|
1478
1547
|
const runtime = c.get("runtime");
|
|
1479
1548
|
const store = runtime.getStateStore();
|
|
1480
1549
|
const scope = c.req.param("scope");
|
|
@@ -1489,7 +1558,7 @@ app4.put("/memory/:scope/:key", async (c) => {
|
|
|
1489
1558
|
await store.saveMemory(scope, key, body.value);
|
|
1490
1559
|
return c.json({ ok: true, data: { saved: true } });
|
|
1491
1560
|
});
|
|
1492
|
-
|
|
1561
|
+
app3.delete("/memory/:scope/:key", async (c) => {
|
|
1493
1562
|
const runtime = c.get("runtime");
|
|
1494
1563
|
const store = runtime.getStateStore();
|
|
1495
1564
|
const scope = c.req.param("scope");
|
|
@@ -1503,18 +1572,18 @@ app4.delete("/memory/:scope/:key", async (c) => {
|
|
|
1503
1572
|
await store.deleteMemory(scope, key);
|
|
1504
1573
|
return c.json({ ok: true, data: { deleted: true } });
|
|
1505
1574
|
});
|
|
1506
|
-
|
|
1575
|
+
app3.post("/memory/search", async (c) => {
|
|
1507
1576
|
return c.json({
|
|
1508
1577
|
ok: true,
|
|
1509
1578
|
data: { results: [], message: "Semantic search requires MemoryManager with vector store" }
|
|
1510
1579
|
});
|
|
1511
1580
|
});
|
|
1512
|
-
var memory_default =
|
|
1581
|
+
var memory_default = app3;
|
|
1513
1582
|
|
|
1514
1583
|
// src/server/routes/decisions.ts
|
|
1515
1584
|
var import_hono8 = require("hono");
|
|
1516
|
-
var
|
|
1517
|
-
|
|
1585
|
+
var app4 = new import_hono8.Hono();
|
|
1586
|
+
app4.get("/decisions", async (c) => {
|
|
1518
1587
|
const runtime = c.get("runtime");
|
|
1519
1588
|
const decisions = await runtime.getPendingDecisions();
|
|
1520
1589
|
return c.json({
|
|
@@ -1522,27 +1591,27 @@ app5.get("/decisions", async (c) => {
|
|
|
1522
1591
|
data: redactPendingDecisionList(decisions, runtime.isRedactEnabled())
|
|
1523
1592
|
});
|
|
1524
1593
|
});
|
|
1525
|
-
|
|
1594
|
+
app4.post("/decisions/:executionId/resolve", async (c) => {
|
|
1526
1595
|
const runtime = c.get("runtime");
|
|
1527
1596
|
const executionId = c.req.param("executionId");
|
|
1528
1597
|
const body = await c.req.json();
|
|
1529
1598
|
await runtime.resolveDecision(executionId, body);
|
|
1530
1599
|
return c.json({ ok: true, data: { resolved: true } });
|
|
1531
1600
|
});
|
|
1532
|
-
var decisions_default =
|
|
1601
|
+
var decisions_default = app4;
|
|
1533
1602
|
|
|
1534
1603
|
// src/server/routes/costs.ts
|
|
1535
1604
|
var import_hono9 = require("hono");
|
|
1536
1605
|
function createCostRoutes(costAggregator) {
|
|
1537
|
-
const
|
|
1538
|
-
|
|
1606
|
+
const app5 = new import_hono9.Hono();
|
|
1607
|
+
app5.get("/costs", (c) => {
|
|
1539
1608
|
if (c.req.query("windows") === "all") {
|
|
1540
1609
|
return c.json({ ok: true, data: costAggregator.getAllSnapshots() });
|
|
1541
1610
|
}
|
|
1542
1611
|
const window = parseWindowParam(c.req.query("window"));
|
|
1543
1612
|
return c.json({ ok: true, data: costAggregator.getSnapshot(window) });
|
|
1544
1613
|
});
|
|
1545
|
-
|
|
1614
|
+
app5.post("/costs/reset", (c) => {
|
|
1546
1615
|
return c.json(
|
|
1547
1616
|
{
|
|
1548
1617
|
ok: false,
|
|
@@ -1554,22 +1623,22 @@ function createCostRoutes(costAggregator) {
|
|
|
1554
1623
|
410
|
|
1555
1624
|
);
|
|
1556
1625
|
});
|
|
1557
|
-
return
|
|
1626
|
+
return app5;
|
|
1558
1627
|
}
|
|
1559
1628
|
|
|
1560
1629
|
// src/server/routes/evals.ts
|
|
1561
1630
|
var import_node_crypto = require("crypto");
|
|
1562
1631
|
var import_hono10 = require("hono");
|
|
1563
1632
|
function createEvalRoutes(connMgr, evalLoader) {
|
|
1564
|
-
const
|
|
1633
|
+
const app5 = new import_hono10.Hono();
|
|
1565
1634
|
const activeRuns = /* @__PURE__ */ new Map();
|
|
1566
|
-
|
|
1635
|
+
app5.get("/evals", async (c) => {
|
|
1567
1636
|
if (evalLoader) await evalLoader();
|
|
1568
1637
|
const runtime = c.get("runtime");
|
|
1569
1638
|
const evals = runtime.getRegisteredEvals();
|
|
1570
1639
|
return c.json({ ok: true, data: evals });
|
|
1571
1640
|
});
|
|
1572
|
-
|
|
1641
|
+
app5.get("/evals/history", async (c) => {
|
|
1573
1642
|
const runtime = c.get("runtime");
|
|
1574
1643
|
const history = await runtime.getEvalHistory();
|
|
1575
1644
|
return c.json({
|
|
@@ -1577,7 +1646,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1577
1646
|
data: redactEvalHistoryList(history, runtime.isRedactEnabled())
|
|
1578
1647
|
});
|
|
1579
1648
|
});
|
|
1580
|
-
|
|
1649
|
+
app5.delete("/evals/history/:id", async (c) => {
|
|
1581
1650
|
const runtime = c.get("runtime");
|
|
1582
1651
|
const id = c.req.param("id");
|
|
1583
1652
|
const deleted = await runtime.deleteEvalResult(id);
|
|
@@ -1592,7 +1661,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1592
1661
|
}
|
|
1593
1662
|
return c.json({ ok: true, data: { id, deleted: true } });
|
|
1594
1663
|
});
|
|
1595
|
-
|
|
1664
|
+
app5.post("/evals/:name/run", async (c) => {
|
|
1596
1665
|
if (evalLoader) await evalLoader();
|
|
1597
1666
|
const runtime = c.get("runtime");
|
|
1598
1667
|
const name = c.req.param("name");
|
|
@@ -1790,7 +1859,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1790
1859
|
);
|
|
1791
1860
|
}
|
|
1792
1861
|
});
|
|
1793
|
-
|
|
1862
|
+
app5.post("/evals/runs/:evalRunId/cancel", (c) => {
|
|
1794
1863
|
const evalRunId = c.req.param("evalRunId");
|
|
1795
1864
|
const ac = activeRuns.get(evalRunId);
|
|
1796
1865
|
if (!ac) {
|
|
@@ -1803,7 +1872,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1803
1872
|
activeRuns.delete(evalRunId);
|
|
1804
1873
|
return c.json({ ok: true, data: { cancelled: true } });
|
|
1805
1874
|
});
|
|
1806
|
-
|
|
1875
|
+
app5.post("/evals/:name/rescore", async (c) => {
|
|
1807
1876
|
if (evalLoader) await evalLoader();
|
|
1808
1877
|
const runtime = c.get("runtime");
|
|
1809
1878
|
const redactOn = runtime.isRedactEnabled();
|
|
@@ -1855,7 +1924,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1855
1924
|
);
|
|
1856
1925
|
}
|
|
1857
1926
|
});
|
|
1858
|
-
|
|
1927
|
+
app5.post("/evals/compare", async (c) => {
|
|
1859
1928
|
const runtime = c.get("runtime");
|
|
1860
1929
|
const redactOn = runtime.isRedactEnabled();
|
|
1861
1930
|
const body = await c.req.json();
|
|
@@ -1938,7 +2007,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1938
2007
|
);
|
|
1939
2008
|
}
|
|
1940
2009
|
});
|
|
1941
|
-
|
|
2010
|
+
app5.post("/evals/import", async (c) => {
|
|
1942
2011
|
const runtime = c.get("runtime");
|
|
1943
2012
|
const body = await c.req.json();
|
|
1944
2013
|
const bad = (message) => c.json({ ok: false, error: { code: "BAD_REQUEST", message } }, 400);
|
|
@@ -2016,7 +2085,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
2016
2085
|
for (const ac of activeRuns.values()) ac.abort();
|
|
2017
2086
|
activeRuns.clear();
|
|
2018
2087
|
}
|
|
2019
|
-
return { app:
|
|
2088
|
+
return { app: app5, closeActiveRuns };
|
|
2020
2089
|
}
|
|
2021
2090
|
|
|
2022
2091
|
// src/server/routes/playground.ts
|
|
@@ -15800,8 +15869,8 @@ var DEMO_SCHEMA_BY_AGENT = {
|
|
|
15800
15869
|
})
|
|
15801
15870
|
};
|
|
15802
15871
|
function createPlaygroundRoutes(connMgr) {
|
|
15803
|
-
const
|
|
15804
|
-
|
|
15872
|
+
const app5 = new import_hono11.Hono();
|
|
15873
|
+
app5.post("/playground/chat", async (c) => {
|
|
15805
15874
|
const runtime = c.get("runtime");
|
|
15806
15875
|
const body = await c.req.json();
|
|
15807
15876
|
if (!body.message || typeof body.message !== "string" || !body.message.trim()) {
|
|
@@ -15881,46 +15950,46 @@ function createPlaygroundRoutes(connMgr) {
|
|
|
15881
15950
|
data: { sessionId, executionId, streaming: true }
|
|
15882
15951
|
});
|
|
15883
15952
|
});
|
|
15884
|
-
return
|
|
15953
|
+
return app5;
|
|
15885
15954
|
}
|
|
15886
15955
|
|
|
15887
15956
|
// src/server/routes/eval-trends.ts
|
|
15888
15957
|
var import_hono12 = require("hono");
|
|
15889
15958
|
function createEvalTrendsRoutes(aggregator) {
|
|
15890
|
-
const
|
|
15891
|
-
|
|
15959
|
+
const app5 = new import_hono12.Hono();
|
|
15960
|
+
app5.get("/eval-trends", (c) => {
|
|
15892
15961
|
const window = parseWindowParam(c.req.query("window"));
|
|
15893
15962
|
return c.json({ ok: true, data: aggregator.getSnapshot(window) });
|
|
15894
15963
|
});
|
|
15895
|
-
return
|
|
15964
|
+
return app5;
|
|
15896
15965
|
}
|
|
15897
15966
|
|
|
15898
15967
|
// src/server/routes/workflow-stats.ts
|
|
15899
15968
|
var import_hono13 = require("hono");
|
|
15900
15969
|
function createWorkflowStatsRoutes(aggregator) {
|
|
15901
|
-
const
|
|
15902
|
-
|
|
15970
|
+
const app5 = new import_hono13.Hono();
|
|
15971
|
+
app5.get("/workflow-stats", (c) => {
|
|
15903
15972
|
const window = parseWindowParam(c.req.query("window"));
|
|
15904
15973
|
return c.json({ ok: true, data: enrichWorkflowStats(aggregator.getSnapshot(window)) });
|
|
15905
15974
|
});
|
|
15906
|
-
return
|
|
15975
|
+
return app5;
|
|
15907
15976
|
}
|
|
15908
15977
|
|
|
15909
15978
|
// src/server/routes/trace-stats.ts
|
|
15910
15979
|
var import_hono14 = require("hono");
|
|
15911
15980
|
function createTraceStatsRoutes(aggregator) {
|
|
15912
|
-
const
|
|
15913
|
-
|
|
15981
|
+
const app5 = new import_hono14.Hono();
|
|
15982
|
+
app5.get("/trace-stats", (c) => {
|
|
15914
15983
|
const window = parseWindowParam(c.req.query("window"));
|
|
15915
15984
|
return c.json({ ok: true, data: aggregator.getSnapshot(window) });
|
|
15916
15985
|
});
|
|
15917
|
-
return
|
|
15986
|
+
return app5;
|
|
15918
15987
|
}
|
|
15919
15988
|
|
|
15920
15989
|
// src/server/index.ts
|
|
15921
15990
|
function createServer(options) {
|
|
15922
15991
|
const { runtime, staticRoot, basePath = "", readOnly = false } = options;
|
|
15923
|
-
const
|
|
15992
|
+
const app5 = new import_hono15.Hono();
|
|
15924
15993
|
const connMgr = new ConnectionManager(options.bufferCaps);
|
|
15925
15994
|
const windows = ["24h", "7d", "30d", "all"];
|
|
15926
15995
|
const costAggregator = new TraceAggregator({
|
|
@@ -15957,10 +16026,10 @@ function createServer(options) {
|
|
|
15957
16026
|
windows
|
|
15958
16027
|
});
|
|
15959
16028
|
if (options.cors !== false) {
|
|
15960
|
-
|
|
16029
|
+
app5.use("*", (0, import_cors.cors)());
|
|
15961
16030
|
}
|
|
15962
|
-
|
|
15963
|
-
|
|
16031
|
+
app5.use("*", errorHandler);
|
|
16032
|
+
app5.use("*", async (c, next) => {
|
|
15964
16033
|
c.set("runtime", runtime);
|
|
15965
16034
|
await next();
|
|
15966
16035
|
});
|
|
@@ -15968,6 +16037,7 @@ function createServer(options) {
|
|
|
15968
16037
|
const blocked = [
|
|
15969
16038
|
/^POST \/api\/workflows(\/|$)/,
|
|
15970
16039
|
/^POST \/api\/executions(\/|$)/,
|
|
16040
|
+
/^DELETE \/api\/executions\/[^/]+$/,
|
|
15971
16041
|
/^POST \/api\/sessions(\/|$)/,
|
|
15972
16042
|
/^DELETE \/api\/sessions(\/|$)/,
|
|
15973
16043
|
/^PUT \/api\/memory(\/|$)/,
|
|
@@ -15981,7 +16051,7 @@ function createServer(options) {
|
|
|
15981
16051
|
/^DELETE \/api\/evals\/history\/[^/]+$/,
|
|
15982
16052
|
/^POST \/api\/playground(\/|$)/
|
|
15983
16053
|
];
|
|
15984
|
-
|
|
16054
|
+
app5.use("/api/*", async (c, next) => {
|
|
15985
16055
|
const apiIdx = c.req.path.indexOf("/api/");
|
|
15986
16056
|
const apiPath = apiIdx >= 0 ? c.req.path.slice(apiIdx) : c.req.path;
|
|
15987
16057
|
const key = `${c.req.method} ${apiPath}`;
|
|
@@ -16000,7 +16070,7 @@ function createServer(options) {
|
|
|
16000
16070
|
const api = new import_hono15.Hono();
|
|
16001
16071
|
api.route("/", createHealthRoutes(readOnly));
|
|
16002
16072
|
api.route("/", createWorkflowRoutes(connMgr));
|
|
16003
|
-
api.route("/",
|
|
16073
|
+
api.route("/", createExecutionRoutes(connMgr));
|
|
16004
16074
|
api.route("/", createSessionRoutes(connMgr));
|
|
16005
16075
|
api.route("/", agents_default);
|
|
16006
16076
|
api.route("/", tools_default);
|
|
@@ -16013,7 +16083,7 @@ function createServer(options) {
|
|
|
16013
16083
|
const { app: evalApp, closeActiveRuns } = createEvalRoutes(connMgr, options.evalLoader);
|
|
16014
16084
|
api.route("/", evalApp);
|
|
16015
16085
|
api.route("/", createPlaygroundRoutes(connMgr));
|
|
16016
|
-
|
|
16086
|
+
app5.route("/api", api);
|
|
16017
16087
|
const traceListener = (event) => {
|
|
16018
16088
|
try {
|
|
16019
16089
|
const traceEvent = event;
|
|
@@ -16067,7 +16137,7 @@ function createServer(options) {
|
|
|
16067
16137
|
root: staticRoot,
|
|
16068
16138
|
rewriteRequestPath: basePath ? (path) => path.startsWith(basePath) ? path.slice(basePath.length) || "/" : path : void 0
|
|
16069
16139
|
});
|
|
16070
|
-
|
|
16140
|
+
app5.use("/*", async (c, next) => {
|
|
16071
16141
|
const reqPath = c.req.path;
|
|
16072
16142
|
const resolved = basePath && reqPath.startsWith(basePath) ? reqPath.slice(basePath.length) || "/" : reqPath;
|
|
16073
16143
|
if (resolved === "/" || resolved === "/index.html" || resolved === "/ws") {
|
|
@@ -16076,7 +16146,7 @@ function createServer(options) {
|
|
|
16076
16146
|
return staticHandler(c, next);
|
|
16077
16147
|
});
|
|
16078
16148
|
if (spaHtml) {
|
|
16079
|
-
|
|
16149
|
+
app5.get("*", async (c, next) => {
|
|
16080
16150
|
const resolved = basePath && c.req.path.startsWith(basePath) ? c.req.path.slice(basePath.length) || "/" : c.req.path;
|
|
16081
16151
|
if (resolved === "/ws") return next();
|
|
16082
16152
|
return c.html(spaHtml);
|
|
@@ -16084,7 +16154,7 @@ function createServer(options) {
|
|
|
16084
16154
|
}
|
|
16085
16155
|
}
|
|
16086
16156
|
return {
|
|
16087
|
-
app:
|
|
16157
|
+
app: app5,
|
|
16088
16158
|
connMgr,
|
|
16089
16159
|
costAggregator,
|
|
16090
16160
|
workflowStatsAggregator,
|
|
@@ -16246,7 +16316,7 @@ Tip: Use .mts for configs with top-level await or in projects without "type": "m
|
|
|
16246
16316
|
}
|
|
16247
16317
|
const staticRoot = (0, import_node_path2.resolve)(import_meta.dirname ?? __dirname, "client");
|
|
16248
16318
|
const hasStaticAssets = (0, import_node_fs2.existsSync)((0, import_node_path2.resolve)(staticRoot, "index.html"));
|
|
16249
|
-
const { app:
|
|
16319
|
+
const { app: app5, createWsHandlers: createWsHandlers2 } = createServer({
|
|
16250
16320
|
runtime,
|
|
16251
16321
|
staticRoot: hasStaticAssets ? staticRoot : void 0,
|
|
16252
16322
|
readOnly: args.readOnly
|
|
@@ -16254,15 +16324,15 @@ Tip: Use .mts for configs with top-level await or in projects without "type": "m
|
|
|
16254
16324
|
if (args.readOnly) {
|
|
16255
16325
|
console.log("[axl-studio] Read-only mode enabled \u2014 mutating endpoints are disabled.");
|
|
16256
16326
|
}
|
|
16257
|
-
const { injectWebSocket, upgradeWebSocket } = (0, import_node_ws.createNodeWebSocket)({ app:
|
|
16327
|
+
const { injectWebSocket, upgradeWebSocket } = (0, import_node_ws.createNodeWebSocket)({ app: app5 });
|
|
16258
16328
|
const wsHandlers = createWsHandlers2();
|
|
16259
|
-
|
|
16329
|
+
app5.get(
|
|
16260
16330
|
"/ws",
|
|
16261
16331
|
upgradeWebSocket(() => wsHandlers)
|
|
16262
16332
|
);
|
|
16263
16333
|
const server = (0, import_node_server.serve)(
|
|
16264
16334
|
{
|
|
16265
|
-
fetch:
|
|
16335
|
+
fetch: app5.fetch,
|
|
16266
16336
|
port: args.port
|
|
16267
16337
|
},
|
|
16268
16338
|
(info) => {
|