@inploi/plugin-kin 2.0.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/cdn/index.js +121 -0
- package/dist/code-block-37QAKDTI-b5c12d79.js +26 -0
- package/dist/code-block-37QAKDTI-ca6c9b98.cjs +2 -0
- package/dist/components/chat-panel.d.ts +8 -0
- package/dist/components/icons.d.ts +28 -0
- package/dist/components/launcher-input.d.ts +17 -0
- package/dist/components/markdown.d.ts +7 -0
- package/dist/components/messages.d.ts +1 -0
- package/dist/components/widget.d.ts +17 -0
- package/dist/index-ac748070.cjs +120 -0
- package/dist/index-e5dbdc11.js +26635 -0
- package/dist/index.cdn.d.ts +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.dev.d.ts +1 -0
- package/dist/kin.client.d.ts +59 -0
- package/dist/kin.d.ts +39 -0
- package/dist/kin.state.d.ts +58 -0
- package/dist/kin.theme.d.ts +39 -0
- package/dist/mermaid-4DMBBIKO-807d8577.js +5 -0
- package/dist/mermaid-4DMBBIKO-c9e92f22.cjs +1 -0
- package/dist/plugin-kin.cjs +1 -0
- package/dist/plugin-kin.js +6 -0
- package/package.json +48 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { kinPlugin, type Kin, type KinPlugin, type KinPluginParams, type KinTheme, BRAND_THEMES } from './kin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebSocket client for Kin agents service
|
|
3
|
+
*/
|
|
4
|
+
export type HistoryMessage = {
|
|
5
|
+
role: 'user' | 'assistant';
|
|
6
|
+
content: string;
|
|
7
|
+
};
|
|
8
|
+
export type KinMessage = {
|
|
9
|
+
type: 'user_message' | 'response_start' | 'response_chunk' | 'response_end' | 'error' | 'system' | 'authenticated' | 'data_cleared' | 'guardrail_block' | 'history' | 'upload_received' | 'file_processing' | 'file_processed';
|
|
10
|
+
content?: string;
|
|
11
|
+
company?: string;
|
|
12
|
+
environment?: string;
|
|
13
|
+
/** Message history sent on connect */
|
|
14
|
+
messages?: HistoryMessage[];
|
|
15
|
+
/** File upload fields */
|
|
16
|
+
fileName?: string;
|
|
17
|
+
status?: 'success' | 'error';
|
|
18
|
+
error?: string;
|
|
19
|
+
/** CV-specific fields (when fileType is 'cv') */
|
|
20
|
+
summary?: string;
|
|
21
|
+
skills?: string[];
|
|
22
|
+
};
|
|
23
|
+
/** Supported file types for upload */
|
|
24
|
+
export declare const SUPPORTED_FILE_TYPES: Record<string, {
|
|
25
|
+
maxSize: number;
|
|
26
|
+
}>;
|
|
27
|
+
export declare const FILE_ACCEPT_STRING = ".pdf,.docx,.doc,.txt,.jpg,.jpeg,.png,.webp";
|
|
28
|
+
export type FileValidationResult = {
|
|
29
|
+
valid: true;
|
|
30
|
+
} | {
|
|
31
|
+
valid: false;
|
|
32
|
+
error: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Validate a file before upload
|
|
36
|
+
*/
|
|
37
|
+
export declare function validateFile(file: File): FileValidationResult;
|
|
38
|
+
export type KinClientOptions = {
|
|
39
|
+
url: string;
|
|
40
|
+
onMessage: (message: KinMessage) => void;
|
|
41
|
+
onOpen: () => void;
|
|
42
|
+
onClose: () => void;
|
|
43
|
+
onError: (error: Event) => void;
|
|
44
|
+
};
|
|
45
|
+
export declare function createKinClient({ url, onMessage, onOpen, onClose, onError }: KinClientOptions): {
|
|
46
|
+
sendMessage: (content: string) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Upload a file to the server
|
|
49
|
+
* @param file - The file to upload
|
|
50
|
+
* @param fileType - The type/purpose of the file (e.g., 'cv')
|
|
51
|
+
*/
|
|
52
|
+
uploadFile: (file: File, fileType: string) => Promise<{
|
|
53
|
+
success: boolean;
|
|
54
|
+
error?: string;
|
|
55
|
+
}>;
|
|
56
|
+
clearData: () => void;
|
|
57
|
+
disconnect: () => void;
|
|
58
|
+
isConnected: () => boolean;
|
|
59
|
+
};
|
package/dist/kin.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { KinTheme } from './kin.theme';
|
|
2
|
+
|
|
3
|
+
export type { KinTheme } from './kin.theme';
|
|
4
|
+
export { BRAND_THEMES } from './kin.theme';
|
|
5
|
+
/** A starter prompt button shown in the empty state */
|
|
6
|
+
export type StarterPrompt = {
|
|
7
|
+
/** Text displayed on the button */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Message sent when clicked (can differ from label) */
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
12
|
+
export type KinPluginParams = {
|
|
13
|
+
/** URL of the Kin agents service (WebSocket endpoint) */
|
|
14
|
+
serviceUrl: string;
|
|
15
|
+
/** Publishable key for authentication */
|
|
16
|
+
publishableKey: string;
|
|
17
|
+
/** Theme configuration */
|
|
18
|
+
theme?: KinTheme;
|
|
19
|
+
/** Starter prompts shown in empty state to help users begin */
|
|
20
|
+
starterPrompts?: StarterPrompt[];
|
|
21
|
+
};
|
|
22
|
+
export type KinPlugin = typeof kinPlugin;
|
|
23
|
+
export type Kin = ReturnType<ReturnType<KinPlugin>>;
|
|
24
|
+
/**
|
|
25
|
+
* Creates the Kin plugin
|
|
26
|
+
*/
|
|
27
|
+
export declare const kinPlugin: ({ serviceUrl, publishableKey, theme, starterPrompts }: KinPluginParams) => ({ logger }: {
|
|
28
|
+
apiClient: import('@inploi/sdk').ApiClient;
|
|
29
|
+
rpcClient: import('@inploi/sdk').InploiRpcClient;
|
|
30
|
+
logger: import('@inploi/sdk').Logger;
|
|
31
|
+
analytics: import('@inploi/sdk').AnalyticsService;
|
|
32
|
+
}) => {
|
|
33
|
+
prepare: () => void;
|
|
34
|
+
open: () => void;
|
|
35
|
+
close: () => void;
|
|
36
|
+
toggle: () => void;
|
|
37
|
+
setTheme: (newTheme: KinTheme) => void;
|
|
38
|
+
destroy: () => void;
|
|
39
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export type Message = {
|
|
2
|
+
role: 'user' | 'assistant' | 'system';
|
|
3
|
+
content: string;
|
|
4
|
+
id: string;
|
|
5
|
+
timestamp: Date;
|
|
6
|
+
};
|
|
7
|
+
export type ConnectionState = 'idle' | 'connecting' | 'connected' | 'disconnected' | 'error';
|
|
8
|
+
export declare const isOpen: import('@preact/signals').Signal<boolean>;
|
|
9
|
+
export declare const isStreaming: import('@preact/signals').Signal<boolean>;
|
|
10
|
+
export declare const connectionState: import('@preact/signals').Signal<ConnectionState>;
|
|
11
|
+
export declare const hasUnreadMessages: import('@preact/signals').Signal<boolean>;
|
|
12
|
+
export type UploadState = 'idle' | 'uploading' | 'processing' | 'success' | 'error';
|
|
13
|
+
export declare const uploadState: import('@preact/signals').Signal<UploadState>;
|
|
14
|
+
export declare const uploadError: import('@preact/signals').Signal<string | null>;
|
|
15
|
+
export declare const uploadFileName: import('@preact/signals').Signal<string | null>;
|
|
16
|
+
export declare const messages: import('@preact/signals').Signal<Message[]>;
|
|
17
|
+
export declare const addMessage: (message: Omit<Message, "id" | "timestamp">) => void;
|
|
18
|
+
export declare const appendToLastMessage: (content: string) => void;
|
|
19
|
+
export declare const clearMessages: () => void;
|
|
20
|
+
/**
|
|
21
|
+
* Set messages from history (replaces current messages)
|
|
22
|
+
*/
|
|
23
|
+
export declare const setMessages: (newMessages: Array<{
|
|
24
|
+
role: "user" | "assistant";
|
|
25
|
+
content: string;
|
|
26
|
+
}>) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Broadcast current state to other tabs (call after streaming ends)
|
|
29
|
+
*/
|
|
30
|
+
export declare const syncToOtherTabs: () => void;
|
|
31
|
+
export declare const setUploadState: (state: UploadState, fileName?: string, error?: string) => void;
|
|
32
|
+
export declare const resetUploadState: () => void;
|
|
33
|
+
/** Mark as having unread messages (call when new message arrives while closed) */
|
|
34
|
+
export declare const setHasUnreadMessages: (hasUnread: boolean) => void;
|
|
35
|
+
/** Clear unread indicator (call when user opens the chat) */
|
|
36
|
+
export declare const clearUnreadMessages: () => void;
|
|
37
|
+
export declare const store: {
|
|
38
|
+
isOpen: import('@preact/signals').Signal<boolean>;
|
|
39
|
+
isStreaming: import('@preact/signals').Signal<boolean>;
|
|
40
|
+
connectionState: import('@preact/signals').Signal<ConnectionState>;
|
|
41
|
+
messages: import('@preact/signals').Signal<Message[]>;
|
|
42
|
+
uploadState: import('@preact/signals').Signal<UploadState>;
|
|
43
|
+
uploadError: import('@preact/signals').Signal<string | null>;
|
|
44
|
+
uploadFileName: import('@preact/signals').Signal<string | null>;
|
|
45
|
+
hasUnreadMessages: import('@preact/signals').Signal<boolean>;
|
|
46
|
+
addMessage: (message: Omit<Message, "id" | "timestamp">) => void;
|
|
47
|
+
appendToLastMessage: (content: string) => void;
|
|
48
|
+
clearMessages: () => void;
|
|
49
|
+
setMessages: (newMessages: Array<{
|
|
50
|
+
role: "user" | "assistant";
|
|
51
|
+
content: string;
|
|
52
|
+
}>) => void;
|
|
53
|
+
syncToOtherTabs: () => void;
|
|
54
|
+
setUploadState: (state: UploadState, fileName?: string, error?: string) => void;
|
|
55
|
+
resetUploadState: () => void;
|
|
56
|
+
setHasUnreadMessages: (hasUnread: boolean) => void;
|
|
57
|
+
clearUnreadMessages: () => void;
|
|
58
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type KinTheme = {
|
|
2
|
+
/** Primary accent color as HEX (e.g., "#FF4D00") */
|
|
3
|
+
accentColor: string;
|
|
4
|
+
/** Light or dark mode */
|
|
5
|
+
mode: 'light' | 'dark';
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Generates CSS custom properties for the theme
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateThemeCss(theme: KinTheme): string;
|
|
11
|
+
/**
|
|
12
|
+
* Default theme - Inploi Tangerine
|
|
13
|
+
*/
|
|
14
|
+
export declare const DEFAULT_THEME: KinTheme;
|
|
15
|
+
/**
|
|
16
|
+
* Preset brand themes with exact HEX colors
|
|
17
|
+
*/
|
|
18
|
+
export declare const BRAND_THEMES: {
|
|
19
|
+
/** Inploi - Tangerine orange, light mode */
|
|
20
|
+
readonly inploi: {
|
|
21
|
+
readonly accentColor: "#FF4D00";
|
|
22
|
+
readonly mode: "light";
|
|
23
|
+
};
|
|
24
|
+
/** Boots - Deep navy blue, light mode */
|
|
25
|
+
readonly boots: {
|
|
26
|
+
readonly accentColor: "#05054b";
|
|
27
|
+
readonly mode: "light";
|
|
28
|
+
};
|
|
29
|
+
/** Wagamama - Red/orange, dark mode */
|
|
30
|
+
readonly wagamama: {
|
|
31
|
+
readonly accentColor: "#df3228";
|
|
32
|
+
readonly mode: "dark";
|
|
33
|
+
};
|
|
34
|
+
/** Gail's - Red, light mode */
|
|
35
|
+
readonly gails: {
|
|
36
|
+
readonly accentColor: "#cf2030";
|
|
37
|
+
readonly mode: "light";
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-ac748070.cjs");require("@inploi/sdk");exports.Mermaid=e.tt;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-ac748070.cjs");require("@inploi/sdk");exports.BRAND_THEMES=e.BRAND_THEMES;exports.kinPlugin=e.kinPlugin;
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@inploi/plugin-kin",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Kin - A unified Talent Agent interface for hiring. One system, many roles.",
|
|
6
|
+
"main": "dist/plugin-kin.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"/dist",
|
|
10
|
+
"/cdn"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"require": "./dist/plugin-kin.cjs",
|
|
15
|
+
"import": "./dist/plugin-kin.js",
|
|
16
|
+
"types": "./dist/index.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./cdn": {
|
|
19
|
+
"import": "./cdn/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"@inploi/sdk": ">=1.16.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@preact/preset-vite": "2.5.0",
|
|
27
|
+
"@preact/signals": "1.2.2",
|
|
28
|
+
"@types/node": "^20.10.0",
|
|
29
|
+
"concurrently": "9.1.2",
|
|
30
|
+
"preact": "10.16.0",
|
|
31
|
+
"vite": "^4.4.5",
|
|
32
|
+
"vite-plugin-dts": "^3.7.0",
|
|
33
|
+
"vite-tsconfig-paths": "^4.2.1",
|
|
34
|
+
"@inploi/sdk": "1.16.0",
|
|
35
|
+
"tsconfig": "0.1.0"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"streamdown": "^2.1.0",
|
|
39
|
+
"@inploi/colors": "1.0.1"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"dev": "vite",
|
|
43
|
+
"build:cdn": "VITE_MOCKS=false vite build --mode=cdn",
|
|
44
|
+
"build:npm": "VITE_MOCKS=false vite build --mode=production",
|
|
45
|
+
"build": "concurrently 'pnpm build:npm' 'pnpm run build:cdn'",
|
|
46
|
+
"check": "tsc"
|
|
47
|
+
}
|
|
48
|
+
}
|