@llmnative/agentico 0.18.0 → 0.20.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 +2 -0
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +795 -664
- package/dist/index.mjs.map +1 -1
- package/dist/types/domain/entityChatStore.d.ts +5 -0
- package/dist/types/domain/threadEvents.d.ts +22 -0
- package/dist/types/i18n/types.d.ts +2 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/presentation/AgenticoContext.d.ts +7 -0
- package/dist/types/presentation/imagePreview.d.ts +11 -0
- package/dist/types/presentation/useAgent.d.ts +3 -0
- package/llms.txt +2 -0
- package/package.json +1 -1
|
@@ -18,6 +18,11 @@ export interface EntityChatActivityEntry {
|
|
|
18
18
|
author?: ChatAuthor;
|
|
19
19
|
/** CR-019: when it was born (ms). Absent on entries saved before 0.18.0. */
|
|
20
20
|
at?: number;
|
|
21
|
+
/** CR-020: on a message of the person, small previews (data URLs) of the images attached to it. */
|
|
22
|
+
attachmentPreviews?: Array<{
|
|
23
|
+
name: string;
|
|
24
|
+
src: string;
|
|
25
|
+
}>;
|
|
21
26
|
/** CR-016: the length of the history of the model when this message of the person was sent. */
|
|
22
27
|
historyAt?: number;
|
|
23
28
|
/** The message in parts (CR-004): saved and reloaded as they are. Absent in chats saved before
|
|
@@ -19,6 +19,26 @@ export interface ThreadEvent {
|
|
|
19
19
|
href?: string;
|
|
20
20
|
/** Framework icon of what it was (default: none). */
|
|
21
21
|
icon?: string;
|
|
22
|
+
/** CR-020: still going on (an agent at work on it): a spinner in place of its icon. */
|
|
23
|
+
running?: boolean;
|
|
24
|
+
/** CR-021: its body shown at once (e.g. the questions an agent waits on), not behind a click. */
|
|
25
|
+
open?: boolean;
|
|
26
|
+
/** CR-021: buttons on the card, run by the host (`ThreadEventsSource.onAction`). */
|
|
27
|
+
actions?: ThreadEventAction[];
|
|
28
|
+
}
|
|
29
|
+
/** CR-021: a button on the card of an event. */
|
|
30
|
+
export interface ThreadEventAction {
|
|
31
|
+
id: string;
|
|
32
|
+
label: string;
|
|
33
|
+
icon?: string;
|
|
34
|
+
primary?: boolean;
|
|
35
|
+
}
|
|
36
|
+
/** CR-021: what an action of an event may do in the chat open in the panel. */
|
|
37
|
+
export interface ThreadEventChat {
|
|
38
|
+
/** Puts `text` in the field of the chat, for the person to change and send. */
|
|
39
|
+
compose(text: string): void;
|
|
40
|
+
/** Sends `text` as a message of the person. */
|
|
41
|
+
send(text: string): Promise<void>;
|
|
22
42
|
}
|
|
23
43
|
/** Where the panel reads the events of a chat (`<AgenticoProvider threadEvents>`). */
|
|
24
44
|
export interface ThreadEventsSource {
|
|
@@ -26,6 +46,8 @@ export interface ThreadEventsSource {
|
|
|
26
46
|
load(thread: string, from: number, to: number): ThreadEvent[] | Promise<ThreadEvent[]>;
|
|
27
47
|
/** Called when the events of `thread` may have changed: the panel reads them again. Returns the unsubscribe. */
|
|
28
48
|
subscribe?(thread: string, onChange: () => void): () => void;
|
|
49
|
+
/** CR-021: a button of the card of an event was clicked. */
|
|
50
|
+
onAction?(event: ThreadEvent, actionId: string, chat: ThreadEventChat): void | Promise<void>;
|
|
29
51
|
}
|
|
30
52
|
/** Each of the events among the turns of a log, by time: before the turn it came before. Turns without a time
|
|
31
53
|
* take the one of the turn before them; events after the last turn go at the end (index = turns). */
|
|
@@ -65,6 +65,8 @@ export interface AgenticoDict {
|
|
|
65
65
|
eventLess: string;
|
|
66
66
|
/** CR-019: opens the event where the host keeps it. */
|
|
67
67
|
eventOpen: string;
|
|
68
|
+
/** CR-020: an event still going on (its spinner). */
|
|
69
|
+
eventRunning: string;
|
|
68
70
|
/** CR-019: the filter in the header: show the events of the host, or the conversation only. */
|
|
69
71
|
showEvents: string;
|
|
70
72
|
hideEvents: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -17,7 +17,8 @@ export { jsonExportDestination, JSON_EXPORT_DESTINATION_ID } from './domain/json
|
|
|
17
17
|
export { registerDestinations, getDestinationRegistry } from './domain/destinationRegistry';
|
|
18
18
|
export { configureEntityChatStore, saveEntityChat, chatStartedAt, chatTitle, chatHasPersonMessage, renameEntityChat, onEntityChatsChange, syncEntityChats, hasEntityChatBackend, type EntityChatBackend, getEntityChat, listEntityChats, removeEntityChat, entityChatTaskId, type EntityChatSnapshot, type ChatAuthor, } from './domain/entityChatStore';
|
|
19
19
|
export { chatThreadOf, earlierSessions } from './domain/chatThread';
|
|
20
|
-
export { placeEvents, type ThreadEvent, type ThreadEventsSource } from './domain/threadEvents';
|
|
20
|
+
export { placeEvents, type ThreadEvent, type ThreadEventAction, type ThreadEventChat, type ThreadEventsSource } from './domain/threadEvents';
|
|
21
|
+
export { imagePreviews, PREVIEW_MAX, PREVIEW_LIMIT, type AttachmentPreview } from './presentation/imagePreview';
|
|
21
22
|
export { agenticoTranslations, agenticoEn, agenticoIt, agenticoDe, useAgenticoI18n, type AgenticoDict } from './i18n';
|
|
22
23
|
export { Agentico, AGENTICO_WIDTH, type AgenticoProps } from './presentation/Agentico';
|
|
23
24
|
export { AGENTICO_MIN_WIDTH, AGENTICO_MAX_WIDTH, AGENTICO_WIDTH_STORAGE_KEY, type AgenticoPanelSize } from './presentation/panelWidth';
|
|
@@ -248,6 +248,13 @@ interface AgenticoContextValue {
|
|
|
248
248
|
/** Apre il pannello incondizionatamente — a differenza di toggleOpen(), non dipende dal
|
|
249
249
|
* valore corrente di isOpen. */
|
|
250
250
|
openPanel: () => void;
|
|
251
|
+
/** CR-021: puts `text` in the field of the chat open in the panel (opening the panel), for the person to send. */
|
|
252
|
+
compose: (text: string) => void;
|
|
253
|
+
/** CR-021: the text last put in the field (`nonce` changes each time). */
|
|
254
|
+
draft: {
|
|
255
|
+
text: string;
|
|
256
|
+
nonce: number;
|
|
257
|
+
} | null;
|
|
251
258
|
/** Persiste (sovrascrivendo un'eventuale chat già salvata per la STESSA entità, vedi
|
|
252
259
|
* entityChatStore) la conversazione del task `taskId`, keyed su `${scopeId}:${subagentId}:
|
|
253
260
|
* ${entityId}` — chiamato da un componente (es. ThemeEditor) subito dopo un salvataggio
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** The longest side of a preview, in px. */
|
|
2
|
+
export declare const PREVIEW_MAX = 480;
|
|
3
|
+
/** The previews of one message at most: the chat stays small. */
|
|
4
|
+
export declare const PREVIEW_LIMIT = 4;
|
|
5
|
+
/** A preview of an image attached to a message: its name and a data URL. */
|
|
6
|
+
export interface AttachmentPreview {
|
|
7
|
+
name: string;
|
|
8
|
+
src: string;
|
|
9
|
+
}
|
|
10
|
+
/** The previews of the images among `files` (the first PREVIEW_LIMIT), none where the browser cannot draw one. */
|
|
11
|
+
export declare function imagePreviews(files: readonly File[], max?: number, limit?: number): Promise<AttachmentPreview[]>;
|
|
@@ -2,6 +2,7 @@ import type { AIConversationTurn, AIModelDescriptor } from '@llmnative/react';
|
|
|
2
2
|
import type { AgentDefinition, AgentExecutorModel, AgentModelGroupBadge } from '../domain/agentDefinition';
|
|
3
3
|
import { type AgentMessagePart, type AgentQuestionAnswer } from '../domain/messageParts';
|
|
4
4
|
import type { ChatAuthor } from '../domain/entityChatStore';
|
|
5
|
+
import { type AttachmentPreview } from './imagePreview';
|
|
5
6
|
/** Una voce del log di attività — o un messaggio dell'utente (il testo di sendMessage(),
|
|
6
7
|
* mostrato subito com'è, mai "sto pensando" perché non è il modello a scriverlo), o una tool
|
|
7
8
|
* call (etichetta SEMPRE deterministica/locale, vedi AgentTool.describeInvocation: mai testo
|
|
@@ -44,6 +45,8 @@ export interface AgentActivityEntry {
|
|
|
44
45
|
author?: ChatAuthor;
|
|
45
46
|
/** CR-019: when it was born (ms). Absent on entries saved before 0.18.0. */
|
|
46
47
|
at?: number;
|
|
48
|
+
/** CR-020: on a message of the person, small previews of the images attached to it, kept with the chat. */
|
|
49
|
+
attachmentPreviews?: AttachmentPreview[];
|
|
47
50
|
/** CR-016: on a message of the person, how many turns the history of the model had when it was sent:
|
|
48
51
|
* where the chat goes back to when the person retries or edits it. Absent on messages sent before
|
|
49
52
|
* 0.15.0 (no Retry from here on them). */
|
package/llms.txt
CHANGED
|
@@ -53,6 +53,8 @@ CR-013: `configureEntityChatStore({ storageKey, backend })` — `EntityChatBacke
|
|
|
53
53
|
CR-012: `executor.catalogReasoning(params, provider) → 'low' | 'medium' | 'high' | 'max' | undefined`: the turns of the chat on that provider of the catalog send `reasoning` on each request (@llmnative/react 1.46 maps it per provider).
|
|
54
54
|
CR-018: `SubagentManifest.thread(params)` makes the saved chats of the scope with the same key sessions of one chat: the panel shows the earlier ones above the open one, read-only (no questions, Retry or Edit), one more each time the person scrolls to the top or presses "Earlier session", each opened by a separator (title, start, "Continue this session" resumes it) and "This session" above the open one; the model reads only the open session. `SubagentManifest.speaker(params)` → `{ name, avatarUrl? }` puts the picture of the agent in a column on the left, its name next to it with a closed summary of the reasoning and steps before its text ("Reasoned for 4 s · 1 step", opened with a click), the text under them; `<AgenticoProvider person={{ name, avatarUrl? }}>` writes `author` on each message of the person (kept in the snapshot): their picture in the same column, Edit and Retry under it, the name above the full-width message; without a picture an `Identicon` of the name. `chatThreadOf(snapshot)`, `earlierSessions(scopeId, thread, openTaskId)`.
|
|
55
55
|
CR-019: `<AgenticoProvider threadEvents={source}>` (keep it memoized): `source.load(thread, from, to)` → `ThreadEvent[]` (`id`, `at` ms, `author` ChatAuthor, `title`, optional `body` Markdown, `badge`, `href`, `icon`), optional `source.subscribe(thread, onChange)` → unsubscribe. In a chat with a `thread` the panel shows them among the turns by time (`placeEvents`), as compact cards with the author's picture in the left column (opened: the body; a link to `href`); the open session from the last message of the session before it, each earlier one up to its last message. Header filter "Conversation only" (kept in this browser, `llmnative.agentico.threadEvents`). The model never reads them. Every entry of a chat now keeps `at` (when it was born); entries saved before 0.18.0 have none.
|
|
56
|
+
CR-020: the images attached to a message of the person stay in sight as previews (`entry.attachmentPreviews`: JPEG data URLs of at most 480 px a side, the first 4 images, drawn in the browser by `imagePreviews(files)` and kept with the chat); a click opens one larger; files without a preview stay as their names. `ThreadEvent.running: true` shows a spinner in place of its icon (an agent still at work on it).
|
|
57
|
+
CR-021: `ThreadEvent.open: true` shows its body at once; `ThreadEvent.actions: [{ id, label, icon?, primary? }]` are buttons on its card, run by `ThreadEventsSource.onAction(event, actionId, chat)`: `chat.compose(text)` puts a text in the field of the chat open in the panel (the person changes and sends it), `chat.send(text)` sends it as a message of the person (composed instead while a turn runs). `useAgentico().compose(text)` does the same anywhere (it opens the panel).
|
|
56
58
|
CR-011: `SubagentManifest.autoTitle: true` gives its saved chats a title from the model (after a turn; once per session for older ones; a model of the catalog the chat may use), drops conversational chats where the person never wrote; `snapshot.name`/`namedBy`, `chatTitle(snapshot)`, `renameEntityChat(scopeId, subagentId, entityId, title, 'person' | 'model')` (the person's wins; empty resets), `onEntityChatsChange(listener)`; the history has Rename.
|
|
57
59
|
|
|
58
60
|
Message parts (0.3.0): the turn also has `onText(text, { id?, done? })` (without id: the one reply, kept below steps and reasoning; with id: a text part of its own), `onReasoning(text, { id?, done?, duration? })` (whole text so far; shown closed, "Reasoned for N s", duration measured if not given), `onQuestions(questions, { id? }) → Promise<answers>` (questions `{ id?, header?, question, options?: [{ label, description? }], multiple?, recommended?, custom? }`; answers `[{ id?, header?, values: string[] }]`). Answers given while the turn runs resolve that promise; given later (or after a reload) they start a new turn with `text: ''` and `answers: { id, answers }` (id = the questions part id, default `questions-N`). Parts are kept in `AgentActivityEntry.parts` (`text` | `reasoning` | `tool` | `questions`, `detail` = the text) and saved with the chat; old chats without parts show `detail`. Rendered with `ChatMarkdown`, `ChatReasoning`, steps grouped in a `Tree`, `ChatQuestions` (needs `@llmnative/react` 1.34). `useAgent().answerQuestions(entryId, partId, answers)`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llmnative/agentico",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
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",
|