@anvia/studio 0.4.0 → 0.5.0

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 CHANGED
@@ -41,7 +41,7 @@ new Studio([agent]).start({
41
41
  Then open:
42
42
 
43
43
  ```txt
44
- http://localhost:4021/playground
44
+ http://localhost:4021/ui/playground
45
45
  ```
46
46
 
47
47
  ## Browser UI
package/dist/index.d.ts CHANGED
@@ -1,5 +1,11 @@
1
1
  import { Hono } from 'hono';
2
- import { Message, JsonObject, AgentTraceOptions, PromptResponse, AgentStreamEvent, JsonValue, Agent, Pipeline, RunEvalSuiteOptions, MemoryStore, ToolResultContent, Usage, AgentTraceInfo, PipelineGraph, AgentObserver, AgentRunStartArgs, AgentRunObserver } from '@anvia/core';
2
+ import { AgentTraceOptions, AgentTraceInfo, AgentObserver, AgentRunStartArgs, AgentRunObserver } from '@anvia/core/observability';
3
+ import { PromptResponse, AgentStreamEvent } from '@anvia/core/agent';
4
+ import { Message, JsonObject, JsonValue, ToolResultContent, Usage } from '@anvia/core/completion';
5
+ import { RunEvalSuiteOptions } from '@anvia/core/evals';
6
+ import { Agent } from '@anvia/core/internal/agent';
7
+ import { MemoryStore } from '@anvia/core/memory';
8
+ import { Pipeline, PipelineGraph } from '@anvia/core/pipeline';
3
9
 
4
10
  type StudioCapability = "agents" | "approvals" | "evals" | "memory" | "knowledge" | "mcps" | "observability" | "pipelines" | "sessions" | "status" | "tools" | "traces";
5
11
  type StudioAgent = {
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  // src/runtime/studio.ts
2
2
  import {
3
- Agent,
4
- createHook as createHook3,
5
- Message,
6
- Pipeline,
7
- resolveMemoryOptions
8
- } from "@anvia/core";
3
+ createHook as createHook3
4
+ } from "@anvia/core/agent";
5
+ import { Message } from "@anvia/core/completion";
6
+ import { Agent } from "@anvia/core/internal/agent";
7
+ import { resolveMemoryOptions } from "@anvia/core/memory";
8
+ import { Pipeline } from "@anvia/core/pipeline";
9
9
  import { serve } from "@hono/node-server";
10
10
  import { Hono as HonoApp } from "hono";
11
11
 
@@ -589,6 +589,7 @@ function registerStudioUi(app, options) {
589
589
  app.get(`${options.path}/tools`, async (c) => c.html(await renderShell()));
590
590
  app.get(`${options.path}/mcps`, async (c) => c.html(await renderShell()));
591
591
  app.get(`${options.path}/pipelines`, async (c) => c.html(await renderShell()));
592
+ app.get(`${options.path}/evals`, async (c) => c.html(await renderShell()));
592
593
  app.get(`${options.path}/memory`, async (c) => c.html(await renderShell()));
593
594
  app.get(`${options.path}/status`, async (c) => c.html(await renderShell()));
594
595
  app.get(`${options.path}/knowledge`, async (c) => c.html(await renderShell()));
@@ -696,7 +697,7 @@ function normalizeUiPath(path) {
696
697
  return withoutTrailingSlash;
697
698
  }
698
699
  function studioUiEntryPath(options) {
699
- return options.rootRoutes ? "/playground" : options.path;
700
+ return `${options.path}/playground`;
700
701
  }
701
702
  async function readBundledUiIndex() {
702
703
  try {
@@ -790,7 +791,12 @@ function escapeHtml(value) {
790
791
  }
791
792
 
792
793
  // src/runtime/approvals.ts
793
- import { createHook, parseToolArgs } from "@anvia/core";
794
+ import {
795
+ createHook
796
+ } from "@anvia/core/agent";
797
+ import {
798
+ parseToolArgs
799
+ } from "@anvia/core/tool";
794
800
 
795
801
  // src/storage/memory-store.ts
796
802
  function createInMemoryStudioStore() {
@@ -2179,6 +2185,9 @@ function formatJson(value) {
2179
2185
 
2180
2186
  // src/runtime/json.ts
2181
2187
  function toJsonValue2(value) {
2188
+ return toJsonValueInternal(value, /* @__PURE__ */ new WeakSet());
2189
+ }
2190
+ function toJsonValueInternal(value, seen) {
2182
2191
  if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
2183
2192
  return value;
2184
2193
  }
@@ -2186,16 +2195,35 @@ function toJsonValue2(value) {
2186
2195
  return null;
2187
2196
  }
2188
2197
  if (Array.isArray(value)) {
2189
- return value.map((item) => toJsonValue2(item));
2198
+ if (seen.has(value)) {
2199
+ return "[Circular]";
2200
+ }
2201
+ seen.add(value);
2202
+ try {
2203
+ return value.map((item) => toJsonValueInternal(item, seen));
2204
+ } finally {
2205
+ seen.delete(value);
2206
+ }
2190
2207
  }
2191
2208
  if (typeof value === "object") {
2192
- return compactJsonObject2(value);
2209
+ if (seen.has(value)) {
2210
+ return "[Circular]";
2211
+ }
2212
+ seen.add(value);
2213
+ try {
2214
+ return compactJsonObjectInternal(value, seen);
2215
+ } finally {
2216
+ seen.delete(value);
2217
+ }
2193
2218
  }
2194
2219
  return String(value);
2195
2220
  }
2196
2221
  function compactJsonObject2(values) {
2222
+ return compactJsonObjectInternal(values, /* @__PURE__ */ new WeakSet());
2223
+ }
2224
+ function compactJsonObjectInternal(values, seen) {
2197
2225
  const entries = Object.entries(values).flatMap(
2198
- ([key, value]) => value === void 0 ? [] : [[key, toJsonValue2(value)]]
2226
+ ([key, value]) => value === void 0 ? [] : [[key, toJsonValueInternal(value, seen)]]
2199
2227
  );
2200
2228
  return Object.fromEntries(entries);
2201
2229
  }
@@ -2211,7 +2239,7 @@ function serializeUnknown(error) {
2211
2239
  }
2212
2240
 
2213
2241
  // src/runtime/tool-metadata.ts
2214
- import { ToolSet } from "@anvia/core";
2242
+ import { ToolSet } from "@anvia/core/tool";
2215
2243
  var MCP_TOOL_METADATA_KEY = /* @__PURE__ */ Symbol.for("anvia.mcp.tool.metadata");
2216
2244
  function agentToolItems(agent) {
2217
2245
  return [
@@ -2831,7 +2859,7 @@ function publicApproval(approval) {
2831
2859
  }
2832
2860
 
2833
2861
  // src/runtime/evals.ts
2834
- import { runEvalSuite } from "@anvia/core";
2862
+ import { runEvalSuite } from "@anvia/core/evals";
2835
2863
  function registerEvalRoutes(app, props) {
2836
2864
  app.get(
2837
2865
  "/evals",
@@ -4778,7 +4806,8 @@ function toJsonValue3(value) {
4778
4806
  }
4779
4807
 
4780
4808
  // src/runtime/questions.ts
4781
- import { createHook as createHook2, parseToolArgs as parseToolArgs2 } from "@anvia/core";
4809
+ import { createHook as createHook2 } from "@anvia/core/agent";
4810
+ import { parseToolArgs as parseToolArgs2 } from "@anvia/core/tool";
4782
4811
  function registerQuestionRoutes(app, questions) {
4783
4812
  app.get("/questions", (c) => {
4784
4813
  const status = parseQuestionStatus(c.req.query("status"));