@anvia/studio 0.1.3 → 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Indra Zulfi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Message, JsonObject, AgentTraceOptions, PromptResponse, AgentStreamEvent, JsonValue, Usage, AgentTraceInfo, Agent, MemoryStore, AgentObserver, AgentRunStartArgs, AgentRunObserver } from '@anvia/core';
2
1
  import { Hono } from 'hono';
2
+ import { Message, JsonObject, AgentTraceOptions, PromptResponse, AgentStreamEvent, JsonValue, Agent, Pipeline, Usage, AgentTraceInfo, PipelineGraph, MemoryStore, AgentObserver, AgentRunStartArgs, AgentRunObserver } from '@anvia/core';
3
3
 
4
- type StudioCapability = "agents" | "approvals" | "knowledge" | "observability" | "sessions" | "traces";
4
+ type StudioCapability = "agents" | "approvals" | "knowledge" | "mcps" | "observability" | "pipelines" | "sessions" | "tools" | "traces";
5
5
  type StudioAgent = {
6
6
  id: string;
7
7
  agent: Agent;
@@ -10,6 +10,7 @@ type StudioAgent = {
10
10
  quickPrompts?: string[];
11
11
  metadata?: JsonObject;
12
12
  };
13
+ type StudioTarget = Agent | Pipeline<unknown, unknown>;
13
14
  type StudioAgentConfig = {
14
15
  id: string;
15
16
  name?: string;
@@ -17,6 +18,27 @@ type StudioAgentConfig = {
17
18
  quickPrompts: string[];
18
19
  metadata?: JsonObject;
19
20
  };
21
+ type StudioPipeline = {
22
+ id: string;
23
+ pipeline: Pipeline<unknown, unknown>;
24
+ name?: string;
25
+ description?: string;
26
+ metadata?: JsonObject;
27
+ };
28
+ type StudioPipelineConfig = {
29
+ id: string;
30
+ name?: string;
31
+ description?: string;
32
+ metadata?: JsonObject;
33
+ stageCount: number;
34
+ edgeCount: number;
35
+ hasParallelStages: boolean;
36
+ agentCount: number;
37
+ extractorCount: number;
38
+ };
39
+ type StudioPipelineDetail = StudioPipelineConfig & {
40
+ graph: PipelineGraph;
41
+ };
20
42
  type StudioCapabilityConfig = {
21
43
  enabled: boolean;
22
44
  reason?: string;
@@ -27,12 +49,47 @@ type StudioConfig = {
27
49
  description?: string;
28
50
  version?: string;
29
51
  agents: StudioAgentConfig[];
52
+ pipelines: StudioPipelineConfig[];
30
53
  chat: {
31
54
  quickPrompts: Record<string, string[]>;
32
55
  };
33
56
  capabilities: Partial<Record<StudioCapability, StudioCapabilityConfig>>;
34
57
  unsupportedCapabilities: StudioCapability[];
35
58
  };
59
+ type StudioAgentToolSource = "static" | "dynamic";
60
+ type StudioAgentToolApprovalMetadata = {
61
+ required: boolean;
62
+ reason?: string;
63
+ rejectMessage?: string;
64
+ };
65
+ type StudioAgentToolMetadata = {
66
+ agentId: string;
67
+ name: string;
68
+ description: string;
69
+ parameters: JsonObject;
70
+ source: StudioAgentToolSource;
71
+ approval: StudioAgentToolApprovalMetadata;
72
+ };
73
+ type StudioAgentToolsSummary = {
74
+ agentId: string;
75
+ tools: StudioAgentToolMetadata[];
76
+ };
77
+ type StudioAgentMcpToolMetadata = {
78
+ name: string;
79
+ description: string;
80
+ parameters: JsonObject;
81
+ source: StudioAgentToolSource;
82
+ };
83
+ type StudioAgentMcpServerMetadata = {
84
+ agentId: string;
85
+ name: string;
86
+ toolCount: number;
87
+ tools: StudioAgentMcpToolMetadata[];
88
+ };
89
+ type StudioAgentMcpsSummary = {
90
+ agentId: string;
91
+ servers: StudioAgentMcpServerMetadata[];
92
+ };
36
93
  type StudioTranscriptChatEntry = {
37
94
  entryId: number;
38
95
  kind: "message";
@@ -110,12 +167,42 @@ type StudioSessionRunTranscriptInput = {
110
167
  status: StudioSessionRunStatus;
111
168
  error?: JsonValue;
112
169
  };
170
+ type StudioSessionLogLevel = "debug" | "info" | "warn" | "error";
171
+ type StudioSessionLogCategory = "session" | "run" | "memory" | "prompt" | "model" | "tool" | "approval" | "question" | "api";
172
+ type StudioSessionLogEntry = {
173
+ id: string;
174
+ sessionId: string;
175
+ runId?: string;
176
+ sequence: number;
177
+ timestamp: string;
178
+ level: StudioSessionLogLevel;
179
+ category: StudioSessionLogCategory;
180
+ event: string;
181
+ message: string;
182
+ metadata?: JsonObject;
183
+ };
184
+ type StudioSessionLogAppendInput = {
185
+ sessionId: string;
186
+ runId?: string;
187
+ level: StudioSessionLogLevel;
188
+ category: StudioSessionLogCategory;
189
+ event: string;
190
+ message: string;
191
+ metadata?: JsonObject;
192
+ };
193
+ type StudioSessionLogListOptions = {
194
+ sessionId: string;
195
+ limit: number;
196
+ after?: number;
197
+ };
113
198
  type StudioSessionStore = MemoryStore & {
114
199
  readonly kind?: string;
115
200
  listSessions(options: StudioSessionListOptions): StudioSessionSummary[] | Promise<StudioSessionSummary[]>;
116
201
  createSession(input: StudioSessionCreateInput): StudioSessionSummary | Promise<StudioSessionSummary>;
117
202
  getSession(id: string): StudioSession | undefined | Promise<StudioSession | undefined>;
118
203
  saveSessionRunTranscript(input: StudioSessionRunTranscriptInput): StudioSession | undefined | Promise<StudioSession | undefined>;
204
+ appendSessionLog?(input: StudioSessionLogAppendInput): StudioSessionLogEntry | Promise<StudioSessionLogEntry>;
205
+ listSessionLogs?(options: StudioSessionLogListOptions): StudioSessionLogEntry[] | Promise<StudioSessionLogEntry[]>;
119
206
  deleteSession?(id: string): boolean | Promise<boolean>;
120
207
  };
121
208
  type StudioTraceStatus = "running" | "success" | "error";
@@ -212,6 +299,8 @@ type StudioKnowledgeSummary = {
212
299
  type StudioStores = {
213
300
  sessions?: StudioSessionStore | false;
214
301
  traces?: StudioTraceStore;
302
+ pipelineLogs?: StudioPipelineLogStore | false;
303
+ pipelineRuns?: StudioPipelineRunStore | false;
215
304
  };
216
305
  type StudioUiOptions = {
217
306
  path?: string;
@@ -310,6 +399,95 @@ type StudioToolQuestionResultEvent = {
310
399
  type: "tool_question_result";
311
400
  question: StudioToolQuestion;
312
401
  };
402
+ type StudioSessionLogEvent = {
403
+ type: "session_log";
404
+ log: StudioSessionLogEntry;
405
+ };
406
+ type StudioPipelineLogLevel = "debug" | "info" | "warn" | "error";
407
+ type StudioPipelineLogCategory = "pipeline" | "run" | "stage" | "parallel" | "agent" | "extractor" | "api";
408
+ type StudioPipelineLogEntry = {
409
+ id: string;
410
+ pipelineId: string;
411
+ runId?: string;
412
+ sequence: number;
413
+ timestamp: string;
414
+ level: StudioPipelineLogLevel;
415
+ category: StudioPipelineLogCategory;
416
+ event: string;
417
+ message: string;
418
+ metadata?: JsonObject;
419
+ };
420
+ type StudioPipelineLogAppendInput = {
421
+ pipelineId: string;
422
+ runId?: string;
423
+ level: StudioPipelineLogLevel;
424
+ category: StudioPipelineLogCategory;
425
+ event: string;
426
+ message: string;
427
+ metadata?: JsonObject;
428
+ };
429
+ type StudioPipelineLogListOptions = {
430
+ pipelineId: string;
431
+ limit: number;
432
+ after?: number;
433
+ };
434
+ type StudioPipelineLogStore = {
435
+ appendPipelineLog(input: StudioPipelineLogAppendInput): StudioPipelineLogEntry | Promise<StudioPipelineLogEntry>;
436
+ listPipelineLogs(options: StudioPipelineLogListOptions): StudioPipelineLogEntry[] | Promise<StudioPipelineLogEntry[]>;
437
+ };
438
+ type StudioPipelineLogEvent = {
439
+ type: "pipeline_log";
440
+ log: StudioPipelineLogEntry;
441
+ };
442
+ type StudioPipelineFinalEvent = {
443
+ type: "pipeline_final";
444
+ runId: string;
445
+ pipelineId: string;
446
+ output: JsonValue;
447
+ };
448
+ type StudioPipelineRunStatus = "running" | "success" | "error";
449
+ type StudioPipelineRunRecord = {
450
+ runId: string;
451
+ pipelineId: string;
452
+ status: StudioPipelineRunStatus;
453
+ input: JsonValue;
454
+ output?: JsonValue;
455
+ error?: JsonValue;
456
+ metadata?: JsonObject;
457
+ startedAt: string;
458
+ endedAt?: string;
459
+ durationMs?: number;
460
+ };
461
+ type StudioPipelineRunSaveInput = {
462
+ runId: string;
463
+ pipelineId: string;
464
+ status: StudioPipelineRunStatus;
465
+ input: JsonValue;
466
+ output?: JsonValue;
467
+ error?: JsonValue;
468
+ metadata?: JsonObject;
469
+ startedAt: string;
470
+ endedAt?: string;
471
+ durationMs?: number;
472
+ };
473
+ type StudioPipelineRunListOptions = {
474
+ pipelineId: string;
475
+ limit: number;
476
+ };
477
+ type StudioPipelineRunStore = {
478
+ savePipelineRun(input: StudioPipelineRunSaveInput): StudioPipelineRunRecord | Promise<StudioPipelineRunRecord>;
479
+ listPipelineRuns(options: StudioPipelineRunListOptions): StudioPipelineRunRecord[] | Promise<StudioPipelineRunRecord[]>;
480
+ };
481
+ type StudioPipelineRunRequest = {
482
+ input: JsonValue;
483
+ stream?: boolean;
484
+ metadata?: JsonObject;
485
+ };
486
+ type StudioPipelineRunResponse = {
487
+ runId: string;
488
+ pipelineId: string;
489
+ output: JsonValue;
490
+ };
313
491
  type AgentRunRequest = {
314
492
  message: string | Message;
315
493
  history?: Message[];
@@ -321,7 +499,7 @@ type AgentRunRequest = {
321
499
  trace?: AgentTraceOptions;
322
500
  };
323
501
  type AgentRunResponse = PromptResponse;
324
- type AgentRunStreamEvent = AgentStreamEvent | StudioToolApprovalRequestEvent | StudioToolApprovalResultEvent | StudioToolQuestionRequestEvent | StudioToolQuestionResultEvent;
502
+ type AgentRunStreamEvent = AgentStreamEvent | StudioToolApprovalRequestEvent | StudioToolApprovalResultEvent | StudioToolQuestionRequestEvent | StudioToolQuestionResultEvent | StudioSessionLogEvent | StudioPipelineLogEvent | StudioPipelineFinalEvent;
325
503
  type StudioErrorCode = "bad_request" | "conflict" | "not_found" | "unsupported_capability" | "internal_error";
326
504
  type StudioErrorResponse = {
327
505
  error: {
@@ -352,7 +530,7 @@ declare class Studio implements AnviaStudio {
352
530
  private studio;
353
531
  private server;
354
532
  private sigintHandler;
355
- constructor(agents?: Agent[], options?: StudioOptions);
533
+ constructor(targets?: StudioTarget[], options?: StudioOptions);
356
534
  get app(): Hono;
357
535
  fetch(request: Request): Response | Promise<Response>;
358
536
  config(): StudioConfig;
@@ -364,6 +542,6 @@ declare class Studio implements AnviaStudio {
364
542
  type SqliteSessionStoreOptions = {
365
543
  path?: string;
366
544
  };
367
- declare function createSqliteSessionStore(options?: SqliteSessionStoreOptions): StudioSessionStore & StudioTraceStore;
545
+ declare function createSqliteSessionStore(options?: SqliteSessionStoreOptions): StudioSessionStore & StudioTraceStore & StudioPipelineLogStore & StudioPipelineRunStore;
368
546
 
369
- export { type AgentRunRequest, type AgentRunResponse, type AgentRunStreamEvent, type AnviaStudio, type SqliteSessionStoreOptions, Studio, type StudioAgent, type StudioAgentConfig, type StudioAgentKnowledgeConfig, type StudioCapability, type StudioCapabilityConfig, type StudioConfig, type StudioErrorCode, type StudioErrorResponse, type StudioKnowledgeEvidence, type StudioKnowledgeEvidenceDocument, type StudioKnowledgeSourceKind, type StudioKnowledgeSourceSummary, type StudioKnowledgeSummary, type StudioOptions, type StudioServeOptions, type StudioSession, type StudioSessionCreateInput, type StudioSessionListOptions, type StudioSessionRunStatus, type StudioSessionRunTranscriptInput, type StudioSessionStore, type StudioSessionSummary, type StudioSessionTraceListOptions, type StudioStaticKnowledgeDocument, type StudioStores, type StudioToolApproval, type StudioToolApprovalDecision, type StudioToolApprovalRequestEvent, type StudioToolApprovalResultEvent, type StudioToolApprovalStatus, type StudioToolApprovalTranscript, type StudioToolQuestion, type StudioToolQuestionAnswer, type StudioToolQuestionChoice, type StudioToolQuestionPrompt, type StudioToolQuestionRequestEvent, type StudioToolQuestionResultEvent, type StudioToolQuestionStatus, type StudioToolQuestionTranscript, type StudioTrace, type StudioTraceListOptions, type StudioTraceObservation, type StudioTraceObservationKind, StudioTraceObserver, type StudioTraceObserverOptions, type StudioTraceStatus, type StudioTraceStore, type StudioTraceSummary, type StudioTranscriptChatEntry, type StudioTranscriptChildAgentEvent, type StudioTranscriptEntry, type StudioTranscriptReasoningEntry, type StudioTranscriptToolEntry, type StudioUiOptions, createSqliteSessionStore };
547
+ export { type AgentRunRequest, type AgentRunResponse, type AgentRunStreamEvent, type AnviaStudio, type SqliteSessionStoreOptions, Studio, type StudioAgent, type StudioAgentConfig, type StudioAgentKnowledgeConfig, type StudioAgentMcpServerMetadata, type StudioAgentMcpToolMetadata, type StudioAgentMcpsSummary, type StudioAgentToolApprovalMetadata, type StudioAgentToolMetadata, type StudioAgentToolSource, type StudioAgentToolsSummary, type StudioCapability, type StudioCapabilityConfig, type StudioConfig, type StudioErrorCode, type StudioErrorResponse, type StudioKnowledgeEvidence, type StudioKnowledgeEvidenceDocument, type StudioKnowledgeSourceKind, type StudioKnowledgeSourceSummary, type StudioKnowledgeSummary, 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 StudioPipelineRunListOptions, type StudioPipelineRunRecord, type StudioPipelineRunRequest, type StudioPipelineRunResponse, type StudioPipelineRunSaveInput, type StudioPipelineRunStatus, type StudioPipelineRunStore, 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 StudioStores, type StudioTarget, type StudioToolApproval, type StudioToolApprovalDecision, type StudioToolApprovalRequestEvent, type StudioToolApprovalResultEvent, type StudioToolApprovalStatus, type StudioToolApprovalTranscript, type StudioToolQuestion, type StudioToolQuestionAnswer, type StudioToolQuestionChoice, type StudioToolQuestionPrompt, type StudioToolQuestionRequestEvent, type StudioToolQuestionResultEvent, type StudioToolQuestionStatus, type StudioToolQuestionTranscript, type StudioTrace, type StudioTraceListOptions, type StudioTraceObservation, type StudioTraceObservationKind, StudioTraceObserver, type StudioTraceObserverOptions, type StudioTraceStatus, type StudioTraceStore, type StudioTraceSummary, type StudioTranscriptChatEntry, type StudioTranscriptChildAgentEvent, type StudioTranscriptEntry, type StudioTranscriptReasoningEntry, type StudioTranscriptToolEntry, type StudioUiOptions, createSqliteSessionStore };