@object-ui/plugin-chatbot 17.2.0 → 17.5.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/CHANGELOG.md +323 -0
- package/README.md +81 -12
- package/dist/chatMessageAdapter.d.ts +134 -0
- package/dist/chatMessageAdapter.d.ts.map +1 -0
- package/dist/index.d.ts +53 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +614 -571
- package/dist/index.umd.cjs +2 -2
- package/dist/tool-display.d.ts +30 -1
- package/dist/tool-display.d.ts.map +1 -1
- package/dist/useHitlInChat.d.ts +19 -1
- package/dist/useHitlInChat.d.ts.map +1 -1
- package/dist/useObjectChat.d.ts +55 -4
- package/dist/useObjectChat.d.ts.map +1 -1
- package/dist/usePendingActions.d.ts +39 -17
- package/dist/usePendingActions.d.ts.map +1 -1
- package/package.json +18 -18
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChatMessage } from './ChatbotEnhanced';
|
|
1
2
|
/**
|
|
2
3
|
* ObjectUI
|
|
3
4
|
* Copyright (c) 2024-present ObjectStack Inc.
|
|
@@ -6,14 +7,6 @@
|
|
|
6
7
|
* LICENSE file in the root directory of this source tree.
|
|
7
8
|
*/
|
|
8
9
|
import * as React from "react";
|
|
9
|
-
export interface ChatMessage {
|
|
10
|
-
id: string;
|
|
11
|
-
role: "user" | "assistant" | "system";
|
|
12
|
-
content: string;
|
|
13
|
-
timestamp?: string;
|
|
14
|
-
avatar?: string;
|
|
15
|
-
avatarFallback?: string;
|
|
16
|
-
}
|
|
17
10
|
export interface ChatbotProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
18
11
|
messages?: ChatMessage[];
|
|
19
12
|
placeholder?: string;
|
|
@@ -43,6 +36,14 @@ declare const TypingIndicator: React.ForwardRefExoticComponent<TypingIndicatorPr
|
|
|
43
36
|
export { Chatbot, TypingIndicator };
|
|
44
37
|
export { useObjectChat } from './useObjectChat';
|
|
45
38
|
export type { UseObjectChatOptions, UseObjectChatReturn } from './useObjectChat';
|
|
39
|
+
/**
|
|
40
|
+
* What `useObjectChat` emits from `messages` and `onSend` — neither the
|
|
41
|
+
* `@object-ui/types` AUTHORING contract (which the hook used to declare while
|
|
42
|
+
* API mode cast RUNTIME values into it) nor the runtime one (which would be a
|
|
43
|
+
* lie about local mode's authored `'tool'` role and legacy tool states). See
|
|
44
|
+
* the type's own doc for the survey that decided it (objectui#4424).
|
|
45
|
+
*/
|
|
46
|
+
export type { ObjectChatMessage } from './useObjectChat';
|
|
46
47
|
export { AI_USAGE_REFRESH_EVENT, emitAiUsageRefresh } from './useObjectChat';
|
|
47
48
|
export { useAgents, resolveDefaultAgentName, PLATFORM_DEFAULT_AGENT, agentHasCapability } from './useAgents';
|
|
48
49
|
export type { UseAgentsOptions, UseAgentsReturn, AgentDescriptor, AgentCapabilities, } from './useAgents';
|
|
@@ -59,10 +60,53 @@ export { FloatingChatbotPanel } from './FloatingChatbotPanel';
|
|
|
59
60
|
export type { FloatingChatbotPanelProps } from './FloatingChatbotPanel';
|
|
60
61
|
export * from './renderer';
|
|
61
62
|
export { ChatbotEnhanced, publishHealthFromResponse } from './ChatbotEnhanced';
|
|
62
|
-
export type { ChatbotEnhancedProps,
|
|
63
|
+
export type { ChatbotEnhancedProps, ChatToolInvocation as ChatbotEnhancedToolInvocation, ChatSource as ChatbotEnhancedSource, ChatbotLabels, ToolDecisionState, PublishHealth, PublishOutcome, } from './ChatbotEnhanced';
|
|
64
|
+
/**
|
|
65
|
+
* The chat message contract of `@object-ui/plugin-chatbot` — the shape
|
|
66
|
+
* `<ChatbotEnhanced>` renders and `uiMessagesToChatMessages()` produces.
|
|
67
|
+
*
|
|
68
|
+
* This barrel used to DECLARE a second, minimal `ChatMessage` of its own
|
|
69
|
+
* (`id`/`role`/`content`/`timestamp`/`avatar`/`avatarFallback` only) while the
|
|
70
|
+
* enhanced shape was re-exported from the same module under the alias
|
|
71
|
+
* `ChatbotEnhancedMessage`. One natural name, two contracts: an importer who
|
|
72
|
+
* reached for `ChatMessage` silently got the narrow one, and the mismatch
|
|
73
|
+
* compiled because every construction site spreads the extra keys
|
|
74
|
+
* conditionally (`...(x ? { toolInvocations } : {})`), which defeats
|
|
75
|
+
* excess-property checking — so the declared type was narrower than every
|
|
76
|
+
* value flowing through it (objectui#4040; corrected for app-shell's
|
|
77
|
+
* `AiChatPage` in PR #4379, but the barrel itself was left as-is).
|
|
78
|
+
*
|
|
79
|
+
* The minimal declaration is retired rather than renamed: nothing produced it,
|
|
80
|
+
* no importer asked for it, and every field it had is present with the same
|
|
81
|
+
* type on the enhanced shape, which adds only OPTIONAL keys on top. So
|
|
82
|
+
* `ChatMessage` now denotes one contract everywhere in this package
|
|
83
|
+
* (objectui#4383). Pinned at compile time in
|
|
84
|
+
* `__tests__/chat-message-contract.test.ts`.
|
|
85
|
+
*
|
|
86
|
+
* `<Chatbot>` renders only the core fields; the enhanced surface (tool calls,
|
|
87
|
+
* reasoning, sources, build progress, charts) is `<ChatbotEnhanced>`.
|
|
88
|
+
*/
|
|
89
|
+
export type { ChatMessage } from './ChatbotEnhanced';
|
|
90
|
+
/**
|
|
91
|
+
* @deprecated Use `ChatMessage`. This alias now denotes the SAME type — it is
|
|
92
|
+
* kept only so importers that spelled the disambiguating name while the barrel
|
|
93
|
+
* still carried two shapes (e.g. app-shell's `AiChatPage`, PR #4379) keep
|
|
94
|
+
* compiling. New code should import `ChatMessage` (objectui#4383).
|
|
95
|
+
*/
|
|
96
|
+
export type { ChatMessage as ChatbotEnhancedMessage } from './ChatbotEnhanced';
|
|
63
97
|
export * as AIElements from './elements';
|
|
64
98
|
export { uiMessageToChatMessage, uiMessagesToChatMessages, detectDraftResult, detectProposedPlan, detectBuilderHandoff, detectProposedChanges, buildProgressFromDraftReview, } from './mapMessages';
|
|
65
99
|
export type { DraftReview, ProposedPlan, BuilderHandoff, ProposedChanges } from './mapMessages';
|
|
100
|
+
export { authoredToRuntimeMessage, toRuntimeMessages, toRuntimeRole, toRuntimeTimestamp, toRuntimeToolInvocation, toRuntimeToolState, } from './chatMessageAdapter';
|
|
101
|
+
/**
|
|
102
|
+
* The seam's INPUT contract: the authoring shape widened by the render-only
|
|
103
|
+
* keys an API-mode value already carries. A host converting its own messages
|
|
104
|
+
* with `toRuntimeMessages` never needs to name this — `ChatMessage` from
|
|
105
|
+
* `@object-ui/types` is assignable to it — but a host that HOLDS such values
|
|
106
|
+
* (having driven `useChat` itself, say) can now say so instead of casting
|
|
107
|
+
* (objectui#4424).
|
|
108
|
+
*/
|
|
109
|
+
export type { SeamChatMessage, SeamToolInvocation } from './chatMessageAdapter';
|
|
66
110
|
export { humanizeToolName, unwrapToolResult, summarizeChatError, } from './tool-display';
|
|
67
111
|
export { usePendingActions } from './usePendingActions';
|
|
68
112
|
export type { UsePendingActionsOptions, UsePendingActionsReturn, PendingActionRow, PendingActionStatus, ApproveOutcome, RejectOutcome, } from './usePendingActions';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAGpD,MAAM,WAAW,YAAa,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACxE,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,aAA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