@axlsdk/studio 0.10.0 → 0.10.1

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/dist/cli.cjs CHANGED
@@ -308,8 +308,8 @@ var health_default = app;
308
308
  var import_hono2 = require("hono");
309
309
  var import_axl = require("@axlsdk/axl");
310
310
  function createWorkflowRoutes(connMgr) {
311
- const app8 = new import_hono2.Hono();
312
- app8.get("/workflows", (c) => {
311
+ const app7 = new import_hono2.Hono();
312
+ app7.get("/workflows", (c) => {
313
313
  const runtime = c.get("runtime");
314
314
  const workflows = runtime.getWorkflows().map((w) => ({
315
315
  name: w.name,
@@ -318,7 +318,7 @@ function createWorkflowRoutes(connMgr) {
318
318
  }));
319
319
  return c.json({ ok: true, data: workflows });
320
320
  });
321
- app8.get("/workflows/:name", (c) => {
321
+ app7.get("/workflows/:name", (c) => {
322
322
  const runtime = c.get("runtime");
323
323
  const name = c.req.param("name");
324
324
  const workflow = runtime.getWorkflow(name);
@@ -337,7 +337,7 @@ function createWorkflowRoutes(connMgr) {
337
337
  }
338
338
  });
339
339
  });
340
- app8.post("/workflows/:name/execute", async (c) => {
340
+ app7.post("/workflows/:name/execute", async (c) => {
341
341
  const runtime = c.get("runtime");
342
342
  const name = c.req.param("name");
343
343
  const workflow = runtime.getWorkflow(name);
@@ -368,7 +368,7 @@ function createWorkflowRoutes(connMgr) {
368
368
  const result = await runtime.execute(name, body.input ?? {}, { metadata: body.metadata });
369
369
  return c.json({ ok: true, data: { result } });
370
370
  });
371
- return app8;
371
+ return app7;
372
372
  }
373
373
 
374
374
  // src/server/routes/executions.ts
@@ -402,8 +402,8 @@ var executions_default = app2;
402
402
  // src/server/routes/sessions.ts
403
403
  var import_hono4 = require("hono");
404
404
  function createSessionRoutes(connMgr) {
405
- const app8 = new import_hono4.Hono();
406
- app8.get("/sessions", async (c) => {
405
+ const app7 = new import_hono4.Hono();
406
+ app7.get("/sessions", async (c) => {
407
407
  const runtime = c.get("runtime");
408
408
  const store = runtime.getStateStore();
409
409
  if (!store.listSessions) {
@@ -417,7 +417,7 @@ function createSessionRoutes(connMgr) {
417
417
  }
418
418
  return c.json({ ok: true, data: sessions });
419
419
  });
420
- app8.get("/sessions/:id", async (c) => {
420
+ app7.get("/sessions/:id", async (c) => {
421
421
  const runtime = c.get("runtime");
422
422
  const store = runtime.getStateStore();
423
423
  const id = c.req.param("id");
@@ -425,7 +425,7 @@ function createSessionRoutes(connMgr) {
425
425
  const handoffHistory = await store.getSessionMeta(id, "handoffHistory");
426
426
  return c.json({ ok: true, data: { id, history, handoffHistory: handoffHistory ?? [] } });
427
427
  });
428
- app8.post("/sessions/:id/send", async (c) => {
428
+ app7.post("/sessions/:id/send", async (c) => {
429
429
  const runtime = c.get("runtime");
430
430
  const id = c.req.param("id");
431
431
  const body = await c.req.json();
@@ -433,7 +433,7 @@ function createSessionRoutes(connMgr) {
433
433
  const result = await session.send(body.workflow, body.message);
434
434
  return c.json({ ok: true, data: { result } });
435
435
  });
436
- app8.post("/sessions/:id/stream", async (c) => {
436
+ app7.post("/sessions/:id/stream", async (c) => {
437
437
  const runtime = c.get("runtime");
438
438
  const id = c.req.param("id");
439
439
  const body = await c.req.json();
@@ -454,14 +454,14 @@ function createSessionRoutes(connMgr) {
454
454
  })();
455
455
  return c.json({ ok: true, data: { executionId, streaming: true } });
456
456
  });
457
- app8.delete("/sessions/:id", async (c) => {
457
+ app7.delete("/sessions/:id", async (c) => {
458
458
  const runtime = c.get("runtime");
459
459
  const store = runtime.getStateStore();
460
460
  const id = c.req.param("id");
461
461
  await store.deleteSession(id);
462
462
  return c.json({ ok: true, data: { deleted: true } });
463
463
  });
464
- return app8;
464
+ return app7;
465
465
  }
466
466
 
467
467
  // src/server/routes/agents.ts
@@ -694,61 +694,65 @@ var decisions_default = app6;
694
694
  // src/server/routes/costs.ts
695
695
  var import_hono9 = require("hono");
696
696
  function createCostRoutes(costAggregator) {
697
- const app8 = new import_hono9.Hono();
698
- app8.get("/costs", (c) => {
697
+ const app7 = new import_hono9.Hono();
698
+ app7.get("/costs", (c) => {
699
699
  return c.json({ ok: true, data: costAggregator.getData() });
700
700
  });
701
- app8.post("/costs/reset", (c) => {
701
+ app7.post("/costs/reset", (c) => {
702
702
  costAggregator.reset();
703
703
  return c.json({ ok: true, data: { reset: true } });
704
704
  });
705
- return app8;
705
+ return app7;
706
706
  }
707
707
 
708
708
  // src/server/routes/evals.ts
709
709
  var import_hono10 = require("hono");
710
- var app7 = new import_hono10.Hono();
711
- app7.get("/evals", async (c) => {
712
- const runtime = c.get("runtime");
713
- const evals = runtime.getRegisteredEvals();
714
- return c.json({ ok: true, data: evals });
715
- });
716
- app7.post("/evals/:name/run", async (c) => {
717
- const runtime = c.get("runtime");
718
- const name = c.req.param("name");
719
- const entry = runtime.getRegisteredEval(name);
720
- if (!entry) {
721
- return c.json(
722
- { ok: false, error: { code: "NOT_FOUND", message: `Eval "${name}" not found` } },
723
- 404
724
- );
725
- }
726
- try {
727
- const result = await runtime.runRegisteredEval(name);
728
- return c.json({ ok: true, data: result });
729
- } catch (err) {
730
- const message = err instanceof Error ? err.message : String(err);
731
- return c.json({ ok: false, error: { code: "EVAL_ERROR", message } }, 400);
732
- }
733
- });
734
- app7.post("/evals/compare", async (c) => {
735
- const runtime = c.get("runtime");
736
- const body = await c.req.json();
737
- try {
738
- const result = await runtime.evalCompare(body.baseline, body.candidate);
739
- return c.json({ ok: true, data: result });
740
- } catch (err) {
741
- const message = err instanceof Error ? err.message : String(err);
742
- return c.json({ ok: false, error: { code: "EVAL_ERROR", message } }, 400);
743
- }
744
- });
745
- var evals_default = app7;
710
+ function createEvalRoutes(evalLoader) {
711
+ const app7 = new import_hono10.Hono();
712
+ app7.get("/evals", async (c) => {
713
+ if (evalLoader) await evalLoader();
714
+ const runtime = c.get("runtime");
715
+ const evals = runtime.getRegisteredEvals();
716
+ return c.json({ ok: true, data: evals });
717
+ });
718
+ app7.post("/evals/:name/run", async (c) => {
719
+ if (evalLoader) await evalLoader();
720
+ const runtime = c.get("runtime");
721
+ const name = c.req.param("name");
722
+ const entry = runtime.getRegisteredEval(name);
723
+ if (!entry) {
724
+ return c.json(
725
+ { ok: false, error: { code: "NOT_FOUND", message: `Eval "${name}" not found` } },
726
+ 404
727
+ );
728
+ }
729
+ try {
730
+ const result = await runtime.runRegisteredEval(name);
731
+ return c.json({ ok: true, data: result });
732
+ } catch (err) {
733
+ const message = err instanceof Error ? err.message : String(err);
734
+ return c.json({ ok: false, error: { code: "EVAL_ERROR", message } }, 400);
735
+ }
736
+ });
737
+ app7.post("/evals/compare", async (c) => {
738
+ const runtime = c.get("runtime");
739
+ const body = await c.req.json();
740
+ try {
741
+ const result = await runtime.evalCompare(body.baseline, body.candidate);
742
+ return c.json({ ok: true, data: result });
743
+ } catch (err) {
744
+ const message = err instanceof Error ? err.message : String(err);
745
+ return c.json({ ok: false, error: { code: "EVAL_ERROR", message } }, 400);
746
+ }
747
+ });
748
+ return app7;
749
+ }
746
750
 
747
751
  // src/server/routes/playground.ts
748
752
  var import_hono11 = require("hono");
749
753
  function createPlaygroundRoutes(connMgr) {
750
- const app8 = new import_hono11.Hono();
751
- app8.post("/playground/chat", async (c) => {
754
+ const app7 = new import_hono11.Hono();
755
+ app7.post("/playground/chat", async (c) => {
752
756
  const runtime = c.get("runtime");
753
757
  const body = await c.req.json();
754
758
  const workflowName = body.workflow ?? runtime.getWorkflowNames()[0];
@@ -779,20 +783,20 @@ function createPlaygroundRoutes(connMgr) {
779
783
  data: { sessionId, executionId, streaming: true }
780
784
  });
781
785
  });
782
- return app8;
786
+ return app7;
783
787
  }
784
788
 
785
789
  // src/server/index.ts
786
790
  function createServer(options) {
787
791
  const { runtime, staticRoot, basePath = "", readOnly = false } = options;
788
- const app8 = new import_hono12.Hono();
792
+ const app7 = new import_hono12.Hono();
789
793
  const connMgr = new ConnectionManager();
790
794
  const costAggregator = new CostAggregator(connMgr);
791
795
  if (options.cors !== false) {
792
- app8.use("*", (0, import_cors.cors)());
796
+ app7.use("*", (0, import_cors.cors)());
793
797
  }
794
- app8.use("*", errorHandler);
795
- app8.use("*", async (c, next) => {
798
+ app7.use("*", errorHandler);
799
+ app7.use("*", async (c, next) => {
796
800
  c.set("runtime", runtime);
797
801
  await next();
798
802
  });
@@ -810,7 +814,7 @@ function createServer(options) {
810
814
  "POST /api/evals",
811
815
  "POST /api/playground"
812
816
  ];
813
- app8.use("/api/*", async (c, next) => {
817
+ app7.use("/api/*", async (c, next) => {
814
818
  const apiIdx = c.req.path.indexOf("/api/");
815
819
  const apiPath = apiIdx >= 0 ? c.req.path.slice(apiIdx) : c.req.path;
816
820
  const key = `${c.req.method} ${apiPath}`;
@@ -836,9 +840,9 @@ function createServer(options) {
836
840
  api.route("/", memory_default);
837
841
  api.route("/", decisions_default);
838
842
  api.route("/", createCostRoutes(costAggregator));
839
- api.route("/", evals_default);
843
+ api.route("/", createEvalRoutes(options.evalLoader));
840
844
  api.route("/", createPlaygroundRoutes(connMgr));
841
- app8.route("/api", api);
845
+ app7.route("/api", api);
842
846
  const traceListener = (event) => {
843
847
  const traceEvent = event;
844
848
  if (traceEvent.executionId) {
@@ -851,7 +855,7 @@ function createServer(options) {
851
855
  };
852
856
  runtime.on("trace", traceListener);
853
857
  if (staticRoot) {
854
- app8.use(
858
+ app7.use(
855
859
  "/*",
856
860
  (0, import_serve_static.serveStatic)({
857
861
  root: staticRoot,
@@ -876,14 +880,14 @@ function createServer(options) {
876
880
  "[axl-studio] Could not inject basePath into index.html \u2014 </head> tag not found. The SPA may not route correctly."
877
881
  );
878
882
  }
879
- app8.get("*", (c) => c.html(injectedHtml));
883
+ app7.get("*", (c) => c.html(injectedHtml));
880
884
  }
881
885
  } else {
882
- app8.get("*", (0, import_serve_static.serveStatic)({ root: staticRoot, path: "/index.html" }));
886
+ app7.get("*", (0, import_serve_static.serveStatic)({ root: staticRoot, path: "/index.html" }));
883
887
  }
884
888
  }
885
889
  return {
886
- app: app8,
890
+ app: app7,
887
891
  connMgr,
888
892
  costAggregator,
889
893
  createWsHandlers: () => createWsHandlers(connMgr),
@@ -1089,19 +1093,19 @@ Tip: Use .mts for configs with top-level await or in projects without "type": "m
1089
1093
  }
1090
1094
  const staticRoot = (0, import_node_path3.resolve)(import_meta.dirname ?? __dirname, "client");
1091
1095
  const hasStaticAssets = (0, import_node_fs3.existsSync)((0, import_node_path3.resolve)(staticRoot, "index.html"));
1092
- const { app: app8, createWsHandlers: createWsHandlers2 } = createServer({
1096
+ const { app: app7, createWsHandlers: createWsHandlers2 } = createServer({
1093
1097
  runtime,
1094
1098
  staticRoot: hasStaticAssets ? staticRoot : void 0
1095
1099
  });
1096
- const { injectWebSocket, upgradeWebSocket } = (0, import_node_ws.createNodeWebSocket)({ app: app8 });
1100
+ const { injectWebSocket, upgradeWebSocket } = (0, import_node_ws.createNodeWebSocket)({ app: app7 });
1097
1101
  const wsHandlers = createWsHandlers2();
1098
- app8.get(
1102
+ app7.get(
1099
1103
  "/ws",
1100
1104
  upgradeWebSocket(() => wsHandlers)
1101
1105
  );
1102
1106
  const server = (0, import_node_server.serve)(
1103
1107
  {
1104
- fetch: app8.fetch,
1108
+ fetch: app7.fetch,
1105
1109
  port: args.port
1106
1110
  },
1107
1111
  (info) => {