@aintela/chat 0.5.0 → 0.5.2

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.
@@ -2,6 +2,7 @@ import { default as React } from 'react';
2
2
  import { InteractionPart } from '../../../../models/InteractionPart';
3
3
  import { Interaction } from '../../../../models/Interaction';
4
4
  import { FunctionDetails } from '../../../../models/ServerEvent';
5
+ import { ActivityStep, VerbosityActivity } from '../verbosity';
5
6
  export type PartKind = 'text' | 'thought' | 'function' | 'waiting' | 'suspended' | 'boxed' | 'serverError' | 'uiTool' | 'askUser' | 'askAuth';
6
7
  /**
7
8
  * What a part renderer is handed: the part, the message it belongs to, and its
@@ -15,7 +16,32 @@ export interface PartRendererProps {
15
16
  isLastInlineInGroup?: boolean;
16
17
  }
17
18
  export type PartRenderer = React.ComponentType<PartRendererProps>;
18
- export type PartRendererMap = Partial<Record<PartKind, PartRenderer>>;
19
+ /**
20
+ * What the `activity` renderer is handed under the `minimum` verbosity, while the live turn has something in
21
+ * progress — it is drawn at the end of the message, and not at all once nothing is (the answer streams, the turn
22
+ * closes):
23
+ * - `activity`: what the agent is doing NOW — the running calls, or the thought it is in.
24
+ * - `steps`: the turn's internals so far, in order ({@link ActivityStep}), each call with its phase
25
+ * (writing / calling / complete).
26
+ *
27
+ * While the line is up the renderer stays mounted (state such as a pacing queue survives), and the library does
28
+ * not animate a custom one — it owns its transitions. Friendly mode comes from {@link MessageScope}, as for the
29
+ * part renderers.
30
+ */
31
+ export interface ActivityRendererProps {
32
+ activity: VerbosityActivity;
33
+ steps: ActivityStep[];
34
+ message: Interaction;
35
+ }
36
+ export type ActivityRenderer = React.ComponentType<ActivityRendererProps>;
37
+ /**
38
+ * Per-kind renderer overrides (`<AiChat partRenderers={...} />`). `activity` is not a part kind — no single part
39
+ * classifies to it — but the slim line it draws stands in for the tool-call and thought parts under the `minimum`
40
+ * verbosity, so a host customizes it the same way, in the same map.
41
+ */
42
+ export type PartRendererMap = Partial<Record<PartKind, PartRenderer>> & {
43
+ activity?: ActivityRenderer;
44
+ };
19
45
  /**
20
46
  * Match the ask_user tool by function name across connectors. The programmed
21
47
  * path emits the bare `ask_user`; live LLM connectors qualify it as
@@ -0,0 +1,85 @@
1
+ import { InteractionPart } from '../../../models/InteractionPart';
2
+ /**
3
+ * How much of the agent's internals (reasoning and tool calls) the transcript shows (issue #1524).
4
+ *
5
+ * - `naked` — none of it, live or closed. The answer and the UI tools only.
6
+ * - `minimum` — while the turn is open, ONE italic line: the current reasoning highlight or the running
7
+ * tool(s). Nothing once the turn closes.
8
+ * - `information` — reasoning as in `detailed`; tool calls only while they run (a finished call disappears),
9
+ * the running ones side by side on one line.
10
+ * - `detailed` — everything, the behaviour before the setting existed.
11
+ *
12
+ * UI tools (`isUi`, ask-user) are content, not internals: every level shows them.
13
+ */
14
+ export type ChatVerbosity = 'naked' | 'minimum' | 'information' | 'detailed';
15
+ /** The levels in order, least to most — the menu's bar draws one step per entry. */
16
+ export declare const CHAT_VERBOSITY_LEVELS: readonly {
17
+ value: ChatVerbosity;
18
+ label: string;
19
+ description: string;
20
+ }[];
21
+ /** A tool call that is run internals — a function part that is NOT a UI tool (a cancelled UI render counts as one). */
22
+ export declare function isToolTracePart(p: InteractionPart): boolean;
23
+ /** The call has not returned yet. The runtime turns a finished call's part into a FunctionResponse marked Done. */
24
+ export declare function isRunningCall(p: InteractionPart): boolean;
25
+ /**
26
+ * The `information` level's held call: when the message ENDS in tool calls and none of them is running any more,
27
+ * the last one stays on screen until something else (the next call, a thought, the answer) arrives.
28
+ *
29
+ * Dropping a call the moment it returned left a gap before the next one started: the chip vanished and came
30
+ * back, and the reasoning above it briefly became the message's last group — so it turned live again (open,
31
+ * "Pensando…") and folded on the next call. The run looked like it was blinking. Holding the last call closes
32
+ * the gap: the slot under the reasoning is never empty while the agent is between two calls.
33
+ */
34
+ export declare function heldTraceCall(parts: InteractionPart[]): InteractionPart | undefined;
35
+ /**
36
+ * The verbosity's cut, before the host's other visibility rules. Returns `undefined` when the level has no
37
+ * opinion about the part (the existing rules decide), `false` to drop it. `held` is {@link heldTraceCall}'s
38
+ * answer for the same parts.
39
+ */
40
+ export declare function verbosityKeeps(p: InteractionPart, verbosity: ChatVerbosity, live: boolean, held?: InteractionPart): boolean | undefined;
41
+ /** What the `minimum` line says: the running tools, or the thought the agent is in. */
42
+ export type VerbosityActivity = {
43
+ kind: 'tools';
44
+ calls: InteractionPart[];
45
+ } | {
46
+ kind: 'thought';
47
+ headline?: string;
48
+ };
49
+ /**
50
+ * The current activity of a live turn, for the `minimum` line. Running tool calls win (they are what the agent
51
+ * waits on); a message that ends in finished calls keeps the last one ({@link heldTraceCall}) until something
52
+ * follows; otherwise the agent is thinking when the latest part is reasoning, and the line carries that thought's
53
+ * latest highlight. Anything else (the answer streaming) has no line. Pure.
54
+ */
55
+ export declare function currentActivity(parts: InteractionPart[]): VerbosityActivity | null;
56
+ /** The slot key of an activity: a new key is a new item, crossfaded; the same key re-renders in place. */
57
+ export declare function activityKey(activity: VerbosityActivity): string;
58
+ /** Where a tool call is: arguments streaming in, running, or returned. */
59
+ export type ActivityStepPhase = 'writing' | 'calling' | 'complete';
60
+ /**
61
+ * One step of a turn's run internals, in arrival order, as a host's `activity` renderer gets them. A tool call is
62
+ * ONE step whose `phase` moves on (writing → calling → complete); a thought is one step per run of reasoning,
63
+ * carrying that run's highlights. Labels are the host's: the step keeps the raw facts.
64
+ */
65
+ export type ActivityStep = {
66
+ id: string;
67
+ kind: 'thought';
68
+ headlines: string[];
69
+ startedAt: number;
70
+ endedAt?: number;
71
+ } | {
72
+ id: string;
73
+ kind: 'tool';
74
+ name: string;
75
+ phase: ActivityStepPhase;
76
+ startedAt: number;
77
+ endedAt?: number;
78
+ part: InteractionPart;
79
+ };
80
+ /**
81
+ * The turn's run internals as {@link ActivityStep}s, from the message's parts. Reasoning between two other parts is
82
+ * one thought step (the chunker's cuts do not count); a tool trace call is one tool step. UI tools are content and
83
+ * never steps. Pure.
84
+ */
85
+ export declare function activitySteps(parts: InteractionPart[]): ActivityStep[];
@@ -26,8 +26,10 @@ export { useParkedAskUser, ASK_USER_CANCELLED } from './AiChat/ChatPane/useParke
26
26
  export type { ParkedAskUser } from './AiChat/ChatPane/useParkedAskUser';
