@tagit/ai-client-react 0.5.0 → 0.6.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/README.md +22 -1
- package/dist/provider.d.ts +6 -9
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js.map +1 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -78,6 +78,17 @@ import '@tagit/ai-client-react/chat-widget.css';
|
|
|
78
78
|
|
|
79
79
|
const client = new AIClient(
|
|
80
80
|
createDefaultConfig('your-use-case-id', 'https://your-orchestrator.example.com', {
|
|
81
|
+
user: {
|
|
82
|
+
entityId: 'anonymous-or-authenticated-user-id',
|
|
83
|
+
entityidType: 'internal_user_id',
|
|
84
|
+
entityidAlgo: 'native',
|
|
85
|
+
entityidOwner: 'your-service',
|
|
86
|
+
},
|
|
87
|
+
conversation: {
|
|
88
|
+
conversationId: 'optional-durable-conversation-id',
|
|
89
|
+
title: 'Optional conversation title',
|
|
90
|
+
memoryMaxTurns: 6,
|
|
91
|
+
},
|
|
81
92
|
collector: {
|
|
82
93
|
enabled: false,
|
|
83
94
|
},
|
|
@@ -296,6 +307,7 @@ The React package owns the widget shell, provider, hooks, and layout guidance. T
|
|
|
296
307
|
Use the core README for:
|
|
297
308
|
|
|
298
309
|
- `createDefaultConfig()`
|
|
310
|
+
- shared `user` and `conversation` config
|
|
299
311
|
- orchestrator config
|
|
300
312
|
- collector config
|
|
301
313
|
- UI config
|
|
@@ -330,10 +342,18 @@ The starter is not the distributable package.
|
|
|
330
342
|
Use this when you want the fastest possible install:
|
|
331
343
|
|
|
332
344
|
- create one `AIClient`
|
|
345
|
+
- provide `user.entityId` so V2 memory and collector events share the same user identity
|
|
346
|
+
- optionally provide `conversation.conversationId` when you want a durable conversation across reloads
|
|
333
347
|
- wrap the app with `AIClientProvider`
|
|
334
348
|
- render `<ChatWidget />`
|
|
335
349
|
- import `@tagit/ai-client-react/chat-widget.css`
|
|
336
350
|
|
|
351
|
+
### V2 Contract Notes
|
|
352
|
+
|
|
353
|
+
This beta client targets the orchestrator V2 contract only. The core client appends `/v2/chat`, sends the current user message, and lets the orchestrator rehydrate recent conversation memory from `conversation.conversationId` and `user.userId ?? user.entityId`.
|
|
354
|
+
|
|
355
|
+
Checkpoint controls are not part of the first React beta. Workflow metadata is still captured in client state and events, so host apps can inspect `workflowId`, `workflowStatus`, and `checkpointPrompt` if a workflow use case returns them.
|
|
356
|
+
|
|
337
357
|
### Viewport-Docked Sidebar
|
|
338
358
|
|
|
339
359
|
Use this when the chat should feel like a persistent product rail:
|
|
@@ -374,7 +394,8 @@ Use `useConversation()` when the host app wants to render its own shell and only
|
|
|
374
394
|
| Header/tab only, empty shell | stale package cache or old bundle | clear `node_modules/.vite`, restart dev server, confirm `children` is not being passed |
|
|
375
395
|
| No styling | CSS not imported | verify `@tagit/ai-client-react/chat-widget.css` import |
|
|
376
396
|
| Missing body after passing custom JSX | `children` overrides stock body | remove `children` to restore the stock widget |
|
|
377
|
-
| No messages sent | invalid orchestrator config | verify `orchestrator.baseUrl` and `useCaseId`, confirm `baseUrl` does not include `/
|
|
397
|
+
| No messages sent | invalid orchestrator config | verify `orchestrator.baseUrl` and `useCaseId`, confirm `baseUrl` does not include `/v2/chat` |
|
|
398
|
+
| V2 request is rejected for missing user | missing shared identity | set `user.entityId`; optionally set `user.userId` when it should differ from the entity id |
|
|
378
399
|
| Runtime import error | unsupported import path | use only documented public exports |
|
|
379
400
|
| Collector events do not appear | collector config incomplete or disabled | confirm `collector.enabled`, `collector.baseUrl`, and `collector.tagId` |
|
|
380
401
|
| Inline mode looks cramped | panel width too small | pass a wider `width` or switch to `dockMode="viewport"` with host-side reserved space |
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import type { AIClient, ClientEvent } from '@tagit/ai-client-core';
|
|
2
|
+
import type { AIClient, ClientEvent, SendMessageOptions } from '@tagit/ai-client-core';
|
|
3
3
|
interface AIClientProviderProps {
|
|
4
4
|
client: AIClient;
|
|
5
5
|
children: ReactNode;
|
|
@@ -16,15 +16,9 @@ export declare function useAIClient(): AIClient;
|
|
|
16
16
|
* Hook to access and subscribe to conversation state
|
|
17
17
|
*/
|
|
18
18
|
export declare function useConversation(): {
|
|
19
|
-
sendMessage: (message: string, options?:
|
|
20
|
-
tools?: "none" | "all" | string[];
|
|
21
|
-
useCaseMessage?: string;
|
|
22
|
-
}) => Promise<void>;
|
|
19
|
+
sendMessage: (message: string, options?: SendMessageOptions) => Promise<void>;
|
|
23
20
|
cancel: () => void;
|
|
24
|
-
retry: (options?:
|
|
25
|
-
tools?: "none" | "all" | string[];
|
|
26
|
-
useCaseMessage?: string;
|
|
27
|
-
}) => Promise<void>;
|
|
21
|
+
retry: (options?: SendMessageOptions) => Promise<void>;
|
|
28
22
|
clearHistory: () => void;
|
|
29
23
|
reEditMessage: (messageId: string) => string | null;
|
|
30
24
|
id: string;
|
|
@@ -34,6 +28,9 @@ export declare function useConversation(): {
|
|
|
34
28
|
error?: string;
|
|
35
29
|
lastError?: import("@tagit/ai-client-core").ClientErrorInfo;
|
|
36
30
|
useCaseId: string;
|
|
31
|
+
workflowId?: string;
|
|
32
|
+
workflowStatus?: string;
|
|
33
|
+
checkpointPrompt?: string;
|
|
37
34
|
};
|
|
38
35
|
/**
|
|
39
36
|
* Hook to listen for specific client events
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAgD,MAAM,OAAO,CAAC;AACvF,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAqB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAgD,MAA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CACzB,CAAC;IAEF,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,EAAE;QACpC,MAAM,CAAC,YAAY,EAAE,CAAC;QACtB,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC9B,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,MAAM,aAAa,GAAG,WAAW,CAAC,CAAC,SAAiB,EAAiB,EAAE;QACrE,MAAM,OAAO,GAAG,MAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QACpD,IAAI,OAAO,KAAK,IAAI;YAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QAClD,OAAO,OAAO,CAAC;IACjB,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO;QACL,GAAG,KAAK;QACR,WAAW;QACX,MAAM;QACN,KAAK;QACL,YAAY;QACZ,aAAa;KACd,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,QAAsC;IACpE,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;IAE7B,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tagit/ai-client-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Self-contained React chat widget and hooks for TagIt AI client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
10
|
+
"!dist/**/*.test.*",
|
|
10
11
|
"src/chat-widget.css"
|
|
11
12
|
],
|
|
12
13
|
"publishConfig": {
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
"recharts": "^3.8.1",
|
|
43
44
|
"rehype-highlight": "^7.0.2",
|
|
44
45
|
"remark-gfm": "^4.0.1",
|
|
45
|
-
"@tagit/ai-client-core": "0.
|
|
46
|
+
"@tagit/ai-client-core": "0.6.0"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
48
49
|
"react": "^18.0.0",
|
|
@@ -58,7 +59,8 @@
|
|
|
58
59
|
"node": ">=18"
|
|
59
60
|
},
|
|
60
61
|
"scripts": {
|
|
61
|
-
"
|
|
62
|
+
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
63
|
+
"build": "pnpm run clean && tsc",
|
|
62
64
|
"dev": "tsc --watch",
|
|
63
65
|
"test": "node ../../scripts/run-node-tests.mjs dist",
|
|
64
66
|
"typecheck": "tsc --noEmit"
|