@llmnative/agentico 0.6.0 → 0.7.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.
@@ -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. */
@@ -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/llms.txt CHANGED
@@ -40,6 +40,8 @@ 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`.
44
46
 
45
47
  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.6.0",
3
+ "version": "0.7.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",