@camunda/copilot-chat 0.0.0-alpha5 → 0.0.0-alpha7

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.
@@ -1,11 +1,12 @@
1
1
  export interface CopilotChatProps {
2
2
  readonly onSendMessage: (message: string) => void;
3
+ readonly isBusy?: boolean;
3
4
  readonly workareaSelector?: string;
4
5
  readonly onStopGeneration?: () => void;
5
6
  readonly onResetConversation?: () => void;
6
7
  readonly emptyStateTitle?: string;
7
8
  readonly emptyStateDescription?: string;
8
9
  }
9
- export declare const CopilotChat: ({ onSendMessage, workareaSelector, onStopGeneration, onResetConversation, emptyStateTitle, emptyStateDescription, }: CopilotChatProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const CopilotChat: ({ onSendMessage, isBusy, workareaSelector, onStopGeneration, onResetConversation, emptyStateTitle, emptyStateDescription, }: CopilotChatProps) => import("react/jsx-runtime").JSX.Element;
10
11
  export default CopilotChat;
11
12
  //# sourceMappingURL=CopilotChat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CopilotChat.d.ts","sourceRoot":"","sources":["../src/CopilotChat.tsx"],"names":[],"mappings":"AAQA,OAAO,0BAA0B,CAAC;AAUlC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IACvC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1C,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;CACzC;AAED,eAAO,MAAM,WAAW,GAAI,qHAOzB,gBAAgB,4CAiFlB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"CopilotChat.d.ts","sourceRoot":"","sources":["../src/CopilotChat.tsx"],"names":[],"mappings":"AAQA,OAAO,0BAA0B,CAAC;AAUlC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IACvC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1C,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;CACzC;AAED,eAAO,MAAM,WAAW,GAAI,6HAQzB,gBAAgB,4CAgFlB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,9 +1,9 @@
1
1
  interface ChatInputProps {
2
2
  readonly onSend: (message: string) => void;
3
3
  readonly onStop?: () => void;
4
- readonly isStreaming?: boolean;
4
+ readonly isBusy?: boolean;
5
5
  readonly placeholder?: string;
6
6
  }
7
- export declare const ChatInput: ({ onSend, onStop, isStreaming, placeholder, }: ChatInputProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const ChatInput: ({ onSend, onStop, isBusy, placeholder, }: ChatInputProps) => import("react/jsx-runtime").JSX.Element;
8
8
  export {};
9
9
  //# sourceMappingURL=ChatInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatInput.d.ts","sourceRoot":"","sources":["../../../src/components/ChatInput/ChatInput.tsx"],"names":[],"mappings":"AAaA,UAAU,cAAc;IACtB,QAAQ,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,SAAS,GAAI,+CAKvB,cAAc,4CA6FhB,CAAC"}
1
+ {"version":3,"file":"ChatInput.d.ts","sourceRoot":"","sources":["../../../src/components/ChatInput/ChatInput.tsx"],"names":[],"mappings":"AAaA,UAAU,cAAc;IACtB,QAAQ,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,SAAS,GAAI,0CAKvB,cAAc,4CA6FhB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export { default as CopilotChat } from './CopilotChat';
2
2
  export type { CopilotChatProps } from './CopilotChat';
3
- export { useChatStore } from './store';
3
+ export { useChatStore, useAgentStore, selectIsBusy, selectAgentState, } from './store';
4
4
  export type { ChatMessage, MessageStatus } from './types';
5
+ export { AgentState, EventType, EventStatus, ResultType } from './types';
6
+ export type { AgentStateType, EventTypeValue, EventStatusValue, ResultTypeValue, AgentEvent, AgentResult, ToolInvokeResult, FrontendTool, } from './types';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,+BAA+B,CAAC;AACvC,OAAO,0BAA0B,CAAC;AAElC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,+BAA+B,CAAC;AACvC,OAAO,0BAA0B,CAAC;AAElC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EACL,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACzE,YAAY,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,YAAY,GACb,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -16802,21 +16802,21 @@ const styles$5 = {
16802
16802
  const ChatInput = ({
16803
16803
  onSend,
16804
16804
  onStop,
16805
- isStreaming = false,
16805
+ isBusy = false,
16806
16806
  placeholder = "Type a message..."
16807
16807
  }) => {
16808
16808
  const [value, setValue] = useState("");
16809
16809
  const textAreaRef = useRef(null);
16810
16810
  const handleSend = useCallback(() => {
16811
16811
  const trimmed = value.trim();
16812
- if (trimmed && !isStreaming) {
16812
+ if (trimmed && !isBusy) {
16813
16813
  onSend(trimmed);
16814
16814
  setValue("");
16815
16815
  if (textAreaRef.current) {
16816
16816
  textAreaRef.current.style.height = "auto";
16817
16817
  }
16818
16818
  }
16819
- }, [value, isStreaming, onSend]);
16819
+ }, [value, isBusy, onSend]);
16820
16820
  const handleStop = useCallback(() => {
16821
16821
  onStop?.();
16822
16822
  }, [onStop]);
@@ -16848,11 +16848,11 @@ const ChatInput = ({
16848
16848
  }
16849
16849
  }, [value]);
16850
16850
  useEffect(() => {
16851
- if (!isStreaming && textAreaRef.current) {
16851
+ if (!isBusy && textAreaRef.current) {
16852
16852
  textAreaRef.current.focus();
16853
16853
  }
16854
- }, [isStreaming]);
16855
- const canSend = value.trim().length > 0 && !isStreaming;
16854
+ }, [isBusy]);
16855
+ const canSend = value.trim().length > 0 && !isBusy;
16856
16856
  return /* @__PURE__ */ jsxs("div", { className: styles$5.inputContainer, children: [
16857
16857
  /* @__PURE__ */ jsx(
16858
16858
  "textarea",
@@ -16863,11 +16863,11 @@ const ChatInput = ({
16863
16863
  onChange: handleChange,
16864
16864
  onKeyDown: handleKeyDown,
16865
16865
  placeholder,
16866
- disabled: isStreaming,
16866
+ disabled: isBusy,
16867
16867
  rows: 1
16868
16868
  }
16869
16869
  ),
16870
- isStreaming ? /* @__PURE__ */ jsx(
16870
+ isBusy ? /* @__PURE__ */ jsx(
16871
16871
  Button,
16872
16872
  {
16873
16873
  className: styles$5.actionButton,
@@ -27434,6 +27434,144 @@ const useChatStore = create((set) => ({
27434
27434
  set({ messages: [], isStreaming: false, streamingMessageId: null });
27435
27435
  }
27436
27436
  }));
27437
+ const AgentState = {
27438
+ IDLE: "IDLE",
27439
+ BUSY: "BUSY",
27440
+ AWAITING_TOOL: "AWAITING_TOOL",
27441
+ ERROR: "ERROR"
27442
+ };
27443
+ const EventType = {
27444
+ THINKING: "THINKING",
27445
+ EXECUTION_PLAN: "EXECUTION_PLAN",
27446
+ TOOL_PLANNING: "TOOL_PLANNING",
27447
+ TOOL_INVOKE: "TOOL_INVOKE",
27448
+ TOOL_RESULT: "TOOL_RESULT"
27449
+ };
27450
+ const EventStatus = {
27451
+ IN_PROGRESS: "IN_PROGRESS",
27452
+ COMPLETED: "COMPLETED",
27453
+ ERROR: "ERROR"
27454
+ };
27455
+ const ResultType = {
27456
+ TOOL_INVOKE: "TOOL_INVOKE"
27457
+ };
27458
+ const INITIAL_STATE = {
27459
+ conversationId: null,
27460
+ currentMessageId: null,
27461
+ activeEvents: /* @__PURE__ */ new Set(),
27462
+ pendingToolInvoke: null,
27463
+ frontendToolNames: /* @__PURE__ */ new Set(),
27464
+ error: null
27465
+ };
27466
+ const deriveAgentState = (activeEvents, pendingToolInvoke, error2) => {
27467
+ if (error2) return AgentState.ERROR;
27468
+ if (pendingToolInvoke) return AgentState.AWAITING_TOOL;
27469
+ if (activeEvents.size > 0) return AgentState.BUSY;
27470
+ return AgentState.IDLE;
27471
+ };
27472
+ const selectAgentState = (state) => deriveAgentState(state.activeEvents, state.pendingToolInvoke, state.error);
27473
+ const selectIsBusy = (state) => {
27474
+ const agentState = selectAgentState(state);
27475
+ return agentState === AgentState.BUSY || agentState === AgentState.AWAITING_TOOL;
27476
+ };
27477
+ const isFrontendTool = (toolName, frontendToolNames) => Boolean(toolName && frontendToolNames.has(toolName));
27478
+ const useAgentStore = create((set, get) => ({
27479
+ ...INITIAL_STATE,
27480
+ startConversation: (conversationId, messageId) => {
27481
+ set({
27482
+ conversationId,
27483
+ currentMessageId: messageId,
27484
+ activeEvents: /* @__PURE__ */ new Set(),
27485
+ pendingToolInvoke: null,
27486
+ error: null
27487
+ });
27488
+ },
27489
+ setFrontendTools: (tools) => {
27490
+ set({
27491
+ frontendToolNames: new Set(tools.map((t2) => t2.name))
27492
+ });
27493
+ },
27494
+ processEvent: (event) => {
27495
+ const state = get();
27496
+ const messageId = state.currentMessageId;
27497
+ if (event.status === EventStatus.ERROR) {
27498
+ set({
27499
+ activeEvents: /* @__PURE__ */ new Set(),
27500
+ error: event.content || "Copilot agent error"
27501
+ });
27502
+ if (messageId) {
27503
+ useChatStore.getState().updateMessageStatus(messageId, "error");
27504
+ }
27505
+ return null;
27506
+ }
27507
+ const trackableEvents = /* @__PURE__ */ new Set([
27508
+ EventType.THINKING,
27509
+ EventType.TOOL_RESULT
27510
+ ]);
27511
+ if (event.status === EventStatus.IN_PROGRESS) {
27512
+ if (trackableEvents.has(event.type)) {
27513
+ const newActiveEvents = new Set(state.activeEvents);
27514
+ newActiveEvents.add(event.type);
27515
+ set({ activeEvents: newActiveEvents });
27516
+ }
27517
+ if (event.type === EventType.TOOL_INVOKE && event.toolName && isFrontendTool(event.toolName, state.frontendToolNames) && !state.pendingToolInvoke) {
27518
+ const toolArguments = event.toolArguments ? JSON.parse(event.toolArguments) : {};
27519
+ set({
27520
+ pendingToolInvoke: {
27521
+ toolName: event.toolName,
27522
+ toolArguments
27523
+ }
27524
+ });
27525
+ return {
27526
+ type: ResultType.TOOL_INVOKE,
27527
+ toolName: event.toolName,
27528
+ toolArguments
27529
+ };
27530
+ }
27531
+ }
27532
+ if (event.status === EventStatus.COMPLETED) {
27533
+ if (event.type === EventType.TOOL_RESULT && event.toolName && state.pendingToolInvoke?.toolName === event.toolName) {
27534
+ set({ pendingToolInvoke: null });
27535
+ }
27536
+ if (trackableEvents.has(event.type)) {
27537
+ const newActiveEvents = new Set(state.activeEvents);
27538
+ newActiveEvents.delete(event.type);
27539
+ const currentPendingTool = get().pendingToolInvoke;
27540
+ set({ activeEvents: newActiveEvents });
27541
+ if (newActiveEvents.size === 0 && !currentPendingTool && messageId) {
27542
+ useChatStore.getState().updateMessageStatus(messageId, "complete");
27543
+ useChatStore.getState().updateMessageStatusLabel(messageId, "");
27544
+ }
27545
+ }
27546
+ }
27547
+ return null;
27548
+ },
27549
+ clearPendingTool: () => {
27550
+ set({ pendingToolInvoke: null });
27551
+ },
27552
+ setError: (error2) => {
27553
+ const messageId = get().currentMessageId;
27554
+ set({
27555
+ activeEvents: /* @__PURE__ */ new Set(),
27556
+ error: error2
27557
+ });
27558
+ if (messageId) {
27559
+ useChatStore.getState().updateMessageStatus(messageId, "error");
27560
+ }
27561
+ },
27562
+ reset: () => {
27563
+ const messageId = get().currentMessageId;
27564
+ if (messageId) {
27565
+ const chatStore = useChatStore.getState();
27566
+ const message2 = chatStore.messages.find((m2) => m2.id === messageId);
27567
+ if (message2 && message2.status !== "complete" && message2.status !== "error") {
27568
+ chatStore.updateMessageStatus(messageId, "complete");
27569
+ chatStore.updateMessageStatusLabel(messageId, "");
27570
+ }
27571
+ }
27572
+ set(INITIAL_STATE);
27573
+ }
27574
+ }));
27437
27575
  const __vite_glob_0_0 = "._inputContainer_19528_1 {\n display: flex;\n align-items: flex-end;\n gap: var(--spacing-px-8, 8px);\n padding: var(--spacing-px-12, 12px) var(--spacing-px-16, 16px);\n background-color: var(--color-background-white, #fff);\n border-block-start: 1px solid var(--color-border-light, rgba(0, 0, 0, 0.1));\n position: relative;\n}\n\n._textArea_19528_11 {\n flex: 1;\n padding: var(--spacing-px-8, 8px) 0;\n border: none;\n margin: 0;\n background: transparent;\n color: var(--color-text-primary, #161616);\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,\n Arial, sans-serif;\n font-size: 14px;\n line-height: var(--line-height-base, 1.5);\n resize: none;\n outline: none;\n overflow-y: auto;\n min-height: 40px;\n max-height: var(--chat-input-max-height, 150px);\n box-shadow: none;\n scrollbar-width: thin;\n scrollbar-color: var(--color-background-scrollbar, #e0e0e0) transparent;\n}\n\n._textArea_19528_11::-webkit-scrollbar {\n width: var(--scrollbar-width, 6px);\n}\n\n._textArea_19528_11::-webkit-scrollbar-track {\n background: transparent;\n}\n\n._textArea_19528_11::-webkit-scrollbar-thumb {\n background-color: var(--color-background-scrollbar, #e0e0e0);\n border-radius: var(--border-radius-small, 3px);\n}\n\n._textArea_19528_11:focus {\n border: none;\n outline: none;\n box-shadow: none;\n}\n\n._textArea_19528_11::placeholder {\n color: var(--color-text-placeholder, #a8a8a8);\n font-weight: var(--font-weight-normal, 400);\n}\n\n._textArea_19528_11:disabled {\n color: var(--color-text-disabled, #c6c6c6);\n cursor: not-allowed;\n opacity: var(--opacity-disabled, 0.5);\n}\n\n._actionButton_19528_62 {\n flex-shrink: 0;\n min-width: var(--size-button-medium, 32px);\n min-height: var(--size-button-medium, 32px);\n padding: var(--spacing-px-6, 6px);\n color: var(--brand-color-primary, #8a3ffc);\n border-radius: var(--border-radius-medium, 6px);\n transition: all var(--transition-duration-base, 120ms)\n var(--transition-timing-ease, ease-in-out);\n}\n\n._actionButton_19528_62:hover:not(:disabled) {\n background-color: var(--color-brand-alpha-10, rgba(138, 63, 252, 0.1));\n color: var(--brand-color-hover, #7a34e4);\n}\n\n._actionButton_19528_62:active:not(:disabled) {\n background-color: var(--color-brand-alpha-20, rgba(138, 63, 252, 0.2));\n transform: scale(var(--transform-scale-pressed, 0.95));\n}\n\n._actionButton_19528_62:disabled {\n color: var(--color-text-disabled, #c6c6c6);\n cursor: not-allowed;\n opacity: var(--opacity-disabled, 0.5);\n}\n";
27438
27576
  const __vite_glob_0_1 = "._message_1rpzb_1 {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 16px 20px;\n}\n\n._userMessage_1rpzb_8 {\n align-items: flex-end;\n}\n\n._assistantMessage_1rpzb_12 {\n align-items: flex-start;\n}\n\n._userBubble_1rpzb_16 {\n max-inline-size: 90%;\n padding: 12px 16px;\n background-color: #f4f4f4;\n color: #161616;\n border-radius: 16px;\n border-bottom-right-radius: 4px;\n font-size: 14px;\n line-height: 1.5;\n word-wrap: break-word;\n}\n\n._assistantBubble_1rpzb_28 {\n max-inline-size: 90%;\n font-size: 14px;\n line-height: 1.5;\n color: #161616;\n word-wrap: break-word;\n}\n\n._errorMessage_1rpzb_36 {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n padding: 12px;\n background-color: #fff1f1;\n border-inline-start: 3px solid #da1e28;\n font-size: 14px;\n line-height: 1.5;\n color: #161616;\n}\n\n._streamingIndicator_1rpzb_48 {\n display: flex;\n align-items: center;\n gap: 8px;\n padding-block-start: 4px;\n color: #525252;\n font-size: 12px;\n}\n\n._content_1rpzb_57 pre {\n margin: 12px 0;\n padding: 12px;\n background-color: rgba(0, 0, 0, 0.06);\n border-radius: 4px;\n overflow-x: auto;\n}\n\n._content_1rpzb_57 pre code {\n padding: 0;\n background: none;\n}\n";
27439
27577
  const __vite_glob_0_2 = "._container_jclve_1 {\n display: flex;\n flex-direction: column;\n flex: 1;\n overflow: hidden;\n}\n\n._list_jclve_8 {\n flex: 1;\n overflow-y: auto;\n padding: var(--spacing-base, 16px) 0;\n}\n\n._emptyState_jclve_14 {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n block-size: 100%;\n padding: var(--spacing-xlarge, 32px);\n text-align: center;\n color: var(--cds-text-secondary, var(--color-text-secondary, #525252));\n}\n\n._emptyTitle_jclve_25 {\n margin-block-end: var(--spacing-small, 8px);\n font-size: var(--font-size-medium, 16px);\n font-weight: var(--font-weight-semibold, 600);\n color: var(--cds-text-primary, var(--color-text-primary, #161616));\n}\n\n._emptyDescription_jclve_32 {\n font-size: var(--font-size-base, 14px);\n}\n";
@@ -27473,6 +27611,7 @@ const ensureSidecarStyles = () => {
27473
27611
  const CopilotLauncherIcon = "data:image/svg+xml,%3csvg%20width='17'%20height='15'%20viewBox='0%200%2017%2015'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M9.7219%205.2691C8.6668%204.2126%207.7435%202.4757%207.0638%201.00772C7.0445%201.00316%207.0206%201%206.9941%201C6.9675%201%206.9436%201.00316%206.9243%201.00773C6.2447%202.4757%205.322%204.2122%204.2662%205.2687C3.2106%206.325%201.47501%207.2485%200.00802994%207.9287C0.00328994%207.9483%200%207.9728%200%208C0%208.0271%200.00324982%208.0515%200.00793982%208.071C1.47467%208.751%203.2101%209.6743%204.2659%2010.7311C5.322%2011.7875%206.2448%2013.5244%206.9245%2014.9923C6.9437%2014.9969%206.9675%2015%206.994%2015C7.0205%2015%207.0444%2014.9968%207.0636%2014.9923C7.7433%2013.5244%208.666%2011.7877%209.7215%2010.7315M9.7215%2010.7315C10.773%209.6791%2012.4531%208.7468%2013.8721%208.0577C13.8756%208.0415%2013.878%208.0217%2013.878%207.9998C13.878%207.9779%2013.8756%207.9582%2013.8721%207.942C12.4537%207.2529%2010.7734%206.3207%209.7219%205.2691'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M15.4808%201.52468C15.104%201.14737%2014.7742%200.52704%2014.5315%200.00275993C14.5246%200.00112993%2014.5161%200%2014.5066%200C14.4971%200%2014.4885%200.00112993%2014.4817%200.00275993C14.2389%200.52705%2013.9094%201.14721%2013.5323%201.52455C13.1553%201.9018%2012.5355%202.2316%2012.0116%202.4745C12.0099%202.4815%2012.0087%202.4903%2012.0087%202.5C12.0087%202.5097%2012.0099%202.5184%2012.0115%202.5254C12.5354%202.7682%2013.1552%203.098%2013.5322%203.4754C13.9094%203.8527%2014.239%204.473%2014.4817%204.9972C14.4886%204.9989%2014.4971%205%2014.5066%205C14.516%205%2014.5246%204.9989%2014.5314%204.9972C14.7742%204.473%2015.1037%203.8528%2015.4806%203.4755M15.4806%203.4755C15.8562%203.0997%2016.4562%202.7667%2016.963%202.5206C16.9643%202.5148%2016.9651%202.5078%2016.9651%202.4999C16.9651%202.4921%2016.9643%202.4851%2016.963%202.4793C16.4565%202.2332%2015.8563%201.90026%2015.4808%201.52468'%20fill='white'/%3e%3c/svg%3e";
27474
27612
  const CopilotChat = ({
27475
27613
  onSendMessage,
27614
+ isBusy = false,
27476
27615
  workareaSelector,
27477
27616
  onStopGeneration,
27478
27617
  onResetConversation,
@@ -27481,7 +27620,6 @@ const CopilotChat = ({
27481
27620
  }) => {
27482
27621
  const [isOpen, setIsOpen] = useState(false);
27483
27622
  const messages = useChatStore((state) => state.messages);
27484
- const isStreaming = useChatStore((state) => state.isStreaming);
27485
27623
  const clearMessages = useChatStore((state) => state.clearMessages);
27486
27624
  useCopilotSidecar({
27487
27625
  enabled: isOpen,
@@ -27551,7 +27689,7 @@ const CopilotChat = ({
27551
27689
  {
27552
27690
  onSend: handleSend,
27553
27691
  onStop: handleStopGeneration,
27554
- isStreaming
27692
+ isBusy
27555
27693
  }
27556
27694
  )
27557
27695
  ] })
@@ -27561,6 +27699,13 @@ const CopilotChat = ({
27561
27699
  ] });
27562
27700
  };
27563
27701
  export {
27702
+ AgentState,
27564
27703
  CopilotChat,
27704
+ EventStatus,
27705
+ EventType,
27706
+ ResultType,
27707
+ selectAgentState,
27708
+ selectIsBusy,
27709
+ useAgentStore,
27565
27710
  useChatStore
27566
27711
  };
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/copilot-chat",
3
- "version": "0.0.0-alpha5",
3
+ "version": "0.0.0-alpha7",
4
4
  "description": "Camunda Copilot Client Library - React components and utilities for Camunda Platform 8",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -0,0 +1,26 @@
1
+ import { AgentStateType, AgentEvent, AgentResult, FrontendTool, EventTypeValue } from '../types/agentTypes';
2
+ interface AgentStoreState {
3
+ readonly conversationId: string | null;
4
+ readonly currentMessageId: string | null;
5
+ readonly activeEvents: ReadonlySet<EventTypeValue>;
6
+ readonly pendingToolInvoke: {
7
+ readonly toolName: string;
8
+ readonly toolArguments: Record<string, unknown>;
9
+ } | null;
10
+ readonly frontendToolNames: ReadonlySet<string>;
11
+ readonly error: string | null;
12
+ }
13
+ interface AgentStoreActions {
14
+ readonly startConversation: (conversationId: string, messageId: string) => void;
15
+ readonly setFrontendTools: (tools: readonly FrontendTool[]) => void;
16
+ readonly processEvent: (event: AgentEvent) => AgentResult | null;
17
+ readonly clearPendingTool: () => void;
18
+ readonly setError: (error: string) => void;
19
+ readonly reset: () => void;
20
+ }
21
+ type AgentStore = AgentStoreState & AgentStoreActions;
22
+ export declare const selectAgentState: (state: AgentStoreState) => AgentStateType;
23
+ export declare const selectIsBusy: (state: AgentStoreState) => boolean;
24
+ export declare const useAgentStore: import('zustand').UseBoundStore<import('zustand').StoreApi<AgentStore>>;
25
+ export {};
26
+ //# sourceMappingURL=agentStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentStore.d.ts","sourceRoot":"","sources":["../../src/store/agentStore.ts"],"names":[],"mappings":"AASA,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,cAAc,EACpB,MAAM,qBAAqB,CAAC;AAG7B,UAAU,eAAe;IACvB,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;IACnD,QAAQ,CAAC,iBAAiB,EAAE;QAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACjD,GAAG,IAAI,CAAC;IACT,QAAQ,CAAC,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,UAAU,iBAAiB;IACzB,QAAQ,CAAC,iBAAiB,EAAE,CAC1B,cAAc,EAAE,MAAM,EACtB,SAAS,EAAE,MAAM,KACd,IAAI,CAAC;IACV,QAAQ,CAAC,gBAAgB,EAAE,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,KAAK,IAAI,CAAC;IACpE,QAAQ,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,WAAW,GAAG,IAAI,CAAC;IACjE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,IAAI,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,KAAK,UAAU,GAAG,eAAe,GAAG,iBAAiB,CAAC;AAsBtD,eAAO,MAAM,gBAAgB,GAAI,OAAO,eAAe,KAAG,cACkB,CAAC;AAE7E,eAAO,MAAM,YAAY,GAAI,OAAO,eAAe,KAAG,OAKrD,CAAC;AAOF,eAAO,MAAM,aAAa,yEA+HvB,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export { useChatStore } from './chatStore';
2
+ export { useAgentStore, selectIsBusy, selectAgentState } from './agentStore';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,46 @@
1
+ export declare const AgentState: {
2
+ readonly IDLE: "IDLE";
3
+ readonly BUSY: "BUSY";
4
+ readonly AWAITING_TOOL: "AWAITING_TOOL";
5
+ readonly ERROR: "ERROR";
6
+ };
7
+ export type AgentStateType = (typeof AgentState)[keyof typeof AgentState];
8
+ export declare const EventType: {
9
+ readonly THINKING: "THINKING";
10
+ readonly EXECUTION_PLAN: "EXECUTION_PLAN";
11
+ readonly TOOL_PLANNING: "TOOL_PLANNING";
12
+ readonly TOOL_INVOKE: "TOOL_INVOKE";
13
+ readonly TOOL_RESULT: "TOOL_RESULT";
14
+ };
15
+ export type EventTypeValue = (typeof EventType)[keyof typeof EventType];
16
+ export declare const EventStatus: {
17
+ readonly IN_PROGRESS: "IN_PROGRESS";
18
+ readonly COMPLETED: "COMPLETED";
19
+ readonly ERROR: "ERROR";
20
+ };
21
+ export type EventStatusValue = (typeof EventStatus)[keyof typeof EventStatus];
22
+ export declare const ResultType: {
23
+ readonly TOOL_INVOKE: "TOOL_INVOKE";
24
+ };
25
+ export type ResultTypeValue = (typeof ResultType)[keyof typeof ResultType];
26
+ export interface AgentEvent {
27
+ readonly conversationId: string;
28
+ readonly type: EventTypeValue;
29
+ readonly status: EventStatusValue;
30
+ readonly content?: string;
31
+ readonly toolName?: string;
32
+ readonly toolArguments?: string;
33
+ readonly toolResult?: string;
34
+ }
35
+ export interface ToolInvokeResult {
36
+ readonly type: typeof ResultType.TOOL_INVOKE;
37
+ readonly toolName: string;
38
+ readonly toolArguments: Record<string, unknown>;
39
+ }
40
+ export type AgentResult = ToolInvokeResult;
41
+ export interface FrontendTool {
42
+ readonly name: string;
43
+ readonly description: string;
44
+ readonly parametersSchema: string;
45
+ }
46
+ //# sourceMappingURL=agentTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentTypes.d.ts","sourceRoot":"","sources":["../../src/types/agentTypes.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,UAAU;;;;;CAKb,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAE1E,eAAO,MAAM,SAAS;;;;;;CAMZ,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAExE,eAAO,MAAM,WAAW;;;;CAId,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAE9E,eAAO,MAAM,UAAU;;CAEb,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAE3E,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,OAAO,UAAU,CAAC,WAAW,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjD;AAED,MAAM,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAE3C,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC"}
@@ -1,2 +1,3 @@
1
1
  export * from './chatTypes';
2
+ export * from './agentTypes';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAQA,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAQA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/copilot-chat",
3
- "version": "0.0.0-alpha5",
3
+ "version": "0.0.0-alpha7",
4
4
  "description": "Camunda Copilot Client Library - React components and utilities for Camunda Platform 8",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",