@agent-platform/ui 0.0.12 → 0.0.13
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 +27 -10
- package/dist/index.d.ts +35 -2
- package/dist/index.js +2462 -3
- package/dist/styles/agent-ui.css +1226 -0
- package/dist/styles/globals.css +18 -1188
- package/dist/styles/theme.css +34 -0
- package/package.json +14 -8
- package/dist/components/agent/agent-container-model.d.ts +0 -19
- package/dist/components/agent/agent-container-model.js +0 -17
- package/dist/components/agent/agent-container-state.d.ts +0 -2
- package/dist/components/agent/agent-container-state.js +0 -52
- package/dist/components/agent/agent-container-view.d.ts +0 -20
- package/dist/components/agent/agent-container-view.js +0 -19
- package/dist/components/agent/agent-container-view.test.d.ts +0 -1
- package/dist/components/agent/agent-container-view.test.js +0 -16
- package/dist/components/agent/agent-container.d.ts +0 -3
- package/dist/components/agent/agent-container.js +0 -24
- package/dist/components/agent/agent-greeting.d.ts +0 -3
- package/dist/components/agent/agent-greeting.js +0 -7
- package/dist/components/agent/agent-header.d.ts +0 -3
- package/dist/components/agent/agent-header.js +0 -9
- package/dist/components/agent/agent-home-card.d.ts +0 -3
- package/dist/components/agent/agent-home-card.js +0 -7
- package/dist/components/agent/agent-home-cards.d.ts +0 -9
- package/dist/components/agent/agent-home-cards.js +0 -13
- package/dist/components/agent/agent-input.d.ts +0 -3
- package/dist/components/agent/agent-input.js +0 -51
- package/dist/components/agent/agent-popup-widget.d.ts +0 -15
- package/dist/components/agent/agent-popup-widget.js +0 -49
- package/dist/components/agent/agent-screen.d.ts +0 -5
- package/dist/components/agent/agent-screen.js +0 -9
- package/dist/components/agent/approval-ui-model.d.ts +0 -18
- package/dist/components/agent/approval-ui-model.js +0 -27
- package/dist/components/agent/approval-ui-model.test.d.ts +0 -1
- package/dist/components/agent/approval-ui-model.test.js +0 -39
- package/dist/components/agent/defaults.d.ts +0 -5
- package/dist/components/agent/defaults.js +0 -12
- package/dist/components/agent/index.d.ts +0 -3
- package/dist/components/agent/index.js +0 -1
- package/dist/components/agent/input-mode.d.ts +0 -5
- package/dist/components/agent/input-mode.js +0 -9
- package/dist/components/agent/message/index.d.ts +0 -8
- package/dist/components/agent/message/index.js +0 -4
- package/dist/components/agent/message/markdown.d.ts +0 -6
- package/dist/components/agent/message/markdown.js +0 -66
- package/dist/components/agent/message/message-item.d.ts +0 -7
- package/dist/components/agent/message/message-item.js +0 -24
- package/dist/components/agent/message/message-list.d.ts +0 -8
- package/dist/components/agent/message/message-list.js +0 -20
- package/dist/components/agent/message/message-loading.d.ts +0 -4
- package/dist/components/agent/message/message-loading.js +0 -10
- package/dist/components/agent/message/tool-call-card.d.ts +0 -9
- package/dist/components/agent/message/tool-call-card.js +0 -26
- package/dist/components/agent/message/utils.d.ts +0 -8
- package/dist/components/agent/message/utils.js +0 -21
- package/dist/components/agent/provider/agent-context.d.ts +0 -4
- package/dist/components/agent/provider/agent-context.js +0 -13
- package/dist/components/agent/provider/agent-provider.d.ts +0 -10
- package/dist/components/agent/provider/agent-provider.js +0 -40
- package/dist/components/agent/provider/index.d.ts +0 -4
- package/dist/components/agent/provider/index.js +0 -2
- package/dist/components/agent/provider/parse-sse-buffer.d.ts +0 -9
- package/dist/components/agent/provider/parse-sse-buffer.js +0 -23
- package/dist/components/agent/provider/runtime-config.d.ts +0 -5
- package/dist/components/agent/provider/runtime-config.js +0 -24
- package/dist/components/agent/provider/types.d.ts +0 -66
- package/dist/components/agent/provider/types.js +0 -1
- package/dist/components/agent/provider/use-agent-chat.d.ts +0 -6
- package/dist/components/agent/provider/use-agent-chat.js +0 -493
- package/dist/components/agent/tool-approval-panel.d.ts +0 -9
- package/dist/components/agent/tool-approval-panel.js +0 -11
- package/dist/components/agent/types.d.ts +0 -44
- package/dist/components/agent/types.js +0 -1
- package/dist/components/index.d.ts +0 -7
- package/dist/components/index.js +0 -9
- package/dist/components/ui/badge.d.ts +0 -9
- package/dist/components/ui/badge.js +0 -24
- package/dist/components/ui/button.d.ts +0 -10
- package/dist/components/ui/button.js +0 -35
- package/dist/components/ui/card.d.ts +0 -9
- package/dist/components/ui/card.js +0 -24
- package/dist/components/ui/input.d.ts +0 -3
- package/dist/components/ui/input.js +0 -6
- package/dist/components/ui/label.d.ts +0 -4
- package/dist/components/ui/label.js +0 -7
- package/dist/components/ui/separator.d.ts +0 -4
- package/dist/components/ui/separator.js +0 -8
- package/dist/components/ui/textarea.d.ts +0 -3
- package/dist/components/ui/textarea.js +0 -6
- package/dist/lib/index.d.ts +0 -1
- package/dist/lib/index.js +0 -1
- package/dist/lib/utils.d.ts +0 -2
- package/dist/lib/utils.js +0 -5
- package/dist/modules/agent/agent.repository.d.ts +0 -58
- package/dist/modules/agent/agent.repository.js +0 -235
- package/dist/modules/agent/agent.repository.test.d.ts +0 -1
- package/dist/modules/agent/agent.repository.test.js +0 -64
- package/dist/modules/agent/domain/chat-state.d.ts +0 -64
- package/dist/modules/agent/domain/chat-state.js +0 -148
- package/dist/modules/agent/domain/chat-state.test.d.ts +0 -1
- package/dist/modules/agent/domain/chat-state.test.js +0 -72
- package/dist/modules/agent/use-agent-chat.d.ts +0 -6
- package/dist/modules/agent/use-agent-chat.js +0 -106
- package/dist/modules/agent/usecases/process-stream.d.ts +0 -26
- package/dist/modules/agent/usecases/process-stream.js +0 -112
- package/dist/modules/agent/usecases/process-stream.test.d.ts +0 -1
- package/dist/modules/agent/usecases/process-stream.test.js +0 -91
- package/dist/modules/agent/usecases/send-message.d.ts +0 -21
- package/dist/modules/agent/usecases/send-message.js +0 -298
- package/dist/modules/agent/usecases/send-message.test.d.ts +0 -1
- package/dist/modules/agent/usecases/send-message.test.js +0 -257
- package/dist/styles/ensure-styles.d.ts +0 -21
- package/dist/styles/ensure-styles.js +0 -22
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @agent-platform/ui - Theme configuration for Tailwind v4 consumers
|
|
3
|
+
*
|
|
4
|
+
* Usage (Mode B - @source integration):
|
|
5
|
+
* @import "tailwindcss";
|
|
6
|
+
* @import "@agent-platform/ui/styles/globals.css";
|
|
7
|
+
* @import "@agent-platform/ui/styles/theme.css";
|
|
8
|
+
* @source "../node_modules/@agent-platform/ui/dist";
|
|
9
|
+
*/
|
|
10
|
+
@theme inline {
|
|
11
|
+
--color-background: var(--background);
|
|
12
|
+
--color-foreground: var(--foreground);
|
|
13
|
+
--color-card: var(--card);
|
|
14
|
+
--color-card-foreground: var(--card-foreground);
|
|
15
|
+
--color-popover: var(--popover);
|
|
16
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
17
|
+
--color-primary: var(--primary);
|
|
18
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
19
|
+
--color-secondary: var(--secondary);
|
|
20
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
21
|
+
--color-muted: var(--muted);
|
|
22
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
23
|
+
--color-accent: var(--accent);
|
|
24
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
25
|
+
--color-destructive: var(--destructive);
|
|
26
|
+
--color-border: var(--border);
|
|
27
|
+
--color-input: var(--input);
|
|
28
|
+
--color-ring: var(--ring);
|
|
29
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
30
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
31
|
+
--radius-lg: var(--radius);
|
|
32
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
33
|
+
--radius-2xl: calc(var(--radius) + 8px);
|
|
34
|
+
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-platform/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
7
|
-
"
|
|
7
|
+
"**/*.css"
|
|
8
8
|
],
|
|
9
9
|
"main": "./dist/index.js",
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"import": "./dist/index.js"
|
|
15
15
|
},
|
|
16
|
-
"./styles
|
|
16
|
+
"./styles": "./dist/styles/agent-ui.css",
|
|
17
|
+
"./styles/globals.css": "./dist/styles/globals.css",
|
|
18
|
+
"./styles/theme.css": "./dist/styles/theme.css"
|
|
17
19
|
},
|
|
18
20
|
"files": [
|
|
19
21
|
"dist",
|
|
@@ -28,6 +30,7 @@
|
|
|
28
30
|
"react-dom": "^19.0.0"
|
|
29
31
|
},
|
|
30
32
|
"dependencies": {
|
|
33
|
+
"better-auth": "^1.4.20",
|
|
31
34
|
"class-variance-authority": "^0.7.1",
|
|
32
35
|
"clsx": "^2.1.1",
|
|
33
36
|
"radix-ui": "^1.4.3",
|
|
@@ -36,20 +39,23 @@
|
|
|
36
39
|
"tailwind-merge": "^3.4.0"
|
|
37
40
|
},
|
|
38
41
|
"devDependencies": {
|
|
39
|
-
"@tailwindcss/cli": "^4.0.0",
|
|
40
42
|
"@phosphor-icons/react": "^2.1.10",
|
|
43
|
+
"@tailwindcss/cli": "^4",
|
|
41
44
|
"@types/react": "^19",
|
|
42
45
|
"@types/react-dom": "^19",
|
|
43
|
-
"tailwindcss": "^4.0.0",
|
|
44
46
|
"react": "19.2.3",
|
|
45
47
|
"react-dom": "19.2.3",
|
|
48
|
+
"tailwindcss": "^4",
|
|
49
|
+
"tsup": "^8",
|
|
46
50
|
"typescript": "^5",
|
|
47
51
|
"@agent-platform/server": "0.0.1"
|
|
48
52
|
},
|
|
49
53
|
"scripts": {
|
|
50
|
-
"build": "pnpm run build:
|
|
51
|
-
"build:
|
|
52
|
-
"build:
|
|
54
|
+
"build": "pnpm run build:js && pnpm run build:css",
|
|
55
|
+
"build:js": "tsup",
|
|
56
|
+
"build:css": "pnpm run build:css:prebuilt && pnpm run build:css:copy",
|
|
57
|
+
"build:css:prebuilt": "tailwindcss -i ./src/styles/preflight.css -o ./dist/styles/agent-ui.css",
|
|
58
|
+
"build:css:copy": "mkdir -p dist/styles && cp src/styles/globals.css dist/styles/globals.css && cp src/styles/theme.css dist/styles/theme.css",
|
|
53
59
|
"test": "pnpm -C ../server exec vitest --root ../ui",
|
|
54
60
|
"typecheck": "tsc --noEmit",
|
|
55
61
|
"pack:check": "pnpm pack",
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { AgentInputProps } from './types';
|
|
2
|
-
interface ResolveEffectiveInputPropsParams {
|
|
3
|
-
inputProps?: Omit<AgentInputProps, 'className'>;
|
|
4
|
-
sendMessage?: (message: string) => Promise<void>;
|
|
5
|
-
isLoading: boolean;
|
|
6
|
-
}
|
|
7
|
-
interface ResolveAgentContainerLayoutStateInput {
|
|
8
|
-
messageCount: number;
|
|
9
|
-
isLoading: boolean;
|
|
10
|
-
hasActiveApprovalRequest: boolean;
|
|
11
|
-
}
|
|
12
|
-
interface AgentContainerLayoutState {
|
|
13
|
-
shouldShowMessages: boolean;
|
|
14
|
-
shouldShowToolApprovalPanel: boolean;
|
|
15
|
-
shouldShowInput: boolean;
|
|
16
|
-
}
|
|
17
|
-
export declare function resolveEffectiveInputProps({ inputProps, sendMessage, isLoading, }: ResolveEffectiveInputPropsParams): AgentInputProps;
|
|
18
|
-
export declare function resolveAgentContainerLayoutState(input: ResolveAgentContainerLayoutStateInput): AgentContainerLayoutState;
|
|
19
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export function resolveEffectiveInputProps({ inputProps, sendMessage, isLoading, }) {
|
|
2
|
-
return {
|
|
3
|
-
...inputProps,
|
|
4
|
-
onSend: inputProps?.onSend ?? sendMessage,
|
|
5
|
-
isLoading: inputProps?.isLoading ?? isLoading,
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
export function resolveAgentContainerLayoutState(input) {
|
|
9
|
-
const shouldShowMessages = input.messageCount > 0 || input.isLoading;
|
|
10
|
-
const shouldShowToolApprovalPanel = input.hasActiveApprovalRequest;
|
|
11
|
-
const shouldShowInput = !input.hasActiveApprovalRequest;
|
|
12
|
-
return {
|
|
13
|
-
shouldShowMessages,
|
|
14
|
-
shouldShowToolApprovalPanel,
|
|
15
|
-
shouldShowInput,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
import { DEFAULT_TOOL_NAME_LABELS } from './defaults';
|
|
4
|
-
import { useOptionalAgentContext } from './provider/agent-context';
|
|
5
|
-
export function useAgentContainerViewModel(props) {
|
|
6
|
-
const { showHeader = true, headerProps, showGreeting = true, greetingProps, showHomeCards = true, cards, onCardClick, toolNameLabels, autoShowMessages = true, showInput = true, inputProps, className, children, } = props;
|
|
7
|
-
const context = useOptionalAgentContext();
|
|
8
|
-
const messages = context?.messages ?? [];
|
|
9
|
-
const pendingToolCalls = context?.pendingToolCalls ?? [];
|
|
10
|
-
const activeApprovalRequest = context?.activeApprovalRequest ?? null;
|
|
11
|
-
const approveToolCall = context?.approveToolCall ?? (() => undefined);
|
|
12
|
-
const rejectToolCall = context?.rejectToolCall ?? (() => undefined);
|
|
13
|
-
const toolApprovalLabels = context?.config.toolApprovalLabels;
|
|
14
|
-
const error = context?.error ?? null;
|
|
15
|
-
const isLoading = context?.isLoading ?? false;
|
|
16
|
-
const sendMessage = context?.sendMessage;
|
|
17
|
-
const clearChat = context?.clearChat;
|
|
18
|
-
const mergedToolNameLabels = useMemo(() => ({ ...DEFAULT_TOOL_NAME_LABELS, ...toolNameLabels }), [toolNameLabels]);
|
|
19
|
-
const effectiveInputProps = useMemo(() => ({
|
|
20
|
-
...inputProps,
|
|
21
|
-
onSend: inputProps?.onSend ?? sendMessage,
|
|
22
|
-
isLoading: inputProps?.isLoading ?? isLoading,
|
|
23
|
-
}), [inputProps, isLoading, sendMessage]);
|
|
24
|
-
const effectiveHeaderProps = useMemo(() => ({
|
|
25
|
-
...headerProps,
|
|
26
|
-
onNewChatClick: headerProps?.onNewChatClick ?? clearChat,
|
|
27
|
-
}), [headerProps, clearChat]);
|
|
28
|
-
return {
|
|
29
|
-
showHeader,
|
|
30
|
-
effectiveHeaderProps,
|
|
31
|
-
showGreeting,
|
|
32
|
-
greetingProps,
|
|
33
|
-
showHomeCards,
|
|
34
|
-
cards,
|
|
35
|
-
onCardClick,
|
|
36
|
-
autoShowMessages,
|
|
37
|
-
showInput,
|
|
38
|
-
effectiveInputProps,
|
|
39
|
-
className,
|
|
40
|
-
messages,
|
|
41
|
-
pendingToolCalls,
|
|
42
|
-
activeApprovalRequest,
|
|
43
|
-
approveToolCall,
|
|
44
|
-
rejectToolCall,
|
|
45
|
-
toolApprovalLabels,
|
|
46
|
-
error,
|
|
47
|
-
isLoading,
|
|
48
|
-
mergedToolNameLabels,
|
|
49
|
-
hasMessages: messages.length > 0,
|
|
50
|
-
children,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ActiveToolApprovalRequest, ToolApprovalLabels, ToolCallState } from './provider/types';
|
|
2
|
-
import type { AgentHomeCardProps, AgentInputProps } from './types';
|
|
3
|
-
export interface AgentContainerViewProps {
|
|
4
|
-
onNewChatClick?: () => void;
|
|
5
|
-
cards?: AgentHomeCardProps[];
|
|
6
|
-
onCardClick?: (cardId: string) => void;
|
|
7
|
-
inputProps: AgentInputProps;
|
|
8
|
-
className?: string;
|
|
9
|
-
messages: import('@agent-platform/server').AgentMessage[];
|
|
10
|
-
pendingToolCalls: ToolCallState[];
|
|
11
|
-
activeApprovalRequest: ActiveToolApprovalRequest | null;
|
|
12
|
-
approveToolCall: () => void;
|
|
13
|
-
rejectToolCall: () => void;
|
|
14
|
-
toolApprovalLabels?: ToolApprovalLabels;
|
|
15
|
-
toolNameLabels: Record<string, string>;
|
|
16
|
-
isLoading: boolean;
|
|
17
|
-
error: string | null;
|
|
18
|
-
}
|
|
19
|
-
declare function AgentContainerView({ onNewChatClick, cards, onCardClick, inputProps, className, messages, pendingToolCalls, activeApprovalRequest, approveToolCall, rejectToolCall, toolApprovalLabels, toolNameLabels, isLoading, error, }: AgentContainerViewProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
export { AgentContainerView };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from '../../lib/utils';
|
|
4
|
-
import { resolveAgentContainerLayoutState } from './agent-container-model';
|
|
5
|
-
import { AgentGreeting } from './agent-greeting';
|
|
6
|
-
import { AgentHeader } from './agent-header';
|
|
7
|
-
import { AgentHomeCards } from './agent-home-cards';
|
|
8
|
-
import { AgentInput } from './agent-input';
|
|
9
|
-
import { MessageList } from './message';
|
|
10
|
-
import { ToolApprovalPanel } from './tool-approval-panel';
|
|
11
|
-
function AgentContainerView({ onNewChatClick, cards, onCardClick, inputProps, className, messages, pendingToolCalls, activeApprovalRequest, approveToolCall, rejectToolCall, toolApprovalLabels, toolNameLabels, isLoading, error, }) {
|
|
12
|
-
const layoutState = resolveAgentContainerLayoutState({
|
|
13
|
-
messageCount: messages.length,
|
|
14
|
-
isLoading,
|
|
15
|
-
hasActiveApprovalRequest: Boolean(activeApprovalRequest),
|
|
16
|
-
});
|
|
17
|
-
return (_jsxs("div", { "data-slot": "agent-container", className: cn('flex h-full w-full flex-col mx-auto max-w-[1120px]', className), children: [_jsx(AgentHeader, { onNewChatClick: onNewChatClick }), layoutState.shouldShowMessages ? (_jsxs("div", { className: "flex-1 overflow-y-auto bg-white pb-[97px]", children: [_jsx(MessageList, { messages: messages, pendingToolCalls: pendingToolCalls, toolNameLabels: toolNameLabels, isLoading: isLoading }), error && (_jsx("div", { className: "mx-4 mb-4 rounded-lg bg-red-50 p-3 text-sm text-red-600", children: error }))] })) : (_jsxs("div", { className: "flex flex-1 flex-col items-center justify-center gap-6 bg-background px-4 py-4", children: [_jsx(AgentGreeting, {}), cards && _jsx(AgentHomeCards, { cards: cards, onCardClick: onCardClick })] })), _jsxs("div", { className: "fixed bottom-0 left-0 right-0 mx-auto w-full max-w-[1120px] bg-background", children: [layoutState.shouldShowInput && _jsx(AgentInput, { ...inputProps }), layoutState.shouldShowToolApprovalPanel && (_jsx(ToolApprovalPanel, { activeApprovalRequest: activeApprovalRequest, approveToolCall: approveToolCall, rejectToolCall: rejectToolCall, toolApprovalLabels: toolApprovalLabels }))] })] }));
|
|
18
|
-
}
|
|
19
|
-
export { AgentContainerView };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { resolveInputMode } from './input-mode';
|
|
3
|
-
describe('resolveInputMode', () => {
|
|
4
|
-
it('承認待ちがある場合はapprovalを返す', () => {
|
|
5
|
-
expect(resolveInputMode({ showInput: true, hasActiveApprovalRequest: true })).toBe('approval');
|
|
6
|
-
});
|
|
7
|
-
it('showInput=falseでも承認待ちがあればapprovalを返す', () => {
|
|
8
|
-
expect(resolveInputMode({ showInput: false, hasActiveApprovalRequest: true })).toBe('approval');
|
|
9
|
-
});
|
|
10
|
-
it('承認待ちがなく入力表示有効ならinputを返す', () => {
|
|
11
|
-
expect(resolveInputMode({ showInput: true, hasActiveApprovalRequest: false })).toBe('input');
|
|
12
|
-
});
|
|
13
|
-
it('入力表示無効ならnoneを返す', () => {
|
|
14
|
-
expect(resolveInputMode({ showInput: false, hasActiveApprovalRequest: false })).toBe('none');
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo } from 'react';
|
|
4
|
-
import { resolveEffectiveInputProps } from './agent-container-model';
|
|
5
|
-
import { DEFAULT_TOOL_NAME_LABELS } from './defaults';
|
|
6
|
-
import { AgentContainerView } from './agent-container-view';
|
|
7
|
-
import { useOptionalAgentContext } from './provider/agent-context';
|
|
8
|
-
function AgentContainer({ cards, onCardClick, toolNameLabels, inputProps, className }) {
|
|
9
|
-
const context = useOptionalAgentContext();
|
|
10
|
-
const messages = context?.messages ?? [];
|
|
11
|
-
const pendingToolCalls = context?.pendingToolCalls ?? [];
|
|
12
|
-
const activeApprovalRequest = context?.activeApprovalRequest ?? null;
|
|
13
|
-
const approveToolCall = context?.approveToolCall ?? (() => undefined);
|
|
14
|
-
const rejectToolCall = context?.rejectToolCall ?? (() => undefined);
|
|
15
|
-
const toolApprovalLabels = context?.config.toolApprovalLabels;
|
|
16
|
-
const error = context?.error ?? null;
|
|
17
|
-
const isLoading = context?.isLoading ?? false;
|
|
18
|
-
const sendMessage = context?.sendMessage;
|
|
19
|
-
const onNewChatClick = context?.clearChat;
|
|
20
|
-
const mergedToolNameLabels = useMemo(() => ({ ...DEFAULT_TOOL_NAME_LABELS, ...toolNameLabels }), [toolNameLabels]);
|
|
21
|
-
const effectiveInputProps = useMemo(() => resolveEffectiveInputProps({ inputProps, sendMessage, isLoading }), [inputProps, sendMessage, isLoading]);
|
|
22
|
-
return (_jsx(AgentContainerView, { onNewChatClick: onNewChatClick, cards: cards, onCardClick: onCardClick, inputProps: effectiveInputProps, className: className, messages: messages, pendingToolCalls: pendingToolCalls, activeApprovalRequest: activeApprovalRequest, approveToolCall: approveToolCall, rejectToolCall: rejectToolCall, toolApprovalLabels: toolApprovalLabels, toolNameLabels: mergedToolNameLabels, isLoading: isLoading, error: error }));
|
|
23
|
-
}
|
|
24
|
-
export { AgentContainer };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from '../../lib/utils';
|
|
4
|
-
function AgentGreeting({ greeting = 'こんにちは 👋', subtext = '何かお手伝いできることはありますか?', className, }) {
|
|
5
|
-
return (_jsxs("div", { "data-slot": "agent-greeting", className: cn('flex flex-col items-center gap-1.5 text-center', className), children: [_jsx("p", { className: "text-sm text-muted-foreground", children: greeting }), _jsx("p", { className: "text-lg font-semibold tracking-tight text-balance text-card-foreground", children: subtext })] }));
|
|
6
|
-
}
|
|
7
|
-
export { AgentGreeting };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { AgentHeaderProps } from './types';
|
|
2
|
-
declare function AgentHeader({ historyLabel, onHistoryClick, onSettingsClick, onNewChatClick, newChatLabel, settingsAriaLabel, className, }: AgentHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
export { AgentHeader };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { CaretDown, Gear } from '@phosphor-icons/react/dist/ssr';
|
|
4
|
-
import { cn } from '../../lib/utils';
|
|
5
|
-
import { Button } from '../ui/button';
|
|
6
|
-
function AgentHeader({ historyLabel = '履歴', onHistoryClick, onSettingsClick, onNewChatClick, newChatLabel = '新規チャット', settingsAriaLabel = '設定', className, }) {
|
|
7
|
-
return (_jsxs("div", { "data-slot": "agent-header", className: cn('flex w-full items-center justify-between bg-background px-4 py-2', className), children: [_jsxs("div", { className: "flex items-center", children: [_jsx("span", { className: "text-sm font-semibold text-foreground", children: historyLabel }), _jsx(Button, { variant: "ghost", size: "icon-sm", onClick: onHistoryClick, "aria-label": historyLabel, children: _jsx(CaretDown, { className: "size-5" }) })] }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx(Button, { variant: "ghost", size: "icon-sm", onClick: onSettingsClick, "aria-label": settingsAriaLabel, className: "text-foreground", children: _jsx(Gear, { className: "size-5" }) }), _jsx(Button, { size: "sm", onClick: onNewChatClick, className: "bg-foreground text-background text-xs font-medium hover:bg-foreground/90", children: newChatLabel })] })] }));
|
|
8
|
-
}
|
|
9
|
-
export { AgentHeader };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "../../lib/utils";
|
|
4
|
-
function AgentHomeCard({ id, icon, title, description, onClick, className, }) {
|
|
5
|
-
return (_jsxs("button", { type: "button", "data-slot": "agent-home-card", "data-card-id": id, onClick: onClick, className: cn("flex flex-1 flex-col items-start gap-2.5 rounded-lg border border-border bg-card p-3 text-left transition-all hover:border-primary/30 hover:bg-accent focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring", className), children: [_jsx("div", { className: "text-muted-foreground [&_svg]:size-5", children: icon }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("p", { className: "text-sm font-semibold leading-none text-card-foreground", children: title }), _jsx("p", { className: "text-xs leading-relaxed text-muted-foreground", children: description })] })] }));
|
|
6
|
-
}
|
|
7
|
-
export { AgentHomeCard };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AgentHomeCardProps } from './types';
|
|
2
|
-
interface AgentHomeCardsProps {
|
|
3
|
-
cards: AgentHomeCardProps[];
|
|
4
|
-
onCardClick?: (cardId: string) => void;
|
|
5
|
-
className?: string;
|
|
6
|
-
}
|
|
7
|
-
declare function AgentHomeCards({ cards, onCardClick, className }: AgentHomeCardsProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export { AgentHomeCards };
|
|
9
|
-
export type { AgentHomeCardsProps };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from '../../lib/utils';
|
|
4
|
-
function AgentHomeCard({ id, icon, title, description, onClick, className }) {
|
|
5
|
-
return (_jsxs("button", { type: "button", "data-slot": "agent-home-card", "data-card-id": id, onClick: onClick, className: cn('flex flex-1 flex-col items-start gap-2.5 rounded-lg border border-border bg-card p-3 text-left transition-all hover:border-primary/30 hover:bg-accent focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring', className), children: [_jsx("div", { className: "text-muted-foreground [&_svg]:size-5", children: icon }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("p", { className: "text-sm font-semibold leading-none text-card-foreground", children: title }), _jsx("p", { className: "text-xs leading-relaxed text-muted-foreground", children: description })] })] }));
|
|
6
|
-
}
|
|
7
|
-
function AgentHomeCards({ cards, onCardClick, className }) {
|
|
8
|
-
return (_jsx("div", { "data-slot": "agent-home-cards", className: cn('flex w-full items-start justify-center gap-4 px-12', className), children: cards.map((card) => (_jsx(AgentHomeCard, { ...card, onClick: () => {
|
|
9
|
-
card.onClick?.();
|
|
10
|
-
onCardClick?.(card.id);
|
|
11
|
-
} }, card.id))) }));
|
|
12
|
-
}
|
|
13
|
-
export { AgentHomeCards };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Paperclip, PaperPlaneTilt } from '@phosphor-icons/react/dist/ssr';
|
|
4
|
-
import { useCallback, useRef, useState } from 'react';
|
|
5
|
-
import { cn } from '../../lib/utils';
|
|
6
|
-
import { Button } from '../ui/button';
|
|
7
|
-
import { Textarea } from '../ui/textarea';
|
|
8
|
-
function AgentInput({ value: controlledValue, onChange, onSend, onAttach, placeholder = 'AIに相談してみましょう', disabled = false, isLoading = false, className, }) {
|
|
9
|
-
const [uncontrolledValue, setUncontrolledValue] = useState('');
|
|
10
|
-
const textareaRef = useRef(null);
|
|
11
|
-
const isControlled = controlledValue !== undefined;
|
|
12
|
-
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
13
|
-
const resetTextareaHeight = useCallback(() => {
|
|
14
|
-
if (textareaRef.current) {
|
|
15
|
-
textareaRef.current.style.height = 'auto';
|
|
16
|
-
}
|
|
17
|
-
}, []);
|
|
18
|
-
const adjustTextareaHeight = useCallback(() => {
|
|
19
|
-
const textarea = textareaRef.current;
|
|
20
|
-
if (textarea) {
|
|
21
|
-
textarea.style.height = 'auto';
|
|
22
|
-
textarea.style.height = `${Math.min(textarea.scrollHeight, 160)}px`;
|
|
23
|
-
}
|
|
24
|
-
}, []);
|
|
25
|
-
const handleChange = useCallback((e) => {
|
|
26
|
-
const newValue = e.target.value;
|
|
27
|
-
if (!isControlled) {
|
|
28
|
-
setUncontrolledValue(newValue);
|
|
29
|
-
}
|
|
30
|
-
onChange?.(newValue);
|
|
31
|
-
adjustTextareaHeight();
|
|
32
|
-
}, [isControlled, onChange, adjustTextareaHeight]);
|
|
33
|
-
const handleSend = useCallback(() => {
|
|
34
|
-
if (value.trim() && !disabled && !isLoading) {
|
|
35
|
-
onSend?.(value.trim());
|
|
36
|
-
if (!isControlled) {
|
|
37
|
-
setUncontrolledValue('');
|
|
38
|
-
}
|
|
39
|
-
resetTextareaHeight();
|
|
40
|
-
}
|
|
41
|
-
}, [value, disabled, isLoading, onSend, isControlled, resetTextareaHeight]);
|
|
42
|
-
const handleKeyDown = useCallback((e) => {
|
|
43
|
-
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
|
|
44
|
-
e.preventDefault();
|
|
45
|
-
handleSend();
|
|
46
|
-
}
|
|
47
|
-
}, [handleSend]);
|
|
48
|
-
const canSend = value.trim().length > 0 && !disabled && !isLoading;
|
|
49
|
-
return (_jsx("div", { "data-slot": "agent-input", className: cn('w-full border-t border-border bg-muted px-3 pb-3 pt-2', className), children: _jsxs("div", { className: "flex items-end gap-1 p-2 rounded-lg border border-border bg-background transition-colors", children: [_jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", onClick: onAttach, disabled: disabled, "aria-label": "\u30D5\u30A1\u30A4\u30EB\u3092\u6DFB\u4ED8", className: "mb-0.5 text-muted-foreground hover:text-foreground", children: _jsx(Paperclip, { className: "size-4", weight: "bold" }) }), _jsx(Textarea, { ref: textareaRef, value: value, onChange: handleChange, onKeyDown: handleKeyDown, placeholder: placeholder, disabled: disabled, rows: 1, className: "border-none p-1 resize-none min-h-8 focus-visible:ring-0 focus-visible:border-0 bg-transparent" }), _jsx(Button, { type: "button", size: "icon-sm", onClick: handleSend, disabled: !canSend, "aria-label": "\u9001\u4FE1 (\u2318+Enter)", children: _jsx(PaperPlaneTilt, { className: "size-5", weight: "fill" }) })] }) }));
|
|
50
|
-
}
|
|
51
|
-
export { AgentInput };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { AgentProviderConfig } from './provider';
|
|
2
|
-
import type { AgentContainerProps } from './types';
|
|
3
|
-
export interface AgentPopupWidgetProps extends AgentProviderConfig {
|
|
4
|
-
containerProps?: AgentContainerProps;
|
|
5
|
-
defaultOpen?: boolean;
|
|
6
|
-
launcherLabel?: string;
|
|
7
|
-
launcherAriaLabel?: string;
|
|
8
|
-
closeLabel?: string;
|
|
9
|
-
className?: string;
|
|
10
|
-
launcherClassName?: string;
|
|
11
|
-
offsetBottom?: number | string;
|
|
12
|
-
offsetRight?: number | string;
|
|
13
|
-
zIndex?: number;
|
|
14
|
-
}
|
|
15
|
-
export declare function AgentPopupWidget({ agentId, executeClientTool, onError, authToken, getAuthToken, getAgentHeaders, disableToolApiAuthHeader, containerProps, defaultOpen, launcherLabel, launcherAriaLabel, closeLabel, className, launcherClassName, offsetBottom, offsetRight, zIndex, }: AgentPopupWidgetProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
4
|
-
import { cn } from '../../lib/utils';
|
|
5
|
-
import { Button } from '../ui/button';
|
|
6
|
-
import { AgentContainer } from './agent-container';
|
|
7
|
-
import { AgentProvider } from './provider';
|
|
8
|
-
const DEFAULT_OFFSET = '1.5rem';
|
|
9
|
-
const DEFAULT_Z_INDEX = 60;
|
|
10
|
-
function toCssSize(value, fallback) {
|
|
11
|
-
if (typeof value === 'number')
|
|
12
|
-
return `${value}px`;
|
|
13
|
-
if (typeof value === 'string' && value.trim().length > 0)
|
|
14
|
-
return value;
|
|
15
|
-
return fallback;
|
|
16
|
-
}
|
|
17
|
-
export function AgentPopupWidget({ agentId, executeClientTool, onError, authToken, getAuthToken, getAgentHeaders, disableToolApiAuthHeader, containerProps, defaultOpen = false, launcherLabel = 'AIアシスタント', launcherAriaLabel = 'AIアシスタントを開く', closeLabel = '閉じる', className, launcherClassName, offsetBottom, offsetRight, zIndex = DEFAULT_Z_INDEX, }) {
|
|
18
|
-
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
19
|
-
const overlayStyle = useMemo(() => ({
|
|
20
|
-
'--agent-popup-right': toCssSize(offsetRight, DEFAULT_OFFSET),
|
|
21
|
-
'--agent-popup-bottom': toCssSize(offsetBottom, DEFAULT_OFFSET),
|
|
22
|
-
'--agent-popup-z-index': String(zIndex),
|
|
23
|
-
}), [offsetBottom, offsetRight, zIndex]);
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (!isOpen)
|
|
26
|
-
return;
|
|
27
|
-
const handleKeyDown = (event) => {
|
|
28
|
-
if (event.key === 'Escape') {
|
|
29
|
-
setIsOpen(false);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
33
|
-
return () => window.removeEventListener('keydown', handleKeyDown);
|
|
34
|
-
}, [isOpen]);
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (!isOpen)
|
|
37
|
-
return;
|
|
38
|
-
const originalOverflow = document.body.style.overflow;
|
|
39
|
-
document.body.style.overflow = 'hidden';
|
|
40
|
-
return () => {
|
|
41
|
-
document.body.style.overflow = originalOverflow;
|
|
42
|
-
};
|
|
43
|
-
}, [isOpen]);
|
|
44
|
-
return (_jsx(AgentProvider, { agentId: agentId, executeClientTool: executeClientTool, onError: onError, authToken: authToken, getAuthToken: getAuthToken, getAgentHeaders: getAgentHeaders, disableToolApiAuthHeader: disableToolApiAuthHeader, children: _jsxs("div", { "data-slot": "agent-popup-widget", style: overlayStyle, children: [!isOpen && (_jsx(Button, { type: "button", "aria-label": launcherAriaLabel, onClick: () => setIsOpen(true), className: cn('fixed right-[var(--agent-popup-right)] bottom-[var(--agent-popup-bottom)] z-[var(--agent-popup-z-index)] h-12 rounded-full px-5 shadow-lg', launcherClassName), children: launcherLabel })), isOpen && (_jsx("div", { className: "fixed inset-0 z-[var(--agent-popup-z-index)] bg-black/45 animate-in fade-in duration-200", onClick: () => setIsOpen(false), onKeyDown: (event) => {
|
|
45
|
-
if (event.key === 'Escape') {
|
|
46
|
-
setIsOpen(false);
|
|
47
|
-
}
|
|
48
|
-
}, children: _jsxs("section", { role: "dialog", "aria-modal": "true", "aria-label": launcherLabel, className: cn('fixed inset-0 flex flex-col overflow-hidden bg-background animate-in fade-in zoom-in-95 duration-200', 'sm:inset-auto sm:right-[var(--agent-popup-right)] sm:bottom-[var(--agent-popup-bottom)] sm:h-[min(70vh,720px)] sm:w-[380px] sm:rounded-2xl sm:border sm:border-border sm:shadow-2xl', className), onClick: (event) => event.stopPropagation(), children: [_jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", "aria-label": closeLabel, className: "absolute top-3 right-3 z-10", onClick: () => setIsOpen(false), children: "\u00D7" }), _jsx(AgentContainer, { ...containerProps, className: cn('h-full bg-background', containerProps?.className) })] }) }))] }) }));
|
|
49
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { AgentProviderConfig } from './provider';
|
|
2
|
-
import type { AgentContainerProps } from './types';
|
|
3
|
-
export interface AgentScreenProps extends AgentProviderConfig, AgentContainerProps {
|
|
4
|
-
}
|
|
5
|
-
export declare function AgentScreen({ agentId, onError, authToken, getAuthToken, getAgentHeaders, disableToolApiAuthHeader, toolApprovalLabels, ...containerProps }: AgentScreenProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { AgentContainer } from './agent-container';
|
|
4
|
-
import { AgentProvider } from './provider';
|
|
5
|
-
import { ensureUiStyles } from '../../styles/ensure-styles';
|
|
6
|
-
ensureUiStyles();
|
|
7
|
-
export function AgentScreen({ agentId, onError, authToken, getAuthToken, getAgentHeaders, disableToolApiAuthHeader, toolApprovalLabels, ...containerProps }) {
|
|
8
|
-
return (_jsx(AgentProvider, { agentId: agentId, onError: onError, authToken: authToken, getAuthToken: getAuthToken, getAgentHeaders: getAgentHeaders, disableToolApiAuthHeader: disableToolApiAuthHeader, toolApprovalLabels: toolApprovalLabels, children: _jsx(AgentContainer, { ...containerProps }) }));
|
|
9
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ActiveToolApprovalRequest, ToolApprovalLabels } from './provider/types';
|
|
2
|
-
declare function resolveToolApprovalLabels(toolApprovalLabels?: ToolApprovalLabels): {
|
|
3
|
-
readonly title: "この操作を実行してもよろしいでしょうか?";
|
|
4
|
-
readonly approveButton: "実行する";
|
|
5
|
-
readonly rejectButton: "実行しない";
|
|
6
|
-
} | {
|
|
7
|
-
title: string;
|
|
8
|
-
approveButton: string;
|
|
9
|
-
rejectButton: string;
|
|
10
|
-
};
|
|
11
|
-
declare function resolveToolApprovalPanelState(activeApprovalRequest: ActiveToolApprovalRequest | null): {
|
|
12
|
-
isActionable: boolean;
|
|
13
|
-
actionLabel?: undefined;
|
|
14
|
-
} | {
|
|
15
|
-
actionLabel: string;
|
|
16
|
-
isActionable: boolean;
|
|
17
|
-
};
|
|
18
|
-
export { resolveToolApprovalLabels, resolveToolApprovalPanelState };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const DEFAULT_TOOL_APPROVAL_LABELS = {
|
|
2
|
-
title: 'この操作を実行してもよろしいでしょうか?',
|
|
3
|
-
approveButton: '実行する',
|
|
4
|
-
rejectButton: '実行しない',
|
|
5
|
-
};
|
|
6
|
-
function resolveToolApprovalLabels(toolApprovalLabels) {
|
|
7
|
-
if (!toolApprovalLabels) {
|
|
8
|
-
return DEFAULT_TOOL_APPROVAL_LABELS;
|
|
9
|
-
}
|
|
10
|
-
return {
|
|
11
|
-
title: toolApprovalLabels.title ?? DEFAULT_TOOL_APPROVAL_LABELS.title,
|
|
12
|
-
approveButton: toolApprovalLabels.approveButton ?? DEFAULT_TOOL_APPROVAL_LABELS.approveButton,
|
|
13
|
-
rejectButton: toolApprovalLabels.rejectButton ?? DEFAULT_TOOL_APPROVAL_LABELS.rejectButton,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function resolveToolApprovalPanelState(activeApprovalRequest) {
|
|
17
|
-
if (!activeApprovalRequest) {
|
|
18
|
-
return {
|
|
19
|
-
isActionable: false,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
return {
|
|
23
|
-
actionLabel: activeApprovalRequest.actionLabel,
|
|
24
|
-
isActionable: true,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
export { resolveToolApprovalLabels, resolveToolApprovalPanelState };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { resolveToolApprovalLabels, resolveToolApprovalRiskLabel } from './approval-ui-model';
|
|
3
|
-
describe('resolveToolApprovalLabels', () => {
|
|
4
|
-
it('未指定時はデフォルト文言を返す', () => {
|
|
5
|
-
const labels = resolveToolApprovalLabels();
|
|
6
|
-
expect(labels).toEqual({
|
|
7
|
-
title: 'この操作を実行してもよろしいでしょうか?',
|
|
8
|
-
description: 'この操作はデータを変更する可能性があります。内容を確認して、承認または非承認を選択してください。',
|
|
9
|
-
approveButton: '実行する',
|
|
10
|
-
rejectButton: '実行しない',
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
it('指定された文言で部分上書きできる', () => {
|
|
14
|
-
const labels = resolveToolApprovalLabels({
|
|
15
|
-
description: '説明を上書き',
|
|
16
|
-
rejectButton: '非承認',
|
|
17
|
-
});
|
|
18
|
-
expect(labels).toEqual({
|
|
19
|
-
title: 'この操作を実行してもよろしいでしょうか?',
|
|
20
|
-
description: '説明を上書き',
|
|
21
|
-
approveButton: '実行する',
|
|
22
|
-
rejectButton: '非承認',
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
describe('resolveToolApprovalRiskLabel', () => {
|
|
27
|
-
it('destructiveは高リスク操作を返す', () => {
|
|
28
|
-
expect(resolveToolApprovalRiskLabel('destructive')).toBe('高リスク操作');
|
|
29
|
-
});
|
|
30
|
-
it('writeは変更操作を返す', () => {
|
|
31
|
-
expect(resolveToolApprovalRiskLabel('write')).toBe('変更操作');
|
|
32
|
-
});
|
|
33
|
-
it('readは確認操作を返す', () => {
|
|
34
|
-
expect(resolveToolApprovalRiskLabel('read')).toBe('確認操作');
|
|
35
|
-
});
|
|
36
|
-
it('未指定時は確認操作を返す', () => {
|
|
37
|
-
expect(resolveToolApprovalRiskLabel()).toBe('確認操作');
|
|
38
|
-
});
|
|
39
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AgentScreen } from './agent-screen';
|