@llmnative/agentico 0.14.0 → 0.15.1
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 +1 -0
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +927 -784
- package/dist/index.mjs.map +1 -1
- package/dist/types/domain/agentDefinition.d.ts +13 -0
- package/dist/types/domain/entityChatStore.d.ts +2 -0
- package/dist/types/i18n/types.d.ts +8 -0
- package/dist/types/presentation/AgentActivityLog.d.ts +25 -1
- package/dist/types/presentation/useAgent.d.ts +12 -1
- package/llms.txt +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
2
|
import type { AIAttachment } from '@llmnative/react';
|
|
3
|
+
import type { EntityChatActivityEntry } from './entityChatStore';
|
|
3
4
|
import type { AgentCard, AgentCardOutcome, AgentCardPart, AgentQuestion, AgentQuestionAnswer, AgentQuestionsAnswers } from './messageParts';
|
|
4
5
|
/** Rif mutabile, sempre aggiornato da useAgent.ts all'inizio di ogni turno (roundTrip 0) con
|
|
5
6
|
* gli allegati grezzi (base64) di QUESTO turno — mai un valore statico catturato una volta:
|
|
@@ -133,6 +134,12 @@ export interface AgentExecutorTurn<TParams, TContext> {
|
|
|
133
134
|
signal: AbortSignal;
|
|
134
135
|
/** The model the person picked among `AgentExecutor.models`, if the executor offers any. */
|
|
135
136
|
model?: string;
|
|
137
|
+
/** CR-016: present on the first turn after the person took the chat back to one of their messages
|
|
138
|
+
* (Retry from here, Edit). What the executor keeps of the conversation (a session on a server) is
|
|
139
|
+
* past: it starts again from `activity`, the chat as it is now, before `text`. */
|
|
140
|
+
rewound?: {
|
|
141
|
+
activity: EntityChatActivityEntry[];
|
|
142
|
+
};
|
|
136
143
|
/** Present when the person answered questions of an earlier turn (CR-004): the turn carries
|
|
137
144
|
* them, structured, with `text` empty. The executor decides how to forward them (e.g. to the
|
|
138
145
|
* `question` tool of its session). Questions answered while their own turn is still running
|
|
@@ -199,6 +206,12 @@ export interface AgentExecutor<TParams, TContext, TResult> {
|
|
|
199
206
|
* `first` of a turn of the executor: its first turn in the chat.
|
|
200
207
|
*/
|
|
201
208
|
alongside?: boolean;
|
|
209
|
+
/**
|
|
210
|
+
* CR-016: the executor starts again from the chat when the person takes it back to one of their messages
|
|
211
|
+
* (its turn then carries `rewound`). Without it, an agent with an executor offers no Retry from here nor
|
|
212
|
+
* Edit: what the executor keeps of the conversation would not go back with the chat.
|
|
213
|
+
*/
|
|
214
|
+
canRewind?: boolean;
|
|
202
215
|
/** CR-009: the group (and its badge) the models of the AI catalog are listed under, next to the executor's. */
|
|
203
216
|
catalogGroup?(provider: string, label: string): {
|
|
204
217
|
group: string;
|
|
@@ -14,6 +14,8 @@ export interface EntityChatActivityEntry {
|
|
|
14
14
|
attachmentNames?: string[];
|
|
15
15
|
/** A message the Retry button sent for the person, not one they wrote (never a title). */
|
|
16
16
|
retry?: boolean;
|
|
17
|
+
/** CR-016: the length of the history of the model when this message of the person was sent. */
|
|
18
|
+
historyAt?: number;
|
|
17
19
|
/** The message in parts (CR-004): saved and reloaded as they are. Absent in chats saved before
|
|
18
20
|
* 0.3.0, which show `detail` as before. */
|
|
19
21
|
parts?: AgentMessagePart[];
|
|
@@ -65,6 +65,14 @@ export interface AgenticoDict {
|
|
|
65
65
|
retry: string;
|
|
66
66
|
/** User message sent to the model by the retry button */
|
|
67
67
|
retryMessage: string;
|
|
68
|
+
/** CR-016: the actions on a message of the person, the composer while editing one, the confirmation. */
|
|
69
|
+
retryFromHere: string;
|
|
70
|
+
editMessage: string;
|
|
71
|
+
editingMessage: string;
|
|
72
|
+
cancelEdit: string;
|
|
73
|
+
rewindTitle: string;
|
|
74
|
+
/** Followed by the steps done after the message. */
|
|
75
|
+
rewindText: string;
|
|
68
76
|
continueWithoutAi: string;
|
|
69
77
|
resumeWithAi: string;
|
|
70
78
|
openPanel: string;
|
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
import type { AgentActivityEntry } from './useAgent';
|
|
2
2
|
import type { AgentCardPart, AgentQuestionAnswer, AgentQuestionsPart } from '../domain/messageParts';
|
|
3
|
+
/** Bolla utente — collassabile SOLO se il testo eccede l'altezza di soglia (misurato via ref,
|
|
4
|
+
* niente stima a priori sul numero di caratteri: dipende da wrap/allegati/lingua). L'unica zona
|
|
5
|
+
* cliccabile per espandere/comprimere è la maniglia dedicata in fondo alla bolla (chevron),
|
|
6
|
+
* MAI l'intera bolla — stesso motivo per cui ChatGPT/Claude fanno lo stesso: il testo dentro
|
|
7
|
+
* deve restare selezionabile col mouse senza che un click/trascinamento apra o chiuda la bolla.
|
|
8
|
+
* Non inventato da zero: è il pattern "show more/less con maniglia separata" già standard nei
|
|
9
|
+
* chatbot conversazionali per i turni utente lunghi.
|
|
10
|
+
*
|
|
11
|
+
* Sticky in cima (CR-004) ma solo dentro il suo turno (vedi AgentActivityLog): quando il turno
|
|
12
|
+
* finisce di scorrere, la bolla se ne va con lui invece di restare sotto quella del turno dopo
|
|
13
|
+
* (prima tutte le bolle erano sticky nella stessa lista, e una bolla più alta spuntava sotto
|
|
14
|
+
* una più bassa, sopra il testo). Sfondo pieno e `z-20`: il testo che scorre sotto (tabelle,
|
|
15
|
+
* codice) non le passa sopra. */
|
|
16
|
+
/** CR-016: what the person can do on one of their messages: send it again from there, or edit it. */
|
|
17
|
+
export interface UserMessageActions {
|
|
18
|
+
/** Whether the message has them (a message of this conversation, with where the chat goes back to). */
|
|
19
|
+
available: (entry: AgentActivityEntry) => boolean;
|
|
20
|
+
/** Off while a turn runs. */
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
onRetry: (entry: AgentActivityEntry) => void;
|
|
23
|
+
onEdit: (entry: AgentActivityEntry) => void;
|
|
24
|
+
}
|
|
3
25
|
/** What the log needs to let the person answer questions (CR-004): the entries of the live
|
|
4
26
|
* conversation (`canAnswer`) and where the answers go. Without it, unanswered questions are shown
|
|
5
27
|
* disabled. */
|
|
@@ -45,8 +67,10 @@ export declare function QuestionsPart({ entry, part, questions, autoFocus, class
|
|
|
45
67
|
* One `<li>` per turn (CR-004): the message of the person, sticky at the top while its turn
|
|
46
68
|
* scrolls, then what the agent did and said. Entries before the first message of the person
|
|
47
69
|
* (an opening without text) form a turn of their own, without a bubble. */
|
|
48
|
-
export declare function AgentActivityLog({ activity, questions, docked, pinUserMessages }: {
|
|
70
|
+
export declare function AgentActivityLog({ activity, questions, docked, pinUserMessages, messageActions }: {
|
|
49
71
|
activity: AgentActivityEntry[];
|
|
72
|
+
/** CR-016: Retry from here and Edit on the messages of the person. */
|
|
73
|
+
messageActions?: UserMessageActions;
|
|
50
74
|
questions?: AgentActivityLogQuestions;
|
|
51
75
|
/** Questions docked at the bottom of the panel (CR-005): left out of the thread. */
|
|
52
76
|
docked?: DockedQuestions | null;
|
|
@@ -39,6 +39,10 @@ export interface AgentActivityEntry {
|
|
|
39
39
|
attachmentNames?: string[];
|
|
40
40
|
/** A message the Retry button sent for the person (never the title of the chat). */
|
|
41
41
|
retry?: boolean;
|
|
42
|
+
/** CR-016: on a message of the person, how many turns the history of the model had when it was sent:
|
|
43
|
+
* where the chat goes back to when the person retries or edits it. Absent on messages sent before
|
|
44
|
+
* 0.15.0 (no Retry from here on them). */
|
|
45
|
+
historyAt?: number;
|
|
42
46
|
/** On the turns of a remote agent (CR-004): the message in parts (text, reasoning, steps,
|
|
43
47
|
* questions), in the order they arrived. `detail` still holds its text. Absent on the turns of
|
|
44
48
|
* the AI provider and on chats saved before 0.3.0, shown from `detail` as before. */
|
|
@@ -150,6 +154,13 @@ export interface UseAgentResult<TParams, TResult> extends AgentControlState {
|
|
|
150
154
|
history: AIConversationTurn[];
|
|
151
155
|
activity: AgentActivityEntry[];
|
|
152
156
|
} | null;
|
|
157
|
+
/** CR-016: back to a message of the person (by its entry id) and sent again, as it was or edited
|
|
158
|
+
* (`text`). Everything after it goes, from the chat and from the history of the model. */
|
|
159
|
+
rewind: (entryId: string, text?: string) => Promise<TResult | null>;
|
|
160
|
+
/** CR-016: whether this agent offers going back (always on the AI catalog; with an executor, when it says so). */
|
|
161
|
+
canRewind: boolean;
|
|
162
|
+
/** CR-016: whether a message of the person can be gone back to (it knows, or the history shows, where it was). */
|
|
163
|
+
rewindable: (entryId: string) => boolean;
|
|
153
164
|
/** Answers the questions part `partId` of the entry `entryId` (CR-004). If the turn that asked
|
|
154
165
|
* is still waiting, its `onQuestions` promise resolves; otherwise a new turn of the executor
|
|
155
166
|
* carries them (`AgentExecutorTurn.answers`, with empty `text`). Either way the part keeps the
|
|
@@ -164,7 +175,7 @@ export interface UseAgentResult<TParams, TResult> extends AgentControlState {
|
|
|
164
175
|
/** Solo la fetta di UseAgentResult che serve a un consumer del pannello globale (Agentico.tsx)
|
|
165
176
|
* per continuare una conversazione già avviata da run() — TParams non compare in nessuno dei
|
|
166
177
|
* membri qui sotto, quindi `never` è innocuo. */
|
|
167
|
-
export type AgentConversation<TResult> = Pick<UseAgentResult<never, TResult>, 'canContinue' | 'remote' | 'remoteModels' | 'alongside' | 'catalogGroup' | 'running' | 'error' | 'activity' | 'sendMessage' | 'stop' | 'runFallback' | 'snapshot' | 'answerQuestions' | 'cardAction' | 'offersFallback'>;
|
|
178
|
+
export type AgentConversation<TResult> = Pick<UseAgentResult<never, TResult>, 'canContinue' | 'remote' | 'remoteModels' | 'alongside' | 'catalogGroup' | 'running' | 'error' | 'activity' | 'sendMessage' | 'stop' | 'runFallback' | 'snapshot' | 'answerQuestions' | 'cardAction' | 'offersFallback' | 'rewind' | 'canRewind' | 'rewindable'>;
|
|
168
179
|
/** The entries of a reopened chat: what was still running stopped, what was streaming done. */
|
|
169
180
|
export declare function settleActivity(activity: AgentActivityEntry[]): AgentActivityEntry[];
|
|
170
181
|
export declare function useAgent<TParams, TContext, TResult>(definition: AgentDefinition<TParams, TContext, TResult>, options?: {
|
package/llms.txt
CHANGED
|
@@ -45,6 +45,7 @@ buildContext (always runs) · buildPrompt · buildFollowUpPrompt · parseRespons
|
|
|
45
45
|
`executor.turn({ params, context, text, first, signal, model?, onText(whole reply so far), onStep({ id, label, status }) }) → { text, result? }`; `executor.models(params)` / `defaultModel(params)` put the models of the executor in the composer: the turns go to the host instead of the AI provider; `text` is what the person typed (opening message on the first turn). The conversation is `remote: true`: no attachments, no fallback; the picker shows `remoteModels`.
|
|
46
46
|
CR-009: `executor.alongside: true` keeps the agent on the AI catalog (prompts, tools, approvals): only the turns whose model is one of `executor.models` go to `executor.turn` (`first` on its first one); the picker shows the executor's models (`{ label, value, group?, groupBadge?: { label, variant? } }`) then the catalog's, grouped by `executor.catalogGroup(provider, label) → { group, badge? }`; `useAgent` gives `alongside`, `catalogGroup`.
|
|
47
47
|
CR-010: `executor.catalogProviders(params) → string[] | undefined` limits the AI catalog of a chat to those providers (composer and turns; a model of another provider is never used: the executor's first model, else the first allowed one). A saved chat keeps `startedAt` (first save; `chatStartedAt(snapshot)` falls back to `savedAt`); `listEntityChats` lists the last started first and the history shows the start.
|
|
48
|
+
CR-016: Retry from here and Edit on a message of the person (hover): `useAgent().rewind(entryId, text?)` cuts the chat and the history of the model at that message (`entry.historyAt`) and sends it again; `canRewind` (always without an executor; with one, only if `executor.canRewind`), and its next turn carries `rewound: { activity }` (start again from the chat as it is). A confirmation lists the steps done after it (they stay done).
|
|
48
49
|
CR-015: `AgentDefinition.offersFallback: false` hides "Continue without AI" when the model fails (an agent with no result without a model, e.g. a chat); default shown.
|
|
49
50
|
CR-014: cards in messages — part `{ type: 'card', id, title, badge?, body?, details?, actions?: [{ id, label, icon?, variant? }], data?, outcome? }`; `AgentTool.card(input, output)` adds one after the tool ran, `turn.onCard(card)` for an executor; `AgentDefinition.onCardAction(params, card, actionId) → { status: 'done' | 'dismissed' | 'error', text, link? }` (stored in the card, buttons off); View opens `details` in a side modal; `useAgent().cardAction(entryId, partId, actionId)`.
|
|
50
51
|
CR-013: `configureEntityChatStore({ storageKey, backend })` — `EntityChatBackend { load(scopeId), save(snapshot), remove(scopeId, subagentId, entityId) }`: the browser copy stays (sync reads), writes also go to the backend; `syncEntityChats(scopeId)` (AgenticoProvider on scope change) merges by `changedAt`, drops chats gone remotely, sends never-sent ones; a refused removal comes back.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llmnative/agentico",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "Agentic chat orchestrator for @llmnative/react apps: a persistent panel that talks with the user and hands the work to host-registered subagents.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|