@llmnative/agentico 0.9.0 → 0.10.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.
@@ -33,6 +33,11 @@ export interface EntityChatSnapshot {
33
33
  /** CR-010: when it started (its first save), kept by every later save. Absent on a chat saved
34
34
  * before 0.9.0: read it with `chatStartedAt`. */
35
35
  startedAt?: number;
36
+ /** CR-011: its own title, written by the model from the chat or by the person; kept by every
37
+ * later save. Absent: `title` (from its params). Read it with `chatTitle`. */
38
+ name?: string;
39
+ /** Who wrote `name`: a title of the person is never replaced by one of the model. */
40
+ namedBy?: 'model' | 'person';
36
41
  /** Etichetta human-friendly dell'entità (es. il nome del tema) — usata dallo storico chat
37
42
  * di Agentico (vedi Agentico.tsx) per mostrare "cosa" senza dover rileggere l'entità stessa
38
43
  * dal suo DataProviderAdapter (che questo store, domain-side, non possiede). */
@@ -42,12 +47,27 @@ export interface EntityChatSnapshot {
42
47
  export declare function configureEntityChatStore(options: {
43
48
  storageKey: string;
44
49
  }): void;
50
+ /** CR-011: called when a chat is saved, renamed or removed (e.g. a list of the host reads them again). */
51
+ export declare function onEntityChatsChange(listener: () => void): () => void;
45
52
  /** La chat attualmente associata a un'entità — `null` se non ne è mai stata salvata una (o è
46
53
  * stata rimossa, vedi removeEntityChat). */
47
54
  export declare function getEntityChat(scopeId: string, subagentId: string, entityId: string): EntityChatSnapshot | null;
48
55
  /** Sovrascrive (o crea) la chat associata a questa entità — vedi il commento in testa al file
49
56
  * per perché è sempre un overwrite, mai un accumulo. Its start (CR-010) stays the one of its first save. */
50
- export declare function saveEntityChat(snapshot: Omit<EntityChatSnapshot, 'savedAt' | 'startedAt'>): void;
57
+ export declare function saveEntityChat(snapshot: Omit<EntityChatSnapshot, 'savedAt' | 'startedAt' | 'name' | 'namedBy'>): void;
58
+ /**
59
+ * CR-011: the title of a chat: its own (of the model or of the person), else the first message of the
60
+ * person (no model could write one, e.g. none the chat may use), else the one of its params.
61
+ */
62
+ export declare const chatTitle: (snapshot: Pick<EntityChatSnapshot, 'title' | 'name' | 'entityId' | 'activity'>) => string;
63
+ /** CR-011: whether the person wrote in a chat (an opening message counts). */
64
+ export declare const chatHasPersonMessage: (snapshot: Pick<EntityChatSnapshot, 'activity'>) => boolean;
65
+ /**
66
+ * CR-011: gives a chat its own title. The person's (`by: 'person'`) replaces any, and an empty one gives
67
+ * it back the automatic title; the model's never replaces the person's. False when the chat is gone or
68
+ * the title was not taken. Its last save (`savedAt`) does not change: a rename is no message.
69
+ */
70
+ export declare function renameEntityChat(scopeId: string, subagentId: string, entityId: string, title: string, by?: 'model' | 'person'): boolean;
51
71
  /** CR-010: when a chat started; a chat saved before 0.9.0, which does not know it: its last save. */
52
72
  export declare const chatStartedAt: (snapshot: Pick<EntityChatSnapshot, 'savedAt' | 'startedAt'>) => number;
53
73
  /** Rimuove la chat di un'entità — chiamata quando l'entità stessa viene eliminata, altrimenti
@@ -20,6 +20,8 @@ export interface AgenticoPrompts {
20
20
  closingSummary: string;
21
21
  /** Page context preamble when several subagents are anchored on the same page. */
22
22
  multipleCandidates: string;
23
+ /** CR-011: asks a title for a saved chat; `{chat}` = the chat, who wrote what. */
24
+ chatTitle: string;
23
25
  }
24
26
  export declare const agenticoPromptsEn: AgenticoPrompts;
25
27
  export declare const agenticoPromptsIt: AgenticoPrompts;
@@ -162,6 +162,13 @@ export interface SubagentManifest<TParams = any, TContext = any, TResult = any>
162
162
  * entityChatStore), so it is in the history and can be resumed on that entity (CR-003).
