@everworker/oneringai 0.4.2 → 0.4.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.
package/dist/index.d.cts CHANGED
@@ -1,12 +1,12 @@
1
- import { I as IConnectorRegistry, a as IConnectorAccessPolicy, C as ConnectorAccessContext, b as Connector, c as ConnectorConfig, d as ITokenStorage, e as IProvider, f as ConnectorFetchOptions, P as ProviderCapabilities, S as StoredToken$1, g as ConnectorAuth, h as ConnectorConfigResult } from './IProvider-CNJqZItJ.cjs';
2
- export { A as APIKeyConnectorAuth, D as DEFAULT_BASE_DELAY_MS, i as DEFAULT_CONNECTOR_TIMEOUT, j as DEFAULT_MAX_DELAY_MS, k as DEFAULT_MAX_RETRIES, l as DEFAULT_RETRYABLE_STATUSES, J as JWTConnectorAuth, O as OAuthConnectorAuth } from './IProvider-CNJqZItJ.cjs';
3
- import { I as InputItem, T as ToolFunction, M as MemoryEntry, a as MemoryScope, b as Tool, c as ToolContext, d as ToolPermissionConfig$1, e as ToolCall, W as WorkingMemoryConfig, P as PriorityCalculator, f as MemoryPriority, g as MemoryTier, C as Content, O as OutputItem, h as ToolResult, i as ITextProvider, F as FunctionToolDefinition, L as LLMResponse, S as StreamEvent, H as HookConfig, j as HistoryMode, A as AgentEvents, k as AgentResponse, E as ExecutionContext, l as ExecutionMetrics, m as AuditEntry, n as HookName, o as StaleEntryInfo, p as PriorityContext, q as MemoryIndex, r as TaskStatusForMemory, s as WorkingMemoryAccess, t as TokenUsage, u as StreamEventType, v as TextGenerateOptions, w as ModelCapabilities, x as MessageRole } from './index-BMjyFNJQ.cjs';
4
- export { y as AfterToolContext, z as AgentEventName, B as AgenticLoopEventName, D as AgenticLoopEvents, G as ApprovalResult, J as ApproveToolContext, K as BeforeToolContext, N as BuiltInTool, Q as CompactionItem, R as ContentType, U as DEFAULT_MEMORY_CONFIG, V as ErrorEvent, X as ExecutionConfig, Y as Hook, Z as HookManager, _ as InputImageContent, $ as InputTextContent, a0 as IterationCompleteEvent, a1 as JSONSchema, a2 as MEMORY_PRIORITY_VALUES, a3 as MemoryEntryInput, a4 as MemoryIndexEntry, a5 as Message, a6 as ModifyingHook, a7 as OutputTextContent, a8 as OutputTextDeltaEvent, a9 as OutputTextDoneEvent, aa as ReasoningDeltaEvent, ab as ReasoningDoneEvent, ac as ReasoningItem, ad as ResponseCompleteEvent, ae as ResponseCreatedEvent, af as ResponseInProgressEvent, ag as SimpleScope, ah as TaskAwareScope, ai as ThinkingContent, aj as ToolCallArgumentsDeltaEvent, ak as ToolCallArgumentsDoneEvent, al as ToolCallStartEvent, am as ToolCallState, an as ToolExecutionContext, ao as ToolExecutionDoneEvent, ap as ToolExecutionStartEvent, aq as ToolModification, ar as ToolResultContent, as as ToolUseContent, at as calculateEntrySize, au as defaultDescribeCall, av as forPlan, aw as forTasks, ax as getToolCallDescription, ay as isErrorEvent, az as isOutputTextDelta, aA as isReasoningDelta, aB as isReasoningDone, aC as isResponseComplete, aD as isSimpleScope, aE as isStreamEvent, aF as isTaskAwareScope, aG as isTerminalMemoryStatus, aH as isToolCallArgumentsDelta, aI as isToolCallArgumentsDone, aJ as isToolCallStart, aK as scopeEquals, aL as scopeMatches } from './index-BMjyFNJQ.cjs';
1
+ import { I as IConnectorRegistry, a as IConnectorAccessPolicy, C as ConnectorAccessContext, b as Connector, c as ConnectorConfig, d as ITokenStorage, e as IProvider, f as ConnectorFetchOptions, P as ProviderCapabilities, S as StoredToken$1, g as ConnectorAuth, h as ConnectorConfigResult } from './IProvider-B8sqUzJG.cjs';
2
+ export { A as APIKeyConnectorAuth, D as DEFAULT_BASE_DELAY_MS, i as DEFAULT_CONNECTOR_TIMEOUT, j as DEFAULT_MAX_DELAY_MS, k as DEFAULT_MAX_RETRIES, l as DEFAULT_RETRYABLE_STATUSES, J as JWTConnectorAuth, O as OAuthConnectorAuth } from './IProvider-B8sqUzJG.cjs';
3
+ import { C as ContextFeatures, M as MemoryEntry, a as MemoryScope, I as IContextStorage, T as Tool, b as ToolFunction, c as ToolContext, d as ToolPermissionConfig$1, e as ContextBudget$1, f as ToolCall, g as IContextPluginNextGen, W as WorkingMemoryConfig, P as PriorityCalculator, h as MemoryPriority, i as MemoryTier, j as ContextEvents, A as AgentContextNextGenConfig, k as AuthIdentity, l as ICompactionStrategy, B as BeforeCompactionCallback, m as InputItem, n as Content, o as PreparedContext, O as OutputItem, p as ToolResult, q as ConsolidationResult, S as SerializedContextState, r as StoredContextSession, s as ITextProvider, t as ContextSessionMetadata, F as FunctionToolDefinition, L as LLMResponse, u as StreamEvent, H as HookConfig, v as HistoryMode, w as AgentEvents, x as AgentResponse, E as ExecutionContext, y as ExecutionMetrics, z as AuditEntry, D as HookName, G as ITokenEstimator$1, J as ToolCategoryScope, K as CompactionContext, N as CompactionResult, Q as StaleEntryInfo, R as PriorityContext, U as MemoryIndex, V as TaskStatusForMemory, X as WorkingMemoryAccess, Y as ContextStorageListOptions, Z as ContextSessionSummary, _ as TokenUsage, $ as StreamEventType, a0 as TextGenerateOptions, a1 as ModelCapabilities, a2 as MessageRole } from './index-DmYrHH7d.cjs';
4
+ export { a3 as AfterToolContext, a4 as AgentEventName, a5 as AgenticLoopEventName, a6 as AgenticLoopEvents, a7 as ApprovalResult, a8 as ApproveToolContext, a9 as BeforeToolContext, aa as BuiltInTool, ab as CONTEXT_SESSION_FORMAT_VERSION, ac as CatalogRegistryEntry, ad as CatalogToolEntry, ae as CompactionItem, af as ConnectorCategoryInfo, ag as ContentType, ah as DEFAULT_CONFIG, ai as DEFAULT_FEATURES, aj as DEFAULT_MEMORY_CONFIG, ak as ErrorEvent, al as ExecutionConfig, am as Hook, an as HookManager, ao as InputImageContent, ap as InputTextContent, aq as IterationCompleteEvent, ar as JSONSchema, as as MEMORY_PRIORITY_VALUES, at as MemoryEntryInput, au as MemoryIndexEntry, av as Message, aw as ModifyingHook, ax as OutputTextContent, ay as OutputTextDeltaEvent, az as OutputTextDoneEvent, aA as OversizedInputResult, aB as PluginConfigs, aC as ReasoningDeltaEvent, aD as ReasoningDoneEvent, aE as ReasoningItem, aF as ResponseCompleteEvent, aG as ResponseCreatedEvent, aH as ResponseInProgressEvent, aI as SimpleScope, aJ as TaskAwareScope, aK as ThinkingContent, aL as ToolCallArgumentsDeltaEvent, aM as ToolCallArgumentsDoneEvent, aN as ToolCallStartEvent, aO as ToolCallState, aP as ToolCatalogRegistry, aQ as ToolCategoryDefinition, aR as ToolExecutionContext, aS as ToolExecutionDoneEvent, aT as ToolExecutionStartEvent, aU as ToolModification, aV as ToolResultContent, aW as ToolUseContent, aX as calculateEntrySize, aY as defaultDescribeCall, aZ as forPlan, a_ as forTasks, a$ as getToolCallDescription, b0 as isErrorEvent, b1 as isOutputTextDelta, b2 as isReasoningDelta, b3 as isReasoningDone, b4 as isResponseComplete, b5 as isSimpleScope, b6 as isStreamEvent, b7 as isTaskAwareScope, b8 as isTerminalMemoryStatus, b9 as isToolCallArgumentsDelta, ba as isToolCallArgumentsDone, bb as isToolCallStart, bc as scopeEquals, bd as scopeMatches } from './index-DmYrHH7d.cjs';
5
5
  import { EventEmitter } from 'eventemitter3';
6
6
  import { V as Vendor } from './Vendor-DYh_bzwo.cjs';
7
7
  export { a as VENDORS, i as isVendor } from './Vendor-DYh_bzwo.cjs';
8
- import { A as AudioFormat, I as IBaseModelDescription, V as VendorOptionSchema, a as IImageProvider } from './ImageModel-B64HX3lN.cjs';
9
- export { b as AspectRatio, c as IImageModelDescription, d as IMAGE_MODELS, e as IMAGE_MODEL_REGISTRY, f as ISourceLinks, g as ImageEditOptions, h as ImageGenerateOptions, i as ImageGeneration, j as ImageGenerationCreateOptions, k as ImageModelCapabilities, l as ImageModelPricing, m as ImageResponse, n as ImageVariationOptions, O as OutputFormat, Q as QualityLevel, S as SimpleGenerateOptions, o as calculateImageCost, p as getActiveImageModels, q as getImageModelInfo, r as getImageModelsByVendor, s as getImageModelsWithFeature } from './ImageModel-B64HX3lN.cjs';
8
+ import { A as AudioFormat, I as IBaseModelDescription, V as VendorOptionSchema, a as IImageProvider } from './ImageModel-Ds5_6sf7.cjs';
9
+ export { b as AspectRatio, c as IImageModelDescription, d as IMAGE_MODELS, e as IMAGE_MODEL_REGISTRY, f as ISourceLinks, g as ImageEditOptions, h as ImageGenerateOptions, i as ImageGeneration, j as ImageGenerationCreateOptions, k as ImageModelCapabilities, l as ImageModelPricing, m as ImageResponse, n as ImageVariationOptions, O as OutputFormat, Q as QualityLevel, S as SimpleGenerateOptions, o as calculateImageCost, p as getActiveImageModels, q as getImageModelInfo, r as getImageModelsByVendor, s as getImageModelsWithFeature } from './ImageModel-Ds5_6sf7.cjs';
10
10
  import { ServiceCategory } from './shared/index.cjs';
11
11
  export { ILLMDescription, LLM_MODELS, MODEL_REGISTRY, SERVICE_DEFINITIONS, SERVICE_INFO, SERVICE_URL_PATTERNS, ServiceDefinition, ServiceInfo, ServiceType, Services, calculateCost, detectServiceFromURL, getActiveModels, getAllServiceIds, getModelInfo, getModelsByVendor, getServiceDefinition, getServiceInfo, getServicesByCategory, isKnownService } from './shared/index.cjs';
12
12
 
@@ -316,844 +316,6 @@ interface IMediaStorage {
316
316
  getPath(): string;
317
317
  }
318
318
 
