@itechchoice/prime-chatkit 0.1.0-alpha.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.
Files changed (45) hide show
  1. package/dist/index.js +10017 -0
  2. package/dist/style.css +1 -0
  3. package/dist/types/adapters/bff/client.d.ts +189 -0
  4. package/dist/types/adapters/bff/controller.d.ts +70 -0
  5. package/dist/types/components/ui/agent-trail-clean.d.ts +63 -0
  6. package/dist/types/components/ui/ai-answer-clean.d.ts +76 -0
  7. package/dist/types/components/ui/approval-card-clean.d.ts +54 -0
  8. package/dist/types/components/ui/button-clean.d.ts +13 -0
  9. package/dist/types/components/ui/chat-composer-clean.d.ts +115 -0
  10. package/dist/types/components/ui/collaboration-stream-clean.d.ts +98 -0
  11. package/dist/types/components/ui/command-menu-clean.d.ts +57 -0
  12. package/dist/types/components/ui/decision-card-clean.d.ts +87 -0
  13. package/dist/types/components/ui/dropzone-clean.d.ts +70 -0
  14. package/dist/types/components/ui/tool-call-card-clean.d.ts +76 -0
  15. package/dist/types/core/history.d.ts +3 -0
  16. package/dist/types/core/run.d.ts +34 -0
  17. package/dist/types/core/scope.d.ts +16 -0
  18. package/dist/types/core/sse.d.ts +12 -0
  19. package/dist/types/core/suspension.d.ts +83 -0
  20. package/dist/types/core/tools.d.ts +15 -0
  21. package/dist/types/core/types.d.ts +152 -0
  22. package/dist/types/index.d.ts +6 -0
  23. package/dist/types/layout/DockShell.d.ts +19 -0
  24. package/dist/types/layout/constants.d.ts +22 -0
  25. package/dist/types/layout/index.d.ts +3 -0
  26. package/dist/types/layout/useLayout.d.ts +52 -0
  27. package/dist/types/provider/PrimeViaChat.d.ts +2 -0
  28. package/dist/types/provider/PrimeViaChatProvider.d.ts +2 -0
  29. package/dist/types/provider/PrimeViaChatShell.d.ts +5 -0
  30. package/dist/types/provider/config.d.ts +92 -0
  31. package/dist/types/provider/context.d.ts +53 -0
  32. package/dist/types/provider/hooks.d.ts +82 -0
  33. package/dist/types/ui/HistoryPanel.d.ts +11 -0
  34. package/dist/types/ui/blocks/BlocksPanel.d.ts +70 -0
  35. package/dist/types/ui/blocks/Process.d.ts +7 -0
  36. package/dist/types/ui/blocks/Questions.d.ts +25 -0
  37. package/dist/types/ui/blocks/SentAttachments.d.ts +11 -0
  38. package/dist/types/ui/blocks/useAttachmentDownload.d.ts +9 -0
  39. package/dist/types/ui/blocks/useAttachments.d.ts +15 -0
  40. package/dist/types/ui/blocks/useFollowLatest.d.ts +20 -0
  41. package/dist/types/ui/history.d.ts +10 -0
  42. package/dist/types/ui/i18n.d.ts +203 -0
  43. package/dist/types/ui/start-icons.d.ts +2 -0
  44. package/dist/types/ui/thread.d.ts +71 -0
  45. package/package.json +52 -0
