@camunda/copilot-chat 0.0.0-alpha10

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.
Files changed (45) hide show
  1. package/LICENSE +65 -0
  2. package/README.md +89 -0
  3. package/dist/CopilotChat.d.ts +12 -0
  4. package/dist/CopilotChat.d.ts.map +1 -0
  5. package/dist/constants/theme.d.ts +79 -0
  6. package/dist/constants/theme.d.ts.map +1 -0
  7. package/dist/hooks/index.d.ts +3 -0
  8. package/dist/hooks/index.d.ts.map +1 -0
  9. package/dist/hooks/useAgentAdapter.d.ts +3 -0
  10. package/dist/hooks/useAgentAdapter.d.ts.map +1 -0
  11. package/dist/hooks/useCopilotSidecar.d.ts +6 -0
  12. package/dist/hooks/useCopilotSidecar.d.ts.map +1 -0
  13. package/dist/index.css +1 -0
  14. package/dist/index.d.ts +11 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +8490 -0
  17. package/dist/layout/SidecarLayoutManager.d.ts +8 -0
  18. package/dist/layout/SidecarLayoutManager.d.ts.map +1 -0
  19. package/dist/package.json +61 -0
  20. package/dist/store/agentStore.d.ts +28 -0
  21. package/dist/store/agentStore.d.ts.map +1 -0
  22. package/dist/store/chatStore.d.ts +25 -0
  23. package/dist/store/chatStore.d.ts.map +1 -0
  24. package/dist/store/index.d.ts +4 -0
  25. package/dist/store/index.d.ts.map +1 -0
  26. package/dist/store/messageContextStore.d.ts +21 -0
  27. package/dist/store/messageContextStore.d.ts.map +1 -0
  28. package/dist/styles/ensureSidecarStyles.d.ts +2 -0
  29. package/dist/styles/ensureSidecarStyles.d.ts.map +1 -0
  30. package/dist/test-setup.d.ts +1 -0
  31. package/dist/test-setup.d.ts.map +1 -0
  32. package/dist/types/agentTypes.d.ts +80 -0
  33. package/dist/types/agentTypes.d.ts.map +1 -0
  34. package/dist/types/chatTypes.d.ts +30 -0
  35. package/dist/types/chatTypes.d.ts.map +1 -0
  36. package/dist/types/index.d.ts +3 -0
  37. package/dist/types/index.d.ts.map +1 -0
  38. package/dist/utils/eventHandlers.d.ts +33 -0
  39. package/dist/utils/eventHandlers.d.ts.map +1 -0
  40. package/dist/utils/index.d.ts +3 -0
  41. package/dist/utils/index.d.ts.map +1 -0
  42. package/dist/utils/statusLabels.d.ts +3 -0
  43. package/dist/utils/statusLabels.d.ts.map +1 -0
  44. package/license.header +7 -0
  45. package/package.json +61 -0