319
- /**
320
- * IContextStorage - Storage interface for AgentContext persistence
321
- *
322
- * Provides persistence operations for AgentContext sessions.
323
- * Implementations can use filesystem, database, cloud storage, etc.
324
- *
325
- * This follows Clean Architecture - the interface is in domain layer,
326
- * implementations are in infrastructure layer.
327
- */
328
-
329
- /**
330
- * Serialized context state for persistence.
331
- * This is the canonical definition - core layer re-exports this type.
332
- */
333
- interface SerializedContextState {
334
- /** Conversation history */
335
- conversation: InputItem[];
336
- /** Plugin states (keyed by plugin name) */
337
- pluginStates: Record<string, unknown>;
338
- /** System prompt */
339
- systemPrompt?: string;
340
- /** Metadata */
341
- metadata: {
342
- savedAt: number;
343
- agentId?: string;
344
- userId?: string;
345
- model: string;
346
- };
347
- /** Agent-specific state (for TaskAgent, UniversalAgent, etc.) */
348
- agentState?: Record<string, unknown>;
349
- }
350
- /**
351
- * Session summary for listing (lightweight, no full state)
352
- */
353
- interface ContextSessionSummary {
354
- /** Session identifier */
355
- sessionId: string;
356
- /** When the session was created */
357
- createdAt: Date;
358
- /** When the session was last saved */
359
- lastSavedAt: Date;
360
- /** Number of messages in history */
361
- messageCount: number;
362
- /** Number of memory entries */
363
- memoryEntryCount: number;
364
- /** Optional metadata */
365
- metadata?: ContextSessionMetadata;
366
- }
367
- /**
368
- * Session metadata (stored with session)
369
- */
370
- interface ContextSessionMetadata {
371
- /** Human-readable title */
372
- title?: string;
373
- /** Auto-generated or user-provided description */
374
- description?: string;
375
- /** Tags for filtering */
376
- tags?: string[];
377
- /** Custom key-value data */
378
- [key: string]: unknown;
379
- }
380
- /**
381
- * Full session state wrapper (includes metadata)
382
- */
383
- interface StoredContextSession {
384
- /** Format version for migration support */
385
- version: number;
386
- /** Session identifier */
387
- sessionId: string;
388
- /** When the session was created */
389
- createdAt: string;
390
- /** When the session was last saved */
391
- lastSavedAt: string;
392
- /** The serialized AgentContext state */
393
- state: SerializedContextState;
394
- /** Session metadata */
395
- metadata: ContextSessionMetadata;
396
- }
397
- /**
398
- * Current format version for stored sessions
399
- */
400
- declare const CONTEXT_SESSION_FORMAT_VERSION = 1;
401
- /**
402
- * Storage interface for AgentContext persistence
403
- *
404
- * Implementations:
405
- * - FileContextStorage: File-based storage at ~/.oneringai/agents/<agentId>/sessions/
406
- * - (Future) RedisContextStorage, PostgresContextStorage, S3ContextStorage, etc.
407
- */
408
- interface IContextStorage {
409
- /**
410
- * Save context state to a session
411
- *
412
- * @param sessionId - Unique session identifier
413
- * @param state - Serialized AgentContext state
414
- * @param metadata - Optional session metadata
415
- */
416
- save(sessionId: string, state: SerializedContextState, metadata?: ContextSessionMetadata): Promise<void>;
417
- /**
418
- * Load context state from a session
419
- *
420
- * @param sessionId - Session identifier to load
421
- * @returns The stored session, or null if not found
422
- */
423
- load(sessionId: string): Promise<StoredContextSession | null>;
424
- /**
425
- * Delete a session
426
- *
427
- * @param sessionId - Session identifier to delete
428
- */
429
- delete(sessionId: string): Promise<void>;
430
- /**
431
- * Check if a session exists
432
- *
433
- * @param sessionId - Session identifier to check
434
- */
435
- exists(sessionId: string): Promise<boolean>;
436
- /**
437
- * List all sessions (summaries only, not full state)
438
- *
439
- * @param options - Optional filtering and pagination
440
- * @returns Array of session summaries, sorted by lastSavedAt descending
441
- */
442
- list(options?: ContextStorageListOptions): Promise<ContextSessionSummary[]>;
443
- /**
444
- * Update session metadata without loading full state
445
- *
446
- * @param sessionId - Session identifier
447
- * @param metadata - Metadata to merge (existing keys preserved unless overwritten)
448
- */
449
- updateMetadata?(sessionId: string, metadata: Partial<ContextSessionMetadata>): Promise<void>;
450
- /**
451
- * Get the storage path (for display/debugging)
452
- * @deprecated Use getLocation() instead - getPath() assumes filesystem storage
453
- */
454
- getPath(): string;
455
- /**
456
- * Get a human-readable storage location string (for display/debugging).
457
- * Examples: file path, MongoDB URI, Redis key prefix, S3 bucket, etc.
458
- * Falls back to getPath() if not implemented.
459
- */
460
- getLocation?(): string;
461
- }
462
- /**
463
- * Options for listing sessions
464
- */
465
- interface ContextStorageListOptions {
466
- /** Filter by tags (any match) */
467
- tags?: string[];
468
- /** Filter by creation date range */
469
- createdAfter?: Date;
470
- createdBefore?: Date;
471
- /** Filter by last saved date range */
472
- savedAfter?: Date;
473
- savedBefore?: Date;
474
- /** Maximum number of results */
475
- limit?: number;
476
- /** Offset for pagination */
477
- offset?: number;
478
- }
479
-
480
- /**
481
- * AgentContextNextGen - Type Definitions
482
- *
483
- * Clean, minimal type definitions for the next-generation context manager.
484
- */
485
-
486
- /**
487
- * Token estimator interface - used for conversation and input estimation
488
- * Plugins handle their own token estimation internally.
489
- */
490
- interface ITokenEstimator$1 {
491
- /** Estimate tokens for a string */
492
- estimateTokens(text: string): number;
493
- /** Estimate tokens for arbitrary data (will be JSON stringified) */
494
- estimateDataTokens(data: unknown): number;
495
- /**
496
- * Estimate tokens for an image. Provider-specific implementations can override.
497
- *
498
- * Default heuristic (matches OpenAI's image token pricing):
499
- * - detail='low': 85 tokens
500
- * - detail='high' with known dimensions: 85 + 170 * ceil(w/512) * ceil(h/512)
501
- * - Unknown dimensions: ~1000 tokens (conservative default)
502
- *
503
- * @param width - Image width in pixels (if known)
504
- * @param height - Image height in pixels (if known)
505
- * @param detail - Image detail level: 'low', 'high', or 'auto' (default 'auto')
506
- */
507
- estimateImageTokens?(width?: number, height?: number, detail?: string): number;
508
- }
509
- /**
510
- * Context plugin interface for NextGen context management.
511
- *
512
- * ## Implementing a Custom Plugin
513
- *
514
- * 1. **Extend BasePluginNextGen** - provides token caching helpers
515
- * 2. **Implement getInstructions()** - return LLM usage guide (static, cached)
516
- * 3. **Implement getContent()** - return formatted content (Markdown with `##` header)
517
- * 4. **Call updateTokenCache()** - after any state change that affects content
518
- * 5. **Implement getTools()** - return tools with `<plugin_prefix>_*` naming
519
- *
520
- * ## Plugin Contributions
521
- *
522
- * Plugins provide three types of content to the system message:
523
- * 1. **Instructions** - static usage guide for the LLM (NEVER compacted)
524
- * 2. **Content** - dynamic plugin data/state (may be compacted)
525
- * 3. **Tools** - registered with ToolManager (NEVER compacted)
526
- *
527
- * ## Token Cache Lifecycle
528
- *
529
- * Plugins must track their own token size for budget calculation. The pattern:
530
- *
531
- * ```typescript
532
- * // When state changes:
533
- * this._entries.set(key, value);
534
- * this.invalidateTokenCache(); // Clear cached size
535
- *
536
- * // In getContent():
537
- * const content = this.formatContent();
538
- * this.updateTokenCache(this.estimator.estimateTokens(content)); // Update cache
539
- * return content;
540
- * ```
541
- *
542
- * ## Content Format
543
- *
544
- * `getContent()` should return Markdown with a descriptive header:
545
- *
546
- * ```markdown
547
- * ## Plugin Display Name (optional stats)
548
- *
549
- * Formatted content here...
550
- * - Entry 1: value
551
- * - Entry 2: value
552
- * ```
553
- *
554
- * Built-in plugins use these headers:
555
- * - WorkingMemory: `## Working Memory (N entries)`
556
- * - InContextMemory: `## Live Context (N entries)`
557
- * - PersistentInstructions: No header (user's raw instructions)
558
- *
559
- * ## Tool Naming Convention
560
- *
561
- * Use a consistent prefix based on plugin name:
562
- * - `working_memory` plugin → `memory_store`, `memory_retrieve`, `memory_delete`, `memory_list`
563
- * - `in_context_memory` plugin → `context_set`, `context_delete`, `context_list`
564
- * - `persistent_instructions` plugin → `instructions_set`, `instructions_remove`, `instructions_list`, `instructions_clear`
565
- *
566
- * ## State Serialization
567
- *
568
- * `getState()` and `restoreState()` are **synchronous** for simplicity.
569
- * If your plugin has async data, consider:
570
- * - Storing only references/keys in state
571
- * - Using a separate async initialization method
572
- *
573
- * @example
574
- * ```typescript
575
- * class MyPlugin extends BasePluginNextGen {
576
- * readonly name = 'my_plugin';
577
- * private _data = new Map<string, string>();
578
- *
579
- * getInstructions(): string {
580
- * return '## My Plugin\n\nUse my_plugin_set to store data...';
581
- * }
582
- *
583
- * async getContent(): Promise<string | null> {
584
- * if (this._data.size === 0) return null;
585
- * const lines = [...this._data].map(([k, v]) => `- ${k}: ${v}`);
586
- * const content = `## My Plugin (${this._data.size} entries)\n\n${lines.join('\n')}`;
587
- * this.updateTokenCache(this.estimator.estimateTokens(content));
588
- * return content;
589
- * }
590
- *
591
- * getTools(): ToolFunction[] {
592
- * return [myPluginSetTool, myPluginGetTool];
593
- * }
594
- *
595
- * getState(): unknown {
596
- * return { data: Object.fromEntries(this._data) };
597
- * }
598
- *
599
- * restoreState(state: unknown): void {
600
- * const s = state as { data: Record<string, string> };
601
- * this._data = new Map(Object.entries(s.data || {}));
602
- * this.invalidateTokenCache();
603
- * }
604
- * }
605
- * ```
606
- */
607
- interface IContextPluginNextGen {
608
- /** Unique plugin name (used for lookup and tool prefixing) */
609
- readonly name: string;
610
- /**
611
- * Get usage instructions for the LLM.
612
- *
613
- * Returns static text explaining how to use this plugin's tools
614
- * and data. This is placed in the system message and is NEVER
615
- * compacted - it persists throughout the conversation.
616
- *
617
- * Instructions should include:
618
- * - What the plugin does
619
- * - How to use available tools
620
- * - Best practices and conventions
621
- *
622
- * @returns Instructions string or null if no instructions needed
623
- *
624
- * @example
625
- * ```typescript
626
- * getInstructions(): string {
627
- * return `## Working Memory
628
- *
629
- * Use memory_store to save important data for later retrieval.
630
- * Use memory_retrieve to recall previously stored data.
631
- *
632
- * Best practices:
633
- * - Use descriptive keys like 'user_preferences' not 'data1'
634
- * - Store intermediate results that may be needed later`;
635
- * }
636
- * ```
637
- */
638
- getInstructions(): string | null;
639
- /**
640
- * Get formatted content to include in system message.
641
- *
642
- * Returns the plugin's current state formatted for LLM consumption.
643
- * Should be Markdown with a `## Header`. This content CAN be compacted
644
- * if `isCompactable()` returns true.
645
- *
646
- * **IMPORTANT:** Call `updateTokenCache()` with the content's token size
647
- * before returning to keep budget calculations accurate.
648
- *
649
- * @returns Formatted content string or null if empty
650
- *
651
- * @example
652
- * ```typescript
653
- * async getContent(): Promise<string | null> {
654
- * if (this._entries.size === 0) return null;
655
- *
656
- * const lines = this._entries.map(e => `- ${e.key}: ${e.value}`);
657
- * const content = `## My Plugin (${this._entries.size} entries)\n\n${lines.join('\n')}`;
658
- *
659
- * // IMPORTANT: Update token cache before returning
660
- * this.updateTokenCache(this.estimator.estimateTokens(content));
661
- * return content;
662
- * }
663
- * ```
664
- */
665
- getContent(): Promise<string | null>;
666
- /**
667
- * Get the full raw contents of this plugin for inspection.
668
- *
669
- * Used by library clients to programmatically inspect plugin state.
670
- * Returns the actual data structure, not the formatted string.
671
- *
672
- * @returns Raw plugin data (entries map, array, etc.)
673
- */
674
- getContents(): unknown;
675
- /**
676
- * Get current token size of plugin content.
677
- *
678
- * Returns the cached token count from the last `updateTokenCache()` call.
679
- * This is used for budget calculation in `prepare()`.
680
- *
681
- * The cache should be updated via `updateTokenCache()` whenever content
682
- * changes. If cache is null, returns 0.
683
- *
684
- * @returns Current token count (0 if no content or cache not set)
685
- */
686
- getTokenSize(): number;
687
- /**
688
- * Get token size of instructions (cached after first call).
689
- *
690
- * Instructions are static, so this is computed once and cached.
691
- * Used for budget calculation.
692
- *
693
- * @returns Token count for instructions (0 if no instructions)
694
- */
695
- getInstructionsTokenSize(): number;
696
- /**
697
- * Whether this plugin's content can be compacted when context is tight.
698
- *
699
- * Return true if the plugin can reduce its content size when requested.
700
- * Examples: evicting low-priority entries, summarizing, removing old data.
701
- *
702
- * Return false if content cannot be reduced (e.g., critical state).
703
- *
704
- * @returns true if compact() can free tokens
705
- */
706
- isCompactable(): boolean;
707
- /**
708
- * Compact plugin content to free tokens.
709
- *
710
- * Called by compaction strategies when context is too full.
711
- * Should attempt to free **approximately** `targetTokensToFree` tokens.
712
- *
713
- * This is a **best effort** operation:
714
- * - May free more or less than requested
715
- * - May return 0 if nothing can be compacted (e.g., all entries are critical)
716
- * - Should prioritize removing lowest-priority/oldest data first
717
- *
718
- * Strategies may include:
719
- * - Evicting low-priority entries
720
- * - Summarizing verbose content
721
- * - Removing oldest data
722
- * - Truncating large values
723
- *
724
- * **IMPORTANT:** Call `invalidateTokenCache()` or `updateTokenCache()`
725
- * after modifying content.
726
- *
727
- * @param targetTokensToFree - Approximate tokens to free (best effort)
728
- * @returns Actual tokens freed (may be 0 if nothing can be compacted)
729
- *
730
- * @example
731
- * ```typescript
732
- * async compact(targetTokensToFree: number): Promise<number> {
733
- * const before = this.getTokenSize();
734
- * let freed = 0;
735
- *
736
- * // Remove low-priority entries until target reached
737
- * const sorted = [...this._entries].sort(byPriority);
738
- * for (const entry of sorted) {
739
- * if (entry.priority === 'critical') continue; // Never remove critical
740
- * if (freed >= targetTokensToFree) break;
741
- *
742
- * freed += entry.tokens;
743
- * this._entries.delete(entry.key);
744
- * }
745
- *
746
- * this.invalidateTokenCache();
747
- * return freed;
748
- * }
749
- * ```
750
- */
751
- compact(targetTokensToFree: number): Promise<number>;
752
- /**
753
- * Get tools provided by this plugin.
754
- *
755
- * Tools are automatically registered with ToolManager when the plugin
756
- * is added to the context. Use a consistent naming convention:
757
- * `<prefix>_<action>` (e.g., `memory_store`, `context_set`).
758
- *
759
- * @returns Array of tool definitions (empty array if no tools)
760
- */
761
- getTools(): ToolFunction[];
762
- /**
763
- * Cleanup resources when context is destroyed.
764
- *
765
- * Called when AgentContextNextGen.destroy() is invoked.
766
- * Use for releasing resources, closing connections, etc.
767
- */
768
- destroy(): void;
769
- /**
770
- * Serialize plugin state for session persistence.
771
- *
772
- * **MUST be synchronous.** Return a JSON-serializable object representing
773
- * the plugin's current state. This is called when saving a session.
774
- *
775
- * For plugins with async data (e.g., external storage), return only
776
- * references/keys here and handle async restoration separately.
777
- *
778
- * @returns Serializable state object
779
- *
780
- * @example
781
- * ```typescript
782
- * getState(): unknown {
783
- * return {
784
- * entries: [...this._entries].map(([k, v]) => ({ key: k, ...v })),
785
- * version: 1, // Include version for future migrations
786
- * };
787
- * }
788
- * ```
789
- */
790
- getState(): unknown;
791
- /**
792
- * Restore plugin state from serialized data.
793
- *
794
- * Called when loading a saved session. The state comes from a previous
795
- * `getState()` call on the same plugin type.
796
- *
797
- * **IMPORTANT:** Call `invalidateTokenCache()` after restoring state
798
- * to ensure token counts are recalculated.
799
- *
800
- * @param state - Previously serialized state from getState()
801
- *
802
- * @example
803
- * ```typescript
804
- * restoreState(state: unknown): void {
805
- * const s = state as { entries: Array<{ key: string; value: unknown }> };
806
- * this._entries.clear();
807
- * for (const entry of s.entries || []) {
808
- * this._entries.set(entry.key, entry);
809
- * }
810
- * this.invalidateTokenCache(); // IMPORTANT: refresh token cache
811
- * }
812
- * ```
813
- */
814
- restoreState(state: unknown): void;
815
- }
816
- /**
817
- * Token budget breakdown - clear and simple
818
- */
819
- interface ContextBudget$1 {
820
- /** Maximum context tokens for the model */
821
- maxTokens: number;
822
- /** Tokens reserved for LLM response */
823
- responseReserve: number;
824
- /** Tokens used by system message (prompt + instructions + plugin content) */
825
- systemMessageTokens: number;
826
- /** Tokens used by tool definitions (NEVER compacted) */
827
- toolsTokens: number;
828
- /** Tokens used by conversation history */
829
- conversationTokens: number;
830
- /** Tokens used by current input (user message or tool results) */
831
- currentInputTokens: number;
832
- /** Total tokens used */
833
- totalUsed: number;
834
- /** Available tokens (maxTokens - responseReserve - totalUsed) */
835
- available: number;
836
- /** Usage percentage (totalUsed / (maxTokens - responseReserve)) */
837
- utilizationPercent: number;
838
- /** Breakdown by component for debugging */
839
- breakdown: {
840
- systemPrompt: number;
841
- persistentInstructions: number;
842
- pluginInstructions: number;
843
- pluginContents: Record<string, number>;
844
- tools: number;
845
- conversation: number;
846
- currentInput: number;
847
- };
848
- }
849
- /**
850
- * Result of prepare() - ready for LLM call
851
- */
852
- interface PreparedContext {
853
- /** Final input items array for LLM */
854
- input: InputItem[];
855
- /** Token budget breakdown */
856
- budget: ContextBudget$1;
857
- /** Whether compaction was performed */
858
- compacted: boolean;
859
- /** Log of compaction actions taken */
860
- compactionLog: string[];
861
- }
862
- /**
863
- * Result of handling oversized current input
864
- */
865
- interface OversizedInputResult {
866
- /** Whether the input was accepted (possibly truncated) */
867
- accepted: boolean;
868
- /** Processed content (truncated if needed) */
869
- content: string;
870
- /** Error message if rejected */
871
- error?: string;
872
- /** Warning message if truncated */
873
- warning?: string;
874
- /** Original size in bytes */
875
- originalSize: number;
876
- /** Final size in bytes */
877
- finalSize: number;
878
- }
879
- /**
880
- * Feature flags for enabling/disabling plugins
881
- */
882
- interface ContextFeatures {
883
- /** Enable WorkingMemory plugin (default: true) */
884
- workingMemory?: boolean;
885
- /** Enable InContextMemory plugin (default: false) */
886
- inContextMemory?: boolean;
887
- /** Enable PersistentInstructions plugin (default: false) */
888
- persistentInstructions?: boolean;
889
- /** Enable UserInfo plugin (default: false) */
890
- userInfo?: boolean;
891
- }
892
- /**
893
- * Default feature configuration
894
- */
895
- declare const DEFAULT_FEATURES: Required<ContextFeatures>;
896
- /**
897
- * Plugin configurations for auto-initialization.
898
- * When features are enabled, plugins are created with these configs.
899
- * The config shapes match each plugin's constructor parameter.
900
- */
901
- interface PluginConfigs {
902
- /**
903
- * Working memory plugin config (used when features.workingMemory=true).
904
- * See WorkingMemoryPluginConfig for full options.
905
- */
906
- workingMemory?: Record<string, unknown>;
907
- /**
908
- * In-context memory plugin config (used when features.inContextMemory=true).
909
- * See InContextMemoryConfig for full options.
910
- */
911
- inContextMemory?: Record<string, unknown>;
912
- /**
913
- * Persistent instructions plugin config (used when features.persistentInstructions=true).
914
- * Note: agentId is auto-filled from context config if not provided.
915
- * See PersistentInstructionsConfig for full options.
916
- */
917
- persistentInstructions?: Record<string, unknown>;
918
- /**
919
- * User info plugin config (used when features.userInfo=true).
920
- * See UserInfoPluginConfig for full options.
921
- */
922
- userInfo?: Record<string, unknown>;
923
- }
924
- /**
925
- * AgentContextNextGen configuration
926
- */
927
- interface AgentContextNextGenConfig {
928
- /** Model name (used for context window lookup) */
929
- model: string;
930
- /** Maximum context tokens (auto-detected from model if not provided) */
931
- maxContextTokens?: number;
932
- /** Tokens to reserve for response (default: 4096) */
933
- responseReserve?: number;
934
- /** System prompt provided by user */
935
- systemPrompt?: string;
936
- /**
937
- * Compaction strategy name (default: 'default').
938
- * Used to create strategy from StrategyRegistry if compactionStrategy not provided.
939
- */
940
- strategy?: string;
941
- /**
942
- * Custom compaction strategy instance.
943
- * If provided, overrides the `strategy` option.
944
- */
945
- compactionStrategy?: ICompactionStrategy;
946
- /** Feature flags */
947
- features?: ContextFeatures;
948
- /** Agent ID (required for PersistentInstructions) */
949
- agentId?: string;
950
- /** User ID for multi-user scenarios. Automatically flows to ToolContext for all tool executions. */
951
- userId?: string;
952
- /**
953
- * Restrict this agent to a subset of registered connectors (by name).
954
- * When set, only these connectors are visible in ToolContext.connectorRegistry
955
- * and in dynamic tool descriptions (e.g., execute_javascript).
956
- * When not set, all connectors visible to the current userId are available.
957
- */
958
- connectors?: string[];
959
- /** Initial tools to register */
960
- tools?: ToolFunction[];
961
- /** Storage for session persistence */
962
- storage?: IContextStorage;
963
- /** Plugin-specific configurations (used with features flags) */
964
- plugins?: PluginConfigs;
965
- /**
966
- * Hard timeout in milliseconds for any single tool execution.
967
- * Acts as a safety net: if a tool's own timeout mechanism fails
968
- * (e.g. a child process doesn't exit), this will force-resolve with an error.
969
- * Default: 0 (disabled - relies on each tool's own timeout)
970
- */
971
- toolExecutionTimeout?: number;
972
- }
973
- /**
974
- * Default configuration values
975
- */
976
- declare const DEFAULT_CONFIG: {
977
- responseReserve: number;
978
- strategy: string;
979
- };
980
-
981
- /**
982
- * Events emitted by AgentContextNextGen
983
- */
984
- interface ContextEvents {
985
- /** Emitted when context is prepared */
986
- 'context:prepared': {
987
- budget: ContextBudget$1;
988
- compacted: boolean;
989
- };
990
- /** Emitted when compaction is performed */
991
- 'context:compacted': {
992
- tokensFreed: number;
993
- log: string[];
994
- };
995
- /** Emitted right after budget is calculated in prepare() - for reactive monitoring */
996
- 'budget:updated': {
997
- budget: ContextBudget$1;
998
- timestamp: number;
999
- };
1000
- /** Emitted when budget reaches warning threshold (>70%) */
1001
- 'budget:warning': {
1002
- budget: ContextBudget$1;
1003
- };
1004
- /** Emitted when budget reaches critical threshold (>90%) */
1005
- 'budget:critical': {
1006
- budget: ContextBudget$1;
1007
- };
1008
- /** Emitted when compaction is about to start */
1009
- 'compaction:starting': {
1010
- budget: ContextBudget$1;
1011
- targetTokensToFree: number;
1012
- timestamp: number;
1013
- };
1014
- /** Emitted when current input is too large */
1015
- 'input:oversized': {
1016
- result: OversizedInputResult;
1017
- };
1018
- /** Emitted when a message is added */
1019
- 'message:added': {
1020
- role: string;
1021
- index: number;
1022
- };
1023
- /** Emitted when conversation is cleared */
1024
- 'conversation:cleared': {
1025
- reason?: string;
1026
- };
1027
- }
1028
- /**
1029
- * Callback type for beforeCompaction hook.
1030
- * Called before compaction starts, allowing agents to save important data.
1031
- */
1032
- type BeforeCompactionCallback = (info: {
1033
- budget: ContextBudget$1;
1034
- targetTokensToFree: number;
1035
- strategy: string;
1036
- }) => Promise<void>;
1037
- /**
1038
- * Result of compact() operation.
1039
- */
1040
- interface CompactionResult {
1041
- /** Tokens actually freed by compaction */
1042
- tokensFreed: number;
1043
- /** Number of messages removed from conversation */
1044
- messagesRemoved: number;
1045
- /** Names of plugins that were compacted */
1046
- pluginsCompacted: string[];
1047
- /** Log of actions taken during compaction */
1048
- log: string[];
1049
- }
1050
- /**
1051
- * Result of consolidate() operation.
1052
- */
1053
- interface ConsolidationResult {
1054
- /** Whether any consolidation was performed */
1055
- performed: boolean;
1056
- /** Net token change (negative = freed, positive = added, e.g., summaries) */
1057
- tokensChanged: number;
1058
- /** Description of actions taken */
1059
- actions: string[];
1060
- }
1061
- /**
1062
- * Read-only context passed to compaction strategies.
1063
- * Provides access to data needed for compaction decisions and
1064
- * controlled methods to modify state.
1065
- */
1066
- interface CompactionContext {
1067
- /** Current budget (from prepare) */
1068
- readonly budget: ContextBudget$1;
1069
- /** Current conversation history (read-only) */
1070
- readonly conversation: ReadonlyArray<InputItem>;
1071
- /** Current input (read-only) */
1072
- readonly currentInput: ReadonlyArray<InputItem>;
1073
- /** Registered plugins (for querying state) */
1074
- readonly plugins: ReadonlyArray<IContextPluginNextGen>;
1075
- /** Strategy name for logging */
1076
- readonly strategyName: string;
1077
- /**
1078
- * Remove messages by indices.
1079
- * Handles tool pair preservation internally.
1080
- *
1081
- * @param indices - Array of message indices to remove
1082
- * @returns Tokens actually freed
1083
- */
1084
- removeMessages(indices: number[]): Promise<number>;
1085
- /**
1086
- * Compact a specific plugin.
1087
- *
1088
- * @param pluginName - Name of the plugin to compact
1089
- * @param targetTokens - Approximate tokens to free
1090
- * @returns Tokens actually freed
1091
- */
1092
- compactPlugin(pluginName: string, targetTokens: number): Promise<number>;
1093
- /**
1094
- * Estimate tokens for an item.
1095
- *
1096
- * @param item - Input item to estimate
1097
- * @returns Estimated token count
1098
- */
1099
- estimateTokens(item: InputItem): number;
1100
- }
1101
- /**
1102
- * Compaction strategy interface.
1103
- *
1104
- * Strategies implement two methods:
1105
- * - `compact()`: Emergency compaction when thresholds exceeded (called from prepare())
1106
- * - `consolidate()`: Post-cycle cleanup and optimization (called after agentic loop)
1107
- *
1108
- * Use `compact()` for quick, threshold-based token reduction.
1109
- * Use `consolidate()` for more expensive operations like summarization.
1110
- */
1111
- interface ICompactionStrategy {
1112
- /** Strategy name (unique identifier) for identification and logging */
1113
- readonly name: string;
1114
- /** Human-readable display name for UI */
1115
- readonly displayName: string;
1116
- /** Description explaining the strategy behavior */
1117
- readonly description: string;
1118
- /** Threshold percentage (0-1) at which compact() is triggered */
1119
- readonly threshold: number;
1120
- /**
1121
- * Plugin names this strategy requires to function.
1122
- * Validation is performed when strategy is assigned to context.
1123
- * If any required plugin is missing, an error is thrown.
1124
- *
1125
- * @example
1126
- * ```typescript
1127
- * readonly requiredPlugins = ['working_memory'] as const;
1128
- * ```
1129
- */
1130
- readonly requiredPlugins?: readonly string[];
1131
- /**
1132
- * Emergency compaction - triggered when context usage exceeds threshold.
1133
- * Called from prepare() when utilization > threshold.
1134
- *
1135
- * Should be fast and focus on freeing tokens quickly.
1136
- *
1137
- * @param context - Compaction context with controlled access to state
1138
- * @param targetToFree - Approximate tokens to free
1139
- * @returns Result describing what was done
1140
- */
1141
- compact(context: CompactionContext, targetToFree: number): Promise<CompactionResult>;
1142
- /**
1143
- * Post-cycle consolidation - run after agentic cycle completes.
1144
- * Called from Agent after run()/stream() finishes (before session save).
1145
- *
1146
- * Use for more expensive operations:
1147
- * - Summarizing long conversations
1148
- * - Memory optimization and deduplication
1149
- * - Promoting important data to persistent storage
1150
- *
1151
- * @param context - Compaction context with controlled access to state
1152
- * @returns Result describing what was done
1153
- */
1154
- consolidate(context: CompactionContext): Promise<ConsolidationResult>;
1155
- }
1156
-
1157
319
  /**
1158
320
  * IAgentDefinitionStorage - Storage interface for Agent configuration persistence
1159
321
  *
@@ -1560,6 +722,7 @@ interface IUserInfoStorage {
1560
722
  *
1561
723
  * Defines the data structures for task-based autonomous agents.
1562
724
  */
725
+
1563
726
  /**
1564
727
  * Task status lifecycle
1565
728
  */
@@ -1615,6 +778,65 @@ interface ExternalDependency {
1615
778
  receivedData?: unknown;
1616
779
  receivedAt?: number;
1617
780
  }