163
163
  * Absent = saved only when the host commits it (commitEntityChat), as before. */
164
164
  chatEntityId?(params: Record<string, unknown>): string | undefined;
165
+ /**
166
+ * CR-011: its saved chats get a title of their own from the model, read from the whole chat (after a
167
+ * turn; once per session for those saved before), and a conversational one where the person never
168
+ * wrote is not kept. The person may rename them (history, `renameEntityChat`). Absent: the title of
169
+ * `deriveHistoryTitle`, as before.
170
+ */
171
+ autoTitle?: boolean;
165
172
  /** true = the orchestrator offers this subagent only when the conversation is scoped to it,
166
173
  * i.e. a component anchored to it is on the page (CR-003): a subagent that makes sense on
167
174
  * one page only (e.g. the design of the project open there). Absent = offered everywhere. */
@@ -44,6 +44,10 @@ export interface AgenticoDict {
44
44
  /** `{label}` = subagent label */
45
45
  newInstance: string;
46
46
  chatHistory: string;
47
+ /** CR-011: renaming a saved chat. */
48
+ renameChat: string;
49
+ chatTitleLabel: string;
50
+ chatTitleHint: string;
47
51
  /** CR-010: the tooltip of a chat of the history, `{at}` its start and its last message. */
48
52
  chatStarted: string;
49
53
  chatLastMessage: string;
@@ -15,7 +15,7 @@ export { extractJsonBlock } from './domain/extractJsonBlock';
15
15
  export type { ResultDestination, DestinationContext, ResultDestinationOutcome } from './domain/resultDestination';
16
16
  export { jsonExportDestination, JSON_EXPORT_DESTINATION_ID } from './domain/jsonExportDestination';
17
17
  export { registerDestinations, getDestinationRegistry } from './domain/destinationRegistry';
18
- export { configureEntityChatStore, saveEntityChat, chatStartedAt, getEntityChat, listEntityChats, removeEntityChat, entityChatTaskId, type EntityChatSnapshot, } from './domain/entityChatStore';
18
+ export { configureEntityChatStore, saveEntityChat, chatStartedAt, chatTitle, chatHasPersonMessage, renameEntityChat, onEntityChatsChange, getEntityChat, listEntityChats, removeEntityChat, entityChatTaskId, type EntityChatSnapshot, } from './domain/entityChatStore';
19
19
  export { agenticoTranslations, agenticoEn, agenticoIt, agenticoDe, useAgenticoI18n, type AgenticoDict } from './i18n';
20
20
  export { Agentico, AGENTICO_WIDTH, type AgenticoProps } from './presentation/Agentico';
21
21
  export { AGENTICO_MIN_WIDTH, AGENTICO_MAX_WIDTH, AGENTICO_WIDTH_STORAGE_KEY, type AgenticoPanelSize } from './presentation/panelWidth';
@@ -0,0 +1,16 @@
1
+ import type { AIModelDescriptor, AIProviderAdapter } from '@llmnative/react';
2
+ import type { SubagentManifest } from '../domain/subagentManifest';
3
+ import { type EntityChatSnapshot } from '../domain/entityChatStore';
4
+ /** What the model reads of a chat: who wrote what, in order; the middle of a long one left out. */
5
+ export declare function chatTranscript(activity: EntityChatSnapshot['activity'], max?: number): string;
6
+ /** The title as the model wrote it: one line, without quotes, a heading mark or a final dot. */
7
+ export declare function cleanTitle(raw: string): string;
8
+ /** The model a chat is titled with: `preferred` when the chat may use it, else its first allowed one. */
9
+ export declare function titleModel(manifest: SubagentManifest, params: Record<string, unknown>, preferred: string | undefined, modelsByProvider: Record<string, AIModelDescriptor[]>, registry: Record<string, AIProviderAdapter>): string | undefined;
10
+ /**
11
+ * Titles chats with the AI catalog of the app: `titleChat` for one (after a turn), and once per scope and
12
+ * session the chats already saved without a title (those where the person never wrote are removed).
13
+ */
14
+ export declare function useChatTitles(scopeId: string | undefined): (subagentId: string, entityId: string, preferred?: string) => Promise<boolean>;
15
+ /** For the tests: the pass runs again. */
16
+ export declare const resetChatTitlesPass: () => void;
package/llms.txt CHANGED
@@ -45,5 +45,6 @@ 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-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.
48
49
 
49
50
  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.9.0",
3
+ "version": "0.10.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",