@llmnative/agentico 0.16.1 → 0.17.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 +117 -116
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1248 -1046
- package/dist/index.mjs.map +1 -1
- package/dist/types/domain/chatThread.d.ts +8 -0
- package/dist/types/domain/entityChatStore.d.ts +7 -0
- package/dist/types/domain/subagentManifest.d.ts +10 -0
- package/dist/types/i18n/types.d.ts +8 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/presentation/AgentActivityLog.d.ts +12 -1
- package/dist/types/presentation/AgenticoContext.d.ts +11 -2
- package/dist/types/presentation/EarlierSessions.d.ts +17 -0
- package/dist/types/presentation/useAgent.d.ts +5 -0
- package/llms.txt +57 -56
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type EntityChatSnapshot } from './entityChatStore';
|
|
2
|
+
/** The chat a saved chat is a session of: the key its subagent gives (`SubagentManifest.thread`), if any. */
|
|
3
|
+
export declare function chatThreadOf(chat: Pick<EntityChatSnapshot, 'subagentId' | 'params'>): string | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* The sessions of a chat before the open one, the latest first: the saved chats of the scope with the same
|
|
6
|
+
* key, started before it (all of them for a chat not saved yet), the open one left out.
|
|
7
|
+
*/
|
|
8
|
+
export declare function earlierSessions(scopeId: string, thread: string, openTaskId: string | undefined): EntityChatSnapshot[];
|
|
@@ -14,12 +14,19 @@ 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-018: who wrote this message of the person (AgenticoProvider `person`). */
|
|
18
|
+
author?: ChatAuthor;
|
|
17
19
|
/** CR-016: the length of the history of the model when this message of the person was sent. */
|
|
18
20
|
historyAt?: number;
|
|
19
21
|
/** The message in parts (CR-004): saved and reloaded as they are. Absent in chats saved before
|
|
20
22
|
* 0.3.0, which show `detail` as before. */
|
|
21
23
|
parts?: AgentMessagePart[];
|
|
22
24
|
}
|
|
25
|
+
/** CR-018: who speaks in a chat, a person or an agent: a name and, when there is one, a picture. */
|
|
26
|
+
export interface ChatAuthor {
|
|
27
|
+
name: string;
|
|
28
|
+
avatarUrl?: string;
|
|
29
|
+
}
|
|
23
30
|
export interface EntityChatSnapshot {
|
|
24
31
|
/** Host scope (tenant, company…) the chat belongs to — see AgenticoScope. */
|
|
25
32
|
scopeId: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
|
+
import type { ChatAuthor } from './entityChatStore';
|
|
2
3
|
import type { AgentDefinition } from './agentDefinition';
|
|
3
4
|
/** Una singola capability offerta dal subagent (oggi quasi sempre una sola per manifest). */
|
|
4
5
|
export interface SubagentCommand {
|
|
@@ -169,6 +170,15 @@ export interface SubagentManifest<TParams = any, TContext = any, TResult = any>
|
|
|
169
170
|
* `deriveHistoryTitle`, as before.
|
|
170
171
|
*/
|
|
171
172
|
autoTitle?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* CR-018: the chat its saved chats are sessions of, from their raw params (e.g. the project). The
|
|
175
|
+
* saved chats of the scope with the same key, of any subagent, are one chat: the panel shows the
|
|
176
|
+
* earlier sessions above the open one, read-only, loaded as the person scrolls up. Each session
|
|
177
|
+
* keeps its own context: the model never reads the others. Absent: each chat stands alone.
|
|
178
|
+
*/
|
|
179
|
+
thread?(params: Record<string, unknown>): string | undefined;
|
|
180
|
+
/** CR-018: who answers in its chats (its name and picture), shown at the start of each of its turns. */
|
|
181
|
+
speaker?(params: Record<string, unknown>): ChatAuthor | undefined;
|
|
172
182
|
/** true = the orchestrator offers this subagent only when the conversation is scoped to it,
|
|
173
183
|
* i.e. a component anchored to it is on the page (CR-003): a subagent that makes sense on
|
|
174
184
|
* one page only (e.g. the design of the project open there). Absent = offered everywhere. */
|
|
@@ -44,6 +44,14 @@ export interface AgenticoDict {
|
|
|
44
44
|
/** `{label}` = subagent label */
|
|
45
45
|
newInstance: string;
|
|
46
46
|
chatHistory: string;
|
|
47
|
+
/** CR-018: the button that loads the session before (also loaded by scrolling to the top). */
|
|
48
|
+
earlierSession: string;
|
|
49
|
+
/** CR-018: the separator above the open session, once earlier ones are shown. */
|
|
50
|
+
thisSession: string;
|
|
51
|
+
/** CR-018: takes up an earlier session (its own context). */
|
|
52
|
+
continueSession: string;
|
|
53
|
+
/** CR-018: the separator of an earlier session without a title; `{at}` its start. */
|
|
54
|
+
sessionOf: string;
|
|
47
55
|
/** CR-011: renaming a saved chat. */
|
|
48
56
|
/** CR-014: the whole text of a card, and closing it. */
|
|
49
57
|
cardView: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -15,7 +15,8 @@ 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, chatTitle, chatHasPersonMessage, renameEntityChat, onEntityChatsChange, syncEntityChats, hasEntityChatBackend, type EntityChatBackend, getEntityChat, listEntityChats, removeEntityChat, entityChatTaskId, type EntityChatSnapshot, } from './domain/entityChatStore';
|
|
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
|
+
export { chatThreadOf, earlierSessions } from './domain/chatThread';
|
|
19
20
|
export { agenticoTranslations, agenticoEn, agenticoIt, agenticoDe, useAgenticoI18n, type AgenticoDict } from './i18n';
|
|
20
21
|
export { Agentico, AGENTICO_WIDTH, type AgenticoProps } from './presentation/Agentico';
|
|
21
22
|
export { AGENTICO_MIN_WIDTH, AGENTICO_MAX_WIDTH, AGENTICO_WIDTH_STORAGE_KEY, type AgenticoPanelSize } from './presentation/panelWidth';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ChatAuthor } from '../domain/entityChatStore';
|
|
1
2
|
import type { AgentActivityEntry } from './useAgent';
|
|
2
3
|
import type { AgentCardPart, AgentQuestionAnswer, AgentQuestionsPart } from '../domain/messageParts';
|
|
3
4
|
/** Bolla utente — collassabile SOLO se il testo eccede l'altezza di soglia (misurato via ref,
|
|
@@ -22,6 +23,11 @@ export interface UserMessageActions {
|
|
|
22
23
|
onRetry: (entry: AgentActivityEntry) => void;
|
|
23
24
|
onEdit: (entry: AgentActivityEntry) => void;
|
|
24
25
|
}
|
|
26
|
+
/** CR-018: the picture of who speaks: theirs, else an icon drawn from their name. */
|
|
27
|
+
export declare function ChatAvatar({ author, size }: {
|
|
28
|
+
author: ChatAuthor;
|
|
29
|
+
size?: number;
|
|
30
|
+
}): import("react").JSX.Element;
|
|
25
31
|
/** What the log needs to let the person answer questions (CR-004): the entries of the live
|
|
26
32
|
* conversation (`canAnswer`) and where the answers go. Without it, unanswered questions are shown
|
|
27
33
|
* disabled. */
|
|
@@ -67,8 +73,13 @@ export declare function QuestionsPart({ entry, part, questions, autoFocus, class
|
|
|
67
73
|
* One `<li>` per turn (CR-004): the message of the person, sticky at the top while its turn
|
|
68
74
|
* scrolls, then what the agent did and said. Entries before the first message of the person
|
|
69
75
|
* (an opening without text) form a turn of their own, without a bubble. */
|
|
70
|
-
export declare function AgentActivityLog({ activity, questions, docked, pinUserMessages, messageActions }: {
|
|
76
|
+
export declare function AgentActivityLog({ activity, questions, docked, pinUserMessages, messageActions, speaker, showAuthors }: {
|
|
71
77
|
activity: AgentActivityEntry[];
|
|
78
|
+
/** CR-018: who answers, shown at the start of each turn of the agent. */
|
|
79
|
+
speaker?: ChatAuthor;
|
|
80
|
+
/** CR-018: the picture of who wrote each message of a person, on its left. Default: when there is a
|
|
81
|
+
* `speaker` or a message with an `author` (a chat that shows who speaks). */
|
|
82
|
+
showAuthors?: boolean;
|
|
72
83
|
/** CR-016: Retry from here and Edit on the messages of the person. */
|
|
73
84
|
messageActions?: UserMessageActions;
|
|
74
85
|
questions?: AgentActivityLogQuestions;
|
|
@@ -3,7 +3,7 @@ import type { AIModelDescriptor, ChatbotAction, DataProviderAdapter, EditorComma
|
|
|
3
3
|
import type { AgentActivityEntry, AgentConversation } from './useAgent';
|
|
4
4
|
import type { ResultDestination } from '../domain/resultDestination';
|
|
5
5
|
import type { SubagentUsageCard } from '../domain/subagentUsageCard';
|
|
6
|
-
import { type EntityChatSnapshot } from '../domain/entityChatStore';
|
|
6
|
+
import { type ChatAuthor, type EntityChatSnapshot } from '../domain/entityChatStore';
|
|
7
7
|
/** Where results are saved and chats are kept: the host's current tenant, company, workspace…
|
|
8
8
|
* `null` while the host has none selected — destinations then refuse to save. */
|
|
9
9
|
export interface AgenticoScope {
|
|
@@ -94,6 +94,11 @@ export interface AgenticoTask<TResult = unknown> {
|
|
|
94
94
|
* top=vecchio/bottom=nuovo (bug segnalato). Assente = comportamento invariato, sempre in
|
|
95
95
|
* fondo (equivalente a passare la lunghezza corrente del log). */
|
|
96
96
|
panelExtraAnchorIndex?: number;
|
|
97
|
+
/** CR-018: the chat this one is a session of (SubagentManifest.thread): the panel shows the earlier
|
|
98
|
+
* sessions above it. */
|
|
99
|
+
thread?: string;
|
|
100
|
+
/** CR-018: who answers in this chat (SubagentManifest.speaker), shown at the start of its turns. */
|
|
101
|
+
speaker?: ChatAuthor;
|
|
97
102
|
/** What the host shows at the bottom of the panel, above the composer, while the task is open
|
|
98
103
|
* (see registerSubagentControls, CR-003). */
|
|
99
104
|
panelActions?: React.ReactNode;
|
|
@@ -143,6 +148,8 @@ export interface ComponentAnchor {
|
|
|
143
148
|
interface AgenticoContextValue {
|
|
144
149
|
/** The host scope passed to <AgenticoProvider scope>. */
|
|
145
150
|
scope: AgenticoScope | null;
|
|
151
|
+
/** CR-018: the person using the panel (<AgenticoProvider person>): the author of their messages. */
|
|
152
|
+
person: ChatAuthor | null;
|
|
146
153
|
task: AgenticoTask | null;
|
|
147
154
|
/** Visibilità del pannello — completamente indipendente dal task (vedi AgenticoToggle:
|
|
148
155
|
* icona persistente stile "estensione del browser"). Nessuna chiamata a `openTask` la forza
|
|
@@ -320,9 +327,11 @@ interface AgenticoContextValue {
|
|
|
320
327
|
/** Changes at every startSubagent() — React `key` of that SubagentRunner. */
|
|
321
328
|
startRunId: string | null;
|
|
322
329
|
}
|
|
323
|
-
export declare function AgenticoProvider({ children, scope }: {
|
|
330
|
+
export declare function AgenticoProvider({ children, scope, person }: {
|
|
324
331
|
children: React.ReactNode;
|
|
325
332
|
scope?: AgenticoScope | null;
|
|
333
|
+
/** CR-018: who uses the panel: their messages carry their name and picture, kept with the chat. */
|
|
334
|
+
person?: ChatAuthor | null;
|
|
326
335
|
}): React.JSX.Element;
|
|
327
336
|
export declare function useAgentico(): AgenticoContextValue;
|
|
328
337
|
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type EntityChatSnapshot } from '../domain/entityChatStore';
|
|
3
|
+
export declare function EarlierSessions({ scopeId, thread, taskId, scrollRef, onLoad, onContinue, busy }: {
|
|
4
|
+
scopeId: string;
|
|
5
|
+
/** The chat the open one is a session of. */
|
|
6
|
+
thread: string;
|
|
7
|
+
/** The task of the open session: left out, and only the sessions started before it. */
|
|
8
|
+
taskId: string;
|
|
9
|
+
/** The scrolling body of the panel: its position stays where it was when a session is added above. */
|
|
10
|
+
scrollRef: React.RefObject<HTMLDivElement | null>;
|
|
11
|
+
/** Called before a session is added above (the panel stops following the bottom). */
|
|
12
|
+
onLoad?: () => void;
|
|
13
|
+
/** Takes up an earlier session. */
|
|
14
|
+
onContinue: (chat: EntityChatSnapshot) => void;
|
|
15
|
+
/** A turn of the open session runs: it is not left meanwhile. */
|
|
16
|
+
busy?: boolean;
|
|
17
|
+
}): React.JSX.Element | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
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
|
+
import type { ChatAuthor } from '../domain/entityChatStore';
|
|
4
5
|
/** Una voce del log di attività — o un messaggio dell'utente (il testo di sendMessage(),
|
|
5
6
|
* mostrato subito com'è, mai "sto pensando" perché non è il modello a scriverlo), o una tool
|
|
6
7
|
* call (etichetta SEMPRE deterministica/locale, vedi AgentTool.describeInvocation: mai testo
|
|
@@ -39,6 +40,8 @@ export interface AgentActivityEntry {
|
|
|
39
40
|
attachmentNames?: string[];
|
|
40
41
|
/** A message the Retry button sent for the person (never the title of the chat). */
|
|
41
42
|
retry?: boolean;
|
|
43
|
+
/** CR-018: on a message of the person, who wrote it (the `author` of useAgent). */
|
|
44
|
+
author?: ChatAuthor;
|
|
42
45
|
/** CR-016: on a message of the person, how many turns the history of the model had when it was sent:
|
|
43
46
|
* where the chat goes back to when the person retries or edits it. Absent on messages sent before
|
|
44
47
|
* 0.15.0 (no Retry from here on them). */
|
|
@@ -182,4 +185,6 @@ export type AgentConversation<TResult> = Pick<UseAgentResult<never, TResult>, 'c
|
|
|
182
185
|
export declare function settleActivity(activity: AgentActivityEntry[]): AgentActivityEntry[];
|
|
183
186
|
export declare function useAgent<TParams, TContext, TResult>(definition: AgentDefinition<TParams, TContext, TResult>, options?: {
|
|
184
187
|
defaultEnabled?: boolean;
|
|
188
|
+
/** CR-018: who writes the messages of the person (AgenticoProvider `person`), kept on each of them. */
|
|
189
|
+
author?: ChatAuthor;
|
|
185
190
|
}): UseAgentResult<TParams, TResult>;
|
package/llms.txt
CHANGED
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
# @llmnative/agentico
|
|
2
|
-
|
|
3
|
-
> Agentic chat orchestrator for @llmnative/react apps. A persistent panel: the orchestrator
|
|
4
|
-
> collects parameters in conversation and hands the work to host-registered subagents. Every
|
|
5
|
-
> subagent has a deterministic fallback. Agentico knows nothing concrete about the host.
|
|
6
|
-
|
|
7
|
-
## Host responsibilities (startup)
|
|
8
|
-
|
|
9
|
-
- `registerSubagents(manifests)` — SubagentManifest: id, label, icon, description, indexPath, commands (name, summary, Zod inputSchema, describeOutput), definition (AgentDefinition), toParams, destinationIds, optional crossAgentToolIds, withCollected, manualEntry, componentContexts, chatEntityId (chat saved at every turn under that entity), onlyWhenAnchored (offered by the orchestrator only when scoped to it).
|
|
10
|
-
- `registerDestinations({ id: ResultDestination })` — apply(result, { scopeId, dataProvider, storageProvider, proxyFetch }, meta).
|
|
11
|
-
- `registerSubagentReports({ subagentId: SubagentReportModule })`.
|
|
12
|
-
- `registerSubagentControls({ subagentId: useControls })` — a hook of the host per task (props: params, taskId, running, close) returning `{ actions?: ChatbotAction[] (with onClick), commands?: EditorCommand[], content?: ReactNode }`, memoized: actions in the prompt, slash commands on `/` (a command without handler inserts `/name `; the turn gets it as plain `text`, the host decides what it means; hidden while docked questions replace the composer), content above it.
|
|
13
|
-
- `SubagentManifest.onArchive(entityId, params)` / `confirmArchive(entityId, params)` — archiving a chat from the history (hover icon).
|
|
14
|
-
- `registerCrossAgentTools((ctx) => AgentTool[])` — ctx: attachmentsRef, collected (per-conversation scratchpad), proxyFetch.
|
|
15
|
-
- `configureAgenticoPrompts(partial)` — model-facing pack; `agenticoPromptsEn` (default) / `agenticoPromptsIt`.
|
|
16
|
-
- `configureEntityChatStore({ storageKey })`.
|
|
17
|
-
- i18n: merge `agenticoTranslations.<locale>` into `<App i18n={{ translations }}>`; override any `agentico.*` key.
|
|
18
|
-
|
|
19
|
-
## Mount
|
|
20
|
-
|
|
21
|
-
```tsx
|
|
22
|
-
<AgenticoProvider scope={{ id, dataProvider, storageProvider } | null}>
|
|
23
|
-
<AgenticoToggle />
|
|
24
|
-
<Agentico />
|
|
25
|
-
</AgenticoProvider>
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
`<Agentico defaultWidth? minWidth? maxWidth? onWidthChange? />` (0.4.0): the column is resized by dragging its inner edge (a `role="separator"`: arrows by 16 px, Shift ×4, Home/End, double click = default), clamped to `minWidth` (320) … `maxWidth` (px or `'<n>vw'`, default `'60vw'`), stored per browser under `agentico:panel-width`. Defaults `AGENTICO_WIDTH` (420), `AGENTICO_MIN_WIDTH`, `AGENTICO_MAX_WIDTH`. Unanswered questions of the latest agent message (turn not stopped/failed) are docked at the bottom in place of the composer (scroll inside, Stop while the turn runs), the person's message is not pinned meanwhile; once answered they are back in the thread, read-only. Questions of a reloaded chat are answerable (docked) too.
|
|
29
|
-
|
|
30
|
-
## Hooks
|
|
31
|
-
|
|
32
|
-
- `useAgentico()` — panel state, `startOrchestrator(goal, opts)`, `startSubagent(subagentId, params, { taskId?, openingMessage? })` (use `entityChatTaskId(subagentId, entityId)` as taskId), `resumeEntityChat`, `commitEntityChat(subagentId, entityId, taskId, scopeId, params, title)`, `scope`.
|
|
33
|
-
- `useAgenticoPageContext(text, card?)` — what the user is looking at.
|
|
34
|
-
- `useSubagentComponentContext(subagentId, componentKey)` — anchor a component to a subagent.
|
|
35
|
-
- `useAgent(definition)` — run an AgentDefinition directly.
|
|
36
|
-
|
|
37
|
-
## AgentDefinition
|
|
38
|
-
|
|
39
|
-
buildContext (always runs) · buildPrompt · buildFollowUpPrompt · parseResponse (null → fallback) · fallback (required) · describeFallback? · getTools? · microPromptIds? · conversational? · executor?
|
|
40
|
-
|
|
41
|
-
`conversational: true` (0.6.0): each text reply of the model is a text part of its turn (a message of the chat), and the subagent keeps no result: no preview, no destinations under the chat. For a chat with tools and nothing to apply.
|
|
42
|
-
|
|
43
|
-
`AgentTool.needsApproval: true | (input) => boolean` (0.7.0): the call waits for the person on a docked question "Approve? <describeApproval(input)>" (Approve / Reject + reason); rejected, the tool does not run and the model reads the prompt `toolRejected` with the reason.
|
|
44
|
-
|
|
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
|
-
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
|
-
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-017: `executor.attachments: true` offers attachments on the models of the executor; the turn gets `attachments: AIAttachment[]` (name, mimeType, base64). Going back sends the text again, not the files.
|
|
49
|
-
CR-016: Edit on a message of the person (on hover), Retry on one whose answer was cut (stopped, failed; also the Retry of the error bar): `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).
|
|
50
|
-
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.
|
|
51
|
-
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)`.
|
|
52
|
-
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.
|
|
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
|
-
CR-
|
|
55
|
-
|
|
56
|
-
|
|
1
|
+
# @llmnative/agentico
|
|
2
|
+
|
|
3
|
+
> Agentic chat orchestrator for @llmnative/react apps. A persistent panel: the orchestrator
|
|
4
|
+
> collects parameters in conversation and hands the work to host-registered subagents. Every
|
|
5
|
+
> subagent has a deterministic fallback. Agentico knows nothing concrete about the host.
|
|
6
|
+
|
|
7
|
+
## Host responsibilities (startup)
|
|
8
|
+
|
|
9
|
+
- `registerSubagents(manifests)` — SubagentManifest: id, label, icon, description, indexPath, commands (name, summary, Zod inputSchema, describeOutput), definition (AgentDefinition), toParams, destinationIds, optional crossAgentToolIds, withCollected, manualEntry, componentContexts, chatEntityId (chat saved at every turn under that entity), onlyWhenAnchored (offered by the orchestrator only when scoped to it).
|
|
10
|
+
- `registerDestinations({ id: ResultDestination })` — apply(result, { scopeId, dataProvider, storageProvider, proxyFetch }, meta).
|
|
11
|
+
- `registerSubagentReports({ subagentId: SubagentReportModule })`.
|
|
12
|
+
- `registerSubagentControls({ subagentId: useControls })` — a hook of the host per task (props: params, taskId, running, close) returning `{ actions?: ChatbotAction[] (with onClick), commands?: EditorCommand[], content?: ReactNode }`, memoized: actions in the prompt, slash commands on `/` (a command without handler inserts `/name `; the turn gets it as plain `text`, the host decides what it means; hidden while docked questions replace the composer), content above it.
|
|
13
|
+
- `SubagentManifest.onArchive(entityId, params)` / `confirmArchive(entityId, params)` — archiving a chat from the history (hover icon).
|
|
14
|
+
- `registerCrossAgentTools((ctx) => AgentTool[])` — ctx: attachmentsRef, collected (per-conversation scratchpad), proxyFetch.
|
|
15
|
+
- `configureAgenticoPrompts(partial)` — model-facing pack; `agenticoPromptsEn` (default) / `agenticoPromptsIt`.
|
|
16
|
+
- `configureEntityChatStore({ storageKey })`.
|
|
17
|
+
- i18n: merge `agenticoTranslations.<locale>` into `<App i18n={{ translations }}>`; override any `agentico.*` key.
|
|
18
|
+
|
|
19
|
+
## Mount
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
<AgenticoProvider scope={{ id, dataProvider, storageProvider } | null}>
|
|
23
|
+
<AgenticoToggle />
|
|
24
|
+
<Agentico />
|
|
25
|
+
</AgenticoProvider>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`<Agentico defaultWidth? minWidth? maxWidth? onWidthChange? />` (0.4.0): the column is resized by dragging its inner edge (a `role="separator"`: arrows by 16 px, Shift ×4, Home/End, double click = default), clamped to `minWidth` (320) … `maxWidth` (px or `'<n>vw'`, default `'60vw'`), stored per browser under `agentico:panel-width`. Defaults `AGENTICO_WIDTH` (420), `AGENTICO_MIN_WIDTH`, `AGENTICO_MAX_WIDTH`. Unanswered questions of the latest agent message (turn not stopped/failed) are docked at the bottom in place of the composer (scroll inside, Stop while the turn runs), the person's message is not pinned meanwhile; once answered they are back in the thread, read-only. Questions of a reloaded chat are answerable (docked) too.
|
|
29
|
+
|
|
30
|
+
## Hooks
|
|
31
|
+
|
|
32
|
+
- `useAgentico()` — panel state, `startOrchestrator(goal, opts)`, `startSubagent(subagentId, params, { taskId?, openingMessage? })` (use `entityChatTaskId(subagentId, entityId)` as taskId), `resumeEntityChat`, `commitEntityChat(subagentId, entityId, taskId, scopeId, params, title)`, `scope`.
|
|
33
|
+
- `useAgenticoPageContext(text, card?)` — what the user is looking at.
|
|
34
|
+
- `useSubagentComponentContext(subagentId, componentKey)` — anchor a component to a subagent.
|
|
35
|
+
- `useAgent(definition)` — run an AgentDefinition directly.
|
|
36
|
+
|
|
37
|
+
## AgentDefinition
|
|
38
|
+
|
|
39
|
+
buildContext (always runs) · buildPrompt · buildFollowUpPrompt · parseResponse (null → fallback) · fallback (required) · describeFallback? · getTools? · microPromptIds? · conversational? · executor?
|
|
40
|
+
|
|
41
|
+
`conversational: true` (0.6.0): each text reply of the model is a text part of its turn (a message of the chat), and the subagent keeps no result: no preview, no destinations under the chat. For a chat with tools and nothing to apply.
|
|
42
|
+
|
|
43
|
+
`AgentTool.needsApproval: true | (input) => boolean` (0.7.0): the call waits for the person on a docked question "Approve? <describeApproval(input)>" (Approve / Reject + reason); rejected, the tool does not run and the model reads the prompt `toolRejected` with the reason.
|
|
44
|
+
|
|
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
|
+
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
|
+
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-017: `executor.attachments: true` offers attachments on the models of the executor; the turn gets `attachments: AIAttachment[]` (name, mimeType, base64). Going back sends the text again, not the files.
|
|
49
|
+
CR-016: Edit on a message of the person (on hover), Retry on one whose answer was cut (stopped, failed; also the Retry of the error bar): `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).
|
|
50
|
+
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.
|
|
51
|
+
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)`.
|
|
52
|
+
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.
|
|
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
|
+
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? }` starts each turn of the agent with its picture and name; `<AgenticoProvider person={{ name, avatarUrl? }}>` writes `author` on each message of the person (kept in the snapshot, shown next to the bubble); without a picture an `Identicon` of the name. `chatThreadOf(snapshot)`, `earlierSessions(scopeId, thread, openTaskId)`.
|
|
55
|
+
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.
|
|
56
|
+
|
|
57
|
+
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.17.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",
|