@mgamadeus/ddd-agents 0.1.2 → 0.1.3
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 +31 -2
- package/dist/chat.js +284 -163
- package/dist/chat.js.map +1 -1
- package/dist/chunks/{contract-Z08LBOqt.js → contract-kmmw_19Y.js} +2 -2
- package/dist/chunks/{contract-Z08LBOqt.js.map → contract-kmmw_19Y.js.map} +1 -1
- package/dist/chunks/{conversation-BEF0aesf.js → conversation-CbWEHPbL.js} +12 -3
- package/dist/chunks/{conversation-BEF0aesf.js.map → conversation-CbWEHPbL.js.map} +1 -1
- package/dist/chunks/link-navigation-DyTApNeA.js.map +1 -1
- package/dist/chunks/{withPollingChangeSubscription-CNXgt3Ri.js → withPollingChangeSubscription-CWavoKjJ.js} +2 -2
- package/dist/chunks/{withPollingChangeSubscription-CNXgt3Ri.js.map → withPollingChangeSubscription-CWavoKjJ.js.map} +1 -1
- package/dist/client-testing.js +1 -1
- package/dist/client.js +45 -6
- package/dist/client.js.map +1 -1
- package/dist/contract.js +6 -5
- package/dist/files/i18n-keys.json +19 -0
- package/dist/styles.css +148 -15
- package/dist/types/chat/AgentChatActivityDots/AgentChatActivityDots.d.ts +11 -0
- package/dist/types/chat/AgentChatActivityIndicator/AgentChatActivityIndicator.d.ts +7 -2
- package/dist/types/chat/AgentChatActivityStack/AgentChatActivityStack.d.ts +15 -0
- package/dist/types/chat/controller/AgentChatController.d.ts +10 -0
- package/dist/types/chat/controller/activity-ticker.d.ts +5 -2
- package/dist/types/chat/controller/chat-activity-timing.d.ts +30 -0
- package/dist/types/chat/controller/use-activity-ticker.d.ts +6 -0
- package/dist/types/chat/controller/use-conversation-activity.d.ts +6 -2
- package/dist/types/client/http/agents-http-mappers.d.ts +9 -2
- package/dist/types/client/http/agents-http-wire.d.ts +13 -0
- package/dist/types/client/http/createAgentsHttpConversationClient.d.ts +9 -0
- package/dist/types/contract/conversation.d.ts +27 -0
- package/dist/types/entries/chat.d.ts +4 -1
- package/dist/types/provider/environment.d.ts +7 -0
- package/package.json +1 -1
- package/public-api.json +16 -0
package/dist/styles.css
CHANGED
|
@@ -5424,37 +5424,45 @@ thead + tbody .agents_row_VBlQR-:first-child {
|
|
|
5424
5424
|
max-width: 50rem;
|
|
5425
5425
|
padding-left: 1rem;
|
|
5426
5426
|
border-left: 2px solid var(--agents-divider-gl);
|
|
5427
|
-
}.
|
|
5428
|
-
display: flex;
|
|
5429
|
-
align-items: center;
|
|
5430
|
-
gap: 0.75rem;
|
|
5431
|
-
max-width: 50rem;
|
|
5432
|
-
min-height: 1.5rem;
|
|
5433
|
-
}
|
|
5434
|
-
|
|
5435
|
-
.agents_dots_Qvm8gN {
|
|
5427
|
+
}.agents_dots_ndE4a- {
|
|
5436
5428
|
display: flex;
|
|
5437
5429
|
align-items: center;
|
|
5438
5430
|
gap: 0.375rem;
|
|
5439
5431
|
}
|
|
5440
5432
|
|
|
5441
|
-
.
|
|
5433
|
+
.agents_dots_ndE4a- span {
|
|
5442
5434
|
width: 0.5rem;
|
|
5443
5435
|
height: 0.5rem;
|
|
5444
5436
|
border-radius: 50%;
|
|
5445
5437
|
background-color: var(--agents-fg-light);
|
|
5446
|
-
animation: agents_activityDotBounce_y55xme 500ms infinite ease-in-out;
|
|
5447
5438
|
}
|
|
5448
5439
|
|
|
5449
|
-
.
|
|
5440
|
+
.agents_bounce_rAVWhT span {
|
|
5441
|
+
animation: agents_activityDotBounce_yD-7nS 500ms infinite ease-in-out;
|
|
5442
|
+
}
|
|
5443
|
+
|
|
5444
|
+
.agents_bounce_rAVWhT span:nth-child(2) {
|
|
5450
5445
|
animation-delay: 75ms;
|
|
5451
5446
|
}
|
|
5452
5447
|
|
|
5453
|
-
.
|
|
5448
|
+
.agents_bounce_rAVWhT span:nth-child(3) {
|
|
5454
5449
|
animation-delay: 150ms;
|
|
5455
5450
|
}
|
|
5456
5451
|
|
|
5457
|
-
|
|
5452
|
+
.agents_pulse_r0EheQ span {
|
|
5453
|
+
opacity: 0.35;
|
|
5454
|
+
animation: agents_activityDotPulse_SbsA69 1400ms infinite ease-in-out;
|
|
5455
|
+
}
|
|
5456
|
+
|
|
5457
|
+
.agents_pulse_r0EheQ span:nth-child(2) {
|
|
5458
|
+
animation-delay: 280ms;
|
|
5459
|
+
}
|
|
5460
|
+
|
|
5461
|
+
.agents_pulse_r0EheQ span:nth-child(3) {
|
|
5462
|
+
animation-delay: 560ms;
|
|
5463
|
+
}
|
|
5464
|
+
|
|
5465
|
+
@keyframes agents_activityDotBounce_yD-7nS {
|
|
5458
5466
|
0%, 80%, 100% {
|
|
5459
5467
|
transform: translateY(0);
|
|
5460
5468
|
opacity: 0.5;
|
|
@@ -5464,10 +5472,27 @@ thead + tbody .agents_row_VBlQR-:first-child {
|
|
|
5464
5472
|
opacity: 1;
|
|
5465
5473
|
}
|
|
5466
5474
|
}
|
|
5475
|
+
@keyframes agents_activityDotPulse_SbsA69 {
|
|
5476
|
+
0%, 70%, 100% {
|
|
5477
|
+
transform: scale(0.85);
|
|
5478
|
+
opacity: 0.35;
|
|
5479
|
+
}
|
|
5480
|
+
35% {
|
|
5481
|
+
transform: scale(1);
|
|
5482
|
+
opacity: 0.9;
|
|
5483
|
+
}
|
|
5484
|
+
}
|
|
5467
5485
|
@media (prefers-reduced-motion: reduce) {
|
|
5468
|
-
.
|
|
5486
|
+
.agents_dots_ndE4a- span {
|
|
5469
5487
|
animation: none;
|
|
5488
|
+
opacity: 0.6;
|
|
5470
5489
|
}
|
|
5490
|
+
}.agents_activity_Gv-0ee {
|
|
5491
|
+
display: flex;
|
|
5492
|
+
align-items: center;
|
|
5493
|
+
gap: 0.75rem;
|
|
5494
|
+
max-width: 50rem;
|
|
5495
|
+
min-height: 1.5rem;
|
|
5471
5496
|
}.agents_bar_DAkgRp {
|
|
5472
5497
|
display: flex;
|
|
5473
5498
|
align-items: center;
|
|
@@ -6740,6 +6765,114 @@ thead + tbody .agents_row_VBlQR-:first-child {
|
|
|
6740
6765
|
display: flex;
|
|
6741
6766
|
flex-direction: column;
|
|
6742
6767
|
overflow: hidden;
|
|
6768
|
+
}.agents_stack_qYED72 {
|
|
6769
|
+
position: relative;
|
|
6770
|
+
max-width: 50rem;
|
|
6771
|
+
min-height: 1.5rem;
|
|
6772
|
+
}
|
|
6773
|
+
|
|
6774
|
+
.agents_visual_44ItL8 {
|
|
6775
|
+
position: relative;
|
|
6776
|
+
}
|
|
6777
|
+
|
|
6778
|
+
.agents_waiting_jFvZ9- {
|
|
6779
|
+
display: flex;
|
|
6780
|
+
align-items: center;
|
|
6781
|
+
gap: 0.75rem;
|
|
6782
|
+
min-height: 1.5rem;
|
|
6783
|
+
}
|
|
6784
|
+
|
|
6785
|
+
.agents_lines_cZJ4if {
|
|
6786
|
+
position: relative;
|
|
6787
|
+
height: 6rem;
|
|
6788
|
+
margin: 0;
|
|
6789
|
+
padding: 0;
|
|
6790
|
+
list-style: none;
|
|
6791
|
+
overflow: hidden;
|
|
6792
|
+
mask-image: linear-gradient(to bottom, transparent 0, black 55%);
|
|
6793
|
+
-webkit-mask-image: linear-gradient(to bottom, transparent 0, black 55%);
|
|
6794
|
+
}
|
|
6795
|
+
|
|
6796
|
+
.agents_line_kzizwA {
|
|
6797
|
+
position: absolute;
|
|
6798
|
+
right: 0;
|
|
6799
|
+
bottom: 0;
|
|
6800
|
+
left: 0;
|
|
6801
|
+
height: 1.5rem;
|
|
6802
|
+
display: flex;
|
|
6803
|
+
align-items: center;
|
|
6804
|
+
overflow: hidden;
|
|
6805
|
+
white-space: nowrap;
|
|
6806
|
+
transform-origin: left bottom;
|
|
6807
|
+
transition: transform var(--agents-activity-stack-move-duration, 420ms) cubic-bezier(0.25, 0.1, 0.25, 1), opacity var(--agents-activity-stack-move-duration, 420ms) cubic-bezier(0.25, 0.1, 0.25, 1);
|
|
6808
|
+
}
|
|
6809
|
+
|
|
6810
|
+
.agents_line_kzizwA[data-rank="0"] {
|
|
6811
|
+
transform: translateY(0) scale(1);
|
|
6812
|
+
opacity: 1;
|
|
6813
|
+
animation: agents_stackLineEnter_aOgcAU var(--agents-activity-stack-move-duration, 420ms) cubic-bezier(0.25, 0.1, 0.25, 1);
|
|
6814
|
+
}
|
|
6815
|
+
|
|
6816
|
+
.agents_line_kzizwA[data-rank="1"] {
|
|
6817
|
+
transform: translateY(-1.5rem) scale(0.94);
|
|
6818
|
+
opacity: 0.7;
|
|
6819
|
+
}
|
|
6820
|
+
|
|
6821
|
+
.agents_line_kzizwA[data-rank="2"] {
|
|
6822
|
+
transform: translateY(-3rem) scale(0.88);
|
|
6823
|
+
opacity: 0.45;
|
|
6824
|
+
}
|
|
6825
|
+
|
|
6826
|
+
.agents_line_kzizwA[data-rank="3"] {
|
|
6827
|
+
transform: translateY(-4.5rem) scale(0.82);
|
|
6828
|
+
opacity: 0.2;
|
|
6829
|
+
}
|
|
6830
|
+
|
|
6831
|
+
.agents_fadingOut_5YOpm- .agents_visual_44ItL8 {
|
|
6832
|
+
animation: agents_stackFadeOut_PSV2fT var(--agents-activity-stack-fade-duration, 1400ms) cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
|
|
6833
|
+
}
|
|
6834
|
+
|
|
6835
|
+
.agents_statusRegion_8U17AD {
|
|
6836
|
+
position: absolute;
|
|
6837
|
+
width: 1px;
|
|
6838
|
+
height: 1px;
|
|
6839
|
+
margin: -1px;
|
|
6840
|
+
padding: 0;
|
|
6841
|
+
overflow: hidden;
|
|
6842
|
+
clip: rect(0 0 0 0);
|
|
6843
|
+
clip-path: inset(50%);
|
|
6844
|
+
white-space: nowrap;
|
|
6845
|
+
border: 0;
|
|
6846
|
+
}
|
|
6847
|
+
|
|
6848
|
+
@keyframes agents_stackLineEnter_aOgcAU {
|
|
6849
|
+
from {
|
|
6850
|
+
transform: translateY(0.5rem);
|
|
6851
|
+
opacity: 0;
|
|
6852
|
+
}
|
|
6853
|
+
to {
|
|
6854
|
+
transform: translateY(0) scale(1);
|
|
6855
|
+
opacity: 1;
|
|
6856
|
+
}
|
|
6857
|
+
}
|
|
6858
|
+
@keyframes agents_stackFadeOut_PSV2fT {
|
|
6859
|
+
from {
|
|
6860
|
+
opacity: 1;
|
|
6861
|
+
}
|
|
6862
|
+
to {
|
|
6863
|
+
opacity: 0;
|
|
6864
|
+
}
|
|
6865
|
+
}
|
|
6866
|
+
@media (prefers-reduced-motion: reduce) {
|
|
6867
|
+
.agents_line_kzizwA,
|
|
6868
|
+
.agents_line_kzizwA[data-rank="0"],
|
|
6869
|
+
.agents_fadingOut_5YOpm- .agents_visual_44ItL8 {
|
|
6870
|
+
transition: none;
|
|
6871
|
+
animation: none;
|
|
6872
|
+
}
|
|
6873
|
+
.agents_fadingOut_5YOpm- .agents_visual_44ItL8 {
|
|
6874
|
+
opacity: 0;
|
|
6875
|
+
}
|
|
6743
6876
|
}.agents_errorBox_2lFftc {
|
|
6744
6877
|
position: relative;
|
|
6745
6878
|
display: flex;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** How the three dots move: `bounce` hops them in turn (the indicator's default); `pulse` only fades and grows them, calmly. */
|
|
2
|
+
export type AgentChatActivityDotsVariant = "bounce" | "pulse";
|
|
3
|
+
export interface AgentChatActivityDotsProps {
|
|
4
|
+
/** Default `bounce`. */
|
|
5
|
+
variant?: AgentChatActivityDotsVariant;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The three working dots of the activity components, decorative (`aria-hidden`). Coloured by `--agents-fg-light`;
|
|
9
|
+
* still under `prefers-reduced-motion`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const AgentChatActivityDots: ({ variant }: AgentChatActivityDotsProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { type AgentChatActivityDotsVariant } from "../AgentChatActivityDots/AgentChatActivityDots";
|
|
1
2
|
import type { AgentChatActivityProps } from "../controller/AgentChatController";
|
|
3
|
+
export interface AgentChatActivityIndicatorProps extends AgentChatActivityProps {
|
|
4
|
+
/** How the dots move: `bounce` (the default) or the calm `pulse`. */
|
|
5
|
+
dotsVariant?: AgentChatActivityDotsVariant;
|
|
6
|
+
}
|
|
2
7
|
/**
|
|
3
8
|
* The package default of the agent's activity at the tail of the thread (`AgentChat`'s `ThinkingIndicator`): three
|
|
4
9
|
* dots and the line the activity ticker shows right now — the step the agent works on — while a turn runs; nothing
|
|
5
10
|
* between turns or after a failed one (the error card speaks then). An app with an agent avatar replaces it
|
|
6
|
-
* (host application: the agent's face beside the same ticker lines).
|
|
11
|
+
* (host application: the agent's face beside the same ticker lines). `AgentChatActivityStack` is the stacked feed.
|
|
7
12
|
*/
|
|
8
|
-
export declare const AgentChatActivityIndicator: (props:
|
|
13
|
+
export declare const AgentChatActivityIndicator: (props: AgentChatActivityIndicatorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AgentChatActivityProps } from "../controller/AgentChatController";
|
|
2
|
+
/** The lines the stack keeps on screen: the newest one and about three readable ranks above it, the oldest under the mask. */
|
|
3
|
+
export declare const ACTIVITY_STACK_VISIBLE_LINES = 4;
|
|
4
|
+
/**
|
|
5
|
+
* The stacked activity feed at the tail of the thread, a drop-in `ThinkingIndicator` of `AgentChat`
|
|
6
|
+
* (`<AgentChat ThinkingIndicator={AgentChatActivityStack} />`): one generated sentence per tool call of the running
|
|
7
|
+
* turn, the newest at the bottom at full size, the older ones drifting up, smaller and fainter under a top mask.
|
|
8
|
+
* Before the first sentence it shows the calm dots and "Working on it…"; once a sentence is told, only sentences. It
|
|
9
|
+
* fades out over the success beat when the turn ends, and shows nothing between turns or after a failed turn.
|
|
10
|
+
*
|
|
11
|
+
* The moving layer is decorative (`aria-hidden`); a polite status region carries the newest sentence. The motion
|
|
12
|
+
* follows the chat's timing (`activityTiming`: the line pace and the success beat), stays still under
|
|
13
|
+
* `prefers-reduced-motion`, and every colour comes from the `--agents-*` variables.
|
|
14
|
+
*/
|
|
15
|
+
export declare const AgentChatActivityStack: (props: AgentChatActivityProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -2,6 +2,7 @@ import { type ComponentType, type ReactNode, type Ref, type RefObject } from "re
|
|
|
2
2
|
import type { AgentsConversationClient } from "../../client/AgentsConversationClient";
|
|
3
3
|
import { type ConversationAttachmentReference } from "../../contract/conversation";
|
|
4
4
|
import type { AgentsChatStore } from "../store/create-agents-chat-store";
|
|
5
|
+
import { type AgentChatActivityTiming, type ResolvedAgentChatActivityTiming } from "./chat-activity-timing";
|
|
5
6
|
import type { ChatScrollTarget } from "./chat-scroll-target";
|
|
6
7
|
import { type ActivityTicker, type ActivityTickerTurn } from "./use-activity-ticker";
|
|
7
8
|
/** What the host's activity components get: the turn's state and the paced lines of the activity ticker. */
|
|
@@ -15,6 +16,8 @@ export interface AgentChatActivityProps {
|
|
|
15
16
|
isAgentWorkingOnTask: boolean;
|
|
16
17
|
/** The key of the agent space the chat is open on. */
|
|
17
18
|
agentSpaceKey: number;
|
|
19
|
+
/** The chat's resolved activity timing (`activityTiming`, the environment's, the package's), for the component's motion. */
|
|
20
|
+
activityTiming?: ResolvedAgentChatActivityTiming;
|
|
18
21
|
}
|
|
19
22
|
/** What the host's activity history under a message gets: the finished turn that message started, if any. */
|
|
20
23
|
export interface AgentChatActivityHistoryProps {
|
|
@@ -54,6 +57,13 @@ export interface AgentChatControllerProps {
|
|
|
54
57
|
scrollTarget?: ChatScrollTarget;
|
|
55
58
|
/** Each finished turn's activity lines stay in the thread above its answer (rendered by `ActivityHistory`). */
|
|
56
59
|
keepActivityHistoryAfterAnswer?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* The timing of the activity reads and of the working indicator's lines (the 3 s read window, the line paces, the
|
|
62
|
+
* success beat). Each field the chat leaves out comes from `AgentsEnvironment.chatActivityTiming`, else the package's
|
|
63
|
+
* value. A host whose realtime push writes `activityUpdatedAt` when the narrator finishes lowers the read window, so a
|
|
64
|
+
* narrated line shows at once.
|
|
65
|
+
*/
|
|
66
|
+
activityTiming?: AgentChatActivityTiming;
|
|
57
67
|
/** The host shows one conversation the owner may not leave: no starting ideas (the agent speaks first). */
|
|
58
68
|
isPinnedToSingleConversation?: boolean;
|
|
59
69
|
/** App extension of the widget context: the chat is the app's guided first-run setup. */
|
|
@@ -56,8 +56,11 @@ export declare const showActivityLine: (queue: ActivityTickerQueue, line: Activi
|
|
|
56
56
|
* a sentence never show (only generated sentences appear).
|
|
57
57
|
*/
|
|
58
58
|
export declare const receiveActivityElements: (queue: ActivityTickerQueue, elements: ActivityElement[], now: number) => ActivityTickerQueue;
|
|
59
|
-
/**
|
|
60
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Milliseconds until the next waiting line may be shown; null when nothing waits. The paces default to
|
|
61
|
+
* {@link LINE_PACE_MS} and {@link BACKLOG_LINE_PACE_MS} (a host sets its own through the chat's `activityTiming`).
|
|
62
|
+
*/
|
|
63
|
+
export declare const msUntilNextActivityLine: (queue: ActivityTickerQueue, now: number, linePaceMs?: number, backlogLinePaceMs?: number) => number | null;
|
|
61
64
|
/** Show the oldest waiting line. The caller's timer decides when (see {@link msUntilNextActivityLine}). */
|
|
62
65
|
export declare const releaseNextActivityLine: (queue: ActivityTickerQueue, now: number) => ActivityTickerQueue;
|
|
63
66
|
/** Show every waiting line at once, oldest first — the turn has ended and the answer is on screen. */
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The timing of the chat's activity lines and of its working indicator, for a host whose delivery differs from the
|
|
3
|
+
* package's polling default. Every field is optional and defaults to the package's value; a value that is no finite
|
|
4
|
+
* number at or above 0 counts as unset.
|
|
5
|
+
*
|
|
6
|
+
* A host with a realtime push that writes `activityUpdatedAt` when the narrator finishes lowers
|
|
7
|
+
* `activityRequestWindowMs` (and the paces), so a narrated line shows as soon as the push arrives instead of after the
|
|
8
|
+
* next 3 s window.
|
|
9
|
+
*/
|
|
10
|
+
export interface AgentChatActivityTiming {
|
|
11
|
+
/** At most one activity read per this many milliseconds per conversation. Default 3000 (`ACTIVITY_REQUEST_WINDOW_MS`). */
|
|
12
|
+
activityRequestWindowMs?: number;
|
|
13
|
+
/** While a turn runs, an activity read also fires on this cadence (the floor for a dead signal). Default 4000 (`RUNNING_FLOOR_MS`). */
|
|
14
|
+
runningFloorMs?: number;
|
|
15
|
+
/** The least time a line stands beside the working face before the next one replaces it. Default 2200 (`LINE_PACE_MS`). */
|
|
16
|
+
linePaceMs?: number;
|
|
17
|
+
/** The shorter wait while more than two lines are queued. Default 1400 (`BACKLOG_LINE_PACE_MS`). */
|
|
18
|
+
backlogLinePaceMs?: number;
|
|
19
|
+
/** How long the face's success beat rests after the turn before it turns idle. Default 1400 (`SUCCESS_BEAT_MS`). */
|
|
20
|
+
successBeatMs?: number;
|
|
21
|
+
}
|
|
22
|
+
/** Every timing value set: the resolved form the chat's hooks read. */
|
|
23
|
+
export type ResolvedAgentChatActivityTiming = Required<AgentChatActivityTiming>;
|
|
24
|
+
/** The package's timing: what a chat uses when neither the chat nor the environment names a value. */
|
|
25
|
+
export declare const DEFAULT_AGENT_CHAT_ACTIVITY_TIMING: ResolvedAgentChatActivityTiming;
|
|
26
|
+
/**
|
|
27
|
+
* The timing of one chat: each field from the first source that sets a usable value — the chat's own
|
|
28
|
+
* (`AgentChat activityTiming`), then the environment's (`AgentsEnvironment.chatActivityTiming`), then the package's.
|
|
29
|
+
*/
|
|
30
|
+
export declare const resolveAgentChatActivityTiming: (...sources: (AgentChatActivityTiming | null | undefined)[]) => ResolvedAgentChatActivityTiming;
|
|
@@ -19,6 +19,12 @@ interface UseActivityTickerParams {
|
|
|
19
19
|
* it; false = they fade out with the line beside the face and nothing remains.
|
|
20
20
|
*/
|
|
21
21
|
keepActivityHistoryAfterAnswer?: boolean;
|
|
22
|
+
/** The least time a line stands beside the face. Default `LINE_PACE_MS` (2200). */
|
|
23
|
+
linePaceMs?: number;
|
|
24
|
+
/** The shorter wait while more than two lines are queued. Default `BACKLOG_LINE_PACE_MS` (1400). */
|
|
25
|
+
backlogLinePaceMs?: number;
|
|
26
|
+
/** The success beat's rest. Default {@link SUCCESS_BEAT_MS}. */
|
|
27
|
+
successBeatMs?: number;
|
|
22
28
|
}
|
|
23
29
|
/** One turn's lines — the turn running now, in the face's success beat, or kept in the thread. */
|
|
24
30
|
export interface ActivityTickerTurn {
|
|
@@ -15,6 +15,10 @@ type Params = {
|
|
|
15
15
|
/** Advances on every signal tick the host acts on (its message refetch); each advance asks for the activity too. */
|
|
16
16
|
signalVersion: number;
|
|
17
17
|
enabled?: boolean;
|
|
18
|
+
/** At most one request per this many milliseconds. Default {@link ACTIVITY_REQUEST_WINDOW_MS}. */
|
|
19
|
+
activityRequestWindowMs?: number;
|
|
20
|
+
/** The request cadence while a turn runs. Default {@link RUNNING_FLOOR_MS}. */
|
|
21
|
+
runningFloorMs?: number;
|
|
18
22
|
};
|
|
19
23
|
type Result = {
|
|
20
24
|
/** The rows of the stack in row order; empty before the first turn of this mount. */
|
|
@@ -29,10 +33,10 @@ type Result = {
|
|
|
29
33
|
* `getConversationActivity` (`AgentsConversationClientProvider`) while the customer watches a running turn and merges the answer into the stack. Frontend-driven on purpose: nothing is
|
|
30
34
|
* generated for a hidden tab or a closed chat. The turn is pinned when it starts (`turnMessageId` from the first
|
|
31
35
|
* answer), so a message the customer sends mid-turn does not move the window. Debounced to one request per
|
|
32
|
-
* {@link ACTIVITY_REQUEST_WINDOW_MS} with one trailing request after a burst; a terminal status fires one request for
|
|
36
|
+
* {@link ACTIVITY_REQUEST_WINDOW_MS} (or the host's `activityRequestWindowMs`) with one trailing request after a burst; a terminal status fires one request for
|
|
33
37
|
* the finished lines, and the requests go on until the endpoint answers that the turn ended — then the stack rests
|
|
34
38
|
* until the next turn. A failed run ends the turn with that last request, whatever it answers, and so do
|
|
35
39
|
* {@link MAX_FAILED_REQUESTS_AFTER_SIGNAL_ENDED} failed requests in a row once the signal stopped saying "running".
|
|
36
40
|
*/
|
|
37
|
-
export declare const useConversationActivity: ({ conversationId, runStatus, signalVersion, enabled, }: Params) => Result;
|
|
41
|
+
export declare const useConversationActivity: ({ conversationId, runStatus, signalVersion, enabled, activityRequestWindowMs, runningFloorMs, }: Params) => Result;
|
|
38
42
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AgentsClientError, type AgentsConversation, type AgentsConversationMessage, type ConversationActivity, type ConversationMessageSearchHit, type ConversationRunStateRead, type ConversationSearchGroup, type SelectableModel } from "../../contract/conversation";
|
|
2
|
-
import type { WireConversation, WireConversationActivityResponse, WireConversationMessage, WireConversationRunStateResponse, WireConversationSearchGroup, WireErrorBody, WireSelectableModel, WireSemanticSearchHit, WireSet } from "./agents-http-wire";
|
|
1
|
+
import { AgentsClientError, type AgentsClientContext, type AgentsConversation, type AgentsConversationMessage, type ConversationActivity, type ConversationMessageSearchHit, type ConversationRunStateRead, type ConversationSearchGroup, type SelectableModel } from "../../contract/conversation";
|
|
2
|
+
import type { WireClientContext, WireConversation, WireConversationActivityResponse, WireConversationMessage, WireConversationRunStateResponse, WireConversationSearchGroup, WireErrorBody, WireSelectableModel, WireSemanticSearchHit, WireSet } from "./agents-http-wire";
|
|
3
3
|
/** The elements of a serialized set (`{ elements: [...] }`), a plain array, or the values of a keyed object. */
|
|
4
4
|
export declare const readWireSetElements: <Element>(wireSet: WireSet<Element> | Record<string, Element> | null | undefined) => Element[];
|
|
5
5
|
/** An `AIConversation` as the contract's conversation. */
|
|
@@ -21,3 +21,10 @@ export declare const mapWireSelectableModel: (wireModel: WireSelectableModel) =>
|
|
|
21
21
|
* `rateLimit` (with `Retry-After`), 404 `notFound`, 403 and 401 `forbidden`, 5xx `network`, everything else `other`.
|
|
22
22
|
*/
|
|
23
23
|
export declare const mapHttpFailureToAgentsClientError: (httpStatus: number, wireErrorBody: WireErrorBody | null, retryAfterHeader: string | null) => AgentsClientError;
|
|
24
|
+
/**
|
|
25
|
+
* The client context as the body field `clientContext` carries it (`AgentClientContext`): the route parameters as a
|
|
26
|
+
* list of `{name, value}`. A field over its cap ({@link AGENTS_CLIENT_CONTEXT_LIMITS}) or with a control character is
|
|
27
|
+
* left out — never cut — so a send never fails on the context; the route parameters go together or not at all.
|
|
28
|
+
* Undefined when nothing is left.
|
|
29
|
+
*/
|
|
30
|
+
export declare const mapClientContextToWire: (clientContext: AgentsClientContext | null | undefined) => WireClientContext | undefined;
|
|
@@ -178,6 +178,19 @@ export interface WireConversationMessageSearchResponse {
|
|
|
178
178
|
export interface WireSelectableModelsResponse {
|
|
179
179
|
models?: WireSet<WireSelectableModel> | null;
|
|
180
180
|
}
|
|
181
|
+
/** One route parameter of `AgentClientContext` on the wire. */
|
|
182
|
+
export interface WireClientContextRouteParameter {
|
|
183
|
+
name: string;
|
|
184
|
+
value: string;
|
|
185
|
+
}
|
|
186
|
+
/** `AgentClientContext`: the body field `clientContext` of a start, a posted message and an injected signal. */
|
|
187
|
+
export interface WireClientContext {
|
|
188
|
+
routePath?: string;
|
|
189
|
+
routeParameters?: WireClientContextRouteParameter[];
|
|
190
|
+
recordKind?: string;
|
|
191
|
+
recordId?: string;
|
|
192
|
+
tab?: string;
|
|
193
|
+
}
|
|
181
194
|
/** The JSON error body of a refused request (`errorCode` on the coded exceptions, `retryAfterSeconds` on a quota). */
|
|
182
195
|
export interface WireErrorBody {
|
|
183
196
|
error?: string | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AgentsConversationClient, AgentsConversationClientBindingOptions } from "../AgentsConversationClient";
|
|
2
|
+
import { type AgentsClientContext } from "../../contract/conversation";
|
|
2
3
|
import type { PollingConversationChangeSubscriptionOptions } from "../polling/createPollingConversationChangeSubscription";
|
|
3
4
|
/** What every request of the binding carries from the host: headers, credentials, mode, cache. */
|
|
4
5
|
export type AgentsHttpFetchOptions = Omit<RequestInit, "method" | "body">;
|
|
@@ -33,7 +34,15 @@ export interface AgentsHttpConversationClientOptions extends AgentsConversationC
|
|
|
33
34
|
* Default: polling with the default intervals.
|
|
34
35
|
*/
|
|
35
36
|
polling?: PollingConversationChangeSubscriptionOptions | false;
|
|
37
|
+
/**
|
|
38
|
+
* What the owner's client shows, read on every start, posted message and injected signal and sent as the body field
|
|
39
|
+
* `clientContext` (the route, its parameters, the record on screen, the tab). The agent reads the newest one as one
|
|
40
|
+
* line beside the owner's newest message. A field over its cap is left out, never cut. Default: none.
|
|
41
|
+
*/
|
|
42
|
+
clientContext?: (operation: AgentsClientContextOperation) => AgentsClientContext | null | undefined;
|
|
36
43
|
}
|
|
44
|
+
/** The writes that carry the client context. */
|
|
45
|
+
export type AgentsClientContextOperation = "startConversation" | "postMessage" | "injectSignal";
|
|
37
46
|
/** The page size of a changed-messages read when the request names none (as the chat sends it). */
|
|
38
47
|
export declare const AGENTS_HTTP_DEFAULT_CHANGED_MESSAGES_PAGE_SIZE = 50;
|
|
39
48
|
/**
|
|
@@ -215,6 +215,33 @@ export interface PostedMessage {
|
|
|
215
215
|
messages: AgentsConversationMessage[];
|
|
216
216
|
}
|
|
217
217
|
/** A model-visible, owner-invisible note into a conversation (a widget click, a render report, a correction). */
|
|
218
|
+
/**
|
|
219
|
+
* What the owner's client shows while the owner writes: the route, its parameters, the record on screen and the tab.
|
|
220
|
+
* Sent with a start, a posted message and an injected signal; the server stores it on that owner row and the agent reads
|
|
221
|
+
* the newest one as one line beside the owner's newest message. Each field is optional and capped
|
|
222
|
+
* ({@link AGENTS_CLIENT_CONTEXT_LIMITS}); the server refuses a request with a field over its cap (HTTP 400).
|
|
223
|
+
*/
|
|
224
|
+
export interface AgentsClientContext {
|
|
225
|
+
/** The path of the route the client shows, e.g. `/tickets/42`. */
|
|
226
|
+
routePath?: string | null;
|
|
227
|
+
/** The parameters of that route by name, values as text. */
|
|
228
|
+
routeParameters?: Record<string, string> | null;
|
|
229
|
+
/** The kind of the record on screen, as the application names it, e.g. `ticket`. */
|
|
230
|
+
recordKind?: string | null;
|
|
231
|
+
/** The id of the record on screen. */
|
|
232
|
+
recordId?: string | number | null;
|
|
233
|
+
/** The tab the client shows. */
|
|
234
|
+
tab?: string | null;
|
|
235
|
+
}
|
|
236
|
+
/** The caps of {@link AgentsClientContext} (characters; the route parameters as their `name=value&…` text). */
|
|
237
|
+
export declare const AGENTS_CLIENT_CONTEXT_LIMITS: {
|
|
238
|
+
readonly routePathChars: 512;
|
|
239
|
+
readonly routeParametersChars: 512;
|
|
240
|
+
readonly routeParameterCount: 20;
|
|
241
|
+
readonly recordKindChars: 64;
|
|
242
|
+
readonly recordIdChars: 128;
|
|
243
|
+
readonly tabChars: 64;
|
|
244
|
+
};
|
|
218
245
|
export interface ConversationSignal {
|
|
219
246
|
/** generic */
|
|
220
247
|
text: string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { AgentChat, type AgentChatProps } from "../chat/AgentChat/AgentChat";
|
|
2
2
|
export { AgentChatController, type AgentChatActivityHistoryProps, type AgentChatActivityProps, type AgentChatComposerHandle, type AgentChatControllerProps, type AgentChatSendModelSource, } from "../chat/controller/AgentChatController";
|
|
3
3
|
export { useAgentsConversationClient, useOptionalAgentsConversationClient, } from "../client/AgentsConversationClientContext";
|
|
4
|
-
export { AgentChatActivityIndicator } from "../chat/AgentChatActivityIndicator/AgentChatActivityIndicator";
|
|
4
|
+
export { AgentChatActivityIndicator, type AgentChatActivityIndicatorProps, } from "../chat/AgentChatActivityIndicator/AgentChatActivityIndicator";
|
|
5
|
+
export { AgentChatActivityStack, ACTIVITY_STACK_VISIBLE_LINES } from "../chat/AgentChatActivityStack/AgentChatActivityStack";
|
|
6
|
+
export { AgentChatActivityDots, type AgentChatActivityDotsProps, type AgentChatActivityDotsVariant, } from "../chat/AgentChatActivityDots/AgentChatActivityDots";
|
|
5
7
|
export { AgentChatActivityHistory } from "../chat/AgentChatActivityHistory/AgentChatActivityHistory";
|
|
6
8
|
export { ConversationClosedBar, type ConversationClosedBarProps } from "../chat/ConversationClosedBar/ConversationClosedBar";
|
|
7
9
|
export * from "../chat/store";
|
|
@@ -33,4 +35,5 @@ export { ConversationMessageInput, MAX_MESSAGE_LENGTH, type ConversationMessageI
|
|
|
33
35
|
export type { ConversationMessageInputAttachmentPreview, ConversationMessageInputAttachmentUploadStatus, } from "../chat/ConversationMessageInput/ConversationMessageInputAttachments/ConversationMessageInputAttachmentPreviewWidget";
|
|
34
36
|
export type { AssistantServerMessagePayload } from "../chat/normalize-server-message-to-markdown";
|
|
35
37
|
export { useActivityTicker, SUCCESS_BEAT_MS } from "../chat/controller/use-activity-ticker";
|
|
38
|
+
export { type AgentChatActivityTiming, type ResolvedAgentChatActivityTiming, DEFAULT_AGENT_CHAT_ACTIVITY_TIMING, resolveAgentChatActivityTiming, } from "../chat/controller/chat-activity-timing";
|
|
36
39
|
export { formatElapsedClock, isStepStillRunning, type ActivityTickerLine } from "../chat/controller/activity-ticker";
|
|
@@ -2,6 +2,7 @@ import type { ComponentType, ErrorInfo, ReactNode } from "react";
|
|
|
2
2
|
import type { AgentsComponents } from "./components/types";
|
|
3
3
|
import type { ConversationWidgetStatePartition } from "../renderer/conversation-widget-state-partition";
|
|
4
4
|
import type { ChatAssistantCategory } from "../chat/chat-assistant-identity";
|
|
5
|
+
import type { AgentChatActivityTiming } from "../chat/controller/chat-activity-timing";
|
|
5
6
|
import type { ComposedNodeSchemaApplicationPart } from "../renderer/widget-tree/composed-node-schema";
|
|
6
7
|
import type { CanvasBehaviour } from "../renderer/canvas/canvas-behaviours";
|
|
7
8
|
import type { OpenEntityActionTarget } from "../renderer/canvas/entity-detail-instance";
|
|
@@ -139,6 +140,12 @@ export interface AgentsEnvironment {
|
|
|
139
140
|
buildWidgetOfAnotherAgentSpaceExplanation?: (agentSpaceLabel: string) => string;
|
|
140
141
|
/** The name the owner knows the agent by, for the interface texts that name it. Default: `the assistant`. */
|
|
141
142
|
agentDisplayName?: string;
|
|
143
|
+
/**
|
|
144
|
+
* The timing of every chat's activity reads and working indicator, for the fields a chat's own `activityTiming`
|
|
145
|
+
* leaves out (`AgentChatActivityTiming`). Default: the package's values (one activity read per 3 s, a line at least
|
|
146
|
+
* 2.2 s beside the face). A host with a realtime push that writes `activityUpdatedAt` lowers the read window.
|
|
147
|
+
*/
|
|
148
|
+
chatActivityTiming?: AgentChatActivityTiming;
|
|
142
149
|
/** A React hook returning what the error card of a reached budget offers. Default: no upgrade, the plain wording. */
|
|
143
150
|
useBudgetLimit?: () => AgentsBudgetLimit;
|
|
144
151
|
/** A React hook returning the map script loader's state. Default: no maps. */
|
package/package.json
CHANGED
package/public-api.json
CHANGED
|
@@ -422,6 +422,7 @@
|
|
|
422
422
|
},
|
|
423
423
|
"./contract": {
|
|
424
424
|
"values": [
|
|
425
|
+
"AGENTS_CLIENT_CONTEXT_LIMITS",
|
|
425
426
|
"AGENTS_CLIENT_ERROR_CODE_REQUEST_ABORTED",
|
|
426
427
|
"AgentsClientError",
|
|
427
428
|
"CONVERSATION_RUN_STATES_THAT_END_THE_CONVERSATION",
|
|
@@ -430,6 +431,7 @@
|
|
|
430
431
|
"readConversationRunStatusOfRunState"
|
|
431
432
|
],
|
|
432
433
|
"types": [
|
|
434
|
+
"AgentsClientContext",
|
|
433
435
|
"AgentsClientErrorKind",
|
|
434
436
|
"AgentsConversation",
|
|
435
437
|
"AgentsConversationMessage",
|
|
@@ -476,6 +478,7 @@
|
|
|
476
478
|
"composeAttachmentMessageText",
|
|
477
479
|
"createAgentsHttpConversationClient",
|
|
478
480
|
"createPollingConversationChangeSubscription",
|
|
481
|
+
"mapClientContextToWire",
|
|
479
482
|
"mapHttpFailureToAgentsClientError",
|
|
480
483
|
"mapWireConversation",
|
|
481
484
|
"mapWireConversationActivity",
|
|
@@ -491,6 +494,7 @@
|
|
|
491
494
|
"withPollingChangeSubscription"
|
|
492
495
|
],
|
|
493
496
|
"types": [
|
|
497
|
+
"AgentsClientContextOperation",
|
|
494
498
|
"AgentsConversationClient",
|
|
495
499
|
"AgentsConversationClientBindingOptions",
|
|
496
500
|
"AgentsConversationClientProviderProps",
|
|
@@ -506,6 +510,8 @@
|
|
|
506
510
|
"PollingTimers",
|
|
507
511
|
"WireActivityLine",
|
|
508
512
|
"WireChangeHistory",
|
|
513
|
+
"WireClientContext",
|
|
514
|
+
"WireClientContextRouteParameter",
|
|
509
515
|
"WireConversation",
|
|
510
516
|
"WireConversationActivityResponse",
|
|
511
517
|
"WireConversationMessage",
|
|
@@ -553,9 +559,12 @@
|
|
|
553
559
|
},
|
|
554
560
|
"./chat": {
|
|
555
561
|
"values": [
|
|
562
|
+
"ACTIVITY_STACK_VISIBLE_LINES",
|
|
556
563
|
"AgentChat",
|
|
564
|
+
"AgentChatActivityDots",
|
|
557
565
|
"AgentChatActivityHistory",
|
|
558
566
|
"AgentChatActivityIndicator",
|
|
567
|
+
"AgentChatActivityStack",
|
|
559
568
|
"AgentChatController",
|
|
560
569
|
"AgentsChatStateContainer",
|
|
561
570
|
"AgentsChatStoreProvider",
|
|
@@ -575,6 +584,7 @@
|
|
|
575
584
|
"ConversationMessageWidgets",
|
|
576
585
|
"ConversationView",
|
|
577
586
|
"ConversationWidgetProvider",
|
|
587
|
+
"DEFAULT_AGENT_CHAT_ACTIVITY_TIMING",
|
|
578
588
|
"EMPTY_AGENTS_CHAT_OPENING_REQUEST",
|
|
579
589
|
"INITIAL_AGENTS_CHAT_STATE",
|
|
580
590
|
"MAX_MESSAGE_LENGTH",
|
|
@@ -588,6 +598,7 @@
|
|
|
588
598
|
"normalizeServerMessageToMarkdown",
|
|
589
599
|
"readConversationErrorTypeOfRefusedSend",
|
|
590
600
|
"reduceAgentsChatState",
|
|
601
|
+
"resolveAgentChatActivityTiming",
|
|
591
602
|
"useActivityTicker",
|
|
592
603
|
"useAgentsChatSelector",
|
|
593
604
|
"useAgentsChatState",
|
|
@@ -604,8 +615,12 @@
|
|
|
604
615
|
"ActivityTickerLine",
|
|
605
616
|
"ActivityTickerTurn",
|
|
606
617
|
"AgentActivity",
|
|
618
|
+
"AgentChatActivityDotsProps",
|
|
619
|
+
"AgentChatActivityDotsVariant",
|
|
607
620
|
"AgentChatActivityHistoryProps",
|
|
621
|
+
"AgentChatActivityIndicatorProps",
|
|
608
622
|
"AgentChatActivityProps",
|
|
623
|
+
"AgentChatActivityTiming",
|
|
609
624
|
"AgentChatComposerHandle",
|
|
610
625
|
"AgentChatControllerProps",
|
|
611
626
|
"AgentChatProps",
|
|
@@ -637,6 +652,7 @@
|
|
|
637
652
|
"ConversationViewProps",
|
|
638
653
|
"ConversationWidgetProviderProps",
|
|
639
654
|
"ConversationsSearchState",
|
|
655
|
+
"ResolvedAgentChatActivityTiming",
|
|
640
656
|
"SendMessageHandler",
|
|
641
657
|
"SendMessageOptions"
|
|
642
658
|
]
|