@llmnative/agentico 0.22.0 → 0.23.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.
@@ -0,0 +1,88 @@
1
+ import type { AIAttachment } from '@llmnative/react';
2
+ import type { AgentDefinition, AgentExecutor, AgentExecutorModel, AgentExecutorPartOptions, AgentExecutorStep, AgentTool } from './agentDefinition';
3
+ import type { EntityChatActivityEntry } from './entityChatStore';
4
+ import type { AgentCard, AgentQuestion, AgentQuestionAnswer } from './messageParts';
5
+ /** A tool of the agent as the harness gets it: JSON Schema for its input. */
6
+ export interface AgenticoHarnessTool {
7
+ name: string;
8
+ description: string;
9
+ inputSchema: Record<string, unknown>;
10
+ }
11
+ /** One turn given to the harness. */
12
+ export interface AgenticoHarnessTurn {
13
+ /** The chat on the harness (8 hex characters): a new one when `first`. */
14
+ chatId: string;
15
+ /** true: a new chat on the harness, `prompt` is the whole brief of the agent (and the chat so far, if any). */
16
+ first: boolean;
17
+ /** What the harness sends to its model. */
18
+ prompt: string;
19
+ /** One of `AgenticoHarness.models()`. */
20
+ model: string;
21
+ /** The tools of the agent: the harness calls them back with `callTool`. */
22
+ tools: AgenticoHarnessTool[];
23
+ /** Runs a tool of the agent in the app, as on the AI catalog (approval, step, card). */
24
+ callTool(name: string, input: Record<string, unknown>): Promise<{
25
+ result: unknown;
26
+ isError?: boolean;
27
+ }>;
28
+ attachments?: AIAttachment[];
29
+ signal: AbortSignal;
30
+ /** The reply so far, whole. */
31
+ onText(text: string, part?: AgentExecutorPartOptions): void;
32
+ onReasoning(text: string, part?: AgentExecutorPartOptions & {
33
+ duration?: number;
34
+ }): void;
35
+ /** A step of the harness of its own (reading files…); the tools of the agent show their steps by themselves. */
36
+ onStep(step: AgentExecutorStep): void;
37
+ }
38
+ /** What the host gives Agentico (`<AgenticoProvider harness>`). */
39
+ export interface AgenticoHarness {
40
+ /** The models the harness runs now for the person (e.g. "Claude Code · your subscription"); none: nothing offered. */
41
+ models(): AgentExecutorModel[];
42
+ /** A turn; rejects with the words for the person when it cannot run (no credit, no subscription…). */
43
+ turn(turn: AgenticoHarnessTurn): Promise<{
44
+ text: string;
45
+ }>;
46
+ /** A chat on the harness that is over (the person started again, or left). */
47
+ close?(chatId: string): Promise<void> | void;
48
+ }
49
+ /** The words `runHostTool` says to the person and to the model. */
50
+ export interface HostToolLabels {
51
+ /** "Approve? {action}" */
52
+ approveQuestion: string;
53
+ approve: string;
54
+ reject: string;
55
+ /** What the model reads when the person rejected: "{reason}" is " (why)" or empty. */
56
+ rejected: string;
57
+ }
58
+ /** What `runHostTool` needs of the turn that runs it. */
59
+ export type HostToolTurn = {
60
+ onQuestions(questions: AgentQuestion[], part?: {
61
+ id?: string;
62
+ }): Promise<AgentQuestionAnswer[]>;
63
+ onStep(step: AgentExecutorStep): void;
64
+ onCard?(card: AgentCard): void;
65
+ };
66
+ /**
67
+ * A tool of the app called by a harness (or any remote model): validated, approved by the person when it needs it
68
+ * (CR-008: a question Approve / Reject with a reason), shown as a step, its card added (CR-014) — as on the AI catalog.
69
+ * Never throws: what went wrong is the answer to the harness, `isError`.
70
+ */
71
+ export declare function runHostTool(tools: readonly AgentTool[], name: string, input: Record<string, unknown>, turn: HostToolTurn, labels: HostToolLabels): Promise<{
72
+ result: unknown;
73
+ isError?: boolean;
74
+ }>;
75
+ /** The chat so far, as a model reads it: what the person wrote and what the agent answered, in order. */
76
+ export declare function harnessTranscript(activity: readonly EntityChatActivityEntry[]): string;
77
+ export type HarnessExecutorOptions = {
78
+ labels: HostToolLabels;
79
+ /** The chat before the message being sent, when the harness starts in the middle of it (the AI catalog came first). */
80
+ earlier?: () => readonly EntityChatActivityEntry[];
81
+ /** How the chat so far is introduced to the model. */
82
+ chatSoFar?: string;
83
+ };
84
+ /**
85
+ * The executor alongside the AI catalog that runs an agent on the harness: its brief (`buildPrompt`, then
86
+ * `buildFollowUpPrompt`), its tools (`getTools`, through `runHostTool`), its reading of the reply (`parseResponse`).
87
+ */
88
+ export declare function createHarnessExecutor<TParams, TContext, TResult>(definition: AgentDefinition<TParams, TContext, TResult>, harness: AgenticoHarness, options: HarnessExecutorOptions): AgentExecutor<TParams, TContext, TResult>;
@@ -115,6 +115,10 @@ export interface AgenticoDict {
115
115
  routingNoPage: string;
116
116
  routingTryPath: string;
117
117
  routingTryPathFeedback: string;
118
+ routingTryPathCount: string;
119
+ routingNoMatch: string;
120
+ routingApplies: string;
121
+ routingOverridden: string;
118
122
  routingOriginDefault: string;
119
123
  routingOriginModified: string;
120
124
  routingOriginAdded: string;
@@ -23,7 +23,7 @@ export { agenticoTranslations, agenticoEn, agenticoIt, agenticoDe, useAgenticoI1
23
23
  export { Agentico, AGENTICO_WIDTH, type AgenticoProps } from './presentation/Agentico';
24
24
  export { AGENTICO_MIN_WIDTH, AGENTICO_MAX_WIDTH, AGENTICO_WIDTH_STORAGE_KEY, type AgenticoPanelSize } from './presentation/panelWidth';
25
25
  export { AgenticoToggle } from './presentation/AgenticoToggle';
26
- export { useAgenticoSettings, type AgenticoSettingsConfig } from './presentation/AgenticoSettingsContext';
26
+ export { useAgenticoSettings, type AgenticoSettingsConfig, type AgenticoSettingsTab } from './presentation/AgenticoSettingsContext';
27
27
  export { AgenticoSettingsModal } from './presentation/AgenticoSettingsModal';
28
28
  export { AGENTICO_SETTING_KEYS, DEFAULT_AGENTICO_SETTINGS, effectiveSettings, shownSettings, browserSettingsStore, type AgenticoSettings, type AgenticoSettingKey, type AgenticoSettingsStore, } from './domain/settings';
29
29
  export { AgenticoProvider, useAgentico, ORCHESTRATOR_TASK_ID, type AgenticoScope, type AgenticoRoute, type AgenticoRoutingState, type AgenticoTask, type ComponentAnchor, } from './presentation/AgenticoContext';
@@ -33,3 +33,5 @@ export { useAgenticoPageContext } from './presentation/useAgenticoPageContext';
33
33
  export { useSubagentComponentContext } from './presentation/useSubagentComponentContext';
34
34
  export { registerSubagentReports, getSubagentReport, type EditableReportModule, type SubagentReportModule, type SubagentSelection, } from './presentation/reports/subagentReportRegistry';
35
35
  export { registerSubagentControls, getSubagentControls, type SubagentControls, type SubagentControlsProps, type UseSubagentControls } from './presentation/subagentControls';
36
+ export { createHarnessExecutor, harnessTranscript, runHostTool, type AgenticoHarness, type AgenticoHarnessTool, type AgenticoHarnessTurn, type HarnessExecutorOptions, type HostToolLabels, type HostToolTurn, } from './domain/harness';
37
+ export { useAgenticoHarness } from './presentation/harnessContext';
@@ -7,6 +7,7 @@ import { type ChatAuthor, type EntityChatSnapshot } from '../domain/entityChatSt
7
7
  import type { ThreadEventsSource } from '../domain/threadEvents';
8
8
  import { type AgenticoPageRuleWithOrigin, type AgenticoRouteMatch, type AgenticoRouting, type AgenticoRoutingChanges, type AgenticoRoutingStore } from '../domain/routing';
9
9
  import { type AgenticoSettingsConfig } from './AgenticoSettingsContext';
10
+ import type { AgenticoHarness } from '../domain/harness';
10
11
  /** Where results are saved and chats are kept: the host's current tenant, company, workspace…
11
12
  * `null` while the host has none selected — destinations then refuse to save. */
12
13
  export interface AgenticoScope {
@@ -372,8 +373,11 @@ interface AgenticoContextValue {
372
373
  /** Changes at every startSubagent() — React `key` of that SubagentRunner. */
373
374
  startRunId: string | null;
374
375
  }
375
- export declare function AgenticoProvider({ children, scope, person, threadEvents, settings, route: routeProp }: {
376
+ export declare function AgenticoProvider({ children, scope, person, threadEvents, settings, route: routeProp, harness }: {
376
377
  children: React.ReactNode;
378
+ /** CR-024: models of the host that run their own loop of tools (e.g. Claude Code with the person's subscription),
379
+ * offered next to the AI catalog for every agent without an executor of its own. Keep it stable (memoized). */
380
+ harness?: AgenticoHarness | null;
377
381
  /** CR-023: the current path of the host app and its routing (see routing.ts): which subagents and
378
382
  * data-collection tools are offered there, and the context the model gets. Absent = everything
379
383
  * offered, no context. Keep `defaults` stable (memoized). */
@@ -2,12 +2,12 @@ import React from 'react';
2
2
  import { type AgenticoPageRule } from '../domain/routing';
3
3
  /** A tool name made readable: `read_sitemap` → "Read sitemap". The name itself stays in the editor title. */
4
4
  export declare function toolLabel(name: string): string;
5
- export declare function AgenticoSubagentsSettings({ onStack }: {
5
+ /** Props of the three tabs: the editor open on top (the settings modal dims behind it). */
6
+ interface RoutingTabProps {
6
7
  onStack?: (open: boolean) => void;
7
- }): React.JSX.Element;
8
- export declare function AgenticoToolsSettings({ onStack }: {
9
- onStack?: (open: boolean) => void;
10
- }): React.JSX.Element;
8
+ }
9
+ export declare function AgenticoSubagentsSettings({ onStack }: RoutingTabProps): React.JSX.Element;
10
+ export declare function AgenticoToolsSettings({ onStack }: RoutingTabProps): React.JSX.Element;
11
11
  /** The editor of a page rule. `flags` is not shown (only `i` would matter, paths are lower case): kept as it is.
12
12
  * `active`: the switch on = the rule applies; a default rule is switched off instead of deleted. */
13
13
  export type AgenticoPageRuleForm = {
@@ -20,6 +20,5 @@ export type AgenticoPageRuleForm = {
20
20
  };
21
21
  /** The page rule written in the editor; empty optional fields left out. */
22
22
  export declare function pageRuleFromForm(record: Partial<Record<keyof AgenticoPageRuleForm, unknown>>): AgenticoPageRule;
23
- export declare function AgenticoPagesSettings({ onStack }: {
24
- onStack?: (open: boolean) => void;
25
- }): React.JSX.Element;
23
+ export declare function AgenticoPagesSettings({ onStack }: RoutingTabProps): React.JSX.Element;
24
+ export {};
@@ -11,12 +11,21 @@ export interface AgenticoSettingsConfig {
11
11
  hidden?: AgenticoSettingKey[];
12
12
  /** The section Connectors of the modal: the AI providers (and the host's connectors, e.g. a subscription on a runner). */
13
13
  connections?: Omit<AIConnectionsProps, 'className'>;
14
+ /** CR-024: tabs of the host after Agentico's (e.g. "My subscriptions" on a runner), drawn by the host. */
15
+ tabs?: AgenticoSettingsTab[];
16
+ }
17
+ /** A tab of the host in the settings modal. */
18
+ export interface AgenticoSettingsTab {
19
+ id: string;
20
+ label: string;
21
+ render: () => React.ReactNode;
14
22
  }
15
23
  interface AgenticoSettingsContextValue {
16
24
  settings: AgenticoSettings;
17
25
  /** The settings the modal shows. */
18
26
  shown: AgenticoSettingKey[];
19
27
  connections?: AgenticoSettingsConfig['connections'];
28
+ tabs?: AgenticoSettingsTab[];
20
29
  save: (values: Partial<AgenticoSettings>) => Promise<void>;
21
30
  isOpen: boolean;
22
31
  open: () => void;
@@ -0,0 +1,4 @@
1
+ import type { AgenticoHarness } from '../domain/harness';
2
+ export declare const AgenticoHarnessContext: import("react").Context<AgenticoHarness | null>;
3
+ /** The harness of the host; null without one. */
4
+ export declare function useAgenticoHarness(): AgenticoHarness | null;
package/llms.txt CHANGED
@@ -61,4 +61,5 @@ CR-011: `SubagentManifest.autoTitle: true` gives its saved chats a title from th
61
61
 
62
62
  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)`.
63
63
 
64
- CR-023: `<AgenticoProvider route={{ path, defaults, store?, readOnly? }}>` (defaults memoized). `AgenticoRouting { subagents?: Record<id, { paths?: string[] (regex on the path, no query/hash; absent = everywhere, [] = only when scoped), tools?: string[] (absent = manifest crossAgentToolIds) }>, tools?: Record<name, { everywhere?: boolean }>, pages?: AgenticoPageRule[] }`; `AgenticoPageRule { id, label?, pattern, flags?, context? ({name}/{1} groups, {path}), disabled? }`, the first enabled matching page rule wins. `resolveAgenticoRoute(routing, location, manifests)` → `{ path, page, context, subagentIds (paths match), toolNames (tools of the offered subagents + everywhere), toolsOf }` = `useAgentico().route`. The page context comes before the page/anchor context in the prompt; the orchestrator offers only those subagents (onlyWhenAnchored still only when scoped) and tools; a scoped subagent uses `toolsOf[id]`. `mergeAgenticoRouting(defaults, changes)`, `diffAgenticoRouting(defaults, next)` → `AgenticoRoutingChanges { pages?, pageOrder?, subagents?, tools? }` (only what differs; an empty subagent entry or `everywhere: false` equals a missing one), `mergeAgenticoPageRules` (origin `default`/`modified`+`defaultRule`/`added`), `validateAgenticoRouting(routing, { subagents, toolNames })` → issues `{ where: page|subagent|tool, key, index?, code, level }`: `invalid-pattern`, `duplicate-id`, `missing-id`, `unknown-tool` (errors), `unknown-subagent`, `anchored-subagent`, unknown tool entry (warnings). Not access control. `route.store` (`AgenticoRoutingStore { load(): changes|null, save(changes) }`), `route.readOnly`; `useAgentico().routing` → `{ path, defaults, routing, pages (with origin), changes, save|null, error }`. Settings tabs: Chats, Subagents (a box per subagent: paths, description, tools as badges; click → editor modal on top: paths add/remove/edit, try a path, tools, restore), Tools (a box per tool: subagents that use it or all; click → editor), Pages (context per path: try, edit, move, restore, delete added), Connectors.
64
+ CR-023: `<AgenticoProvider route={{ path, defaults, store?, readOnly? }}>` (defaults memoized). `AgenticoRouting { subagents?: Record<id, { paths?: string[] (regex on the path, no query/hash; absent = everywhere, [] = only when scoped), tools?: string[] (absent = manifest crossAgentToolIds) }>, tools?: Record<name, { everywhere?: boolean }>, pages?: AgenticoPageRule[] }`; `AgenticoPageRule { id, label?, pattern, flags?, context? ({name}/{1} groups, {path}), disabled? }`, the first enabled matching page rule wins. `resolveAgenticoRoute(routing, location, manifests)` → `{ path, page, context, subagentIds (paths match), toolNames (tools of the offered subagents + everywhere), toolsOf }` = `useAgentico().route`. The page context comes before the page/anchor context in the prompt; the orchestrator offers only those subagents (onlyWhenAnchored still only when scoped) and tools; a scoped subagent uses `toolsOf[id]`. `mergeAgenticoRouting(defaults, changes)`, `diffAgenticoRouting(defaults, next)` → `AgenticoRoutingChanges { pages?, pageOrder?, subagents?, tools? }` (only what differs; an empty subagent entry or `everywhere: false` equals a missing one), `mergeAgenticoPageRules` (origin `default`/`modified`+`defaultRule`/`added`), `validateAgenticoRouting(routing, { subagents, toolNames })` → issues `{ where: page|subagent|tool, key, index?, code, level }`: `invalid-pattern`, `duplicate-id`, `missing-id`, `unknown-tool` (errors), `unknown-subagent`, `anchored-subagent`, unknown tool entry (warnings). Not access control. `route.store` (`AgenticoRoutingStore { load(): changes|null, save(changes) }`), `route.readOnly`; `useAgentico().routing` → `{ path, defaults, routing, pages (with origin), changes, save|null, error }`. Settings tabs: Chats, Subagents (a box per subagent: paths, description, tools as readable badges; click → editor modal on top: paths add/remove/edit, try a path, tools, restore), Tools (a box per tool: subagents that use it or all; click → editor), Pages (context per path: edit in a modal with the switch Active in its head, move, restore, delete added), Connectors. Each routing tab has a toolbar button "Try a path" (0.22.1): a field prefilled with the current path filters the boxes to what matches; on Pages every matching rule is shown, the first "Applies" (context filled), the others "Overridden by #n".
65
+ CR-024 (0.23.0): `<AgenticoProvider harness>` — `AgenticoHarness { models(): AgentExecutorModel[] (read while rendering: keep them cached, pass a new object when they change), turn(AgenticoHarnessTurn) → { text } (rejects with words for the person), close?(chatId) }`; `AgenticoHarnessTurn { chatId (8 hex, new when first), first, prompt, model, tools: { name, description, inputSchema (JSON Schema) }[], callTool(name, input) → { result, isError? }, attachments?, signal, onText (whole text), onReasoning, onStep }`. For every agent without `executor` Agentico composes one alongside the catalog (`createHarnessExecutor(definition, harness, { labels, earlier? })`): first turn `buildPrompt` (+ the chat so far when it starts mid-chat or after a rewind, then the message), then `buildFollowUpPrompt`; tools of `getTools` through `runHostTool(tools, name, input, { onQuestions, onStep, onCard? }, { approveQuestion, approve, reject, rejected })` (validation, CR-008 approval, step, CR-014 card; never throws); result `parseResponse(text)`. The starter composer lists the harness models first. `settings.tabs: AgenticoSettingsTab[] { id, label, render() }` — host tabs after Agentico's in the settings modal.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmnative/agentico",
3
- "version": "0.22.0",
3
+ "version": "0.23.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",