@llmnative/agentico 0.20.2 → 0.22.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/LICENSE +201 -201
- package/README.md +24 -0
- package/dist/index.js +16 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2807 -1211
- package/dist/index.mjs.map +1 -1
- package/dist/types/domain/orchestrator/agenticoOrchestratorAgent.d.ts +8 -0
- package/dist/types/domain/routing.d.ts +127 -0
- package/dist/types/domain/settings.d.ts +27 -0
- package/dist/types/i18n/types.d.ts +84 -0
- package/dist/types/index.d.ts +5 -1
- package/dist/types/presentation/AgenticoContext.d.ts +43 -1
- package/dist/types/presentation/AgenticoRoutingSettings.d.ts +25 -0
- package/dist/types/presentation/AgenticoSettingsContext.d.ts +31 -0
- package/dist/types/presentation/AgenticoSettingsModal.d.ts +4 -0
- package/dist/types/presentation/ThreadEvents.d.ts +5 -2
- package/dist/types/presentation/useAIModelCatalog.d.ts +7 -1
- package/llms.txt +4 -0
- package/package.json +5 -3
|
@@ -8,6 +8,14 @@ export interface OrchestratorAgentParams {
|
|
|
8
8
|
/** Subagent the starting page is pinned to, `null` for a generic chat. Restricts the
|
|
9
9
|
* cross-agent tools to the ones that subagent declares (SubagentManifest.crossAgentToolIds). */
|
|
10
10
|
scopedSubagentId: string | null;
|
|
11
|
+
/** CR-023: what the routing offers on the current path (see routing.ts), `null` = everything.
|
|
12
|
+
* The subagent the conversation is scoped to is offered anyway, with the tools it uses
|
|
13
|
+
* (`toolsOf`, else its manifest). */
|
|
14
|
+
route?: {
|
|
15
|
+
subagentIds: string[] | null;
|
|
16
|
+
toolNames: string[] | null;
|
|
17
|
+
toolsOf?: Record<string, string[]>;
|
|
18
|
+
} | null;
|
|
11
19
|
}
|
|
12
20
|
export interface OrchestratorAgentContext {
|
|
13
21
|
cliCatalog: string;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { SubagentManifest } from './subagentManifest';
|
|
2
|
+
/** A context for the model about a point of the host app. */
|
|
3
|
+
export interface AgenticoPageRule {
|
|
4
|
+
/** Stable id: a saved change replaces the default rule with the same id. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Name shown to people. */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Regular expression matched against the path only (no query, no hash), e.g.
|
|
9
|
+
* `^/sites/(?<siteId>[^/]+)/pages/(?<pageId>[^/]+)$`. Anchor it (`^…$`) to match the whole path. */
|
|
10
|
+
pattern: string;
|
|
11
|
+
/** Flags of the regular expression (`i`…). `g` and `y` are ignored. */
|
|
12
|
+
flags?: string;
|
|
13
|
+
/** Text for the model. `{name}` = a named group of the pattern, `{1}`, `{2}`… = numbered groups,
|
|
14
|
+
* `{path}` = the whole path. A group that matched nothing (an optional one) gives an empty text;
|
|
15
|
+
* a placeholder that is no group stays as it is. */
|
|
16
|
+
context?: string;
|
|
17
|
+
/** A disabled rule never matches (a default rule turned off by a saved change). */
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Where the subagent is offered and what it uses. */
|
|
21
|
+
export interface AgenticoSubagentRouting {
|
|
22
|
+
/** Regular expressions on the path where it is offered. Absent = everywhere; `[]` = nowhere (only
|
|
23
|
+
* when a chat is scoped to it: an anchor on the page, a button of the host). */
|
|
24
|
+
paths?: string[];
|
|
25
|
+
/** Names of the data-collection tools it uses. Absent = the ones of its manifest
|
|
26
|
+
* (`crossAgentToolIds`). Tools used everywhere are added anyway. */
|
|
27
|
+
tools?: string[];
|
|
28
|
+
}
|
|
29
|
+
export interface AgenticoToolRouting {
|
|
30
|
+
/** Used by every subagent, so offered on every page. */
|
|
31
|
+
everywhere?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** The routing of the host: its defaults in code, or those with the changes kept by people. */
|
|
34
|
+
export interface AgenticoRouting {
|
|
35
|
+
/** Context per path, in order: the first matching rule wins. */
|
|
36
|
+
pages?: AgenticoPageRule[];
|
|
37
|
+
/** By subagent id. A subagent missing here: everywhere, with the tools of its manifest. */
|
|
38
|
+
subagents?: Record<string, AgenticoSubagentRouting>;
|
|
39
|
+
/** By tool name. A tool missing here: used by the subagents that name it. */
|
|
40
|
+
tools?: Record<string, AgenticoToolRouting>;
|
|
41
|
+
}
|
|
42
|
+
/** Where a page rule comes from, after mergeAgenticoRouting(). */
|
|
43
|
+
export type AgenticoRoutingOrigin = 'default' | 'modified' | 'added';
|
|
44
|
+
export interface AgenticoPageRuleWithOrigin extends AgenticoPageRule {
|
|
45
|
+
origin: AgenticoRoutingOrigin;
|
|
46
|
+
/** The default rule this one changes (only when `origin` is `modified`). */
|
|
47
|
+
defaultRule?: AgenticoPageRule;
|
|
48
|
+
}
|
|
49
|
+
/** Changes kept by the host over its defaults: only what differs. */
|
|
50
|
+
export interface AgenticoRoutingChanges {
|
|
51
|
+
/** Page rules replacing a default rule with the same id, or added. */
|
|
52
|
+
pages?: AgenticoPageRule[];
|
|
53
|
+
/** Order of the page rules by id. Ids missing here keep their place after the listed ones. */
|
|
54
|
+
pageOrder?: string[];
|
|
55
|
+
/** Entries replacing the default entry of the same subagent. */
|
|
56
|
+
subagents?: Record<string, AgenticoSubagentRouting>;
|
|
57
|
+
/** Entries replacing the default entry of the same tool. */
|
|
58
|
+
tools?: Record<string, AgenticoToolRouting>;
|
|
59
|
+
}
|
|
60
|
+
/** Where the host keeps the changes people make to its routing (its database, per tenant…). */
|
|
61
|
+
export interface AgenticoRoutingStore {
|
|
62
|
+
/** The changes kept; nothing kept: `null` or `{}`. */
|
|
63
|
+
load(): Promise<AgenticoRoutingChanges | null>;
|
|
64
|
+
/** Keeps the changes (only what differs from the defaults; `{}` = back to the defaults). */
|
|
65
|
+
save(changes: AgenticoRoutingChanges): Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
/** The page rule matching a path. */
|
|
68
|
+
export interface AgenticoPageMatch {
|
|
69
|
+
rule: AgenticoPageRule;
|
|
70
|
+
/** Groups of the pattern: named ones by name, numbered ones by number ("1", "2"…). */
|
|
71
|
+
groups: Record<string, string>;
|
|
72
|
+
/** The context of the rule with its placeholders filled, `null` when the rule has none. */
|
|
73
|
+
context: string | null;
|
|
74
|
+
}
|
|
75
|
+
/** What Agentico offers on a path. */
|
|
76
|
+
export interface AgenticoRouteMatch {
|
|
77
|
+
path: string;
|
|
78
|
+
/** The page rule of the path, `null` = none. */
|
|
79
|
+
page: AgenticoPageMatch | null;
|
|
80
|
+
/** The context of the page rule, `null` = none. */
|
|
81
|
+
context: string | null;
|
|
82
|
+
/** Subagents whose paths match (a subagent only for an anchored page is still offered only when scoped). */
|
|
83
|
+
subagentIds: string[];
|
|
84
|
+
/** Data-collection tools offered: the ones the subagents offered here use, and the ones used everywhere. */
|
|
85
|
+
toolNames: string[];
|
|
86
|
+
/** The tools each registered subagent uses, wherever it is offered (a scoped chat uses these). */
|
|
87
|
+
toolsOf: Record<string, string[]>;
|
|
88
|
+
}
|
|
89
|
+
export type AgenticoRoutingIssueCode = 'invalid-pattern' | 'duplicate-id' | 'missing-id' | 'unknown-subagent' | 'unknown-tool' | 'anchored-subagent';
|
|
90
|
+
export interface AgenticoRoutingIssue {
|
|
91
|
+
/** What the issue is about: a page rule (key = its id), a subagent (its id) or a tool (its name). */
|
|
92
|
+
where: 'page' | 'subagent' | 'tool';
|
|
93
|
+
key: string;
|
|
94
|
+
/** Index of the page rule, or of the path of the subagent, the issue is about. */
|
|
95
|
+
index?: number;
|
|
96
|
+
code: AgenticoRoutingIssueCode;
|
|
97
|
+
/** `error`: it cannot work as written. `warning`: it works, maybe not as expected. */
|
|
98
|
+
level: 'error' | 'warning';
|
|
99
|
+
/** The subagent id, tool name or the error of the regular expression the issue is about. */
|
|
100
|
+
detail?: string;
|
|
101
|
+
}
|
|
102
|
+
type KnownSubagent = Pick<SubagentManifest, 'id' | 'onlyWhenAnchored' | 'crossAgentToolIds'>;
|
|
103
|
+
/** The path matched: query and hash removed. */
|
|
104
|
+
export declare function routePathOf(location: string): string;
|
|
105
|
+
/** The regular expression of a pattern, or its error. Cached. */
|
|
106
|
+
export declare function compileRoutePattern(pattern: string, flags?: string): RegExp | Error;
|
|
107
|
+
/** Whether one of `paths` matches `location` (absent = everywhere; an invalid pattern never matches). */
|
|
108
|
+
export declare function matchesAnyPath(paths: readonly string[] | undefined, location: string): boolean;
|
|
109
|
+
/** The first enabled page rule matching `location` (path, query and hash allowed: only the path counts). */
|
|
110
|
+
export declare function matchAgenticoPage(rules: readonly AgenticoPageRule[], location: string): AgenticoPageMatch | null;
|
|
111
|
+
/** The tools a subagent uses: its routing, else its manifest; plus the ones used everywhere. */
|
|
112
|
+
export declare function subagentToolsOf(routing: AgenticoRouting, manifest: KnownSubagent): string[];
|
|
113
|
+
/** What Agentico offers on `location` with `routing`, for the registered `subagents`. */
|
|
114
|
+
export declare function resolveAgenticoRoute(routing: AgenticoRouting, location: string, subagents: readonly KnownSubagent[]): AgenticoRouteMatch;
|
|
115
|
+
/** The page rules of the defaults with the changes, each one with its origin. */
|
|
116
|
+
export declare function mergeAgenticoPageRules(defaults: readonly AgenticoPageRule[], changes?: Pick<AgenticoRoutingChanges, 'pages' | 'pageOrder'> | null): AgenticoPageRuleWithOrigin[];
|
|
117
|
+
/** The defaults of the host with the changes kept elsewhere. */
|
|
118
|
+
export declare function mergeAgenticoRouting(defaults: AgenticoRouting, changes?: AgenticoRoutingChanges | null): AgenticoRouting;
|
|
119
|
+
/** What a host saves to get `next` back from its `defaults` with mergeAgenticoRouting(): only the
|
|
120
|
+
* page rules, subagents and tools that differ, and the order of the page rules when it changed. */
|
|
121
|
+
export declare function diffAgenticoRouting(defaults: AgenticoRouting, next: AgenticoRouting): AgenticoRoutingChanges;
|
|
122
|
+
/** Problems of a routing, against the subagents and data-collection tools the host registers. */
|
|
123
|
+
export declare function validateAgenticoRouting(routing: AgenticoRouting, known: {
|
|
124
|
+
subagents: readonly KnownSubagent[];
|
|
125
|
+
toolNames: readonly string[];
|
|
126
|
+
}): AgenticoRoutingIssue[];
|
|
127
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AIReasoningLevel } from '@llmnative/react';
|
|
2
|
+
export interface AgenticoSettings {
|
|
3
|
+
/** The model the chats start with on the AI catalog (`provider/model`); absent: the person picks one. */
|
|
4
|
+
defaultModel?: string;
|
|
5
|
+
/** How much the model reasons on the AI catalog when the agent does not say (`executor.catalogReasoning`). */
|
|
6
|
+
reasoning?: AIReasoningLevel;
|
|
7
|
+
/** The providers of the AI catalog the chats may use; absent: all the connected ones. */
|
|
8
|
+
providers?: string[];
|
|
9
|
+
/** The model writes the titles of the chats (CR-011). */
|
|
10
|
+
chatTitles: boolean;
|
|
11
|
+
/** The events of the host (what the other agents did) are shown among the messages (CR-019). */
|
|
12
|
+
threadEvents: boolean;
|
|
13
|
+
}
|
|
14
|
+
export type AgenticoSettingKey = keyof AgenticoSettings;
|
|
15
|
+
export declare const AGENTICO_SETTING_KEYS: readonly AgenticoSettingKey[];
|
|
16
|
+
export declare const DEFAULT_AGENTICO_SETTINGS: AgenticoSettings;
|
|
17
|
+
/** Where the settings the person changes are kept: the host's store (a database, its server). */
|
|
18
|
+
export interface AgenticoSettingsStore {
|
|
19
|
+
load(): Promise<Partial<AgenticoSettings>>;
|
|
20
|
+
save(values: Partial<AgenticoSettings>): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
/** The value of each setting: fixed by the host, else what the person saved, else the default. */
|
|
23
|
+
export declare function effectiveSettings(saved: Partial<AgenticoSettings>, fixed?: Partial<AgenticoSettings>): AgenticoSettings;
|
|
24
|
+
/** The settings the modal shows: neither fixed nor hidden by the host. */
|
|
25
|
+
export declare function shownSettings(fixed?: Partial<AgenticoSettings>, hidden?: readonly AgenticoSettingKey[]): AgenticoSettingKey[];
|
|
26
|
+
/** The store of this browser, when the host gives none. */
|
|
27
|
+
export declare const browserSettingsStore: AgenticoSettingsStore;
|
|
@@ -70,6 +70,90 @@ export interface AgenticoDict {
|
|
|
70
70
|
/** CR-019: the filter in the header: show the events of the host, or the conversation only. */
|
|
71
71
|
showEvents: string;
|
|
72
72
|
hideEvents: string;
|
|
73
|
+
/** CR-022: the settings modal of Agentico. */
|
|
74
|
+
settingsTitle: string;
|
|
75
|
+
settingsSave: string;
|
|
76
|
+
settingsClose: string;
|
|
77
|
+
settingsChats: string;
|
|
78
|
+
settingsDefaultModel: string;
|
|
79
|
+
settingsDefaultModelNone: string;
|
|
80
|
+
settingsReasoning: string;
|
|
81
|
+
settingsReasoningDefault: string;
|
|
82
|
+
settingsReasoningLow: string;
|
|
83
|
+
settingsReasoningMedium: string;
|
|
84
|
+
settingsReasoningHigh: string;
|
|
85
|
+
settingsReasoningMax: string;
|
|
86
|
+
settingsProviders: string;
|
|
87
|
+
settingsChatTitles: string;
|
|
88
|
+
settingsThreadEvents: string;
|
|
89
|
+
settingsConnectors: string;
|
|
90
|
+
settingsSubagents: string;
|
|
91
|
+
settingsTools: string;
|
|
92
|
+
settingsPages: string;
|
|
93
|
+
routingHere: string;
|
|
94
|
+
routingHereBadge: string;
|
|
95
|
+
routingContext: string;
|
|
96
|
+
routingNoContext: string;
|
|
97
|
+
routingOfferedHere: string;
|
|
98
|
+
routingNone: string;
|
|
99
|
+
routingOffered: string;
|
|
100
|
+
routingNotOffered: string;
|
|
101
|
+
routingOnlyAnchored: string;
|
|
102
|
+
routingNoRouting: string;
|
|
103
|
+
routingSubagentsIntro: string;
|
|
104
|
+
routingWhere: string;
|
|
105
|
+
routingEverywhere: string;
|
|
106
|
+
routingNowhere: string;
|
|
107
|
+
routingUses: string;
|
|
108
|
+
routingNoTools: string;
|
|
109
|
+
routingModified: string;
|
|
110
|
+
routingToolsIntro: string;
|
|
111
|
+
routingUsedBy: string;
|
|
112
|
+
routingAllSubagents: string;
|
|
113
|
+
routingNoSubagents: string;
|
|
114
|
+
routingPagesIntro: string;
|
|
115
|
+
routingNoPage: string;
|
|
116
|
+
routingTryPath: string;
|
|
117
|
+
routingTryPathFeedback: string;
|
|
118
|
+
routingOriginDefault: string;
|
|
119
|
+
routingOriginModified: string;
|
|
120
|
+
routingOriginAdded: string;
|
|
121
|
+
routingRuleOff: string;
|
|
122
|
+
routingMoveUp: string;
|
|
123
|
+
routingMoveDown: string;
|
|
124
|
+
routingRestore: string;
|
|
125
|
+
routingRemove: string;
|
|
126
|
+
routingNewRule: string;
|
|
127
|
+
routingReadOnly: string;
|
|
128
|
+
routingLoadError: string;
|
|
129
|
+
routingSaveError: string;
|
|
130
|
+
routingEditOf: string;
|
|
131
|
+
routingFieldEverywhere: string;
|
|
132
|
+
routingFieldPaths: string;
|
|
133
|
+
routingFieldPathsFeedback: string;
|
|
134
|
+
routingAddPath: string;
|
|
135
|
+
routingRemovePath: string;
|
|
136
|
+
routingFieldTools: string;
|
|
137
|
+
routingToolsEverywhereNote: string;
|
|
138
|
+
routingFieldAllSubagents: string;
|
|
139
|
+
routingFieldUsedBy: string;
|
|
140
|
+
routingFieldId: string;
|
|
141
|
+
routingFieldIdFeedback: string;
|
|
142
|
+
routingFieldLabel: string;
|
|
143
|
+
routingFieldPattern: string;
|
|
144
|
+
routingFieldPatternFeedback: string;
|
|
145
|
+
routingPatternRequired: string;
|
|
146
|
+
routingFieldContextFeedback: string;
|
|
147
|
+
routingFieldActive: string;
|
|
148
|
+
routingFieldActiveFeedback: string;
|
|
149
|
+
routingSave: string;
|
|
150
|
+
routingCancel: string;
|
|
151
|
+
routingIssueInvalidPattern: string;
|
|
152
|
+
routingIssueDuplicateId: string;
|
|
153
|
+
routingIssueMissingId: string;
|
|
154
|
+
routingIssueUnknownSubagent: string;
|
|
155
|
+
routingIssueUnknownTool: string;
|
|
156
|
+
routingIssueAnchoredSubagent: string;
|
|
73
157
|
/** CR-011: renaming a saved chat. */
|
|
74
158
|
/** CR-014: the whole text of a card, and closing it. */
|
|
75
159
|
cardView: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -23,7 +23,11 @@ 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 {
|
|
26
|
+
export { useAgenticoSettings, type AgenticoSettingsConfig } from './presentation/AgenticoSettingsContext';
|
|
27
|
+
export { AgenticoSettingsModal } from './presentation/AgenticoSettingsModal';
|
|
28
|
+
export { AGENTICO_SETTING_KEYS, DEFAULT_AGENTICO_SETTINGS, effectiveSettings, shownSettings, browserSettingsStore, type AgenticoSettings, type AgenticoSettingKey, type AgenticoSettingsStore, } from './domain/settings';
|
|
29
|
+
export { AgenticoProvider, useAgentico, ORCHESTRATOR_TASK_ID, type AgenticoScope, type AgenticoRoute, type AgenticoRoutingState, type AgenticoTask, type ComponentAnchor, } from './presentation/AgenticoContext';
|
|
30
|
+
export { resolveAgenticoRoute, matchAgenticoPage, matchesAnyPath, subagentToolsOf, mergeAgenticoRouting, mergeAgenticoPageRules, diffAgenticoRouting, validateAgenticoRouting, compileRoutePattern, routePathOf, type AgenticoRouting, type AgenticoPageRule, type AgenticoPageRuleWithOrigin, type AgenticoSubagentRouting, type AgenticoToolRouting, type AgenticoRoutingOrigin, type AgenticoRoutingChanges, type AgenticoRoutingStore, type AgenticoPageMatch, type AgenticoRouteMatch, type AgenticoRoutingIssue, type AgenticoRoutingIssueCode, } from './domain/routing';
|
|
27
31
|
export { useAgent, type AgentActivityEntry, type AgentConversation, type UseAgentResult } from './presentation/useAgent';
|
|
28
32
|
export { useAgenticoPageContext } from './presentation/useAgenticoPageContext';
|
|
29
33
|
export { useSubagentComponentContext } from './presentation/useSubagentComponentContext';
|
|
@@ -5,6 +5,8 @@ import type { ResultDestination } from '../domain/resultDestination';
|
|
|
5
5
|
import type { SubagentUsageCard } from '../domain/subagentUsageCard';
|
|
6
6
|
import { type ChatAuthor, type EntityChatSnapshot } from '../domain/entityChatStore';
|
|
7
7
|
import type { ThreadEventsSource } from '../domain/threadEvents';
|
|
8
|
+
import { type AgenticoPageRuleWithOrigin, type AgenticoRouteMatch, type AgenticoRouting, type AgenticoRoutingChanges, type AgenticoRoutingStore } from '../domain/routing';
|
|
9
|
+
import { type AgenticoSettingsConfig } from './AgenticoSettingsContext';
|
|
8
10
|
/** Where results are saved and chats are kept: the host's current tenant, company, workspace…
|
|
9
11
|
* `null` while the host has none selected — destinations then refuse to save. */
|
|
10
12
|
export interface AgenticoScope {
|
|
@@ -146,9 +148,42 @@ export interface ComponentAnchor {
|
|
|
146
148
|
* host). */
|
|
147
149
|
pinnedEntityId?: string;
|
|
148
150
|
}
|
|
151
|
+
/** CR-023: where the person is in the host app, and what Agentico knows and offers there (see routing.ts). */
|
|
152
|
+
export interface AgenticoRoute {
|
|
153
|
+
/** The current location of the host app (its router's): only the path is matched. */
|
|
154
|
+
path: string;
|
|
155
|
+
/** The routing of the host in code: where each subagent is offered and the tools it uses, the
|
|
156
|
+
* tools used everywhere, the context per page. */
|
|
157
|
+
defaults: AgenticoRouting;
|
|
158
|
+
/** Where the changes people make are kept (Settings › Subagents, Tools, Pages). Absent: shown,
|
|
159
|
+
* not changed. Keep it stable (memoized). */
|
|
160
|
+
store?: AgenticoRoutingStore | null;
|
|
161
|
+
/** The person may see the routing but not change it. */
|
|
162
|
+
readOnly?: boolean;
|
|
163
|
+
}
|
|
164
|
+
/** CR-023: the routing in use (the host's defaults with the changes kept), for the settings modal. */
|
|
165
|
+
export interface AgenticoRoutingState {
|
|
166
|
+
/** The current path, `null` without `<AgenticoProvider route>`. */
|
|
167
|
+
path: string | null;
|
|
168
|
+
defaults: AgenticoRouting;
|
|
169
|
+
/** The defaults with the changes kept. */
|
|
170
|
+
routing: AgenticoRouting;
|
|
171
|
+
/** The page rules in use, each with its origin. */
|
|
172
|
+
pages: AgenticoPageRuleWithOrigin[];
|
|
173
|
+
/** The changes kept (what differs from the defaults: a subagent or tool listed here is modified). */
|
|
174
|
+
changes: AgenticoRoutingChanges;
|
|
175
|
+
/** Present when the person may change it. Throws when the store refuses. */
|
|
176
|
+
save: ((next: AgenticoRouting) => Promise<void>) | null;
|
|
177
|
+
/** Why the kept changes could not be read (the defaults apply meanwhile). */
|
|
178
|
+
error: string | null;
|
|
179
|
+
}
|
|
149
180
|
interface AgenticoContextValue {
|
|
150
181
|
/** The host scope passed to <AgenticoProvider scope>. */
|
|
151
182
|
scope: AgenticoScope | null;
|
|
183
|
+
/** CR-023: what is offered on the current path (<AgenticoProvider route>), `null` = no routing: everything offered. */
|
|
184
|
+
route: AgenticoRouteMatch | null;
|
|
185
|
+
/** CR-023: the routing in use and how to change it. */
|
|
186
|
+
routing: AgenticoRoutingState;
|
|
152
187
|
/** CR-018: the person using the panel (<AgenticoProvider person>): the author of their messages. */
|
|
153
188
|
person: ChatAuthor | null;
|
|
154
189
|
/** CR-019: where the panel reads what happened around a chat (<AgenticoProvider threadEvents>). */
|
|
@@ -337,8 +372,15 @@ interface AgenticoContextValue {
|
|
|
337
372
|
/** Changes at every startSubagent() — React `key` of that SubagentRunner. */
|
|
338
373
|
startRunId: string | null;
|
|
339
374
|
}
|
|
340
|
-
export declare function AgenticoProvider({ children, scope, person, threadEvents }: {
|
|
375
|
+
export declare function AgenticoProvider({ children, scope, person, threadEvents, settings, route: routeProp }: {
|
|
341
376
|
children: React.ReactNode;
|
|
377
|
+
/** CR-023: the current path of the host app and its routing (see routing.ts): which subagents and
|
|
378
|
+
* data-collection tools are offered there, and the context the model gets. Absent = everything
|
|
379
|
+
* offered, no context. Keep `defaults` stable (memoized). */
|
|
380
|
+
route?: AgenticoRoute | null;
|
|
381
|
+
/** CR-022: the settings of Agentico: where they are kept, which ones the code fixes or hides, and the connectors
|
|
382
|
+
* of the AI providers shown in the settings modal. Keep it stable (memoized). */
|
|
383
|
+
settings?: AgenticoSettingsConfig;
|
|
342
384
|
scope?: AgenticoScope | null;
|
|
343
385
|
/** CR-018: who uses the panel: their messages carry their name and picture, kept with the chat. */
|
|
344
386
|
person?: ChatAuthor | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type AgenticoPageRule } from '../domain/routing';
|
|
3
|
+
/** A tool name made readable: `read_sitemap` → "Read sitemap". The name itself stays in the editor title. */
|
|
4
|
+
export declare function toolLabel(name: string): string;
|
|
5
|
+
export declare function AgenticoSubagentsSettings({ onStack }: {
|
|
6
|
+
onStack?: (open: boolean) => void;
|
|
7
|
+
}): React.JSX.Element;
|
|
8
|
+
export declare function AgenticoToolsSettings({ onStack }: {
|
|
9
|
+
onStack?: (open: boolean) => void;
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
/** The editor of a page rule. `flags` is not shown (only `i` would matter, paths are lower case): kept as it is.
|
|
12
|
+
* `active`: the switch on = the rule applies; a default rule is switched off instead of deleted. */
|
|
13
|
+
export type AgenticoPageRuleForm = {
|
|
14
|
+
id: string;
|
|
15
|
+
label: string;
|
|
16
|
+
pattern: string;
|
|
17
|
+
flags: string;
|
|
18
|
+
context: string;
|
|
19
|
+
active: string;
|
|
20
|
+
};
|
|
21
|
+
/** The page rule written in the editor; empty optional fields left out. */
|
|
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;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AIConnectionsProps } from '@llmnative/react';
|
|
3
|
+
import { type AgenticoSettingKey, type AgenticoSettings, type AgenticoSettingsStore } from '../domain/settings';
|
|
4
|
+
/** What the host says about the settings (`<AgenticoProvider settings>`). */
|
|
5
|
+
export interface AgenticoSettingsConfig {
|
|
6
|
+
/** Where the values the person changes are kept; absent: this browser. */
|
|
7
|
+
store?: AgenticoSettingsStore;
|
|
8
|
+
/** Values fixed in code: applied, not shown, not changed. */
|
|
9
|
+
fixed?: Partial<AgenticoSettings>;
|
|
10
|
+
/** Settings not shown: they keep their saved or default value. */
|
|
11
|
+
hidden?: AgenticoSettingKey[];
|
|
12
|
+
/** The section Connectors of the modal: the AI providers (and the host's connectors, e.g. a subscription on a runner). */
|
|
13
|
+
connections?: Omit<AIConnectionsProps, 'className'>;
|
|
14
|
+
}
|
|
15
|
+
interface AgenticoSettingsContextValue {
|
|
16
|
+
settings: AgenticoSettings;
|
|
17
|
+
/** The settings the modal shows. */
|
|
18
|
+
shown: AgenticoSettingKey[];
|
|
19
|
+
connections?: AgenticoSettingsConfig['connections'];
|
|
20
|
+
save: (values: Partial<AgenticoSettings>) => Promise<void>;
|
|
21
|
+
isOpen: boolean;
|
|
22
|
+
open: () => void;
|
|
23
|
+
close: () => void;
|
|
24
|
+
}
|
|
25
|
+
export declare function AgenticoSettingsProvider({ config, children }: {
|
|
26
|
+
config?: AgenticoSettingsConfig;
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
}): React.JSX.Element;
|
|
29
|
+
/** The settings of Agentico; the defaults outside `<AgenticoProvider>`. */
|
|
30
|
+
export declare function useAgenticoSettings(): AgenticoSettingsContextValue;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/** Whether the modal has anything to show: a setting the person changes, the subagents, tools and pages (CR-023), or the connectors. */
|
|
3
|
+
export declare function useHasAgenticoSettings(): boolean;
|
|
4
|
+
export declare function AgenticoSettingsModal(): React.JSX.Element | null;
|
|
@@ -2,8 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import type { ThreadEvent } from '../domain/threadEvents';
|
|
3
3
|
/** Where the person's choice to see the events or not is kept (this browser only). */
|
|
4
4
|
export declare const THREAD_EVENTS_STORAGE_KEY = "llmnative.agentico.threadEvents";
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Whether the events are shown (the filter in the header of the panel): on unless the person turned them off; never
|
|
7
|
+
* when the settings of Agentico turn them off (CR-022), and then the filter is not offered.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useShowThreadEvents(): [boolean, (show: boolean) => void, boolean];
|
|
7
10
|
/** The events of `thread` from `from` to `to`, as the host has them; none without a source or a thread. */
|
|
8
11
|
export declare function useThreadEvents(thread: string | undefined, from: number, to: number, enabled?: boolean): ThreadEvent[];
|
|
9
12
|
/** One event: who did it in the column on the left, what happened next to their name, its time; opened, what it said. */
|
|
@@ -6,4 +6,10 @@ export interface UseAIModelCatalogResult {
|
|
|
6
6
|
selectedModel: string;
|
|
7
7
|
setSelectedModel: (id: string) => void;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The AI catalog of the chats: the providers the settings allow (CR-022), and the model picked — else the one
|
|
11
|
+
* the settings start with. `unfiltered`: every connected provider (the settings modal).
|
|
12
|
+
*/
|
|
13
|
+
export declare function useAIModelCatalog({ unfiltered }?: {
|
|
14
|
+
unfiltered?: boolean;
|
|
15
|
+
}): UseAIModelCatalogResult;
|
package/llms.txt
CHANGED
|
@@ -54,7 +54,11 @@ CR-012: `executor.catalogReasoning(params, provider) → 'low' | 'medium' | 'hig
|
|
|
54
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? }` puts the picture of the agent in a column on the left, its name next to it with a closed summary of the reasoning and steps before its text ("Reasoned for 4 s · 1 step", opened with a click), the text under them; `<AgenticoProvider person={{ name, avatarUrl? }}>` writes `author` on each message of the person (kept in the snapshot): their picture in the same column, Edit and Retry under it, the name above the full-width message; without a picture an `Identicon` of the name. `chatThreadOf(snapshot)`, `earlierSessions(scopeId, thread, openTaskId)`.
|
|
55
55
|
CR-019: `<AgenticoProvider threadEvents={source}>` (keep it memoized): `source.load(thread, from, to)` → `ThreadEvent[]` (`id`, `at` ms, `author` ChatAuthor, `title`, optional `body` Markdown, `badge`, `href`, `icon`), optional `source.subscribe(thread, onChange)` → unsubscribe. In a chat with a `thread` the panel shows them among the turns by time (`placeEvents`), as compact cards with the author's picture in the left column (opened: the body; a link to `href`); the open session from the last message of the session before it, each earlier one up to its last message. Header filter "Conversation only" (kept in this browser, `llmnative.agentico.threadEvents`). The model never reads them. Every entry of a chat now keeps `at` (when it was born); entries saved before 0.18.0 have none.
|
|
56
56
|
CR-020: the images attached to a message of the person stay in sight as previews (`entry.attachmentPreviews`: JPEG data URLs of at most 480 px a side, the first 4 images, drawn in the browser by `imagePreviews(files)` and kept with the chat); a click opens one larger; files without a preview stay as their names. `ThreadEvent.running: true` shows a spinner in place of its icon (an agent still at work on it).
|
|
57
|
+
CR-022: `<AgenticoProvider settings={{ store?, fixed?, hidden?, connections? }}>` (memoized). Settings `defaultModel` (`provider/model` the chats start with), `reasoning` (when `executor.catalogReasoning` says nothing), `providers` (the AI catalog the chats may use), `chatTitles`, `threadEvents`: fixed > saved (host `store.load/save`, default this browser) > default. The gear in the panel header opens `AgenticoSettingsModal`: the settings neither fixed nor hidden, and `connections` as `AIConnections` (@llmnative/react 3.2). `useAgenticoSettings()` → `{ settings, shown, save, open, close }`. Peer `@llmnative/react` ^3.2.0.
|
|
58
|
+
|
|
57
59
|
CR-021: `ThreadEvent.open: true` shows its body at once; `ThreadEvent.actions: [{ id, label, icon?, primary? }]` are buttons on its card, run by `ThreadEventsSource.onAction(event, actionId, chat)`: `chat.compose(text)` puts a text in the field of the chat open in the panel (the person changes and sends it), `chat.send(text)` sends it as a message of the person (composed instead while a turn runs). `useAgentico().compose(text)` does the same anywhere (it opens the panel).
|
|
58
60
|
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.
|
|
59
61
|
|
|
60
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
|
+
|
|
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llmnative/agentico",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.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",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"packageManager": "npm@11.11.0",
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@llmnative/react": "^
|
|
51
|
+
"@llmnative/react": "^3.2.0",
|
|
52
52
|
"react": "^19.2.0",
|
|
53
53
|
"react-dom": "^19.2.0",
|
|
54
54
|
"zod": "^3.24.1"
|
|
@@ -57,12 +57,14 @@
|
|
|
57
57
|
"zod-to-json-schema": "^3.24.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@llmnative/react": "^
|
|
60
|
+
"@llmnative/react": "^3.2.0",
|
|
61
61
|
"@phosphor-icons/react": "^2.1.10",
|
|
62
|
+
"@supabase/supabase-js": "^2.119.0",
|
|
62
63
|
"@testing-library/jest-dom": "^7.0.1",
|
|
63
64
|
"@testing-library/react": "^16.3.3",
|
|
64
65
|
"@types/react": "^19.3.0",
|
|
65
66
|
"@types/react-dom": "^19.3.0",
|
|
67
|
+
"firebase": "^12.19.0",
|
|
66
68
|
"happy-dom": "^20.14.5",
|
|
67
69
|
"lucide-react": "^1.52.0",
|
|
68
70
|
"react": "^19.3.0",
|