@@ -0,0 +1,20 @@
1
+ export type OlderMessages = {
2
+ hasMore: boolean;
3
+ loading: boolean;
4
+ onLoad: () => void;
5
+ };
6
+ /** Layout glue: only follow while the reader remains at the bottom. */
7
+ export declare function useFollowLatest({ messages, older, active }: {
8
+ messages: readonly {
9
+ id: string;
10
+ }[];
11
+ older?: OlderMessages;
12
+ active?: boolean;
13
+ }): {
14
+ viewport: import("react").RefObject<HTMLDivElement | null>;
15
+ content: import("react").RefObject<HTMLDivElement | null>;
16
+ away: boolean;
17
+ onScroll: () => void;
18
+ jump: () => void;
19
+ loadOlder: () => void;
20
+ };
@@ -0,0 +1,10 @@
1
+ import type { SessionSummary } from "../adapters/bff/client";
2
+ import type { CommandGroup } from "../components/ui/command-menu-clean";
3
+ import type { HistoryCopy } from "./i18n";
4
+ /** Preserve server order within local-calendar groups; ids always stay strings. */
5
+ export declare function historyGroups(items: SessionSummary[], opts: {
6
+ now: number;
7
+ copy: HistoryCopy;
8
+ editingId?: string;
9
+ confirmingId?: string;
10
+ }): CommandGroup[];
@@ -0,0 +1,203 @@
1
+ import type { ChatComposerLabels } from "../components/ui/chat-composer-clean";
2
+ import type { ToolCallLabels } from "../components/ui/tool-call-card-clean";
3
+ /** Copy used only by the view-model → thread mapping. */
4
+ export type ThreadCopy = {
5
+ preparing: (tools?: number, mcpServers?: number) => string;
6
+ prepared: (tools?: number, mcpServers?: number) => string;
7
+ thinking: (iteration: number) => string;
8
+ toolFallback: (name: string) => string;
9
+ emptyAnswer: string;
10
+ failedAnswer: string;
11
+ };
12
+ export declare const zhThreadCopy: ThreadCopy;
13
+ export declare const enThreadCopy: ThreadCopy;
14
+ export declare const zhComposerLabels: ChatComposerLabels;
15
+ export declare const zhToolCallLabels: ToolCallLabels;
16
+ type ThreadLabels = {
17
+ composer?: Partial<ChatComposerLabels>;
18
+ toolCall?: Partial<ToolCallLabels>;
19
+ };
20
+ export declare const zhThreadLabels: {
21
+ composer: {
22
+ placeholder: string;
23
+ requestApproval: string;
24
+ requestApprovalDescription: string;
25
+ approveForMe: string;
26
+ approveForMeDescription: string;
27
+ fullAccess: string;
28
+ fullAccessDescription: string;
29
+ add: string;
30
+ files: string;
31
+ attachClaude: string;
32
+ workInFolder: string;
33
+ chooseFolder: string;
34
+ goal: string;
35
+ goalDescription: string;
36
+ planMode: string;
37
+ planOnDescription: string;
38
+ recordSkill: string;
39
+ draw: string;
40
+ drawDescription: string;
41
+ plugins: string;
42
+ documents: string;
43
+ documentsDescription: string;
44
+ pdf: string;
45
+ pdfDescription: string;
46
+ noFolder: string;
47
+ planOff: string;
48
+ planOn: string;
49
+ recording: string;
50
+ recordingAdded: string;
51
+ recordingDiscarded: string;
52
+ messageSent: string;
53
+ composer: string;
54
+ message: string;
55
+ voiceInput: string;
56
+ sendMessage: string;
57
+ discardRecording: string;
58
+ useRecording: string;
59
+ connectApps: string;
60
+ addToChat: string;
61
+ planOffDescription: string;
62
+ approvalQuestion: string;
63
+ learnMore: string;
64
+ selectModel: string;
65
+ apps: string;
66
+ workingIn: (folder: string) => string;
67
+ appConnection: (name: string | undefined, connected: boolean) => string;
68
+ selected: (name: string | undefined) => string;
69
+ connectedCount: (n: number) => string;
70
+ };
71
+ toolCall: {
72
+ failed: string;
73
+ error: string;
74
+ retry: string;
75
+ arguments: string;
76
+ result: string;
77
+ waiting: string;
78
+ empty: string;
79
+ showAll: string;
80
+ showLess: string;
81
+ copied: string;
82
+ copyArguments: string;
83
+ copyResult: string;
84
+ running: (name: string) => string;
85
+ finished: (name: string) => string;
86
+ failedAnnouncement: (name: string, error?: string) => string;
87
+ duration: (ms: number, live: boolean) => string;
88
+ usingTools: string;
89
+ usedTools: (n: number) => string;
90
+ failedTools: (n: number) => string;
91
+ groupAnnouncement: (count: string, failed: number) => string;
92
+ };
93
+ };
94
+ export declare function threadLabelsFor(locale?: string): {
95
+ labels: ThreadLabels;
96
+ copy: ThreadCopy;
97
+ locale: string;
98
+ };
99
+ export type PanelCopy = {
100
+ credits: (balance: number, locale: string) => string;
101
+ history: string;
102
+ newChat: string;
103
+ switchLayout: string;
104
+ close: string;
105
+ placeholder: string;
106
+ unavailable: string;
107
+ provisionTitle: string;
108
+ provisionAction: string;
109
+ };
110
+ export declare const zhPanelCopy: PanelCopy;
111
+ export declare const enPanelCopy: PanelCopy;
112
+ export declare function panelCopyFor(locale?: string): PanelCopy;
113
+ /** All interface copy for suspension decisions and controller errors. */
114
+ export type HitlCopy = {
115
+ approvalQuestion: (tool: string) => string;
116
+ approvalQuestionGeneric: string;
117
+ approvalTask: string;
118
+ factTool: string;
119
+ factCapability: string;
120
+ questionsTask: string;
121
+ skip: string;
122
+ errorText: (code: string, status?: number) => string;
123
+ };
124
+ export declare const zhHitlCopy: HitlCopy;
125
+ export declare const enHitlCopy: HitlCopy;
126
+ export declare function hitlCopyFor(locale?: string): HitlCopy;
127
+ /** Dock/split shell copy is independent of the panel dictionary. */
128
+ export type ShellCopy = {
129
+ resizeHandle: string;
130
+ resizeCorner: string;
131
+ restore: string;
132
+ restoreText: string;
133
+ };
134
+ export declare function shellCopyFor(locale?: string): ShellCopy;
135
+ type HistoryErrorCode = NonNullable<NonNullable<import("../adapters/bff/controller").ControllerState["sessions"]>["error"]>["code"];
136
+ export type HistoryCopy = {
137
+ today: string;
138
+ older: string;
139
+ untitled: string;
140
+ rename: string;
141
+ delete: string;
142
+ confirmDelete: string;
143
+ cancel: string;
144
+ search: string;
145
+ loading: string;
146
+ empty: string;
147
+ errorText: (code: HistoryErrorCode) => string;
148
+ };
149
+ export declare const zhHistoryCopy: HistoryCopy;
150
+ export declare const enHistoryCopy: HistoryCopy;
151
+ export declare function historyCopyFor(locale?: string): HistoryCopy;
152
+ export declare const zhHistoryLabels: import("../components/ui/command-menu-clean").CommandMenuLabels;
153
+ export declare function historyLabelsFor(locale?: string): Partial<import("../components/ui/command-menu-clean").CommandMenuLabels>;
154
+ /** Copy for the blocks panel and its library components. */
155
+ import { type AIAnswerLabels } from "../components/ui/ai-answer-clean";
156
+ import { type DropzoneLabels } from "../components/ui/dropzone-clean";
157
+ export type BlocksCopy = {
158
+ attachments: {
159
+ dropzone: DropzoneLabels;
160
+ collapse: string;
161
+ closePreview: string;
162
+ downloadFailed: string;
163
+ waitUploads: string;
164
+ fixUploads: string;
165
+ };
166
+ answer: Partial<AIAnswerLabels>;
167
+ latest: string;
168
+ loadOlder: string;
169
+ conversation: string;
170
+ pendingQuestion: string;
171
+ stop: string;
172
+ stopped: string;
173
+ retry: string;
174
+ approve: string;
175
+ decline: string;
176
+ approveAlways: string;
177
+ process: string;
178
+ steps: (n: number) => string;
179
+ runningSteps: (n: number) => string;
180
+ waiting: string;
181
+ arguments: string;
182
+ feedbackReasons: string[];
183
+ decision: import("../components/ui/decision-card-clean").DecisionCardLabels;
184
+ questions: {
185
+ yes: string;
186
+ no: string;
187
+ openLink: string;
188
+ waiting: string;
189
+ waitingApproval: (tool?: string) => string;
190
+ waitingFor: (who?: string) => string;
191
+ numberPlaceholder: string;
192
+ invalidNumber: string;
193
+ invalidInteger: string;
194
+ resubmit: string;
195
+ refill: string;
196
+ cancel: string;
197
+ };
198
+ trail: Omit<import("../components/ui/agent-trail-clean").AgentTrailLabels, "count" | "duration"> & Partial<import("../components/ui/agent-trail-clean").AgentTrailLabels>;
199
+ };
200
+ export declare const zhBlocksCopy: BlocksCopy;
201
+ export declare const enBlocksCopy: BlocksCopy;
202
+ export declare function blocksCopyFor(locale?: string): BlocksCopy;
203
+ export {};
@@ -0,0 +1,2 @@
1
+ import { type ReactElement } from "react";
2
+ export declare function startIcon(name?: string): ReactElement | undefined;
@@ -0,0 +1,71 @@
1
+ import type { ChatMessage } from "../core/types";
2
+ import type { ThreadCopy } from "./i18n";
3
+ /** View-model shapes shared by the mapping and the blocks panel. */
4
+ export type ThreadTool = {
5
+ id: string;
6
+ label: string;
7
+ name?: string;
8
+ args?: unknown;
9
+ result?: unknown;
10
+ error?: string;
11
+ status: "running" | "done" | "failed" | "stopped";
12
+ startedAt?: number;
13
+ ms?: number;
14
+ };
15
+ export type ThreadDecision = {
16
+ id: string;
17
+ question: string;
18
+ task: string;
19
+ kind?: "decision" | "pick" | "approval" | "question";
20
+ options?: {
21
+ id: string;
22
+ title: string;
23
+ summary?: string;
24
+ }[];
25
+ facts?: {
26
+ label: string;
27
+ value: string;
28
+ }[];
29
+ };
30
+ export type ThreadPart = {
31
+ kind: "text";
32
+ text: string;
33
+ } | {
34
+ kind: "tools";
35
+ id: string;
36
+ tools: ThreadTool[];
37
+ } | {
38
+ kind: "decision";
39
+ ask: ThreadDecision;
40
+ } | {
41
+ kind: "artifacts";
42
+ names: string[];
43
+ } | {
44
+ kind: "error";
45
+ text: string;
46
+ retry?: boolean;
47
+ };
48
+ export type ThreadAgentMessage = {
49
+ id: string;
50
+ role: "agent";
51
+ at: number;
52
+ parts: ThreadPart[];
53
+ streaming?: boolean;
54
+ stopped?: boolean;
55
+ };
56
+ export type ThreadMessage = ThreadAgentMessage | {
57
+ id: string;
58
+ role: "user";
59
+ text: string;
60
+ at: number;
61
+ attachments?: {
62
+ id: string;
63
+ name: string;
64
+ size: number;
65
+ kind: "image" | "file";
66
+ }[];
67
+ };
68
+ export declare function toThreadMessages(messages: ChatMessage[], copy: ThreadCopy, options?: {
69
+ processView?: "full" | "replies";
70
+ }): ThreadMessage[];
71
+ export declare function toDecisions(messages: ChatMessage[]): ThreadDecision[];
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@itechchoice/prime-chatkit",
3
+ "version": "0.1.0-alpha.0",
4
+ "description": "PrimeChatKit: React chat UI for products built on the prime-chatkit SDK BFF contract. Shows the agent's work: thinking, tool calls, approvals, sources and cost.",
5
+ "license": "UNLICENSED",
6
+ "publishConfig": {
7
+ "access": "restricted"
8
+ },
9
+ "type": "module",
10
+ "module": "./dist/index.js",
11
+ "types": "./dist/types/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/types/index.d.ts",
15
+ "import": "./dist/index.js"
16
+ },
17
+ "./style.css": "./dist/style.css"
18
+ },
19
+ "files": ["dist"],
20
+ "sideEffects": ["*.css"],
21
+ "scripts": {
22
+ "dev": "vite --config vite.demo.config.ts",
23
+ "build": "vite build && tsc -p tsconfig.build.json",
24
+ "typecheck": "node scripts/check-charter.mjs && tsc --noEmit",
25
+ "test": "vitest run && node --test scripts/check-charter.test.mjs scripts/check-workorder-assertions.test.mjs scripts/shell-hygiene.test.mjs"
26
+ },
27
+ "peerDependencies": {
28
+ "react": ">=19.0.0",
29
+ "react-dom": ">=19.0.0"
30
+ },
31
+ "dependencies": {
32
+ "@hugeicons/core-free-icons": "^4.4.0",
33
+ "@hugeicons/react": "^1.1.10",
34
+ "react-markdown": "^10.1.0",
35
+ "remark-cjk-friendly": "^2.3.4",
36
+ "remark-gfm": "^4.0.1"
37
+ },
38
+ "devDependencies": {
39
+ "@testing-library/react": "^16.3.3",
40
+ "@types/node": "^26.6.6",
41
+ "@types/react": "^19.3.0",
42
+ "@types/react-dom": "^19.3.0",
43
+ "@vitejs/plugin-react": "^5.2.0",
44
+ "jsdom": "^31.0.0",
45
+ "playwright": "1.63.0",
46
+ "react": "^19.2.5",
47
+ "react-dom": "^19.3.1",
48
+ "typescript": "~5.9.3",
49
+ "vite": "^7.3.7",
50
+ "vitest": "^4.1.12"
51
+ }
52
+ }