@@ -0,0 +1,8 @@
1
+ export interface SidecarLayoutConfig {
2
+ width: number;
3
+ zIndex: number;
4
+ workareaSelector?: string;
5
+ responsiveBreakpoint: number;
6
+ }
7
+ export declare const attachSidecarLayout: ({ width, zIndex, workareaSelector, responsiveBreakpoint, }: SidecarLayoutConfig) => () => void;
8
+ //# sourceMappingURL=SidecarLayoutManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidecarLayoutManager.d.ts","sourceRoot":"","sources":["../../src/layout/SidecarLayoutManager.ts"],"names":[],"mappings":"AAOA,OAAO,2BAA2B,CAAC;AAInC,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAsMD,eAAO,MAAM,mBAAmB,GAAI,4DAKjC,mBAAmB,eAqBrB,CAAC"}
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@camunda/copilot-chat",
3
+ "version": "0.0.0-alpha10",
4
+ "description": "Camunda Copilot Client Library - React components and utilities for Camunda Platform 8",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "style": "./dist/index.css",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./style.css": {
17
+ "import": "./dist/index.css",
18
+ "default": "./dist/index.css"
19
+ },
20
+ "./package.json": "./package.json"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "README.md",
25
+ "LICENSE"
26
+ ],
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/camunda/camunda-copilot-client.git",
33
+ "directory": "packages/copilot-chat"
34
+ },
35
+ "keywords": [
36
+ "camunda",
37
+ "copilot",
38
+ "react",
39
+ "typescript",
40
+ "camunda-platform-8",
41
+ "workflow",
42
+ "automation"
43
+ ],
44
+ "author": "Camunda Services GmbH",
45
+ "license": "LicenseRef-Camunda-1.0",
46
+ "engines": {
47
+ "node": ">=18.0.0",
48
+ "npm": ">=9.0.0"
49
+ },
50
+ "dependencies": {
51
+ "zustand": "^5.0.2"
52
+ },
53
+ "devDependencies": {
54
+ "@camunda/copilot-components": "file:../copilot-components"
55
+ },
56
+ "peerDependencies": {
57
+ "@carbon/react": "^1.92.0",
58
+ "react": ">=18.0.0 <20.0.0",
59
+ "react-dom": ">=18.0.0 <20.0.0"
60
+ }
61
+ }
@@ -0,0 +1,28 @@
1
+ import { AgentEvent, AgentResult, FrontendTool, EventTypeValue } from '../types/agentTypes';
2
+ interface AgentStoreState {
3
+ readonly conversationId: string | null;
4
+ readonly currentMessageId: string | null;
5
+ readonly isBusy: boolean;
6
+ readonly currentEventType: EventTypeValue | null;
7
+ readonly currentToolName: string | null;
8
+ readonly pendingToolInvoke: {
9
+ readonly toolName: string;
10
+ readonly toolArguments: Record<string, unknown>;
11
+ } | null;
12
+ readonly frontendToolNames: ReadonlySet<string>;
13
+ readonly error: string | null;
14
+ }
15
+ interface AgentStoreActions {
16
+ readonly startConversation: (conversationId: string, messageId: string) => void;
17
+ readonly setFrontendTools: (tools: readonly FrontendTool[]) => void;
18
+ readonly processEvent: (event: AgentEvent) => AgentResult | null;
19
+ readonly clearPendingTool: () => void;
20
+ readonly setError: (error: string) => void;
21
+ readonly reset: () => void;
22
+ }
23
+ type AgentStore = AgentStoreState & AgentStoreActions;
24
+ export declare const selectIsBusy: (state: AgentStoreState) => boolean;
25
+ export declare const selectAgentState: (state: AgentStoreState) => string;
26
+ export declare const useAgentStore: import('zustand').UseBoundStore<import('zustand').StoreApi<AgentStore>>;
27
+ export {};
28
+ //# 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,EAIL,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,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,gBAAgB,EAAE,cAAc,GAAG,IAAI,CAAC;IACjD,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,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;AAatD,eAAO,MAAM,YAAY,GAAI,OAAO,eAAe,KAAG,OACJ,CAAC;AAEnD,eAAO,MAAM,gBAAgB,GAAI,OAAO,eAAe,KAAG,MAKzD,CAAC;AA0GF,eAAO,MAAM,aAAa,yEA2EvB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { ChatMessage, MessageStatus } from '../types';
2
+ interface ChatState {
3
+ readonly messages: readonly ChatMessage[];
4
+ readonly isStreaming: boolean;
5
+ readonly streamingMessageId: string | null;
6
+ readonly currentThinkingBlockId: string | null;
7
+ }
8
+ interface ChatActions {
9
+ readonly addUserMessage: (content: string) => string;
10
+ readonly addAssistantMessage: (id: string) => void;
11
+ readonly appendToMessage: (id: string, content: string) => void;
12
+ readonly setMessageContent: (id: string, content: string) => void;
13
+ readonly updateMessageStatus: (id: string, status: MessageStatus) => void;
14
+ readonly updateMessageStatusLabel: (id: string, statusLabel: string) => void;
15
+ readonly setStreaming: (isStreaming: boolean, messageId?: string | null) => void;
16
+ readonly clearMessages: () => void;
17
+ readonly addThinkingBlock: (messageId: string, blockId: string, label: string) => void;
18
+ readonly appendToThinkingBlock: (messageId: string, blockId: string, content: string) => void;
19
+ readonly completeThinkingBlock: (messageId: string, blockId: string) => void;
20
+ readonly completeAllThinkingBlocks: (messageId: string) => void;
21
+ }
22
+ type ChatStore = ChatState & ChatActions;
23
+ export declare const useChatStore: import('zustand').UseBoundStore<import('zustand').StoreApi<ChatStore>>;
24
+ export {};
25
+ //# sourceMappingURL=chatStore.d.ts.map
@@ -0,0 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IAAI,CAAC;IACV,QAAQ,CAAC,qBAAqB,EAAE,CAC9B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,KACZ,IAAI,CAAC;IACV,QAAQ,CAAC,qBAAqB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7E,QAAQ,CAAC,yBAAyB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CACjE;AAED,KAAK,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;AAKzC,eAAO,MAAM,YAAY,wEAyKtB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { useChatStore } from './chatStore';
2
+ export { useAgentStore, selectIsBusy, selectAgentState } from './agentStore';
3
+ export { useMessageContextStore, selectMessageContext, } from './messageContextStore';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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;AAC7E,OAAO,EACL,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,21 @@
1
+ interface MessageContextState {
2
+ readonly messageId: string | null;
3
+ readonly currentThinkingBlockId: string | null;
4
+ readonly lastThinkingContent: string;
5
+ readonly lastStatusLabel: string;
6
+ readonly accumulatedContent: string;
7
+ readonly blockCount: number;
8
+ }
9
+ interface MessageContextActions {
10
+ readonly initContext: (messageId: string) => void;
11
+ readonly updateThinkingBlock: (blockId: string | null, content: string) => void;
12
+ readonly updateStatusLabel: (label: string) => void;
13
+ readonly updateAccumulatedContent: (content: string) => void;
14
+ readonly incrementBlockCount: () => void;
15
+ readonly reset: () => void;
16
+ }
17
+ type MessageContextStore = MessageContextState & MessageContextActions;
18
+ export declare const useMessageContextStore: import('zustand').UseBoundStore<import('zustand').StoreApi<MessageContextStore>>;
19
+ export declare const selectMessageContext: (state: MessageContextStore) => MessageContextState;
20
+ export {};
21
+ //# sourceMappingURL=messageContextStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messageContextStore.d.ts","sourceRoot":"","sources":["../../src/store/messageContextStore.ts"],"names":[],"mappings":"AAUA,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,mBAAmB,EAAE,CAC5B,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,OAAO,EAAE,MAAM,KACZ,IAAI,CAAC;IACV,QAAQ,CAAC,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,QAAQ,CAAC,wBAAwB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,QAAQ,CAAC,mBAAmB,EAAE,MAAM,IAAI,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,KAAK,mBAAmB,GAAG,mBAAmB,GAAG,qBAAqB,CAAC;AAWvE,eAAO,MAAM,sBAAsB,kFAiBhC,CAAC;AAEJ,eAAO,MAAM,oBAAoB,GAC/B,OAAO,mBAAmB,KACzB,mBAOD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const ensureSidecarStyles: () => void;
2
+ //# sourceMappingURL=ensureSidecarStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureSidecarStyles.d.ts","sourceRoot":"","sources":["../../src/styles/ensureSidecarStyles.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,mBAAmB,YAc/B,CAAC"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=test-setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../src/test-setup.ts"],"names":[],"mappings":""}
@@ -0,0 +1,80 @@
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
+ readonly EXECUTION_COMPLETE: "EXECUTION_COMPLETE";
15
+ };
16
+ export type EventTypeValue = (typeof EventType)[keyof typeof EventType];
17
+ export declare const EventStatus: {
18
+ readonly IN_PROGRESS: "IN_PROGRESS";
19
+ readonly COMPLETED: "COMPLETED";
20
+ readonly ERROR: "ERROR";
21
+ };
22
+ export type EventStatusValue = (typeof EventStatus)[keyof typeof EventStatus];
23
+ export declare const ResultType: {
24
+ readonly TOOL_INVOKE: "TOOL_INVOKE";
25
+ };
26
+ export type ResultTypeValue = (typeof ResultType)[keyof typeof ResultType];
27
+ export interface AgentEvent {
28
+ readonly conversationId: string;
29
+ readonly type: EventTypeValue;
30
+ readonly status: EventStatusValue;
31
+ readonly content?: string;
32
+ readonly toolName?: string;
33
+ readonly toolArguments?: string;
34
+ readonly toolResult?: string;
35
+ }
36
+ export interface ToolInvokeResult {
37
+ readonly type: typeof ResultType.TOOL_INVOKE;
38
+ readonly toolName: string;
39
+ readonly toolArguments: Record<string, unknown>;
40
+ }
41
+ export type AgentResult = ToolInvokeResult;
42
+ export type ToolHandler = (args: Record<string, unknown>, onError: (toolName: string, error: Error) => void) => Promise<unknown>;
43
+ export interface FrontendTool {
44
+ readonly name: string;
45
+ readonly description: string;
46
+ readonly parametersSchema: string;
47
+ readonly handler?: ToolHandler;
48
+ }
49
+ export interface SendMessagePayload {
50
+ readonly conversationId: string;
51
+ readonly messageId: string;
52
+ readonly content: string;
53
+ readonly frontendTools: ReadonlyArray<FrontendTool>;
54
+ }
55
+ export interface ToolResultPayload {
56
+ readonly conversationId: string;
57
+ readonly type: 'TOOL_RESULT';
58
+ readonly toolName: string;
59
+ readonly toolResult: string;
60
+ readonly contentType: 'TEXT' | 'BPMN';
61
+ }
62
+ export interface AgentTransport {
63
+ subscribe(conversationId: string, onEvent: (event: AgentEvent) => void): void;
64
+ unsubscribe(conversationId: string): void;
65
+ sendMessage(payload: SendMessagePayload): Promise<void>;
66
+ sendToolResult(payload: ToolResultPayload): Promise<void>;
67
+ }
68
+ export interface AgentAdapterConfig {
69
+ readonly transport: AgentTransport;
70
+ readonly frontendTools?: ReadonlyArray<FrontendTool>;
71
+ readonly onToolInvoke?: (toolName: string, args: Record<string, unknown>) => Promise<unknown>;
72
+ readonly getStatusLabel?: (eventType: EventTypeValue, toolName?: string) => string;
73
+ }
74
+ export interface AgentAdapterReturn {
75
+ readonly sendMessage: (content: string) => Promise<void>;
76
+ readonly stopGeneration: () => void;
77
+ readonly resetConversation: () => void;
78
+ readonly isBusy: boolean;
79
+ }
80
+ //# 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,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Q,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACrD,QAAQ,CAAC,YAAY,CAAC,EAAE,CACtB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1B,OAAO,CAAC,OAAO,CAAC,CAAC;IACtB,QAAQ,CAAC,cAAc,CAAC,EAAE,CACxB,SAAS,EAAE,cAAc,EACzB,QAAQ,CAAC,EAAE,MAAM,KACd,MAAM,CAAC;CACb;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,QAAQ,CAAC,cAAc,EAAE,MAAM,IAAI,CAAC;IACpC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,IAAI,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B"}
@@ -0,0 +1,30 @@
1
+ export type MessageRole = 'user' | 'assistant';
2
+ export type MessageStatus = 'pending' | 'streaming' | 'complete' | 'error';
3
+ export interface ThinkingBlock {
4
+ readonly id: string;
5
+ readonly content: string;
6
+ readonly label: string;
7
+ readonly isComplete: boolean;
8
+ }
9
+ export interface ChatMessage {
10
+ readonly id: string;
11
+ readonly role: MessageRole;
12
+ readonly content: string;
13
+ readonly status: MessageStatus;
14
+ readonly timestamp?: number;
15
+ readonly statusLabel?: string;
16
+ readonly thinkingBlocks?: readonly ThinkingBlock[];
17
+ }
18
+ export interface StreamChunk {
19
+ readonly type: 'chunk';
20
+ readonly content: string;
21
+ readonly itemId: string;
22
+ readonly responseId: string;
23
+ }
24
+ export interface StreamFinal {
25
+ readonly type: 'final';
26
+ readonly content: string;
27
+ readonly responseId: string;
28
+ }
29
+ export type StreamEvent = StreamChunk | StreamFinal;
30
+ //# sourceMappingURL=chatTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatTypes.d.ts","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
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAQA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { AgentEvent, EventTypeValue } from '../types/agentTypes';
2
+ export interface ThinkingBlockAction {
3
+ readonly type: 'ADD_BLOCK' | 'APPEND_BLOCK' | 'COMPLETE_BLOCK' | 'COMPLETE_ALL';
4
+ readonly messageId: string;
5
+ readonly blockId: string;
6
+ readonly label: string;
7
+ readonly content: string;
8
+ }
9
+ export interface EventResult {
10
+ readonly statusLabel?: string;
11
+ readonly thinkingAction?: ThinkingBlockAction;
12
+ readonly finalContent?: string;
13
+ readonly error?: string;
14
+ }
15
+ export declare const formatToolResult: (toolName: string, result: unknown) => {
16
+ contentType: "TEXT" | "BPMN";
17
+ resultString: string;
18
+ };
19
+ export declare const generateBlockId: () => string;
20
+ export declare const computeThinkingDelta: (newContent: string, lastContent: string) => string;
21
+ export declare const deriveStatusLabel: (event: AgentEvent, getStatusLabel: (type: EventTypeValue, toolName?: string) => string) => string | undefined;
22
+ export declare const deriveThinkingAction: (event: AgentEvent, messageId: string, currentBlockId: string | null, lastContent: string, statusLabel: string, blockCount: number) => {
23
+ action?: ThinkingBlockAction;
24
+ newBlockId: string | null;
25
+ newContent: string;
26
+ };
27
+ export declare const processAgentEvent: (event: AgentEvent, messageId: string | null, currentBlockId: string | null, lastThinkingContent: string, lastStatusLabel: string, blockCount: number, accumulatedContent: string, getStatusLabel: (type: EventTypeValue, toolName?: string) => string) => EventResult & {
28
+ newBlockId: string | null;
29
+ newThinkingContent: string;
30
+ newAccumulatedContent: string;
31
+ newBlockCount: number;
32
+ };
33
+ //# sourceMappingURL=eventHandlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventHandlers.d.ts","sourceRoot":"","sources":["../../src/utils/eventHandlers.ts"],"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B,CAAC;IAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CA+BpB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,OAAO,UAAU,EACjB,WAAW,MAAM,GAAG,IAAI,EACxB,gBAAgB,MAAM,GAAG,IAAI,EAC7B,qBAAqB,MAAM,EAC3B,iBAAiB,MAAM,EACvB,YAAY,MAAM,EAClB,oBAAoB,MAAM,EAC1B,gBAAgB,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,KAClE,WAAW,GAAG;IACf,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;CAqHvB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { getDefaultStatusLabel } from './statusLabels';
2
+ export { processAgentEvent, formatToolResult, type ThinkingBlockAction, type EventResult, } from './eventHandlers';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACjB,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { EventTypeValue } from '../types';
2
+ export declare const getDefaultStatusLabel: (eventType: EventTypeValue, toolName?: string) => string;
3
+ //# sourceMappingURL=statusLabels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statusLabels.d.ts","sourceRoot":"","sources":["../../src/utils/statusLabels.ts"],"names":[],"mappings":"AAQA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAiB1D,eAAO,MAAM,qBAAqB,GAChC,WAAW,cAAc,EACzB,WAAW,MAAM,KAChB,MAMF,CAAC"}
package/license.header ADDED
@@ -0,0 +1,7 @@
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under
3
+ * one or more contributor license agreements. See the NOTICE file distributed
4
+ * with this work for additional information regarding copyright ownership.
5
+ * Licensed under the Camunda License 1.0. You may not use this file
6
+ * except in compliance with the Camunda License 1.0.
7
+ */
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@camunda/copilot-chat",
3
+ "version": "0.0.0-alpha10",
4
+ "description": "Camunda Copilot Client Library - React components and utilities for Camunda Platform 8",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "style": "./dist/index.css",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./style.css": {
17
+ "import": "./dist/index.css",
18
+ "default": "./dist/index.css"
19
+ },
20
+ "./package.json": "./package.json"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "README.md",
25
+ "LICENSE"
26
+ ],
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/camunda/camunda-copilot-client.git",
33
+ "directory": "packages/copilot-chat"
34
+ },
35
+ "keywords": [
36
+ "camunda",
37
+ "copilot",
38
+ "react",
39
+ "typescript",
40
+ "camunda-platform-8",
41
+ "workflow",
42
+ "automation"
43
+ ],
44
+ "author": "Camunda Services GmbH",
45
+ "license": "LicenseRef-Camunda-1.0",
46
+ "engines": {
47
+ "node": ">=18.0.0",
48
+ "npm": ">=9.0.0"
49
+ },
50
+ "dependencies": {
51
+ "zustand": "^5.0.2"
52
+ },
53
+ "devDependencies": {
54
+ "@camunda/copilot-components": "file:../copilot-components"
55
+ },
56
+ "peerDependencies": {
57
+ "@carbon/react": "^1.92.0",
58
+ "react": ">=18.0.0 <20.0.0",
59
+ "react-dom": ">=18.0.0 <20.0.0"
60
+ }
61
+ }