@almadar/agent 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,520 @@
1
+ import { LLMProvider } from '@almadar/llm';
2
+ import { S as SubagentEventCallback, O as OrbitalCompleteCallback, D as DomainOrbitalCompleteCallback } from './orbital-subagent-cNfTLdXQ.js';
3
+ import { BaseCheckpointSaver } from '@langchain/langgraph-checkpoint';
4
+ import { P as PersistenceMode, b as FirestoreDb$1, d as SessionMetadata, e as SessionRecord } from './firestore-checkpointer-DxbQ10ve.js';
5
+ import { OrbitalSchema } from '@almadar/core';
6
+ import '@langchain/langgraph';
7
+
8
+ /**
9
+ * Session Manager
10
+ *
11
+ * Unified session management API with pluggable persistence backends.
12
+ * Supports in-memory (development) and Firestore (production) backends.
13
+ */
14
+
15
+ interface SessionManagerOptions {
16
+ /**
17
+ * Persistence mode.
18
+ * @default 'memory'
19
+ */
20
+ mode?: PersistenceMode;
21
+ /**
22
+ * Firestore database instance. Required when mode is 'firestore'.
23
+ */
24
+ firestoreDb?: FirestoreDb$1;
25
+ }
26
+ /**
27
+ * Unified session management for agent sessions.
28
+ *
29
+ * Handles both session metadata and LangGraph checkpointers.
30
+ */
31
+ declare class SessionManager {
32
+ private mode;
33
+ private memoryBackend;
34
+ private memoryCheckpointers;
35
+ private firestoreCheckpointer;
36
+ private firestoreSessionStore;
37
+ constructor(options?: SessionManagerOptions);
38
+ /**
39
+ * Get the persistence mode.
40
+ */
41
+ getMode(): PersistenceMode;
42
+ /**
43
+ * Get or create a checkpointer for a session.
44
+ */
45
+ getCheckpointer(threadId: string): BaseCheckpointSaver<any>;
46
+ /**
47
+ * Store session metadata.
48
+ */
49
+ store(threadId: string, metadata: SessionMetadata): void;
50
+ /**
51
+ * Get session metadata (sync, memory only).
52
+ */
53
+ get(threadId: string): SessionMetadata | undefined;
54
+ /**
55
+ * Get session metadata (async, supports Firestore).
56
+ */
57
+ getAsync(threadId: string): Promise<SessionMetadata | undefined>;
58
+ /**
59
+ * Clear a session's checkpointer and metadata.
60
+ */
61
+ clear(threadId: string): boolean;
62
+ /**
63
+ * List all sessions (sync, memory only).
64
+ */
65
+ list(): SessionRecord[];
66
+ /**
67
+ * List all sessions (async, supports Firestore).
68
+ */
69
+ listAsync(): Promise<SessionRecord[]>;
70
+ }
71
+
72
+ /**
73
+ * Memory Orbital Schema
74
+ *
75
+ * Defines the structure for agent memory using Orbital types.
76
+ * This is an OrbitalSchema that represents user memory, preferences,
77
+ * and generation history.
78
+ *
79
+ * @packageDocumentation
80
+ */
81
+
82
+ /**
83
+ * The complete Memory Orbital Schema
84
+ * This defines the structure for storing agent memory
85
+ */
86
+ declare const MemoryOrbitalSchema: OrbitalSchema;
87
+ type UserPreference = {
88
+ id: string;
89
+ userId: string;
90
+ namingConvention: 'PascalCase' | 'camelCase' | 'snake_case';
91
+ validationStyle: 'strict' | 'minimal' | 'none';
92
+ preferredPatterns: string[];
93
+ commonEntities: string[];
94
+ commonTraits: string[];
95
+ learnedAt: Date;
96
+ confidence: number;
97
+ };
98
+ type GenerationSession = {
99
+ id: string;
100
+ userId: string;
101
+ threadId: string;
102
+ prompt: string;
103
+ skill: string;
104
+ generatedSchema?: Record<string, unknown>;
105
+ entities: string[];
106
+ patterns: string[];
107
+ validationResult?: {
108
+ valid: boolean;
109
+ errors: unknown[];
110
+ };
111
+ createdAt: Date;
112
+ completedAt?: Date;
113
+ success: boolean;
114
+ };
115
+ type ProjectContext = {
116
+ id: string;
117
+ appId: string;
118
+ userId: string;
119
+ projectName?: string;
120
+ description?: string;
121
+ existingEntities: string[];
122
+ conventions: string[];
123
+ domain: 'business' | 'ecommerce' | 'cms' | 'dashboard' | 'workflow';
124
+ lastUpdatedAt: Date;
125
+ };
126
+
127
+ /**
128
+ * Memory System Types
129
+ *
130
+ * Additional types for the memory system beyond the core orbital types.
131
+ */
132
+ /**
133
+ * User feedback on a generation session
134
+ */
135
+ interface UserFeedback {
136
+ /** Unique feedback ID */
137
+ feedbackId: string;
138
+ /** Session this feedback is for */
139
+ sessionId: string;
140
+ /** User who gave the feedback */
141
+ userId: string;
142
+ /** Type of feedback */
143
+ type: 'positive' | 'negative' | 'correction' | 'suggestion';
144
+ /** Optional comment */
145
+ comment?: string;
146
+ /** Suggested correction or improvement */
147
+ suggestion?: string;
148
+ /** Timestamp of feedback */
149
+ timestamp: Date;
150
+ }
151
+ /**
152
+ * Pattern affinity - tracks how well patterns work for a user
153
+ */
154
+ interface PatternAffinity {
155
+ /** User ID */
156
+ userId: string;
157
+ /** Pattern ID */
158
+ patternId: string;
159
+ /** How many times used */
160
+ usageCount: number;
161
+ /** Successful uses */
162
+ successCount: number;
163
+ /** Failed uses */
164
+ failureCount: number;
165
+ /** Contexts where this pattern was used */
166
+ contexts?: {
167
+ entityType?: string;
168
+ useCase?: string;
169
+ }[];
170
+ /** Last time this pattern was used */
171
+ lastUsedAt: Date;
172
+ /** When tracking started */
173
+ createdAt: Date;
174
+ }
175
+
176
+ /**
177
+ * Memory Manager - GAP-001: Orbital Memory System
178
+ *
179
+ * Manages user memory and preferences using Firestore persistence.
180
+ * Provides the foundation for personalized AI assistance by learning
181
+ * from user interactions and feedback.
182
+ */
183
+
184
+ /**
185
+ * Minimal Firestore interface to avoid importing firebase-admin.
186
+ * These match the interfaces defined in firestore-checkpointer.ts
187
+ */
188
+ interface FirestoreDb {
189
+ collection(path: string): FirestoreCollectionRef;
190
+ batch(): FirestoreBatch;
191
+ }
192
+ interface FirestoreCollectionRef {
193
+ doc(id: string): FirestoreDocRef;
194
+ where(field: string, op: string, value: unknown): FirestoreQuery;
195
+ orderBy(field: string, direction?: string): FirestoreQuery;
196
+ limit(n: number): FirestoreQuery;
197
+ }
198
+ interface FirestoreDocRef {
199
+ set(data: unknown): Promise<unknown>;
200
+ get(): Promise<FirestoreDocSnapshot>;
201
+ update(data: unknown): Promise<unknown>;
202
+ delete(): Promise<unknown>;
203
+ }
204
+ interface FirestoreDocSnapshot {
205
+ exists: boolean;
206
+ data(): Record<string, unknown> | undefined;
207
+ }
208
+ interface FirestoreQuery {
209
+ where(field: string, op: string, value: unknown): FirestoreQuery;
210
+ orderBy(field: string, direction?: string): FirestoreQuery;
211
+ limit(n: number): FirestoreQuery;
212
+ startAfter(doc: unknown): FirestoreQuery;
213
+ get(): Promise<FirestoreQuerySnapshot>;
214
+ }
215
+ interface FirestoreQuerySnapshot {
216
+ empty: boolean;
217
+ docs: FirestoreQueryDocSnapshot[];
218
+ size: number;
219
+ }
220
+ interface FirestoreQueryDocSnapshot {
221
+ data(): Record<string, unknown>;
222
+ }
223
+ interface FirestoreBatch {
224
+ set(ref: unknown, data: unknown): void;
225
+ delete(ref: unknown): void;
226
+ commit(): Promise<unknown>;
227
+ }
228
+ /**
229
+ * Options for MemoryManager
230
+ */
231
+ interface MemoryManagerOptions {
232
+ /**
233
+ * Firestore database instance (injected)
234
+ */
235
+ db: FirestoreDb;
236
+ /**
237
+ * Collection name for user preferences
238
+ * @default 'agent_memory_users'
239
+ */
240
+ usersCollection?: string;
241
+ /**
242
+ * Collection name for generation sessions
243
+ * @default 'agent_memory_generations'
244
+ */
245
+ generationsCollection?: string;
246
+ /**
247
+ * Collection name for project context
248
+ * @default 'agent_memory_projects'
249
+ */
250
+ projectsCollection?: string;
251
+ /**
252
+ * Collection name for pattern affinity
253
+ * @default 'agent_memory_patterns'
254
+ */
255
+ patternsCollection?: string;
256
+ /**
257
+ * Collection name for user feedback
258
+ * @default 'agent_memory_feedback'
259
+ */
260
+ feedbackCollection?: string;
261
+ }
262
+ declare class MemoryManager {
263
+ private db;
264
+ private usersCollection;
265
+ private generationsCollection;
266
+ private projectsCollection;
267
+ private patternsCollection;
268
+ private feedbackCollection;
269
+ constructor(options: MemoryManagerOptions);
270
+ /**
271
+ * Get user preferences with defaults
272
+ */
273
+ getUserPreferences(userId: string): Promise<UserPreference | null>;
274
+ /**
275
+ * Update user preferences
276
+ */
277
+ updateUserPreferences(userId: string, preferences: Partial<Omit<UserPreference, 'id' | 'userId' | 'learnedAt'>>): Promise<void>;
278
+ /**
279
+ * Record a new generation session
280
+ */
281
+ recordGeneration(userId: string, session: Omit<GenerationSession, 'id' | 'userId' | 'createdAt'>): Promise<string>;
282
+ /**
283
+ * Get a specific generation session
284
+ */
285
+ getGenerationSession(sessionId: string): Promise<GenerationSession | null>;
286
+ /**
287
+ * Get generation history for a user
288
+ */
289
+ getUserGenerationHistory(userId: string, limit?: number): Promise<GenerationSession[]>;
290
+ /**
291
+ * Update generation session status
292
+ */
293
+ updateGenerationStatus(sessionId: string, status: GenerationSession['success'], validationResult?: GenerationSession['validationResult']): Promise<void>;
294
+ /**
295
+ * Get project context
296
+ */
297
+ getProjectContext(appId: string): Promise<ProjectContext | null>;
298
+ /**
299
+ * Update project context with new information
300
+ */
301
+ updateProjectContext(appId: string, update: Partial<Omit<ProjectContext, 'id' | 'appId'>>): Promise<void>;
302
+ /**
303
+ * Update pattern affinity based on usage
304
+ */
305
+ updatePatternAffinity(userId: string, patternId: string, outcome: 'success' | 'failure' | 'partial', context?: {
306
+ entityType?: string;
307
+ useCase?: string;
308
+ }): Promise<void>;
309
+ /**
310
+ * Get pattern affinity for a user
311
+ */
312
+ getPatternAffinity(userId: string, patternId: string): Promise<PatternAffinity | null>;
313
+ /**
314
+ * Get all patterns used by a user
315
+ */
316
+ getUserPatterns(userId: string): Promise<PatternAffinity[]>;
317
+ /**
318
+ * Record user feedback on a generation
319
+ */
320
+ recordFeedback(sessionId: string, feedback: Omit<UserFeedback, 'feedbackId' | 'sessionId' | 'timestamp'>): Promise<void>;
321
+ /**
322
+ * Get feedback for a session
323
+ */
324
+ getSessionFeedback(sessionId: string): Promise<UserFeedback[]>;
325
+ private parsePreference;
326
+ private serializePreference;
327
+ private parseSession;
328
+ private serializeSession;
329
+ private parseContext;
330
+ private serializeContext;
331
+ }
332
+
333
+ /**
334
+ * Skill-Based DeepAgent Factory
335
+ *
336
+ * Creates DeepAgent instances that use skills as the primary prompt source.
337
+ * No custom system prompts - all agent behavior is defined through skills.
338
+ *
339
+ * Uses deepagents library primitives:
340
+ * - createDeepAgent() for agent creation
341
+ * - FilesystemBackend for file operations
342
+ *
343
+ * Skill loading is injected via SkillLoader functions, keeping this package
344
+ * independent of any specific skill registry location.
345
+ */
346
+
347
+ /**
348
+ * Skill definition loaded by the consumer.
349
+ */
350
+ interface Skill {
351
+ name: string;
352
+ description: string;
353
+ content: string;
354
+ allowedTools?: string[];
355
+ version?: string;
356
+ references: string[];
357
+ path?: string;
358
+ }
359
+ /**
360
+ * Function to load a skill by name.
361
+ */
362
+ type SkillLoader = (name: string) => Skill | null;
363
+ /**
364
+ * Function to load a skill reference by skill name and ref name.
365
+ */
366
+ type SkillRefLoader = (skillName: string, refName: string) => string | null;
367
+ /**
368
+ * Options for creating a skill agent.
369
+ */
370
+ interface SkillAgentOptions {
371
+ /** Required: The skill(s) to use. Can be a single skill or array of skills. */
372
+ skill: string | string[];
373
+ /** Required: Working directory for the agent */
374
+ workDir: string;
375
+ /** Required: Function to load skills */
376
+ skillLoader: SkillLoader;
377
+ /** Optional: Function to load skill references */
378
+ skillRefLoader?: SkillRefLoader;
379
+ /** Optional: Thread ID for session continuity */
380
+ threadId?: string;
381
+ /** Optional: LLM provider */
382
+ provider?: LLMProvider;
383
+ /** Optional: Model name */
384
+ model?: string;
385
+ /** Optional: Enable verbose logging */
386
+ verbose?: boolean;
387
+ /** Optional: Disable human-in-the-loop interrupts (for eval/testing) */
388
+ noInterrupt?: boolean;
389
+ /** Optional: Callback for subagent events (orbital generation) */
390
+ onSubagentEvent?: SubagentEventCallback;
391
+ /** Optional: Session manager instance (shared across requests) */
392
+ sessionManager?: SessionManager;
393
+ /** Optional: Extracted requirements from analysis phase (for orbital skill) */
394
+ requirements?: {
395
+ entities?: string[];
396
+ states?: string[];
397
+ events?: string[];
398
+ guards?: string[];
399
+ pages?: string[];
400
+ effects?: string[];
401
+ rawRequirements?: string[];
402
+ };
403
+ /** Optional: GitHub integration configuration */
404
+ githubConfig?: {
405
+ /** GitHub personal access token */
406
+ token: string;
407
+ /** Repository owner (e.g., 'octocat') */
408
+ owner?: string;
409
+ /** Repository name (e.g., 'hello-world') */
410
+ repo?: string;
411
+ };
412
+ /** Optional: Memory manager for user/project memory (GAP-001) */
413
+ memoryManager?: MemoryManager;
414
+ /** Optional: User ID for memory lookup */
415
+ userId?: string;
416
+ /** Optional: App ID for project context */
417
+ appId?: string;
418
+ }
419
+ /**
420
+ * Result from creating a skill agent.
421
+ */
422
+ interface SkillAgentResult {
423
+ /** The agent instance (from deepagents library) */
424
+ agent: any;
425
+ /** Thread ID for session resumption */
426
+ threadId: string;
427
+ /** The loaded skill(s) - primary skill when single, all skills when multiple */
428
+ skill: Skill;
429
+ /** All loaded skills (same as skill when single) */
430
+ skills: Skill[];
431
+ /** Working directory */
432
+ workDir: string;
433
+ /** Orbital tool setter for wiring SSE callback (if orbital tool enabled) */
434
+ setOrbitalEventCallback?: (callback: SubagentEventCallback) => void;
435
+ /** Orbital tool setter for wiring persistence callback */
436
+ setOrbitalCompleteCallback?: (callback: OrbitalCompleteCallback) => void;
437
+ /** Domain orbital callback for lean skill Firestore persistence */
438
+ setDomainCompleteCallback?: (callback: DomainOrbitalCompleteCallback) => void;
439
+ /** User preferences loaded from memory (GAP-001) */
440
+ userPreferences?: UserPreference | null;
441
+ /** Project context loaded from memory (GAP-001) */
442
+ projectContext?: ProjectContext | null;
443
+ /** Memory manager instance (GAP-001) */
444
+ memoryManager?: MemoryManager;
445
+ }
446
+ /**
447
+ * Create a skill-based DeepAgent.
448
+ *
449
+ * Uses the specified skill's content as the system prompt.
450
+ * When multiple skills are provided, the agent sees all skill descriptions
451
+ * and can choose the appropriate one based on the user's request.
452
+ *
453
+ * @throws Error if any skill is not found
454
+ */
455
+ declare function createSkillAgent(options: SkillAgentOptions): Promise<SkillAgentResult>;
456
+ /**
457
+ * Resume a skill agent session.
458
+ *
459
+ * Loads the skill from session metadata and creates agent with same threadId.
460
+ *
461
+ * @throws Error if session not found
462
+ */
463
+ declare function resumeSkillAgent(threadId: string, options: {
464
+ verbose?: boolean;
465
+ noInterrupt?: boolean;
466
+ skillLoader: SkillLoader;
467
+ skillRefLoader?: SkillRefLoader;
468
+ sessionManager?: SessionManager;
469
+ }): Promise<SkillAgentResult>;
470
+
471
+ /**
472
+ * Event Budget Configuration
473
+ *
474
+ * Prevents runaway agent loops with soft/hard event limits per skill.
475
+ */
476
+ /**
477
+ * Event budget limits for different skills.
478
+ * - soft: Warning threshold (agent reminded to finish up)
479
+ * - hard: Maximum events before forced completion
480
+ */
481
+ declare const EVENT_BUDGETS: Record<string, {
482
+ soft: number;
483
+ hard: number;
484
+ }>;
485
+ /**
486
+ * Get event budget for a skill.
487
+ */
488
+ declare function getEventBudget(skillName: string): {
489
+ soft: number;
490
+ hard: number;
491
+ };
492
+ /**
493
+ * Generate a budget warning message to inject into the agent.
494
+ */
495
+ declare function getBudgetWarningMessage(eventCount: number, budget: {
496
+ soft: number;
497
+ hard: number;
498
+ }): string | null;
499
+
500
+ /**
501
+ * Interrupt Configuration
502
+ *
503
+ * Human-in-the-loop configuration for agent tools.
504
+ */
505
+ /**
506
+ * Skill metadata (minimal interface for interrupt config).
507
+ */
508
+ interface SkillMeta {
509
+ name: string;
510
+ allowedTools?: string[];
511
+ }
512
+ /**
513
+ * Get interrupt configuration for a skill.
514
+ *
515
+ * Default: require approval for execute tool.
516
+ * Skills can override via frontmatter (future enhancement).
517
+ */
518
+ declare function getInterruptConfig(_skill: SkillMeta): Record<string, boolean>;
519
+
520
+ export { EVENT_BUDGETS as E, type GenerationSession as G, MemoryManager as M, type PatternAffinity as P, SessionManager as S, type UserPreference as U, type MemoryManagerOptions as a, MemoryOrbitalSchema as b, type ProjectContext as c, type SessionManagerOptions as d, type Skill as e, type SkillAgentOptions as f, type SkillAgentResult as g, type SkillLoader as h, type SkillMeta as i, type SkillRefLoader as j, type UserFeedback as k, createSkillAgent as l, getBudgetWarningMessage as m, getEventBudget as n, getInterruptConfig as o, resumeSkillAgent as r };
package/dist/index.d.ts CHANGED
@@ -7,7 +7,8 @@ export { DomainDocument, DomainToSchemaResult, ParseError, SchemaToDomainResult,
7
7
  import { LLMClient } from '@almadar/llm';
8
8
  export { createCompactSystemPrompt, createSystemPrompt } from './prompts/index.js';
9
9
  import { BaseMessage } from '@langchain/core/messages';
10
- export { EVENT_BUDGETS, SessionManager, SessionManagerOptions, Skill, SkillAgentOptions, SkillAgentResult, SkillLoader, SkillMeta, SkillRefLoader, createSkillAgent, getBudgetWarningMessage, getEventBudget, getInterruptConfig, resumeSkillAgent } from './agent/index.js';
10
+ import { U as UserPreference, M as MemoryManager, G as GenerationSession } from './index-wLhxy6Gb.js';
11
+ export { E as EVENT_BUDGETS, a as MemoryManagerOptions, b as MemoryOrbitalSchema, P as PatternAffinity, c as ProjectContext, S as SessionManager, d as SessionManagerOptions, e as Skill, f as SkillAgentOptions, g as SkillAgentResult, h as SkillLoader, i as SkillMeta, j as SkillRefLoader, k as UserFeedback, l as createSkillAgent, m as getBudgetWarningMessage, n as getEventBudget, o as getInterruptConfig, r as resumeSkillAgent } from './index-wLhxy6Gb.js';
11
12
  export { F as FirestoreCheckpointer, a as FirestoreCheckpointerOptions, b as FirestoreDb, c as FirestoreTimestamp, P as PersistenceMode, S as Session, d as SessionMetadata, e as SessionRecord } from './firestore-checkpointer-DxbQ10ve.js';
12
13
  export { FirestoreSessionStore, FirestoreSessionStoreOptions, FirestoreStore, FirestoreStoreOptions, MemorySessionBackend } from './persistence/index.js';
13
14
  export { RawAgentEvent, extractFileOperation, extractInterruptData, hasInterrupt, isFileOperation, isTodoUpdate, transformAgentEvent, transformAgentEventMulti } from './event-transformer/index.js';
@@ -16,6 +17,7 @@ export { D as DomainOrbitalCompleteCallback, a as DomainOrbitalEventCallback, b
16
17
  import 'zod';
17
18
  import '@langchain/core/tools';
18
19
  import '@langchain/langgraph-checkpoint';
20
+ import '@almadar/core';
19
21
  import '@langchain/core/runnables';
20
22
 
21
23
  /**
@@ -494,4 +496,62 @@ declare function formatSummary(summary: MetricsSummary): string;
494
496
  */
495
497
  declare function analyzeFailures(failures: GenerationMetrics[]): string[];
496
498
 
497
- export { type ContextCompactionConfig, DEFAULT_COMPACTION_CONFIG, type DeepAgentCompleteEvent, type DeepAgentErrorEvent, type DeepAgentEvent, type DeepAgentExecutionEvent, type DeepAgentSchemaEvent, type DeepAgentStartEvent, type GenerationMetrics, MetricsCollector, type MetricsSummary, type CombinerOptions as OrbitalCombinerOptions, type CombinerResult as OrbitalCombinerResult, type OrbitalSchemaValidationResult, SubAgent, analyzeFailures, combineOrbitals, combineOrbitalsToSchema, createErrorFixerSubagent, createSchemaGeneratorSubagent, createSubagentConfigs, createSubagents, createSummaryPrompt, createTestAnalyzerSubagent, estimateCacheSavings, estimateCombineComplexity, estimateTokens, formatSummary, generateFullOrbital, isCompleteEvent, isErrorEvent, isExecutionEvent, isSchemaEvent, isStartEvent, needsCompaction, parseDeepAgentEvent };
499
+ /**
500
+ * Preference Learner
501
+ *
502
+ * Uses LLM to infer user preferences from generation sessions.
503
+ * Leverages @almadar/llm for structured output.
504
+ *
505
+ * @packageDocumentation
506
+ */
507
+
508
+ interface PreferenceLearnerOptions {
509
+ /** LLM client for inference */
510
+ llmClient?: LLMClient;
511
+ /** Memory manager for persistence */
512
+ memoryManager: MemoryManager;
513
+ /** Confidence threshold for auto-accepting preferences */
514
+ confidenceThreshold?: number;
515
+ }
516
+ interface InferredPreference {
517
+ /** The preference field being inferred */
518
+ field: keyof Omit<UserPreference, 'id' | 'userId' | 'learnedAt'>;
519
+ /** The inferred value */
520
+ value: unknown;
521
+ /** Confidence level (0-1) */
522
+ confidence: number;
523
+ /** Explanation of why this was inferred */
524
+ reasoning: string;
525
+ }
526
+ interface PreferenceAnalysis {
527
+ /** List of inferred preferences */
528
+ inferences: InferredPreference[];
529
+ /** Whether the inference is high confidence */
530
+ isHighConfidence: boolean;
531
+ }
532
+ declare class PreferenceLearner {
533
+ private llmClient;
534
+ private memoryManager;
535
+ private confidenceThreshold;
536
+ constructor(options: PreferenceLearnerOptions);
537
+ /**
538
+ * Analyze a session and infer user preferences
539
+ */
540
+ analyzeSession(session: GenerationSession): Promise<PreferenceAnalysis>;
541
+ /**
542
+ * Learn from a session and update preferences if confidence is high
543
+ */
544
+ learnFromSession(session: GenerationSession): Promise<UserPreference | null>;
545
+ /**
546
+ * Batch learn from multiple sessions
547
+ */
548
+ batchLearn(sessions: GenerationSession[]): Promise<UserPreference | null>;
549
+ private buildAnalysisPrompt;
550
+ private buildAggregatePrompt;
551
+ private parseAnalysisResponse;
552
+ private isValidNamingConvention;
553
+ private isValidValidationStyle;
554
+ }
555
+ declare function createPreferenceLearner(options: PreferenceLearnerOptions): PreferenceLearner;
556
+
557
+ export { type ContextCompactionConfig, DEFAULT_COMPACTION_CONFIG, type DeepAgentCompleteEvent, type DeepAgentErrorEvent, type DeepAgentEvent, type DeepAgentExecutionEvent, type DeepAgentSchemaEvent, type DeepAgentStartEvent, type GenerationMetrics, GenerationSession, type InferredPreference, MemoryManager, MetricsCollector, type MetricsSummary, type CombinerOptions as OrbitalCombinerOptions, type CombinerResult as OrbitalCombinerResult, type OrbitalSchemaValidationResult, type PreferenceAnalysis, PreferenceLearner, type PreferenceLearnerOptions, SubAgent, UserPreference, analyzeFailures, combineOrbitals, combineOrbitalsToSchema, createErrorFixerSubagent, createPreferenceLearner, createSchemaGeneratorSubagent, createSubagentConfigs, createSubagents, createSummaryPrompt, createTestAnalyzerSubagent, estimateCacheSavings, estimateCombineComplexity, estimateTokens, formatSummary, generateFullOrbital, isCompleteEvent, isErrorEvent, isExecutionEvent, isSchemaEvent, isStartEvent, needsCompaction, parseDeepAgentEvent };