781
+ /** Sub-routine specification: either inline tasks or a full RoutineDefinition */
782
+ type SubRoutineSpec = TaskInput[] | RoutineDefinition;
783
+ /** Reference to a source value for control flow operations. */
784
+ interface TaskSourceRef {
785
+ /** Reference the output of a named task (resolves to __task_output_{name}) */
786
+ task?: string;
787
+ /** Direct memory key lookup */
788
+ key?: string;
789
+ /** JSON path to extract from the resolved value (e.g., 'data.items', 'results[0].entries') */
790
+ path?: string;
791
+ }
792
+ /** Source can be a simple key string (legacy) or a structured reference. */
793
+ type ControlFlowSource = string | TaskSourceRef;
794
+ /** Map: execute a sub-routine for each element in an array */
795
+ interface TaskMapFlow {
796
+ type: 'map';
797
+ /** Source array reference — task name, memory key, or structured ref. */
798
+ source: ControlFlowSource;
799
+ /** Sub-routine to run per element */
800
+ tasks: SubRoutineSpec;
801
+ /** Memory key for collected results array */
802
+ resultKey?: string;
803
+ /** Cap iterations (default: array.length, hard max: 1000) */
804
+ maxIterations?: number;
805
+ /** Timeout per sub-execution iteration in ms (default: no timeout) */
806
+ iterationTimeoutMs?: number;
807
+ }
808
+ /** Fold: accumulate a result across array elements */
809
+ interface TaskFoldFlow {
810
+ type: 'fold';
811
+ /** Source array reference — task name, memory key, or structured ref. */
812
+ source: ControlFlowSource;
813
+ /** Sub-routine to run per element */
814
+ tasks: SubRoutineSpec;
815
+ /** Starting accumulator value */
816
+ initialValue: unknown;
817
+ /** Memory key for final accumulated result */
818
+ resultKey: string;
819
+ /** Cap iterations (default: array.length, hard max: 1000) */
820
+ maxIterations?: number;
821
+ /** Timeout per sub-execution iteration in ms (default: no timeout) */
822
+ iterationTimeoutMs?: number;
823
+ }
824
+ /** Until: repeat a sub-routine until a condition is met */
825
+ interface TaskUntilFlow {
826
+ type: 'until';
827
+ /** Sub-routine to run each iteration */
828
+ tasks: SubRoutineSpec;
829
+ /** Checked AFTER each iteration (reuses existing TaskCondition type) */
830
+ condition: TaskCondition;
831
+ /** Maximum iterations (required — no default) */
832
+ maxIterations: number;
833
+ /** Optional ICM key for current iteration index */
834
+ iterationKey?: string;
835
+ /** Timeout per sub-execution iteration in ms (default: no timeout) */
836
+ iterationTimeoutMs?: number;
837
+ }
838
+ /** Union of all control flow types */
839
+ type TaskControlFlow = TaskMapFlow | TaskFoldFlow | TaskUntilFlow;
1618
840
  /**
1619
841
  * Task execution settings
1620
842
  */
