@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/server/index.cjs
CHANGED
|
@@ -70,6 +70,14 @@ function redactExecutionInfo(info, redact) {
|
|
|
70
70
|
...info,
|
|
71
71
|
...info.result !== void 0 ? { result: REDACTED } : {},
|
|
72
72
|
...info.error !== void 0 ? { error: REDACTED } : {},
|
|
73
|
+
// `metadata` carries operator-supplied tags (userId/tenantId/correlation
|
|
74
|
+
// ids per the docs) — exactly the surface trace.redact is supposed to
|
|
75
|
+
// protect. Without this scrub, REST consumers see the metadata bag
|
|
76
|
+
// even when redaction is enabled, while events[*].data.* is properly
|
|
77
|
+
// scrubbed. Use a `{ redacted: true }` marker to keep the field
|
|
78
|
+
// queryable/serializable rather than dropping it (mirrors
|
|
79
|
+
// `redactPendingDecision` on `decision.metadata`).
|
|
80
|
+
...info.metadata !== void 0 ? { metadata: { redacted: true } } : {},
|
|
73
81
|
events: info.events.map((e) => redactStreamEvent(e, true))
|
|
74
82
|
};
|
|
75
83
|
}
|
|
@@ -320,6 +328,24 @@ var ConnectionManager = class {
|
|
|
320
328
|
}
|
|
321
329
|
}
|
|
322
330
|
}
|
|
331
|
+
/** Drop the replay buffer for a channel immediately (cancels any pending
|
|
332
|
+
* TTL timer). Used by the executions DELETE route to scrub buffered
|
|
333
|
+
* events when an operator runs a GDPR delete — otherwise events for the
|
|
334
|
+
* deleted execution remain replayable to late subscribers for up to
|
|
335
|
+
* `BUFFER_TTL_MS` after stream completion. No-op when no buffer exists.
|
|
336
|
+
*/
|
|
337
|
+
clearChannelBuffer(channel) {
|
|
338
|
+
const buffer = this.buffers.get(channel);
|
|
339
|
+
if (!buffer) return;
|
|
340
|
+
if (buffer.timer) clearTimeout(buffer.timer);
|
|
341
|
+
this.buffers.delete(channel);
|
|
342
|
+
}
|
|
343
|
+
/** @internal Inspection hook for tests — returns whether a replay buffer
|
|
344
|
+
* currently exists for `channel`. Not part of the public API; embedders
|
|
345
|
+
* should not rely on it. */
|
|
346
|
+
_hasReplayBuffer(channel) {
|
|
347
|
+
return this.buffers.has(channel);
|
|
348
|
+
}
|
|
323
349
|
/** Unsubscribe a connection from a channel. */
|
|
324
350
|
unsubscribe(ws, channel) {
|
|
325
351
|
this.channels.get(channel)?.delete(ws);
|
|
@@ -578,6 +604,7 @@ var TraceAggregator = class {
|
|
|
578
604
|
snaps;
|
|
579
605
|
interval;
|
|
580
606
|
listener;
|
|
607
|
+
deleteListener;
|
|
581
608
|
options;
|
|
582
609
|
constructor(options) {
|
|
583
610
|
this.options = options;
|
|
@@ -595,6 +622,12 @@ var TraceAggregator = class {
|
|
|
595
622
|
this.snaps.fold(event.timestamp, (prev) => this.options.reducer(prev, event));
|
|
596
623
|
};
|
|
597
624
|
this.options.runtime.on("trace", this.listener);
|
|
625
|
+
this.deleteListener = () => {
|
|
626
|
+
this.rebuild().catch(
|
|
627
|
+
(err) => console.error("[axl-studio] rebuild on execution_deleted failed:", err)
|
|
628
|
+
);
|
|
629
|
+
};
|
|
630
|
+
this.options.runtime.on("execution_deleted", this.deleteListener);
|
|
598
631
|
this.interval = setInterval(
|
|
599
632
|
() => this.rebuild().catch((err) => console.error("[axl-studio] rebuild failed:", err)),
|
|
600
633
|
REBUILD_INTERVAL_MS
|
|
@@ -627,6 +660,7 @@ var TraceAggregator = class {
|
|
|
627
660
|
}
|
|
628
661
|
close() {
|
|
629
662
|
if (this.listener) this.options.runtime.off("trace", this.listener);
|
|
663
|
+
if (this.deleteListener) this.options.runtime.off("execution_deleted", this.deleteListener);
|
|
630
664
|
if (this.interval) clearInterval(this.interval);
|
|
631
665
|
}
|
|
632
666
|
};
|
|
@@ -636,6 +670,7 @@ var ExecutionAggregator = class {
|
|
|
636
670
|
snaps;
|
|
637
671
|
interval;
|
|
638
672
|
listener;
|
|
673
|
+
deleteListener;
|
|
639
674
|
options;
|
|
640
675
|
/** Generation counter to prevent stale async fold after rebuild. */
|
|
641
676
|
generation = 0;
|
|
@@ -662,6 +697,12 @@ var ExecutionAggregator = class {
|
|
|
662
697
|
}).catch((err) => console.error("[axl-studio] execution fold failed:", err));
|
|
663
698
|
};
|
|
664
699
|
this.options.runtime.on("trace", this.listener);
|
|
700
|
+
this.deleteListener = () => {
|
|
701
|
+
this.rebuild().catch(
|
|
702
|
+
(err) => console.error("[axl-studio] rebuild on execution_deleted failed:", err)
|
|
703
|
+
);
|
|
704
|
+
};
|
|
705
|
+
this.options.runtime.on("execution_deleted", this.deleteListener);
|
|
665
706
|
this.interval = setInterval(
|
|
666
707
|
() => this.rebuild().catch((err) => console.error("[axl-studio] rebuild failed:", err)),
|
|
667
708
|
REBUILD_INTERVAL_MS
|
|
@@ -693,6 +734,7 @@ var ExecutionAggregator = class {
|
|
|
693
734
|
}
|
|
694
735
|
close() {
|
|
695
736
|
if (this.listener) this.options.runtime.off("trace", this.listener);
|
|
737
|
+
if (this.deleteListener) this.options.runtime.off("execution_deleted", this.deleteListener);
|
|
696
738
|
if (this.interval) clearInterval(this.interval);
|
|
697
739
|
}
|
|
698
740
|
};
|
|
@@ -702,6 +744,7 @@ var EvalAggregator = class {
|
|
|
702
744
|
snaps;
|
|
703
745
|
interval;
|
|
704
746
|
listener;
|
|
747
|
+
deleteListener;
|
|
705
748
|
options;
|
|
706
749
|
constructor(options) {
|
|
707
750
|
this.options = options;
|
|
@@ -719,6 +762,12 @@ var EvalAggregator = class {
|
|
|
719
762
|
this.snaps.fold(entry.timestamp, (prev) => this.options.reducer(prev, entry));
|
|
720
763
|
};
|
|
721
764
|
this.options.runtime.on("eval_result", this.listener);
|
|
765
|
+
this.deleteListener = () => {
|
|
766
|
+
this.rebuild().catch(
|
|
767
|
+
(err) => console.error("[axl-studio] rebuild on eval_deleted failed:", err)
|
|
768
|
+
);
|
|
769
|
+
};
|
|
770
|
+
this.options.runtime.on("eval_deleted", this.deleteListener);
|
|
722
771
|
this.interval = setInterval(
|
|
723
772
|
() => this.rebuild().catch((err) => console.error("[axl-studio] rebuild failed:", err)),
|
|
724
773
|
REBUILD_INTERVAL_MS
|
|
@@ -749,6 +798,7 @@ var EvalAggregator = class {
|
|
|
749
798
|
}
|
|
750
799
|
close() {
|
|
751
800
|
if (this.listener) this.options.runtime.off("eval_result", this.listener);
|
|
801
|
+
if (this.deleteListener) this.options.runtime.off("eval_deleted", this.deleteListener);
|
|
752
802
|
if (this.interval) clearInterval(this.interval);
|
|
753
803
|
}
|
|
754
804
|
};
|
|
@@ -1091,8 +1141,8 @@ function reduceTraceStats(acc, event) {
|
|
|
1091
1141
|
// src/server/routes/health.ts
|
|
1092
1142
|
var import_hono = require("hono");
|
|
1093
1143
|
function createHealthRoutes(readOnly) {
|
|
1094
|
-
const
|
|
1095
|
-
|
|
1144
|
+
const app5 = new import_hono.Hono();
|
|
1145
|
+
app5.get("/health", (c) => {
|
|
1096
1146
|
const runtime = c.get("runtime");
|
|
1097
1147
|
return c.json({
|
|
1098
1148
|
ok: true,
|
|
@@ -1105,15 +1155,15 @@ function createHealthRoutes(readOnly) {
|
|
|
1105
1155
|
}
|
|
1106
1156
|
});
|
|
1107
1157
|
});
|
|
1108
|
-
return
|
|
1158
|
+
return app5;
|
|
1109
1159
|
}
|
|
1110
1160
|
|
|
1111
1161
|
// src/server/routes/workflows.ts
|
|
1112
1162
|
var import_hono2 = require("hono");
|
|
1113
1163
|
var import_axl3 = require("@axlsdk/axl");
|
|
1114
1164
|
function createWorkflowRoutes(connMgr) {
|
|
1115
|
-
const
|
|
1116
|
-
|
|
1165
|
+
const app5 = new import_hono2.Hono();
|
|
1166
|
+
app5.get("/workflows", (c) => {
|
|
1117
1167
|
const runtime = c.get("runtime");
|
|
1118
1168
|
const workflows = runtime.getWorkflows().map((w) => ({
|
|
1119
1169
|
name: w.name,
|
|
@@ -1122,7 +1172,7 @@ function createWorkflowRoutes(connMgr) {
|
|
|
1122
1172
|
}));
|
|
1123
1173
|
return c.json({ ok: true, data: workflows });
|
|
1124
1174
|
});
|
|
1125
|
-
|
|
1175
|
+
app5.get("/workflows/:name", (c) => {
|
|
1126
1176
|
const runtime = c.get("runtime");
|
|
1127
1177
|
const name = c.req.param("name");
|
|
1128
1178
|
const workflow = runtime.getWorkflow(name);
|
|
@@ -1141,7 +1191,7 @@ function createWorkflowRoutes(connMgr) {
|
|
|
1141
1191
|
}
|
|
1142
1192
|
});
|
|
1143
1193
|
});
|
|
1144
|
-
|
|
1194
|
+
app5.post("/workflows/:name/execute", async (c) => {
|
|
1145
1195
|
const runtime = c.get("runtime");
|
|
1146
1196
|
const name = c.req.param("name");
|
|
1147
1197
|
const workflow = runtime.getWorkflow(name);
|
|
@@ -1172,70 +1222,89 @@ function createWorkflowRoutes(connMgr) {
|
|
|
1172
1222
|
data: { result: redactValue(result, runtime.isRedactEnabled()) }
|
|
1173
1223
|
});
|
|
1174
1224
|
});
|
|
1175
|
-
return
|
|
1225
|
+
return app5;
|
|
1176
1226
|
}
|
|
1177
1227
|
|
|
1178
1228
|
// src/server/routes/executions.ts
|
|
1179
1229
|
var import_hono3 = require("hono");
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1230
|
+
function createExecutionRoutes(connMgr) {
|
|
1231
|
+
const app5 = new import_hono3.Hono();
|
|
1232
|
+
app5.get("/executions", async (c) => {
|
|
1233
|
+
const runtime = c.get("runtime");
|
|
1234
|
+
const executions = await runtime.getExecutions();
|
|
1235
|
+
return c.json({
|
|
1236
|
+
ok: true,
|
|
1237
|
+
data: redactExecutionList(executions, runtime.isRedactEnabled())
|
|
1238
|
+
});
|
|
1187
1239
|
});
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1240
|
+
app5.get("/executions/:id", async (c) => {
|
|
1241
|
+
const runtime = c.get("runtime");
|
|
1242
|
+
const id = c.req.param("id");
|
|
1243
|
+
const execution = await runtime.getExecution(id);
|
|
1244
|
+
if (!execution) {
|
|
1245
|
+
return c.json(
|
|
1246
|
+
{ ok: false, error: { code: "NOT_FOUND", message: `Execution "${id}" not found` } },
|
|
1247
|
+
404
|
|
1248
|
+
);
|
|
1249
|
+
}
|
|
1250
|
+
const sinceParam = c.req.query("since");
|
|
1251
|
+
let paged = execution;
|
|
1252
|
+
if (sinceParam !== void 0) {
|
|
1253
|
+
const since = Number(sinceParam);
|
|
1254
|
+
if (!Number.isFinite(since) || !Number.isInteger(since)) {
|
|
1255
|
+
return c.json(
|
|
1256
|
+
{
|
|
1257
|
+
ok: false,
|
|
1258
|
+
error: {
|
|
1259
|
+
code: "INVALID_PARAM",
|
|
1260
|
+
message: `\`since\` must be a finite integer (got "${sinceParam}")`,
|
|
1261
|
+
param: "since"
|
|
1262
|
+
}
|
|
1263
|
+
},
|
|
1264
|
+
400
|
|
1265
|
+
);
|
|
1266
|
+
}
|
|
1267
|
+
paged = {
|
|
1268
|
+
...execution,
|
|
1269
|
+
events: execution.events.filter((e) => e.step > since)
|
|
1270
|
+
};
|
|
1271
|
+
}
|
|
1272
|
+
return c.json({
|
|
1273
|
+
ok: true,
|
|
1274
|
+
data: redactExecutionInfo(paged, runtime.isRedactEnabled())
|
|
1275
|
+
});
|
|
1276
|
+
});
|
|
1277
|
+
app5.post("/executions/:id/abort", (c) => {
|
|
1278
|
+
const runtime = c.get("runtime");
|
|
1279
|
+
const id = c.req.param("id");
|
|
1280
|
+
runtime.abort(id);
|
|
1281
|
+
return c.json({ ok: true, data: { aborted: true } });
|
|
1282
|
+
});
|
|
1283
|
+
app5.delete("/executions/:id", async (c) => {
|
|
1284
|
+
const runtime = c.get("runtime");
|
|
1285
|
+
const id = c.req.param("id");
|
|
1286
|
+
const deleted = await runtime.deleteExecution(id);
|
|
1287
|
+
if (!deleted) {
|
|
1204
1288
|
return c.json(
|
|
1205
1289
|
{
|
|
1206
1290
|
ok: false,
|
|
1207
|
-
error: {
|
|
1208
|
-
code: "INVALID_PARAM",
|
|
1209
|
-
message: `\`since\` must be a finite integer (got "${sinceParam}")`,
|
|
1210
|
-
param: "since"
|
|
1211
|
-
}
|
|
1291
|
+
error: { code: "NOT_FOUND", message: `Execution "${id}" not found` }
|
|
1212
1292
|
},
|
|
1213
|
-
|
|
1293
|
+
404
|
|
1214
1294
|
);
|
|
1215
1295
|
}
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
events: execution.events.filter((e) => e.step > since)
|
|
1219
|
-
};
|
|
1220
|
-
}
|
|
1221
|
-
return c.json({
|
|
1222
|
-
ok: true,
|
|
1223
|
-
data: redactExecutionInfo(paged, runtime.isRedactEnabled())
|
|
1296
|
+
connMgr?.clearChannelBuffer(`execution:${id}`);
|
|
1297
|
+
return c.json({ ok: true, data: { id, deleted: true } });
|
|
1224
1298
|
});
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
const id = c.req.param("id");
|
|
1229
|
-
runtime.abort(id);
|
|
1230
|
-
return c.json({ ok: true, data: { aborted: true } });
|
|
1231
|
-
});
|
|
1232
|
-
var executions_default = app;
|
|
1299
|
+
return app5;
|
|
1300
|
+
}
|
|
1301
|
+
var executions_default = createExecutionRoutes();
|
|
1233
1302
|
|
|
1234
1303
|
// src/server/routes/sessions.ts
|
|
1235
1304
|
var import_hono4 = require("hono");
|
|
1236
1305
|
function createSessionRoutes(connMgr) {
|
|
1237
|
-
const
|
|
1238
|
-
|
|
1306
|
+
const app5 = new import_hono4.Hono();
|
|
1307
|
+
app5.get("/sessions", async (c) => {
|
|
1239
1308
|
const runtime = c.get("runtime");
|
|
1240
1309
|
const store = runtime.getStateStore();
|
|
1241
1310
|
if (!store.listSessions) {
|
|
@@ -1249,7 +1318,7 @@ function createSessionRoutes(connMgr) {
|
|
|
1249
1318
|
}
|
|
1250
1319
|
return c.json({ ok: true, data: sessions });
|
|
1251
1320
|
});
|
|
1252
|
-
|
|
1321
|
+
app5.get("/sessions/:id", async (c) => {
|
|
1253
1322
|
const runtime = c.get("runtime");
|
|
1254
1323
|
const store = runtime.getStateStore();
|
|
1255
1324
|
const id = c.req.param("id");
|
|
@@ -1266,7 +1335,7 @@ function createSessionRoutes(connMgr) {
|
|
|
1266
1335
|
}
|
|
1267
1336
|
});
|
|
1268
1337
|
});
|
|
1269
|
-
|
|
1338
|
+
app5.post("/sessions/:id/send", async (c) => {
|
|
1270
1339
|
const runtime = c.get("runtime");
|
|
1271
1340
|
const id = c.req.param("id");
|
|
1272
1341
|
const body = await c.req.json();
|
|
@@ -1274,7 +1343,7 @@ function createSessionRoutes(connMgr) {
|
|
|
1274
1343
|
const result = await session.send(body.workflow, body.message);
|
|
1275
1344
|
return c.json({ ok: true, data: { result } });
|
|
1276
1345
|
});
|
|
1277
|
-
|
|
1346
|
+
app5.post("/sessions/:id/stream", async (c) => {
|
|
1278
1347
|
const runtime = c.get("runtime");
|
|
1279
1348
|
const id = c.req.param("id");
|
|
1280
1349
|
const body = await c.req.json();
|
|
@@ -1288,21 +1357,21 @@ function createSessionRoutes(connMgr) {
|
|
|
1288
1357
|
})();
|
|
1289
1358
|
return c.json({ ok: true, data: { executionId, streaming: true } });
|
|
1290
1359
|
});
|
|
1291
|
-
|
|
1360
|
+
app5.delete("/sessions/:id", async (c) => {
|
|
1292
1361
|
const runtime = c.get("runtime");
|
|
1293
1362
|
const store = runtime.getStateStore();
|
|
1294
1363
|
const id = c.req.param("id");
|
|
1295
1364
|
await store.deleteSession(id);
|
|
1296
1365
|
return c.json({ ok: true, data: { deleted: true } });
|
|
1297
1366
|
});
|
|
1298
|
-
return
|
|
1367
|
+
return app5;
|
|
1299
1368
|
}
|
|
1300
1369
|
|
|
1301
1370
|
// src/server/routes/agents.ts
|
|
1302
1371
|
var import_hono5 = require("hono");
|
|
1303
1372
|
var import_axl4 = require("@axlsdk/axl");
|
|
1304
|
-
var
|
|
1305
|
-
|
|
1373
|
+
var app = new import_hono5.Hono();
|
|
1374
|
+
app.get("/agents", (c) => {
|
|
1306
1375
|
const runtime = c.get("runtime");
|
|
1307
1376
|
const agents = runtime.getAgents().map((a) => ({
|
|
1308
1377
|
name: a._name,
|
|
@@ -1321,7 +1390,7 @@ app2.get("/agents", (c) => {
|
|
|
1321
1390
|
}));
|
|
1322
1391
|
return c.json({ ok: true, data: agents });
|
|
1323
1392
|
});
|
|
1324
|
-
|
|
1393
|
+
app.get("/agents/:name", (c) => {
|
|
1325
1394
|
const runtime = c.get("runtime");
|
|
1326
1395
|
const name = c.req.param("name");
|
|
1327
1396
|
const agent = runtime.getAgent(name);
|
|
@@ -1377,13 +1446,13 @@ app2.get("/agents/:name", (c) => {
|
|
|
1377
1446
|
}
|
|
1378
1447
|
});
|
|
1379
1448
|
});
|
|
1380
|
-
var agents_default =
|
|
1449
|
+
var agents_default = app;
|
|
1381
1450
|
|
|
1382
1451
|
// src/server/routes/tools.ts
|
|
1383
1452
|
var import_hono6 = require("hono");
|
|
1384
1453
|
var import_axl5 = require("@axlsdk/axl");
|
|
1385
|
-
var
|
|
1386
|
-
|
|
1454
|
+
var app2 = new import_hono6.Hono();
|
|
1455
|
+
app2.get("/tools", (c) => {
|
|
1387
1456
|
const runtime = c.get("runtime");
|
|
1388
1457
|
const tools = runtime.getTools().map((t) => ({
|
|
1389
1458
|
name: t.name,
|
|
@@ -1394,7 +1463,7 @@ app3.get("/tools", (c) => {
|
|
|
1394
1463
|
}));
|
|
1395
1464
|
return c.json({ ok: true, data: tools });
|
|
1396
1465
|
});
|
|
1397
|
-
|
|
1466
|
+
app2.get("/tools/:name", (c) => {
|
|
1398
1467
|
const runtime = c.get("runtime");
|
|
1399
1468
|
const name = c.req.param("name");
|
|
1400
1469
|
const tool = runtime.getTool(name);
|
|
@@ -1421,7 +1490,7 @@ app3.get("/tools/:name", (c) => {
|
|
|
1421
1490
|
}
|
|
1422
1491
|
});
|
|
1423
1492
|
});
|
|
1424
|
-
|
|
1493
|
+
app2.post("/tools/:name/test", async (c) => {
|
|
1425
1494
|
const runtime = c.get("runtime");
|
|
1426
1495
|
const name = c.req.param("name");
|
|
1427
1496
|
const tool = runtime.getTool(name);
|
|
@@ -1439,12 +1508,12 @@ app3.post("/tools/:name/test", async (c) => {
|
|
|
1439
1508
|
data: { result: redactValue(result, runtime.isRedactEnabled()) }
|
|
1440
1509
|
});
|
|
1441
1510
|
});
|
|
1442
|
-
var tools_default =
|
|
1511
|
+
var tools_default = app2;
|
|
1443
1512
|
|
|
1444
1513
|
// src/server/routes/memory.ts
|
|
1445
1514
|
var import_hono7 = require("hono");
|
|
1446
|
-
var
|
|
1447
|
-
|
|
1515
|
+
var app3 = new import_hono7.Hono();
|
|
1516
|
+
app3.get("/memory/:scope", async (c) => {
|
|
1448
1517
|
const runtime = c.get("runtime");
|
|
1449
1518
|
const store = runtime.getStateStore();
|
|
1450
1519
|
const scope = c.req.param("scope");
|
|
@@ -1454,7 +1523,7 @@ app4.get("/memory/:scope", async (c) => {
|
|
|
1454
1523
|
const entries = await store.getAllMemory(scope);
|
|
1455
1524
|
return c.json({ ok: true, data: redactMemoryList(entries, runtime.isRedactEnabled()) });
|
|
1456
1525
|
});
|
|
1457
|
-
|
|
1526
|
+
app3.get("/memory/:scope/:key", async (c) => {
|
|
1458
1527
|
const runtime = c.get("runtime");
|
|
1459
1528
|
const store = runtime.getStateStore();
|
|
1460
1529
|
const scope = c.req.param("scope");
|
|
@@ -1477,7 +1546,7 @@ app4.get("/memory/:scope/:key", async (c) => {
|
|
|
1477
1546
|
data: { key, value: redactMemoryValue(value, runtime.isRedactEnabled()) }
|
|
1478
1547
|
});
|
|
1479
1548
|
});
|
|
1480
|
-
|
|
1549
|
+
app3.put("/memory/:scope/:key", async (c) => {
|
|
1481
1550
|
const runtime = c.get("runtime");
|
|
1482
1551
|
const store = runtime.getStateStore();
|
|
1483
1552
|
const scope = c.req.param("scope");
|
|
@@ -1492,7 +1561,7 @@ app4.put("/memory/:scope/:key", async (c) => {
|
|
|
1492
1561
|
await store.saveMemory(scope, key, body.value);
|
|
1493
1562
|
return c.json({ ok: true, data: { saved: true } });
|
|
1494
1563
|
});
|
|
1495
|
-
|
|
1564
|
+
app3.delete("/memory/:scope/:key", async (c) => {
|
|
1496
1565
|
const runtime = c.get("runtime");
|
|
1497
1566
|
const store = runtime.getStateStore();
|
|
1498
1567
|
const scope = c.req.param("scope");
|
|
@@ -1506,18 +1575,18 @@ app4.delete("/memory/:scope/:key", async (c) => {
|
|
|
1506
1575
|
await store.deleteMemory(scope, key);
|
|
1507
1576
|
return c.json({ ok: true, data: { deleted: true } });
|
|
1508
1577
|
});
|
|
1509
|
-
|
|
1578
|
+
app3.post("/memory/search", async (c) => {
|
|
1510
1579
|
return c.json({
|
|
1511
1580
|
ok: true,
|
|
1512
1581
|
data: { results: [], message: "Semantic search requires MemoryManager with vector store" }
|
|
1513
1582
|
});
|
|
1514
1583
|
});
|
|
1515
|
-
var memory_default =
|
|
1584
|
+
var memory_default = app3;
|
|
1516
1585
|
|
|
1517
1586
|
// src/server/routes/decisions.ts
|
|
1518
1587
|
var import_hono8 = require("hono");
|
|
1519
|
-
var
|
|
1520
|
-
|
|
1588
|
+
var app4 = new import_hono8.Hono();
|
|
1589
|
+
app4.get("/decisions", async (c) => {
|
|
1521
1590
|
const runtime = c.get("runtime");
|
|
1522
1591
|
const decisions = await runtime.getPendingDecisions();
|
|
1523
1592
|
return c.json({
|
|
@@ -1525,27 +1594,27 @@ app5.get("/decisions", async (c) => {
|
|
|
1525
1594
|
data: redactPendingDecisionList(decisions, runtime.isRedactEnabled())
|
|
1526
1595
|
});
|
|
1527
1596
|
});
|
|
1528
|
-
|
|
1597
|
+
app4.post("/decisions/:executionId/resolve", async (c) => {
|
|
1529
1598
|
const runtime = c.get("runtime");
|
|
1530
1599
|
const executionId = c.req.param("executionId");
|
|
1531
1600
|
const body = await c.req.json();
|
|
1532
1601
|
await runtime.resolveDecision(executionId, body);
|
|
1533
1602
|
return c.json({ ok: true, data: { resolved: true } });
|
|
1534
1603
|
});
|
|
1535
|
-
var decisions_default =
|
|
1604
|
+
var decisions_default = app4;
|
|
1536
1605
|
|
|
1537
1606
|
// src/server/routes/costs.ts
|
|
1538
1607
|
var import_hono9 = require("hono");
|
|
1539
1608
|
function createCostRoutes(costAggregator) {
|
|
1540
|
-
const
|
|
1541
|
-
|
|
1609
|
+
const app5 = new import_hono9.Hono();
|
|
1610
|
+
app5.get("/costs", (c) => {
|
|
1542
1611
|
if (c.req.query("windows") === "all") {
|
|
1543
1612
|
return c.json({ ok: true, data: costAggregator.getAllSnapshots() });
|
|
1544
1613
|
}
|
|
1545
1614
|
const window = parseWindowParam(c.req.query("window"));
|
|
1546
1615
|
return c.json({ ok: true, data: costAggregator.getSnapshot(window) });
|
|
1547
1616
|
});
|
|
1548
|
-
|
|
1617
|
+
app5.post("/costs/reset", (c) => {
|
|
1549
1618
|
return c.json(
|
|
1550
1619
|
{
|
|
1551
1620
|
ok: false,
|
|
@@ -1557,22 +1626,22 @@ function createCostRoutes(costAggregator) {
|
|
|
1557
1626
|
410
|
|
1558
1627
|
);
|
|
1559
1628
|
});
|
|
1560
|
-
return
|
|
1629
|
+
return app5;
|
|
1561
1630
|
}
|
|
1562
1631
|
|
|
1563
1632
|
// src/server/routes/evals.ts
|
|
1564
1633
|
var import_node_crypto = require("crypto");
|
|
1565
1634
|
var import_hono10 = require("hono");
|
|
1566
1635
|
function createEvalRoutes(connMgr, evalLoader) {
|
|
1567
|
-
const
|
|
1636
|
+
const app5 = new import_hono10.Hono();
|
|
1568
1637
|
const activeRuns = /* @__PURE__ */ new Map();
|
|
1569
|
-
|
|
1638
|
+
app5.get("/evals", async (c) => {
|
|
1570
1639
|
if (evalLoader) await evalLoader();
|
|
1571
1640
|
const runtime = c.get("runtime");
|
|
1572
1641
|
const evals = runtime.getRegisteredEvals();
|
|
1573
1642
|
return c.json({ ok: true, data: evals });
|
|
1574
1643
|
});
|
|
1575
|
-
|
|
1644
|
+
app5.get("/evals/history", async (c) => {
|
|
1576
1645
|
const runtime = c.get("runtime");
|
|
1577
1646
|
const history = await runtime.getEvalHistory();
|
|
1578
1647
|
return c.json({
|
|
@@ -1580,7 +1649,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1580
1649
|
data: redactEvalHistoryList(history, runtime.isRedactEnabled())
|
|
1581
1650
|
});
|
|
1582
1651
|
});
|
|
1583
|
-
|
|
1652
|
+
app5.delete("/evals/history/:id", async (c) => {
|
|
1584
1653
|
const runtime = c.get("runtime");
|
|
1585
1654
|
const id = c.req.param("id");
|
|
1586
1655
|
const deleted = await runtime.deleteEvalResult(id);
|
|
@@ -1595,7 +1664,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1595
1664
|
}
|
|
1596
1665
|
return c.json({ ok: true, data: { id, deleted: true } });
|
|
1597
1666
|
});
|
|
1598
|
-
|
|
1667
|
+
app5.post("/evals/:name/run", async (c) => {
|
|
1599
1668
|
if (evalLoader) await evalLoader();
|
|
1600
1669
|
const runtime = c.get("runtime");
|
|
1601
1670
|
const name = c.req.param("name");
|
|
@@ -1793,7 +1862,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1793
1862
|
);
|
|
1794
1863
|
}
|
|
1795
1864
|
});
|
|
1796
|
-
|
|
1865
|
+
app5.post("/evals/runs/:evalRunId/cancel", (c) => {
|
|
1797
1866
|
const evalRunId = c.req.param("evalRunId");
|
|
1798
1867
|
const ac = activeRuns.get(evalRunId);
|
|
1799
1868
|
if (!ac) {
|
|
@@ -1806,7 +1875,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1806
1875
|
activeRuns.delete(evalRunId);
|
|
1807
1876
|
return c.json({ ok: true, data: { cancelled: true } });
|
|
1808
1877
|
});
|
|
1809
|
-
|
|
1878
|
+
app5.post("/evals/:name/rescore", async (c) => {
|
|
1810
1879
|
if (evalLoader) await evalLoader();
|
|
1811
1880
|
const runtime = c.get("runtime");
|
|
1812
1881
|
const redactOn = runtime.isRedactEnabled();
|
|
@@ -1858,7 +1927,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1858
1927
|
);
|
|
1859
1928
|
}
|
|
1860
1929
|
});
|
|
1861
|
-
|
|
1930
|
+
app5.post("/evals/compare", async (c) => {
|
|
1862
1931
|
const runtime = c.get("runtime");
|
|
1863
1932
|
const redactOn = runtime.isRedactEnabled();
|
|
1864
1933
|
const body = await c.req.json();
|
|
@@ -1941,7 +2010,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1941
2010
|
);
|
|
1942
2011
|
}
|
|
1943
2012
|
});
|
|
1944
|
-
|
|
2013
|
+
app5.post("/evals/import", async (c) => {
|
|
1945
2014
|
const runtime = c.get("runtime");
|
|
1946
2015
|
const body = await c.req.json();
|
|
1947
2016
|
const bad = (message) => c.json({ ok: false, error: { code: "BAD_REQUEST", message } }, 400);
|
|
@@ -2019,7 +2088,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
2019
2088
|
for (const ac of activeRuns.values()) ac.abort();
|
|
2020
2089
|
activeRuns.clear();
|
|
2021
2090
|
}
|
|
2022
|
-
return { app:
|
|
2091
|
+
return { app: app5, closeActiveRuns };
|
|
2023
2092
|
}
|
|
2024
2093
|
|
|
2025
2094
|
// src/server/routes/playground.ts
|
|
@@ -15803,8 +15872,8 @@ var DEMO_SCHEMA_BY_AGENT = {
|
|
|
15803
15872
|
})
|
|
15804
15873
|
};
|
|
15805
15874
|
function createPlaygroundRoutes(connMgr) {
|
|
15806
|
-
const
|
|
15807
|
-
|
|
15875
|
+
const app5 = new import_hono11.Hono();
|
|
15876
|
+
app5.post("/playground/chat", async (c) => {
|
|
15808
15877
|
const runtime = c.get("runtime");
|
|
15809
15878
|
const body = await c.req.json();
|
|
15810
15879
|
if (!body.message || typeof body.message !== "string" || !body.message.trim()) {
|
|
@@ -15884,46 +15953,46 @@ function createPlaygroundRoutes(connMgr) {
|
|
|
15884
15953
|
data: { sessionId, executionId, streaming: true }
|
|
15885
15954
|
});
|
|
15886
15955
|
});
|
|
15887
|
-
return
|
|
15956
|
+
return app5;
|
|
15888
15957
|
}
|
|
15889
15958
|
|
|
15890
15959
|
// src/server/routes/eval-trends.ts
|
|
15891
15960
|
var import_hono12 = require("hono");
|
|
15892
15961
|
function createEvalTrendsRoutes(aggregator) {
|
|
15893
|
-
const
|
|
15894
|
-
|
|
15962
|
+
const app5 = new import_hono12.Hono();
|
|
15963
|
+
app5.get("/eval-trends", (c) => {
|
|
15895
15964
|
const window = parseWindowParam(c.req.query("window"));
|
|
15896
15965
|
return c.json({ ok: true, data: aggregator.getSnapshot(window) });
|
|
15897
15966
|
});
|
|
15898
|
-
return
|
|
15967
|
+
return app5;
|
|
15899
15968
|
}
|
|
15900
15969
|
|
|
15901
15970
|
// src/server/routes/workflow-stats.ts
|
|
15902
15971
|
var import_hono13 = require("hono");
|
|
15903
15972
|
function createWorkflowStatsRoutes(aggregator) {
|
|
15904
|
-
const
|
|
15905
|
-
|
|
15973
|
+
const app5 = new import_hono13.Hono();
|
|
15974
|
+
app5.get("/workflow-stats", (c) => {
|
|
15906
15975
|
const window = parseWindowParam(c.req.query("window"));
|
|
15907
15976
|
return c.json({ ok: true, data: enrichWorkflowStats(aggregator.getSnapshot(window)) });
|
|
15908
15977
|
});
|
|
15909
|
-
return
|
|
15978
|
+
return app5;
|
|
15910
15979
|
}
|
|
15911
15980
|
|
|
15912
15981
|
// src/server/routes/trace-stats.ts
|
|
15913
15982
|
var import_hono14 = require("hono");
|
|
15914
15983
|
function createTraceStatsRoutes(aggregator) {
|
|
15915
|
-
const
|
|
15916
|
-
|
|
15984
|
+
const app5 = new import_hono14.Hono();
|
|
15985
|
+
app5.get("/trace-stats", (c) => {
|
|
15917
15986
|
const window = parseWindowParam(c.req.query("window"));
|
|
15918
15987
|
return c.json({ ok: true, data: aggregator.getSnapshot(window) });
|
|
15919
15988
|
});
|
|
15920
|
-
return
|
|
15989
|
+
return app5;
|
|
15921
15990
|
}
|
|
15922
15991
|
|
|
15923
15992
|
// src/server/index.ts
|
|
15924
15993
|
function createServer(options) {
|
|
15925
15994
|
const { runtime, staticRoot, basePath = "", readOnly = false } = options;
|
|
15926
|
-
const
|
|
15995
|
+
const app5 = new import_hono15.Hono();
|
|
15927
15996
|
const connMgr = new ConnectionManager(options.bufferCaps);
|
|
15928
15997
|
const windows = ["24h", "7d", "30d", "all"];
|
|
15929
15998
|
const costAggregator = new TraceAggregator({
|
|
@@ -15960,10 +16029,10 @@ function createServer(options) {
|
|
|
15960
16029
|
windows
|
|
15961
16030
|
});
|
|
15962
16031
|
if (options.cors !== false) {
|
|
15963
|
-
|
|
16032
|
+
app5.use("*", (0, import_cors.cors)());
|
|
15964
16033
|
}
|
|
15965
|
-
|
|
15966
|
-
|
|
16034
|
+
app5.use("*", errorHandler);
|
|
16035
|
+
app5.use("*", async (c, next) => {
|
|
15967
16036
|
c.set("runtime", runtime);
|
|
15968
16037
|
await next();
|
|
15969
16038
|
});
|
|
@@ -15971,6 +16040,7 @@ function createServer(options) {
|
|
|
15971
16040
|
const blocked = [
|
|
15972
16041
|
/^POST \/api\/workflows(\/|$)/,
|
|
15973
16042
|
/^POST \/api\/executions(\/|$)/,
|
|
16043
|
+
/^DELETE \/api\/executions\/[^/]+$/,
|
|
15974
16044
|
/^POST \/api\/sessions(\/|$)/,
|
|
15975
16045
|
/^DELETE \/api\/sessions(\/|$)/,
|
|
15976
16046
|
/^PUT \/api\/memory(\/|$)/,
|
|
@@ -15984,7 +16054,7 @@ function createServer(options) {
|
|
|
15984
16054
|
/^DELETE \/api\/evals\/history\/[^/]+$/,
|
|
15985
16055
|
/^POST \/api\/playground(\/|$)/
|
|
15986
16056
|
];
|
|
15987
|
-
|
|
16057
|
+
app5.use("/api/*", async (c, next) => {
|
|
15988
16058
|
const apiIdx = c.req.path.indexOf("/api/");
|
|
15989
16059
|
const apiPath = apiIdx >= 0 ? c.req.path.slice(apiIdx) : c.req.path;
|
|
15990
16060
|
const key = `${c.req.method} ${apiPath}`;
|
|
@@ -16003,7 +16073,7 @@ function createServer(options) {
|
|
|
16003
16073
|
const api = new import_hono15.Hono();
|
|
16004
16074
|
api.route("/", createHealthRoutes(readOnly));
|
|
16005
16075
|
api.route("/", createWorkflowRoutes(connMgr));
|
|
16006
|
-
api.route("/",
|
|
16076
|
+
api.route("/", createExecutionRoutes(connMgr));
|
|
16007
16077
|
api.route("/", createSessionRoutes(connMgr));
|
|
16008
16078
|
api.route("/", agents_default);
|
|
16009
16079
|
api.route("/", tools_default);
|
|
@@ -16016,7 +16086,7 @@ function createServer(options) {
|
|
|
16016
16086
|
const { app: evalApp, closeActiveRuns } = createEvalRoutes(connMgr, options.evalLoader);
|
|
16017
16087
|
api.route("/", evalApp);
|
|
16018
16088
|
api.route("/", createPlaygroundRoutes(connMgr));
|
|
16019
|
-
|
|
16089
|
+
app5.route("/api", api);
|
|
16020
16090
|
const traceListener = (event) => {
|
|
16021
16091
|
try {
|
|
16022
16092
|
const traceEvent = event;
|
|
@@ -16070,7 +16140,7 @@ function createServer(options) {
|
|
|
16070
16140
|
root: staticRoot,
|
|
16071
16141
|
rewriteRequestPath: basePath ? (path) => path.startsWith(basePath) ? path.slice(basePath.length) || "/" : path : void 0
|
|
16072
16142
|
});
|
|
16073
|
-
|
|
16143
|
+
app5.use("/*", async (c, next) => {
|
|
16074
16144
|
const reqPath = c.req.path;
|
|
16075
16145
|
const resolved = basePath && reqPath.startsWith(basePath) ? reqPath.slice(basePath.length) || "/" : reqPath;
|
|
16076
16146
|
if (resolved === "/" || resolved === "/index.html" || resolved === "/ws") {
|
|
@@ -16079,7 +16149,7 @@ function createServer(options) {
|
|
|
16079
16149
|
return staticHandler(c, next);
|
|
16080
16150
|
});
|
|
16081
16151
|
if (spaHtml) {
|
|
16082
|
-
|
|
16152
|
+
app5.get("*", async (c, next) => {
|
|
16083
16153
|
const resolved = basePath && c.req.path.startsWith(basePath) ? c.req.path.slice(basePath.length) || "/" : c.req.path;
|
|
16084
16154
|
if (resolved === "/ws") return next();
|
|
16085
16155
|
return c.html(spaHtml);
|
|
@@ -16087,7 +16157,7 @@ function createServer(options) {
|
|
|
16087
16157
|
}
|
|
16088
16158
|
}
|
|
16089
16159
|
return {
|
|
16090
|
-
app:
|
|
16160
|
+
app: app5,
|
|
16091
16161
|
connMgr,
|
|
16092
16162
|
costAggregator,
|
|
16093
16163
|
workflowStatsAggregator,
|