@anvia/studio 1.0.2 → 1.0.5
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 +25 -2
- package/dist/index.d.ts +42 -2
- package/dist/index.js +148 -3
- package/dist/index.js.map +1 -1
- package/dist/ui/assets/Check.es-DgvuCllR.js +2 -0
- package/dist/ui/assets/Check.es-DgvuCllR.js.map +1 -0
- package/dist/ui/assets/Copy.es-DV7tb_eC.js +2 -0
- package/dist/ui/assets/Copy.es-DV7tb_eC.js.map +1 -0
- package/dist/ui/assets/MagnifyingGlass.es-yzEp9c89.js +2 -0
- package/dist/ui/assets/MagnifyingGlass.es-yzEp9c89.js.map +1 -0
- package/dist/ui/assets/Wrench.es-rRuP3Mrh.js +2 -0
- package/dist/ui/assets/Wrench.es-rRuP3Mrh.js.map +1 -0
- package/dist/ui/assets/agents-page-ByhvVYOx.js +2 -0
- package/dist/ui/assets/agents-page-ByhvVYOx.js.map +1 -0
- package/dist/ui/assets/badge-C3fkxijh.js +2 -0
- package/dist/ui/assets/badge-C3fkxijh.js.map +1 -0
- package/dist/ui/assets/button-B_AoswCu.js +2 -0
- package/dist/ui/assets/button-B_AoswCu.js.map +1 -0
- package/dist/ui/assets/{dialog-DN8F1Aaq.js → dialog-BfKpnby4.js} +2 -2
- package/dist/ui/assets/{dialog-DN8F1Aaq.js.map → dialog-BfKpnby4.js.map} +1 -1
- package/dist/ui/assets/{dist-PrGeYMiK.js → dist-Dr6EWOhl.js} +2 -2
- package/dist/ui/assets/{dist-PrGeYMiK.js.map → dist-Dr6EWOhl.js.map} +1 -1
- package/dist/ui/assets/{es2015-Ck1KeeEx.js → es2015-DGcxtKLK.js} +2 -2
- package/dist/ui/assets/{es2015-Ck1KeeEx.js.map → es2015-DGcxtKLK.js.map} +1 -1
- package/dist/ui/assets/favicon-dark.svg +7 -0
- package/dist/ui/assets/favicon-light.svg +7 -0
- package/dist/ui/assets/favicon.svg +1 -1
- package/dist/ui/assets/graphs-page-ne3dJIrx.js +2 -0
- package/dist/ui/assets/graphs-page-ne3dJIrx.js.map +1 -0
- package/dist/ui/assets/index-BGl7eOVR.css +2 -0
- package/dist/ui/assets/index-DF9Ysm8q.js +75 -0
- package/dist/ui/assets/index-DF9Ysm8q.js.map +1 -0
- package/dist/ui/assets/{input-DHvac9Uq.js → input-DuERdYTl.js} +2 -2
- package/dist/ui/assets/{input-DHvac9Uq.js.map → input-DuERdYTl.js.map} +1 -1
- package/dist/ui/assets/knowledge-page-1WgvGV4f.js +2 -0
- package/dist/ui/assets/knowledge-page-1WgvGV4f.js.map +1 -0
- package/dist/ui/assets/{mcps-page-MSz67ifn.js → mcps-page-BV96jSfG.js} +2 -2
- package/dist/ui/assets/mcps-page-BV96jSfG.js.map +1 -0
- package/dist/ui/assets/memory-page-DxClkjRl.js +4 -0
- package/dist/ui/assets/{memory-page-2qr2eMrI.js.map → memory-page-DxClkjRl.js.map} +1 -1
- package/dist/ui/assets/pipelines-page-ClO_uXn1.js +2 -0
- package/dist/ui/assets/pipelines-page-ClO_uXn1.js.map +1 -0
- package/dist/ui/assets/{renderers-BIw5yJkg.js → renderers-Cf55u6J4.js} +3 -3
- package/dist/ui/assets/{renderers-BIw5yJkg.js.map → renderers-Cf55u6J4.js.map} +1 -1
- package/dist/ui/assets/{request-CnFL8L6p.js → request-DbgMKweq.js} +2 -2
- package/dist/ui/assets/{request-CnFL8L6p.js.map → request-DbgMKweq.js.map} +1 -1
- package/dist/ui/assets/{sandboxes-page-DWMtrKYJ.js → sandboxes-page-Bo4S4ILL.js} +2 -2
- package/dist/ui/assets/sandboxes-page-Bo4S4ILL.js.map +1 -0
- package/dist/ui/assets/select-BdCBnmXx.js +2 -0
- package/dist/ui/assets/{select-C1_9fsRu.js.map → select-BdCBnmXx.js.map} +1 -1
- package/dist/ui/assets/sessions-page-BMnR-r_F.js +2 -0
- package/dist/ui/assets/sessions-page-BMnR-r_F.js.map +1 -0
- package/dist/ui/assets/status-page-Ys5dQyMG.js +2 -0
- package/dist/ui/assets/status-page-Ys5dQyMG.js.map +1 -0
- package/dist/ui/assets/studio-DzEdCFsX.js +2 -0
- package/dist/ui/assets/studio-DzEdCFsX.js.map +1 -0
- package/dist/ui/assets/style-BstB0PNS.js +8 -0
- package/dist/ui/assets/style-BstB0PNS.js.map +1 -0
- package/dist/ui/assets/{textarea-CZvhTJxB.js → textarea-fAtCF2cf.js} +2 -2
- package/dist/ui/assets/{textarea-CZvhTJxB.js.map → textarea-fAtCF2cf.js.map} +1 -1
- package/dist/ui/assets/tool-runner-Cwfc3yY8.js +2 -0
- package/dist/ui/assets/tool-runner-Cwfc3yY8.js.map +1 -0
- package/dist/ui/assets/{tools-page-D1ewvG0D.js → tools-page-BSgFqVi2.js} +2 -2
- package/dist/ui/assets/tools-page-BSgFqVi2.js.map +1 -0
- package/dist/ui/assets/trace-browser-Co9iS9HR.js +4 -0
- package/dist/ui/assets/trace-browser-Co9iS9HR.js.map +1 -0
- package/dist/ui/assets/transcript-item-ChVGempt.js +3 -0
- package/dist/ui/assets/transcript-item-ChVGempt.js.map +1 -0
- package/dist/ui/index.html +28 -20
- package/package.json +9 -8
- package/dist/ui/assets/CaretDown.es-CXu4Fvbf.js +0 -2
- package/dist/ui/assets/CaretDown.es-CXu4Fvbf.js.map +0 -1
- package/dist/ui/assets/Check.es-DSXK9-8c.js +0 -2
- package/dist/ui/assets/Check.es-DSXK9-8c.js.map +0 -1
- package/dist/ui/assets/Wrench.es-Cl38Pi3C.js +0 -4
- package/dist/ui/assets/Wrench.es-Cl38Pi3C.js.map +0 -1
- package/dist/ui/assets/agents-page-h-83w9EN.js +0 -2
- package/dist/ui/assets/agents-page-h-83w9EN.js.map +0 -1
- package/dist/ui/assets/badge-O3YyUN3G.js +0 -2
- package/dist/ui/assets/badge-O3YyUN3G.js.map +0 -1
- package/dist/ui/assets/button-Dsqwey2_.js +0 -2
- package/dist/ui/assets/button-Dsqwey2_.js.map +0 -1
- package/dist/ui/assets/index-DmctBqLn.js +0 -75
- package/dist/ui/assets/index-DmctBqLn.js.map +0 -1
- package/dist/ui/assets/index-VCdJ2Rb4.css +0 -2
- package/dist/ui/assets/knowledge-page-DKnPrmhK.js +0 -2
- package/dist/ui/assets/knowledge-page-DKnPrmhK.js.map +0 -1
- package/dist/ui/assets/mcps-page-MSz67ifn.js.map +0 -1
- package/dist/ui/assets/memory-page-2qr2eMrI.js +0 -4
- package/dist/ui/assets/pipelines-page-D1IB1tw-.js +0 -8
- package/dist/ui/assets/pipelines-page-D1IB1tw-.js.map +0 -1
- package/dist/ui/assets/sandboxes-page-DWMtrKYJ.js.map +0 -1
- package/dist/ui/assets/select-C1_9fsRu.js +0 -2
- package/dist/ui/assets/sessions-page-BIk4q-L8.js +0 -2
- package/dist/ui/assets/sessions-page-BIk4q-L8.js.map +0 -1
- package/dist/ui/assets/status-page-jKTghmnz.js +0 -2
- package/dist/ui/assets/status-page-jKTghmnz.js.map +0 -1
- package/dist/ui/assets/studio-Bh00wIF1.js +0 -2
- package/dist/ui/assets/studio-Bh00wIF1.js.map +0 -1
- package/dist/ui/assets/tool-runner-BtaZqE3R.js +0 -2
- package/dist/ui/assets/tool-runner-BtaZqE3R.js.map +0 -1
- package/dist/ui/assets/tools-page-D1ewvG0D.js.map +0 -1
- package/dist/ui/assets/trace-browser-CuBl9__d.js +0 -10
- package/dist/ui/assets/trace-browser-CuBl9__d.js.map +0 -1
- package/dist/ui/assets/transcript-item-ChtaJvPe.js +0 -3
- package/dist/ui/assets/transcript-item-ChtaJvPe.js.map +0 -1
- /package/dist/ui/assets/{pipelines-page-DLioOiRN.css → style-DLioOiRN.css} +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# @anvia/studio
|
|
2
2
|
|
|
3
|
-
Studio UI and HTTP runtime for Anvia agents, pipelines, tools, MCPs, memory, status, and
|
|
3
|
+
Studio UI and HTTP runtime for Anvia agents, pipelines, graphs, tools, MCPs, memory, status, and
|
|
4
|
+
knowledge inspection.
|
|
4
5
|
|
|
5
6
|
Use this package to serve local agents and pipelines over HTTP, inspect sessions, traces, tools, MCPs, Memory, Status, and Knowledge in the browser UI, and exercise tool approval workflows during development.
|
|
6
7
|
|
|
@@ -142,6 +143,7 @@ Studio exposes:
|
|
|
142
143
|
- Realtime observability stream for session logs, pipeline logs, and completed traces
|
|
143
144
|
- Eval suite runner for registered `runEvalSuite` configurations
|
|
144
145
|
- Pipeline graph, logs, run history, and replay-from-history controls
|
|
146
|
+
- Knowledge-graph explorer with type filters, search, node details, and bounded neighborhood expansion
|
|
145
147
|
- Rich agent runtime details, direct tool invocation, static tool, dynamic tool, and MCP inspectors
|
|
146
148
|
- Memory explorer for users, conversations, messages, and transcript steps backed by the session store
|
|
147
149
|
- Status dashboard for storage adapters, record counts, and enabled capabilities
|
|
@@ -151,6 +153,27 @@ Studio reads MCP provenance directly from `Agent.mcpServers`. Prefixes configure
|
|
|
151
153
|
`McpClient` remain visible in both the MCP inspector and direct tool runner, while the remote tool
|
|
152
154
|
name stays available on the typed MCP registration.
|
|
153
155
|
|
|
156
|
+
### Graph explorer
|
|
157
|
+
|
|
158
|
+
Register any graph that implements the provider-neutral `GraphExplorer` contract. Both
|
|
159
|
+
`@anvia/neo4j` and `@anvia/memgraph` graph registrations can be passed directly:
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
const studio = new Studio([agent], {
|
|
163
|
+
graphs: [
|
|
164
|
+
{
|
|
165
|
+
id: "support",
|
|
166
|
+
name: "Support knowledge graph",
|
|
167
|
+
graph,
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
});
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Open `/graphs` and select nodes to inspect their public properties or expand their one-hop
|
|
174
|
+
neighborhood. Studio exposes only bounded overview and expansion requests; it does not accept raw
|
|
175
|
+
Cypher. Adapter explorer responses also omit stored embeddings and reserved `__anvia_*` properties.
|
|
176
|
+
|
|
154
177
|
## Session Storage
|
|
155
178
|
|
|
156
179
|
Studio uses an in-memory store by default. Sessions, traces, and pipeline run history are available while the process is running, but they do not create local files unless you pass an explicit SQLite store. If you omit the port, Studio uses `RUNNER_PORT` and then falls back to `4021`.
|
|
@@ -174,7 +197,7 @@ SQLite storage uses dedicated `anvia_studio_*` tables so it can share an applica
|
|
|
174
197
|
- `Studio`
|
|
175
198
|
- `createInMemoryStudioStore`
|
|
176
199
|
- `createSqliteSessionStore`
|
|
177
|
-
- Studio session, trace, approval, pipeline, memory, status, knowledge, tool, MCP, and runtime types
|
|
200
|
+
- Studio session, trace, approval, pipeline, graph, memory, status, knowledge, tool, MCP, and runtime types
|
|
178
201
|
|
|
179
202
|
## Development
|
|
180
203
|
|
package/dist/index.d.ts
CHANGED
|
@@ -6,10 +6,11 @@ import { JsonObject, Message, JsonValue, CompletionModelCapabilities, ToolResult
|
|
|
6
6
|
import { MemoryStore, MemoryAppendOptions, MemoryErrorOptions, MemoryScope } from '@anvia/core/memory';
|
|
7
7
|
import { ModelList } from '@anvia/core/model-listing';
|
|
8
8
|
import { Pipeline, PipelineGraph } from '@anvia/core/pipeline';
|
|
9
|
+
import { GraphExplorer } from '@anvia/graph';
|
|
9
10
|
|
|
10
11
|
declare function traceSummary(trace: StudioTrace): StudioTraceSummary;
|
|
11
12
|
|
|
12
|
-
type StudioCapability = "agents" | "interactions" | "evals" | "memory" | "knowledge" | "mcps" | "observability" | "pipelines" | "sandboxes" | "sessions" | "status" | "tools" | "traces";
|
|
13
|
+
type StudioCapability = "agents" | "interactions" | "evals" | "graphs" | "memory" | "knowledge" | "mcps" | "observability" | "pipelines" | "sandboxes" | "sessions" | "status" | "tools" | "traces";
|
|
13
14
|
type AgentTraceInfo = {
|
|
14
15
|
observer: string;
|
|
15
16
|
traceId?: string | undefined;
|
|
@@ -147,6 +148,43 @@ type StudioPipelineConfig = {
|
|
|
147
148
|
type StudioPipelineDetail = StudioPipelineConfig & {
|
|
148
149
|
graph: PipelineGraph;
|
|
149
150
|
};
|
|
151
|
+
type StudioGraphRegistration = {
|
|
152
|
+
id: string;
|
|
153
|
+
graph: GraphExplorer;
|
|
154
|
+
name?: string;
|
|
155
|
+
description?: string;
|
|
156
|
+
};
|
|
157
|
+
type StudioGraphConfig = {
|
|
158
|
+
id: string;
|
|
159
|
+
name?: string;
|
|
160
|
+
description?: string;
|
|
161
|
+
nodeTypes: Array<{
|
|
162
|
+
name: string;
|
|
163
|
+
description: string;
|
|
164
|
+
}>;
|
|
165
|
+
relationshipTypes: Array<{
|
|
166
|
+
name: string;
|
|
167
|
+
description: string;
|
|
168
|
+
from: string;
|
|
169
|
+
to: string;
|
|
170
|
+
}>;
|
|
171
|
+
};
|
|
172
|
+
type StudioGraphExploreRequest = {
|
|
173
|
+
mode: "overview";
|
|
174
|
+
nodeTypes?: string[];
|
|
175
|
+
relationships?: string[];
|
|
176
|
+
maxNodes?: number;
|
|
177
|
+
maxRelationships?: number;
|
|
178
|
+
} | {
|
|
179
|
+
mode: "expand";
|
|
180
|
+
nodeIds: string[];
|
|
181
|
+
nodeTypes?: string[];
|
|
182
|
+
relationships?: string[];
|
|
183
|
+
direction?: "outgoing" | "incoming" | "both";
|
|
184
|
+
maxDepth?: number;
|
|
185
|
+
maxNodes?: number;
|
|
186
|
+
maxRelationships?: number;
|
|
187
|
+
};
|
|
150
188
|
type StudioEvalSuite<Input = any, _Output = any, _Expected = any> = {
|
|
151
189
|
name: string;
|
|
152
190
|
cases: Array<Input>;
|
|
@@ -210,6 +248,7 @@ type StudioConfig = {
|
|
|
210
248
|
agents: StudioAgentConfig[];
|
|
211
249
|
models?: StudioModelsConfig;
|
|
212
250
|
pipelines: StudioPipelineConfig[];
|
|
251
|
+
graphs: StudioGraphConfig[];
|
|
213
252
|
evals: StudioEvalSuiteConfig[];
|
|
214
253
|
chat: {
|
|
215
254
|
quickPrompts: Record<string, string[]>;
|
|
@@ -842,6 +881,7 @@ type StudioOptions = {
|
|
|
842
881
|
ui?: boolean | StudioUiOptions;
|
|
843
882
|
models?: StudioModelConfig;
|
|
844
883
|
sandboxes?: readonly StudioSandboxRegistration[];
|
|
884
|
+
graphs?: readonly StudioGraphRegistration[];
|
|
845
885
|
};
|
|
846
886
|
type StudioServeOptions = {
|
|
847
887
|
port?: number;
|
|
@@ -1072,4 +1112,4 @@ declare function createSqliteSessionStore(options?: SqliteSessionStoreOptions):
|
|
|
1072
1112
|
|
|
1073
1113
|
declare function createInMemoryStudioStore(): StudioSessionStore & StudioTraceStore & StudioPipelineLogStore & StudioPipelineRunStore;
|
|
1074
1114
|
|
|
1075
|
-
export { type AgentRunRequest, type AgentRunResponse, type AgentRunStreamEvent, type AgentTraceInfo, type AgentTraceOptions, type AnviaStudio, type SqliteSessionStoreOptions, Studio, type StudioAgent, type StudioAgentConfig, type StudioAgentKnowledgeConfig, type StudioAgentMcpServerMetadata, type StudioAgentMcpToolMetadata, type StudioAgentMcpsSummary, type StudioAgentModelPolicy, type StudioAgentModelPolicyConfig, type StudioAgentModelsSummary, type StudioAgentRuntimeSummary, type StudioAgentToolApprovalMetadata, type StudioAgentToolMetadata, type StudioAgentToolSource, type StudioAgentToolsSummary, type StudioCapability, type StudioCapabilityConfig, type StudioConfig, type StudioErrorCode, type StudioErrorResponse, type StudioEvalCasePreview, type StudioEvalMetricSummary, type StudioEvalRunRequest, type StudioEvalRunResponse, type StudioEvalSuite, type StudioEvalSuiteConfig, type StudioKnowledgeEvidence, type StudioKnowledgeEvidenceDocument, type StudioKnowledgeItem, type StudioKnowledgeItemKind, type StudioKnowledgeItemsPage, type StudioKnowledgeSourceKind, type StudioKnowledgeSourceSummary, type StudioKnowledgeSummary, type StudioMemoryAppendOptions, type StudioMemoryConversationMessages, type StudioMemoryConversationSteps, type StudioMemoryConversationSummary, type StudioMemoryConversationsPage, type StudioMemoryErrorOptions, type StudioMemoryMessageRecord, type StudioMemoryScope, type StudioMemorySourceConversationMessages, type StudioMemorySourceConversationSteps, type StudioMemorySourceConversationSummary, type StudioMemorySourceConversationsPage, type StudioMemorySourceKind, type StudioMemorySourceSummary, type StudioMemorySourceUsersPage, type StudioMemorySourcesPage, type StudioMemoryStore, type StudioMemoryUserSummary, type StudioMemoryUsersPage, type StudioModelConfig, type StudioModelDefinition, type StudioModelModalities, type StudioModelModality, type StudioModelProvider, type StudioModelProviderConfig, type StudioModelRef, type StudioModelSummary, type StudioModelsConfig, type StudioObservabilityEvent, type StudioObservabilityEventType, type StudioOptions, type StudioPipeline, type StudioPipelineConfig, type StudioPipelineDetail, type StudioPipelineFinalEvent, type StudioPipelineLogAppendInput, type StudioPipelineLogCategory, type StudioPipelineLogEntry, type StudioPipelineLogEvent, type StudioPipelineLogLevel, type StudioPipelineLogListOptions, type StudioPipelineLogStore, type StudioPipelineReplayRequest, type StudioPipelineRunGetOptions, type StudioPipelineRunListOptions, type StudioPipelineRunRecord, type StudioPipelineRunRequest, type StudioPipelineRunResponse, type StudioPipelineRunSaveInput, type StudioPipelineRunStatus, type StudioPipelineRunStore, type StudioSandboxCapabilities, type StudioSandboxFileEntry, type StudioSandboxFileType, type StudioSandboxFilesResponse, type StudioSandboxInspector, type StudioSandboxInspectorFileEntry, type StudioSandboxInspectorPort, type StudioSandboxInspectorProcess, type StudioSandboxInspectorProcessLogs, type StudioSandboxPort, type StudioSandboxPortsResponse, type StudioSandboxProcess, type StudioSandboxProcessLogsResponse, type StudioSandboxProcessStatus, type StudioSandboxProcessesResponse, type StudioSandboxRegistration, type StudioSandboxSummary, type StudioSandboxViewAccess, type StudioSandboxViewAuthentication, type StudioSandboxViewAuthorizeArgs, type StudioSandboxViewConnection, type StudioSandboxViewControl, type StudioSandboxViewControlLease, type StudioSandboxViewControlSnapshot, type StudioSandboxViewRegistration, type StudioSandboxViewSource, type StudioSandboxViewSummary, type StudioSandboxesSummary, type StudioServeLifecycleOptions, type StudioServeOptions, type StudioSession, type StudioSessionCreateInput, type StudioSessionListOptions, type StudioSessionLogAppendInput, type StudioSessionLogCategory, type StudioSessionLogEntry, type StudioSessionLogEvent, type StudioSessionLogLevel, type StudioSessionLogListOptions, type StudioSessionRunStatus, type StudioSessionRunTranscriptInput, type StudioSessionStore, type StudioSessionSummary, type StudioSessionTraceListOptions, type StudioStaticKnowledgeDocument, type StudioStatusSummary, type StudioStores, type StudioTarget, type StudioToolApprovalStatus, type StudioToolApprovalTranscript, type StudioToolQuestionAnswer, type StudioToolQuestionChoice, type StudioToolQuestionPrompt, type StudioToolQuestionStatus, type StudioToolQuestionTranscript, type StudioToolRunRequest, type StudioToolRunResponse, type StudioTrace, type StudioTraceListOptions, type StudioTraceObservation, type StudioTraceObservationKind, StudioTraceObserver, type StudioTraceObserverOptions, type StudioTraceStatus, type StudioTraceStore, type StudioTraceSummary, type StudioTranscriptAttachment, type StudioTranscriptChatEntry, type StudioTranscriptChildAgentEvent, type StudioTranscriptEntry, type StudioTranscriptReasoningEntry, type StudioTranscriptToolEntry, type StudioUiOptions, createInMemoryStudioStore, createSqliteSessionStore, traceSummary };
|
|
1115
|
+
export { type AgentRunRequest, type AgentRunResponse, type AgentRunStreamEvent, type AgentTraceInfo, type AgentTraceOptions, type AnviaStudio, type SqliteSessionStoreOptions, Studio, type StudioAgent, type StudioAgentConfig, type StudioAgentKnowledgeConfig, type StudioAgentMcpServerMetadata, type StudioAgentMcpToolMetadata, type StudioAgentMcpsSummary, type StudioAgentModelPolicy, type StudioAgentModelPolicyConfig, type StudioAgentModelsSummary, type StudioAgentRuntimeSummary, type StudioAgentToolApprovalMetadata, type StudioAgentToolMetadata, type StudioAgentToolSource, type StudioAgentToolsSummary, type StudioCapability, type StudioCapabilityConfig, type StudioConfig, type StudioErrorCode, type StudioErrorResponse, type StudioEvalCasePreview, type StudioEvalMetricSummary, type StudioEvalRunRequest, type StudioEvalRunResponse, type StudioEvalSuite, type StudioEvalSuiteConfig, type StudioGraphConfig, type StudioGraphExploreRequest, type StudioGraphRegistration, type StudioKnowledgeEvidence, type StudioKnowledgeEvidenceDocument, type StudioKnowledgeItem, type StudioKnowledgeItemKind, type StudioKnowledgeItemsPage, type StudioKnowledgeSourceKind, type StudioKnowledgeSourceSummary, type StudioKnowledgeSummary, type StudioMemoryAppendOptions, type StudioMemoryConversationMessages, type StudioMemoryConversationSteps, type StudioMemoryConversationSummary, type StudioMemoryConversationsPage, type StudioMemoryErrorOptions, type StudioMemoryMessageRecord, type StudioMemoryScope, type StudioMemorySourceConversationMessages, type StudioMemorySourceConversationSteps, type StudioMemorySourceConversationSummary, type StudioMemorySourceConversationsPage, type StudioMemorySourceKind, type StudioMemorySourceSummary, type StudioMemorySourceUsersPage, type StudioMemorySourcesPage, type StudioMemoryStore, type StudioMemoryUserSummary, type StudioMemoryUsersPage, type StudioModelConfig, type StudioModelDefinition, type StudioModelModalities, type StudioModelModality, type StudioModelProvider, type StudioModelProviderConfig, type StudioModelRef, type StudioModelSummary, type StudioModelsConfig, type StudioObservabilityEvent, type StudioObservabilityEventType, type StudioOptions, type StudioPipeline, type StudioPipelineConfig, type StudioPipelineDetail, type StudioPipelineFinalEvent, type StudioPipelineLogAppendInput, type StudioPipelineLogCategory, type StudioPipelineLogEntry, type StudioPipelineLogEvent, type StudioPipelineLogLevel, type StudioPipelineLogListOptions, type StudioPipelineLogStore, type StudioPipelineReplayRequest, type StudioPipelineRunGetOptions, type StudioPipelineRunListOptions, type StudioPipelineRunRecord, type StudioPipelineRunRequest, type StudioPipelineRunResponse, type StudioPipelineRunSaveInput, type StudioPipelineRunStatus, type StudioPipelineRunStore, type StudioSandboxCapabilities, type StudioSandboxFileEntry, type StudioSandboxFileType, type StudioSandboxFilesResponse, type StudioSandboxInspector, type StudioSandboxInspectorFileEntry, type StudioSandboxInspectorPort, type StudioSandboxInspectorProcess, type StudioSandboxInspectorProcessLogs, type StudioSandboxPort, type StudioSandboxPortsResponse, type StudioSandboxProcess, type StudioSandboxProcessLogsResponse, type StudioSandboxProcessStatus, type StudioSandboxProcessesResponse, type StudioSandboxRegistration, type StudioSandboxSummary, type StudioSandboxViewAccess, type StudioSandboxViewAuthentication, type StudioSandboxViewAuthorizeArgs, type StudioSandboxViewConnection, type StudioSandboxViewControl, type StudioSandboxViewControlLease, type StudioSandboxViewControlSnapshot, type StudioSandboxViewRegistration, type StudioSandboxViewSource, type StudioSandboxViewSummary, type StudioSandboxesSummary, type StudioServeLifecycleOptions, type StudioServeOptions, type StudioSession, type StudioSessionCreateInput, type StudioSessionListOptions, type StudioSessionLogAppendInput, type StudioSessionLogCategory, type StudioSessionLogEntry, type StudioSessionLogEvent, type StudioSessionLogLevel, type StudioSessionLogListOptions, type StudioSessionRunStatus, type StudioSessionRunTranscriptInput, type StudioSessionStore, type StudioSessionSummary, type StudioSessionTraceListOptions, type StudioStaticKnowledgeDocument, type StudioStatusSummary, type StudioStores, type StudioTarget, type StudioToolApprovalStatus, type StudioToolApprovalTranscript, type StudioToolQuestionAnswer, type StudioToolQuestionChoice, type StudioToolQuestionPrompt, type StudioToolQuestionStatus, type StudioToolQuestionTranscript, type StudioToolRunRequest, type StudioToolRunResponse, type StudioTrace, type StudioTraceListOptions, type StudioTraceObservation, type StudioTraceObservationKind, StudioTraceObserver, type StudioTraceObserverOptions, type StudioTraceStatus, type StudioTraceStore, type StudioTraceSummary, type StudioTranscriptAttachment, type StudioTranscriptChatEntry, type StudioTranscriptChildAgentEvent, type StudioTranscriptEntry, type StudioTranscriptReasoningEntry, type StudioTranscriptToolEntry, type StudioUiOptions, createInMemoryStudioStore, createSqliteSessionStore, traceSummary };
|
package/dist/index.js
CHANGED
|
@@ -674,6 +674,7 @@ function registerStudioUi(app, options) {
|
|
|
674
674
|
app.get(`${options.path}/tools`, (c) => redirectWithQuery(c, "/tools"));
|
|
675
675
|
app.get(`${options.path}/mcps`, (c) => redirectWithQuery(c, "/mcps"));
|
|
676
676
|
app.get(`${options.path}/pipelines`, (c) => redirectWithQuery(c, "/pipelines"));
|
|
677
|
+
app.get(`${options.path}/graphs`, (c) => redirectWithQuery(c, "/graphs"));
|
|
677
678
|
app.get(`${options.path}/sandboxes`, (c) => redirectWithQuery(c, "/sandboxes"));
|
|
678
679
|
app.get(
|
|
679
680
|
`${options.path}/sandboxes/:sandboxRef`,
|
|
@@ -698,6 +699,7 @@ function registerStudioUi(app, options) {
|
|
|
698
699
|
app.get("/tools", async (c) => c.html(await renderShell()));
|
|
699
700
|
app.get("/mcps", async (c) => c.html(await renderShell()));
|
|
700
701
|
app.get("/pipelines", shellWhenHtml(renderShell));
|
|
702
|
+
app.get("/graphs", shellWhenHtml(renderShell));
|
|
701
703
|
app.get("/sandboxes", shellWhenHtml(renderShell));
|
|
702
704
|
app.get("/sandboxes/:sandboxRef", shellWhenHtml(renderShell));
|
|
703
705
|
app.get("/memory", async (c) => c.html(await renderShell()));
|
|
@@ -791,8 +793,9 @@ function renderLegacyStudioUiShell(props) {
|
|
|
791
793
|
'<meta charset="utf-8">',
|
|
792
794
|
'<meta name="viewport" content="width=device-width, initial-scale=1">',
|
|
793
795
|
`<title>${title}</title>`,
|
|
794
|
-
'<
|
|
795
|
-
`<link rel="icon" type="image/svg+xml" href="${escapeHtml(props.compatUiPath)}/assets/favicon.svg">`,
|
|
796
|
+
'<meta name="theme-color" content="#09090b">',
|
|
797
|
+
`<link data-anvia-favicon rel="icon" type="image/svg+xml" href="${escapeHtml(props.compatUiPath)}/assets/favicon-dark.svg">`,
|
|
798
|
+
'<script>(()=>{let m="dark";try{const t=localStorage.getItem("anvia-theme");const l=localStorage.getItem("anvia-studio-theme");if(t==="light"||(t!=="dark"&&l==="light"))m="light"}catch{}const r=document.documentElement;r.classList.toggle("dark",m==="dark");r.dataset.theme=m;r.style.colorScheme=m;document.querySelector(\'meta[name="theme-color"]\')?.setAttribute("content",m==="dark"?"#09090b":"#f4f4f5");const f=document.querySelector("link[data-anvia-favicon]");if(f)f.href=f.href.replace("favicon-dark.svg",`favicon-${m}.svg`)})();</script>',
|
|
796
799
|
`<link rel="stylesheet" href="${escapeHtml(props.stylesheet)}">`,
|
|
797
800
|
"</head>",
|
|
798
801
|
"<body>",
|
|
@@ -1009,6 +1012,18 @@ function unsupportedCapability(c, capability) {
|
|
|
1009
1012
|
{ capability }
|
|
1010
1013
|
);
|
|
1011
1014
|
}
|
|
1015
|
+
async function parseJsonBody(c, validate) {
|
|
1016
|
+
let body;
|
|
1017
|
+
try {
|
|
1018
|
+
body = await c.req.json();
|
|
1019
|
+
} catch {
|
|
1020
|
+
return { error: errorResponse(c, 400, "bad_request", "Request body must be JSON") };
|
|
1021
|
+
}
|
|
1022
|
+
if (!isObject(body)) {
|
|
1023
|
+
return { error: errorResponse(c, 400, "bad_request", "Request body must be an object") };
|
|
1024
|
+
}
|
|
1025
|
+
return validate(body);
|
|
1026
|
+
}
|
|
1012
1027
|
|
|
1013
1028
|
// src/runtime/models.ts
|
|
1014
1029
|
var STUDIO_MODEL_METADATA_KEY = "studioModel";
|
|
@@ -4218,12 +4233,33 @@ function pipelineConfig(pipeline) {
|
|
|
4218
4233
|
if (pipeline.metadata !== void 0) config.metadata = pipeline.metadata;
|
|
4219
4234
|
return config;
|
|
4220
4235
|
}
|
|
4236
|
+
function graphConfig(registration) {
|
|
4237
|
+
const config = {
|
|
4238
|
+
id: registration.id,
|
|
4239
|
+
nodeTypes: Object.entries(registration.graph.schema.nodes).map(([name, definition]) => ({
|
|
4240
|
+
name,
|
|
4241
|
+
description: definition.description
|
|
4242
|
+
})),
|
|
4243
|
+
relationshipTypes: Object.entries(registration.graph.schema.relationships).map(
|
|
4244
|
+
([name, definition]) => ({
|
|
4245
|
+
name,
|
|
4246
|
+
description: definition.description,
|
|
4247
|
+
from: definition.from,
|
|
4248
|
+
to: definition.to
|
|
4249
|
+
})
|
|
4250
|
+
)
|
|
4251
|
+
};
|
|
4252
|
+
if (registration.name !== void 0) config.name = registration.name;
|
|
4253
|
+
if (registration.description !== void 0) config.description = registration.description;
|
|
4254
|
+
return config;
|
|
4255
|
+
}
|
|
4221
4256
|
function buildConfig(options, agents, pipelines, stores, sandboxCount = 0) {
|
|
4222
4257
|
const models = options.models === void 0 ? void 0 : studioModelsConfig(createStudioModelRegistry(options.models), agents);
|
|
4223
4258
|
const config = {
|
|
4224
4259
|
id: runnerId(options),
|
|
4225
4260
|
agents: agents.map(agentConfig),
|
|
4226
4261
|
pipelines: pipelines.map(pipelineConfig),
|
|
4262
|
+
graphs: options.graphs.map(graphConfig),
|
|
4227
4263
|
evals: options.evals.map(evalConfig),
|
|
4228
4264
|
chat: {
|
|
4229
4265
|
quickPrompts: Object.fromEntries(agents.map((agent) => [agent.id, agent.quickPrompts ?? []]))
|
|
@@ -4255,6 +4291,9 @@ function capabilityConfig(_options, agents, pipelines, stores, sandboxCount = 0)
|
|
|
4255
4291
|
if (pipelines.length > 0) {
|
|
4256
4292
|
capabilities.pipelines = { enabled: true };
|
|
4257
4293
|
}
|
|
4294
|
+
if (_options.graphs.length > 0) {
|
|
4295
|
+
capabilities.graphs = { enabled: true };
|
|
4296
|
+
}
|
|
4258
4297
|
if (_options.evals.length > 0) {
|
|
4259
4298
|
capabilities.evals = { enabled: true };
|
|
4260
4299
|
}
|
|
@@ -4352,6 +4391,110 @@ async function parseEvalRunRequest(c) {
|
|
|
4352
4391
|
return request;
|
|
4353
4392
|
}
|
|
4354
4393
|
|
|
4394
|
+
// src/runtime/graphs.ts
|
|
4395
|
+
import { resolveGraphExploreOptions } from "@anvia/graph/explore";
|
|
4396
|
+
function registerGraphRoutes(app, registrations) {
|
|
4397
|
+
const graphs = graphRegistry(registrations);
|
|
4398
|
+
app.get("/graphs", (c) => c.json({ graphs: [...graphs.values()].map(graphConfig) }));
|
|
4399
|
+
app.post("/graphs/:graphId/explore", async (c) => {
|
|
4400
|
+
const registration = graphs.get(c.req.param("graphId"));
|
|
4401
|
+
if (registration === void 0) {
|
|
4402
|
+
return errorResponse(c, 404, "not_found", "Graph not found");
|
|
4403
|
+
}
|
|
4404
|
+
const body = await parseJsonBody(c, (value) => parseExploreRequest(c, value));
|
|
4405
|
+
if ("error" in body) return body.error;
|
|
4406
|
+
const input = exploreOptionsWithSignal(body, c.req.raw.signal);
|
|
4407
|
+
let options;
|
|
4408
|
+
try {
|
|
4409
|
+
options = resolveGraphExploreOptions(registration.graph.schema, input);
|
|
4410
|
+
} catch (error) {
|
|
4411
|
+
return errorResponse(
|
|
4412
|
+
c,
|
|
4413
|
+
400,
|
|
4414
|
+
"bad_request",
|
|
4415
|
+
error instanceof Error ? error.message : "Invalid graph exploration request"
|
|
4416
|
+
);
|
|
4417
|
+
}
|
|
4418
|
+
return c.json(await registration.graph.explore(options));
|
|
4419
|
+
});
|
|
4420
|
+
}
|
|
4421
|
+
function graphRegistry(registrations) {
|
|
4422
|
+
const graphs = /* @__PURE__ */ new Map();
|
|
4423
|
+
for (const registration of registrations) {
|
|
4424
|
+
if (typeof registration.id !== "string" || registration.id.length === 0) {
|
|
4425
|
+
throw new TypeError("Studio graph id must be a non-empty string.");
|
|
4426
|
+
}
|
|
4427
|
+
if (graphs.has(registration.id)) {
|
|
4428
|
+
throw new TypeError(`Duplicate Studio graph id: ${registration.id}.`);
|
|
4429
|
+
}
|
|
4430
|
+
graphs.set(registration.id, registration);
|
|
4431
|
+
}
|
|
4432
|
+
return graphs;
|
|
4433
|
+
}
|
|
4434
|
+
function parseExploreRequest(c, value) {
|
|
4435
|
+
if (!isObject(value) || value.mode !== "overview" && value.mode !== "expand") {
|
|
4436
|
+
return { error: errorResponse(c, 400, "bad_request", "mode must be overview or expand") };
|
|
4437
|
+
}
|
|
4438
|
+
const common = parseCommonOptions(c, value);
|
|
4439
|
+
if ("error" in common) return common;
|
|
4440
|
+
if (value.mode === "overview") return { ...common, mode: "overview" };
|
|
4441
|
+
const nodeIds = stringList(value.nodeIds);
|
|
4442
|
+
if (nodeIds === void 0) {
|
|
4443
|
+
return { error: errorResponse(c, 400, "bad_request", "nodeIds must be a string array") };
|
|
4444
|
+
}
|
|
4445
|
+
const request = {
|
|
4446
|
+
...common,
|
|
4447
|
+
mode: "expand",
|
|
4448
|
+
nodeIds
|
|
4449
|
+
};
|
|
4450
|
+
if (value.direction === "outgoing" || value.direction === "incoming" || value.direction === "both") {
|
|
4451
|
+
request.direction = value.direction;
|
|
4452
|
+
} else if (value.direction !== void 0) {
|
|
4453
|
+
return {
|
|
4454
|
+
error: errorResponse(c, 400, "bad_request", "direction must be outgoing, incoming, or both")
|
|
4455
|
+
};
|
|
4456
|
+
}
|
|
4457
|
+
if (typeof value.maxDepth === "number") request.maxDepth = value.maxDepth;
|
|
4458
|
+
else if (value.maxDepth !== void 0) {
|
|
4459
|
+
return { error: errorResponse(c, 400, "bad_request", "maxDepth must be a number") };
|
|
4460
|
+
}
|
|
4461
|
+
return request;
|
|
4462
|
+
}
|
|
4463
|
+
function parseCommonOptions(c, value) {
|
|
4464
|
+
const request = {};
|
|
4465
|
+
for (const [key, label] of [
|
|
4466
|
+
["nodeTypes", "nodeTypes"],
|
|
4467
|
+
["relationships", "relationships"]
|
|
4468
|
+
]) {
|
|
4469
|
+
const selected = value[key];
|
|
4470
|
+
if (selected === void 0) continue;
|
|
4471
|
+
const values = stringList(selected);
|
|
4472
|
+
if (values === void 0) {
|
|
4473
|
+
return { error: errorResponse(c, 400, "bad_request", `${label} must be a string array`) };
|
|
4474
|
+
}
|
|
4475
|
+
request[key] = values;
|
|
4476
|
+
}
|
|
4477
|
+
for (const [key, label] of [
|
|
4478
|
+
["maxNodes", "maxNodes"],
|
|
4479
|
+
["maxRelationships", "maxRelationships"]
|
|
4480
|
+
]) {
|
|
4481
|
+
const selected = value[key];
|
|
4482
|
+
if (selected === void 0) continue;
|
|
4483
|
+
if (typeof selected !== "number") {
|
|
4484
|
+
return { error: errorResponse(c, 400, "bad_request", `${label} must be a number`) };
|
|
4485
|
+
}
|
|
4486
|
+
request[key] = selected;
|
|
4487
|
+
}
|
|
4488
|
+
return request;
|
|
4489
|
+
}
|
|
4490
|
+
function exploreOptionsWithSignal(request, abortSignal) {
|
|
4491
|
+
return { ...request, abortSignal };
|
|
4492
|
+
}
|
|
4493
|
+
function stringList(value) {
|
|
4494
|
+
if (!Array.isArray(value) || !value.every((item) => typeof item === "string")) return void 0;
|
|
4495
|
+
return value;
|
|
4496
|
+
}
|
|
4497
|
+
|
|
4355
4498
|
// src/runtime/interactions.ts
|
|
4356
4499
|
import {
|
|
4357
4500
|
assertAgentInteractionResponse
|
|
@@ -7111,7 +7254,8 @@ function studioOptionsFromTargets(targets, options) {
|
|
|
7111
7254
|
const runtimeOptions = {
|
|
7112
7255
|
agents: inferStudioAgents(agents, options.quickPrompts ?? {}),
|
|
7113
7256
|
pipelines: inferStudioPipelines(pipelines),
|
|
7114
|
-
evals: options.evals ?? []
|
|
7257
|
+
evals: options.evals ?? [],
|
|
7258
|
+
graphs: options.graphs === void 0 ? [] : [...options.graphs]
|
|
7115
7259
|
};
|
|
7116
7260
|
if (options.models !== void 0) runtimeOptions.models = options.models;
|
|
7117
7261
|
if (options.stores !== void 0) runtimeOptions.stores = options.stores;
|
|
@@ -7252,6 +7396,7 @@ function createStudioApp(options) {
|
|
|
7252
7396
|
evals: options.evals,
|
|
7253
7397
|
evalMap
|
|
7254
7398
|
});
|
|
7399
|
+
registerGraphRoutes(app, options.graphs);
|
|
7255
7400
|
const knowledgeOptions = { agents };
|
|
7256
7401
|
if (stores.traces !== void 0) knowledgeOptions.traceStore = stores.traces;
|
|
7257
7402
|
registerKnowledgeRoutes(app, knowledgeOptions);
|