@llmnative/agentico 0.22.1 → 0.24.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.
@@ -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). */
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { AIConnectionsProps } from '@llmnative/react';
3
+ import type { AgenticoBackend } from '../backend/agenticoBackend';
3
4
  import { type AgenticoSettingKey, type AgenticoSettings, type AgenticoSettingsStore } from '../domain/settings';
4
5
  /** What the host says about the settings (`<AgenticoProvider settings>`). */
5
6
  export interface AgenticoSettingsConfig {
@@ -11,12 +12,27 @@ export interface AgenticoSettingsConfig {
11
12
  hidden?: AgenticoSettingKey[];
12
13
  /** The section Connectors of the modal: the AI providers (and the host's connectors, e.g. a subscription on a runner). */
13
14
  connections?: Omit<AIConnectionsProps, 'className'>;
15
+ /** CR-024: tabs of the host after Agentico's (e.g. "My subscriptions" on a runner), drawn by the host. */
16
+ tabs?: AgenticoSettingsTab[];
17
+ /**
18
+ * CR-026: the server of Agentico of the host (`createAgenticoBackend`): the tabs Connections (Cloud, the runners,
19
+ * Add a runner), Memory and Projects. With it, Cloud takes the place of the Connectors section.
20
+ */
21
+ backend?: AgenticoBackend;
22
+ }
23
+ /** A tab of the host in the settings modal. */
24
+ export interface AgenticoSettingsTab {
25
+ id: string;
26
+ label: string;
27
+ render: () => React.ReactNode;
14
28
  }
15
29
  interface AgenticoSettingsContextValue {
16
30
  settings: AgenticoSettings;
17
31
  /** The settings the modal shows. */
18
32
  shown: AgenticoSettingKey[];
19
33
  connections?: AgenticoSettingsConfig['connections'];
34
+ tabs?: AgenticoSettingsTab[];
35
+ backend?: AgenticoBackend;
20
36
  save: (values: Partial<AgenticoSettings>) => Promise<void>;
21
37
  isOpen: boolean;
22
38
  open: () => void;
@@ -0,0 +1,6 @@
1
+ import type { AgenticoBackend } from '../backend/agenticoBackend';
2
+ import type { AgenticoHarness } from '../domain/harness';
3
+ export declare function BackendHarness({ backend, onChange }: {
4
+ backend: AgenticoBackend;
5
+ onChange: (harness: AgenticoHarness | null) => void;
6
+ }): null;
@@ -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;
@@ -0,0 +1,80 @@
1
+ import { type AICompleteRequest, type AICompleteResult, type AIModelDescriptor, type AIProviderAdapter } from '@llmnative/react/server';
2
+ import type { AgenticoRecords, AgenticoSecrets } from './ports';
3
+ export declare const CONNECTIONS = "agentico_connections";
4
+ type Account = {
5
+ id: string;
6
+ label?: string;
7
+ at: string;
8
+ };
9
+ type Provider = {
10
+ id: string;
11
+ at: string;
12
+ fields?: Record<string, string>;
13
+ accounts: Account[];
14
+ };
15
+ /** The connections of a namespace, one document: never a key. */
16
+ export interface ConnectionsRecord {
17
+ id: string;
18
+ providers: Provider[];
19
+ order?: {
20
+ list: string[];
21
+ manual: boolean;
22
+ };
23
+ }
24
+ export type ConnectionsSnapshot = {
25
+ providers: Array<{
26
+ id: string;
27
+ at?: string;
28
+ fields?: Record<string, string>;
29
+ accounts?: Array<{
30
+ id: string;
31
+ label?: string;
32
+ at?: string;
33
+ }>;
34
+ }>;
35
+ order?: {
36
+ list: string[];
37
+ manual: boolean;
38
+ };
39
+ };
40
+ export type ConnectionResult = {
41
+ ok: true;
42
+ } | {
43
+ ok: false;
44
+ error?: string;
45
+ };
46
+ /** Builds the adapter of a provider from its fields (the key among them); a host can give its own. */
47
+ export type AdapterFactory = (provider: string, fields: Record<string, string>) => Promise<AIProviderAdapter>;
48
+ export declare const defaultAdapterFactory: AdapterFactory;
49
+ export type ConnectionsDeps = {
50
+ records: AgenticoRecords;
51
+ secrets: AgenticoSecrets;
52
+ adapter?: AdapterFactory;
53
+ now?: () => Date;
54
+ };
55
+ export declare function createConnections(deps: ConnectionsDeps): {
56
+ /** What is connected: never a key. */
57
+ snapshot(namespace: string): Promise<ConnectionsSnapshot>;
58
+ /** Connects a provider with its first account: any account it had is replaced. */
59
+ connect(namespace: string, provider: string, fields: Record<string, string>): Promise<ConnectionResult>;
60
+ addAccount(namespace: string, provider: string, fields: Record<string, string>): Promise<ConnectionResult>;
61
+ disconnect(namespace: string, provider: string): Promise<void>;
62
+ removeAccount(namespace: string, provider: string, accountId: string): Promise<void>;
63
+ orderAccounts(namespace: string, provider: string, accountIds: string[]): Promise<void>;
64
+ setOrder(namespace: string, order: string[] | null): Promise<void>;
65
+ /** The adapter of a provider with its first account: what the server answers with. */
66
+ adapter(namespace: string, provider: string): Promise<AIProviderAdapter | null>;
67
+ models(namespace: string, provider: string): Promise<AIModelDescriptor[]>;
68
+ /** A request answered on the server with the key of the namespace. */
69
+ complete(namespace: string, provider: string, request: AICompleteRequest): Promise<AICompleteResult | null>;
70
+ /**
71
+ * The proxy of the browser (CR-102): the placeholders of the request swapped for the keys of the namespace,
72
+ * only towards a host of their provider. The scope of a placeholder must be the namespace itself.
73
+ */
74
+ resolve(namespace: string, request: {
75
+ url: string;
76
+ headers: Record<string, string>;
77
+ }): Promise<import("@llmnative/react/server").ServerCredentialResolution>;
78
+ };
79
+ export type Connections = ReturnType<typeof createConnections>;
80
+ export {};
@@ -0,0 +1,11 @@
1
+ export { createAgenticoServer } from './server';
2
+ export type { AgenticoServer, AgenticoServerOptions } from './server';
3
+ export type { AgenticoIdentity, AgenticoKnownTenant, AgenticoRecords, AgenticoRole, AgenticoSecrets } from './ports';
4
+ export { namespaceOf, inProject, tenantOf, PROJECT_ID, TENANT_ID, NamespaceError } from './namespace';
5
+ export { memoryStores, fileStores } from './stores';
6
+ export { createConnections, defaultAdapterFactory, CONNECTIONS } from './connections';
7
+ export type { AdapterFactory, Connections, ConnectionsSnapshot, ConnectionResult } from './connections';
8
+ export { createFleet, FleetError, normalizeRunnerUrl, NAMESPACE_KEY_PERMISSIONS, RUNNERS, NAMESPACES } from './runners';
9
+ export type { Fleet, RunnerEntry, RunnerRecord, NamespaceRecord, RunnerConnection, RunnerTarget } from './runners';
10
+ export { createMemories, MemoryError, MEMORIES } from './memories';
11
+ export type { Memories, MemoryEntry, MemoryCheck, MemoryHit } from './memories';
@@ -0,0 +1,76 @@
1
+ import type { AgenticoRecords, AgenticoSecrets } from './ports';
2
+ export declare const MEMORIES = "agentico_memories";
3
+ export interface MemoryRecord {
4
+ id: string;
5
+ name: string;
6
+ /** The API: `<apiUrl>/ns/<namespace>/search`, `/document`. */
7
+ apiUrl: string;
8
+ /** The MCP server the agents and the IDE connect to. */
9
+ mcpUrl?: string;
10
+ createdAt: number;
11
+ }
12
+ export type MemoryEntry = Omit<MemoryRecord, 'createdAt'>;
13
+ export type MemoryCheck = {
14
+ ok: true;
15
+ } | {
16
+ ok: false;
17
+ error: 'rejected' | 'unreachable' | 'invalid';
18
+ status?: number;
19
+ };
20
+ export type MemoryHit = {
21
+ id?: string;
22
+ title?: string;
23
+ content: string;
24
+ score?: number;
25
+ metadata?: Record<string, unknown>;
26
+ };
27
+ export declare class MemoryError extends Error {
28
+ readonly code: 'invalid' | 'not-found' | 'conflict' | 'unreachable' | 'rejected';
29
+ constructor(code: MemoryError['code'], reason: string);
30
+ }
31
+ export type MemoriesDeps = {
32
+ records: AgenticoRecords;
33
+ secrets: AgenticoSecrets;
34
+ fetch?: typeof fetch;
35
+ newId?: () => string;
36
+ now?: () => number;
37
+ };
38
+ export declare function createMemories(deps: MemoriesDeps): {
39
+ list(): Promise<MemoryEntry[]>;
40
+ /** Whether a memory answers with these credentials: a search that finds nothing is fine. */
41
+ check(input: {
42
+ apiUrl: string;
43
+ key: string;
44
+ }): Promise<MemoryCheck>;
45
+ /** Adds a memory once it answers with its key. */
46
+ add(input: {
47
+ name?: string;
48
+ apiUrl: string;
49
+ mcpUrl?: string;
50
+ key: string;
51
+ }): Promise<MemoryEntry>;
52
+ /** Name and MCP address; a new key only when given (it is checked first). */
53
+ update(id: string, patch: {
54
+ name?: string;
55
+ mcpUrl?: string | null;
56
+ key?: string;
57
+ }): Promise<MemoryEntry>;
58
+ remove(id: string, inUse: boolean): Promise<void>;
59
+ /** The passages of a namespace that answer a query, best first. */
60
+ search(id: string, namespace: string, query: string, limit?: number): Promise<MemoryHit[]>;
61
+ /** Writes a document in a namespace; the same `documentId` replaces it. */
62
+ write(id: string, namespace: string, input: {
63
+ title: string;
64
+ content: string;
65
+ documentId?: string;
66
+ }): Promise<{
67
+ id?: string;
68
+ }>;
69
+ /** What an agent or an IDE needs to reach the memory of a namespace: never the key (asked apart, once). */
70
+ coordinates(id: string, namespace: string): Promise<{
71
+ apiUrl: string;
72
+ mcpUrl?: string;
73
+ namespace: string;
74
+ }>;
75
+ };
76
+ export type Memories = ReturnType<typeof createMemories>;
@@ -0,0 +1,13 @@
1
+ /** A project: no hyphen, so that `<project>-<tenant>` names one project only (the rule of the runner, 1.2). */
2
+ export declare const PROJECT_ID: RegExp;
3
+ /** A tenant: what fits after `<project>-` in a tenant of the runner (63 characters in all). */
4
+ export declare const TENANT_ID: RegExp;
5
+ export declare class NamespaceError extends Error {
6
+ constructor(message: string);
7
+ }
8
+ /** The namespace of a project and its tenant, checked. */
9
+ export declare function namespaceOf(project: string, tenant?: string): string;
10
+ /** Whether a namespace is of a project. */
11
+ export declare const inProject: (project: string, namespace: string) => boolean;
12
+ /** The tenant of a namespace of a project, or undefined for the project itself. */
13
+ export declare const tenantOf: (project: string, namespace: string) => string | undefined;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * What a person may do:
3
+ * - `platform`: the runners and memories of the project, and which runner and memory each namespace uses;
4
+ * - `admin`: the cloud connections of their namespace;
5
+ * - `member`: use them (models, runner, memory).
6
+ */
7
+ export type AgenticoRole = 'platform' | 'admin' | 'member';
8
+ /** Who asks, as the host knows it from its own sign-in. */
9
+ export interface AgenticoIdentity {
10
+ user: {
11
+ id: string;
12
+ name?: string;
13
+ };
14
+ role: AgenticoRole;
15
+ /** The project of the host (`crm`, `cms`, `playbook`): lowercase letters and digits, no hyphen. */
16
+ project: string;
17
+ /** The tenant inside a multi-tenant project; absent for a project with one tenant. */
18
+ tenant?: string;
19
+ }
20
+ /** Documents that are not secret, by collection; every document carries its own `id`. */
21
+ export interface AgenticoRecords {
22
+ get<T extends {
23
+ id: string;
24
+ }>(collection: string, id: string): Promise<T | null>;
25
+ list<T extends {
26
+ id: string;
27
+ }>(collection: string): Promise<T[]>;
28
+ put<T extends {
29
+ id: string;
30
+ }>(collection: string, record: T): Promise<void>;
31
+ delete(collection: string, id: string): Promise<void>;
32
+ }
33
+ /** Secrets by name (keys of runners and providers, keys of memories): never in a document, an answer or a log. */
34
+ export interface AgenticoSecrets {
35
+ get(name: string): Promise<string | null>;
36
+ set(name: string, value: string): Promise<void>;
37
+ delete(name: string): Promise<void>;
38
+ }
39
+ /** A tenant of the project the host knows (the tenants of a CMS): listed in Projects even before it has a runner. */
40
+ export type AgenticoKnownTenant = {
41
+ id: string;
42
+ name?: string;
43
+ };
@@ -0,0 +1,180 @@
1
+ import { type RunnerKey, type RunnerPairingPoll, type RunnerPairingRequest, type RunnerPermission, type RunnerStatus, type RunnerTenant } from '@llmnative/runner/client';
2
+ import { installOverSsh, type InstallProgress, type SshTarget } from '@llmnative/runner/setup';
3
+ import type { AgenticoRecords, AgenticoSecrets } from './ports';
4
+ export declare const RUNNERS = "agentico_runners";
5
+ export declare const PAIRINGS = "agentico_runner_pairings";
6
+ export declare const NAMESPACES = "agentico_namespaces";
7
+ export declare const RUNNER_CHATS = "agentico_runner_chats";
8
+ export declare const INSTALLS = "agentico_runner_installs";
9
+ export interface RunnerRecord {
10
+ id: string;
11
+ name: string;
12
+ url: string;
13
+ isDefault: boolean;
14
+ draining: boolean;
15
+ /** The id of the platform key on the runner, to revoke it when the runner is removed. */
16
+ keyId?: string;
17
+ hostFingerprint?: string;
18
+ createdAt: number;
19
+ updatedAt: number;
20
+ }
21
+ /** What the pages see of a runner: never its key. */
22
+ export type RunnerEntry = {
23
+ id: string;
24
+ name: string;
25
+ url: string;
26
+ isDefault: boolean;
27
+ draining: boolean;
28
+ };
29
+ /** Which runner and memory a namespace uses. */
30
+ export interface NamespaceRecord {
31
+ id: string;
32
+ runnerId?: string;
33
+ /** The id of the key of the namespace on its runner. */
34
+ runnerKeyId?: string;
35
+ memoryId?: string;
36
+ }
37
+ export interface InstallRecord {
38
+ id: string;
39
+ status: 'running' | 'done' | 'error';
40
+ lines: string[];
41
+ runnerId?: string;
42
+ error?: string;
43
+ startedBy: string;
44
+ }
45
+ /** The part of RunnerClient the fleet uses (a fake one in the tests). */
46
+ export interface RunnerConnection {
47
+ pair(code: string, name?: string, project?: string): Promise<{
48
+ key: string;
49
+ record: RunnerKey;
50
+ version: string;
51
+ }>;
52
+ requestPairing(name: string, project?: string): Promise<RunnerPairingRequest>;
53
+ pollPairing(request: string): Promise<RunnerPairingPoll>;
54
+ platform: {
55
+ status(): Promise<RunnerStatus>;
56
+ tenants(): Promise<RunnerTenant[]>;
57
+ createTenant(id: string, options?: {
58
+ name?: string;
59
+ key?: boolean;
60
+ keyPermissions?: RunnerPermission[];
61
+ }): Promise<{
62
+ tenant: RunnerTenant;
63
+ key?: string;
64
+ keyRecord?: RunnerKey;
65
+ }>;
66
+ createKey(tenant: string, input?: {
67
+ name?: string;
68
+ permissions?: RunnerPermission[];
69
+ }): Promise<{
70
+ key: string;
71
+ record: RunnerKey;
72
+ }>;
73
+ revokeKey(tenant: string, id: string): Promise<boolean>;
74
+ revokePlatformKey(id: string): Promise<boolean>;
75
+ };
76
+ }
77
+ export type FleetErrorCode = 'invalid' | 'not-found' | 'conflict';
78
+ export declare class FleetError extends Error {
79
+ readonly code: FleetErrorCode;
80
+ constructor(code: FleetErrorCode, reason: string);
81
+ }
82
+ /** What the backend of the host does for the people of a namespace: always as one of them (act-as-user). */
83
+ export declare const NAMESPACE_KEY_PERMISSIONS: RunnerPermission[];
84
+ export declare function normalizeRunnerUrl(value: string): string;
85
+ export type FleetDeps = {
86
+ project: string;
87
+ /** How the platform is named on the runner (its console shows it): e.g. the name of the host. */
88
+ platformName: string;
89
+ records: AgenticoRecords;
90
+ secrets: AgenticoSecrets;
91
+ connect?: (url: string, key?: string) => RunnerConnection;
92
+ install?: typeof installOverSsh;
93
+ newId?: () => string;
94
+ now?: () => number;
95
+ };
96
+ /** Where a request of a person goes. */
97
+ export type RunnerTarget = {
98
+ runnerId: string;
99
+ url: string;
100
+ key: string;
101
+ };
102
+ export declare function createFleet(deps: FleetDeps): {
103
+ list(): Promise<RunnerEntry[]>;
104
+ /** Connects a runner with a pairing code (the key it gives, of this project, stays here). */
105
+ add(input: {
106
+ name?: string;
107
+ url: string;
108
+ code?: string;
109
+ key?: string;
110
+ }, extra?: {
111
+ hostFingerprint?: string;
112
+ }): Promise<RunnerEntry>;
113
+ /** Asks a runner to connect (device flow, with the project): its admin approves in its console. */
114
+ startPairing(input: {
115
+ name?: string;
116
+ url: string;
117
+ }, startedBy: string): Promise<{
118
+ id: string;
119
+ code: string;
120
+ approveUrl: string;
121
+ expiresAt: string;
122
+ }>;
123
+ /** How a request goes; approved, the runner is connected with the key it gave (once). */
124
+ pairingStatus(id: string, startedBy: string): Promise<{
125
+ status: 'pending' | 'denied' | 'expired';
126
+ } | {
127
+ status: 'approved';
128
+ runner: RunnerEntry;
129
+ }>;
130
+ update(id: string, patch: {
131
+ name?: string;
132
+ isDefault?: boolean;
133
+ draining?: boolean;
134
+ }): Promise<void>;
135
+ /** Only a runner no namespace uses: its people would lose their chats and subscriptions there. */
136
+ remove(id: string): Promise<void>;
137
+ status(id: string): Promise<RunnerStatus>;
138
+ /**
139
+ * Puts a namespace on a runner: the tenant there (made if missing) and a key of its own, kept as a secret.
140
+ * Moving it, the key on the runner before is revoked unless `keepBefore` (chats still going there).
141
+ */
142
+ assign(namespace: string, runnerId: string, options?: {
143
+ keepBefore?: boolean;
144
+ name?: string;
145
+ }): Promise<void>;
146
+ /**
147
+ * Where a request of a person of a namespace goes. A chat going stays on the runner it started on; a new chat
148
+ * leaves a draining runner for the default one; a namespace without a runner is put on the default one.
149
+ */
150
+ route(namespace: string, request?: {
151
+ newChat?: boolean;
152
+ chat?: string;
153
+ user?: string;
154
+ }): Promise<RunnerTarget | null>;
155
+ /** A chat started: where, so that its next messages go there too. */
156
+ chatStarted(namespace: string, user: string, chat: string, runnerId: string): Promise<void>;
157
+ chatClosed(namespace: string, user: string, chat: string): Promise<void>;
158
+ /**
159
+ * Installs a runner over SSH and connects it; the log goes to its document as it comes. The SSH access is used
160
+ * for this connection only, never kept.
161
+ */
162
+ install(input: {
163
+ name?: string;
164
+ domain: string;
165
+ access: SshTarget;
166
+ version?: string;
167
+ }, startedBy: string, onProgress?: (progress: InstallProgress) => void): Promise<{
168
+ installId: string;
169
+ done: Promise<RunnerEntry>;
170
+ }>;
171
+ /** The log of an installation from a line on. */
172
+ installState(installId: string, startedBy: string, from?: number): Promise<{
173
+ status: InstallRecord['status'];
174
+ lines: string[];
175
+ next: number;
176
+ runnerId?: string;
177
+ error?: string;
178
+ } | null>;
179
+ };
180
+ export type Fleet = ReturnType<typeof createFleet>;
@@ -0,0 +1,141 @@
1
+ import { type RunnerStatus } from '@llmnative/runner/client';
2
+ import { type AdapterFactory } from './connections';
3
+ import { type MemoryEntry } from './memories';
4
+ import type { AgenticoIdentity, AgenticoKnownTenant, AgenticoRecords, AgenticoSecrets } from './ports';
5
+ import { createFleet, type RunnerConnection, type RunnerEntry } from './runners';
6
+ export type AgenticoServerOptions = {
7
+ /** Who asks, from the sign-in of the host; null: not signed in (401). */
8
+ identity: (request: Request) => Promise<AgenticoIdentity | null>;
9
+ records: AgenticoRecords;
10
+ secrets: AgenticoSecrets;
11
+ /** How the platform is named on the runners it connects (their console shows it), e.g. "Consuletica CRM". */
12
+ platformName: string;
13
+ /** The tenants of the project the host knows, listed in Projects even before they have a runner or a memory. */
14
+ tenants?: (identity: AgenticoIdentity) => Promise<AgenticoKnownTenant[]>;
15
+ /**
16
+ * The headers that carry the session of the host (e.g. `x-session`): never forwarded by the proxy of the AI
17
+ * requests. The session must not be in `authorization` there, which is the provider's.
18
+ */
19
+ sessionHeaders?: string[];
20
+ /** The path the handler is mounted on (e.g. `/api/agentico`): stripped from every request. */
21
+ basePath?: string;
22
+ adapter?: AdapterFactory;
23
+ fetch?: typeof fetch;
24
+ connectRunner?: (url: string, key?: string) => RunnerConnection;
25
+ install?: Parameters<typeof createFleet>[0]['install'];
26
+ log?: (event: string, details?: Record<string, unknown>) => void;
27
+ now?: () => number;
28
+ };
29
+ export declare function createAgenticoServer(options: AgenticoServerOptions): {
30
+ connections: {
31
+ snapshot(namespace: string): Promise<import("./connections").ConnectionsSnapshot>;
32
+ connect(namespace: string, provider: string, fields: Record<string, string>): Promise<import("./connections").ConnectionResult>;
33
+ addAccount(namespace: string, provider: string, fields: Record<string, string>): Promise<import("./connections").ConnectionResult>;
34
+ disconnect(namespace: string, provider: string): Promise<void>;
35
+ removeAccount(namespace: string, provider: string, accountId: string): Promise<void>;
36
+ orderAccounts(namespace: string, provider: string, accountIds: string[]): Promise<void>;
37
+ setOrder(namespace: string, order: string[] | null): Promise<void>;
38
+ adapter(namespace: string, provider: string): Promise<import("@llmnative/react").AIProviderAdapter | null>;
39
+ models(namespace: string, provider: string): Promise<import("@llmnative/react").AIModelDescriptor[]>;
40
+ complete(namespace: string, provider: string, request: import("@llmnative/react").AICompleteRequest): Promise<import("@llmnative/react").AICompleteResult | null>;
41
+ resolve(namespace: string, request: {
42
+ url: string;
43
+ headers: Record<string, string>;
44
+ }): Promise<import("@llmnative/react/server").ServerCredentialResolution>;
45
+ };
46
+ memories: {
47
+ list(): Promise<MemoryEntry[]>;
48
+ check(input: {
49
+ apiUrl: string;
50
+ key: string;
51
+ }): Promise<import("./memories").MemoryCheck>;
52
+ add(input: {
53
+ name?: string;
54
+ apiUrl: string;
55
+ mcpUrl?: string;
56
+ key: string;
57
+ }): Promise<MemoryEntry>;
58
+ update(id: string, patch: {
59
+ name?: string;
60
+ mcpUrl?: string | null;
61
+ key?: string;
62
+ }): Promise<MemoryEntry>;
63
+ remove(id: string, inUse: boolean): Promise<void>;
64
+ search(id: string, namespace: string, query: string, limit?: number): Promise<import("./memories").MemoryHit[]>;
65
+ write(id: string, namespace: string, input: {
66
+ title: string;
67
+ content: string;
68
+ documentId?: string;
69
+ }): Promise<{
70
+ id?: string;
71
+ }>;
72
+ coordinates(id: string, namespace: string): Promise<{
73
+ apiUrl: string;
74
+ mcpUrl?: string;
75
+ namespace: string;
76
+ }>;
77
+ };
78
+ fleet: (project: string) => {
79
+ list(): Promise<RunnerEntry[]>;
80
+ add(input: {
81
+ name?: string;
82
+ url: string;
83
+ code?: string;
84
+ key?: string;
85
+ }, extra?: {
86
+ hostFingerprint?: string;
87
+ }): Promise<RunnerEntry>;
88
+ startPairing(input: {
89
+ name?: string;
90
+ url: string;
91
+ }, startedBy: string): Promise<{
92
+ id: string;
93
+ code: string;
94
+ approveUrl: string;
95
+ expiresAt: string;
96
+ }>;
97
+ pairingStatus(id: string, startedBy: string): Promise<{
98
+ status: 'pending' | 'denied' | 'expired';
99
+ } | {
100
+ status: 'approved';
101
+ runner: RunnerEntry;
102
+ }>;
103
+ update(id: string, patch: {
104
+ name?: string;
105
+ isDefault?: boolean;
106
+ draining?: boolean;
107
+ }): Promise<void>;
108
+ remove(id: string): Promise<void>;
109
+ status(id: string): Promise<RunnerStatus>;
110
+ assign(namespace: string, runnerId: string, options?: {
111
+ keepBefore?: boolean;
112
+ name?: string;
113
+ }): Promise<void>;
114
+ route(namespace: string, request?: {
115
+ newChat?: boolean;
116
+ chat?: string;
117
+ user?: string;
118
+ }): Promise<import("./runners").RunnerTarget | null>;
119
+ chatStarted(namespace: string, user: string, chat: string, runnerId: string): Promise<void>;
120
+ chatClosed(namespace: string, user: string, chat: string): Promise<void>;
121
+ install(input: {
122
+ name?: string;
123
+ domain: string;
124
+ access: import("@llmnative/runner/setup").SshTarget;
125
+ version?: string;
126
+ }, startedBy: string, onProgress?: (progress: import("@llmnative/runner/setup").InstallProgress) => void): Promise<{
127
+ installId: string;
128
+ done: Promise<RunnerEntry>;
129
+ }>;
130
+ installState(installId: string, startedBy: string, from?: number): Promise<{
131
+ status: import("./runners").InstallRecord['status'];
132
+ lines: string[];
133
+ next: number;
134
+ runnerId?: string;
135
+ error?: string;
136
+ } | null>;
137
+ };
138
+ handle(request: Request): Promise<Response>;
139
+ };
140
+ export type AgenticoServer = ReturnType<typeof createAgenticoServer>;
141
+ export type { RunnerStatus };
@@ -0,0 +1,11 @@
1
+ import type { AgenticoRecords, AgenticoSecrets } from './ports';
2
+ /** Documents and secrets kept in memory: lost when the process ends. */
3
+ export declare function memoryStores(): {
4
+ records: AgenticoRecords;
5
+ secrets: AgenticoSecrets;
6
+ };
7
+ /** Documents in `records.json` and secrets in `secrets.json` of a folder, both 0600: the folder stays out of git. */
8
+ export declare function fileStores(folder: string): {
9
+ records: AgenticoRecords;
10
+ secrets: AgenticoSecrets;
11
+ };
package/llms.txt CHANGED
@@ -62,3 +62,5 @@ CR-011: `SubagentManifest.autoTitle: true` gives its saved chats a title from th
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
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.
66
+ CR-025/026 (0.24.0): `@llmnative/agentico/server` — `createAgenticoServer({ identity(request) → { user: { id, name? }, role: 'platform' | 'admin' | 'member', project, tenant? } | null, records, secrets, platformName, basePath?, sessionHeaders?, tenants?(identity), adapter?, fetch?, connectRunner?, install?, log? })` → `{ handle(Request): Response, connections, memories, fleet(project) }`; stores `memoryStores()`, `fileStores(dir)` (JSON 0600); namespace `namespaceOf(project, tenant?)` = `<project>[-<tenant>]` (project `^[a-z0-9]{1,32}$`). Routes: `GET me`; `connections` (GET snapshot, POST|DELETE `/:provider` {fields}, `/:provider/accounts[/:id|/order]`, PUT `/order`, GET `/:provider/models`; `?namespace=` for the platform); `ai/complete` {provider, request}; `ai/proxy?url=` (framework proxy, CR-102); `runner/v1/*` (person routes, act-as-user, chats stay on their runner), `runner-namespace/v1/accounts*` (admin); `runners` (GET, POST {url, code|key}, `pairings` POST/GET `:id`, `installs` POST/GET `:id?from=`, PATCH/DELETE `:id`, GET `:id/status`) platform; `memories` (GET, POST {apiUrl, mcpUrl?, key, name?}, POST `check`, PATCH/DELETE `:id`) platform; `memory` (GET coordinates, POST `search` {query, limit}, POST `write` {title, content, documentId?}) of the namespace; GET `projects`; PUT `namespaces/:ns` {runnerId?, memoryId?|null} platform. Browser: `createAgenticoBackend({ baseUrl, headers?, fetch? })` → `{ me, connections(namespace?) (AIConnectionStore), fleet (RunnerFleet of @llmnative/runner/ui), runner(), runnerOfNamespace() (RunnerClient), memories, memory, projects }`; `settings.backend` adds the tabs Connections (boxes Cloud / runners / Add a runner → modals), Memory (platform), Projects (admin+), replaces Connectors, and makes the runner the harness when the host gives none. Dependency `@llmnative/runner` ^1.2.0.