27
27
  export { configureFriendlyMapping, getFriendlyLabel } from './AiChat/ChatPane/friendlyToolConfig';
28
28
  export type { FriendlyState, FriendlyToolEntry } from './AiChat/ChatPane/friendlyToolConfig';
29
- export { classifyPart, DEFAULT_PART_RENDERERS, TextPart, ThoughtPart, FunctionPart, WaitingPart, SuspendedPart, BoxedPart, UiToolDispatcher, } from './AiChat/ChatPane/parts';
30
- export type { PartKind, PartRendererProps, PartRenderer, PartRendererMap, } from './AiChat/ChatPane/parts';
29
+ export { CHAT_VERBOSITY_LEVELS, activitySteps } from './AiChat/ChatPane/verbosity';
30
+ export type { ChatVerbosity, VerbosityActivity, ActivityStep, ActivityStepPhase } from './AiChat/ChatPane/verbosity';
31
+ export { classifyPart, DEFAULT_PART_RENDERERS, TextPart, ThoughtPart, FunctionPart, WaitingPart, SuspendedPart, BoxedPart, UiToolDispatcher, ActivityLine, DEFAULT_ACTIVITY_RENDERER, } from './AiChat/ChatPane/parts';
32
+ export type { PartKind, PartRendererProps, PartRenderer, PartRendererMap, ActivityRendererProps, ActivityRenderer, } from './AiChat/ChatPane/parts';
31
33
  export { createUiToolRegistry, parseUiArgs, parseClientOutput } from './AiChat/ChatPane/parts';
32
34
  export type { UiToolRegistry, UiToolRegistryBuilder, UiToolContext, UiToolActionContext, UiToolArgs, UiToolRenderFn, UiToolActionFn, UiToolRenderOptions, UiToolActionOptions, UiToolEntry, UiToolRenderEntry, UiToolActionEntry, UiToolAskUserRenderers, UiToolAskUserQuestionFn, UiToolAskUserResponseFn, UiToolAskUserEntry, } from './AiChat/ChatPane/parts';
33
35
  export { useContainerRectangle } from '../hooks/useContainerWidth';
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ import { ChatVerbosity } from '../AiChat/ChatPane/verbosity';
3
+ interface VerbositySliderProps {
4
+ value: ChatVerbosity;
5
+ onChange: (value: ChatVerbosity) => void;
6
+ }
7
+ /**
8
+ * The verbosity setting as a line with a draggable icon that snaps to the four levels, least (left) to most
9
+ * (right). Clicking a point on the line jumps there; arrow keys step (issue #1524).
10
+ */
11
+ export declare const VerbositySlider: React.FC<VerbositySliderProps>;
12
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aintela/chat",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"