@agentuity/workbench 0.0.70 → 0.0.71
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/components/internal/Chat.d.ts.map +1 -1
- package/dist/components/internal/Chat.js +7 -2
- package/dist/components/internal/Chat.js.map +1 -1
- package/dist/components/internal/WorkbenchProvider.d.ts.map +1 -1
- package/dist/components/internal/WorkbenchProvider.js +13 -0
- package/dist/components/internal/WorkbenchProvider.js.map +1 -1
- package/dist/components/internal/logo.d.ts +6 -1
- package/dist/components/internal/logo.d.ts.map +1 -1
- package/dist/components/internal/logo.js +7 -3
- package/dist/components/internal/logo.js.map +1 -1
- package/dist/lib/utils.d.ts +13 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +29 -0
- package/dist/lib/utils.js.map +1 -1
- package/dist/styles.css +8 -82
- package/package.json +3 -3
- package/src/components/internal/Chat.tsx +16 -6
- package/src/components/internal/WorkbenchProvider.tsx +17 -1
- package/src/components/internal/logo.tsx +36 -10
- package/src/lib/utils.ts +34 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/components/internal/Chat.tsx"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAgB1B,MAAM,WAAW,SAAS;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/components/internal/Chat.tsx"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAgB1B,MAAM,WAAW,SAAS;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,SAAS,2CAsKxD;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -32,9 +32,14 @@ export function Chat({ className: _className }) {
|
|
|
32
32
|
await submitMessage(value);
|
|
33
33
|
setValue('');
|
|
34
34
|
};
|
|
35
|
-
return (_jsxs("div", { className: "relative flex flex-1 overflow-hidden", children: [_jsxs("div", { className: cn('flex flex-col flex-1 transition-all duration-300 ease-in-out min-w-0', schemaOpen && 'mr-[600px]'), children: [_jsxs(Conversation, { className: "flex-1 overflow-y-auto", children: [_jsx(ConversationContent, { className: "pb-0", children: messages.map((
|
|
35
|
+
return (_jsxs("div", { className: "relative flex flex-1 overflow-hidden", children: [_jsxs("div", { className: cn('flex flex-col flex-1 transition-all duration-300 ease-in-out min-w-0', schemaOpen && 'mr-[600px]'), children: [_jsxs(Conversation, { className: "flex-1 overflow-y-auto", children: [_jsx(ConversationContent, { className: "pb-0", children: messages.map((message) => {
|
|
36
|
+
const { role, parts, id } = message;
|
|
36
37
|
const isStreaming = parts.some((part) => part.type === 'text' && part.state === 'streaming');
|
|
37
|
-
|
|
38
|
+
const tokens = 'tokens' in message ? message.tokens : undefined;
|
|
39
|
+
const duration = 'duration' in message
|
|
40
|
+
? message.duration
|
|
41
|
+
: undefined;
|
|
42
|
+
return (_jsxs("div", { className: "mb-2", children: [role === 'assistant' && (_jsxs("div", { className: cn('w-fit flex items-center mb-2 text-muted-foreground text-sm transition-colors', !isStreaming && 'hover:text-foreground cursor-pointer'), children: [_jsx(Loader, { className: cn('size-4 transition-all', isStreaming || isLoading ? 'animate-spin mr-2' : 'w-0 mr-2.5') }), isStreaming || isLoading ? (_jsx(Shimmer, { duration: 1, children: "Running..." })) : (_jsxs(_Fragment, { children: [duration && (_jsxs(_Fragment, { children: ["Ran for", _jsx("span", { className: "mx-1", children: duration })] })), duration && tokens && ` and consumed ${tokens} tokens`, (duration || tokens) && _jsx(ChevronRight, { className: "size-4" })] }))] })), !(isStreaming || isLoading) && (_jsxs(_Fragment, { children: [_jsx(Message, { from: role, className: "p-0", children: _jsx(MessageContent, { children: parts.map((part, index) => {
|
|
38
43
|
switch (part.type) {
|
|
39
44
|
case 'text':
|
|
40
45
|
return (_jsx("div", { children: part.text || '' }, `${id}-${part.text}-${index}`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chat.js","sourceRoot":"","sources":["../../../src/components/internal/Chat.tsx"],"names":[],"mappings":";AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,wBAAwB,GACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAMlC;;;GAGG;AACH,MAAM,UAAU,IAAI,CAAC,EAAE,SAAS,EAAE,UAAU,EAAa;IACxD,MAAM,EACL,MAAM,EACN,WAAW,EACX,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,aAAa,GACb,GAAG,YAAY,EAAE,CAAC;IAEnB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACvC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEpD,MAAM,YAAY,GAAG,KAAK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AAC,IAAI,IAAC,SAAS,EAAC,QAAQ,GAAG,GACnB,IACA,IACR,CACH,KAzFQ,EAAE,CA0FN,CACN,CAAC;gCACH,CAAC,CAAC,GACmB,EAEtB,KAAC,wBAAwB,KAAG,IACd,EACf,KAAC,YAAY,IACZ,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,GACtC,IACG,EAEN,KAAC,MAAM,IAAC,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,GAAI,IACpD,CACN,CAAC;AACH,CAAC;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkbenchProvider.d.ts","sourceRoot":"","sources":["../../../src/components/internal/WorkbenchProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAE9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAoB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"WorkbenchProvider.d.ts","sourceRoot":"","sources":["../../../src/components/internal/WorkbenchProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAE9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAoB,MAAM,oBAAoB,CAAC;AAOjF,wBAAgB,YAAY,yBAM3B;AAED,UAAU,sBAAsB;IAC/B,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;AAED,wBAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,sBAAsB,2CAiQ7E"}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { createContext, useContext, useEffect, useState } from 'react';
|
|
3
3
|
import { useAgentSchemas } from '../../hooks/useAgentSchemas';
|
|
4
4
|
import { useWorkbenchWebsocket } from '../../hooks/useWorkbenchWebsocket';
|
|
5
|
+
import { getTotalTokens, parseTokensHeader } from '../../lib/utils';
|
|
5
6
|
const WorkbenchContext = createContext(null);
|
|
6
7
|
export function useWorkbench() {
|
|
7
8
|
const context = useContext(WorkbenchContext);
|
|
@@ -140,6 +141,7 @@ export function WorkbenchProvider({ config, children }) {
|
|
|
140
141
|
}
|
|
141
142
|
const controller = new AbortController();
|
|
142
143
|
const timeoutId = setTimeout(() => controller.abort(), 30000); // 30s timeout
|
|
144
|
+
const startTime = performance.now();
|
|
143
145
|
try {
|
|
144
146
|
const response = await fetch(`${baseUrl}/_agentuity/workbench/execute`, {
|
|
145
147
|
method: 'POST',
|
|
@@ -158,12 +160,23 @@ export function WorkbenchProvider({ config, children }) {
|
|
|
158
160
|
throw new Error(errorData.error || `Request failed with status ${response.status}`);
|
|
159
161
|
}
|
|
160
162
|
const result = await response.json();
|
|
163
|
+
const endTime = performance.now();
|
|
164
|
+
const clientDuration = ((endTime - startTime) / 1000).toFixed(1); // Duration in seconds
|
|
165
|
+
// Extract duration from response header, fallback to client-side timing
|
|
166
|
+
const durationHeader = response.headers.get('x-agentuity-duration');
|
|
167
|
+
const duration = durationHeader || `${clientDuration}s`;
|
|
168
|
+
// Extract token count from response header
|
|
169
|
+
const tokensHeader = response.headers.get('x-agentuity-tokens');
|
|
170
|
+
const tokensRecord = tokensHeader ? parseTokensHeader(tokensHeader) : undefined;
|
|
171
|
+
const totalTokens = tokensRecord ? getTotalTokens(tokensRecord) : undefined;
|
|
161
172
|
// Format result as JSON string for display
|
|
162
173
|
const resultText = typeof result === 'object' ? JSON.stringify(result, null, 2) : String(result);
|
|
163
174
|
const assistantMessage = {
|
|
164
175
|
id: (Date.now() + 1).toString(),
|
|
165
176
|
role: 'assistant',
|
|
166
177
|
parts: [{ type: 'text', text: resultText }],
|
|
178
|
+
tokens: totalTokens?.toString(),
|
|
179
|
+
duration,
|
|
167
180
|
};
|
|
168
181
|
setMessages((prev) => [...prev, assistantMessage]);
|
|
169
182
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkbenchProvider.js","sourceRoot":"","sources":["../../../src/components/internal/WorkbenchProvider.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI9E,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"WorkbenchProvider.js","sourceRoot":"","sources":["../../../src/components/internal/WorkbenchProvider.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI9E,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpE,MAAM,gBAAgB,GAAG,aAAa,CAA8B,IAAI,CAAC,CAAC;AAE1E,MAAM,UAAU,YAAY;IAC3B,MAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAC7C,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC;AAOD,MAA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C,CAAC,CAAC;QAChD,CAAC;gBAAS,CAAC;YACV,YAAY,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACF,CAAC,CAAC;IAEF,MAAM,iBAAiB,GAAG,KAAK,EAAE,OAAe,EAAE,EAAE;QACnD,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAC1B,iCAAiC;IAClC,CAAC,CAAC;IAEF,MAAM,YAAY,GAAyB;QAC1C,MAAM;QACN,MAAM,EAAE,MAAM,IAAI,EAAE;QACpB,WAAW;QACX,QAAQ;QACR,WAAW;QACX,aAAa;QACb,gBAAgB,EAAE,iBAAiB;QACnC,SAAS;QACT,YAAY;QACZ,SAAS,EAAE,SAAS,IAAI,CAAC,gBAAgB,IAAI,CAAC,CAAC,cAAc,CAAC;QAC9D,aAAa;QACb,uBAAuB;QACvB,OAAO,EAAE,UAAU;QACnB,cAAc,EAAE,CAAC,CAAC,cAAc;QAChC,YAAY;QACZ,cAAc;QACd,oBAAoB;QACpB,gBAAgB;KAChB,CAAC;IAEF,OAAO,KAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAAG,QAAQ,GAA6B,CAAC;AAC/F,CAAC"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const Logo: React.ForwardRefExoticComponent<{
|
|
3
|
+
className?: string;
|
|
4
|
+
alt?: string;
|
|
5
|
+
} & React.RefAttributes<SVGSVGElement>>;
|
|
6
|
+
export default Logo;
|
|
2
7
|
//# sourceMappingURL=logo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logo.d.ts","sourceRoot":"","sources":["../../../src/components/internal/logo.tsx"],"names":[],"mappings":"AACA,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"logo.d.ts","sourceRoot":"","sources":["../../../src/components/internal/logo.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,QAAA,MAAM,IAAI;gBAA2C,MAAM;UAAQ,MAAM;uCA2BxE,CAAC;AAIF,eAAe,IAAI,CAAC"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
const Logo = forwardRef(({ className = '', alt = 'Agentuity' }, ref) => {
|
|
5
|
+
return (_jsxs("svg", { ref: ref, role: "img", "aria-label": alt, className: cn('fill-cyan-600 dark:fill-cyan-500', className), width: "24", height: "22", viewBox: "0 0 24 22", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("title", { children: alt }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M24 21.3349H0L3.4284 15.3894H0L0.872727 13.8622H19.6909L24 21.3349ZM5.19141 15.3894L2.6437 19.8076H21.3563L18.8086 15.3894H5.19141Z" }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12 0.498535L17.1762 9.49853H20.6182L21.4909 11.0258H5.94545L12 0.498535ZM8.58569 9.49853L12 3.56193L15.4143 9.49853H8.58569Z" })] }));
|
|
6
|
+
});
|
|
7
|
+
Logo.displayName = 'Logo';
|
|
8
|
+
export default Logo;
|
|
5
9
|
//# sourceMappingURL=logo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logo.js","sourceRoot":"","sources":["../../../src/components/internal/logo.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"logo.js","sourceRoot":"","sources":["../../../src/components/internal/logo.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnC,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC,MAAM,IAAI,GAAG,UAAU,CACtB,CAAC,EAAE,SAAS,GAAG,EAAE,EAAE,GAAG,GAAG,WAAW,EAAE,EAAE,GAAG,EAAE,EAAE;IAC9C,OAAO,CACN,eACC,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,KAAK,gBACE,GAAG,EACf,SAAS,EAAE,EAAE,CAAC,kCAAkC,EAAE,SAAS,CAAC,EAC5D,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,KAAK,EAAC,4BAA4B,aAElC,0BAAQ,GAAG,GAAS,EACpB,eACC,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,qIAAqI,GACtI,EACF,eACC,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,+HAA+H,GAChI,IACG,CACN,CAAC;AACH,CAAC,CACD,CAAC;AAEF,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;AAE1B,eAAe,IAAI,CAAC"}
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
import { type ClassValue } from 'clsx';
|
|
2
2
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
3
|
+
/**
|
|
4
|
+
* Parses the x-agentuity-tokens header string into a Record of model names to token counts.
|
|
5
|
+
* Format: "model1:count1, model2:count2" or "model1:count1"
|
|
6
|
+
* @param header - The x-agentuity-tokens header string
|
|
7
|
+
* @returns Record mapping model names to token counts
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseTokensHeader(header: string): Record<string, number>;
|
|
10
|
+
/**
|
|
11
|
+
* Calculates the total number of tokens from a parsed tokens record.
|
|
12
|
+
* @param tokens - Record mapping model names to token counts
|
|
13
|
+
* @returns Total number of tokens
|
|
14
|
+
*/
|
|
15
|
+
export declare function getTotalTokens(tokens: Record<string, number>): number;
|
|
3
16
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAiBxE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAErE"}
|
package/dist/lib/utils.js
CHANGED
|
@@ -3,4 +3,33 @@ import { twMerge } from 'tailwind-merge';
|
|
|
3
3
|
export function cn(...inputs) {
|
|
4
4
|
return twMerge(clsx(inputs));
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Parses the x-agentuity-tokens header string into a Record of model names to token counts.
|
|
8
|
+
* Format: "model1:count1, model2:count2" or "model1:count1"
|
|
9
|
+
* @param header - The x-agentuity-tokens header string
|
|
10
|
+
* @returns Record mapping model names to token counts
|
|
11
|
+
*/
|
|
12
|
+
export function parseTokensHeader(header) {
|
|
13
|
+
const result = {};
|
|
14
|
+
// Split by comma and trim each entry
|
|
15
|
+
const entries = header.split(',').map((entry) => entry.trim());
|
|
16
|
+
for (const entry of entries) {
|
|
17
|
+
const [model, countStr] = entry.split(':').map((s) => s.trim());
|
|
18
|
+
if (model && countStr) {
|
|
19
|
+
const count = Number.parseInt(countStr, 10);
|
|
20
|
+
if (!Number.isNaN(count)) {
|
|
21
|
+
result[model] = count;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Calculates the total number of tokens from a parsed tokens record.
|
|
29
|
+
* @param tokens - Record mapping model names to token counts
|
|
30
|
+
* @returns Total number of tokens
|
|
31
|
+
*/
|
|
32
|
+
export function getTotalTokens(tokens) {
|
|
33
|
+
return Object.keys(tokens).reduce((sum, key) => sum + tokens[key], 0);
|
|
34
|
+
}
|
|
6
35
|
//# sourceMappingURL=utils.js.map
|
package/dist/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,IAAI,EAAE,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,UAAU,EAAE,CAAC,GAAG,MAAoB;IACzC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9B,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,IAAI,EAAE,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,UAAU,EAAE,CAAC,GAAG,MAAoB;IACzC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC/C,MAAM,MAAM,GAA2B,EAAE,CAAC;IAE1C,qCAAqC;IACrC,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAE/D,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAChE,IAAI,KAAK,IAAI,QAAQ,EAAE,CAAC;YACvB,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAC5C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC1B,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;YACvB,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,MAA8B;IAC5D,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AACvE,CAAC"}
|
package/dist/styles.css
CHANGED
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
--color-sky-800: oklch(44.3% 0.11 240.79);
|
|
35
35
|
--color-sky-900: oklch(39.1% 0.09 240.876);
|
|
36
36
|
--color-sky-950: oklch(29.3% 0.066 243.157);
|
|
37
|
-
--color-purple-600: oklch(55.8% 0.288 302.321);
|
|
38
37
|
--color-rose-50: oklch(96.9% 0.015 12.422);
|
|
39
38
|
--color-rose-100: oklch(94.1% 0.03 12.58);
|
|
40
39
|
--color-rose-200: oklch(89.2% 0.058 10.001);
|
|
@@ -75,7 +74,6 @@
|
|
|
75
74
|
--font-weight-normal: 400;
|
|
76
75
|
--font-weight-medium: 500;
|
|
77
76
|
--font-weight-semibold: 600;
|
|
78
|
-
--font-weight-bold: 700;
|
|
79
77
|
--tracking-tight: -0.025em;
|
|
80
78
|
--tracking-wide: 0.025em;
|
|
81
79
|
--tracking-widest: 0.1em;
|
|
@@ -964,13 +962,6 @@
|
|
|
964
962
|
margin-block-end: calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)));
|
|
965
963
|
}
|
|
966
964
|
}
|
|
967
|
-
.space-x-2 {
|
|
968
|
-
:where(& > :not(:last-child)) {
|
|
969
|
-
--tw-space-x-reverse: 0;
|
|
970
|
-
margin-inline-start: calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));
|
|
971
|
-
margin-inline-end: calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)));
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
965
|
.gap-y-0\.5 {
|
|
975
966
|
row-gap: calc(var(--spacing) * 0.5);
|
|
976
967
|
}
|
|
@@ -1210,21 +1201,9 @@
|
|
|
1210
1201
|
.bg-transparent {
|
|
1211
1202
|
background-color: transparent;
|
|
1212
1203
|
}
|
|
1213
|
-
.bg-gradient-to-br {
|
|
1214
|
-
--tw-gradient-position: to bottom right in oklab;
|
|
1215
|
-
background-image: linear-gradient(var(--tw-gradient-stops));
|
|
1216
|
-
}
|
|
1217
1204
|
.bg-none {
|
|
1218
1205
|
background-image: none;
|
|
1219
1206
|
}
|
|
1220
|
-
.from-blue-500 {
|
|
1221
|
-
--tw-gradient-from: var(--color-sky-500);
|
|
1222
|
-
--tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
|
|
1223
|
-
}
|
|
1224
|
-
.to-purple-600 {
|
|
1225
|
-
--tw-gradient-to: var(--color-purple-600);
|
|
1226
|
-
--tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
|
|
1227
|
-
}
|
|
1228
1207
|
.bg-\[length\:250\%_100\%\,auto\] {
|
|
1229
1208
|
background-size: 250% 100%,auto;
|
|
1230
1209
|
}
|
|
@@ -1237,6 +1216,9 @@
|
|
|
1237
1216
|
.fill-current {
|
|
1238
1217
|
fill: currentcolor;
|
|
1239
1218
|
}
|
|
1219
|
+
.fill-cyan-600 {
|
|
1220
|
+
fill: #00cccc;
|
|
1221
|
+
}
|
|
1240
1222
|
.fill-foreground {
|
|
1241
1223
|
fill: var(--foreground);
|
|
1242
1224
|
}
|
|
@@ -1433,10 +1415,6 @@
|
|
|
1433
1415
|
--tw-leading: var(--leading-tight);
|
|
1434
1416
|
line-height: var(--leading-tight);
|
|
1435
1417
|
}
|
|
1436
|
-
.font-bold {
|
|
1437
|
-
--tw-font-weight: var(--font-weight-bold);
|
|
1438
|
-
font-weight: var(--font-weight-bold);
|
|
1439
|
-
}
|
|
1440
1418
|
.font-medium {
|
|
1441
1419
|
--tw-font-weight: var(--font-weight-medium);
|
|
1442
1420
|
font-weight: var(--font-weight-medium);
|
|
@@ -2863,6 +2841,11 @@
|
|
|
2863
2841
|
background-color: transparent;
|
|
2864
2842
|
}
|
|
2865
2843
|
}
|
|
2844
|
+
.dark\:fill-cyan-500 {
|
|
2845
|
+
&:is(.dark *) {
|
|
2846
|
+
fill: #00ffff;
|
|
2847
|
+
}
|
|
2848
|
+
}
|
|
2866
2849
|
.dark\:text-amber-400 {
|
|
2867
2850
|
&:is(.dark *) {
|
|
2868
2851
|
color: var(--color-amber-400);
|
|
@@ -3785,11 +3768,6 @@
|
|
|
3785
3768
|
inherits: false;
|
|
3786
3769
|
initial-value: 0;
|
|
3787
3770
|
}
|
|
3788
|
-
@property --tw-space-x-reverse {
|
|
3789
|
-
syntax: "*";
|
|
3790
|
-
inherits: false;
|
|
3791
|
-
initial-value: 0;
|
|
3792
|
-
}
|
|
3793
3771
|
@property --tw-divide-y-reverse {
|
|
3794
3772
|
syntax: "*";
|
|
3795
3773
|
inherits: false;
|
|
@@ -3800,48 +3778,6 @@
|
|
|
3800
3778
|
inherits: false;
|
|
3801
3779
|
initial-value: solid;
|
|
3802
3780
|
}
|
|
3803
|
-
@property --tw-gradient-position {
|
|
3804
|
-
syntax: "*";
|
|
3805
|
-
inherits: false;
|
|
3806
|
-
}
|
|
3807
|
-
@property --tw-gradient-from {
|
|
3808
|
-
syntax: "<color>";
|
|
3809
|
-
inherits: false;
|
|
3810
|
-
initial-value: #0000;
|
|
3811
|
-
}
|
|
3812
|
-
@property --tw-gradient-via {
|
|
3813
|
-
syntax: "<color>";
|
|
3814
|
-
inherits: false;
|
|
3815
|
-
initial-value: #0000;
|
|
3816
|
-
}
|
|
3817
|
-
@property --tw-gradient-to {
|
|
3818
|
-
syntax: "<color>";
|
|
3819
|
-
inherits: false;
|
|
3820
|
-
initial-value: #0000;
|
|
3821
|
-
}
|
|
3822
|
-
@property --tw-gradient-stops {
|
|
3823
|
-
syntax: "*";
|
|
3824
|
-
inherits: false;
|
|
3825
|
-
}
|
|
3826
|
-
@property --tw-gradient-via-stops {
|
|
3827
|
-
syntax: "*";
|
|
3828
|
-
inherits: false;
|
|
3829
|
-
}
|
|
3830
|
-
@property --tw-gradient-from-position {
|
|
3831
|
-
syntax: "<length-percentage>";
|
|
3832
|
-
inherits: false;
|
|
3833
|
-
initial-value: 0%;
|
|
3834
|
-
}
|
|
3835
|
-
@property --tw-gradient-via-position {
|
|
3836
|
-
syntax: "<length-percentage>";
|
|
3837
|
-
inherits: false;
|
|
3838
|
-
initial-value: 50%;
|
|
3839
|
-
}
|
|
3840
|
-
@property --tw-gradient-to-position {
|
|
3841
|
-
syntax: "<length-percentage>";
|
|
3842
|
-
inherits: false;
|
|
3843
|
-
initial-value: 100%;
|
|
3844
|
-
}
|
|
3845
3781
|
@property --tw-leading {
|
|
3846
3782
|
syntax: "*";
|
|
3847
3783
|
inherits: false;
|
|
@@ -4006,18 +3942,8 @@
|
|
|
4006
3942
|
--tw-skew-x: initial;
|
|
4007
3943
|
--tw-skew-y: initial;
|
|
4008
3944
|
--tw-space-y-reverse: 0;
|
|
4009
|
-
--tw-space-x-reverse: 0;
|
|
4010
3945
|
--tw-divide-y-reverse: 0;
|
|
4011
3946
|
--tw-border-style: solid;
|
|
4012
|
-
--tw-gradient-position: initial;
|
|
4013
|
-
--tw-gradient-from: #0000;
|
|
4014
|
-
--tw-gradient-via: #0000;
|
|
4015
|
-
--tw-gradient-to: #0000;
|
|
4016
|
-
--tw-gradient-stops: initial;
|
|
4017
|
-
--tw-gradient-via-stops: initial;
|
|
4018
|
-
--tw-gradient-from-position: 0%;
|
|
4019
|
-
--tw-gradient-via-position: 50%;
|
|
4020
|
-
--tw-gradient-to-position: 100%;
|
|
4021
3947
|
--tw-leading: initial;
|
|
4022
3948
|
--tw-font-weight: initial;
|
|
4023
3949
|
--tw-tracking: initial;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentuity/workbench",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.71",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "Agentuity employees and contributors",
|
|
6
6
|
"type": "module",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"prepublishOnly": "bun run clean && bun run build"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@agentuity/core": "0.0.
|
|
38
|
-
"@agentuity/react": "0.0.
|
|
37
|
+
"@agentuity/core": "0.0.71",
|
|
38
|
+
"@agentuity/react": "0.0.71",
|
|
39
39
|
"@ai-sdk/react": "^2.0.82",
|
|
40
40
|
"@hookform/resolvers": "^5.2.2",
|
|
41
41
|
"@radix-ui/react-avatar": "^1.1.10",
|
|
@@ -62,10 +62,17 @@ export function Chat({ className: _className }: ChatProps) {
|
|
|
62
62
|
>
|
|
63
63
|
<Conversation className="flex-1 overflow-y-auto">
|
|
64
64
|
<ConversationContent className="pb-0">
|
|
65
|
-
{messages.map((
|
|
65
|
+
{messages.map((message) => {
|
|
66
|
+
const { role, parts, id } = message;
|
|
66
67
|
const isStreaming = parts.some(
|
|
67
68
|
(part) => part.type === 'text' && part.state === 'streaming'
|
|
68
69
|
);
|
|
70
|
+
const tokens =
|
|
71
|
+
'tokens' in message ? (message as { tokens?: string }).tokens : undefined;
|
|
72
|
+
const duration =
|
|
73
|
+
'duration' in message
|
|
74
|
+
? (message as { duration?: string }).duration
|
|
75
|
+
: undefined;
|
|
69
76
|
|
|
70
77
|
return (
|
|
71
78
|
<div key={id} className="mb-2">
|
|
@@ -87,11 +94,14 @@ export function Chat({ className: _className }: ChatProps) {
|
|
|
87
94
|
<Shimmer duration={1}>Running...</Shimmer>
|
|
88
95
|
) : (
|
|
89
96
|
<>
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
97
|
+
{duration && (
|
|
98
|
+
<>
|
|
99
|
+
Ran for
|
|
100
|
+
<span className="mx-1">{duration}</span>
|
|
101
|
+
</>
|
|
102
|
+
)}
|
|
103
|
+
{duration && tokens && ` and consumed ${tokens} tokens`}
|
|
104
|
+
{(duration || tokens) && <ChevronRight className="size-4" />}
|
|
95
105
|
</>
|
|
96
106
|
)}
|
|
97
107
|
</div>
|
|
@@ -4,6 +4,7 @@ import type { WorkbenchConfig } from '@agentuity/core/workbench';
|
|
|
4
4
|
import type { WorkbenchContextType, ConnectionStatus } from '../../types/config';
|
|
5
5
|
import { useAgentSchemas } from '../../hooks/useAgentSchemas';
|
|
6
6
|
import { useWorkbenchWebsocket } from '../../hooks/useWorkbenchWebsocket';
|
|
7
|
+
import { getTotalTokens, parseTokensHeader } from '../../lib/utils';
|
|
7
8
|
|
|
8
9
|
const WorkbenchContext = createContext<WorkbenchContextType | null>(null);
|
|
9
10
|
|
|
@@ -174,6 +175,8 @@ export function WorkbenchProvider({ config, children }: WorkbenchProviderProps)
|
|
|
174
175
|
const controller = new AbortController();
|
|
175
176
|
const timeoutId = setTimeout(() => controller.abort(), 30000); // 30s timeout
|
|
176
177
|
|
|
178
|
+
const startTime = performance.now();
|
|
179
|
+
|
|
177
180
|
try {
|
|
178
181
|
const response = await fetch(`${baseUrl}/_agentuity/workbench/execute`, {
|
|
179
182
|
method: 'POST',
|
|
@@ -194,15 +197,28 @@ export function WorkbenchProvider({ config, children }: WorkbenchProviderProps)
|
|
|
194
197
|
}
|
|
195
198
|
|
|
196
199
|
const result = await response.json();
|
|
200
|
+
const endTime = performance.now();
|
|
201
|
+
const clientDuration = ((endTime - startTime) / 1000).toFixed(1); // Duration in seconds
|
|
202
|
+
|
|
203
|
+
// Extract duration from response header, fallback to client-side timing
|
|
204
|
+
const durationHeader = response.headers.get('x-agentuity-duration');
|
|
205
|
+
const duration = durationHeader || `${clientDuration}s`;
|
|
206
|
+
|
|
207
|
+
// Extract token count from response header
|
|
208
|
+
const tokensHeader = response.headers.get('x-agentuity-tokens');
|
|
209
|
+
const tokensRecord = tokensHeader ? parseTokensHeader(tokensHeader) : undefined;
|
|
210
|
+
const totalTokens = tokensRecord ? getTotalTokens(tokensRecord) : undefined;
|
|
197
211
|
|
|
198
212
|
// Format result as JSON string for display
|
|
199
213
|
const resultText =
|
|
200
214
|
typeof result === 'object' ? JSON.stringify(result, null, 2) : String(result);
|
|
201
215
|
|
|
202
|
-
const assistantMessage: UIMessage = {
|
|
216
|
+
const assistantMessage: UIMessage & { tokens?: string; duration?: string } = {
|
|
203
217
|
id: (Date.now() + 1).toString(),
|
|
204
218
|
role: 'assistant',
|
|
205
219
|
parts: [{ type: 'text', text: resultText }],
|
|
220
|
+
tokens: totalTokens?.toString(),
|
|
221
|
+
duration,
|
|
206
222
|
};
|
|
207
223
|
|
|
208
224
|
setMessages((prev) => [...prev, assistantMessage]);
|
|
@@ -1,11 +1,37 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
3
|
+
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
|
+
|
|
6
|
+
const Logo = forwardRef<SVGSVGElement, { className?: string; alt?: string }>(
|
|
7
|
+
({ className = '', alt = 'Agentuity' }, ref) => {
|
|
8
|
+
return (
|
|
9
|
+
<svg
|
|
10
|
+
ref={ref}
|
|
11
|
+
role="img"
|
|
12
|
+
aria-label={alt}
|
|
13
|
+
className={cn('fill-cyan-600 dark:fill-cyan-500', className)}
|
|
14
|
+
width="24"
|
|
15
|
+
height="22"
|
|
16
|
+
viewBox="0 0 24 22"
|
|
17
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
+
>
|
|
19
|
+
<title>{alt}</title>
|
|
20
|
+
<path
|
|
21
|
+
fillRule="evenodd"
|
|
22
|
+
clipRule="evenodd"
|
|
23
|
+
d="M24 21.3349H0L3.4284 15.3894H0L0.872727 13.8622H19.6909L24 21.3349ZM5.19141 15.3894L2.6437 19.8076H21.3563L18.8086 15.3894H5.19141Z"
|
|
24
|
+
/>
|
|
25
|
+
<path
|
|
26
|
+
fillRule="evenodd"
|
|
27
|
+
clipRule="evenodd"
|
|
28
|
+
d="M12 0.498535L17.1762 9.49853H20.6182L21.4909 11.0258H5.94545L12 0.498535ZM8.58569 9.49853L12 3.56193L15.4143 9.49853H8.58569Z"
|
|
29
|
+
/>
|
|
30
|
+
</svg>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
Logo.displayName = 'Logo';
|
|
36
|
+
|
|
37
|
+
export default Logo;
|
package/src/lib/utils.ts
CHANGED
|
@@ -4,3 +4,37 @@ import { twMerge } from 'tailwind-merge';
|
|
|
4
4
|
export function cn(...inputs: ClassValue[]) {
|
|
5
5
|
return twMerge(clsx(inputs));
|
|
6
6
|
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Parses the x-agentuity-tokens header string into a Record of model names to token counts.
|
|
10
|
+
* Format: "model1:count1, model2:count2" or "model1:count1"
|
|
11
|
+
* @param header - The x-agentuity-tokens header string
|
|
12
|
+
* @returns Record mapping model names to token counts
|
|
13
|
+
*/
|
|
14
|
+
export function parseTokensHeader(header: string): Record<string, number> {
|
|
15
|
+
const result: Record<string, number> = {};
|
|
16
|
+
|
|
17
|
+
// Split by comma and trim each entry
|
|
18
|
+
const entries = header.split(',').map((entry) => entry.trim());
|
|
19
|
+
|
|
20
|
+
for (const entry of entries) {
|
|
21
|
+
const [model, countStr] = entry.split(':').map((s) => s.trim());
|
|
22
|
+
if (model && countStr) {
|
|
23
|
+
const count = Number.parseInt(countStr, 10);
|
|
24
|
+
if (!Number.isNaN(count)) {
|
|
25
|
+
result[model] = count;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Calculates the total number of tokens from a parsed tokens record.
|
|
35
|
+
* @param tokens - Record mapping model names to token counts
|
|
36
|
+
* @returns Total number of tokens
|
|
37
|
+
*/
|
|
38
|
+
export function getTotalTokens(tokens: Record<string, number>): number {
|
|
39
|
+
return Object.keys(tokens).reduce((sum, key) => sum + tokens[key], 0);
|
|
40
|
+
}
|