@anvia/studio 1.0.0-rc.9 → 1.0.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/dist/index.d.ts +2 -2
- package/dist/index.js +27 -20
- package/dist/index.js.map +1 -1
- package/dist/ui/assets/index-BtvoCaW7.js +12 -0
- package/dist/ui/assets/index-BtvoCaW7.js.map +1 -0
- package/dist/ui/assets/index-CFbK-pX6.css +2 -0
- package/dist/ui/assets/{knowledge-page-DzRhA9qQ.js → knowledge-page-DZeLh92t.js} +2 -2
- package/dist/ui/assets/{knowledge-page-DzRhA9qQ.js.map → knowledge-page-DZeLh92t.js.map} +1 -1
- package/dist/ui/assets/{mcps-page-ZVngljXI.js → mcps-page-CDPMO2x9.js} +2 -2
- package/dist/ui/assets/{mcps-page-ZVngljXI.js.map → mcps-page-CDPMO2x9.js.map} +1 -1
- package/dist/ui/assets/{memory-page-CRmoZTWz.js → memory-page-D3UhjpTb.js} +2 -2
- package/dist/ui/assets/{memory-page-CRmoZTWz.js.map → memory-page-D3UhjpTb.js.map} +1 -1
- package/dist/ui/assets/{pipelines-page-8osYA129.js → pipelines-page-BP8R6NI7.js} +2 -2
- package/dist/ui/assets/{pipelines-page-8osYA129.js.map → pipelines-page-BP8R6NI7.js.map} +1 -1
- package/dist/ui/assets/{renderers-BPGo4d2i.js → renderers-DHMEAblV.js} +2 -2
- package/dist/ui/assets/{renderers-BPGo4d2i.js.map → renderers-DHMEAblV.js.map} +1 -1
- package/dist/ui/assets/{status-page-DfuQ0fpa.js → status-page-eA8uRLZQ.js} +2 -2
- package/dist/ui/assets/{status-page-DfuQ0fpa.js.map → status-page-eA8uRLZQ.js.map} +1 -1
- package/dist/ui/assets/{tool-runner-Cdrcs2v4.js → tool-runner-D3-SlGqQ.js} +2 -2
- package/dist/ui/assets/{tool-runner-Cdrcs2v4.js.map → tool-runner-D3-SlGqQ.js.map} +1 -1
- package/dist/ui/assets/{tools-page-C865VQmM.js → tools-page-D3gnQf1_.js} +2 -2
- package/dist/ui/assets/{tools-page-C865VQmM.js.map → tools-page-D3gnQf1_.js.map} +1 -1
- package/dist/ui/assets/{transcript-item-BadzBIzE.js → transcript-item-BmjdZLbS.js} +2 -2
- package/dist/ui/assets/{transcript-item-BadzBIzE.js.map → transcript-item-BmjdZLbS.js.map} +1 -1
- package/dist/ui/index.html +2 -2
- package/package.json +7 -7
- package/dist/ui/assets/index-BGNC3dLD.css +0 -1
- package/dist/ui/assets/index-Cd0icc_h.js +0 -12
- package/dist/ui/assets/index-Cd0icc_h.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
2
|
import { AgentObserver, AgentRunStartArgs, AgentRunObserver } from '@anvia/core/observability';
|
|
3
|
-
import {
|
|
3
|
+
import { AgentOutcome, AgentInteractionOutcome, AgentStreamEvent, Agent } from '@anvia/core/agent';
|
|
4
4
|
import { AgentInteractionResponse } from '@anvia/core/agent/interactions';
|
|
5
5
|
import { JsonObject, Message, JsonValue, CompletionModelCapabilities, ToolResultContentPart, Usage, CompletionModel, StreamingCompletionModel } from '@anvia/core/completion';
|
|
6
6
|
import { MemoryStore, MemoryAppendOptions, MemoryErrorOptions, MemoryScope } from '@anvia/core/memory';
|
|
@@ -1009,7 +1009,7 @@ type AgentRunRequest = (AgentRunRequestBase & {
|
|
|
1009
1009
|
toolConcurrency?: never;
|
|
1010
1010
|
model?: never;
|
|
1011
1011
|
});
|
|
1012
|
-
type AgentRunResponse = Exclude<
|
|
1012
|
+
type AgentRunResponse = Exclude<AgentOutcome, AgentInteractionOutcome> | Omit<AgentInteractionOutcome, "continuation" | "messages">;
|
|
1013
1013
|
type AgentRunStreamEvent = AgentStreamEvent | StudioSessionLogEvent | StudioPipelineLogEvent | StudioPipelineFinalEvent;
|
|
1014
1014
|
type StudioErrorCode = "bad_request" | "conflict" | "forbidden" | "not_found" | "payload_too_large" | "unsupported_capability" | "internal_error";
|
|
1015
1015
|
type StudioErrorResponse = {
|
package/dist/index.js
CHANGED
|
@@ -1870,7 +1870,7 @@ function withAgentRunCancellation(events, onCancel) {
|
|
|
1870
1870
|
}
|
|
1871
1871
|
return next;
|
|
1872
1872
|
}
|
|
1873
|
-
if (next.value
|
|
1873
|
+
if (isTerminalAgentEvent(next.value)) {
|
|
1874
1874
|
terminal = true;
|
|
1875
1875
|
}
|
|
1876
1876
|
return next;
|
|
@@ -1947,10 +1947,10 @@ function createPersistedStreamingSessionTranscript(props) {
|
|
|
1947
1947
|
return;
|
|
1948
1948
|
}
|
|
1949
1949
|
acceptTranscriptStreamEvent(transcript, event);
|
|
1950
|
-
if (event
|
|
1950
|
+
if (isTerminalAgentEvent(event)) {
|
|
1951
1951
|
assignTranscriptRunDuration(transcript, Date.now() - props.startedAt);
|
|
1952
1952
|
}
|
|
1953
|
-
const eventStatus = event.type === "
|
|
1953
|
+
const eventStatus = event.type === "response" || event.type === "interaction" || event.type === "blocked" ? event.type === "interaction" ? "suspended" : "success" : event.type === "error" ? "error" : "running";
|
|
1954
1954
|
const saveInput = {
|
|
1955
1955
|
id: props.session.id,
|
|
1956
1956
|
runId: props.runId,
|
|
@@ -1960,7 +1960,7 @@ function createPersistedStreamingSessionTranscript(props) {
|
|
|
1960
1960
|
};
|
|
1961
1961
|
if (event.type === "error") saveInput.error = serializeError(event.error);
|
|
1962
1962
|
await saveTranscript(saveInput);
|
|
1963
|
-
const generatedMessages = event.type === "
|
|
1963
|
+
const generatedMessages = event.type === "response" || event.type === "interaction" || event.type === "blocked" ? event.messages.slice(props.generatedMessagesStartIndex ?? 1) : [];
|
|
1964
1964
|
if (props.persistGeneratedMessages === true && generatedMessages.length > 0) {
|
|
1965
1965
|
await props.store.append({
|
|
1966
1966
|
scope: { sessionId: props.session.id },
|
|
@@ -2108,8 +2108,8 @@ function acceptTranscriptStreamEvent(transcript, event) {
|
|
|
2108
2108
|
}
|
|
2109
2109
|
appendChildAgentTranscriptEvent(matched, event);
|
|
2110
2110
|
}
|
|
2111
|
-
if (event.type === "
|
|
2112
|
-
const interaction = event.
|
|
2111
|
+
if (event.type === "interaction") {
|
|
2112
|
+
const interaction = event.interaction;
|
|
2113
2113
|
const matched = findTranscriptToolEntry(
|
|
2114
2114
|
transcript,
|
|
2115
2115
|
interaction.toolName,
|
|
@@ -2167,8 +2167,8 @@ function acceptTranscriptStreamEvent(transcript, event) {
|
|
|
2167
2167
|
};
|
|
2168
2168
|
}
|
|
2169
2169
|
}
|
|
2170
|
-
if (event.type === "
|
|
2171
|
-
assignTranscriptTraceId(transcript, event.
|
|
2170
|
+
if ((event.type === "response" || event.type === "interaction" || event.type === "blocked") && event.trace?.traceId !== void 0) {
|
|
2171
|
+
assignTranscriptTraceId(transcript, event.trace.traceId);
|
|
2172
2172
|
}
|
|
2173
2173
|
if (event.type === "error") {
|
|
2174
2174
|
appendTranscriptAssistantError(transcript, errorText(event.error));
|
|
@@ -2583,6 +2583,9 @@ function toolResultOutputText(output) {
|
|
|
2583
2583
|
(part) => part.type === "text" ? part.text : `[file:${part.mediaType}${part.filename === void 0 ? "" : `:${part.filename}`}]`
|
|
2584
2584
|
).join("\n");
|
|
2585
2585
|
}
|
|
2586
|
+
function isTerminalAgentEvent(event) {
|
|
2587
|
+
return event.type === "response" || event.type === "interaction" || event.type === "blocked" || event.type === "error";
|
|
2588
|
+
}
|
|
2586
2589
|
|
|
2587
2590
|
// src/runtime/session-logs.ts
|
|
2588
2591
|
async function appendSessionLog(store, input) {
|
|
@@ -2722,6 +2725,10 @@ function memoryCompactedLog(props) {
|
|
|
2722
2725
|
originalMessageCount: props.originalMessageCount,
|
|
2723
2726
|
compactedMessageCount: props.compactedMessageCount,
|
|
2724
2727
|
retainedMessageCount: props.retainedMessageCount,
|
|
2728
|
+
originalTokenCount: props.originalTokenCount,
|
|
2729
|
+
compactedTokenCount: props.compactedTokenCount,
|
|
2730
|
+
retainedTokenCount: props.retainedTokenCount,
|
|
2731
|
+
resultTokenCount: props.resultTokenCount,
|
|
2725
2732
|
attempts: props.attempts
|
|
2726
2733
|
};
|
|
2727
2734
|
const usage = usageSummary(props.usage);
|
|
@@ -2833,10 +2840,10 @@ function logsFromStreamEvent(props) {
|
|
|
2833
2840
|
}
|
|
2834
2841
|
];
|
|
2835
2842
|
}
|
|
2836
|
-
if (event.type === "
|
|
2837
|
-
const result = event
|
|
2843
|
+
if (event.type === "response" || event.type === "interaction" || event.type === "blocked") {
|
|
2844
|
+
const result = event;
|
|
2838
2845
|
const logs = [];
|
|
2839
|
-
if (result.
|
|
2846
|
+
if (result.type === "interaction") {
|
|
2840
2847
|
logs.push({
|
|
2841
2848
|
sessionId,
|
|
2842
2849
|
runId,
|
|
@@ -2991,15 +2998,15 @@ function childAgentLog(event, sessionId, runId) {
|
|
|
2991
2998
|
}
|
|
2992
2999
|
];
|
|
2993
3000
|
}
|
|
2994
|
-
if (child.type === "
|
|
2995
|
-
const result = child
|
|
3001
|
+
if (child.type === "response" || child.type === "interaction" || child.type === "blocked") {
|
|
3002
|
+
const result = child;
|
|
2996
3003
|
const metadata = {
|
|
2997
3004
|
parentToolName: event.toolName,
|
|
2998
3005
|
agentId: event.agentId,
|
|
2999
3006
|
hasAgentName: event.agentName !== void 0,
|
|
3000
3007
|
outputBytes: byteLength2(result.text),
|
|
3001
3008
|
messageCount: result.messages.length,
|
|
3002
|
-
status: result.
|
|
3009
|
+
status: result.type
|
|
3003
3010
|
};
|
|
3004
3011
|
const usage = usageSummary(result.usage);
|
|
3005
3012
|
if (usage !== void 0) metadata.usage = usage;
|
|
@@ -3383,7 +3390,7 @@ async function handleBufferedAgentRun(c, run, props) {
|
|
|
3383
3390
|
try {
|
|
3384
3391
|
const runtimeOptions = await startBufferedSessionRun(run);
|
|
3385
3392
|
const result = await run.execution.generate(runtimeOptions);
|
|
3386
|
-
if (result.
|
|
3393
|
+
if (result.type === "interaction") {
|
|
3387
3394
|
props.continuationRegistry.register({ continuation: result.continuation, context: run });
|
|
3388
3395
|
}
|
|
3389
3396
|
await completeBufferedSessionRun(run, result);
|
|
@@ -3394,7 +3401,7 @@ async function handleBufferedAgentRun(c, run, props) {
|
|
|
3394
3401
|
}
|
|
3395
3402
|
}
|
|
3396
3403
|
function agentRunResponse(result) {
|
|
3397
|
-
if (result.
|
|
3404
|
+
if (result.type !== "interaction") return result;
|
|
3398
3405
|
const { continuation: _continuation, messages: _messages, ...response } = result;
|
|
3399
3406
|
return response;
|
|
3400
3407
|
}
|
|
@@ -3428,8 +3435,8 @@ async function startBufferedSessionRun(run) {
|
|
|
3428
3435
|
}
|
|
3429
3436
|
async function* registerStreamingContinuation(stream, registry, run) {
|
|
3430
3437
|
for await (const event of stream) {
|
|
3431
|
-
if (event.type === "
|
|
3432
|
-
registry.register({ continuation: event.
|
|
3438
|
+
if (event.type === "interaction") {
|
|
3439
|
+
registry.register({ continuation: event.continuation, context: run });
|
|
3433
3440
|
}
|
|
3434
3441
|
yield event;
|
|
3435
3442
|
}
|
|
@@ -3457,7 +3464,7 @@ async function completeBufferedSessionRun(run, response) {
|
|
|
3457
3464
|
runId: run.runId,
|
|
3458
3465
|
...optionalTitle(run.body.messages.at(-1)),
|
|
3459
3466
|
transcript,
|
|
3460
|
-
status: response.
|
|
3467
|
+
status: response.type === "interaction" ? "suspended" : "success"
|
|
3461
3468
|
});
|
|
3462
3469
|
if (response.memoryCompaction !== void 0 && !run.memoryCompactionLogged) {
|
|
3463
3470
|
await appendSessionLog(
|
|
@@ -3472,7 +3479,7 @@ async function completeBufferedSessionRun(run, response) {
|
|
|
3472
3479
|
}
|
|
3473
3480
|
await appendSessionLog(
|
|
3474
3481
|
run.sessionStore,
|
|
3475
|
-
response.
|
|
3482
|
+
response.type === "interaction" ? {
|
|
3476
3483
|
sessionId: run.session.id,
|
|
3477
3484
|
runId: run.runId,
|
|
3478
3485
|
level: "info",
|