@axlsdk/studio 0.17.6 → 0.17.8
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
|
@@ -38,6 +38,14 @@ function redactExecutionInfo(info, redact) {
|
|
|
38
38
|
...info,
|
|
39
39
|
...info.result !== void 0 ? { result: REDACTED } : {},
|
|
40
40
|
...info.error !== void 0 ? { error: REDACTED } : {},
|
|
41
|
+
// `metadata` carries operator-supplied tags (userId/tenantId/correlation
|
|
42
|
+
// ids per the docs) — exactly the surface trace.redact is supposed to
|
|
43
|
+
// protect. Without this scrub, REST consumers see the metadata bag
|
|
44
|
+
// even when redaction is enabled, while events[*].data.* is properly
|
|
45
|
+
// scrubbed. Use a `{ redacted: true }` marker to keep the field
|
|
46
|
+
// queryable/serializable rather than dropping it (mirrors
|
|
47
|
+
// `redactPendingDecision` on `decision.metadata`).
|
|
48
|
+
...info.metadata !== void 0 ? { metadata: { redacted: true } } : {},
|
|
41
49
|
events: info.events.map((e) => redactStreamEvent(e, true))
|
|
42
50
|
};
|
|
43
51
|
}
|
|
@@ -288,6 +296,24 @@ var ConnectionManager = class {
|
|
|
288
296
|
}
|
|
289
297
|
}
|
|
290
298
|
}
|
|
299
|
+
/** Drop the replay buffer for a channel immediately (cancels any pending
|
|
300
|
+
* TTL timer). Used by the executions DELETE route to scrub buffered
|
|
301
|
+
* events when an operator runs a GDPR delete — otherwise events for the
|
|
302
|
+
* deleted execution remain replayable to late subscribers for up to
|
|
303
|
+
* `BUFFER_TTL_MS` after stream completion. No-op when no buffer exists.
|
|
304
|
+
*/
|
|
305
|
+
clearChannelBuffer(channel) {
|
|
306
|
+
const buffer = this.buffers.get(channel);
|
|
307
|
+
if (!buffer) return;
|
|
308
|
+
if (buffer.timer) clearTimeout(buffer.timer);
|
|
309
|
+
this.buffers.delete(channel);
|
|
310
|
+
}
|
|
311
|
+
/** @internal Inspection hook for tests — returns whether a replay buffer
|
|
312
|
+
* currently exists for `channel`. Not part of the public API; embedders
|
|
313
|
+
* should not rely on it. */
|
|
314
|
+
_hasReplayBuffer(channel) {
|
|
315
|
+
return this.buffers.has(channel);
|
|
316
|
+
}
|
|
291
317
|
/** Unsubscribe a connection from a channel. */
|
|
292
318
|
unsubscribe(ws, channel) {
|
|
293
319
|
this.channels.get(channel)?.delete(ws);
|
|
@@ -546,6 +572,7 @@ var TraceAggregator = class {
|
|
|
546
572
|
snaps;
|
|
547
573
|
interval;
|
|
548
574
|
listener;
|
|
575
|
+
deleteListener;
|
|
549
576
|
options;
|
|
550
577
|
constructor(options) {
|
|
551
578
|
this.options = options;
|
|
@@ -563,6 +590,12 @@ var TraceAggregator = class {
|
|
|
563
590
|
this.snaps.fold(event.timestamp, (prev) => this.options.reducer(prev, event));
|
|
564
591
|
};
|
|
565
592
|
this.options.runtime.on("trace", this.listener);
|
|
593
|
+
this.deleteListener = () => {
|
|
594
|
+
this.rebuild().catch(
|
|
595
|
+
(err) => console.error("[axl-studio] rebuild on execution_deleted failed:", err)
|
|
596
|
+
);
|
|
597
|
+
};
|
|
598
|
+
this.options.runtime.on("execution_deleted", this.deleteListener);
|
|
566
599
|
this.interval = setInterval(
|
|
567
600
|
() => this.rebuild().catch((err) => console.error("[axl-studio] rebuild failed:", err)),
|
|
568
601
|
REBUILD_INTERVAL_MS
|
|
@@ -595,6 +628,7 @@ var TraceAggregator = class {
|
|
|
595
628
|
}
|
|
596
629
|
close() {
|
|
597
630
|
if (this.listener) this.options.runtime.off("trace", this.listener);
|
|
631
|
+
if (this.deleteListener) this.options.runtime.off("execution_deleted", this.deleteListener);
|
|
598
632
|
if (this.interval) clearInterval(this.interval);
|
|
599
633
|
}
|
|
600
634
|
};
|
|
@@ -604,6 +638,7 @@ var ExecutionAggregator = class {
|
|
|
604
638
|
snaps;
|
|
605
639
|
interval;
|
|
606
640
|
listener;
|
|
641
|
+
deleteListener;
|
|
607
642
|
options;
|
|
608
643
|
/** Generation counter to prevent stale async fold after rebuild. */
|
|
609
644
|
generation = 0;
|
|
@@ -630,6 +665,12 @@ var ExecutionAggregator = class {
|
|
|
630
665
|
}).catch((err) => console.error("[axl-studio] execution fold failed:", err));
|
|
631
666
|
};
|
|
632
667
|
this.options.runtime.on("trace", this.listener);
|
|
668
|
+
this.deleteListener = () => {
|
|
669
|
+
this.rebuild().catch(
|
|
670
|
+
(err) => console.error("[axl-studio] rebuild on execution_deleted failed:", err)
|
|
671
|
+
);
|
|
672
|
+
};
|
|
673
|
+
this.options.runtime.on("execution_deleted", this.deleteListener);
|
|
633
674
|
this.interval = setInterval(
|
|
634
675
|
() => this.rebuild().catch((err) => console.error("[axl-studio] rebuild failed:", err)),
|
|
635
676
|
REBUILD_INTERVAL_MS
|
|
@@ -661,6 +702,7 @@ var ExecutionAggregator = class {
|
|
|
661
702
|
}
|
|
662
703
|
close() {
|
|
663
704
|
if (this.listener) this.options.runtime.off("trace", this.listener);
|
|
705
|
+
if (this.deleteListener) this.options.runtime.off("execution_deleted", this.deleteListener);
|
|
664
706
|
if (this.interval) clearInterval(this.interval);
|
|
665
707
|
}
|
|
666
708
|
};
|
|
@@ -670,6 +712,7 @@ var EvalAggregator = class {
|
|
|
670
712
|
snaps;
|
|
671
713
|
interval;
|
|
672
714
|
listener;
|
|
715
|
+
deleteListener;
|
|
673
716
|
options;
|
|
674
717
|
constructor(options) {
|
|
675
718
|
this.options = options;
|
|
@@ -687,6 +730,12 @@ var EvalAggregator = class {
|
|
|
687
730
|
this.snaps.fold(entry.timestamp, (prev) => this.options.reducer(prev, entry));
|
|
688
731
|
};
|
|
689
732
|
this.options.runtime.on("eval_result", this.listener);
|
|
733
|
+
this.deleteListener = () => {
|
|
734
|
+
this.rebuild().catch(
|
|
735
|
+
(err) => console.error("[axl-studio] rebuild on eval_deleted failed:", err)
|
|
736
|
+
);
|
|
737
|
+
};
|
|
738
|
+
this.options.runtime.on("eval_deleted", this.deleteListener);
|
|
690
739
|
this.interval = setInterval(
|
|
691
740
|
() => this.rebuild().catch((err) => console.error("[axl-studio] rebuild failed:", err)),
|
|
692
741
|
REBUILD_INTERVAL_MS
|
|
@@ -717,6 +766,7 @@ var EvalAggregator = class {
|
|
|
717
766
|
}
|
|
718
767
|
close() {
|
|
719
768
|
if (this.listener) this.options.runtime.off("eval_result", this.listener);
|
|
769
|
+
if (this.deleteListener) this.options.runtime.off("eval_deleted", this.deleteListener);
|
|
720
770
|
if (this.interval) clearInterval(this.interval);
|
|
721
771
|
}
|
|
722
772
|
};
|
|
@@ -1059,8 +1109,8 @@ function reduceTraceStats(acc, event) {
|
|
|
1059
1109
|
// src/server/routes/health.ts
|
|
1060
1110
|
import { Hono } from "hono";
|
|
1061
1111
|
function createHealthRoutes(readOnly) {
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1112
|
+
const app5 = new Hono();
|
|
1113
|
+
app5.get("/health", (c) => {
|
|
1064
1114
|
const runtime = c.get("runtime");
|
|
1065
1115
|
return c.json({
|
|
1066
1116
|
ok: true,
|
|
@@ -1073,15 +1123,15 @@ function createHealthRoutes(readOnly) {
|
|
|
1073
1123
|
}
|
|
1074
1124
|
});
|
|
1075
1125
|
});
|
|
1076
|
-
return
|
|
1126
|
+
return app5;
|
|
1077
1127
|
}
|
|
1078
1128
|
|
|
1079
1129
|
// src/server/routes/workflows.ts
|
|
1080
1130
|
import { Hono as Hono2 } from "hono";
|
|
1081
1131
|
import { zodToJsonSchema } from "@axlsdk/axl";
|
|
1082
1132
|
function createWorkflowRoutes(connMgr) {
|
|
1083
|
-
const
|
|
1084
|
-
|
|
1133
|
+
const app5 = new Hono2();
|
|
1134
|
+
app5.get("/workflows", (c) => {
|
|
1085
1135
|
const runtime = c.get("runtime");
|
|
1086
1136
|
const workflows = runtime.getWorkflows().map((w) => ({
|
|
1087
1137
|
name: w.name,
|
|
@@ -1090,7 +1140,7 @@ function createWorkflowRoutes(connMgr) {
|
|
|
1090
1140
|
}));
|
|
1091
1141
|
return c.json({ ok: true, data: workflows });
|
|
1092
1142
|
});
|
|
1093
|
-
|
|
1143
|
+
app5.get("/workflows/:name", (c) => {
|
|
1094
1144
|
const runtime = c.get("runtime");
|
|
1095
1145
|
const name = c.req.param("name");
|
|
1096
1146
|
const workflow = runtime.getWorkflow(name);
|
|
@@ -1109,7 +1159,7 @@ function createWorkflowRoutes(connMgr) {
|
|
|
1109
1159
|
}
|
|
1110
1160
|
});
|
|
1111
1161
|
});
|
|
1112
|
-
|
|
1162
|
+
app5.post("/workflows/:name/execute", async (c) => {
|
|
1113
1163
|
const runtime = c.get("runtime");
|
|
1114
1164
|
const name = c.req.param("name");
|
|
1115
1165
|
const workflow = runtime.getWorkflow(name);
|
|
@@ -1140,70 +1190,89 @@ function createWorkflowRoutes(connMgr) {
|
|
|
1140
1190
|
data: { result: redactValue(result, runtime.isRedactEnabled()) }
|
|
1141
1191
|
});
|
|
1142
1192
|
});
|
|
1143
|
-
return
|
|
1193
|
+
return app5;
|
|
1144
1194
|
}
|
|
1145
1195
|
|
|
1146
1196
|
// src/server/routes/executions.ts
|
|
1147
1197
|
import { Hono as Hono3 } from "hono";
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1198
|
+
function createExecutionRoutes(connMgr) {
|
|
1199
|
+
const app5 = new Hono3();
|
|
1200
|
+
app5.get("/executions", async (c) => {
|
|
1201
|
+
const runtime = c.get("runtime");
|
|
1202
|
+
const executions = await runtime.getExecutions();
|
|
1203
|
+
return c.json({
|
|
1204
|
+
ok: true,
|
|
1205
|
+
data: redactExecutionList(executions, runtime.isRedactEnabled())
|
|
1206
|
+
});
|
|
1155
1207
|
});
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1208
|
+
app5.get("/executions/:id", async (c) => {
|
|
1209
|
+
const runtime = c.get("runtime");
|
|
1210
|
+
const id = c.req.param("id");
|
|
1211
|
+
const execution = await runtime.getExecution(id);
|
|
1212
|
+
if (!execution) {
|
|
1213
|
+
return c.json(
|
|
1214
|
+
{ ok: false, error: { code: "NOT_FOUND", message: `Execution "${id}" not found` } },
|
|
1215
|
+
404
|
|
1216
|
+
);
|
|
1217
|
+
}
|
|
1218
|
+
const sinceParam = c.req.query("since");
|
|
1219
|
+
let paged = execution;
|
|
1220
|
+
if (sinceParam !== void 0) {
|
|
1221
|
+
const since = Number(sinceParam);
|
|
1222
|
+
if (!Number.isFinite(since) || !Number.isInteger(since)) {
|
|
1223
|
+
return c.json(
|
|
1224
|
+
{
|
|
1225
|
+
ok: false,
|
|
1226
|
+
error: {
|
|
1227
|
+
code: "INVALID_PARAM",
|
|
1228
|
+
message: `\`since\` must be a finite integer (got "${sinceParam}")`,
|
|
1229
|
+
param: "since"
|
|
1230
|
+
}
|
|
1231
|
+
},
|
|
1232
|
+
400
|
|
1233
|
+
);
|
|
1234
|
+
}
|
|
1235
|
+
paged = {
|
|
1236
|
+
...execution,
|
|
1237
|
+
events: execution.events.filter((e) => e.step > since)
|
|
1238
|
+
};
|
|
1239
|
+
}
|
|
1240
|
+
return c.json({
|
|
1241
|
+
ok: true,
|
|
1242
|
+
data: redactExecutionInfo(paged, runtime.isRedactEnabled())
|
|
1243
|
+
});
|
|
1244
|
+
});
|
|
1245
|
+
app5.post("/executions/:id/abort", (c) => {
|
|
1246
|
+
const runtime = c.get("runtime");
|
|
1247
|
+
const id = c.req.param("id");
|
|
1248
|
+
runtime.abort(id);
|
|
1249
|
+
return c.json({ ok: true, data: { aborted: true } });
|
|
1250
|
+
});
|
|
1251
|
+
app5.delete("/executions/:id", async (c) => {
|
|
1252
|
+
const runtime = c.get("runtime");
|
|
1253
|
+
const id = c.req.param("id");
|
|
1254
|
+
const deleted = await runtime.deleteExecution(id);
|
|
1255
|
+
if (!deleted) {
|
|
1172
1256
|
return c.json(
|
|
1173
1257
|
{
|
|
1174
1258
|
ok: false,
|
|
1175
|
-
error: {
|
|
1176
|
-
code: "INVALID_PARAM",
|
|
1177
|
-
message: `\`since\` must be a finite integer (got "${sinceParam}")`,
|
|
1178
|
-
param: "since"
|
|
1179
|
-
}
|
|
1259
|
+
error: { code: "NOT_FOUND", message: `Execution "${id}" not found` }
|
|
1180
1260
|
},
|
|
1181
|
-
|
|
1261
|
+
404
|
|
1182
1262
|
);
|
|
1183
1263
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
events: execution.events.filter((e) => e.step > since)
|
|
1187
|
-
};
|
|
1188
|
-
}
|
|
1189
|
-
return c.json({
|
|
1190
|
-
ok: true,
|
|
1191
|
-
data: redactExecutionInfo(paged, runtime.isRedactEnabled())
|
|
1264
|
+
connMgr?.clearChannelBuffer(`execution:${id}`);
|
|
1265
|
+
return c.json({ ok: true, data: { id, deleted: true } });
|
|
1192
1266
|
});
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
const id = c.req.param("id");
|
|
1197
|
-
runtime.abort(id);
|
|
1198
|
-
return c.json({ ok: true, data: { aborted: true } });
|
|
1199
|
-
});
|
|
1200
|
-
var executions_default = app;
|
|
1267
|
+
return app5;
|
|
1268
|
+
}
|
|
1269
|
+
var executions_default = createExecutionRoutes();
|
|
1201
1270
|
|
|
1202
1271
|
// src/server/routes/sessions.ts
|
|
1203
1272
|
import { Hono as Hono4 } from "hono";
|
|
1204
1273
|
function createSessionRoutes(connMgr) {
|
|
1205
|
-
const
|
|
1206
|
-
|
|
1274
|
+
const app5 = new Hono4();
|
|
1275
|
+
app5.get("/sessions", async (c) => {
|
|
1207
1276
|
const runtime = c.get("runtime");
|
|
1208
1277
|
const store = runtime.getStateStore();
|
|
1209
1278
|
if (!store.listSessions) {
|
|
@@ -1217,7 +1286,7 @@ function createSessionRoutes(connMgr) {
|
|
|
1217
1286
|
}
|
|
1218
1287
|
return c.json({ ok: true, data: sessions });
|
|
1219
1288
|
});
|
|
1220
|
-
|
|
1289
|
+
app5.get("/sessions/:id", async (c) => {
|
|
1221
1290
|
const runtime = c.get("runtime");
|
|
1222
1291
|
const store = runtime.getStateStore();
|
|
1223
1292
|
const id = c.req.param("id");
|
|
@@ -1234,7 +1303,7 @@ function createSessionRoutes(connMgr) {
|
|
|
1234
1303
|
}
|
|
1235
1304
|
});
|
|
1236
1305
|
});
|
|
1237
|
-
|
|
1306
|
+
app5.post("/sessions/:id/send", async (c) => {
|
|
1238
1307
|
const runtime = c.get("runtime");
|
|
1239
1308
|
const id = c.req.param("id");
|
|
1240
1309
|
const body = await c.req.json();
|
|
@@ -1242,7 +1311,7 @@ function createSessionRoutes(connMgr) {
|
|
|
1242
1311
|
const result = await session.send(body.workflow, body.message);
|
|
1243
1312
|
return c.json({ ok: true, data: { result } });
|
|
1244
1313
|
});
|
|
1245
|
-
|
|
1314
|
+
app5.post("/sessions/:id/stream", async (c) => {
|
|
1246
1315
|
const runtime = c.get("runtime");
|
|
1247
1316
|
const id = c.req.param("id");
|
|
1248
1317
|
const body = await c.req.json();
|
|
@@ -1256,21 +1325,21 @@ function createSessionRoutes(connMgr) {
|
|
|
1256
1325
|
})();
|
|
1257
1326
|
return c.json({ ok: true, data: { executionId, streaming: true } });
|
|
1258
1327
|
});
|
|
1259
|
-
|
|
1328
|
+
app5.delete("/sessions/:id", async (c) => {
|
|
1260
1329
|
const runtime = c.get("runtime");
|
|
1261
1330
|
const store = runtime.getStateStore();
|
|
1262
1331
|
const id = c.req.param("id");
|
|
1263
1332
|
await store.deleteSession(id);
|
|
1264
1333
|
return c.json({ ok: true, data: { deleted: true } });
|
|
1265
1334
|
});
|
|
1266
|
-
return
|
|
1335
|
+
return app5;
|
|
1267
1336
|
}
|
|
1268
1337
|
|
|
1269
1338
|
// src/server/routes/agents.ts
|
|
1270
1339
|
import { Hono as Hono5 } from "hono";
|
|
1271
1340
|
import { zodToJsonSchema as zodToJsonSchema2 } from "@axlsdk/axl";
|
|
1272
|
-
var
|
|
1273
|
-
|
|
1341
|
+
var app = new Hono5();
|
|
1342
|
+
app.get("/agents", (c) => {
|
|
1274
1343
|
const runtime = c.get("runtime");
|
|
1275
1344
|
const agents = runtime.getAgents().map((a) => ({
|
|
1276
1345
|
name: a._name,
|
|
@@ -1289,7 +1358,7 @@ app2.get("/agents", (c) => {
|
|
|
1289
1358
|
}));
|
|
1290
1359
|
return c.json({ ok: true, data: agents });
|
|
1291
1360
|
});
|
|
1292
|
-
|
|
1361
|
+
app.get("/agents/:name", (c) => {
|
|
1293
1362
|
const runtime = c.get("runtime");
|
|
1294
1363
|
const name = c.req.param("name");
|
|
1295
1364
|
const agent = runtime.getAgent(name);
|
|
@@ -1345,13 +1414,13 @@ app2.get("/agents/:name", (c) => {
|
|
|
1345
1414
|
}
|
|
1346
1415
|
});
|
|
1347
1416
|
});
|
|
1348
|
-
var agents_default =
|
|
1417
|
+
var agents_default = app;
|
|
1349
1418
|
|
|
1350
1419
|
// src/server/routes/tools.ts
|
|
1351
1420
|
import { Hono as Hono6 } from "hono";
|
|
1352
1421
|
import { zodToJsonSchema as zodToJsonSchema3 } from "@axlsdk/axl";
|
|
1353
|
-
var
|
|
1354
|
-
|
|
1422
|
+
var app2 = new Hono6();
|
|
1423
|
+
app2.get("/tools", (c) => {
|
|
1355
1424
|
const runtime = c.get("runtime");
|
|
1356
1425
|
const tools = runtime.getTools().map((t) => ({
|
|
1357
1426
|
name: t.name,
|
|
@@ -1362,7 +1431,7 @@ app3.get("/tools", (c) => {
|
|
|
1362
1431
|
}));
|
|
1363
1432
|
return c.json({ ok: true, data: tools });
|
|
1364
1433
|
});
|
|
1365
|
-
|
|
1434
|
+
app2.get("/tools/:name", (c) => {
|
|
1366
1435
|
const runtime = c.get("runtime");
|
|
1367
1436
|
const name = c.req.param("name");
|
|
1368
1437
|
const tool = runtime.getTool(name);
|
|
@@ -1389,7 +1458,7 @@ app3.get("/tools/:name", (c) => {
|
|
|
1389
1458
|
}
|
|
1390
1459
|
});
|
|
1391
1460
|
});
|
|
1392
|
-
|
|
1461
|
+
app2.post("/tools/:name/test", async (c) => {
|
|
1393
1462
|
const runtime = c.get("runtime");
|
|
1394
1463
|
const name = c.req.param("name");
|
|
1395
1464
|
const tool = runtime.getTool(name);
|
|
@@ -1407,12 +1476,12 @@ app3.post("/tools/:name/test", async (c) => {
|
|
|
1407
1476
|
data: { result: redactValue(result, runtime.isRedactEnabled()) }
|
|
1408
1477
|
});
|
|
1409
1478
|
});
|
|
1410
|
-
var tools_default =
|
|
1479
|
+
var tools_default = app2;
|
|
1411
1480
|
|
|
1412
1481
|
// src/server/routes/memory.ts
|
|
1413
1482
|
import { Hono as Hono7 } from "hono";
|
|
1414
|
-
var
|
|
1415
|
-
|
|
1483
|
+
var app3 = new Hono7();
|
|
1484
|
+
app3.get("/memory/:scope", async (c) => {
|
|
1416
1485
|
const runtime = c.get("runtime");
|
|
1417
1486
|
const store = runtime.getStateStore();
|
|
1418
1487
|
const scope = c.req.param("scope");
|
|
@@ -1422,7 +1491,7 @@ app4.get("/memory/:scope", async (c) => {
|
|
|
1422
1491
|
const entries = await store.getAllMemory(scope);
|
|
1423
1492
|
return c.json({ ok: true, data: redactMemoryList(entries, runtime.isRedactEnabled()) });
|
|
1424
1493
|
});
|
|
1425
|
-
|
|
1494
|
+
app3.get("/memory/:scope/:key", async (c) => {
|
|
1426
1495
|
const runtime = c.get("runtime");
|
|
1427
1496
|
const store = runtime.getStateStore();
|
|
1428
1497
|
const scope = c.req.param("scope");
|
|
@@ -1445,7 +1514,7 @@ app4.get("/memory/:scope/:key", async (c) => {
|
|
|
1445
1514
|
data: { key, value: redactMemoryValue(value, runtime.isRedactEnabled()) }
|
|
1446
1515
|
});
|
|
1447
1516
|
});
|
|
1448
|
-
|
|
1517
|
+
app3.put("/memory/:scope/:key", async (c) => {
|
|
1449
1518
|
const runtime = c.get("runtime");
|
|
1450
1519
|
const store = runtime.getStateStore();
|
|
1451
1520
|
const scope = c.req.param("scope");
|
|
@@ -1460,7 +1529,7 @@ app4.put("/memory/:scope/:key", async (c) => {
|
|
|
1460
1529
|
await store.saveMemory(scope, key, body.value);
|
|
1461
1530
|
return c.json({ ok: true, data: { saved: true } });
|
|
1462
1531
|
});
|
|
1463
|
-
|
|
1532
|
+
app3.delete("/memory/:scope/:key", async (c) => {
|
|
1464
1533
|
const runtime = c.get("runtime");
|
|
1465
1534
|
const store = runtime.getStateStore();
|
|
1466
1535
|
const scope = c.req.param("scope");
|
|
@@ -1474,18 +1543,18 @@ app4.delete("/memory/:scope/:key", async (c) => {
|
|
|
1474
1543
|
await store.deleteMemory(scope, key);
|
|
1475
1544
|
return c.json({ ok: true, data: { deleted: true } });
|
|
1476
1545
|
});
|
|
1477
|
-
|
|
1546
|
+
app3.post("/memory/search", async (c) => {
|
|
1478
1547
|
return c.json({
|
|
1479
1548
|
ok: true,
|
|
1480
1549
|
data: { results: [], message: "Semantic search requires MemoryManager with vector store" }
|
|
1481
1550
|
});
|
|
1482
1551
|
});
|
|
1483
|
-
var memory_default =
|
|
1552
|
+
var memory_default = app3;
|
|
1484
1553
|
|
|
1485
1554
|
// src/server/routes/decisions.ts
|
|
1486
1555
|
import { Hono as Hono8 } from "hono";
|
|
1487
|
-
var
|
|
1488
|
-
|
|
1556
|
+
var app4 = new Hono8();
|
|
1557
|
+
app4.get("/decisions", async (c) => {
|
|
1489
1558
|
const runtime = c.get("runtime");
|
|
1490
1559
|
const decisions = await runtime.getPendingDecisions();
|
|
1491
1560
|
return c.json({
|
|
@@ -1493,27 +1562,27 @@ app5.get("/decisions", async (c) => {
|
|
|
1493
1562
|
data: redactPendingDecisionList(decisions, runtime.isRedactEnabled())
|
|
1494
1563
|
});
|
|
1495
1564
|
});
|
|
1496
|
-
|
|
1565
|
+
app4.post("/decisions/:executionId/resolve", async (c) => {
|
|
1497
1566
|
const runtime = c.get("runtime");
|
|
1498
1567
|
const executionId = c.req.param("executionId");
|
|
1499
1568
|
const body = await c.req.json();
|
|
1500
1569
|
await runtime.resolveDecision(executionId, body);
|
|
1501
1570
|
return c.json({ ok: true, data: { resolved: true } });
|
|
1502
1571
|
});
|
|
1503
|
-
var decisions_default =
|
|
1572
|
+
var decisions_default = app4;
|
|
1504
1573
|
|
|
1505
1574
|
// src/server/routes/costs.ts
|
|
1506
1575
|
import { Hono as Hono9 } from "hono";
|
|
1507
1576
|
function createCostRoutes(costAggregator) {
|
|
1508
|
-
const
|
|
1509
|
-
|
|
1577
|
+
const app5 = new Hono9();
|
|
1578
|
+
app5.get("/costs", (c) => {
|
|
1510
1579
|
if (c.req.query("windows") === "all") {
|
|
1511
1580
|
return c.json({ ok: true, data: costAggregator.getAllSnapshots() });
|
|
1512
1581
|
}
|
|
1513
1582
|
const window = parseWindowParam(c.req.query("window"));
|
|
1514
1583
|
return c.json({ ok: true, data: costAggregator.getSnapshot(window) });
|
|
1515
1584
|
});
|
|
1516
|
-
|
|
1585
|
+
app5.post("/costs/reset", (c) => {
|
|
1517
1586
|
return c.json(
|
|
1518
1587
|
{
|
|
1519
1588
|
ok: false,
|
|
@@ -1525,22 +1594,22 @@ function createCostRoutes(costAggregator) {
|
|
|
1525
1594
|
410
|
|
1526
1595
|
);
|
|
1527
1596
|
});
|
|
1528
|
-
return
|
|
1597
|
+
return app5;
|
|
1529
1598
|
}
|
|
1530
1599
|
|
|
1531
1600
|
// src/server/routes/evals.ts
|
|
1532
1601
|
import { randomUUID } from "crypto";
|
|
1533
1602
|
import { Hono as Hono10 } from "hono";
|
|
1534
1603
|
function createEvalRoutes(connMgr, evalLoader) {
|
|
1535
|
-
const
|
|
1604
|
+
const app5 = new Hono10();
|
|
1536
1605
|
const activeRuns = /* @__PURE__ */ new Map();
|
|
1537
|
-
|
|
1606
|
+
app5.get("/evals", async (c) => {
|
|
1538
1607
|
if (evalLoader) await evalLoader();
|
|
1539
1608
|
const runtime = c.get("runtime");
|
|
1540
1609
|
const evals = runtime.getRegisteredEvals();
|
|
1541
1610
|
return c.json({ ok: true, data: evals });
|
|
1542
1611
|
});
|
|
1543
|
-
|
|
1612
|
+
app5.get("/evals/history", async (c) => {
|
|
1544
1613
|
const runtime = c.get("runtime");
|
|
1545
1614
|
const history = await runtime.getEvalHistory();
|
|
1546
1615
|
return c.json({
|
|
@@ -1548,7 +1617,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1548
1617
|
data: redactEvalHistoryList(history, runtime.isRedactEnabled())
|
|
1549
1618
|
});
|
|
1550
1619
|
});
|
|
1551
|
-
|
|
1620
|
+
app5.delete("/evals/history/:id", async (c) => {
|
|
1552
1621
|
const runtime = c.get("runtime");
|
|
1553
1622
|
const id = c.req.param("id");
|
|
1554
1623
|
const deleted = await runtime.deleteEvalResult(id);
|
|
@@ -1563,7 +1632,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1563
1632
|
}
|
|
1564
1633
|
return c.json({ ok: true, data: { id, deleted: true } });
|
|
1565
1634
|
});
|
|
1566
|
-
|
|
1635
|
+
app5.post("/evals/:name/run", async (c) => {
|
|
1567
1636
|
if (evalLoader) await evalLoader();
|
|
1568
1637
|
const runtime = c.get("runtime");
|
|
1569
1638
|
const name = c.req.param("name");
|
|
@@ -1761,7 +1830,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1761
1830
|
);
|
|
1762
1831
|
}
|
|
1763
1832
|
});
|
|
1764
|
-
|
|
1833
|
+
app5.post("/evals/runs/:evalRunId/cancel", (c) => {
|
|
1765
1834
|
const evalRunId = c.req.param("evalRunId");
|
|
1766
1835
|
const ac = activeRuns.get(evalRunId);
|
|
1767
1836
|
if (!ac) {
|
|
@@ -1774,7 +1843,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1774
1843
|
activeRuns.delete(evalRunId);
|
|
1775
1844
|
return c.json({ ok: true, data: { cancelled: true } });
|
|
1776
1845
|
});
|
|
1777
|
-
|
|
1846
|
+
app5.post("/evals/:name/rescore", async (c) => {
|
|
1778
1847
|
if (evalLoader) await evalLoader();
|
|
1779
1848
|
const runtime = c.get("runtime");
|
|
1780
1849
|
const redactOn = runtime.isRedactEnabled();
|
|
@@ -1826,7 +1895,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1826
1895
|
);
|
|
1827
1896
|
}
|
|
1828
1897
|
});
|
|
1829
|
-
|
|
1898
|
+
app5.post("/evals/compare", async (c) => {
|
|
1830
1899
|
const runtime = c.get("runtime");
|
|
1831
1900
|
const redactOn = runtime.isRedactEnabled();
|
|
1832
1901
|
const body = await c.req.json();
|
|
@@ -1909,7 +1978,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1909
1978
|
);
|
|
1910
1979
|
}
|
|
1911
1980
|
});
|
|
1912
|
-
|
|
1981
|
+
app5.post("/evals/import", async (c) => {
|
|
1913
1982
|
const runtime = c.get("runtime");
|
|
1914
1983
|
const body = await c.req.json();
|
|
1915
1984
|
const bad = (message) => c.json({ ok: false, error: { code: "BAD_REQUEST", message } }, 400);
|
|
@@ -1987,7 +2056,7 @@ function createEvalRoutes(connMgr, evalLoader) {
|
|
|
1987
2056
|
for (const ac of activeRuns.values()) ac.abort();
|
|
1988
2057
|
activeRuns.clear();
|
|
1989
2058
|
}
|
|
1990
|
-
return { app:
|
|
2059
|
+
return { app: app5, closeActiveRuns };
|
|
1991
2060
|
}
|
|
1992
2061
|
|
|
1993
2062
|
// src/server/routes/playground.ts
|
|
@@ -15771,8 +15840,8 @@ var DEMO_SCHEMA_BY_AGENT = {
|
|
|
15771
15840
|
})
|
|
15772
15841
|
};
|
|
15773
15842
|
function createPlaygroundRoutes(connMgr) {
|
|
15774
|
-
const
|
|
15775
|
-
|
|
15843
|
+
const app5 = new Hono11();
|
|
15844
|
+
app5.post("/playground/chat", async (c) => {
|
|
15776
15845
|
const runtime = c.get("runtime");
|
|
15777
15846
|
const body = await c.req.json();
|
|
15778
15847
|
if (!body.message || typeof body.message !== "string" || !body.message.trim()) {
|
|
@@ -15852,46 +15921,46 @@ function createPlaygroundRoutes(connMgr) {
|
|
|
15852
15921
|
data: { sessionId, executionId, streaming: true }
|
|
15853
15922
|
});
|
|
15854
15923
|
});
|
|
15855
|
-
return
|
|
15924
|
+
return app5;
|
|
15856
15925
|
}
|
|
15857
15926
|
|
|
15858
15927
|
// src/server/routes/eval-trends.ts
|
|
15859
15928
|
import { Hono as Hono12 } from "hono";
|
|
15860
15929
|
function createEvalTrendsRoutes(aggregator) {
|
|
15861
|
-
const
|
|
15862
|
-
|
|
15930
|
+
const app5 = new Hono12();
|
|
15931
|
+
app5.get("/eval-trends", (c) => {
|
|
15863
15932
|
const window = parseWindowParam(c.req.query("window"));
|
|
15864
15933
|
return c.json({ ok: true, data: aggregator.getSnapshot(window) });
|
|
15865
15934
|
});
|
|
15866
|
-
return
|
|
15935
|
+
return app5;
|
|
15867
15936
|
}
|
|
15868
15937
|
|
|
15869
15938
|
// src/server/routes/workflow-stats.ts
|
|
15870
15939
|
import { Hono as Hono13 } from "hono";
|
|
15871
15940
|
function createWorkflowStatsRoutes(aggregator) {
|
|
15872
|
-
const
|
|
15873
|
-
|
|
15941
|
+
const app5 = new Hono13();
|
|
15942
|
+
app5.get("/workflow-stats", (c) => {
|
|
15874
15943
|
const window = parseWindowParam(c.req.query("window"));
|
|
15875
15944
|
return c.json({ ok: true, data: enrichWorkflowStats(aggregator.getSnapshot(window)) });
|
|
15876
15945
|
});
|
|
15877
|
-
return
|
|
15946
|
+
return app5;
|
|
15878
15947
|
}
|
|
15879
15948
|
|
|
15880
15949
|
// src/server/routes/trace-stats.ts
|
|
15881
15950
|
import { Hono as Hono14 } from "hono";
|
|
15882
15951
|
function createTraceStatsRoutes(aggregator) {
|
|
15883
|
-
const
|
|
15884
|
-
|
|
15952
|
+
const app5 = new Hono14();
|
|
15953
|
+
app5.get("/trace-stats", (c) => {
|
|
15885
15954
|
const window = parseWindowParam(c.req.query("window"));
|
|
15886
15955
|
return c.json({ ok: true, data: aggregator.getSnapshot(window) });
|
|
15887
15956
|
});
|
|
15888
|
-
return
|
|
15957
|
+
return app5;
|
|
15889
15958
|
}
|
|
15890
15959
|
|
|
15891
15960
|
// src/server/index.ts
|
|
15892
15961
|
function createServer(options) {
|
|
15893
15962
|
const { runtime, staticRoot, basePath = "", readOnly = false } = options;
|
|
15894
|
-
const
|
|
15963
|
+
const app5 = new Hono15();
|
|
15895
15964
|
const connMgr = new ConnectionManager(options.bufferCaps);
|
|
15896
15965
|
const windows = ["24h", "7d", "30d", "all"];
|
|
15897
15966
|
const costAggregator = new TraceAggregator({
|
|
@@ -15928,10 +15997,10 @@ function createServer(options) {
|
|
|
15928
15997
|
windows
|
|
15929
15998
|
});
|
|
15930
15999
|
if (options.cors !== false) {
|
|
15931
|
-
|
|
16000
|
+
app5.use("*", cors());
|
|
15932
16001
|
}
|
|
15933
|
-
|
|
15934
|
-
|
|
16002
|
+
app5.use("*", errorHandler);
|
|
16003
|
+
app5.use("*", async (c, next) => {
|
|
15935
16004
|
c.set("runtime", runtime);
|
|
15936
16005
|
await next();
|
|
15937
16006
|
});
|
|
@@ -15939,6 +16008,7 @@ function createServer(options) {
|
|
|
15939
16008
|
const blocked = [
|
|
15940
16009
|
/^POST \/api\/workflows(\/|$)/,
|
|
15941
16010
|
/^POST \/api\/executions(\/|$)/,
|
|
16011
|
+
/^DELETE \/api\/executions\/[^/]+$/,
|
|
15942
16012
|
/^POST \/api\/sessions(\/|$)/,
|
|
15943
16013
|
/^DELETE \/api\/sessions(\/|$)/,
|
|
15944
16014
|
/^PUT \/api\/memory(\/|$)/,
|
|
@@ -15952,7 +16022,7 @@ function createServer(options) {
|
|
|
15952
16022
|
/^DELETE \/api\/evals\/history\/[^/]+$/,
|
|
15953
16023
|
/^POST \/api\/playground(\/|$)/
|
|
15954
16024
|
];
|
|
15955
|
-
|
|
16025
|
+
app5.use("/api/*", async (c, next) => {
|
|
15956
16026
|
const apiIdx = c.req.path.indexOf("/api/");
|
|
15957
16027
|
const apiPath = apiIdx >= 0 ? c.req.path.slice(apiIdx) : c.req.path;
|
|
15958
16028
|
const key = `${c.req.method} ${apiPath}`;
|
|
@@ -15971,7 +16041,7 @@ function createServer(options) {
|
|
|
15971
16041
|
const api = new Hono15();
|
|
15972
16042
|
api.route("/", createHealthRoutes(readOnly));
|
|
15973
16043
|
api.route("/", createWorkflowRoutes(connMgr));
|
|
15974
|
-
api.route("/",
|
|
16044
|
+
api.route("/", createExecutionRoutes(connMgr));
|
|
15975
16045
|
api.route("/", createSessionRoutes(connMgr));
|
|
15976
16046
|
api.route("/", agents_default);
|
|
15977
16047
|
api.route("/", tools_default);
|
|
@@ -15984,7 +16054,7 @@ function createServer(options) {
|
|
|
15984
16054
|
const { app: evalApp, closeActiveRuns } = createEvalRoutes(connMgr, options.evalLoader);
|
|
15985
16055
|
api.route("/", evalApp);
|
|
15986
16056
|
api.route("/", createPlaygroundRoutes(connMgr));
|
|
15987
|
-
|
|
16057
|
+
app5.route("/api", api);
|
|
15988
16058
|
const traceListener = (event) => {
|
|
15989
16059
|
try {
|
|
15990
16060
|
const traceEvent = event;
|
|
@@ -16038,7 +16108,7 @@ function createServer(options) {
|
|
|
16038
16108
|
root: staticRoot,
|
|
16039
16109
|
rewriteRequestPath: basePath ? (path) => path.startsWith(basePath) ? path.slice(basePath.length) || "/" : path : void 0
|
|
16040
16110
|
});
|
|
16041
|
-
|
|
16111
|
+
app5.use("/*", async (c, next) => {
|
|
16042
16112
|
const reqPath = c.req.path;
|
|
16043
16113
|
const resolved = basePath && reqPath.startsWith(basePath) ? reqPath.slice(basePath.length) || "/" : reqPath;
|
|
16044
16114
|
if (resolved === "/" || resolved === "/index.html" || resolved === "/ws") {
|
|
@@ -16047,7 +16117,7 @@ function createServer(options) {
|
|
|
16047
16117
|
return staticHandler(c, next);
|
|
16048
16118
|
});
|
|
16049
16119
|
if (spaHtml) {
|
|
16050
|
-
|
|
16120
|
+
app5.get("*", async (c, next) => {
|
|
16051
16121
|
const resolved = basePath && c.req.path.startsWith(basePath) ? c.req.path.slice(basePath.length) || "/" : c.req.path;
|
|
16052
16122
|
if (resolved === "/ws") return next();
|
|
16053
16123
|
return c.html(spaHtml);
|
|
@@ -16055,7 +16125,7 @@ function createServer(options) {
|
|
|
16055
16125
|
}
|
|
16056
16126
|
}
|
|
16057
16127
|
return {
|
|
16058
|
-
app:
|
|
16128
|
+
app: app5,
|
|
16059
16129
|
connMgr,
|
|
16060
16130
|
costAggregator,
|
|
16061
16131
|
workflowStatsAggregator,
|
|
@@ -16085,4 +16155,4 @@ export {
|
|
|
16085
16155
|
EvalAggregator,
|
|
16086
16156
|
createServer
|
|
16087
16157
|
};
|
|
16088
|
-
//# sourceMappingURL=chunk-
|
|
16158
|
+
//# sourceMappingURL=chunk-WUCCIBQ6.js.map
|