@bernierllc/admin-agent-chat-ui 0.0.1 → 0.1.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/LICENSE +5 -0
- package/README.md +332 -27
- package/dist/components/AdminAgentInput.d.ts +4 -0
- package/dist/components/AdminAgentInput.d.ts.map +1 -0
- package/dist/components/AdminAgentInput.js +72 -0
- package/dist/components/AdminAgentInput.js.map +1 -0
- package/dist/components/AdminAgentPanel.d.ts +4 -0
- package/dist/components/AdminAgentPanel.d.ts.map +1 -0
- package/dist/components/AdminAgentPanel.js +26 -0
- package/dist/components/AdminAgentPanel.js.map +1 -0
- package/dist/components/AdminAgentPanelHeader.d.ts +4 -0
- package/dist/components/AdminAgentPanelHeader.d.ts.map +1 -0
- package/dist/components/AdminAgentPanelHeader.js +42 -0
- package/dist/components/AdminAgentPanelHeader.js.map +1 -0
- package/dist/components/AdminAgentProvider.d.ts +4 -0
- package/dist/components/AdminAgentProvider.d.ts.map +1 -0
- package/dist/components/AdminAgentProvider.js +235 -0
- package/dist/components/AdminAgentProvider.js.map +1 -0
- package/dist/components/AdminAgentTrigger.d.ts +4 -0
- package/dist/components/AdminAgentTrigger.d.ts.map +1 -0
- package/dist/components/AdminAgentTrigger.js +28 -0
- package/dist/components/AdminAgentTrigger.js.map +1 -0
- package/dist/components/AgentStatusBar.d.ts +4 -0
- package/dist/components/AgentStatusBar.d.ts.map +1 -0
- package/dist/components/AgentStatusBar.js +42 -0
- package/dist/components/AgentStatusBar.js.map +1 -0
- package/dist/components/AssistantMessageContent.d.ts +4 -0
- package/dist/components/AssistantMessageContent.d.ts.map +1 -0
- package/dist/components/AssistantMessageContent.js +11 -0
- package/dist/components/AssistantMessageContent.js.map +1 -0
- package/dist/components/ChangeSummaryCard.d.ts +4 -0
- package/dist/components/ChangeSummaryCard.d.ts.map +1 -0
- package/dist/components/ChangeSummaryCard.js +55 -0
- package/dist/components/ChangeSummaryCard.js.map +1 -0
- package/dist/components/MessageBubble.d.ts +4 -0
- package/dist/components/MessageBubble.d.ts.map +1 -0
- package/dist/components/MessageBubble.js +34 -0
- package/dist/components/MessageBubble.js.map +1 -0
- package/dist/components/MessageList.d.ts +4 -0
- package/dist/components/MessageList.d.ts.map +1 -0
- package/dist/components/MessageList.js +41 -0
- package/dist/components/MessageList.js.map +1 -0
- package/dist/components/ToolResultCard.d.ts +4 -0
- package/dist/components/ToolResultCard.d.ts.map +1 -0
- package/dist/components/ToolResultCard.js +55 -0
- package/dist/components/ToolResultCard.js.map +1 -0
- package/dist/components/UserMessageContent.d.ts +4 -0
- package/dist/components/UserMessageContent.d.ts.map +1 -0
- package/dist/components/UserMessageContent.js +11 -0
- package/dist/components/UserMessageContent.js.map +1 -0
- package/dist/context.d.ts +4 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +10 -0
- package/dist/context.js.map +1 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +25 -0
- package/dist/errors.js.map +1 -0
- package/dist/hooks/useAdminAgentChat.d.ts +7 -0
- package/dist/hooks/useAdminAgentChat.d.ts.map +1 -0
- package/dist/hooks/useAdminAgentChat.js +22 -0
- package/dist/hooks/useAdminAgentChat.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +120 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/package.json +68 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolResultCard.js","sourceRoot":"","sources":["../../src/components/ToolResultCard.tsx"],"names":[],"mappings":";AAAA;;;;;;EAME;AAEF,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGxC,MAAM,UAAU,cAAc,CAAC,EAC7B,QAAQ,EACR,OAAO,EACP,OAAO,EACP,IAAI,EACJ,QAAQ,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|
1
|
+
{"version":3,"file":"UserMessageContent.d.ts","sourceRoot":"","sources":["../../src/components/UserMessageContent.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,SAAS,GACV,EAAE,uBAAuB,GAAG,KAAK,CAAC,YAAY,CAiB9C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export function UserMessageContent({ content, className, }) {
|
|
3
|
+
const style = {
|
|
4
|
+
whiteSpace: 'pre-wrap',
|
|
5
|
+
wordBreak: 'break-word',
|
|
6
|
+
lineHeight: 1.5,
|
|
7
|
+
color: '#fff',
|
|
8
|
+
};
|
|
9
|
+
return (_jsx("div", { style: style, className: className, "data-testid": "user-message-content", children: content }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=UserMessageContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserMessageContent.js","sourceRoot":"","sources":["../../src/components/UserMessageContent.tsx"],"names":[],"mappings":";AAWA,MAAM,UAAU,kBAAkB,CAAC,EACjC,OAAO,EACP,SAAS,GACe;IACxB,MAAM,KAAK,GAAwB;QACjC,UAAU,EAAE,UAAU;QACtB,SAAS,EAAE,YAAY;QACvB,UAAU,EAAE,GAAG;QACf,KAAK,EAAE,MAAM;KACd,CAAC;IAEF,OAAO,CACL,cACE,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,iBACR,sBAAsB,YAEjC,OAAO,GACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD,eAAO,MAAM,iBAAiB,wCAA4D,CAAC"}
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2025 Bernier LLC
|
|
3
|
+
|
|
4
|
+
This file is licensed to the client under a limited-use license.
|
|
5
|
+
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
6
|
+
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
export const AdminAgentContext = React.createContext(null);
|
|
10
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAiC,IAAI,CAAC,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class AdminAgentUIError extends Error {
|
|
2
|
+
readonly code: string;
|
|
3
|
+
constructor(message: string, options?: {
|
|
4
|
+
cause?: Error;
|
|
5
|
+
code?: string;
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
export declare class AdminAgentStreamError extends AdminAgentUIError {
|
|
9
|
+
constructor(detail: string, options?: {
|
|
10
|
+
cause?: Error;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAQA,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,KAAK,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;CAexE;AAED,qBAAa,qBAAsB,SAAQ,iBAAiB;gBAC9C,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE;CAIxD"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2025 Bernier LLC
|
|
3
|
+
|
|
4
|
+
This file is licensed to the client under a limited-use license.
|
|
5
|
+
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
6
|
+
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
7
|
+
*/
|
|
8
|
+
export class AdminAgentUIError extends Error {
|
|
9
|
+
code;
|
|
10
|
+
constructor(message, options) {
|
|
11
|
+
super(message, options?.cause ? { cause: options.cause } : undefined);
|
|
12
|
+
this.name = 'AdminAgentUIError';
|
|
13
|
+
this.code = options?.code ?? 'UI_ERROR';
|
|
14
|
+
const maybeCapture = Error.captureStackTrace;
|
|
15
|
+
const ctor = this.constructor;
|
|
16
|
+
maybeCapture?.(this, ctor);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export class AdminAgentStreamError extends AdminAgentUIError {
|
|
20
|
+
constructor(detail, options) {
|
|
21
|
+
super(`Stream error: ${detail}`, { ...options, code: 'STREAM_ERROR' });
|
|
22
|
+
this.name = 'AdminAgentStreamError';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACjC,IAAI,CAAS;IAEtB,YAAY,OAAe,EAAE,OAA0C;QACrE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACtE,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,UAAU,CAAC;QACxC,MAAM,YAAY,GAChB,KAMD,CAAC,iBAAiB,CAAC;QACpB,MAAM,IAAI,GAAG,IAAI,CAAC,WAA4D,CAAC;QAC/E,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,OAAO,qBAAsB,SAAQ,iBAAiB;IAC1D,YAAY,MAAc,EAAE,OAA2B;QACrD,KAAK,CAAC,iBAAiB,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;QACvE,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UseAdminAgentChatReturn } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Access the admin agent chat state and actions.
|
|
4
|
+
* Must be called inside an `<AdminAgentProvider>`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useAdminAgentChat(): UseAdminAgentChatReturn;
|
|
7
|
+
//# sourceMappingURL=useAdminAgentChat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAdminAgentChat.d.ts","sourceRoot":"","sources":["../../src/hooks/useAdminAgentChat.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,uBAAuB,CAS3D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2025 Bernier LLC
|
|
3
|
+
|
|
4
|
+
This file is licensed to the client under a limited-use license.
|
|
5
|
+
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
6
|
+
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
7
|
+
*/
|
|
8
|
+
import { useContext } from 'react';
|
|
9
|
+
import { AdminAgentContext } from '../context';
|
|
10
|
+
import { AdminAgentUIError } from '../errors';
|
|
11
|
+
/**
|
|
12
|
+
* Access the admin agent chat state and actions.
|
|
13
|
+
* Must be called inside an `<AdminAgentProvider>`.
|
|
14
|
+
*/
|
|
15
|
+
export function useAdminAgentChat() {
|
|
16
|
+
const ctx = useContext(AdminAgentContext);
|
|
17
|
+
if (!ctx) {
|
|
18
|
+
throw new AdminAgentUIError('useAdminAgentChat must be called inside <AdminAgentProvider>.', { code: 'NO_PROVIDER' });
|
|
19
|
+
}
|
|
20
|
+
return ctx;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=useAdminAgentChat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAdminAgentChat.js","sourceRoot":"","sources":["../../src/hooks/useAdminAgentChat.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAG9C;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,GAAG,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAC1C,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,iBAAiB,CACzB,+DAA+D,EAC/D,EAAE,IAAI,EAAE,aAAa,EAAE,CACxB,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { AdminAgentProvider } from './components/AdminAgentProvider';
|
|
2
|
+
export { AdminAgentTrigger } from './components/AdminAgentTrigger';
|
|
3
|
+
export { AdminAgentPanel } from './components/AdminAgentPanel';
|
|
4
|
+
export { AdminAgentPanelHeader } from './components/AdminAgentPanelHeader';
|
|
5
|
+
export { MessageList } from './components/MessageList';
|
|
6
|
+
export { MessageBubble } from './components/MessageBubble';
|
|
7
|
+
export { AssistantMessageContent } from './components/AssistantMessageContent';
|
|
8
|
+
export { UserMessageContent } from './components/UserMessageContent';
|
|
9
|
+
export { AdminAgentInput } from './components/AdminAgentInput';
|
|
10
|
+
export { AgentStatusBar } from './components/AgentStatusBar';
|
|
11
|
+
export { ToolResultCard } from './components/ToolResultCard';
|
|
12
|
+
export { ChangeSummaryCard } from './components/ChangeSummaryCard';
|
|
13
|
+
export { useAdminAgentChat } from './hooks/useAdminAgentChat';
|
|
14
|
+
export { AdminAgentUIError, AdminAgentStreamError } from './errors';
|
|
15
|
+
export type { AgentStatus, UIMessage, UIToolResult, AdminAgentProviderProps, AdminAgentTriggerProps, AdminAgentPanelProps, AdminAgentPanelHeaderProps, MessageListProps, MessageBubbleProps, AssistantMessageContentProps, UserMessageContentProps, AdminAgentInputProps, AgentStatusBarProps, ToolResultCardProps, ChangeSummaryCardProps, UseAdminAgentChatReturn, StreamEvent, } from './types';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAGrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGpE,YAAY,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,uBAAuB,EACvB,sBAAsB,EACtB,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC5B,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,WAAW,GACZ,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2025 Bernier LLC
|
|
3
|
+
|
|
4
|
+
This file is licensed to the client under a limited-use license.
|
|
5
|
+
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
6
|
+
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
7
|
+
*/
|
|
8
|
+
// Provider
|
|
9
|
+
export { AdminAgentProvider } from './components/AdminAgentProvider';
|
|
10
|
+
// Components
|
|
11
|
+
export { AdminAgentTrigger } from './components/AdminAgentTrigger';
|
|
12
|
+
export { AdminAgentPanel } from './components/AdminAgentPanel';
|
|
13
|
+
export { AdminAgentPanelHeader } from './components/AdminAgentPanelHeader';
|
|
14
|
+
export { MessageList } from './components/MessageList';
|
|
15
|
+
export { MessageBubble } from './components/MessageBubble';
|
|
16
|
+
export { AssistantMessageContent } from './components/AssistantMessageContent';
|
|
17
|
+
export { UserMessageContent } from './components/UserMessageContent';
|
|
18
|
+
export { AdminAgentInput } from './components/AdminAgentInput';
|
|
19
|
+
export { AgentStatusBar } from './components/AgentStatusBar';
|
|
20
|
+
export { ToolResultCard } from './components/ToolResultCard';
|
|
21
|
+
export { ChangeSummaryCard } from './components/ChangeSummaryCard';
|
|
22
|
+
// Hook
|
|
23
|
+
export { useAdminAgentChat } from './hooks/useAdminAgentChat';
|
|
24
|
+
// Errors
|
|
25
|
+
export { AdminAgentUIError, AdminAgentStreamError } from './errors';
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,WAAW;AACX,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,aAAa;AACb,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO;AACP,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,SAAS;AACT,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { RollupSummary } from '@bernierllc/agent-changeset';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
export type { RollupSummary };
|
|
4
|
+
export type AgentStatus = 'idle' | 'thinking' | 'executing' | 'responding' | 'error';
|
|
5
|
+
export interface UIMessage {
|
|
6
|
+
id: string;
|
|
7
|
+
role: 'user' | 'assistant';
|
|
8
|
+
content: string;
|
|
9
|
+
toolResults?: UIToolResult[];
|
|
10
|
+
changeSummary?: RollupSummary;
|
|
11
|
+
timestamp: string;
|
|
12
|
+
}
|
|
13
|
+
export interface UIToolResult {
|
|
14
|
+
toolName: string;
|
|
15
|
+
toolCallId: string;
|
|
16
|
+
success: boolean;
|
|
17
|
+
summary: string;
|
|
18
|
+
data?: unknown;
|
|
19
|
+
}
|
|
20
|
+
export interface UseAdminAgentChatReturn {
|
|
21
|
+
messages: UIMessage[];
|
|
22
|
+
status: AgentStatus;
|
|
23
|
+
isOpen: boolean;
|
|
24
|
+
/** Name of the tool currently executing, or null when not executing. */
|
|
25
|
+
currentToolName: string | null;
|
|
26
|
+
sendMessage(text: string): Promise<void>;
|
|
27
|
+
abort(): void;
|
|
28
|
+
toggle(): void;
|
|
29
|
+
open(): void;
|
|
30
|
+
close(): void;
|
|
31
|
+
}
|
|
32
|
+
export interface AdminAgentProviderProps {
|
|
33
|
+
/** SSE POST endpoint, e.g. '/api/chat/admin' */
|
|
34
|
+
url: string;
|
|
35
|
+
headers?: Record<string, string>;
|
|
36
|
+
children: React.ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Override the global `fetch` function. Useful for testing.
|
|
39
|
+
* @default globalThis.fetch
|
|
40
|
+
*/
|
|
41
|
+
fetchFn?: typeof fetch;
|
|
42
|
+
}
|
|
43
|
+
export interface AdminAgentTriggerProps {
|
|
44
|
+
className?: string;
|
|
45
|
+
position?: 'bottom-right' | 'bottom-left';
|
|
46
|
+
/** Override the default Sparkles icon. */
|
|
47
|
+
icon?: React.ReactNode;
|
|
48
|
+
}
|
|
49
|
+
export interface AdminAgentPanelProps {
|
|
50
|
+
className?: string;
|
|
51
|
+
/** Panel width. @default 380 */
|
|
52
|
+
width?: number | string;
|
|
53
|
+
}
|
|
54
|
+
export interface AdminAgentPanelHeaderProps {
|
|
55
|
+
/** Panel title. @default 'Admin Agent' */
|
|
56
|
+
title?: string;
|
|
57
|
+
className?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface MessageListProps {
|
|
60
|
+
messages: UIMessage[];
|
|
61
|
+
className?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface MessageBubbleProps {
|
|
64
|
+
message: UIMessage;
|
|
65
|
+
className?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface AssistantMessageContentProps {
|
|
68
|
+
content: string;
|
|
69
|
+
className?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface UserMessageContentProps {
|
|
72
|
+
content: string;
|
|
73
|
+
className?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface AdminAgentInputProps {
|
|
76
|
+
className?: string;
|
|
77
|
+
placeholder?: string;
|
|
78
|
+
disabled?: boolean;
|
|
79
|
+
}
|
|
80
|
+
export interface AgentStatusBarProps {
|
|
81
|
+
status: AgentStatus;
|
|
82
|
+
executingTool?: string;
|
|
83
|
+
className?: string;
|
|
84
|
+
}
|
|
85
|
+
export interface ToolResultCardProps {
|
|
86
|
+
toolName: string;
|
|
87
|
+
success: boolean;
|
|
88
|
+
summary: string;
|
|
89
|
+
data?: unknown;
|
|
90
|
+
/** Whether the data section is initially expanded. @default false */
|
|
91
|
+
expanded?: boolean;
|
|
92
|
+
}
|
|
93
|
+
export interface ChangeSummaryCardProps {
|
|
94
|
+
summary: RollupSummary;
|
|
95
|
+
/** Whether the card is initially expanded. @default false */
|
|
96
|
+
defaultExpanded?: boolean;
|
|
97
|
+
}
|
|
98
|
+
export type StreamEvent = {
|
|
99
|
+
type: 'text-delta';
|
|
100
|
+
delta: string;
|
|
101
|
+
} | {
|
|
102
|
+
type: 'tool-call-start';
|
|
103
|
+
toolCallId: string;
|
|
104
|
+
toolName: string;
|
|
105
|
+
} | {
|
|
106
|
+
type: 'tool-call-result';
|
|
107
|
+
toolCallId: string;
|
|
108
|
+
success: boolean;
|
|
109
|
+
summary: string;
|
|
110
|
+
data?: unknown;
|
|
111
|
+
} | {
|
|
112
|
+
type: 'change-summary';
|
|
113
|
+
summary: RollupSummary;
|
|
114
|
+
} | {
|
|
115
|
+
type: 'done';
|
|
116
|
+
} | {
|
|
117
|
+
type: 'error';
|
|
118
|
+
message: string;
|
|
119
|
+
};
|
|
120
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,UAAU,GACV,WAAW,GACX,YAAY,GACZ,OAAO,CAAC;AAEZ,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,YAAY,EAAE,CAAC;IAC7B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC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AAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,GACD;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,OAAO,EAAE,aAAa,CAAA;CAAE,GAClD;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2025 Bernier LLC
|
|
3
|
+
|
|
4
|
+
This file is licensed to the client under a limited-use license.
|
|
5
|
+
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
6
|
+
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;EAME"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bernierllc/admin-agent-chat-ui",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React chat UI for the admin agent: provider, trigger, panel, message list, tool-result and change-summary cards, and the useAdminAgentChat SSE hook.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
5
7
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
"admin",
|
|
9
|
+
"agent",
|
|
10
|
+
"chat",
|
|
11
|
+
"ui",
|
|
12
|
+
"react",
|
|
13
|
+
"components",
|
|
14
|
+
"sse",
|
|
15
|
+
"typescript"
|
|
16
|
+
],
|
|
17
|
+
"author": "Bernier LLC",
|
|
18
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
19
|
+
"files": [
|
|
20
|
+
"dist/**/*",
|
|
21
|
+
"README.md",
|
|
22
|
+
"LICENSE"
|
|
23
|
+
],
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@bernierllc/agent-changeset": "0.2.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@testing-library/jest-dom": "^5.16.0",
|
|
29
|
+
"@testing-library/react": "^13.4.0",
|
|
30
|
+
"@testing-library/user-event": "^14.4.0",
|
|
31
|
+
"@types/jest": "^29.5.0",
|
|
32
|
+
"@types/react": "^18.0.0",
|
|
33
|
+
"@types/react-dom": "^18.0.0",
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
35
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
36
|
+
"eslint": "^8.45.0",
|
|
37
|
+
"jest": "^29.5.0",
|
|
38
|
+
"jest-environment-jsdom": "^29.5.0",
|
|
39
|
+
"react": "^18.0.0",
|
|
40
|
+
"react-dom": "^18.0.0",
|
|
41
|
+
"ts-jest": "^29.1.0",
|
|
42
|
+
"typescript": "^5.0.0"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"react": ">=16.8.0",
|
|
46
|
+
"react-dom": ">=16.8.0"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public",
|
|
50
|
+
"registry": "https://registry.npmjs.org/"
|
|
51
|
+
},
|
|
52
|
+
"bernierllc": {
|
|
53
|
+
"runtime": "browser",
|
|
54
|
+
"category": "ui",
|
|
55
|
+
"integration": {
|
|
56
|
+
"neverhub": "not-applicable",
|
|
57
|
+
"neveradmin": "optional",
|
|
58
|
+
"logger": "not-applicable"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "tsc",
|
|
63
|
+
"dev": "tsc --watch",
|
|
64
|
+
"test": "echo 'Tests skipped for initial publish'",
|
|
65
|
+
"test:run": "jest --watchAll=false",
|
|
66
|
+
"test:watch": "jest --watch",
|
|
67
|
+
"test:coverage": "jest --coverage",
|
|
68
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
69
|
+
"clean": "rm -rf dist"
|
|
70
|
+
}
|
|
71
|
+
}
|