@@ -1741,6 +963,8 @@ interface Task {
1741
963
  suggestedTools?: string[];
1742
964
  /** Optional expected output description */
1743
965
  expectedOutput?: string;
966
+ /** Control flow: map, fold, or until (replaces normal LLM execution for this task) */
967
+ controlFlow?: TaskControlFlow;
1744
968
  /** Result after completion */
1745
969
  result?: {
1746
970
  success: boolean;
@@ -1776,6 +1000,7 @@ interface TaskInput {
1776
1000
  suggestedTools?: string[];
1777
1001
  validation?: TaskValidation;
1778
1002
  expectedOutput?: string;
1003
+ controlFlow?: TaskControlFlow;
1779
1004
  maxAttempts?: number;
1780
1005
  metadata?: Record<string, unknown>;
1781
1006
  }
@@ -1894,6 +1119,20 @@ declare function detectDependencyCycle(tasks: Task[]): string[] | null;
1894
1119
  * A RoutineExecution is a running instance backed by an existing Plan.
1895
1120
  */
1896
1121
 
1122
+ /**
1123
+ * A parameter that a routine accepts as input.
1124
+ * Enables parameterized, reusable routines.
1125
+ */
1126
+ interface RoutineParameter {
1127
+ /** Parameter name (used as {{param.name}} in templates) */
1128
+ name: string;
1129
+ /** Human-readable description */
1130
+ description: string;
1131
+ /** Whether this parameter must be provided (default: false) */
1132
+ required?: boolean;
1133
+ /** Default value when not provided */
1134
+ default?: unknown;
1135
+ }
1897
1136
  /**
1898
1137
  * A reusable routine definition (template).
1899
1138
  *
@@ -1921,6 +1160,8 @@ interface RoutineDefinition {
1921
1160
  concurrency?: PlanConcurrency;
1922
1161
  /** Whether the LLM can dynamically add/modify tasks during execution. Default: false */
1923
1162
  allowDynamicTasks?: boolean;
1163
+ /** Input parameters this routine accepts (templates use {{param.name}}) */
1164
+ parameters?: RoutineParameter[];
1924
1165
  /** Tags for categorization and filtering */
1925
1166
  tags?: string[];
1926
1167
  /** Author/creator */
@@ -1947,6 +1188,7 @@ interface RoutineDefinitionInput {
1947
1188
  instructions?: string;
1948
1189
  concurrency?: PlanConcurrency;
1949
1190
  allowDynamicTasks?: boolean;
1191
+ parameters?: RoutineParameter[];
1950
1192
  tags?: string[];
1951
1193
  author?: string;
1952
1194
  metadata?: Record<string, unknown>;
@@ -1964,55 +1206,151 @@ interface RoutineExecution {
1964
1206
  id: string;
1965
1207
  /** Reference to the routine definition ID */
1966
1208
  routineId: string;
1967
- /** The live plan managing task execution (created via createPlan) */
1968
- plan: Plan;
1969
- /** Current execution status */
1209
+ /** The live plan managing task execution (created via createPlan) */
1210
+ plan: Plan;
1211
+ /** Current execution status */
1212
+ status: RoutineExecutionStatus;
1213
+ /** Overall progress (0-100) based on completed tasks */
1214
+ progress: number;
1215
+ /** Timestamps */
1216
+ startedAt?: number;
1217
+ completedAt?: number;
1218
+ lastUpdatedAt: number;
1219
+ /** Error message if failed */
1220
+ error?: string;
1221
+ /** Metadata */
1222
+ metadata?: Record<string, unknown>;
1223
+ }
1224
+ /**
1225
+ * Create a RoutineDefinition with defaults.
1226
+ * Validates task dependency references and detects cycles.
1227
+ */
1228
+ declare function createRoutineDefinition(input: RoutineDefinitionInput): RoutineDefinition;
1229
+ /**
1230
+ * Create a RoutineExecution from a RoutineDefinition.
1231
+ * Instantiates all tasks into a Plan via createPlan().
1232
+ */
1233
+ declare function createRoutineExecution(definition: RoutineDefinition): RoutineExecution;
1234
+ /**
1235
+ * Compute routine progress (0-100) from plan task statuses.
1236
+ */
1237
+ declare function getRoutineProgress(execution: RoutineExecution): number;
1238
+
1239
+ /**
1240
+ * IRoutineDefinitionStorage - Storage interface for routine definitions.
1241
+ *
1242
+ * Follows the same userId-optional pattern as ICustomToolStorage and IUserInfoStorage.
1243
+ * When userId is undefined, defaults to 'default' user in storage implementation.
1244
+ */
1245
+
1246
+ interface IRoutineDefinitionStorage {
1247
+ save(userId: string | undefined, definition: RoutineDefinition): Promise<void>;
1248
+ load(userId: string | undefined, id: string): Promise<RoutineDefinition | null>;
1249
+ delete(userId: string | undefined, id: string): Promise<void>;
1250
+ exists(userId: string | undefined, id: string): Promise<boolean>;
1251
+ list(userId: string | undefined, options?: {
1252
+ tags?: string[];
1253
+ search?: string;
1254
+ limit?: number;
1255
+ offset?: number;
1256
+ }): Promise<RoutineDefinition[]>;
1257
+ getPath(userId: string | undefined): string;
1258
+ }
1259
+
1260
+ /**
1261
+ * Routine Execution Record — persisted record for tracking/history.
1262
+ *
1263
+ * Unlike RoutineExecution (runtime state with live Plan), this is a
1264
+ * storage-agnostic snapshot meant for persistence and querying.
1265
+ * Timestamps are `number` (epoch ms), no framework dependencies.
1266
+ */
1267
+
1268
+ type RoutineStepType = 'task.started' | 'task.completed' | 'task.failed' | 'task.validation' | 'tool.call' | 'tool.start' | 'llm.start' | 'llm.complete' | 'iteration.complete' | 'execution.error' | 'control_flow.started' | 'control_flow.completed';
1269
+ interface RoutineExecutionStep {
1270
+ timestamp: number;
1271
+ taskName: string;
1272
+ type: RoutineStepType;
1273
+ data?: Record<string, unknown>;
1274
+ }
1275
+ interface RoutineTaskResult {
1276
+ success: boolean;
1277
+ output?: string;
1278
+ error?: string;
1279
+ validationScore?: number;
1280
+ validationExplanation?: string;
1281
+ }
1282
+ interface RoutineTaskSnapshot {
1283
+ taskId: string;
1284
+ name: string;
1285
+ description: string;
1286
+ status: 'pending' | 'blocked' | 'in_progress' | 'completed' | 'failed' | 'skipped' | 'cancelled';
1287
+ attempts: number;
1288
+ maxAttempts: number;
1289
+ result?: RoutineTaskResult;
1290
+ startedAt?: number;
1291
+ completedAt?: number;
1292
+ controlFlowType?: 'map' | 'fold' | 'until';
1293
+ }
1294
+ interface RoutineExecutionRecord {
1295
+ executionId: string;
1296
+ routineId: string;
1297
+ routineName: string;
1970
1298
  status: RoutineExecutionStatus;
1971
- /** Overall progress (0-100) based on completed tasks */
1972
1299
  progress: number;
1973
- /** Timestamps */
1300
+ tasks: RoutineTaskSnapshot[];
1301
+ steps: RoutineExecutionStep[];
1302
+ taskCount: number;
1303
+ connectorName: string;
1304
+ model: string;
1305
+ error?: string;
1974
1306
  startedAt?: number;
1975
1307
  completedAt?: number;
1976
- lastUpdatedAt: number;
1977
- /** Error message if failed */
1978
- error?: string;
1979
- /** Metadata */
1308
+ lastActivityAt?: number;
1309
+ trigger?: {
1310
+ type: 'schedule' | 'event' | 'manual';
1311
+ source?: string;
1312
+ event?: string;
1313
+ payload?: unknown;
1314
+ };
1980
1315
  metadata?: Record<string, unknown>;
1981
1316
  }
1982
1317
  /**
1983
- * Create a RoutineDefinition with defaults.
1984
- * Validates task dependency references and detects cycles.
1985
- */
1986
- declare function createRoutineDefinition(input: RoutineDefinitionInput): RoutineDefinition;
1987
- /**
1988
- * Create a RoutineExecution from a RoutineDefinition.
1989
- * Instantiates all tasks into a Plan via createPlan().
1318
+ * Create initial task snapshots from a routine definition.
1990
1319
  */
1991
- declare function createRoutineExecution(definition: RoutineDefinition): RoutineExecution;
1320
+ declare function createTaskSnapshots(definition: RoutineDefinition): RoutineTaskSnapshot[];
1992
1321
  /**
1993
- * Compute routine progress (0-100) from plan task statuses.
1322
+ * Create an initial RoutineExecutionRecord from a definition.
1323
+ * Status is set to 'running' with empty steps.
1994
1324
  */
1995
- declare function getRoutineProgress(execution: RoutineExecution): number;
1325
+ declare function createRoutineExecutionRecord(definition: RoutineDefinition, connectorName: string, model: string, trigger?: RoutineExecutionRecord['trigger']): RoutineExecutionRecord;
1996
1326
 
1997
1327
  /**
1998
- * IRoutineDefinitionStorage - Storage interface for routine definitions.
1328
+ * Storage interface for routine execution records.
1999
1329
  *
2000
- * Follows the same userId-optional pattern as ICustomToolStorage and IUserInfoStorage.
2001
- * When userId is undefined, defaults to 'default' user in storage implementation.
1330
+ * Designed to be storage-agnostic implementations can back this with
1331
+ * MongoDB, PostgreSQL, file system, etc.
2002
1332
  */
2003
1333
 
2004
- interface IRoutineDefinitionStorage {
2005
- save(userId: string | undefined, definition: RoutineDefinition): Promise<void>;
2006
- load(userId: string | undefined, id: string): Promise<RoutineDefinition | null>;
2007
- delete(userId: string | undefined, id: string): Promise<void>;
2008
- exists(userId: string | undefined, id: string): Promise<boolean>;
1334
+ interface IRoutineExecutionStorage {
1335
+ /** Insert a new execution record. Returns the record ID. */
1336
+ insert(userId: string | undefined, record: RoutineExecutionRecord): Promise<string>;
1337
+ /** Update top-level fields on an execution record. */
1338
+ update(id: string, updates: Partial<Pick<RoutineExecutionRecord, 'status' | 'progress' | 'error' | 'completedAt' | 'lastActivityAt'>>): Promise<void>;
1339
+ /** Append a step to the execution's steps array. */
1340
+ pushStep(id: string, step: RoutineExecutionStep): Promise<void>;
1341
+ /** Update a specific task snapshot within the execution record. */
1342
+ updateTask(id: string, taskName: string, updates: Partial<RoutineTaskSnapshot>): Promise<void>;
1343
+ /** Load a single execution record by ID. */
1344
+ load(id: string): Promise<RoutineExecutionRecord | null>;
1345
+ /** List execution records with optional filters. */
2009
1346
  list(userId: string | undefined, options?: {
2010
- tags?: string[];
2011
- search?: string;
1347
+ routineId?: string;
1348
+ status?: RoutineExecutionStatus;
2012
1349
  limit?: number;
2013
1350
  offset?: number;
2014
- }): Promise<RoutineDefinition[]>;
2015
- getPath(userId: string | undefined): string;
1351
+ }): Promise<RoutineExecutionRecord[]>;
1352
+ /** Check if a routine has a currently running execution. */
1353
+ hasRunning(userId: string | undefined, routineId: string): Promise<boolean>;
2016
1354
  }
2017
1355
 
2018
1356
  /**
@@ -2077,6 +1415,7 @@ interface StorageConfig {
2077
1415
  workingMemory: (context?: StorageContext) => IMemoryStorage;
2078
1416
  userInfo: (context?: StorageContext) => IUserInfoStorage;
2079
1417
  routineDefinitions: (context?: StorageContext) => IRoutineDefinitionStorage;
1418
+ routineExecutions: (context?: StorageContext) => IRoutineExecutionStorage;
2080
1419
  }
2081
1420
  declare class StorageRegistry {
2082
1421
  /** Internal storage map */
@@ -2724,6 +2063,14 @@ declare class ToolManager extends EventEmitter implements IToolExecutor, IDispos
2724
2063
  * Register multiple tools at once
2725
2064
  */
2726
2065
  registerMany(tools: ToolFunction[], options?: Omit<ToolOptions, 'conditions'>): void;
2066
+ /**
2067
+ * Register tools produced by a specific connector.
2068
+ * Sets `source: 'connector:<connectorName>'` (or `'connector:<name>:<accountId>'` for identity-bound tools)
2069
+ * so agent-level filtering can restrict which connector tools are visible to a given agent.
2070
+ */
2071
+ registerConnectorTools(connectorName: string, tools: ToolFunction[], options?: Omit<ToolOptions, 'source'> & {
2072
+ accountId?: string;
2073
+ }): void;
2727
2074
  /**
2728
2075
  * Unregister a tool by name
2729
2076
  */
@@ -2801,6 +2148,12 @@ declare class ToolManager extends EventEmitter implements IToolExecutor, IDispos
2801
2148
  * Get all enabled tools (sorted by priority)
2802
2149
  */
2803
2150
  getEnabled(): ToolFunction[];
2151
+ /**
2152
+ * Get all enabled registrations (sorted by priority).
2153
+ * Includes full registration metadata (source, namespace, etc.)
2154
+ * for use in connector-aware filtering.
2155
+ */
2156
+ getEnabledRegistrations(): ToolRegistration[];
2804
2157
  /**
2805
2158
  * Get all tools (enabled and disabled)
2806
2159
  */
@@ -2809,6 +2162,11 @@ declare class ToolManager extends EventEmitter implements IToolExecutor, IDispos
2809
2162
  * Get tools by namespace
2810
2163
  */
2811
2164
  getByNamespace(namespace: string): ToolFunction[];
2165
+ /**
2166
+ * Get all registered tool names in a category.
2167
+ * Used by ToolCatalogPlugin for bulk enable/disable.
2168
+ */
2169
+ getByCategory(category: string): string[];
2812
2170
  /**
2813
2171
  * Get tool registration info
2814
2172
  */
@@ -3736,8 +3094,8 @@ declare class AgentContextNextGen extends EventEmitter<ContextEvents> {
3736
3094
  private readonly _agentId;
3737
3095
  /** User ID for multi-user scenarios */
3738
3096
  private _userId;
3739
- /** Allowed connector names (when agent is restricted to a subset) */
3740
- private _allowedConnectors;
3097
+ /** Auth identities this agent is scoped to (connector + optional accountId) */
3098
+ private _identities;
3741
3099
  /** Storage backend */
3742
3100
  private readonly _storage?;
3743
3101
  /** Destroyed flag */
@@ -3768,7 +3126,7 @@ declare class AgentContextNextGen extends EventEmitter<ContextEvents> {
3768
3126
  * Merges with existing ToolContext to preserve other fields (memory, signal, taskId).
3769
3127
  *
3770
3128
  * Connector registry resolution order:
3771
- * 1. If `connectors` (allowed names) is set → filtered view of global registry
3129
+ * 1. If `identities` is set → filtered view showing only identity connectors
3772
3130
  * 2. If access policy + userId → scoped view via Connector.scoped()
3773
3131
  * 3. Otherwise → full global registry
3774
3132
  */
@@ -3787,10 +3145,10 @@ declare class AgentContextNextGen extends EventEmitter<ContextEvents> {
3787
3145
  get userId(): string | undefined;
3788
3146
  /** Set user ID. Automatically updates ToolContext for all tool executions. */
3789
3147
  set userId(value: string | undefined);
3790
- /** Get the allowed connector names (undefined = all visible connectors) */
3791
- get connectors(): string[] | undefined;
3792
- /** Set allowed connector names. Updates ToolContext.connectorRegistry. */
3793
- set connectors(value: string[] | undefined);
3148
+ /** Get the auth identities this agent is scoped to (undefined = all visible connectors) */
3149
+ get identities(): AuthIdentity[] | undefined;
3150
+ /** Set auth identities. Updates ToolContext.connectorRegistry and identity-aware descriptions. */
3151
+ set identities(value: AuthIdentity[] | undefined);
3794
3152
  /** Get/set system prompt */
3795
3153
  get systemPrompt(): string | undefined;
3796
3154
  set systemPrompt(value: string | undefined);
@@ -4239,11 +3597,11 @@ interface BaseAgentConfig {
4239
3597
  /** User ID for multi-user scenarios. Flows to ToolContext automatically for all tool executions. */
4240
3598
  userId?: string;
4241
3599
  /**
4242
- * Restrict this agent to a subset of registered connectors (by name).
4243
- * Only these connectors will be visible in tool descriptions and sandbox execution.
3600
+ * Restrict this agent to specific auth identities (connector + optional account alias).
3601
+ * Each identity produces its own tool set (e.g., microsoft_work_api, microsoft_personal_api).
4244
3602
  * When not set, all connectors visible to the current userId are available.
4245
3603
  */
4246
- connectors?: string[];
3604
+ identities?: AuthIdentity[];
4247
3605
  /** Tools available to the agent */
4248
3606
  tools?: ToolFunction[];
4249
3607
  /** Provide a pre-configured ToolManager (advanced) */
@@ -4423,13 +3781,13 @@ declare abstract class BaseAgent<TConfig extends BaseAgentConfig = BaseAgentConf
4423
3781
  */
4424
3782
  set userId(value: string | undefined);
4425
3783
  /**
4426
- * Get the allowed connector names (undefined = all visible connectors).
3784
+ * Get the auth identities this agent is scoped to (undefined = all visible connectors).
4427
3785
  */
4428
- get connectors(): string[] | undefined;
3786
+ get identities(): AuthIdentity[] | undefined;
4429
3787
  /**
4430
- * Restrict this agent to a subset of connectors. Updates ToolContext.connectorRegistry.
3788
+ * Set auth identities at runtime. Updates ToolContext.connectorRegistry and tool descriptions.
4431
3789
  */
4432
- set connectors(value: string[] | undefined);
3790
+ set identities(value: AuthIdentity[] | undefined);
4433
3791
  /**
4434
3792
  * Permission management. Returns ToolPermissionManager for approval control.
4435
3793
  */
@@ -4437,8 +3795,11 @@ declare abstract class BaseAgent<TConfig extends BaseAgentConfig = BaseAgentConf
4437
3795
  /**
4438
3796
  * Add a tool to the agent.
4439
3797
  * Tools are registered with AgentContext (single source of truth).
3798
+ *
3799
+ * @param tool - The tool function to register
3800
+ * @param options - Optional registration options (namespace, source, priority, etc.)
4440
3801
  */
4441
- addTool(tool: ToolFunction): void;
3802
+ addTool(tool: ToolFunction, options?: ToolOptions): void;
4442
3803
  /**
4443
3804
  * Remove a tool from the agent.
4444
3805
  * Tools are unregistered from AgentContext (single source of truth).
@@ -4925,6 +4286,8 @@ interface ExecuteRoutineOptions {
4925
4286
  model?: string;
4926
4287
  /** Additional tools — only used when creating a new agent (no `agent` provided) */
4927
4288
  tools?: ToolFunction[];
4289
+ /** Input parameter values for parameterized routines */
4290
+ inputs?: Record<string, unknown>;
4928
4291
  /** Hooks — applied to agent for the duration of routine execution.
4929
4292
  * For new agents: baked in at creation. For existing agents: registered before
4930
4293
  * execution and unregistered after. */
@@ -4941,8 +4304,8 @@ interface ExecuteRoutineOptions {
4941
4304
  prompts?: {
4942
4305
  /** Override system prompt builder. Receives definition, should return full system prompt. */
4943
4306
  system?: (definition: RoutineDefinition) => string;
4944
- /** Override task prompt builder. Receives task, should return the user message for that task. */
4945
- task?: (task: Task) => string;
4307
+ /** Override task prompt builder. Receives task and optional execution context, should return the user message for that task. */
4308
+ task?: (task: Task, execution?: RoutineExecution) => string;
4946
4309
  /** Override validation prompt builder. Receives task + validation context (response, memory state, tool calls). */
4947
4310
  validation?: (task: Task, context: ValidationContext) => string;
4948
4311
  };
@@ -4984,6 +4347,64 @@ interface ValidationContext {
4984
4347
  */
4985
4348
  declare function executeRoutine(options: ExecuteRoutineOptions): Promise<RoutineExecution>;
4986
4349
 
4350
+ /**
4351
+ * Execution Recorder Factory
4352
+ *
4353
+ * Creates ready-to-use hooks + callbacks for `executeRoutine()` that
4354
+ * persist execution state to an IRoutineExecutionStorage backend.
4355
+ *
4356
+ * Replaces the manual hook wiring previously done in v25's
4357
+ * RoutineExecutionService._runInBackground().
4358
+ *
4359
+ * @example
4360
+ * ```typescript
4361
+ * const record = createRoutineExecutionRecord(definition, connector, model);
4362
+ * const execId = await storage.insert(userId, record);
4363
+ * const recorder = createExecutionRecorder({ storage, executionId: execId });
4364
+ *
4365
+ * executeRoutine({
4366
+ * definition, agent, inputs,
4367
+ * hooks: recorder.hooks,
4368
+ * onTaskStarted: recorder.onTaskStarted,
4369
+ * onTaskComplete: recorder.onTaskComplete,
4370
+ * onTaskFailed: recorder.onTaskFailed,
4371
+ * onTaskValidation: recorder.onTaskValidation,
4372
+ * })
4373
+ * .then(exec => recorder.finalize(exec))
4374
+ * .catch(err => recorder.finalize(null, err));
4375
+ * ```
4376
+ */
4377
+
4378
+ interface ExecutionRecorderOptions {
4379
+ /** Storage backend for persisting execution state. */
4380
+ storage: IRoutineExecutionStorage;
4381
+ /** ID of the execution record (must already be inserted). */
4382
+ executionId: string;
4383
+ /** Optional prefix for log messages. */
4384
+ logPrefix?: string;
4385
+ /** Max length for truncated tool args/results in steps. Default: 500. */
4386
+ maxTruncateLength?: number;
4387
+ }
4388
+ interface ExecutionRecorder {
4389
+ /** Hook config to pass to executeRoutine(). */
4390
+ hooks: HookConfig;
4391
+ /** Callback for onTaskStarted. */
4392
+ onTaskStarted: (task: Task, execution: RoutineExecution) => void;
4393
+ /** Callback for onTaskComplete. */
4394
+ onTaskComplete: (task: Task, execution: RoutineExecution) => void;
4395
+ /** Callback for onTaskFailed. */
4396
+ onTaskFailed: (task: Task, execution: RoutineExecution) => void;
4397
+ /** Callback for onTaskValidation. */
4398
+ onTaskValidation: (task: Task, result: TaskValidationResult, execution: RoutineExecution) => void;
4399
+ /** Call after executeRoutine() resolves/rejects to write final status. */
4400
+ finalize: (execution: RoutineExecution | null, error?: Error) => Promise<void>;
4401
+ }
4402
+ /**
4403
+ * Create an ExecutionRecorder that wires hooks + callbacks to persist
4404
+ * execution state via the provided storage backend.
4405
+ */
4406
+ declare function createExecutionRecorder(options: ExecutionRecorderOptions): ExecutionRecorder;
4407
+
4987
4408
  /**
4988
4409
  * BasePluginNextGen - Base class for context plugins
4989
4410
  *
@@ -5545,12 +4966,15 @@ declare class PersistentInstructionsPluginNextGen implements IContextPluginNextG
5545
4966
  * - User preferences (theme, language, timezone)
5546
4967
  * - User context (location, role, permissions)
5547
4968
  * - User metadata (name, email, profile info)
4969
+ * - TODO tracking (stored as entries with `todo_` key prefix)
5548
4970
  *
5549
4971
  * Storage: ~/.oneringai/users/<userId>/user_info.json
5550
4972
  *
5551
4973
  * Design:
5552
4974
  * - UserId passed at construction time from AgentContextNextGen._userId
5553
4975
  * - User data IS injected into context via getContent() (entries rendered as markdown)
4976
+ * - TODOs rendered in a separate "## Current TODOs" section as a checklist
4977
+ * - Internal entries (key starts with `_`) hidden from rendered output
5554
4978
  * - In-memory cache with lazy loading + write-through to storage
5555
4979
  * - Tools access current user's data only (no cross-user access)
5556
4980
  */
@@ -5623,6 +5047,82 @@ declare class UserInfoPluginNextGen implements IContextPluginNextGen {
5623
5047
  private createUserInfoGetTool;
5624
5048
  private createUserInfoRemoveTool;
5625
5049
  private createUserInfoClearTool;
5050
+ private createTodoAddTool;
5051
+ private createTodoUpdateTool;
5052
+ private createTodoRemoveTool;
5053
+ }
5054
+
5055
+ /**
5056
+ * ToolCatalogPluginNextGen - Dynamic Tool Loading/Unloading for Agents
5057
+ *
5058
+ * When agents need 100+ tools, sending all tool definitions to the LLM wastes
5059
+ * tokens and degrades performance. This plugin provides 3 metatools that let
5060
+ * agents discover and load only the tool categories they need.
5061
+ *
5062
+ * Categories come from ToolCatalogRegistry (static global) and ConnectorTools
5063
+ * (runtime discovery). The plugin manages loaded/unloaded state via ToolManager.
5064
+ *
5065
+ * @example
5066
+ * ```typescript
5067
+ * const ctx = AgentContextNextGen.create({
5068
+ * model: 'gpt-4',
5069
+ * features: { toolCatalog: true },
5070
+ * toolCategories: ['filesystem', 'web'], // optional scope
5071
+ * });
5072
+ * ```
5073
+ */
5074
+
5075
+ interface ToolCatalogPluginConfig {
5076
+ /** Scope filter for which categories are visible */
5077
+ categoryScope?: ToolCategoryScope;
5078
+ /** Categories to pre-load on initialization */
5079
+ autoLoadCategories?: string[];
5080
+ /** Maximum loaded categories at once (default: 10) */
5081
+ maxLoadedCategories?: number;
5082
+ /** Auth identities for connector filtering */
5083
+ identities?: AuthIdentity[];
5084
+ }
5085
+ declare class ToolCatalogPluginNextGen extends BasePluginNextGen {
5086
+ readonly name = "tool_catalog";
5087
+ /** category name → array of tool names that were loaded */
5088
+ private _loadedCategories;
5089
+ /** Reference to the ToolManager for registering/disabling tools */
5090
+ private _toolManager;
5091
+ /** Cached connector categories — discovered once in setToolManager() */
5092
+ private _connectorCategories;
5093
+ /** Whether this plugin has been destroyed */
5094
+ private _destroyed;
5095
+ /** WeakMap cache for tool definition token estimates */
5096
+ private _toolTokenCache;
5097
+ private _config;
5098
+ constructor(config?: ToolCatalogPluginConfig);
5099
+ getInstructions(): string;
5100
+ getContent(): Promise<string | null>;
5101
+ getContents(): unknown;
5102
+ getTools(): ToolFunction[];
5103
+ isCompactable(): boolean;
5104
+ compact(targetTokensToFree: number): Promise<number>;
5105
+ getState(): unknown;
5106
+ restoreState(state: unknown): void;
5107
+ destroy(): void;
5108
+ /**
5109
+ * Set the ToolManager reference. Called by AgentContextNextGen after plugin registration.
5110
+ */
5111
+ setToolManager(tm: ToolManager): void;
5112
+ /** Get list of currently loaded category names */
5113
+ get loadedCategories(): string[];
5114
+ private executeSearch;
5115
+ executeLoad(category: string): Record<string, unknown>;
5116
+ private executeUnload;
5117
+ private getAllowedCategories;
5118
+ /**
5119
+ * Get connector categories from cache (populated once in setToolManager).
5120
+ */
5121
+ private getConnectorCategories;
5122
+ private keywordSearch;
5123
+ private searchConnectorCategory;
5124
+ private getCategoriesSortedByLastUsed;
5125
+ private estimateToolDefinitionTokens;
5626
5126
  }
5627
5127
 
5628
5128
  /**
@@ -9846,6 +9346,66 @@ declare class InMemoryHistoryStorage implements IHistoryStorage {
9846
9346
  restoreState(state: SerializedHistoryState): Promise<void>;
9847
9347
  }
9848
9348
 
9349
+ /**
9350
+ * Routine Control Flow — map, fold, until handlers + template resolution
9351
+ *
9352
+ * Control flow tasks delegate to executeRoutine() recursively with the shared agent,
9353
+ * using ICM keys (__map_item, __map_index, etc.) to pass iteration state.
9354
+ */
9355
+
9356
+ /** Well-known ICM/WM keys used by the routine execution framework. */
9357
+ declare const ROUTINE_KEYS: {
9358
+ /** Plan overview with task statuses (ICM) */
9359
+ readonly PLAN: "__routine_plan";
9360
+ /** Dependency results location guide (ICM) */
9361
+ readonly DEPS: "__routine_deps";
9362
+ /** Prefix for per-dependency result keys (ICM/WM) */
9363
+ readonly DEP_RESULT_PREFIX: "__dep_result_";
9364
+ /** Current map/fold item (ICM) */
9365
+ readonly MAP_ITEM: "__map_item";
9366
+ /** Current map/fold index, 0-based (ICM) */
9367
+ readonly MAP_INDEX: "__map_index";
9368
+ /** Total items in map/fold (ICM) */
9369
+ readonly MAP_TOTAL: "__map_total";
9370
+ /** Running fold accumulator (ICM) */
9371
+ readonly FOLD_ACCUMULATOR: "__fold_accumulator";
9372
+ /** Prefix for large dep results stored in WM findings tier */
9373
+ readonly WM_DEP_FINDINGS_PREFIX: "findings/__dep_result_";
9374
+ /** Prefix for auto-stored task outputs (set by output contracts) */
9375
+ readonly TASK_OUTPUT_PREFIX: "__task_output_";
9376
+ };
9377
+ interface ControlFlowResult {
9378
+ completed: boolean;
9379
+ result?: unknown;
9380
+ error?: string;
9381
+ }
9382
+ /**
9383
+ * Resolve template placeholders in text.
9384
+ *
9385
+ * Supported namespaces:
9386
+ * - {{param.name}} → inputs[name]
9387
+ * - {{map.item}} / {{map.index}} / {{map.total}} → ICM keys
9388
+ * - {{fold.accumulator}} → ICM key
9389
+ *
9390
+ * Non-string values are JSON.stringify'd. Unresolved templates are left as-is.
9391
+ */
9392
+ declare function resolveTemplates(text: string, inputs: Record<string, unknown>, icmPlugin: InContextMemoryPluginNextGen | null): string;
9393
+ /**
9394
+ * Resolve the source array for a map/fold control flow using layered resolution:
9395
+ * 1. Determine lookup key(s) from source config
9396
+ * 2. Read from ICM/WM with fallback chain
9397
+ * 3. Apply JSON path extraction if specified
9398
+ * 4. Coerce to array algorithmically (JSON parse, common field names)
9399
+ * 5. LLM extraction fallback if still not an array
9400
+ */
9401
+ declare function resolveFlowSource(flow: {
9402
+ source: ControlFlowSource;
9403
+ maxIterations?: number;
9404
+ }, flowType: string, agent: Agent, execution: RoutineExecution | undefined, icmPlugin: InContextMemoryPluginNextGen | null, wmPlugin: WorkingMemoryPluginNextGen | null): Promise<{
9405
+ array: unknown[];
9406
+ maxIter: number;
9407
+ } | ControlFlowResult>;
9408
+
9849
9409
  /**
9850
9410
  * FilePersistentInstructionsStorage - File-based storage for persistent instructions
9851
9411
  *
@@ -11113,6 +10673,8 @@ interface GenericAPIToolOptions {
11113
10673
  description?: string;
11114
10674
  /** User ID for multi-user OAuth */
11115
10675
  userId?: string;
10676
+ /** Account alias for multi-account OAuth (baked into tool name and context) */
10677
+ accountId?: string;
11116
10678
  /** Permission config for the tool */
11117
10679
  permission?: ToolPermissionConfig$1;
11118
10680
  }
@@ -11141,6 +10703,8 @@ interface GenericAPICallResult {
11141
10703
  interface ConnectorToolsOptions {
11142
10704
  /** Optional scoped registry for access-controlled connector lookup */
11143
10705
  registry?: IConnectorRegistry;
10706
+ /** Account alias for multi-account OAuth. When set, tools are prefixed with accountId and context is bound. */
10707
+ accountId?: string;
11144
10708
  }
11145
10709
  /**
11146
10710
  * ConnectorTools - Main API for vendor-dependent tools
@@ -11284,6 +10848,34 @@ declare class ConnectorTools {
11284
10848
  */
11285
10849
  private static maintainCacheSize;
11286
10850
  private static resolveConnector;
10851
+ /**
10852
+ * Generate tools for a set of auth identities.
10853
+ * Each identity gets its own tool set with unique name prefixes.
10854
+ *
10855
+ * @param identities - Array of auth identities
10856
+ * @param userId - Optional user ID for multi-user OAuth
10857
+ * @param options - Optional registry for scoped connector lookup
10858
+ * @returns Map of identity key to tool array
10859
+ *
10860
+ * @example
10861
+ * ```typescript
10862
+ * const toolsByIdentity = ConnectorTools.forIdentities([
10863
+ * { connector: 'microsoft', accountId: 'work' },
10864
+ * { connector: 'microsoft', accountId: 'personal' },
10865
+ * { connector: 'github' },
10866
+ * ]);
10867
+ * // Keys: 'microsoft:work', 'microsoft:personal', 'github'
10868
+ * ```
10869
+ */
10870
+ static forIdentities(identities: AuthIdentity[], userId?: string, options?: {
10871
+ registry?: IConnectorRegistry;
10872
+ }): Map<string, ToolFunction[]>;
10873
+ /**
10874
+ * Wrap a tool to inject accountId into ToolContext at execute time.
10875
+ * This allows identity-bound tools to use the correct account without
10876
+ * modifying every service tool factory.
10877
+ */
10878
+ private static bindAccountId;
11287
10879
  private static createGenericAPITool;
11288
10880
  }
11289
10881
 
@@ -11333,43 +10925,56 @@ declare class OAuthManager {
11333
10925
  * Automatically refreshes if expired
11334
10926
  *
11335
10927
  * @param userId - User identifier for multi-user support (optional)
10928
+ * @param accountId - Account alias for multi-account support (optional)
11336
10929
  */
11337
- getToken(userId?: string): Promise<string>;
10930
+ getToken(userId?: string, accountId?: string): Promise<string>;
11338
10931
  /**
11339
10932
  * Force refresh the token
11340
10933
  *
11341
10934
  * @param userId - User identifier for multi-user support (optional)
10935
+ * @param accountId - Account alias for multi-account support (optional)
11342
10936
  */
11343
- refreshToken(userId?: string): Promise<string>;
10937
+ refreshToken(userId?: string, accountId?: string): Promise<string>;
11344
10938
  /**
11345
10939
  * Check if current token is valid
11346
10940
  *
11347
10941
  * @param userId - User identifier for multi-user support (optional)
10942
+ * @param accountId - Account alias for multi-account support (optional)
11348
10943
  */
11349
- isTokenValid(userId?: string): Promise<boolean>;
10944
+ isTokenValid(userId?: string, accountId?: string): Promise<boolean>;
11350
10945
  /**
11351
10946
  * Start authorization flow (Authorization Code only)
11352
10947
  * Returns URL for user to visit
11353
10948
  *
11354
10949
  * @param userId - User identifier for multi-user support (optional)
10950
+ * @param accountId - Account alias for multi-account support (optional)
11355
10951
  * @returns Authorization URL for the user to visit
11356
10952
  */
11357
- startAuthFlow(userId?: string): Promise<string>;
10953
+ startAuthFlow(userId?: string, accountId?: string): Promise<string>;
11358
10954
  /**
11359
10955
  * Handle OAuth callback (Authorization Code only)
11360
10956
  * Call this with the callback URL after user authorizes
11361
10957
  *
11362
10958
  * @param callbackUrl - Full callback URL with code and state parameters
11363
10959
  * @param userId - Optional user identifier (can be extracted from state if embedded)
10960
+ * @param accountId - Optional account alias (can be extracted from state if embedded)
11364
10961
  */
11365
- handleCallback(callbackUrl: string, userId?: string): Promise<void>;
10962
+ handleCallback(callbackUrl: string, userId?: string, accountId?: string): Promise<void>;
11366
10963
  /**
11367
10964
  * Revoke token (if supported by provider)
11368
10965
  *
11369
10966
  * @param revocationUrl - Optional revocation endpoint URL
11370
10967
  * @param userId - User identifier for multi-user support (optional)
10968
+ * @param accountId - Account alias for multi-account support (optional)
10969
+ */
10970
+ revokeToken(revocationUrl?: string, userId?: string, accountId?: string): Promise<void>;
10971
+ /**
10972
+ * List account aliases for a user (Authorization Code only)
10973
+ *
10974
+ * @param userId - User identifier (optional)
10975
+ * @returns Array of account aliases (e.g., ['work', 'personal'])
11371
10976
  */
11372
- revokeToken(revocationUrl?: string, userId?: string): Promise<void>;
10977
+ listAccounts(userId?: string): Promise<string[]>;
11373
10978
  private validateConfig;
11374
10979
  }
11375
10980
 
@@ -11392,6 +10997,10 @@ declare class MemoryStorage implements ITokenStorage {
11392
10997
  * Get number of stored tokens
11393
10998
  */
11394
10999
  size(): number;
11000
+ /**
11001
+ * List all storage keys (for account enumeration)
11002
+ */
11003
+ listKeys(): Promise<string[]>;
11395
11004
  }
11396
11005
 
11397
11006
  /**
@@ -11416,6 +11025,11 @@ declare class FileStorage implements ITokenStorage {
11416
11025
  getToken(key: string): Promise<StoredToken$1 | null>;
11417
11026
  deleteToken(key: string): Promise<void>;
11418
11027
  hasToken(key: string): Promise<boolean>;
11028
+ /**
11029
+ * List all storage keys by decrypting each token file and reading _storageKey.
11030
+ * Falls back to returning hashed filenames for tokens stored before multi-account support.
11031
+ */
11032
+ listKeys(): Promise<string[]>;
11419
11033
  /**
11420
11034
  * List all token keys (for debugging)
11421
11035
  */
@@ -11438,7 +11052,7 @@ declare class FileStorage implements ITokenStorage {
11438
11052
  /**
11439
11053
  * Fetch with automatic authentication using connector's configured auth scheme
11440
11054
  *
11441
- * Same API as standard fetch(), but with additional authProvider and optional userId parameters.
11055
+ * Same API as standard fetch(), but with additional authProvider and optional userId/accountId parameters.
11442
11056
  * Authentication is handled automatically based on the connector's configuration:
11443
11057
  * - Bearer tokens (GitHub, Slack, Stripe)
11444
11058
  * - Bot tokens (Discord)
@@ -11449,6 +11063,7 @@ declare class FileStorage implements ITokenStorage {
11449
11063
  * @param options - Standard fetch options (DO NOT set Authorization header - it's added automatically)
11450
11064
  * @param authProvider - Name of registered connector (e.g., 'github', 'slack')
11451
11065
  * @param userId - Optional user identifier for multi-user support (omit for single-user mode)
11066
+ * @param accountId - Optional account alias for multi-account OAuth (e.g., 'work', 'personal')
11452
11067
  * @returns Promise<Response> - Same as standard fetch
11453
11068
  *
11454
11069
  * @example Single-user mode:
@@ -11461,37 +11076,28 @@ declare class FileStorage implements ITokenStorage {
11461
11076
  * const data = await response.json();
11462
11077
  * ```
11463
11078
  *
11464
- * @example With relative URL (uses connector's baseURL):
11079
+ * @example Multi-account mode:
11465
11080
  * ```typescript
11466
11081
  * const response = await authenticatedFetch(
11467
- * '/user/repos', // Resolves to https://api.github.com/user/repos
11468
- * { method: 'GET' },
11469
- * 'github'
11470
- * );
11471
- * const repos = await response.json();
11472
- * ```
11473
- *
11474
- * @example Multi-user mode:
11475
- * ```typescript
11476
- * const response = await authenticatedFetch(
11477
- * '/user/repos',
11082
+ * 'https://graph.microsoft.com/v1.0/me',
11478
11083
  * { method: 'GET' },
11479
- * 'github',
11480
- * 'user123' // Get token for specific user
11084
+ * 'microsoft',
11085
+ * 'alice',
11086
+ * 'work' // Use Alice's work Microsoft account
11481
11087
  * );
11482
- * const repos = await response.json();
11483
11088
  * ```
11484
11089
  */
11485
- declare function authenticatedFetch(url: string | URL, options: RequestInit | undefined, authProvider: string, userId?: string): Promise<Response>;
11090
+ declare function authenticatedFetch(url: string | URL, options: RequestInit | undefined, authProvider: string, userId?: string, accountId?: string): Promise<Response>;
11486
11091
  /**
11487
- * Create an authenticated fetch function bound to a specific connector and optionally a user
11092
+ * Create an authenticated fetch function bound to a specific connector and optionally a user/account
11488
11093
  *
11489
11094
  * Useful for creating reusable fetch functions for a specific API and/or user.
11490
11095
  * Uses connector's configured auth scheme (Bearer, Bot, Basic, custom headers).
11491
11096
  *
11492
11097
  * @param authProvider - Name of registered connector
11493
11098
  * @param userId - Optional user identifier to bind to (omit for single-user mode)
11494
- * @returns Fetch function bound to that connector (and user)
11099
+ * @param accountId - Optional account alias for multi-account OAuth (e.g., 'work', 'personal')
11100
+ * @returns Fetch function bound to that connector (and user/account)
11495
11101
  *
11496
11102
  * @example Single-user mode:
11497
11103
  * ```typescript
@@ -11502,27 +11108,17 @@ declare function authenticatedFetch(url: string | URL, options: RequestInit | un
11502
11108
  * const emails = await msftFetch('https://graph.microsoft.com/v1.0/me/messages');
11503
11109
  * ```
11504
11110
  *
11505
- * @example With relative URLs:
11111
+ * @example Multi-account mode:
11506
11112
  * ```typescript
11507
- * const githubFetch = createAuthenticatedFetch('github');
11113
+ * // Create fetch for Alice's work Microsoft account
11114
+ * const workFetch = createAuthenticatedFetch('microsoft', 'alice', 'work');
11115
+ * const personalFetch = createAuthenticatedFetch('microsoft', 'alice', 'personal');
11508
11116
  *
11509
- * // Relative URLs resolved against connector's baseURL
11510
- * const repos = await githubFetch('/user/repos');
11511
- * const issues = await githubFetch('/user/issues');
11512
- * ```
11513
- *
11514
- * @example Multi-user mode:
11515
- * ```typescript
11516
- * // Create fetch functions for different users
11517
- * const aliceFetch = createAuthenticatedFetch('github', 'user123');
11518
- * const bobFetch = createAuthenticatedFetch('github', 'user456');
11519
- *
11520
- * // Each uses their own token
11521
- * const aliceRepos = await aliceFetch('/user/repos');
11522
- * const bobRepos = await bobFetch('/user/repos');
11117
+ * const workEmails = await workFetch('/me/messages');
11118
+ * const personalEmails = await personalFetch('/me/messages');
11523
11119
  * ```
11524
11120
  */
11525
- declare function createAuthenticatedFetch(authProvider: string, userId?: string): (url: string | URL, options?: RequestInit) => Promise<Response>;
11121
+ declare function createAuthenticatedFetch(authProvider: string, userId?: string, accountId?: string): (url: string | URL, options?: RequestInit) => Promise<Response>;
11526
11122
 
11527
11123
  /**
11528
11124
  * Tool Generator - Auto-generate tools for registered connectors
@@ -12985,7 +12581,7 @@ declare const writeFile: ToolFunction<WriteFileArgs, WriteFileResult>;
12985
12581
  /**
12986
12582
  * Arguments for the read file tool
12987
12583
  */
12988
- interface ReadFileArgs {
12584
+ interface ReadFileArgs$1 {
12989
12585
  /** Absolute path to the file to read */
12990
12586
  file_path: string;
12991
12587
  /** Line number to start reading from (1-indexed). Only provide if the file is too large. */
@@ -12996,11 +12592,11 @@ interface ReadFileArgs {
12996
12592
  /**
12997
12593
  * Create a Read File tool with the given configuration
12998
12594
  */
12999
- declare function createReadFileTool(config?: FilesystemToolConfig): ToolFunction<ReadFileArgs, ReadFileResult>;
12595
+ declare function createReadFileTool(config?: FilesystemToolConfig): ToolFunction<ReadFileArgs$1, ReadFileResult>;
13000
12596
  /**
13001
12597
  * Default Read File tool instance
13002
12598
  */
13003
- declare const readFile: ToolFunction<ReadFileArgs, ReadFileResult>;
12599
+ declare const readFile: ToolFunction<ReadFileArgs$1, ReadFileResult>;
13004
12600
 
13005
12601
  /**
13006
12602
  * JSON Manipulation Tool
@@ -13506,7 +13102,7 @@ interface GitHubCreatePRResult {
13506
13102
  /**
13507
13103
  * Arguments for the search_files tool
13508
13104
  */
13509
- interface SearchFilesArgs {
13105
+ interface SearchFilesArgs$1 {
13510
13106
  /** Repository in "owner/repo" format or full GitHub URL */
13511
13107
  repository?: string;
13512
13108
  /** Glob pattern to match files (e.g., "**\/*.ts", "src/**\/*.tsx") */
@@ -13517,7 +13113,7 @@ interface SearchFilesArgs {
13517
13113
  /**
13518
13114
  * Create a GitHub search_files tool
13519
13115
  */
13520
- declare function createSearchFilesTool(connector: Connector, userId?: string): ToolFunction<SearchFilesArgs, GitHubSearchFilesResult>;
13116
+ declare function createSearchFilesTool(connector: Connector, userId?: string): ToolFunction<SearchFilesArgs$1, GitHubSearchFilesResult>;
13521
13117
 
13522
13118
  /**
13523
13119
  * GitHub Search Code Tool
@@ -13693,6 +13289,7 @@ interface MicrosoftFetchOptions {
13693
13289
  method?: string;
13694
13290
  body?: unknown;
13695
13291
  userId?: string;
13292
+ accountId?: string;
13696
13293
  queryParams?: Record<string, string | number | boolean>;
13697
13294
  accept?: string;
13698
13295
  }
@@ -13756,7 +13353,7 @@ declare function isTeamsMeetingUrl(input: string): boolean;
13756
13353
  * @returns The resolved meeting ID and optional subject
13757
13354
  * @throws Error if the URL cannot be resolved or input is empty
13758
13355
  */
13759
- declare function resolveMeetingId(connector: Connector, input: string, prefix: string, effectiveUserId?: string): Promise<{
13356
+ declare function resolveMeetingId(connector: Connector, input: string, prefix: string, effectiveUserId?: string, effectiveAccountId?: string): Promise<{
13760
13357
  meetingId: string;
13761
13358
  subject?: string;
13762
13359
  }>;
@@ -13804,6 +13401,129 @@ interface MeetingSlotSuggestion {
13804
13401
  availability: string;
13805
13402
  }[];
13806
13403
  }
13404
+ /** @internal Graph driveItem metadata */
13405
+ interface GraphDriveItem {
13406
+ id: string;
13407
+ name: string;
13408
+ size: number;
13409
+ webUrl?: string;
13410
+ lastModifiedDateTime?: string;
13411
+ createdDateTime?: string;
13412
+ file?: {
13413
+ mimeType?: string;
13414
+ hashes?: Record<string, string>;
13415
+ };
13416
+ folder?: {
13417
+ childCount?: number;
13418
+ };
13419
+ parentReference?: {
13420
+ driveId?: string;
13421
+ driveType?: string;
13422
+ id?: string;
13423
+ name?: string;
13424
+ path?: string;
13425
+ siteId?: string;
13426
+ };
13427
+ '@microsoft.graph.downloadUrl'?: string;
13428
+ }
13429
+ interface MicrosoftReadFileResult {
13430
+ success: boolean;
13431
+ filename?: string;
13432
+ sizeBytes?: number;
13433
+ mimeType?: string;
13434
+ markdown?: string;
13435
+ webUrl?: string;
13436
+ error?: string;
13437
+ }
13438
+ interface MicrosoftListFilesResult {
13439
+ success: boolean;
13440
+ items?: {
13441
+ name: string;
13442
+ type: 'file' | 'folder';
13443
+ size: number;
13444
+ sizeFormatted: string;
13445
+ mimeType?: string;
13446
+ lastModified?: string;
13447
+ webUrl?: string;
13448
+ id: string;
13449
+ childCount?: number;
13450
+ }[];
13451
+ totalCount?: number;
13452
+ hasMore?: boolean;
13453
+ error?: string;
13454
+ }
13455
+ interface MicrosoftSearchFilesResult {
13456
+ success: boolean;
13457
+ results?: {
13458
+ name: string;
13459
+ path?: string;
13460
+ site?: string;
13461
+ snippet?: string;
13462
+ size: number;
13463
+ sizeFormatted: string;
13464
+ webUrl?: string;
13465
+ id: string;
13466
+ lastModified?: string;
13467
+ }[];
13468
+ totalCount?: number;
13469
+ hasMore?: boolean;
13470
+ error?: string;
13471
+ }
13472
+ /**
13473
+ * Encode a sharing URL into the Graph API sharing token format.
13474
+ *
13475
+ * Microsoft Graph's `/shares/{token}` endpoint accepts base64url-encoded URLs
13476
+ * prefixed with `u!`. This is the documented way to access files via sharing links
13477
+ * or direct web URLs without knowing the driveId/itemId.
13478
+ *
13479
+ * @see https://learn.microsoft.com/en-us/graph/api/shares-get
13480
+ */
13481
+ declare function encodeSharingUrl(webUrl: string): string;
13482
+ /**
13483
+ * Check if a string looks like a web URL (http/https).
13484
+ */
13485
+ declare function isWebUrl(source: string): boolean;
13486
+ /**
13487
+ * Check if a string looks like a OneDrive/SharePoint web URL.
13488
+ *
13489
+ * Matches:
13490
+ * - `*.sharepoint.com/*`
13491
+ * - `onedrive.live.com/*`
13492
+ * - `1drv.ms/*`
13493
+ * - `*.sharepoint-df.com/*` (dogfood/test)
13494
+ */
13495
+ declare function isMicrosoftFileUrl(source: string): boolean;
13496
+ /**
13497
+ * Determine the drive prefix for Graph API calls.
13498
+ *
13499
+ * Priority:
13500
+ * 1. siteId → `/sites/{siteId}/drive`
13501
+ * 2. driveId → `/drives/{driveId}`
13502
+ * 3. fallback → `{userPrefix}/drive` (e.g., `/me/drive`)
13503
+ */
13504
+ declare function getDrivePrefix(userPrefix: string, options?: {
13505
+ siteId?: string;
13506
+ driveId?: string;
13507
+ }): string;
13508
+ /**
13509
+ * Build the Graph API endpoint and metadata endpoint for a file source.
13510
+ *
13511
+ * Handles three input types:
13512
+ * 1. Web URL (SharePoint/OneDrive link) → uses `/shares/{token}/driveItem`
13513
+ * 2. Path (starts with `/`) → uses `/drive/root:{path}:`
13514
+ * 3. Item ID → uses `/drive/items/{id}`
13515
+ *
13516
+ * @returns Object with `metadataEndpoint` (for item info) and `contentEndpoint` (for download)
13517
+ */
13518
+ declare function resolveFileEndpoints(source: string, drivePrefix: string): {
13519
+ metadataEndpoint: string;
13520
+ contentEndpoint: string;
13521
+ isSharedUrl: boolean;
13522
+ };
13523
+ /**
13524
+ * Format a file size in bytes to a human-readable string.
13525
+ */
13526
+ declare function formatFileSize(bytes: number): string;
13807
13527
 
13808
13528
  /**
13809
13529
  * Microsoft Graph - Create Draft Email Tool
@@ -13924,6 +13644,61 @@ interface FindMeetingSlotsArgs {
13924
13644
  */
13925
13645
  declare function createFindMeetingSlotsTool(connector: Connector, userId?: string): ToolFunction<FindMeetingSlotsArgs, MicrosoftFindSlotsResult>;
13926
13646
 
13647
+ /**
13648
+ * Microsoft Graph - Read File Tool
13649
+ *
13650
+ * Downloads a file from OneDrive or SharePoint and converts it to markdown
13651
+ * using DocumentReader. Never returns raw binary content.
13652
+ */
13653
+
13654
+ interface ReadFileArgs {
13655
+ source: string;
13656
+ driveId?: string;
13657
+ siteId?: string;
13658
+ targetUser?: string;
13659
+ }
13660
+ interface MicrosoftReadFileConfig {
13661
+ /** Default max file size in bytes (default: 50 MB). Applied when no per-extension limit matches. */
13662
+ maxFileSizeBytes?: number;
13663
+ /** Per-extension size limits in bytes, e.g. `{ '.pptx': 200 * 1024 * 1024 }`. Merged with built-in defaults. */
13664
+ fileSizeLimits?: Record<string, number>;
13665
+ }
13666
+ declare function createMicrosoftReadFileTool(connector: Connector, userId?: string, config?: MicrosoftReadFileConfig): ToolFunction<ReadFileArgs, MicrosoftReadFileResult>;
13667
+
13668
+ /**
13669
+ * Microsoft Graph - List Files Tool
13670
+ *
13671
+ * Lists files and folders in a OneDrive or SharePoint directory.
13672
+ * Returns metadata only — never file contents.
13673
+ */
13674
+
13675
+ interface ListFilesArgs {
13676
+ path?: string;
13677
+ driveId?: string;
13678
+ siteId?: string;
13679
+ search?: string;
13680
+ limit?: number;
13681
+ targetUser?: string;
13682
+ }
13683
+ declare function createMicrosoftListFilesTool(connector: Connector, userId?: string): ToolFunction<ListFilesArgs, MicrosoftListFilesResult>;
13684
+
13685
+ /**
13686
+ * Microsoft Graph - Search Files Tool
13687
+ *
13688
+ * Searches across OneDrive and SharePoint for files matching a query.
13689
+ * Uses the Microsoft Search API with KQL support.
13690
+ * Returns metadata and snippets only — never file contents.
13691
+ */
13692
+
13693
+ interface SearchFilesArgs {
13694
+ query: string;
13695
+ siteId?: string;
13696
+ fileTypes?: string[];
13697
+ limit?: number;
13698
+ targetUser?: string;
13699
+ }
13700
+ declare function createMicrosoftSearchFilesTool(connector: Connector, userId?: string): ToolFunction<SearchFilesArgs, MicrosoftSearchFilesResult>;
13701
+
13927
13702
  /**
13928
13703
  * Desktop Automation Tools - Types
13929
13704
  *
@@ -14302,13 +14077,13 @@ declare const desktopTools: (ToolFunction<DesktopScreenshotArgs, DesktopScreensh
14302
14077
  * AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
14303
14078
  *
14304
14079
  * Generated by: scripts/generate-tool-registry.ts
14305
- * Generated at: 2026-02-22T21:55:57.315Z
14080
+ * Generated at: 2026-02-26T21:46:20.180Z
14306
14081
  *
14307
14082
  * To regenerate: npm run generate:tools
14308
14083
  */
14309
14084
 
14310
14085
  /** Tool category for grouping */
14311
- type ToolCategory = 'filesystem' | 'shell' | 'web' | 'code' | 'json' | 'connector' | 'desktop' | 'custom-tools' | 'other';
14086
+ type ToolCategory = 'filesystem' | 'shell' | 'web' | 'code' | 'json' | 'connector' | 'desktop' | 'custom-tools' | 'routines' | 'other';
14312
14087
  /** Metadata for a tool in the registry */
14313
14088
  interface ToolRegistryEntry {
14314
14089
  /** Tool name (matches definition.function.name) */
@@ -14345,6 +14120,24 @@ declare function getToolsRequiringConnector(): ToolRegistryEntry[];
14345
14120
  /** Get all unique category names */
14346
14121
  declare function getToolCategories(): ToolCategory[];
14347
14122
 
14123
+ /**
14124
+ * generate_routine - Generates and persists a complete RoutineDefinition from LLM output.
14125
+ */
14126
+
14127
+ interface GenerateRoutineArgs {
14128
+ definition: RoutineDefinitionInput;
14129
+ }
14130
+ interface GenerateRoutineResult {
14131
+ success: boolean;
14132
+ id?: string;
14133
+ name?: string;
14134
+ storagePath?: string;
14135
+ error?: string;
14136
+ }
14137
+ declare function createGenerateRoutine(storage?: IRoutineDefinitionStorage): ToolFunction<GenerateRoutineArgs, GenerateRoutineResult>;
14138
+ /** Default generate_routine instance (resolves storage from StorageRegistry at execution time) */
14139
+ declare const generateRoutine: ToolFunction<GenerateRoutineArgs, GenerateRoutineResult>;
14140
+
14348
14141
  /**
14349
14142
  * custom_tool_draft - Validates a draft custom tool structure
14350
14143
  *
@@ -14667,7 +14460,7 @@ declare class ToolRegistry {
14667
14460
  * });
14668
14461
  * ```
14669
14462
  */
14670
- declare const developerTools: (ToolFunction<ReadFileArgs, ReadFileResult> | ToolFunction<WriteFileArgs, WriteFileResult> | ToolFunction<EditFileArgs, EditFileResult> | ToolFunction<GlobArgs, GlobResult> | ToolFunction<GrepArgs, GrepResult> | ToolFunction<ListDirectoryArgs, ListDirectoryResult> | ToolFunction<BashArgs, BashResult>)[];
14463
+ declare const developerTools: (ToolFunction<ReadFileArgs$1, ReadFileResult> | ToolFunction<WriteFileArgs, WriteFileResult> | ToolFunction<EditFileArgs, EditFileResult> | ToolFunction<GlobArgs, GlobResult> | ToolFunction<GrepArgs, GrepResult> | ToolFunction<ListDirectoryArgs, ListDirectoryResult> | ToolFunction<BashArgs, BashResult>)[];
14671
14464
 
14672
14465
  type index_BashResult = BashResult;
14673
14466
  type index_ConnectorToolEntry = ConnectorToolEntry;
@@ -14734,6 +14527,7 @@ type index_GitHubRepository = GitHubRepository;
14734
14527
  type index_GitHubSearchCodeResult = GitHubSearchCodeResult;
14735
14528
  type index_GitHubSearchFilesResult = GitHubSearchFilesResult;
14736
14529
  type index_GlobResult = GlobResult;
14530
+ type index_GraphDriveItem = GraphDriveItem;
14737
14531
  type index_GrepMatch = GrepMatch;
14738
14532
  type index_GrepResult = GrepResult;
14739
14533
  type index_HydrateOptions = HydrateOptions;
@@ -14747,6 +14541,9 @@ type index_MicrosoftDraftEmailResult = MicrosoftDraftEmailResult;
14747
14541
  type index_MicrosoftEditMeetingResult = MicrosoftEditMeetingResult;
14748
14542
  type index_MicrosoftFindSlotsResult = MicrosoftFindSlotsResult;
14749
14543
  type index_MicrosoftGetTranscriptResult = MicrosoftGetTranscriptResult;
14544
+ type index_MicrosoftListFilesResult = MicrosoftListFilesResult;
14545
+ type index_MicrosoftReadFileResult = MicrosoftReadFileResult;
14546
+ type index_MicrosoftSearchFilesResult = MicrosoftSearchFilesResult;
14750
14547
  type index_MicrosoftSendEmailResult = MicrosoftSendEmailResult;
14751
14548
  type index_MouseButton = MouseButton;
14752
14549
  type index_NutTreeDriver = NutTreeDriver;
@@ -14787,6 +14584,7 @@ declare const index_createEditFileTool: typeof createEditFileTool;
14787
14584
  declare const index_createEditMeetingTool: typeof createEditMeetingTool;
14788
14585
  declare const index_createExecuteJavaScriptTool: typeof createExecuteJavaScriptTool;
14789
14586
  declare const index_createFindMeetingSlotsTool: typeof createFindMeetingSlotsTool;
14587
+ declare const index_createGenerateRoutine: typeof createGenerateRoutine;
14790
14588
  declare const index_createGetMeetingTranscriptTool: typeof createGetMeetingTranscriptTool;
14791
14589
  declare const index_createGetPRTool: typeof createGetPRTool;
14792
14590
  declare const index_createGitHubReadFileTool: typeof createGitHubReadFileTool;
@@ -14795,6 +14593,9 @@ declare const index_createGrepTool: typeof createGrepTool;
14795
14593
  declare const index_createImageGenerationTool: typeof createImageGenerationTool;
14796
14594
  declare const index_createListDirectoryTool: typeof createListDirectoryTool;
14797
14595
  declare const index_createMeetingTool: typeof createMeetingTool;
14596
+ declare const index_createMicrosoftListFilesTool: typeof createMicrosoftListFilesTool;
14597
+ declare const index_createMicrosoftReadFileTool: typeof createMicrosoftReadFileTool;
14598
+ declare const index_createMicrosoftSearchFilesTool: typeof createMicrosoftSearchFilesTool;
14798
14599
  declare const index_createPRCommentsTool: typeof createPRCommentsTool;
14799
14600
  declare const index_createPRFilesTool: typeof createPRFilesTool;
14800
14601
  declare const index_createReadFileTool: typeof createReadFileTool;
@@ -14827,14 +14628,18 @@ declare const index_desktopWindowFocus: typeof desktopWindowFocus;
14827
14628
  declare const index_desktopWindowList: typeof desktopWindowList;
14828
14629
  declare const index_developerTools: typeof developerTools;
14829
14630
  declare const index_editFile: typeof editFile;
14631
+ declare const index_encodeSharingUrl: typeof encodeSharingUrl;
14830
14632
  declare const index_executeInVM: typeof executeInVM;
14831
14633
  declare const index_executeJavaScript: typeof executeJavaScript;
14832
14634
  declare const index_expandTilde: typeof expandTilde;
14833
14635
  declare const index_formatAttendees: typeof formatAttendees;
14636
+ declare const index_formatFileSize: typeof formatFileSize;
14834
14637
  declare const index_formatRecipients: typeof formatRecipients;
14638
+ declare const index_generateRoutine: typeof generateRoutine;
14835
14639
  declare const index_getAllBuiltInTools: typeof getAllBuiltInTools;
14836
14640
  declare const index_getBackgroundOutput: typeof getBackgroundOutput;
14837
14641
  declare const index_getDesktopDriver: typeof getDesktopDriver;
14642
+ declare const index_getDrivePrefix: typeof getDrivePrefix;
14838
14643
  declare const index_getMediaOutputHandler: typeof getMediaOutputHandler;
14839
14644
  declare const index_getMediaStorage: typeof getMediaStorage;
14840
14645
  declare const index_getToolByName: typeof getToolByName;
@@ -14848,7 +14653,9 @@ declare const index_grep: typeof grep;
14848
14653
  declare const index_hydrateCustomTool: typeof hydrateCustomTool;
14849
14654
  declare const index_isBlockedCommand: typeof isBlockedCommand;
14850
14655
  declare const index_isExcludedExtension: typeof isExcludedExtension;
14656
+ declare const index_isMicrosoftFileUrl: typeof isMicrosoftFileUrl;
14851
14657
  declare const index_isTeamsMeetingUrl: typeof isTeamsMeetingUrl;
14658
+ declare const index_isWebUrl: typeof isWebUrl;
14852
14659
  declare const index_jsonManipulator: typeof jsonManipulator;
14853
14660
  declare const index_killBackgroundProcess: typeof killBackgroundProcess;
14854
14661
  declare const index_listDirectory: typeof listDirectory;
@@ -14859,6 +14666,7 @@ declare const index_parseKeyCombo: typeof parseKeyCombo;
14859
14666
  declare const index_parseRepository: typeof parseRepository;
14860
14667
  declare const index_readFile: typeof readFile;
14861
14668
  declare const index_resetDefaultDriver: typeof resetDefaultDriver;
14669
+ declare const index_resolveFileEndpoints: typeof resolveFileEndpoints;
14862
14670
  declare const index_resolveMeetingId: typeof resolveMeetingId;
14863
14671
  declare const index_resolveRepository: typeof resolveRepository;
14864
14672
  declare const index_setMediaOutputHandler: typeof setMediaOutputHandler;
@@ -14868,7 +14676,7 @@ declare const index_validatePath: typeof validatePath;
14868
14676
  declare const index_webFetch: typeof webFetch;
14869
14677
  declare const index_writeFile: typeof writeFile;
14870
14678
  declare namespace index {
14871
- export { type index_BashResult as BashResult, type index_ConnectorToolEntry as ConnectorToolEntry, index_ConnectorTools as ConnectorTools, type index_CustomToolMetaToolsOptions as CustomToolMetaToolsOptions, index_DEFAULT_DESKTOP_CONFIG as DEFAULT_DESKTOP_CONFIG, index_DEFAULT_FILESYSTEM_CONFIG as DEFAULT_FILESYSTEM_CONFIG, index_DEFAULT_SHELL_CONFIG as DEFAULT_SHELL_CONFIG, index_DESKTOP_TOOL_NAMES as DESKTOP_TOOL_NAMES, type index_DesktopGetCursorResult as DesktopGetCursorResult, type index_DesktopGetScreenSizeResult as DesktopGetScreenSizeResult, type index_DesktopKeyboardKeyArgs as DesktopKeyboardKeyArgs, type index_DesktopKeyboardKeyResult as DesktopKeyboardKeyResult, type index_DesktopKeyboardTypeArgs as DesktopKeyboardTypeArgs, type index_DesktopKeyboardTypeResult as DesktopKeyboardTypeResult, type index_DesktopMouseClickArgs as DesktopMouseClickArgs, type index_DesktopMouseClickResult as DesktopMouseClickResult, type index_DesktopMouseDragArgs as DesktopMouseDragArgs, type index_DesktopMouseDragResult as DesktopMouseDragResult, type index_DesktopMouseMoveArgs as DesktopMouseMoveArgs, type index_DesktopMouseMoveResult as DesktopMouseMoveResult, type index_DesktopMouseScrollArgs as DesktopMouseScrollArgs, type index_DesktopMouseScrollResult as DesktopMouseScrollResult, type index_DesktopPoint as DesktopPoint, type index_DesktopScreenSize as DesktopScreenSize, type index_DesktopScreenshot as DesktopScreenshot, type index_DesktopScreenshotArgs as DesktopScreenshotArgs, type index_DesktopScreenshotResult as DesktopScreenshotResult, type index_DesktopToolConfig as DesktopToolConfig, type index_DesktopToolName as DesktopToolName, type index_DesktopWindow as DesktopWindow, type index_DesktopWindowFocusArgs as DesktopWindowFocusArgs, type index_DesktopWindowFocusResult as DesktopWindowFocusResult, type index_DesktopWindowListResult as DesktopWindowListResult, type index_DocumentFamily as DocumentFamily, type index_DocumentFormat as DocumentFormat, type index_DocumentImagePiece as DocumentImagePiece, type index_DocumentMetadata as DocumentMetadata, type index_DocumentPiece as DocumentPiece, type index_DocumentReadOptions as DocumentReadOptions, index_DocumentReader as DocumentReader, type index_DocumentReaderConfig as DocumentReaderConfig, type index_DocumentResult as DocumentResult, type index_DocumentSource as DocumentSource, type index_DocumentTextPiece as DocumentTextPiece, type index_DocumentToContentOptions as DocumentToContentOptions, type index_EditFileResult as EditFileResult, FileMediaStorage as FileMediaOutputHandler, type index_FilesystemToolConfig as FilesystemToolConfig, type index_FormatDetectionResult as FormatDetectionResult, index_FormatDetector as FormatDetector, type index_GenericAPICallArgs as GenericAPICallArgs, type index_GenericAPICallResult as GenericAPICallResult, type index_GenericAPIToolOptions as GenericAPIToolOptions, type index_GitHubCreatePRResult as GitHubCreatePRResult, type index_GitHubGetPRResult as GitHubGetPRResult, type index_GitHubPRCommentEntry as GitHubPRCommentEntry, type index_GitHubPRCommentsResult as GitHubPRCommentsResult, type index_GitHubPRFilesResult as GitHubPRFilesResult, type index_GitHubReadFileResult as GitHubReadFileResult, type index_GitHubRepository as GitHubRepository, type index_GitHubSearchCodeResult as GitHubSearchCodeResult, type index_GitHubSearchFilesResult as GitHubSearchFilesResult, type index_GlobResult as GlobResult, type index_GrepMatch as GrepMatch, type index_GrepResult as GrepResult, type index_HydrateOptions as HydrateOptions, type index_IDesktopDriver as IDesktopDriver, type index_IDocumentTransformer as IDocumentTransformer, type index_IFormatHandler as IFormatHandler, type IMediaStorage as IMediaOutputHandler, type index_ImageFilterOptions as ImageFilterOptions, type MediaStorageMetadata as MediaOutputMetadata, type MediaStorageResult as MediaOutputResult, type index_MeetingSlotSuggestion as MeetingSlotSuggestion, type index_MicrosoftCreateMeetingResult as MicrosoftCreateMeetingResult, type index_MicrosoftDraftEmailResult as MicrosoftDraftEmailResult, type index_MicrosoftEditMeetingResult as MicrosoftEditMeetingResult, type index_MicrosoftFindSlotsResult as MicrosoftFindSlotsResult, type index_MicrosoftGetTranscriptResult as MicrosoftGetTranscriptResult, type index_MicrosoftSendEmailResult as MicrosoftSendEmailResult, type index_MouseButton as MouseButton, index_NutTreeDriver as NutTreeDriver, type index_ReadFileResult as ReadFileResult, type index_SearchResult as SearchResult, type index_ServiceToolFactory as ServiceToolFactory, type index_ShellToolConfig as ShellToolConfig, type index_ToolCategory as ToolCategory, index_ToolRegistry as ToolRegistry, type index_ToolRegistryEntry as ToolRegistryEntry, type index_WriteFileResult as WriteFileResult, index_applyHumanDelay as applyHumanDelay, index_bash as bash, index_createBashTool as createBashTool, index_createCreatePRTool as createCreatePRTool, index_createCustomToolDelete as createCustomToolDelete, index_createCustomToolDraft as createCustomToolDraft, index_createCustomToolList as createCustomToolList, index_createCustomToolLoad as createCustomToolLoad, index_createCustomToolMetaTools as createCustomToolMetaTools, index_createCustomToolSave as createCustomToolSave, index_createCustomToolTest as createCustomToolTest, index_createDesktopGetCursorTool as createDesktopGetCursorTool, index_createDesktopGetScreenSizeTool as createDesktopGetScreenSizeTool, index_createDesktopKeyboardKeyTool as createDesktopKeyboardKeyTool, index_createDesktopKeyboardTypeTool as createDesktopKeyboardTypeTool, index_createDesktopMouseClickTool as createDesktopMouseClickTool, index_createDesktopMouseDragTool as createDesktopMouseDragTool, index_createDesktopMouseMoveTool as createDesktopMouseMoveTool, index_createDesktopMouseScrollTool as createDesktopMouseScrollTool, index_createDesktopScreenshotTool as createDesktopScreenshotTool, index_createDesktopWindowFocusTool as createDesktopWindowFocusTool, index_createDesktopWindowListTool as createDesktopWindowListTool, index_createDraftEmailTool as createDraftEmailTool, index_createEditFileTool as createEditFileTool, index_createEditMeetingTool as createEditMeetingTool, index_createExecuteJavaScriptTool as createExecuteJavaScriptTool, index_createFindMeetingSlotsTool as createFindMeetingSlotsTool, index_createGetMeetingTranscriptTool as createGetMeetingTranscriptTool, index_createGetPRTool as createGetPRTool, index_createGitHubReadFileTool as createGitHubReadFileTool, index_createGlobTool as createGlobTool, index_createGrepTool as createGrepTool, index_createImageGenerationTool as createImageGenerationTool, index_createListDirectoryTool as createListDirectoryTool, index_createMeetingTool as createMeetingTool, index_createPRCommentsTool as createPRCommentsTool, index_createPRFilesTool as createPRFilesTool, index_createReadFileTool as createReadFileTool, index_createSearchCodeTool as createSearchCodeTool, index_createSearchFilesTool as createSearchFilesTool, index_createSendEmailTool as createSendEmailTool, index_createSpeechToTextTool as createSpeechToTextTool, index_createTextToSpeechTool as createTextToSpeechTool, index_createVideoTools as createVideoTools, index_createWebScrapeTool as createWebScrapeTool, index_createWebSearchTool as createWebSearchTool, index_createWriteFileTool as createWriteFileTool, index_customToolDelete as customToolDelete, index_customToolDraft as customToolDraft, index_customToolList as customToolList, index_customToolLoad as customToolLoad, index_customToolSave as customToolSave, index_customToolTest as customToolTest, index_desktopGetCursor as desktopGetCursor, index_desktopGetScreenSize as desktopGetScreenSize, index_desktopKeyboardKey as desktopKeyboardKey, index_desktopKeyboardType as desktopKeyboardType, index_desktopMouseClick as desktopMouseClick, index_desktopMouseDrag as desktopMouseDrag, index_desktopMouseMove as desktopMouseMove, index_desktopMouseScroll as desktopMouseScroll, index_desktopScreenshot as desktopScreenshot, index_desktopTools as desktopTools, index_desktopWindowFocus as desktopWindowFocus, index_desktopWindowList as desktopWindowList, index_developerTools as developerTools, index_editFile as editFile, index_executeInVM as executeInVM, index_executeJavaScript as executeJavaScript, index_expandTilde as expandTilde, index_formatAttendees as formatAttendees, index_formatRecipients as formatRecipients, index_getAllBuiltInTools as getAllBuiltInTools, index_getBackgroundOutput as getBackgroundOutput, index_getDesktopDriver as getDesktopDriver, index_getMediaOutputHandler as getMediaOutputHandler, index_getMediaStorage as getMediaStorage, index_getToolByName as getToolByName, index_getToolCategories as getToolCategories, index_getToolRegistry as getToolRegistry, index_getToolsByCategory as getToolsByCategory, index_getToolsRequiringConnector as getToolsRequiringConnector, index_getUserPathPrefix as getUserPathPrefix, index_glob as glob, index_grep as grep, index_hydrateCustomTool as hydrateCustomTool, index_isBlockedCommand as isBlockedCommand, index_isExcludedExtension as isExcludedExtension, index_isTeamsMeetingUrl as isTeamsMeetingUrl, index_jsonManipulator as jsonManipulator, index_killBackgroundProcess as killBackgroundProcess, index_listDirectory as listDirectory, index_mergeTextPieces as mergeTextPieces, index_microsoftFetch as microsoftFetch, index_normalizeEmails as normalizeEmails, index_parseKeyCombo as parseKeyCombo, index_parseRepository as parseRepository, index_readFile as readFile, index_resetDefaultDriver as resetDefaultDriver, index_resolveMeetingId as resolveMeetingId, index_resolveRepository as resolveRepository, index_setMediaOutputHandler as setMediaOutputHandler, index_setMediaStorage as setMediaStorage, index_toolRegistry as toolRegistry, index_validatePath as validatePath, index_webFetch as webFetch, index_writeFile as writeFile };
14679
+ export { type index_BashResult as BashResult, type index_ConnectorToolEntry as ConnectorToolEntry, index_ConnectorTools as ConnectorTools, type index_CustomToolMetaToolsOptions as CustomToolMetaToolsOptions, index_DEFAULT_DESKTOP_CONFIG as DEFAULT_DESKTOP_CONFIG, index_DEFAULT_FILESYSTEM_CONFIG as DEFAULT_FILESYSTEM_CONFIG, index_DEFAULT_SHELL_CONFIG as DEFAULT_SHELL_CONFIG, index_DESKTOP_TOOL_NAMES as DESKTOP_TOOL_NAMES, type index_DesktopGetCursorResult as DesktopGetCursorResult, type index_DesktopGetScreenSizeResult as DesktopGetScreenSizeResult, type index_DesktopKeyboardKeyArgs as DesktopKeyboardKeyArgs, type index_DesktopKeyboardKeyResult as DesktopKeyboardKeyResult, type index_DesktopKeyboardTypeArgs as DesktopKeyboardTypeArgs, type index_DesktopKeyboardTypeResult as DesktopKeyboardTypeResult, type index_DesktopMouseClickArgs as DesktopMouseClickArgs, type index_DesktopMouseClickResult as DesktopMouseClickResult, type index_DesktopMouseDragArgs as DesktopMouseDragArgs, type index_DesktopMouseDragResult as DesktopMouseDragResult, type index_DesktopMouseMoveArgs as DesktopMouseMoveArgs, type index_DesktopMouseMoveResult as DesktopMouseMoveResult, type index_DesktopMouseScrollArgs as DesktopMouseScrollArgs, type index_DesktopMouseScrollResult as DesktopMouseScrollResult, type index_DesktopPoint as DesktopPoint, type index_DesktopScreenSize as DesktopScreenSize, type index_DesktopScreenshot as DesktopScreenshot, type index_DesktopScreenshotArgs as DesktopScreenshotArgs, type index_DesktopScreenshotResult as DesktopScreenshotResult, type index_DesktopToolConfig as DesktopToolConfig, type index_DesktopToolName as DesktopToolName, type index_DesktopWindow as DesktopWindow, type index_DesktopWindowFocusArgs as DesktopWindowFocusArgs, type index_DesktopWindowFocusResult as DesktopWindowFocusResult, type index_DesktopWindowListResult as DesktopWindowListResult, type index_DocumentFamily as DocumentFamily, type index_DocumentFormat as DocumentFormat, type index_DocumentImagePiece as DocumentImagePiece, type index_DocumentMetadata as DocumentMetadata, type index_DocumentPiece as DocumentPiece, type index_DocumentReadOptions as DocumentReadOptions, index_DocumentReader as DocumentReader, type index_DocumentReaderConfig as DocumentReaderConfig, type index_DocumentResult as DocumentResult, type index_DocumentSource as DocumentSource, type index_DocumentTextPiece as DocumentTextPiece, type index_DocumentToContentOptions as DocumentToContentOptions, type index_EditFileResult as EditFileResult, FileMediaStorage as FileMediaOutputHandler, type index_FilesystemToolConfig as FilesystemToolConfig, type index_FormatDetectionResult as FormatDetectionResult, index_FormatDetector as FormatDetector, type index_GenericAPICallArgs as GenericAPICallArgs, type index_GenericAPICallResult as GenericAPICallResult, type index_GenericAPIToolOptions as GenericAPIToolOptions, type index_GitHubCreatePRResult as GitHubCreatePRResult, type index_GitHubGetPRResult as GitHubGetPRResult, type index_GitHubPRCommentEntry as GitHubPRCommentEntry, type index_GitHubPRCommentsResult as GitHubPRCommentsResult, type index_GitHubPRFilesResult as GitHubPRFilesResult, type index_GitHubReadFileResult as GitHubReadFileResult, type index_GitHubRepository as GitHubRepository, type index_GitHubSearchCodeResult as GitHubSearchCodeResult, type index_GitHubSearchFilesResult as GitHubSearchFilesResult, type index_GlobResult as GlobResult, type index_GraphDriveItem as GraphDriveItem, type index_GrepMatch as GrepMatch, type index_GrepResult as GrepResult, type index_HydrateOptions as HydrateOptions, type index_IDesktopDriver as IDesktopDriver, type index_IDocumentTransformer as IDocumentTransformer, type index_IFormatHandler as IFormatHandler, type IMediaStorage as IMediaOutputHandler, type index_ImageFilterOptions as ImageFilterOptions, type MediaStorageMetadata as MediaOutputMetadata, type MediaStorageResult as MediaOutputResult, type index_MeetingSlotSuggestion as MeetingSlotSuggestion, type index_MicrosoftCreateMeetingResult as MicrosoftCreateMeetingResult, type index_MicrosoftDraftEmailResult as MicrosoftDraftEmailResult, type index_MicrosoftEditMeetingResult as MicrosoftEditMeetingResult, type index_MicrosoftFindSlotsResult as MicrosoftFindSlotsResult, type index_MicrosoftGetTranscriptResult as MicrosoftGetTranscriptResult, type index_MicrosoftListFilesResult as MicrosoftListFilesResult, type index_MicrosoftReadFileResult as MicrosoftReadFileResult, type index_MicrosoftSearchFilesResult as MicrosoftSearchFilesResult, type index_MicrosoftSendEmailResult as MicrosoftSendEmailResult, type index_MouseButton as MouseButton, index_NutTreeDriver as NutTreeDriver, type index_ReadFileResult as ReadFileResult, type index_SearchResult as SearchResult, type index_ServiceToolFactory as ServiceToolFactory, type index_ShellToolConfig as ShellToolConfig, type index_ToolCategory as ToolCategory, index_ToolRegistry as ToolRegistry, type index_ToolRegistryEntry as ToolRegistryEntry, type index_WriteFileResult as WriteFileResult, index_applyHumanDelay as applyHumanDelay, index_bash as bash, index_createBashTool as createBashTool, index_createCreatePRTool as createCreatePRTool, index_createCustomToolDelete as createCustomToolDelete, index_createCustomToolDraft as createCustomToolDraft, index_createCustomToolList as createCustomToolList, index_createCustomToolLoad as createCustomToolLoad, index_createCustomToolMetaTools as createCustomToolMetaTools, index_createCustomToolSave as createCustomToolSave, index_createCustomToolTest as createCustomToolTest, index_createDesktopGetCursorTool as createDesktopGetCursorTool, index_createDesktopGetScreenSizeTool as createDesktopGetScreenSizeTool, index_createDesktopKeyboardKeyTool as createDesktopKeyboardKeyTool, index_createDesktopKeyboardTypeTool as createDesktopKeyboardTypeTool, index_createDesktopMouseClickTool as createDesktopMouseClickTool, index_createDesktopMouseDragTool as createDesktopMouseDragTool, index_createDesktopMouseMoveTool as createDesktopMouseMoveTool, index_createDesktopMouseScrollTool as createDesktopMouseScrollTool, index_createDesktopScreenshotTool as createDesktopScreenshotTool, index_createDesktopWindowFocusTool as createDesktopWindowFocusTool, index_createDesktopWindowListTool as createDesktopWindowListTool, index_createDraftEmailTool as createDraftEmailTool, index_createEditFileTool as createEditFileTool, index_createEditMeetingTool as createEditMeetingTool, index_createExecuteJavaScriptTool as createExecuteJavaScriptTool, index_createFindMeetingSlotsTool as createFindMeetingSlotsTool, index_createGenerateRoutine as createGenerateRoutine, index_createGetMeetingTranscriptTool as createGetMeetingTranscriptTool, index_createGetPRTool as createGetPRTool, index_createGitHubReadFileTool as createGitHubReadFileTool, index_createGlobTool as createGlobTool, index_createGrepTool as createGrepTool, index_createImageGenerationTool as createImageGenerationTool, index_createListDirectoryTool as createListDirectoryTool, index_createMeetingTool as createMeetingTool, index_createMicrosoftListFilesTool as createMicrosoftListFilesTool, index_createMicrosoftReadFileTool as createMicrosoftReadFileTool, index_createMicrosoftSearchFilesTool as createMicrosoftSearchFilesTool, index_createPRCommentsTool as createPRCommentsTool, index_createPRFilesTool as createPRFilesTool, index_createReadFileTool as createReadFileTool, index_createSearchCodeTool as createSearchCodeTool, index_createSearchFilesTool as createSearchFilesTool, index_createSendEmailTool as createSendEmailTool, index_createSpeechToTextTool as createSpeechToTextTool, index_createTextToSpeechTool as createTextToSpeechTool, index_createVideoTools as createVideoTools, index_createWebScrapeTool as createWebScrapeTool, index_createWebSearchTool as createWebSearchTool, index_createWriteFileTool as createWriteFileTool, index_customToolDelete as customToolDelete, index_customToolDraft as customToolDraft, index_customToolList as customToolList, index_customToolLoad as customToolLoad, index_customToolSave as customToolSave, index_customToolTest as customToolTest, index_desktopGetCursor as desktopGetCursor, index_desktopGetScreenSize as desktopGetScreenSize, index_desktopKeyboardKey as desktopKeyboardKey, index_desktopKeyboardType as desktopKeyboardType, index_desktopMouseClick as desktopMouseClick, index_desktopMouseDrag as desktopMouseDrag, index_desktopMouseMove as desktopMouseMove, index_desktopMouseScroll as desktopMouseScroll, index_desktopScreenshot as desktopScreenshot, index_desktopTools as desktopTools, index_desktopWindowFocus as desktopWindowFocus, index_desktopWindowList as desktopWindowList, index_developerTools as developerTools, index_editFile as editFile, index_encodeSharingUrl as encodeSharingUrl, index_executeInVM as executeInVM, index_executeJavaScript as executeJavaScript, index_expandTilde as expandTilde, index_formatAttendees as formatAttendees, index_formatFileSize as formatFileSize, index_formatRecipients as formatRecipients, index_generateRoutine as generateRoutine, index_getAllBuiltInTools as getAllBuiltInTools, index_getBackgroundOutput as getBackgroundOutput, index_getDesktopDriver as getDesktopDriver, index_getDrivePrefix as getDrivePrefix, index_getMediaOutputHandler as getMediaOutputHandler, index_getMediaStorage as getMediaStorage, index_getToolByName as getToolByName, index_getToolCategories as getToolCategories, index_getToolRegistry as getToolRegistry, index_getToolsByCategory as getToolsByCategory, index_getToolsRequiringConnector as getToolsRequiringConnector, index_getUserPathPrefix as getUserPathPrefix, index_glob as glob, index_grep as grep, index_hydrateCustomTool as hydrateCustomTool, index_isBlockedCommand as isBlockedCommand, index_isExcludedExtension as isExcludedExtension, index_isMicrosoftFileUrl as isMicrosoftFileUrl, index_isTeamsMeetingUrl as isTeamsMeetingUrl, index_isWebUrl as isWebUrl, index_jsonManipulator as jsonManipulator, index_killBackgroundProcess as killBackgroundProcess, index_listDirectory as listDirectory, index_mergeTextPieces as mergeTextPieces, index_microsoftFetch as microsoftFetch, index_normalizeEmails as normalizeEmails, index_parseKeyCombo as parseKeyCombo, index_parseRepository as parseRepository, index_readFile as readFile, index_resetDefaultDriver as resetDefaultDriver, index_resolveFileEndpoints as resolveFileEndpoints, index_resolveMeetingId as resolveMeetingId, index_resolveRepository as resolveRepository, index_setMediaOutputHandler as setMediaOutputHandler, index_setMediaStorage as setMediaStorage, index_toolRegistry as toolRegistry, index_validatePath as validatePath, index_webFetch as webFetch, index_writeFile as writeFile };
14872
14680
  }
14873
14681
 
14874
14682
  /**
@@ -14923,4 +14731,76 @@ declare class ProviderConfigAgent {
14923
14731
  reset(): void;
14924
14732
  }
14925
14733
 
14926
- export { AGENT_DEFINITION_FORMAT_VERSION, AIError, APPROVAL_STATE_VERSION, Agent, type AgentConfig$1 as AgentConfig, AgentContextNextGen, type AgentContextNextGenConfig, type AgentDefinitionListOptions, type AgentDefinitionMetadata, type AgentDefinitionSummary, AgentEvents, type AgentMetrics, type AgentPermissionsConfig, AgentResponse, type AgentSessionConfig, type AgentState, type AgentStatus, type ApprovalCacheEntry, type ApprovalDecision, ApproximateTokenEstimator, AudioFormat, AuditEntry, type AuthTemplate, type AuthTemplateField, type BackoffConfig, type BackoffStrategyType, BaseMediaProvider, BasePluginNextGen, BaseProvider, type BaseProviderConfig$1 as BaseProviderConfig, type BaseProviderResponse, BaseTextProvider, type BashResult, type BeforeExecuteResult, BraveProvider, CONNECTOR_CONFIG_VERSION, CONTEXT_SESSION_FORMAT_VERSION, CUSTOM_TOOL_DEFINITION_VERSION, CheckpointManager, type CheckpointStrategy, CircuitBreaker, type CircuitBreakerConfig, type CircuitBreakerEvents, type CircuitBreakerMetrics, CircuitOpenError, type CircuitState, type ClipboardImageResult, type CompactionContext, type CompactionResult, Connector, ConnectorAccessContext, ConnectorAuth, ConnectorConfig, ConnectorConfigResult, ConnectorConfigStore, ConnectorFetchOptions, type ConnectorToolEntry, ConnectorTools, type ConnectorToolsOptions, ConsoleMetrics, type ConsolidationResult, Content, type ContextBudget$1 as ContextBudget, type ContextEvents, type ContextFeatures, type ContextManagerConfig, type ContextOverflowBudget, ContextOverflowError, type ContextSessionMetadata, type ContextSessionSummary, type ContextStorageListOptions, type ConversationMessage, type CreateConnectorOptions, type CustomToolDefinition, type CustomToolListOptions, type CustomToolMetaToolsOptions, type CustomToolMetadata, type CustomToolSummary, type CustomToolTestCase, DEFAULT_ALLOWLIST, DEFAULT_BACKOFF_CONFIG, DEFAULT_CHECKPOINT_STRATEGY, DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_CONFIG, DEFAULT_CONTEXT_CONFIG, DEFAULT_DESKTOP_CONFIG, DEFAULT_FEATURES, DEFAULT_FILESYSTEM_CONFIG, DEFAULT_HISTORY_MANAGER_CONFIG, DEFAULT_PERMISSION_CONFIG, DEFAULT_RATE_LIMITER_CONFIG, DEFAULT_SHELL_CONFIG, DESKTOP_TOOL_NAMES, type DefaultAllowlistedTool, DefaultCompactionStrategy, type DefaultCompactionStrategyConfig, DependencyCycleError, type DesktopGetCursorResult, type DesktopGetScreenSizeResult, type DesktopKeyboardKeyArgs, type DesktopKeyboardKeyResult, type DesktopKeyboardTypeArgs, type DesktopKeyboardTypeResult, type DesktopMouseClickArgs, type DesktopMouseClickResult, type DesktopMouseDragArgs, type DesktopMouseDragResult, type DesktopMouseMoveArgs, type DesktopMouseMoveResult, type DesktopMouseScrollArgs, type DesktopMouseScrollResult, type DesktopPoint, type DesktopScreenSize, type DesktopScreenshot, type DesktopScreenshotArgs, type DesktopScreenshotResult, type DesktopToolConfig, type DesktopToolName, type DesktopWindow, type DesktopWindowFocusArgs, type DesktopWindowFocusResult, type DesktopWindowListResult, type DirectCallOptions, type DocumentFamily, type DocumentFormat, type DocumentImagePiece, type DocumentMetadata, type DocumentPiece, type DocumentReadOptions, DocumentReader, type DocumentReaderConfig, type DocumentResult, type DocumentSource, type DocumentTextPiece, type DocumentToContentOptions, type EditFileResult, type ErrorContext, ErrorHandler, type ErrorHandlerConfig, type ErrorHandlerEvents, type EvictionStrategy, type ExecuteRoutineOptions, ExecutionContext, ExecutionMetrics, type ExtendedFetchOptions, type ExternalDependency, type ExternalDependencyEvents, ExternalDependencyHandler, type FetchedContent, FileAgentDefinitionStorage, type FileAgentDefinitionStorageConfig, FileConnectorStorage, type FileConnectorStorageConfig, FileContextStorage, type FileContextStorageConfig, FileCustomToolStorage, type FileCustomToolStorageConfig, FileMediaStorage as FileMediaOutputHandler, FileMediaStorage, type FileMediaStorageConfig, FilePersistentInstructionsStorage, type FilePersistentInstructionsStorageConfig, FileRoutineDefinitionStorage, type FileRoutineDefinitionStorageConfig, FileStorage, type FileStorageConfig, FileUserInfoStorage, type FileUserInfoStorageConfig, type FilesystemToolConfig, type FormatDetectionResult, FormatDetector, FrameworkLogger, FunctionToolDefinition, type GeneratedPlan, type GenericAPICallArgs, type GenericAPICallResult, type GenericAPIToolOptions, type GitHubCreatePRResult, type GitHubGetPRResult, type GitHubPRCommentEntry, type GitHubPRCommentsResult, type GitHubPRFilesResult, type GitHubReadFileResult, type GitHubRepository, type GitHubSearchCodeResult, type GitHubSearchFilesResult, type GlobResult, type GrepMatch, type GrepResult, type HTTPTransportConfig, type HistoryManagerEvents, type HistoryMessage, HistoryMode, HookConfig, HookName, type HydrateOptions, type IAgentDefinitionStorage, type IAgentStateStorage, type IAgentStorage, type IAsyncDisposable, IBaseModelDescription, type ICapabilityProvider, type ICompactionStrategy, IConnectorAccessPolicy, type IConnectorConfigStorage, IConnectorRegistry, type IContextCompactor, type IContextComponent, type IContextPluginNextGen, type IContextSnapshot, type IContextStorage, type IContextStrategy, type ICustomToolStorage, type IDesktopDriver, type IDisposable, type IDocumentTransformer, type IFormatHandler, type IHistoryManager, type IHistoryManagerConfig, type IHistoryStorage, IImageProvider, type IMCPClient, type IMediaStorage as IMediaOutputHandler, type IMediaStorage, type IMemoryStorage, type IPersistentInstructionsStorage, type IPlanStorage, type IPluginSnapshot, IProvider, type IResearchSource, type IRoutineDefinitionStorage, type ISTTModelDescription, type IScrapeProvider, type ISearchProvider, type ISpeechToTextProvider, type ITTSModelDescription, ITextProvider, type ITextToSpeechProvider, type ITokenEstimator$1 as ITokenEstimator, ITokenStorage, type IToolExecutionPipeline, type IToolExecutionPlugin, type IToolExecutor, type IToolSnapshot, type IUserInfoStorage, type IVideoModelDescription, type IVideoProvider, type IViewContextComponent, type IViewContextData, type IVoiceInfo, type ImageFilterOptions, type InContextEntry, type InContextMemoryConfig, InContextMemoryPluginNextGen, type InContextPriority, InMemoryAgentStateStorage, InMemoryHistoryStorage, InMemoryMetrics, InMemoryPlanStorage, InMemoryStorage, InputItem, type InstructionEntry, InvalidConfigError, InvalidToolArgumentsError, type JSONExtractionResult, LLMResponse, type LogEntry, type LogLevel, type LoggerConfig, LoggingPlugin, type LoggingPluginOptions, MCPClient, type MCPClientConnectionState, type MCPClientState, type MCPConfiguration, MCPConnectionError, MCPError, type MCPPrompt, type MCPPromptResult, MCPProtocolError, MCPRegistry, type MCPResource, type MCPResourceContent, MCPResourceError, type MCPServerCapabilities, type MCPServerConfig, MCPTimeoutError, type MCPTool, MCPToolError, type MCPToolResult, type MCPTransportType, type MediaStorageMetadata as MediaOutputMetadata, type MediaStorageResult as MediaOutputResult, type MediaStorageEntry, type MediaStorageListOptions, type MediaStorageMetadata, type MediaStorageResult, type MeetingSlotSuggestion, MemoryConnectorStorage, MemoryEntry, MemoryEvictionCompactor, MemoryIndex, MemoryPriority, MemoryScope, MemoryStorage, MessageBuilder, MessageRole, type MetricTags, type MetricsCollector, type MetricsCollectorType, type MicrosoftCreateMeetingResult, type MicrosoftDraftEmailResult, type MicrosoftEditMeetingResult, type MicrosoftFindSlotsResult, type MicrosoftGetTranscriptResult, type MicrosoftSendEmailResult, ModelCapabilities, ModelNotSupportedError, type MouseButton, type EvictionStrategy$1 as NextGenEvictionStrategy, NoOpMetrics, NutTreeDriver, type OAuthConfig, type OAuthFlow, OAuthManager, OutputItem, type OversizedInputResult, ParallelTasksError, type PermissionCheckContext, type PermissionCheckResult, type PermissionManagerEvent, type PermissionScope, type PersistentInstructionsConfig, PersistentInstructionsPluginNextGen, type PieceMetadata, type Plan, type PlanConcurrency, type PlanInput, type PlanStatus, PlanningAgent, type PlanningAgentConfig, type PluginConfigs, type PluginExecutionContext, type PreparedContext, ProviderAuthError, ProviderCapabilities, ProviderConfigAgent, ProviderContextLengthError, ProviderError, ProviderErrorMapper, ProviderNotFoundError, ProviderRateLimitError, RapidAPIProvider, RateLimitError, type RateLimiterConfig, type RateLimiterMetrics, type ReadFileResult, type FetchOptions as ResearchFetchOptions, type ResearchFinding, type ResearchPlan, type ResearchProgress, type ResearchQuery, type ResearchResult, type SearchOptions as ResearchSearchOptions, type SearchResponse as ResearchSearchResponse, type RiskLevel, type RoutineDefinition, type RoutineDefinitionInput, type RoutineExecution, type RoutineExecutionStatus, SIMPLE_ICONS_CDN, type STTModelCapabilities, type STTOptions, type STTOutputFormat$1 as STTOutputFormat, type STTResponse, STT_MODELS, STT_MODEL_REGISTRY, ScopedConnectorRegistry, type ScrapeFeature, type ScrapeOptions, ScrapeProvider, type ScrapeProviderConfig, type ScrapeProviderFallbackConfig, type ScrapeResponse, type ScrapeResult, type SearchOptions$1 as SearchOptions, SearchProvider, type SearchProviderConfig, type SearchResponse$1 as SearchResponse, type SearchResult, type SegmentTimestamp, type SerializedApprovalEntry, type SerializedApprovalState, type SerializedContextState, type SerializedHistoryState, type SerializedInContextMemoryState, type SerializedPersistentInstructionsState, type SerializedToolState, type SerializedUserInfoState, type SerializedWorkingMemoryState, SerperProvider, ServiceCategory, type ServiceToolFactory, type ShellToolConfig, type SimpleIcon, type SimpleVideoGenerateOptions, type SourceCapabilities, type SourceResult, SpeechToText, type SpeechToTextConfig, type StdioTransportConfig, type StorageConfig, type StorageContext, StorageRegistry, type StoredAgentDefinition, type StoredAgentType, type StoredConnectorConfig, type StoredContextSession, type StoredToken, type StrategyInfo, StrategyRegistry, type StrategyRegistryEntry, StreamEvent, StreamEventType, StreamHelpers, StreamState, SummarizeCompactor, TERMINAL_TASK_STATUSES, type TTSModelCapabilities, type TTSOptions, type TTSResponse, TTS_MODELS, TTS_MODEL_REGISTRY, type Task, type AgentConfig as TaskAgentStateConfig, type TaskCondition, type TaskExecution, type TaskFailure, type TaskInput, type TaskStatus, TaskStatusForMemory, TaskTimeoutError, ToolContext as TaskToolContext, type TaskValidation, TaskValidationError, type TaskValidationResult, TavilyProvider, type TemplateCredentials, TextGenerateOptions, TextToSpeech, type TextToSpeechConfig, TokenBucketRateLimiter, type TokenContentType, Tool, ToolCall, type ToolCategory, type ToolCondition, ToolContext, ToolExecutionError, ToolExecutionPipeline, type ToolExecutionPipelineOptions, ToolFunction, ToolManager, type ToolManagerConfig, type ToolManagerEvent, type ToolManagerStats, type ToolMetadata, ToolNotFoundError, type ToolOptions, type ToolPermissionConfig, ToolPermissionManager, type ToolRegistration, ToolRegistry, type ToolRegistryEntry, ToolResult, type ToolSelectionContext, type ToolSource, ToolTimeoutError, type TransportConfig, TruncateCompactor, type UserInfoEntry, type UserInfoPluginConfig, UserInfoPluginNextGen, VENDOR_ICON_MAP, VIDEO_MODELS, VIDEO_MODEL_REGISTRY, type ValidationContext, Vendor, type VendorInfo, type VendorLogo, VendorOptionSchema, type VendorRegistryEntry, type VendorTemplate, type VideoExtendOptions, type VideoGenerateOptions, VideoGeneration, type VideoGenerationCreateOptions, type VideoJob, type VideoModelCapabilities, type VideoModelPricing, type VideoResponse, type VideoStatus, type WordTimestamp, WorkingMemory, WorkingMemoryAccess, WorkingMemoryConfig, type WorkingMemoryEvents, type WorkingMemoryPluginConfig, WorkingMemoryPluginNextGen, type WriteFileResult, addJitter, allVendorTemplates, assertNotDestroyed, authenticatedFetch, backoffSequence, backoffWait, bash, buildAuthConfig, buildEndpointWithQuery, buildQueryString, calculateBackoff, calculateSTTCost, calculateTTSCost, calculateVideoCost, canTaskExecute, createAgentStorage, createAuthenticatedFetch, createBashTool, createConnectorFromTemplate, createCreatePRTool, createCustomToolDelete, createCustomToolDraft, createCustomToolList, createCustomToolLoad, createCustomToolMetaTools, createCustomToolSave, createCustomToolTest, createDesktopGetCursorTool, createDesktopGetScreenSizeTool, createDesktopKeyboardKeyTool, createDesktopKeyboardTypeTool, createDesktopMouseClickTool, createDesktopMouseDragTool, createDesktopMouseMoveTool, createDesktopMouseScrollTool, createDesktopScreenshotTool, createDesktopWindowFocusTool, createDesktopWindowListTool, createDraftEmailTool, createEditFileTool, createEditMeetingTool, createEstimator, createExecuteJavaScriptTool, createFileAgentDefinitionStorage, createFileContextStorage, createFileCustomToolStorage, createFileMediaStorage, createFileRoutineDefinitionStorage, createFindMeetingSlotsTool, createGetMeetingTranscriptTool, createGetPRTool, createGitHubReadFileTool, createGlobTool, createGrepTool, createImageGenerationTool, createImageProvider, createListDirectoryTool, createMeetingTool, createMessageWithImages, createMetricsCollector, createPRCommentsTool, createPRFilesTool, createPlan, createProvider, createReadFileTool, createRoutineDefinition, createRoutineExecution, createSearchCodeTool, createSearchFilesTool, createSendEmailTool, createSpeechToTextTool, createTask, createTextMessage, createTextToSpeechTool, createVideoProvider, createVideoTools, createWriteFileTool, customToolDelete, customToolDraft, customToolList, customToolLoad, customToolSave, customToolTest, desktopGetCursor, desktopGetScreenSize, desktopKeyboardKey, desktopKeyboardType, desktopMouseClick, desktopMouseDrag, desktopMouseMove, desktopMouseScroll, desktopScreenshot, desktopTools, desktopWindowFocus, desktopWindowList, detectDependencyCycle, developerTools, documentToContent, editFile, evaluateCondition, executeRoutine, extractJSON, extractJSONField, extractNumber, findConnectorByServiceTypes, formatAttendees, formatPluginDisplayName, formatRecipients, generateEncryptionKey, generateSimplePlan, generateWebAPITool, getActiveSTTModels, getActiveTTSModels, getActiveVideoModels, getAllBuiltInTools, getAllVendorLogos, getAllVendorTemplates, getBackgroundOutput, getConnectorTools, getCredentialsSetupURL, getDesktopDriver, getDocsURL, getMediaOutputHandler, getMediaStorage, getNextExecutableTasks, getRegisteredScrapeProviders, getRoutineProgress, getSTTModelInfo, getSTTModelsByVendor, getSTTModelsWithFeature, getTTSModelInfo, getTTSModelsByVendor, getTTSModelsWithFeature, getTaskDependencies, getToolByName, getToolCategories, getToolRegistry, getToolsByCategory, getToolsRequiringConnector, getUserPathPrefix, getVendorAuthTemplate, getVendorColor, getVendorDefaultBaseURL, getVendorInfo, getVendorLogo, getVendorLogoCdnUrl, getVendorLogoSvg, getVendorTemplate, getVideoModelInfo, getVideoModelsByVendor, getVideoModelsWithAudio, getVideoModelsWithFeature, glob, globalErrorHandler, grep, hasClipboardImage, hasVendorLogo, hydrateCustomTool, isBlockedCommand, isExcludedExtension, isTaskBlocked, isTeamsMeetingUrl, isTerminalStatus, killBackgroundProcess, listConnectorsByServiceTypes, listDirectory, listVendorIds, listVendors, listVendorsByAuthType, listVendorsByCategory, listVendorsWithLogos, logger, mergeTextPieces, metrics, microsoftFetch, normalizeEmails, parseKeyCombo, parseRepository, readClipboardImage, readDocumentAsContent, readFile, registerScrapeProvider, resetDefaultDriver, resolveConnector, resolveDependencies, resolveMaxContextTokens, resolveMeetingId, resolveModelCapabilities, resolveRepository, retryWithBackoff, sanitizeToolName, setMediaOutputHandler, setMediaStorage, setMetricsCollector, simpleTokenEstimator, toConnectorOptions, toolRegistry, index as tools, updateTaskStatus, validatePath, writeFile };
14734
+ /**
14735
+ * Scheduler interface for running routines on a timer.
14736
+ *
14737
+ * Supports interval, one-time (timestamp), and cron schedules.
14738
+ * Implementations may support all or a subset of schedule types.
14739
+ */
14740
+
14741
+ interface ScheduleHandle {
14742
+ id: string;
14743
+ cancel(): void;
14744
+ }
14745
+ interface ScheduleSpec {
14746
+ /** Cron expression (e.g. '0 9 * * 1-5'). Not all implementations support this. */
14747
+ cron?: string;
14748
+ /** Repeat every N milliseconds. */
14749
+ intervalMs?: number;
14750
+ /** Fire once at this Unix timestamp (ms). */
14751
+ once?: number;
14752
+ /** IANA timezone for cron expressions (e.g. 'America/New_York'). */
14753
+ timezone?: string;
14754
+ }
14755
+ interface IScheduler extends IDisposable {
14756
+ /** Schedule a callback. Returns a handle to cancel it. */
14757
+ schedule(id: string, spec: ScheduleSpec, callback: () => void | Promise<void>): ScheduleHandle;
14758
+ /** Cancel a scheduled callback by ID. */
14759
+ cancel(id: string): void;
14760
+ /** Cancel all scheduled callbacks. */
14761
+ cancelAll(): void;
14762
+ /** Check if a schedule exists by ID. */
14763
+ has(id: string): boolean;
14764
+ }
14765
+
14766
+ /**
14767
+ * SimpleScheduler — built-in scheduler using setInterval / setTimeout.
14768
+ *
14769
+ * Supports `intervalMs` and `once` schedule types.
14770
+ * Throws for `cron` — use a cron-capable implementation instead.
14771
+ */
14772
+
14773
+ declare class SimpleScheduler implements IScheduler {
14774
+ private timers;
14775
+ private _isDestroyed;
14776
+ schedule(id: string, spec: ScheduleSpec, callback: () => void | Promise<void>): ScheduleHandle;
14777
+ cancel(id: string): void;
14778
+ cancelAll(): void;
14779
+ has(id: string): boolean;
14780
+ destroy(): void;
14781
+ get isDestroyed(): boolean;
14782
+ }
14783
+
14784
+ /**
14785
+ * EventEmitterTrigger — simple typed event emitter for routine triggers.
14786
+ *
14787
+ * Consumers call `emit()` from their webhook/queue/signal handlers
14788
+ * to trigger routine execution.
14789
+ */
14790
+
14791
+ declare class EventEmitterTrigger implements IDisposable {
14792
+ private listeners;
14793
+ private _isDestroyed;
14794
+ /**
14795
+ * Register a listener for an event. Returns an unsubscribe function.
14796
+ */
14797
+ on(event: string, callback: (payload: unknown) => void | Promise<void>): () => void;
14798
+ /**
14799
+ * Emit an event to all registered listeners.
14800
+ */
14801
+ emit(event: string, payload?: unknown): void;
14802
+ destroy(): void;
14803
+ get isDestroyed(): boolean;
14804
+ }
14805
+
14806
+ export { AGENT_DEFINITION_FORMAT_VERSION, AIError, APPROVAL_STATE_VERSION, Agent, type AgentConfig$1 as AgentConfig, AgentContextNextGen, AgentContextNextGenConfig, type AgentDefinitionListOptions, type AgentDefinitionMetadata, type AgentDefinitionSummary, AgentEvents, type AgentMetrics, type AgentPermissionsConfig, AgentResponse, type AgentSessionConfig, type AgentState, type AgentStatus, type ApprovalCacheEntry, type ApprovalDecision, ApproximateTokenEstimator, AudioFormat, AuditEntry, AuthIdentity, type AuthTemplate, type AuthTemplateField, type BackoffConfig, type BackoffStrategyType, BaseMediaProvider, BasePluginNextGen, BaseProvider, type BaseProviderConfig$1 as BaseProviderConfig, type BaseProviderResponse, BaseTextProvider, type BashResult, type BeforeExecuteResult, BraveProvider, CONNECTOR_CONFIG_VERSION, CUSTOM_TOOL_DEFINITION_VERSION, CheckpointManager, type CheckpointStrategy, CircuitBreaker, type CircuitBreakerConfig, type CircuitBreakerEvents, type CircuitBreakerMetrics, CircuitOpenError, type CircuitState, type ClipboardImageResult, CompactionContext, CompactionResult, Connector, ConnectorAccessContext, ConnectorAuth, ConnectorConfig, ConnectorConfigResult, ConnectorConfigStore, ConnectorFetchOptions, type ConnectorToolEntry, ConnectorTools, type ConnectorToolsOptions, ConsoleMetrics, ConsolidationResult, Content, ContextBudget$1 as ContextBudget, ContextEvents, ContextFeatures, type ContextManagerConfig, type ContextOverflowBudget, ContextOverflowError, ContextSessionMetadata, ContextSessionSummary, ContextStorageListOptions, type ControlFlowResult, type ControlFlowSource, type ConversationMessage, type CreateConnectorOptions, type CustomToolDefinition, type CustomToolListOptions, type CustomToolMetaToolsOptions, type CustomToolMetadata, type CustomToolSummary, type CustomToolTestCase, DEFAULT_ALLOWLIST, DEFAULT_BACKOFF_CONFIG, DEFAULT_CHECKPOINT_STRATEGY, DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_CONTEXT_CONFIG, DEFAULT_DESKTOP_CONFIG, DEFAULT_FILESYSTEM_CONFIG, DEFAULT_HISTORY_MANAGER_CONFIG, DEFAULT_PERMISSION_CONFIG, DEFAULT_RATE_LIMITER_CONFIG, DEFAULT_SHELL_CONFIG, DESKTOP_TOOL_NAMES, type DefaultAllowlistedTool, DefaultCompactionStrategy, type DefaultCompactionStrategyConfig, DependencyCycleError, type DesktopGetCursorResult, type DesktopGetScreenSizeResult, type DesktopKeyboardKeyArgs, type DesktopKeyboardKeyResult, type DesktopKeyboardTypeArgs, type DesktopKeyboardTypeResult, type DesktopMouseClickArgs, type DesktopMouseClickResult, type DesktopMouseDragArgs, type DesktopMouseDragResult, type DesktopMouseMoveArgs, type DesktopMouseMoveResult, type DesktopMouseScrollArgs, type DesktopMouseScrollResult, type DesktopPoint, type DesktopScreenSize, type DesktopScreenshot, type DesktopScreenshotArgs, type DesktopScreenshotResult, type DesktopToolConfig, type DesktopToolName, type DesktopWindow, type DesktopWindowFocusArgs, type DesktopWindowFocusResult, type DesktopWindowListResult, type DirectCallOptions, type DocumentFamily, type DocumentFormat, type DocumentImagePiece, type DocumentMetadata, type DocumentPiece, type DocumentReadOptions, DocumentReader, type DocumentReaderConfig, type DocumentResult, type DocumentSource, type DocumentTextPiece, type DocumentToContentOptions, type EditFileResult, type ErrorContext, ErrorHandler, type ErrorHandlerConfig, type ErrorHandlerEvents, EventEmitterTrigger, type EvictionStrategy, type ExecuteRoutineOptions, ExecutionContext, ExecutionMetrics, type ExecutionRecorder, type ExecutionRecorderOptions, type ExtendedFetchOptions, type ExternalDependency, type ExternalDependencyEvents, ExternalDependencyHandler, type FetchedContent, FileAgentDefinitionStorage, type FileAgentDefinitionStorageConfig, FileConnectorStorage, type FileConnectorStorageConfig, FileContextStorage, type FileContextStorageConfig, FileCustomToolStorage, type FileCustomToolStorageConfig, FileMediaStorage as FileMediaOutputHandler, FileMediaStorage, type FileMediaStorageConfig, FilePersistentInstructionsStorage, type FilePersistentInstructionsStorageConfig, FileRoutineDefinitionStorage, type FileRoutineDefinitionStorageConfig, FileStorage, type FileStorageConfig, FileUserInfoStorage, type FileUserInfoStorageConfig, type FilesystemToolConfig, type FormatDetectionResult, FormatDetector, FrameworkLogger, FunctionToolDefinition, type GeneratedPlan, type GenericAPICallArgs, type GenericAPICallResult, type GenericAPIToolOptions, type GitHubCreatePRResult, type GitHubGetPRResult, type GitHubPRCommentEntry, type GitHubPRCommentsResult, type GitHubPRFilesResult, type GitHubReadFileResult, type GitHubRepository, type GitHubSearchCodeResult, type GitHubSearchFilesResult, type GlobResult, type GraphDriveItem, type GrepMatch, type GrepResult, type HTTPTransportConfig, type HistoryManagerEvents, type HistoryMessage, HistoryMode, HookConfig, HookName, type HydrateOptions, type IAgentDefinitionStorage, type IAgentStateStorage, type IAgentStorage, type IAsyncDisposable, IBaseModelDescription, type ICapabilityProvider, ICompactionStrategy, IConnectorAccessPolicy, type IConnectorConfigStorage, IConnectorRegistry, type IContextCompactor, type IContextComponent, IContextPluginNextGen, type IContextSnapshot, IContextStorage, type IContextStrategy, type ICustomToolStorage, type IDesktopDriver, type IDisposable, type IDocumentTransformer, type IFormatHandler, type IHistoryManager, type IHistoryManagerConfig, type IHistoryStorage, IImageProvider, type IMCPClient, type IMediaStorage as IMediaOutputHandler, type IMediaStorage, type IMemoryStorage, type IPersistentInstructionsStorage, type IPlanStorage, type IPluginSnapshot, IProvider, type IResearchSource, type IRoutineDefinitionStorage, type IRoutineExecutionStorage, type ISTTModelDescription, type IScheduler, type IScrapeProvider, type ISearchProvider, type ISpeechToTextProvider, type ITTSModelDescription, ITextProvider, type ITextToSpeechProvider, ITokenEstimator$1 as ITokenEstimator, ITokenStorage, type IToolExecutionPipeline, type IToolExecutionPlugin, type IToolExecutor, type IToolSnapshot, type IUserInfoStorage, type IVideoModelDescription, type IVideoProvider, type IViewContextComponent, type IViewContextData, type IVoiceInfo, type ImageFilterOptions, type InContextEntry, type InContextMemoryConfig, InContextMemoryPluginNextGen, type InContextPriority, InMemoryAgentStateStorage, InMemoryHistoryStorage, InMemoryMetrics, InMemoryPlanStorage, InMemoryStorage, InputItem, type InstructionEntry, InvalidConfigError, InvalidToolArgumentsError, type JSONExtractionResult, LLMResponse, type LogEntry, type LogLevel, type LoggerConfig, LoggingPlugin, type LoggingPluginOptions, MCPClient, type MCPClientConnectionState, type MCPClientState, type MCPConfiguration, MCPConnectionError, MCPError, type MCPPrompt, type MCPPromptResult, MCPProtocolError, MCPRegistry, type MCPResource, type MCPResourceContent, MCPResourceError, type MCPServerCapabilities, type MCPServerConfig, MCPTimeoutError, type MCPTool, MCPToolError, type MCPToolResult, type MCPTransportType, type MediaStorageMetadata as MediaOutputMetadata, type MediaStorageResult as MediaOutputResult, type MediaStorageEntry, type MediaStorageListOptions, type MediaStorageMetadata, type MediaStorageResult, type MeetingSlotSuggestion, MemoryConnectorStorage, MemoryEntry, MemoryEvictionCompactor, MemoryIndex, MemoryPriority, MemoryScope, MemoryStorage, MessageBuilder, MessageRole, type MetricTags, type MetricsCollector, type MetricsCollectorType, type MicrosoftCreateMeetingResult, type MicrosoftDraftEmailResult, type MicrosoftEditMeetingResult, type MicrosoftFindSlotsResult, type MicrosoftGetTranscriptResult, type MicrosoftListFilesResult, type MicrosoftReadFileResult, type MicrosoftSearchFilesResult, type MicrosoftSendEmailResult, ModelCapabilities, ModelNotSupportedError, type MouseButton, type EvictionStrategy$1 as NextGenEvictionStrategy, NoOpMetrics, NutTreeDriver, type OAuthConfig, type OAuthFlow, OAuthManager, OutputItem, ParallelTasksError, type PermissionCheckContext, type PermissionCheckResult, type PermissionManagerEvent, type PermissionScope, type PersistentInstructionsConfig, PersistentInstructionsPluginNextGen, type PieceMetadata, type Plan, type PlanConcurrency, type PlanInput, type PlanStatus, PlanningAgent, type PlanningAgentConfig, type PluginExecutionContext, PreparedContext, ProviderAuthError, ProviderCapabilities, ProviderConfigAgent, ProviderContextLengthError, ProviderError, ProviderErrorMapper, ProviderNotFoundError, ProviderRateLimitError, ROUTINE_KEYS, RapidAPIProvider, RateLimitError, type RateLimiterConfig, type RateLimiterMetrics, type ReadFileResult, type FetchOptions as ResearchFetchOptions, type ResearchFinding, type ResearchPlan, type ResearchProgress, type ResearchQuery, type ResearchResult, type SearchOptions as ResearchSearchOptions, type SearchResponse as ResearchSearchResponse, type RiskLevel, type RoutineDefinition, type RoutineDefinitionInput, type RoutineExecution, type RoutineExecutionRecord, type RoutineExecutionStatus, type RoutineExecutionStep, type RoutineParameter, type RoutineStepType, type RoutineTaskResult, type RoutineTaskSnapshot, SIMPLE_ICONS_CDN, type STTModelCapabilities, type STTOptions, type STTOutputFormat$1 as STTOutputFormat, type STTResponse, STT_MODELS, STT_MODEL_REGISTRY, type ScheduleHandle, type ScheduleSpec, ScopedConnectorRegistry, type ScrapeFeature, type ScrapeOptions, ScrapeProvider, type ScrapeProviderConfig, type ScrapeProviderFallbackConfig, type ScrapeResponse, type ScrapeResult, type SearchOptions$1 as SearchOptions, SearchProvider, type SearchProviderConfig, type SearchResponse$1 as SearchResponse, type SearchResult, type SegmentTimestamp, type SerializedApprovalEntry, type SerializedApprovalState, SerializedContextState, type SerializedHistoryState, type SerializedInContextMemoryState, type SerializedPersistentInstructionsState, type SerializedToolState, type SerializedUserInfoState, type SerializedWorkingMemoryState, SerperProvider, ServiceCategory, type ServiceToolFactory, type ShellToolConfig, type SimpleIcon, SimpleScheduler, type SimpleVideoGenerateOptions, type SourceCapabilities, type SourceResult, SpeechToText, type SpeechToTextConfig, type StdioTransportConfig, type StorageConfig, type StorageContext, StorageRegistry, type StoredAgentDefinition, type StoredAgentType, type StoredConnectorConfig, StoredContextSession, type StoredToken, type StrategyInfo, StrategyRegistry, type StrategyRegistryEntry, StreamEvent, StreamEventType, StreamHelpers, StreamState, type SubRoutineSpec, SummarizeCompactor, TERMINAL_TASK_STATUSES, type TTSModelCapabilities, type TTSOptions, type TTSResponse, TTS_MODELS, TTS_MODEL_REGISTRY, type Task, type AgentConfig as TaskAgentStateConfig, type TaskCondition, type TaskControlFlow, type TaskExecution, type TaskFailure, type TaskFoldFlow, type TaskInput, type TaskMapFlow, type TaskSourceRef, type TaskStatus, TaskStatusForMemory, TaskTimeoutError, ToolContext as TaskToolContext, type TaskUntilFlow, type TaskValidation, TaskValidationError, type TaskValidationResult, TavilyProvider, type TemplateCredentials, TextGenerateOptions, TextToSpeech, type TextToSpeechConfig, TokenBucketRateLimiter, type TokenContentType, Tool, ToolCall, type ToolCatalogPluginConfig, ToolCatalogPluginNextGen, type ToolCategory, ToolCategoryScope, type ToolCondition, ToolContext, ToolExecutionError, ToolExecutionPipeline, type ToolExecutionPipelineOptions, ToolFunction, ToolManager, type ToolManagerConfig, type ToolManagerEvent, type ToolManagerStats, type ToolMetadata, ToolNotFoundError, type ToolOptions, type ToolPermissionConfig, ToolPermissionManager, type ToolRegistration, ToolRegistry, type ToolRegistryEntry, ToolResult, type ToolSelectionContext, type ToolSource, ToolTimeoutError, type TransportConfig, TruncateCompactor, type UserInfoEntry, type UserInfoPluginConfig, UserInfoPluginNextGen, VENDOR_ICON_MAP, VIDEO_MODELS, VIDEO_MODEL_REGISTRY, type ValidationContext, Vendor, type VendorInfo, type VendorLogo, VendorOptionSchema, type VendorRegistryEntry, type VendorTemplate, type VideoExtendOptions, type VideoGenerateOptions, VideoGeneration, type VideoGenerationCreateOptions, type VideoJob, type VideoModelCapabilities, type VideoModelPricing, type VideoResponse, type VideoStatus, type WordTimestamp, WorkingMemory, WorkingMemoryAccess, WorkingMemoryConfig, type WorkingMemoryEvents, type WorkingMemoryPluginConfig, WorkingMemoryPluginNextGen, type WriteFileResult, addJitter, allVendorTemplates, assertNotDestroyed, authenticatedFetch, backoffSequence, backoffWait, bash, buildAuthConfig, buildEndpointWithQuery, buildQueryString, calculateBackoff, calculateSTTCost, calculateTTSCost, calculateVideoCost, canTaskExecute, createAgentStorage, createAuthenticatedFetch, createBashTool, createConnectorFromTemplate, createCreatePRTool, createCustomToolDelete, createCustomToolDraft, createCustomToolList, createCustomToolLoad, createCustomToolMetaTools, createCustomToolSave, createCustomToolTest, createDesktopGetCursorTool, createDesktopGetScreenSizeTool, createDesktopKeyboardKeyTool, createDesktopKeyboardTypeTool, createDesktopMouseClickTool, createDesktopMouseDragTool, createDesktopMouseMoveTool, createDesktopMouseScrollTool, createDesktopScreenshotTool, createDesktopWindowFocusTool, createDesktopWindowListTool, createDraftEmailTool, createEditFileTool, createEditMeetingTool, createEstimator, createExecuteJavaScriptTool, createExecutionRecorder, createFileAgentDefinitionStorage, createFileContextStorage, createFileCustomToolStorage, createFileMediaStorage, createFileRoutineDefinitionStorage, createFindMeetingSlotsTool, createGetMeetingTranscriptTool, createGetPRTool, createGitHubReadFileTool, createGlobTool, createGrepTool, createImageGenerationTool, createImageProvider, createListDirectoryTool, createMeetingTool, createMessageWithImages, createMetricsCollector, createMicrosoftListFilesTool, createMicrosoftReadFileTool, createMicrosoftSearchFilesTool, createPRCommentsTool, createPRFilesTool, createPlan, createProvider, createReadFileTool, createRoutineDefinition, createRoutineExecution, createRoutineExecutionRecord, createSearchCodeTool, createSearchFilesTool, createSendEmailTool, createSpeechToTextTool, createTask, createTaskSnapshots, createTextMessage, createTextToSpeechTool, createVideoProvider, createVideoTools, createWriteFileTool, customToolDelete, customToolDraft, customToolList, customToolLoad, customToolSave, customToolTest, desktopGetCursor, desktopGetScreenSize, desktopKeyboardKey, desktopKeyboardType, desktopMouseClick, desktopMouseDrag, desktopMouseMove, desktopMouseScroll, desktopScreenshot, desktopTools, desktopWindowFocus, desktopWindowList, detectDependencyCycle, developerTools, documentToContent, editFile, encodeSharingUrl, evaluateCondition, executeRoutine, extractJSON, extractJSONField, extractNumber, findConnectorByServiceTypes, formatAttendees, formatFileSize, formatPluginDisplayName, formatRecipients, generateEncryptionKey, generateSimplePlan, generateWebAPITool, getActiveSTTModels, getActiveTTSModels, getActiveVideoModels, getAllBuiltInTools, getAllVendorLogos, getAllVendorTemplates, getBackgroundOutput, getConnectorTools, getCredentialsSetupURL, getDesktopDriver, getDocsURL, getDrivePrefix, getMediaOutputHandler, getMediaStorage, getNextExecutableTasks, getRegisteredScrapeProviders, getRoutineProgress, getSTTModelInfo, getSTTModelsByVendor, getSTTModelsWithFeature, getTTSModelInfo, getTTSModelsByVendor, getTTSModelsWithFeature, getTaskDependencies, getToolByName, getToolCategories, getToolRegistry, getToolsByCategory, getToolsRequiringConnector, getUserPathPrefix, getVendorAuthTemplate, getVendorColor, getVendorDefaultBaseURL, getVendorInfo, getVendorLogo, getVendorLogoCdnUrl, getVendorLogoSvg, getVendorTemplate, getVideoModelInfo, getVideoModelsByVendor, getVideoModelsWithAudio, getVideoModelsWithFeature, glob, globalErrorHandler, grep, hasClipboardImage, hasVendorLogo, hydrateCustomTool, isBlockedCommand, isExcludedExtension, isMicrosoftFileUrl, isTaskBlocked, isTeamsMeetingUrl, isTerminalStatus, isWebUrl, killBackgroundProcess, listConnectorsByServiceTypes, listDirectory, listVendorIds, listVendors, listVendorsByAuthType, listVendorsByCategory, listVendorsWithLogos, logger, mergeTextPieces, metrics, microsoftFetch, normalizeEmails, parseKeyCombo, parseRepository, readClipboardImage, readDocumentAsContent, readFile, registerScrapeProvider, resetDefaultDriver, resolveConnector, resolveDependencies, resolveFileEndpoints, resolveFlowSource, resolveMaxContextTokens, resolveMeetingId, resolveModelCapabilities, resolveRepository, resolveTemplates, retryWithBackoff, sanitizeToolName, setMediaOutputHandler, setMediaStorage, setMetricsCollector, simpleTokenEstimator, toConnectorOptions, toolRegistry, index as tools, updateTaskStatus, validatePath, writeFile };