@framers/agentos 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +124 -81
- package/dist/api/AgentOS.d.ts +88 -3
- package/dist/api/AgentOS.d.ts.map +1 -1
- package/dist/api/AgentOS.js +73 -1
- package/dist/api/AgentOS.js.map +1 -1
- package/dist/api/AgentOSOrchestrator.d.ts.map +1 -1
- package/dist/api/AgentOSOrchestrator.js +248 -106
- package/dist/api/AgentOSOrchestrator.js.map +1 -1
- package/dist/cognitive_substrate/GMI.d.ts.map +1 -1
- package/dist/cognitive_substrate/GMI.js +5 -5
- package/dist/cognitive_substrate/GMI.js.map +1 -1
- package/dist/cognitive_substrate/personas/definitions/default_assistant_persona.json +7 -15
- package/dist/config/RetrievalAugmentorConfiguration.d.ts +1 -1
- package/dist/config/VectorStoreConfiguration.d.ts +6 -1
- package/dist/config/VectorStoreConfiguration.d.ts.map +1 -1
- package/dist/config/VectorStoreConfiguration.js +1 -1
- package/dist/config/VectorStoreConfiguration.js.map +1 -1
- package/dist/core/observability/index.d.ts +2 -0
- package/dist/core/observability/index.d.ts.map +1 -1
- package/dist/core/observability/index.js +1 -0
- package/dist/core/observability/index.js.map +1 -1
- package/dist/core/observability/otel.d.ts +101 -0
- package/dist/core/observability/otel.d.ts.map +1 -0
- package/dist/core/observability/otel.js +344 -0
- package/dist/core/observability/otel.js.map +1 -0
- package/dist/extensions/ExtensionManager.d.ts +99 -3
- package/dist/extensions/ExtensionManager.d.ts.map +1 -1
- package/dist/extensions/ExtensionManager.js +254 -53
- package/dist/extensions/ExtensionManager.js.map +1 -1
- package/dist/extensions/ExtensionRegistry.d.ts +1 -0
- package/dist/extensions/ExtensionRegistry.d.ts.map +1 -1
- package/dist/extensions/ExtensionRegistry.js +62 -15
- package/dist/extensions/ExtensionRegistry.js.map +1 -1
- package/dist/extensions/packs/schema-on-demand-pack.d.ts +34 -0
- package/dist/extensions/packs/schema-on-demand-pack.d.ts.map +1 -0
- package/dist/extensions/packs/schema-on-demand-pack.js +275 -0
- package/dist/extensions/packs/schema-on-demand-pack.js.map +1 -0
- package/dist/logging/PinoLogger.d.ts.map +1 -1
- package/dist/logging/PinoLogger.js +13 -4
- package/dist/logging/PinoLogger.js.map +1 -1
- package/dist/rag/IRetrievalAugmentor.d.ts +1 -1
- package/dist/rag/IRetrievalAugmentor.d.ts.map +1 -1
- package/dist/rag/IVectorStore.d.ts +18 -0
- package/dist/rag/IVectorStore.d.ts.map +1 -1
- package/dist/rag/RetrievalAugmentor.d.ts +2 -0
- package/dist/rag/RetrievalAugmentor.d.ts.map +1 -1
- package/dist/rag/RetrievalAugmentor.js +121 -11
- package/dist/rag/RetrievalAugmentor.js.map +1 -1
- package/dist/rag/graphrag/GraphRAGEngine.d.ts +1 -0
- package/dist/rag/graphrag/GraphRAGEngine.d.ts.map +1 -1
- package/dist/rag/graphrag/GraphRAGEngine.js +26 -2
- package/dist/rag/graphrag/GraphRAGEngine.js.map +1 -1
- package/dist/rag/graphrag/IGraphRAG.d.ts +7 -0
- package/dist/rag/graphrag/IGraphRAG.d.ts.map +1 -1
- package/dist/rag/implementations/vector_stores/SqlVectorStore.d.ts +3 -0
- package/dist/rag/implementations/vector_stores/SqlVectorStore.d.ts.map +1 -1
- package/dist/rag/implementations/vector_stores/SqlVectorStore.js +171 -39
- package/dist/rag/implementations/vector_stores/SqlVectorStore.js.map +1 -1
- package/dist/rag/reranking/index.d.ts +1 -1
- package/dist/rag/reranking/index.js +1 -1
- package/dist/rag/reranking/providers/CohereReranker.d.ts +3 -3
- package/dist/rag/reranking/providers/CohereReranker.d.ts.map +1 -1
- package/dist/rag/reranking/providers/CohereReranker.js +8 -3
- package/dist/rag/reranking/providers/CohereReranker.js.map +1 -1
- package/dist/skills/SkillRegistry.d.ts +16 -1
- package/dist/skills/SkillRegistry.d.ts.map +1 -1
- package/dist/skills/SkillRegistry.js +159 -11
- package/dist/skills/SkillRegistry.js.map +1 -1
- package/dist/skills/index.d.ts +1 -0
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +1 -0
- package/dist/skills/index.js.map +1 -1
- package/dist/skills/paths.d.ts +35 -0
- package/dist/skills/paths.d.ts.map +1 -0
- package/dist/skills/paths.js +71 -0
- package/dist/skills/paths.js.map +1 -0
- package/dist/skills/types.d.ts +2 -0
- package/dist/skills/types.d.ts.map +1 -1
- package/dist/skills/types.js.map +1 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -126,117 +126,155 @@ yarn add @framers/agentos
|
|
|
126
126
|
## Quick Start
|
|
127
127
|
|
|
128
128
|
```typescript
|
|
129
|
-
import { AgentOS } from '@framers/agentos';
|
|
129
|
+
import { AgentOS, AgentOSResponseChunkType } from '@framers/agentos';
|
|
130
|
+
import { createTestAgentOSConfig } from '@framers/agentos/config/AgentOSConfig';
|
|
130
131
|
|
|
131
|
-
// Initialize
|
|
132
|
+
// Initialize (local/dev defaults)
|
|
132
133
|
const agent = new AgentOS();
|
|
133
|
-
await agent.initialize(
|
|
134
|
-
llmProvider: {
|
|
135
|
-
provider: 'openai',
|
|
136
|
-
apiKey: process.env.OPENAI_API_KEY,
|
|
137
|
-
model: 'gpt-4o'
|
|
138
|
-
}
|
|
139
|
-
});
|
|
134
|
+
await agent.initialize(await createTestAgentOSConfig());
|
|
140
135
|
|
|
141
136
|
// Process requests with streaming
|
|
142
137
|
for await (const chunk of agent.processRequest({
|
|
143
|
-
|
|
144
|
-
|
|
138
|
+
userId: 'user-123',
|
|
139
|
+
sessionId: 'session-123',
|
|
140
|
+
textInput: 'Help me analyze this data',
|
|
145
141
|
})) {
|
|
146
|
-
if (chunk.type ===
|
|
147
|
-
process.stdout.write(chunk.
|
|
142
|
+
if (chunk.type === AgentOSResponseChunkType.TEXT_DELTA) {
|
|
143
|
+
process.stdout.write(chunk.textDelta);
|
|
148
144
|
}
|
|
149
145
|
}
|
|
150
146
|
```
|
|
151
147
|
|
|
152
|
-
### With Tools
|
|
148
|
+
### With Tools (Extension Packs)
|
|
153
149
|
|
|
154
150
|
```typescript
|
|
155
|
-
import {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
151
|
+
import {
|
|
152
|
+
AgentOS,
|
|
153
|
+
AgentOSResponseChunkType,
|
|
154
|
+
EXTENSION_KIND_TOOL,
|
|
155
|
+
type ExtensionManifest,
|
|
156
|
+
type ExtensionPack,
|
|
157
|
+
type ITool,
|
|
158
|
+
} from '@framers/agentos';
|
|
159
|
+
import { createTestAgentOSConfig } from '@framers/agentos/config/AgentOSConfig';
|
|
160
|
+
|
|
161
|
+
const helloTool: ITool = {
|
|
162
|
+
id: 'hello-tool',
|
|
163
|
+
name: 'hello',
|
|
164
|
+
displayName: 'Hello',
|
|
165
|
+
description: 'Return a greeting.',
|
|
166
|
+
category: 'utility',
|
|
167
|
+
hasSideEffects: false,
|
|
168
|
+
inputSchema: {
|
|
168
169
|
type: 'object',
|
|
169
|
-
properties: {
|
|
170
|
-
|
|
171
|
-
},
|
|
172
|
-
required: ['city']
|
|
170
|
+
properties: { name: { type: 'string' } },
|
|
171
|
+
required: ['name'],
|
|
173
172
|
},
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
173
|
+
execute: async (args, _ctx) => {
|
|
174
|
+
const name = typeof args.name === 'string' ? args.name : String(args.name);
|
|
175
|
+
return { success: true, output: { text: `Hello, ${name}!` } };
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const manifest: ExtensionManifest = {
|
|
180
|
+
packs: [
|
|
181
|
+
{
|
|
182
|
+
factory: async () =>
|
|
183
|
+
({
|
|
184
|
+
name: 'local-tools',
|
|
185
|
+
descriptors: [{ id: helloTool.id, kind: EXTENSION_KIND_TOOL, payload: helloTool }],
|
|
186
|
+
}) satisfies ExtensionPack,
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const agent = new AgentOS();
|
|
192
|
+
const base = await createTestAgentOSConfig();
|
|
193
|
+
await agent.initialize({ ...base, extensionManifest: manifest });
|
|
180
194
|
|
|
181
195
|
// Tools are called automatically when the model decides to use them
|
|
182
|
-
for await (const chunk of agent.processRequest({
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
196
|
+
for await (const chunk of agent.processRequest({
|
|
197
|
+
userId: 'user-123',
|
|
198
|
+
sessionId: 'session-123',
|
|
199
|
+
textInput: 'Say hello to Ada.',
|
|
200
|
+
})) {
|
|
201
|
+
if (chunk.type === AgentOSResponseChunkType.TEXT_DELTA) process.stdout.write(chunk.textDelta);
|
|
202
|
+
}
|
|
186
203
|
```
|
|
187
204
|
|
|
188
205
|
### Multiple Providers
|
|
189
206
|
|
|
190
207
|
```typescript
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
model: 'anthropic/claude-3.5-sonnet'
|
|
197
|
-
}
|
|
198
|
-
});
|
|
208
|
+
import { AgentOS } from '@framers/agentos';
|
|
209
|
+
import { createTestAgentOSConfig } from '@framers/agentos/config/AgentOSConfig';
|
|
210
|
+
|
|
211
|
+
const agent = new AgentOS();
|
|
212
|
+
const base = await createTestAgentOSConfig();
|
|
199
213
|
|
|
200
|
-
// Local Ollama
|
|
201
214
|
await agent.initialize({
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
215
|
+
...base,
|
|
216
|
+
modelProviderManagerConfig: {
|
|
217
|
+
providers: [
|
|
218
|
+
{ providerId: 'openai', enabled: true, isDefault: true, config: { apiKey: process.env.OPENAI_API_KEY } },
|
|
219
|
+
{ providerId: 'openrouter', enabled: true, config: { apiKey: process.env.OPENROUTER_API_KEY } },
|
|
220
|
+
{ providerId: 'ollama', enabled: true, config: { baseUrl: 'http://localhost:11434' } },
|
|
221
|
+
],
|
|
222
|
+
},
|
|
223
|
+
gmiManagerConfig: {
|
|
224
|
+
...base.gmiManagerConfig,
|
|
225
|
+
defaultGMIBaseConfigDefaults: {
|
|
226
|
+
...(base.gmiManagerConfig.defaultGMIBaseConfigDefaults ?? {}),
|
|
227
|
+
defaultLlmProviderId: 'openai',
|
|
228
|
+
defaultLlmModelId: 'gpt-4o',
|
|
229
|
+
},
|
|
230
|
+
},
|
|
207
231
|
});
|
|
208
232
|
```
|
|
209
233
|
|
|
210
|
-
###
|
|
234
|
+
### RAG (RetrievalAugmentor)
|
|
211
235
|
|
|
212
|
-
|
|
213
|
-
import { AgentOS } from '@framers/agentos';
|
|
236
|
+
AgentOS supports embedding-based retrieval via `IRetrievalAugmentor` (vector RAG, optional GraphRAG). You can either:
|
|
214
237
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
llmProvider: {
|
|
218
|
-
provider: 'openai',
|
|
219
|
-
apiKey: process.env.OPENAI_API_KEY,
|
|
220
|
-
model: 'gpt-4o'
|
|
221
|
-
},
|
|
222
|
-
memory: {
|
|
223
|
-
vectorStore: 'memory', // or 'sqlite', 'postgres'
|
|
224
|
-
embeddingModel: 'text-embedding-3-small'
|
|
225
|
-
}
|
|
226
|
-
});
|
|
238
|
+
- pass a ready augmentor via `AgentOSConfig.retrievalAugmentor`, or
|
|
239
|
+
- let AgentOS initialize it via `AgentOSConfig.ragConfig`
|
|
227
240
|
|
|
228
|
-
|
|
229
|
-
await agent.memory.ingest([
|
|
230
|
-
{ content: 'AgentOS supports streaming responses...', metadata: { source: 'docs' } },
|
|
231
|
-
{ content: 'GMIs maintain context across sessions...', metadata: { source: 'docs' } }
|
|
232
|
-
]);
|
|
241
|
+
See `docs/RAG_MEMORY_CONFIGURATION.md` for full setup details.
|
|
233
242
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
243
|
+
```ts
|
|
244
|
+
import { AgentOS } from '@framers/agentos';
|
|
245
|
+
import { createTestAgentOSConfig } from '@framers/agentos/config/AgentOSConfig';
|
|
246
|
+
|
|
247
|
+
const agentos = new AgentOS();
|
|
248
|
+
const base = await createTestAgentOSConfig();
|
|
249
|
+
await agentos.initialize({
|
|
250
|
+
...base,
|
|
251
|
+
ragConfig: {
|
|
252
|
+
embeddingManagerConfig: {
|
|
253
|
+
embeddingModels: [
|
|
254
|
+
{ modelId: 'text-embedding-3-small', providerId: 'openai', dimension: 1536, isDefault: true },
|
|
255
|
+
],
|
|
256
|
+
},
|
|
257
|
+
vectorStoreManagerConfig: {
|
|
258
|
+
managerId: 'rag-vsm',
|
|
259
|
+
providers: [{ id: 'sql-store', type: 'sql', storage: { filePath: './data/agentos_vectors.db' } }],
|
|
260
|
+
defaultProviderId: 'sql-store',
|
|
261
|
+
defaultEmbeddingDimension: 1536,
|
|
262
|
+
},
|
|
263
|
+
dataSourceConfigs: [
|
|
264
|
+
{
|
|
265
|
+
dataSourceId: 'voice_conversation_summaries',
|
|
266
|
+
displayName: 'Conversation Summaries',
|
|
267
|
+
vectorStoreProviderId: 'sql-store',
|
|
268
|
+
actualNameInProvider: 'voice_conversation_summaries',
|
|
269
|
+
embeddingDimension: 1536,
|
|
270
|
+
},
|
|
271
|
+
],
|
|
272
|
+
retrievalAugmentorConfig: {
|
|
273
|
+
defaultDataSourceId: 'voice_conversation_summaries',
|
|
274
|
+
categoryBehaviors: [],
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
});
|
|
240
278
|
```
|
|
241
279
|
|
|
242
280
|
### Immutability & Provenance (Optional)
|
|
@@ -270,6 +308,10 @@ const provenancePack = createProvenancePack(
|
|
|
270
308
|
|
|
271
309
|
**Sealed conversation persistence:** when using `sealed` storage policy with SQL conversation persistence, set `ConversationManagerConfig.appendOnlyPersistence=true` so conversation history remains append-only (no UPDATE/DELETE/UPSERT on protected tables).
|
|
272
310
|
|
|
311
|
+
**Toolset pinning (recommended):** treat the enabled toolset as part of the sealed spec. Disable dynamic tool registration and (optionally) store a toolset manifest hash at seal time so you can verify you’re running the same tools/versions later.
|
|
312
|
+
|
|
313
|
+
**“Forgetting” memory in sealed mode:** avoid hard deletes. Prefer append-only **redaction/tombstone** events that remove items from retrieval while keeping an auditable trail.
|
|
314
|
+
|
|
273
315
|
---
|
|
274
316
|
|
|
275
317
|
## Architecture
|
|
@@ -359,6 +401,7 @@ Supported platforms: `telegram`, `whatsapp`, `discord`, `slack`, `webchat`, `sig
|
|
|
359
401
|
| Guide | Description |
|
|
360
402
|
|-------|-------------|
|
|
361
403
|
| [Cost Optimization](./docs/COST_OPTIMIZATION.md) | Token usage and cost management |
|
|
404
|
+
| [Observability](./docs/OBSERVABILITY.md) | OpenTelemetry spans and trace/log correlation (opt-in) |
|
|
362
405
|
| [Platform Support](./docs/PLATFORM_SUPPORT.md) | Supported platforms and environments |
|
|
363
406
|
| [Releasing](./docs/RELEASING.md) | How to publish new versions |
|
|
364
407
|
| [API Reference](./docs/api/index.html) | TypeDoc-generated API docs |
|
package/dist/api/AgentOS.d.ts
CHANGED
|
@@ -52,12 +52,17 @@ import { ConversationManagerConfig } from '../core/conversation/ConversationMana
|
|
|
52
52
|
import { ConversationContext } from '../core/conversation/ConversationContext';
|
|
53
53
|
import type { IRollingSummaryMemorySink } from '../core/conversation/IRollingSummaryMemorySink';
|
|
54
54
|
import type { ILongTermMemoryRetriever } from '../core/conversation/ILongTermMemoryRetriever';
|
|
55
|
+
import type { IRetrievalAugmentor } from '../rag/IRetrievalAugmentor';
|
|
56
|
+
import type { EmbeddingManagerConfig } from '../config/EmbeddingManagerConfiguration';
|
|
57
|
+
import type { RetrievalAugmentorServiceConfig } from '../config/RetrievalAugmentorConfiguration';
|
|
58
|
+
import type { RagDataSourceConfig, VectorStoreManagerConfig } from '../config/VectorStoreConfiguration';
|
|
55
59
|
import type { PrismaClient } from '../stubs/prismaClient.js';
|
|
56
60
|
import type { StorageAdapter } from '@framers/sql-storage-adapter';
|
|
57
61
|
import { IPersonaDefinition } from '../cognitive_substrate/personas/IPersonaDefinition';
|
|
58
62
|
import { StreamingManagerConfig, StreamId } from '../core/streaming/StreamingManager';
|
|
59
63
|
import { GMIError, GMIErrorCode } from '../utils/errors';
|
|
60
64
|
import { ILogger } from '../logging/ILogger';
|
|
65
|
+
import { type AgentOSObservabilityConfig } from '../core/observability/otel';
|
|
61
66
|
import type { IGuardrailService } from '../core/guardrails/IGuardrailService';
|
|
62
67
|
import type { IPersonaLoader } from '../cognitive_substrate/personas/IPersonaLoader';
|
|
63
68
|
import { type ExtensionManifest, type ExtensionOverrides } from '../extensions';
|
|
@@ -137,6 +142,59 @@ export interface AgentOSConfig {
|
|
|
137
142
|
* (e.g. user/org/persona memories stored in a RAG/KG).
|
|
138
143
|
*/
|
|
139
144
|
longTermMemoryRetriever?: ILongTermMemoryRetriever;
|
|
145
|
+
/**
|
|
146
|
+
* Optional retrieval augmentor enabling vector-based RAG and/or GraphRAG.
|
|
147
|
+
* When provided, it is passed into GMIs via the GMIManager.
|
|
148
|
+
*
|
|
149
|
+
* Notes:
|
|
150
|
+
* - This is separate from `longTermMemoryRetriever`, which injects pre-formatted
|
|
151
|
+
* memory text into prompts.
|
|
152
|
+
* - The augmentor instance is typically shared across GMIs; do not shut it down
|
|
153
|
+
* from individual GMIs.
|
|
154
|
+
*/
|
|
155
|
+
retrievalAugmentor?: IRetrievalAugmentor;
|
|
156
|
+
/**
|
|
157
|
+
* If true, AgentOS will call `retrievalAugmentor.shutdown()` during `AgentOS.shutdown()`.
|
|
158
|
+
* Default: false (caller manages lifecycle).
|
|
159
|
+
*/
|
|
160
|
+
manageRetrievalAugmentorLifecycle?: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Optional configuration for AgentOS-managed RAG subsystem initialization.
|
|
163
|
+
*
|
|
164
|
+
* When provided and enabled, AgentOS will:
|
|
165
|
+
* - Initialize an {@link EmbeddingManager} with {@link EmbeddingManagerConfig}
|
|
166
|
+
* - Initialize a {@link VectorStoreManager} with {@link VectorStoreManagerConfig} + {@link RagDataSourceConfig}
|
|
167
|
+
* - Initialize a {@link RetrievalAugmentor} with {@link RetrievalAugmentorServiceConfig}
|
|
168
|
+
* - Pass the resulting {@link IRetrievalAugmentor} into GMIs via the {@link GMIManager}
|
|
169
|
+
*
|
|
170
|
+
* Notes:
|
|
171
|
+
* - If `retrievalAugmentor` is provided, it takes precedence and this config is ignored.
|
|
172
|
+
* - By default, when AgentOS creates the RAG subsystem it also manages lifecycle and will
|
|
173
|
+
* shut it down during {@link AgentOS.shutdown}.
|
|
174
|
+
*/
|
|
175
|
+
ragConfig?: {
|
|
176
|
+
/** Enable or disable AgentOS-managed RAG initialization. Default: true. */
|
|
177
|
+
enabled?: boolean;
|
|
178
|
+
/** Embedding manager configuration (must include at least one embedding model). */
|
|
179
|
+
embeddingManagerConfig: EmbeddingManagerConfig;
|
|
180
|
+
/** Vector store manager configuration (providers). */
|
|
181
|
+
vectorStoreManagerConfig: VectorStoreManagerConfig;
|
|
182
|
+
/** Logical data sources mapped onto vector store providers. */
|
|
183
|
+
dataSourceConfigs: RagDataSourceConfig[];
|
|
184
|
+
/** Retrieval augmentor configuration (category behaviors, defaults). */
|
|
185
|
+
retrievalAugmentorConfig: RetrievalAugmentorServiceConfig;
|
|
186
|
+
/**
|
|
187
|
+
* If true, AgentOS will shut down the augmentor and any owned vector store providers
|
|
188
|
+
* during {@link AgentOS.shutdown}. Default: true.
|
|
189
|
+
*/
|
|
190
|
+
manageLifecycle?: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* When true (default), AgentOS injects its `storageAdapter` into SQL vector-store providers
|
|
193
|
+
* that did not specify `adapter` or `storage`. This keeps vector persistence colocated with
|
|
194
|
+
* the host database by default.
|
|
195
|
+
*/
|
|
196
|
+
bindToStorageAdapter?: boolean;
|
|
197
|
+
};
|
|
140
198
|
/** Configuration for the {@link PromptEngine}. */
|
|
141
199
|
promptEngineConfig: PromptEngineConfig;
|
|
142
200
|
/** Configuration for the {@link ToolOrchestrator}. */
|
|
@@ -176,6 +234,24 @@ export interface AgentOSConfig {
|
|
|
176
234
|
guardrailService?: IGuardrailService;
|
|
177
235
|
/** Optional map of secretId -> value for extension/tool credentials. */
|
|
178
236
|
extensionSecrets?: Record<string, string>;
|
|
237
|
+
/**
|
|
238
|
+
* Optional: enable schema-on-demand meta tools for lazy tool schema loading.
|
|
239
|
+
*
|
|
240
|
+
* When enabled, AgentOS registers three meta tools:
|
|
241
|
+
* - `extensions_list`
|
|
242
|
+
* - `extensions_enable` (side effects)
|
|
243
|
+
* - `extensions_status`
|
|
244
|
+
*
|
|
245
|
+
* These tools allow an agent to load additional extension packs at runtime,
|
|
246
|
+
* so newly-enabled tool schemas appear in the next `listAvailableTools()` call.
|
|
247
|
+
*/
|
|
248
|
+
schemaOnDemandTools?: {
|
|
249
|
+
enabled?: boolean;
|
|
250
|
+
/** Allow enabling packs by explicit npm package name (source='package'). Default: true. */
|
|
251
|
+
allowPackages?: boolean;
|
|
252
|
+
/** Allow enabling packs by local module specifier/path (source='module'). Default: false. */
|
|
253
|
+
allowModules?: boolean;
|
|
254
|
+
};
|
|
179
255
|
/**
|
|
180
256
|
* Optional. An instance of a utility AI service.
|
|
181
257
|
* This service should conform to {@link IUtilityAI} for general utility tasks.
|
|
@@ -248,10 +324,15 @@ export interface AgentOSConfig {
|
|
|
248
324
|
*
|
|
249
325
|
* **Graceful Degradation:**
|
|
250
326
|
* - If omitted, AgentOS falls back to Prisma (server-side only).
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
327
|
+
* - If provided, AgentOS uses storageAdapter for conversations, Prisma only for auth/subscriptions.
|
|
328
|
+
* - Recommended: Always provide storageAdapter for cross-platform compatibility.
|
|
329
|
+
*/
|
|
254
330
|
storageAdapter?: StorageAdapter;
|
|
331
|
+
/**
|
|
332
|
+
* Optional observability config for tracing, metrics, and log correlation.
|
|
333
|
+
* Default: disabled (opt-in).
|
|
334
|
+
*/
|
|
335
|
+
observability?: AgentOSObservabilityConfig;
|
|
255
336
|
}
|
|
256
337
|
/**
|
|
257
338
|
* @class AgentOS
|
|
@@ -286,6 +367,9 @@ export declare class AgentOS implements IAgentOS {
|
|
|
286
367
|
private workflowExtensionListener?;
|
|
287
368
|
private workflowRuntime?;
|
|
288
369
|
private agencyRegistry?;
|
|
370
|
+
private retrievalAugmentor?;
|
|
371
|
+
private ragVectorStoreManager?;
|
|
372
|
+
private manageRetrievalAugmentorLifecycle;
|
|
289
373
|
private authService;
|
|
290
374
|
private subscriptionService;
|
|
291
375
|
private prisma;
|
|
@@ -459,5 +543,6 @@ export declare class AgentOS implements IAgentOS {
|
|
|
459
543
|
* @throws {AgentOSServiceError} If an error occurs during the shutdown of any critical component.
|
|
460
544
|
*/
|
|
461
545
|
shutdown(): Promise<void>;
|
|
546
|
+
private initializeRagSubsystem;
|
|
462
547
|
}
|
|
463
548
|
//# sourceMappingURL=AgentOS.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentOS.d.ts","sourceRoot":"","sources":["../../src/api/AgentOS.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,eAAe,EAA+C,MAAM,yBAAyB,CAAC;AACvG,OAAO,EAAwD,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACxH,OAAO,EAAc,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAA0B,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAEpH,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAGvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCA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KnC;;;;;;;;;;;OAWG;IACU,qBAAqB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAU3F;;;;;;;;;;;;OAYG;IACU,sBAAsB,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IA+BhH;;;;;;;;;;;;;;OAcG;IACU,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBvI;;;;;;;;OAQG;IACU,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YAmFxB,sBAAsB;CA4DrC"}
|
package/dist/api/AgentOS.js
CHANGED
|
@@ -52,9 +52,11 @@ import { StreamingManager } from '../core/streaming/StreamingManager.js';
|
|
|
52
52
|
import { GMIError, GMIErrorCode } from '../utils/errors.js';
|
|
53
53
|
import { uuidv4 } from '../utils/uuid.js';
|
|
54
54
|
import { createLogger } from '../logging/loggerFactory.js';
|
|
55
|
+
import { configureAgentOSObservability } from '../core/observability/otel.js';
|
|
55
56
|
import { GuardrailAction } from '../core/guardrails/IGuardrailService.js';
|
|
56
57
|
import { evaluateInputGuardrails, createGuardrailBlockedStream, wrapOutputGuardrails, } from '../core/guardrails/guardrailDispatcher.js';
|
|
57
58
|
import { ExtensionManager, EXTENSION_KIND_GUARDRAIL, EXTENSION_KIND_PROVENANCE, EXTENSION_KIND_TOOL, EXTENSION_KIND_WORKFLOW, } from '../extensions/index.js';
|
|
59
|
+
import { createSchemaOnDemandPack } from '../extensions/packs/schema-on-demand-pack.js';
|
|
58
60
|
import { WorkflowRuntime } from '../core/workflows/runtime/WorkflowRuntime.js';
|
|
59
61
|
import { AgencyRegistry } from '../core/agency/AgencyRegistry.js';
|
|
60
62
|
import { WorkflowEngine } from '../core/workflows/WorkflowEngine.js';
|
|
@@ -215,6 +217,7 @@ export class AgentOS {
|
|
|
215
217
|
constructor(logger = createLogger('AgentOS')) {
|
|
216
218
|
this.logger = logger;
|
|
217
219
|
this.initialized = false;
|
|
220
|
+
this.manageRetrievalAugmentorLifecycle = false;
|
|
218
221
|
}
|
|
219
222
|
/**
|
|
220
223
|
* Initializes the `AgentOS` service and all its core dependencies.
|
|
@@ -237,6 +240,8 @@ export class AgentOS {
|
|
|
237
240
|
this.validateConfiguration(config);
|
|
238
241
|
// Make the configuration immutable after validation to prevent runtime changes.
|
|
239
242
|
this.config = Object.freeze({ ...config });
|
|
243
|
+
// Observability is opt-in (config + env). Safe no-op if OTEL is not installed by host.
|
|
244
|
+
configureAgentOSObservability(this.config.observability);
|
|
240
245
|
// Initialize LanguageService early if configured so downstream orchestration can use it.
|
|
241
246
|
if (config.languageConfig) {
|
|
242
247
|
try {
|
|
@@ -263,10 +268,22 @@ export class AgentOS {
|
|
|
263
268
|
this.extensionManager = new ExtensionManager({
|
|
264
269
|
manifest: this.config.extensionManifest,
|
|
265
270
|
secrets: this.config.extensionSecrets,
|
|
271
|
+
overrides: this.config.extensionOverrides,
|
|
266
272
|
});
|
|
267
273
|
const extensionLifecycleContext = { logger: this.logger };
|
|
268
274
|
await this.extensionManager.loadManifest(extensionLifecycleContext);
|
|
269
275
|
await this.registerConfigGuardrailService(extensionLifecycleContext);
|
|
276
|
+
if (this.config.schemaOnDemandTools?.enabled === true) {
|
|
277
|
+
const pack = createSchemaOnDemandPack({
|
|
278
|
+
extensionManager: this.extensionManager,
|
|
279
|
+
options: {
|
|
280
|
+
allowPackages: this.config.schemaOnDemandTools.allowPackages,
|
|
281
|
+
allowModules: this.config.schemaOnDemandTools.allowModules,
|
|
282
|
+
},
|
|
283
|
+
});
|
|
284
|
+
await this.extensionManager.loadPackFromFactory(pack, 'schema-on-demand', undefined, extensionLifecycleContext);
|
|
285
|
+
this.logger.info('[AgentOS] Schema-on-demand tools enabled');
|
|
286
|
+
}
|
|
270
287
|
let storageAdapter = this.config.storageAdapter;
|
|
271
288
|
if (storageAdapter) {
|
|
272
289
|
try {
|
|
@@ -290,6 +307,7 @@ export class AgentOS {
|
|
|
290
307
|
await this.modelProviderManager.initialize(this.config.modelProviderManagerConfig);
|
|
291
308
|
console.log('AgentOS: AIModelProviderManager initialized.');
|
|
292
309
|
await this.ensureUtilityAIService();
|
|
310
|
+
await this.initializeRagSubsystem(storageAdapter);
|
|
293
311
|
// Initialize Prompt Engine
|
|
294
312
|
this.promptEngine = new PromptEngine();
|
|
295
313
|
const peUtility = this.utilityAIService;
|
|
@@ -323,7 +341,7 @@ export class AgentOS {
|
|
|
323
341
|
// Initialize GMI Manager
|
|
324
342
|
this.gmiManager = new GMIManager(this.config.gmiManagerConfig, this.subscriptionService, this.authService, this.conversationManager, // Removed Prisma parameter
|
|
325
343
|
this.promptEngine, this.modelProviderManager, this.utilityAIService, // Pass the potentially dual-role utility service
|
|
326
|
-
this.toolOrchestrator,
|
|
344
|
+
this.toolOrchestrator, this.retrievalAugmentor, this.config.personaLoader);
|
|
327
345
|
await this.gmiManager.initialize();
|
|
328
346
|
console.log('AgentOS: GMIManager initialized.');
|
|
329
347
|
await this.startWorkflowRuntime();
|
|
@@ -1030,6 +1048,14 @@ export class AgentOS {
|
|
|
1030
1048
|
await this.toolOrchestrator.shutdown();
|
|
1031
1049
|
console.log('AgentOS: ToolOrchestrator shut down.');
|
|
1032
1050
|
}
|
|
1051
|
+
if (this.manageRetrievalAugmentorLifecycle && this.retrievalAugmentor?.shutdown) {
|
|
1052
|
+
await this.retrievalAugmentor.shutdown();
|
|
1053
|
+
console.log('AgentOS: RetrievalAugmentor shut down.');
|
|
1054
|
+
}
|
|
1055
|
+
if (this.manageRetrievalAugmentorLifecycle && this.ragVectorStoreManager?.shutdownAllProviders) {
|
|
1056
|
+
await this.ragVectorStoreManager.shutdownAllProviders();
|
|
1057
|
+
console.log('AgentOS: VectorStore providers shut down.');
|
|
1058
|
+
}
|
|
1033
1059
|
// PromptEngine might have a cleanup method like clearCache
|
|
1034
1060
|
if (this.promptEngine && typeof this.promptEngine.clearCache === 'function') {
|
|
1035
1061
|
await this.promptEngine.clearCache();
|
|
@@ -1058,6 +1084,52 @@ export class AgentOS {
|
|
|
1058
1084
|
this.initialized = false; // Mark as uninitialized regardless of shutdown errors.
|
|
1059
1085
|
}
|
|
1060
1086
|
}
|
|
1087
|
+
async initializeRagSubsystem(storageAdapter) {
|
|
1088
|
+
// Prefer caller-provided augmentor instance.
|
|
1089
|
+
if (this.config.retrievalAugmentor) {
|
|
1090
|
+
this.retrievalAugmentor = this.config.retrievalAugmentor;
|
|
1091
|
+
this.manageRetrievalAugmentorLifecycle = this.config.manageRetrievalAugmentorLifecycle === true;
|
|
1092
|
+
return;
|
|
1093
|
+
}
|
|
1094
|
+
const ragConfig = this.config.ragConfig;
|
|
1095
|
+
if (!ragConfig || ragConfig.enabled === false) {
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1098
|
+
try {
|
|
1099
|
+
const { EmbeddingManager } = await import('../rag/EmbeddingManager.js');
|
|
1100
|
+
const { VectorStoreManager } = await import('../rag/VectorStoreManager.js');
|
|
1101
|
+
const { RetrievalAugmentor } = await import('../rag/RetrievalAugmentor.js');
|
|
1102
|
+
const embeddingManager = new EmbeddingManager();
|
|
1103
|
+
await embeddingManager.initialize(ragConfig.embeddingManagerConfig, this.modelProviderManager);
|
|
1104
|
+
const bindToStorageAdapter = ragConfig.bindToStorageAdapter === undefined ? true : ragConfig.bindToStorageAdapter === true;
|
|
1105
|
+
const patchedVectorStoreConfig = {
|
|
1106
|
+
...ragConfig.vectorStoreManagerConfig,
|
|
1107
|
+
providers: ragConfig.vectorStoreManagerConfig.providers.map((provider) => {
|
|
1108
|
+
if (bindToStorageAdapter &&
|
|
1109
|
+
storageAdapter &&
|
|
1110
|
+
provider?.type === 'sql' &&
|
|
1111
|
+
!provider.adapter &&
|
|
1112
|
+
!provider.storage) {
|
|
1113
|
+
return { ...provider, adapter: storageAdapter };
|
|
1114
|
+
}
|
|
1115
|
+
return provider;
|
|
1116
|
+
}),
|
|
1117
|
+
};
|
|
1118
|
+
const vectorStoreManager = new VectorStoreManager();
|
|
1119
|
+
await vectorStoreManager.initialize(patchedVectorStoreConfig, ragConfig.dataSourceConfigs);
|
|
1120
|
+
const retrievalAugmentor = new RetrievalAugmentor();
|
|
1121
|
+
await retrievalAugmentor.initialize(ragConfig.retrievalAugmentorConfig, embeddingManager, vectorStoreManager);
|
|
1122
|
+
this.retrievalAugmentor = retrievalAugmentor;
|
|
1123
|
+
this.ragVectorStoreManager = vectorStoreManager;
|
|
1124
|
+
this.manageRetrievalAugmentorLifecycle = ragConfig.manageLifecycle !== false;
|
|
1125
|
+
console.log('AgentOS: RAG subsystem initialized.');
|
|
1126
|
+
}
|
|
1127
|
+
catch (error) {
|
|
1128
|
+
this.logger.error('AgentOS: Failed to initialize RAG subsystem; continuing without retrieval augmentor.', {
|
|
1129
|
+
error: error?.message ?? error,
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1061
1133
|
}
|
|
1062
1134
|
/**
|
|
1063
1135
|
* @class AsyncStreamClientBridge
|