@anvia/studio 0.2.8 → 0.2.10
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/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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';
|
|
2
|
+
import { Message, JsonObject, AgentTraceOptions, PromptResponse, AgentStreamEvent, JsonValue, Agent, Pipeline, Usage, AgentTraceInfo, PipelineGraph, ToolResultContent, MemoryStore, AgentObserver, AgentRunStartArgs, AgentRunObserver } from '@anvia/core';
|
|
3
3
|
|
|
4
4
|
type StudioCapability = "agents" | "approvals" | "knowledge" | "mcps" | "observability" | "pipelines" | "sessions" | "tools" | "traces";
|
|
5
5
|
type StudioAgent = {
|
|
@@ -110,6 +110,7 @@ type StudioTranscriptToolEntry = {
|
|
|
110
110
|
callId?: string;
|
|
111
111
|
args?: string;
|
|
112
112
|
result?: string;
|
|
113
|
+
structuredResult?: ToolResultContent[];
|
|
113
114
|
childEvents?: StudioTranscriptChildAgentEvent[];
|
|
114
115
|
approval?: StudioToolApprovalTranscript;
|
|
115
116
|
question?: StudioToolQuestionTranscript;
|
|
@@ -133,6 +134,7 @@ type StudioTranscriptChildAgentEvent = {
|
|
|
133
134
|
callId?: string;
|
|
134
135
|
args?: string;
|
|
135
136
|
result?: string;
|
|
137
|
+
structuredResult?: ToolResultContent[];
|
|
136
138
|
};
|
|
137
139
|
type StudioTranscriptEntry = StudioTranscriptChatEntry | StudioTranscriptReasoningEntry | StudioTranscriptToolEntry;
|
|
138
140
|
type StudioSessionSummary = {
|
package/dist/index.js
CHANGED
|
@@ -1851,7 +1851,10 @@ function transcriptFromMessagesFallback(messages) {
|
|
|
1851
1851
|
kind: "tool",
|
|
1852
1852
|
toolName: "tool_result",
|
|
1853
1853
|
callId: content.callId ?? content.id,
|
|
1854
|
-
result: content.content.map(
|
|
1854
|
+
result: content.content.map(
|
|
1855
|
+
(item) => "text" in item ? item.text : `[image:${item.mediaType ?? "image/png"}]`
|
|
1856
|
+
).join("\n"),
|
|
1857
|
+
structuredResult: content.content
|
|
1855
1858
|
});
|
|
1856
1859
|
}
|
|
1857
1860
|
continue;
|
|
@@ -3247,12 +3250,16 @@ function acceptTranscriptStreamEvent(transcript, event) {
|
|
|
3247
3250
|
toolName: event.toolName,
|
|
3248
3251
|
...event.toolCallId === void 0 ? {} : { callId: event.toolCallId },
|
|
3249
3252
|
args: event.args,
|
|
3250
|
-
result: event.result
|
|
3253
|
+
result: event.result,
|
|
3254
|
+
...event.structuredResult === void 0 ? {} : { structuredResult: event.structuredResult }
|
|
3251
3255
|
});
|
|
3252
3256
|
return;
|
|
3253
3257
|
}
|
|
3254
3258
|
matched.args = matched.args ?? event.args;
|
|
3255
3259
|
matched.result = event.result;
|
|
3260
|
+
if (event.structuredResult !== void 0) {
|
|
3261
|
+
matched.structuredResult = event.structuredResult;
|
|
3262
|
+
}
|
|
3256
3263
|
}
|
|
3257
3264
|
if (event.type === "agent_tool_event") {
|
|
3258
3265
|
const matched = findTranscriptToolEntry(transcript, event.toolName, event.toolCallId);
|
|
@@ -3414,7 +3421,8 @@ function childAgentTranscriptEvent(event) {
|
|
|
3414
3421
|
toolName: child.toolName,
|
|
3415
3422
|
...child.toolCallId === void 0 ? {} : { callId: child.toolCallId },
|
|
3416
3423
|
args: child.args,
|
|
3417
|
-
result: child.result
|
|
3424
|
+
result: child.result,
|
|
3425
|
+
...child.structuredResult === void 0 ? {} : { structuredResult: child.structuredResult }
|
|
3418
3426
|
};
|
|
3419
3427
|
}
|
|
3420
3428
|
if (child.type === "error") {
|
|
@@ -3474,7 +3482,10 @@ function transcriptFromMessages(messages) {
|
|
|
3474
3482
|
kind: "tool",
|
|
3475
3483
|
toolName: "tool_result",
|
|
3476
3484
|
callId: content.callId ?? content.id,
|
|
3477
|
-
result: content.content.map(
|
|
3485
|
+
result: content.content.map(
|
|
3486
|
+
(item) => "text" in item ? item.text : `[image:${item.mediaType ?? "image/png"}]`
|
|
3487
|
+
).join("\n"),
|
|
3488
|
+
structuredResult: content.content
|
|
3478
3489
|
});
|
|
3479
3490
|
}
|
|
3480
3491
|
continue;
|
|
@@ -3579,7 +3590,9 @@ function extractMessageText(message) {
|
|
|
3579
3590
|
return [`${item.function.name}(${formatJson2(item.function.arguments)})`];
|
|
3580
3591
|
}
|
|
3581
3592
|
if (item.type === "tool_result") {
|
|
3582
|
-
return item.content.map(
|
|
3593
|
+
return item.content.map(
|
|
3594
|
+
(result) => "text" in result ? result.text : `[image:${result.mediaType ?? "image/png"}]`
|
|
3595
|
+
);
|
|
3583
3596
|
}
|
|
3584
3597
|
return [];
|
|
3585
3598
|
}).join("\n");
|
|
@@ -4445,7 +4458,8 @@ function logsFromStreamEvent(props) {
|
|
|
4445
4458
|
callId: event.toolCallId,
|
|
4446
4459
|
internalCallId: event.internalCallId,
|
|
4447
4460
|
argumentBytes: byteLength3(event.args),
|
|
4448
|
-
resultBytes: byteLength3(event.result)
|
|
4461
|
+
resultBytes: byteLength3(event.result),
|
|
4462
|
+
structuredResultBytes: event.structuredResult === void 0 ? void 0 : byteLength3(JSON.stringify(event.structuredResult))
|
|
4449
4463
|
})
|
|
4450
4464
|
}
|
|
4451
4465
|
];
|
|
@@ -4613,7 +4627,8 @@ function childAgentLog(event, sessionId, runId) {
|
|
|
4613
4627
|
childTurn: child.turn,
|
|
4614
4628
|
toolName: child.toolName,
|
|
4615
4629
|
callId: child.toolCallId,
|
|
4616
|
-
resultBytes: byteLength3(child.result)
|
|
4630
|
+
resultBytes: byteLength3(child.result),
|
|
4631
|
+
structuredResultBytes: child.structuredResult === void 0 ? void 0 : byteLength3(JSON.stringify(child.structuredResult))
|
|
4617
4632
|
})
|
|
4618
4633
|
}
|
|
4619
4634
|
];
|