@llmnative/agentico 0.19.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.
@@ -21,6 +21,24 @@ export interface ThreadEvent {
21
21
  icon?: string;
22
22
  /** CR-020: still going on (an agent at work on it): a spinner in place of its icon. */
23
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>;
24
42
  }
25
43
  /** Where the panel reads the events of a chat (`<AgenticoProvider threadEvents>`). */
26
44
  export interface ThreadEventsSource {
@@ -28,6 +46,8 @@ export interface ThreadEventsSource {
28
46
  load(thread: string, from: number, to: number): ThreadEvent[] | Promise<ThreadEvent[]>;
29
47
  /** Called when the events of `thread` may have changed: the panel reads them again. Returns the unsubscribe. */
30
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>;
31
51
  }
32
52
  /** Each of the events among the turns of a log, by time: before the turn it came before. Turns without a time
33
53
  * take the one of the turn before them; events after the last turn go at the end (index = turns). */
@@ -17,7 +17,7 @@ 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
21
  export { imagePreviews, PREVIEW_MAX, PREVIEW_LIMIT, type AttachmentPreview } from './presentation/imagePreview';
22
22
  export { agenticoTranslations, agenticoEn, agenticoIt, agenticoDe, useAgenticoI18n, type AgenticoDict } from './i18n';
23
23
  export { Agentico, AGENTICO_WIDTH, type AgenticoProps } from './presentation/Agentico';
@@ -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
package/llms.txt CHANGED
@@ -54,6 +54,7 @@ CR-012: `executor.catalogReasoning(params, provider) → 'low' | 'medium' | 'hig
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
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).
57
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.
58
59
 
59
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.19.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",