@llmnative/agentico 0.6.0 → 0.8.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 +9 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +423 -319
- package/dist/index.mjs.map +1 -1
- package/dist/types/domain/agentDefinition.d.ts +31 -5
- package/dist/types/domain/approval.d.ts +13 -0
- package/dist/types/domain/prompts.d.ts +2 -0
- package/dist/types/i18n/types.d.ts +4 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/presentation/useAgent.d.ts +10 -7
- package/llms.txt +3 -0
- package/package.json +1 -1
|
@@ -39,6 +39,13 @@ export interface AgentTool {
|
|
|
39
39
|
* scritta due volte una sopra l'altra. Assente = ripiega su describeInvocation (meglio
|
|
40
40
|
* di niente, ma con la ripetizione). */
|
|
41
41
|
describeIntent?: string;
|
|
42
|
+
/** true (or true for this input) = the tool runs only once the person approves it (CR-008): the turn
|
|
43
|
+
* stops on a question docked at the bottom of the chat, Approve / Reject with a reason. Rejected,
|
|
44
|
+
* the tool does not run and the model is told why. For what stops work, spends or cannot be undone. */
|
|
45
|
+
needsApproval?: boolean | ((input: Record<string, unknown>) => boolean);
|
|
46
|
+
/** What the tool is about to do, said to the person in the approval (e.g. "Close #141: duplicate of
|
|
47
|
+
* #139"). Absent = `describeInvocation`, else the name of the tool. */
|
|
48
|
+
describeApproval?: (input: Record<string, unknown>) => string;
|
|
42
49
|
}
|
|
43
50
|
export interface AgentDefinition<TParams, TContext, TResult> {
|
|
44
51
|
/** Gira sempre, con o senza AI — estrazione/parsing deterministico dei dati grezzi. */
|
|
@@ -149,6 +156,18 @@ export interface AgentExecutorPartOptions {
|
|
|
149
156
|
/** The part is complete: no longer streaming. */
|
|
150
157
|
done?: boolean;
|
|
151
158
|
}
|
|
159
|
+
/** A badge on the right of the header of a group of models (CR-009, CR-121 of the framework). */
|
|
160
|
+
export type AgentModelGroupBadge = {
|
|
161
|
+
label: string;
|
|
162
|
+
variant?: 'info' | 'success' | 'warning' | 'danger' | 'primary' | 'secondary' | 'light' | 'dark';
|
|
163
|
+
};
|
|
164
|
+
/** A model an executor offers in the composer. */
|
|
165
|
+
export type AgentExecutorModel = {
|
|
166
|
+
label: string;
|
|
167
|
+
value: string;
|
|
168
|
+
group?: string;
|
|
169
|
+
groupBadge?: AgentModelGroupBadge;
|
|
170
|
+
};
|
|
152
171
|
/** The host side of a remote agent: one call per turn, resolved when its reply is complete. */
|
|
153
172
|
export interface AgentExecutor<TParams, TContext, TResult> {
|
|
154
173
|
turn(turn: AgentExecutorTurn<TParams, TContext>): Promise<{
|
|
@@ -157,11 +176,18 @@ export interface AgentExecutor<TParams, TContext, TResult> {
|
|
|
157
176
|
}>;
|
|
158
177
|
/** The models the person can pick in the composer, at any time: what one means is the host's
|
|
159
178
|
* (e.g. the model of the remote session from the next message). Absent = no picker. */
|
|
160
|
-
models?(params: TParams):
|
|
161
|
-
label: string;
|
|
162
|
-
value: string;
|
|
163
|
-
group?: string;
|
|
164
|
-
}>;
|
|
179
|
+
models?(params: TParams): AgentExecutorModel[];
|
|
165
180
|
/** The model picked at first, e.g. the one the remote session runs with. */
|
|
166
181
|
defaultModel?(params: TParams): string | undefined;
|
|
182
|
+
/**
|
|
183
|
+
* CR-009: the agent stays an agent of the AI catalog of the app (its prompts, its tools, its approvals)
|
|
184
|
+
* and the executor answers only the turns whose model is one of its own; the composer offers both.
|
|
185
|
+
* `first` of a turn of the executor: its first turn in the chat.
|
|
186
|
+
*/
|
|
187
|
+
alongside?: boolean;
|
|
188
|
+
/** CR-009: the group (and its badge) the models of the AI catalog are listed under, next to the executor's. */
|
|
189
|
+
catalogGroup?(provider: string, label: string): {
|
|
190
|
+
group: string;
|
|
191
|
+
badge?: AgentModelGroupBadge;
|
|
192
|
+
};
|
|
167
193
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AgentTool } from './agentDefinition';
|
|
2
|
+
import type { AgentQuestionAnswer } from './messageParts';
|
|
3
|
+
/** The id of the questions part of an approval, in its own message. */
|
|
4
|
+
export declare const APPROVAL_PART_ID = "approval";
|
|
5
|
+
/** What the person decided, and what they wrote besides the choice. */
|
|
6
|
+
export interface ApprovalDecision {
|
|
7
|
+
approved: boolean;
|
|
8
|
+
reason?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Whether this call of the tool waits for the person. */
|
|
11
|
+
export declare function needsApproval(tool: AgentTool, input: Record<string, unknown>): boolean;
|
|
12
|
+
/** The decision in the answer: approved only when Approve was chosen; any free text is the reason. */
|
|
13
|
+
export declare function approvalOf(answers: readonly AgentQuestionAnswer[], approve: string, reject: string): ApprovalDecision;
|
|
@@ -12,6 +12,8 @@ export interface AgenticoPrompts {
|
|
|
12
12
|
noToolsAvailable: string;
|
|
13
13
|
/** Sent to the model when it keeps calling tools past the round-trip limit. */
|
|
14
14
|
stopCallingTools: string;
|
|
15
|
+
/** Returned to the model for a tool the person rejected (CR-008). `{reason}` = their reason, or empty. */
|
|
16
|
+
toolRejected: string;
|
|
15
17
|
/** Returned to the model by a handoff tool: the work is queued, not done. `{label}` = subagent. */
|
|
16
18
|
handoffQueued: string;
|
|
17
19
|
/** Closing-summary micro-prompt (see microPrompts.ts). */
|
|
@@ -24,6 +24,10 @@ export interface AgenticoDict {
|
|
|
24
24
|
modelRequestError: string;
|
|
25
25
|
noProviderResponse: string;
|
|
26
26
|
noActiveSession: string;
|
|
27
|
+
approvalHeader: string;
|
|
28
|
+
approve: string;
|
|
29
|
+
reject: string;
|
|
30
|
+
approveQuestion: string;
|
|
27
31
|
requestInProgress: string;
|
|
28
32
|
invalidResponse: string;
|
|
29
33
|
responseReceived: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './i18n/types';
|
|
2
|
-
export type { AgentDefinition, AgentTool, LatestAttachmentsRef, AgentExecutor, AgentExecutorTurn, AgentExecutorStep, AgentExecutorPartOptions } from './domain/agentDefinition';
|
|
2
|
+
export type { AgentDefinition, AgentTool, LatestAttachmentsRef, AgentExecutor, AgentExecutorTurn, AgentExecutorStep, AgentExecutorPartOptions, AgentExecutorModel, AgentModelGroupBadge } from './domain/agentDefinition';
|
|
3
3
|
export { DEFAULT_TEXT_PART_ID, DEFAULT_REASONING_PART_ID, upsertMessagePart, messagePartsText, formatQuestionAnswers, type AgentMessagePart, type AgentTextPart, type AgentReasoningPart, type AgentToolPart, type AgentQuestionsPart, type AgentQuestion, type AgentQuestionOption, type AgentQuestionAnswer, type AgentQuestionsAnswers, } from './domain/messageParts';
|
|
4
4
|
export type { SubagentCommand, SubagentManifest, SubagentComponentContext } from './domain/subagentManifest';
|
|
5
5
|
export { defineSubagent } from './domain/defineSubagent';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AIConversationTurn, AIModelDescriptor } from '@llmnative/react';
|
|
2
|
-
import type { AgentDefinition } from '../domain/agentDefinition';
|
|
2
|
+
import type { AgentDefinition, AgentExecutorModel, AgentModelGroupBadge } from '../domain/agentDefinition';
|
|
3
3
|
import { type AgentMessagePart, type AgentQuestionAnswer } from '../domain/messageParts';
|
|
4
4
|
/** Una voce del log di attività — o un messaggio dell'utente (il testo di sendMessage(),
|
|
5
5
|
* mostrato subito com'è, mai "sto pensando" perché non è il modello a scriverlo), o una tool
|
|
@@ -63,11 +63,14 @@ export interface UseAgentResult<TParams, TResult> extends AgentControlState {
|
|
|
63
63
|
* deterministic fallback; the models are the executor's (`remoteModels`), not the catalog. */
|
|
64
64
|
remote: boolean;
|
|
65
65
|
/** The models a remote executor offers (`AgentExecutor.models`); `selectedModel` is one of them. */
|
|
66
|
-
remoteModels:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
remoteModels: AgentExecutorModel[];
|
|
67
|
+
/** CR-009: the executor answers only the turns of its own models, next to the AI catalog. */
|
|
68
|
+
alongside: boolean;
|
|
69
|
+
/** CR-009: the group and badge of a model of the AI catalog, as the executor names them. */
|
|
70
|
+
catalogGroup?: (provider: string, label: string) => {
|
|
71
|
+
group: string;
|
|
72
|
+
badge?: AgentModelGroupBadge;
|
|
73
|
+
};
|
|
71
74
|
/** Log delle tool call della sessione corrente, più recenti in fondo — azzerato a ogni
|
|
72
75
|
* run(), accumulato attraverso i sendMessage() successivi. */
|
|
73
76
|
activity: AgentActivityEntry[];
|
|
@@ -154,7 +157,7 @@ export interface UseAgentResult<TParams, TResult> extends AgentControlState {
|
|
|
154
157
|
/** Solo la fetta di UseAgentResult che serve a un consumer del pannello globale (Agentico.tsx)
|
|
155
158
|
* per continuare una conversazione già avviata da run() — TParams non compare in nessuno dei
|
|
156
159
|
* membri qui sotto, quindi `never` è innocuo. */
|
|
157
|
-
export type AgentConversation<TResult> = Pick<UseAgentResult<never, TResult>, 'canContinue' | 'remote' | 'remoteModels' | 'running' | 'error' | 'activity' | 'sendMessage' | 'stop' | 'runFallback' | 'snapshot' | 'answerQuestions'>;
|
|
160
|
+
export type AgentConversation<TResult> = Pick<UseAgentResult<never, TResult>, 'canContinue' | 'remote' | 'remoteModels' | 'alongside' | 'catalogGroup' | 'running' | 'error' | 'activity' | 'sendMessage' | 'stop' | 'runFallback' | 'snapshot' | 'answerQuestions'>;
|
|
158
161
|
export declare function useAgent<TParams, TContext, TResult>(definition: AgentDefinition<TParams, TContext, TResult>, options?: {
|
|
159
162
|
defaultEnabled?: boolean;
|
|
160
163
|
}): UseAgentResult<TParams, TResult>;
|
package/llms.txt
CHANGED
|
@@ -40,6 +40,9 @@ buildContext (always runs) · buildPrompt · buildFollowUpPrompt · parseRespons
|
|
|
40
40
|
|
|
41
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
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
|
+
|
|
43
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`.
|
|
44
47
|
|
|
45
48
|
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.8.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",
|