@everworker/oneringai 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -8
- package/dist/{IProvider-Br817mKc.d.cts → IProvider-B8sqUzJG.d.cts} +37 -7
- package/dist/{IProvider-BUbU5UwV.d.ts → IProvider-CxDUGl6n.d.ts} +37 -7
- package/dist/{ImageModel-zh19LiVM.d.cts → ImageModel-Ds5_6sf7.d.cts} +1 -1
- package/dist/{ImageModel-B2KUs-ps.d.ts → ImageModel-OWbA277F.d.ts} +1 -1
- package/dist/capabilities/agents/index.d.cts +2 -2
- package/dist/capabilities/agents/index.d.ts +2 -2
- package/dist/capabilities/images/index.cjs +251 -106
- package/dist/capabilities/images/index.cjs.map +1 -1
- package/dist/capabilities/images/index.d.cts +2 -2
- package/dist/capabilities/images/index.d.ts +2 -2
- package/dist/capabilities/images/index.js +251 -106
- package/dist/capabilities/images/index.js.map +1 -1
- package/dist/{index-CR5PHkck.d.cts → index-CEjKTeSb.d.cts} +902 -7
- package/dist/{index-Cb7N9QIj.d.ts → index-CzGnmqOs.d.ts} +902 -7
- package/dist/index.cjs +2023 -484
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +440 -908
- package/dist/index.d.ts +440 -908
- package/dist/index.js +2003 -469
- package/dist/index.js.map +1 -1
- package/dist/shared/index.cjs +9 -0
- package/dist/shared/index.cjs.map +1 -1
- package/dist/shared/index.js +9 -0
- package/dist/shared/index.js.map +1 -1
- package/package.json +2 -1
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-
|
|
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-
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
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 CompactionContext, K as CompactionResult, N as StaleEntryInfo, Q as PriorityContext, R as MemoryIndex, U as TaskStatusForMemory, V as WorkingMemoryAccess, X as ContextStorageListOptions, Y as ContextSessionSummary, Z as TokenUsage, _ as StreamEventType, $ as TextGenerateOptions, a0 as ModelCapabilities, a1 as MessageRole } from './index-CEjKTeSb.cjs';
|
|
4
|
+
export { a2 as AfterToolContext, a3 as AgentEventName, a4 as AgenticLoopEventName, a5 as AgenticLoopEvents, a6 as ApprovalResult, a7 as ApproveToolContext, a8 as BeforeToolContext, a9 as BuiltInTool, aa as CONTEXT_SESSION_FORMAT_VERSION, ab as CompactionItem, ac as ContentType, ad as DEFAULT_CONFIG, ae as DEFAULT_FEATURES, af as DEFAULT_MEMORY_CONFIG, ag as ErrorEvent, ah as ExecutionConfig, ai as Hook, aj as HookManager, ak as InputImageContent, al as InputTextContent, am as IterationCompleteEvent, an as JSONSchema, ao as MEMORY_PRIORITY_VALUES, ap as MemoryEntryInput, aq as MemoryIndexEntry, ar as Message, as as ModifyingHook, at as OutputTextContent, au as OutputTextDeltaEvent, av as OutputTextDoneEvent, aw as OversizedInputResult, ax as PluginConfigs, ay as ReasoningDeltaEvent, az as ReasoningDoneEvent, aA as ReasoningItem, aB as ResponseCompleteEvent, aC as ResponseCreatedEvent, aD as ResponseInProgressEvent, aE as SimpleScope, aF as TaskAwareScope, aG as ThinkingContent, aH as ToolCallArgumentsDeltaEvent, aI as ToolCallArgumentsDoneEvent, aJ as ToolCallStartEvent, aK as ToolCallState, aL as ToolExecutionContext, aM as ToolExecutionDoneEvent, aN as ToolExecutionStartEvent, aO as ToolModification, aP as ToolResultContent, aQ as ToolUseContent, aR as calculateEntrySize, aS as defaultDescribeCall, aT as forPlan, aU as forTasks, aV as getToolCallDescription, aW as isErrorEvent, aX as isOutputTextDelta, aY as isReasoningDelta, aZ as isReasoningDone, a_ as isResponseComplete, a$ as isSimpleScope, b0 as isStreamEvent, b1 as isTaskAwareScope, b2 as isTerminalMemoryStatus, b3 as isToolCallArgumentsDelta, b4 as isToolCallArgumentsDone, b5 as isToolCallStart, b6 as scopeEquals, b7 as scopeMatches } from './index-CEjKTeSb.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-
|
|
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-
|
|
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,54 @@ 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
|
+
/** Map: execute a sub-routine for each element in an array */
|
|
784
|
+
interface TaskMapFlow {
|
|
785
|
+
type: 'map';
|
|
786
|
+
/** Memory key containing the source array */
|
|
787
|
+
sourceKey: string;
|
|
788
|
+
/** Sub-routine to run per element */
|
|
789
|
+
tasks: SubRoutineSpec;
|
|
790
|
+
/** Memory key for collected results array */
|
|
791
|
+
resultKey?: string;
|
|
792
|
+
/** Cap iterations (default: array.length, hard max: 1000) */
|
|
793
|
+
maxIterations?: number;
|
|
794
|
+
/** Timeout per sub-execution iteration in ms (default: no timeout) */
|
|
795
|
+
iterationTimeoutMs?: number;
|
|
796
|
+
}
|
|
797
|
+
/** Fold: accumulate a result across array elements */
|
|
798
|
+
interface TaskFoldFlow {
|
|
799
|
+
type: 'fold';
|
|
800
|
+
/** Memory key containing the source array */
|
|
801
|
+
sourceKey: string;
|
|
802
|
+
/** Sub-routine to run per element */
|
|
803
|
+
tasks: SubRoutineSpec;
|
|
804
|
+
/** Starting accumulator value */
|
|
805
|
+
initialValue: unknown;
|
|
806
|
+
/** Memory key for final accumulated result */
|
|
807
|
+
resultKey: string;
|
|
808
|
+
/** Cap iterations (default: array.length, hard max: 1000) */
|
|
809
|
+
maxIterations?: number;
|
|
810
|
+
/** Timeout per sub-execution iteration in ms (default: no timeout) */
|
|
811
|
+
iterationTimeoutMs?: number;
|
|
812
|
+
}
|
|
813
|
+
/** Until: repeat a sub-routine until a condition is met */
|
|
814
|
+
interface TaskUntilFlow {
|
|
815
|
+
type: 'until';
|
|
816
|
+
/** Sub-routine to run each iteration */
|
|
817
|
+
tasks: SubRoutineSpec;
|
|
818
|
+
/** Checked AFTER each iteration (reuses existing TaskCondition type) */
|
|
819
|
+
condition: TaskCondition;
|
|
820
|
+
/** Maximum iterations (required — no default) */
|
|
821
|
+
maxIterations: number;
|
|
822
|
+
/** Optional ICM key for current iteration index */
|
|
823
|
+
iterationKey?: string;
|
|
824
|
+
/** Timeout per sub-execution iteration in ms (default: no timeout) */
|
|
825
|
+
iterationTimeoutMs?: number;
|
|
826
|
+
}
|
|
827
|
+
/** Union of all control flow types */
|
|
828
|
+
type TaskControlFlow = TaskMapFlow | TaskFoldFlow | TaskUntilFlow;
|
|
1618
829
|
/**
|
|
1619
830
|
* Task execution settings
|
|
1620
831
|
*/
|
|
@@ -1627,7 +838,7 @@ interface TaskExecution {
|
|
|
1627
838
|
priority?: number;
|
|
1628
839
|
/**
|
|
1629
840
|
* Maximum LLM iterations (tool-call loops) per agent.run() for this task.
|
|
1630
|
-
* Prevents runaway agents. Default:
|
|
841
|
+
* Prevents runaway agents. Default: 50.
|
|
1631
842
|
*/
|
|
1632
843
|
maxIterations?: number;
|
|
1633
844
|
/**
|
|
@@ -1741,6 +952,8 @@ interface Task {
|
|
|
1741
952
|
suggestedTools?: string[];
|
|
1742
953
|
/** Optional expected output description */
|
|
1743
954
|
expectedOutput?: string;
|
|
955
|
+
/** Control flow: map, fold, or until (replaces normal LLM execution for this task) */
|
|
956
|
+
controlFlow?: TaskControlFlow;
|
|
1744
957
|
/** Result after completion */
|
|
1745
958
|
result?: {
|
|
1746
959
|
success: boolean;
|
|
@@ -1776,6 +989,7 @@ interface TaskInput {
|
|
|
1776
989
|
suggestedTools?: string[];
|
|
1777
990
|
validation?: TaskValidation;
|
|
1778
991
|
expectedOutput?: string;
|
|
992
|
+
controlFlow?: TaskControlFlow;
|
|
1779
993
|
maxAttempts?: number;
|
|
1780
994
|
metadata?: Record<string, unknown>;
|
|
1781
995
|
}
|
|
@@ -1894,6 +1108,20 @@ declare function detectDependencyCycle(tasks: Task[]): string[] | null;
|
|
|
1894
1108
|
* A RoutineExecution is a running instance backed by an existing Plan.
|
|
1895
1109
|
*/
|
|
1896
1110
|
|
|
1111
|
+
/**
|
|
1112
|
+
* A parameter that a routine accepts as input.
|
|
1113
|
+
* Enables parameterized, reusable routines.
|
|
1114
|
+
*/
|
|
1115
|
+
interface RoutineParameter {
|
|
1116
|
+
/** Parameter name (used as {{param.name}} in templates) */
|
|
1117
|
+
name: string;
|
|
1118
|
+
/** Human-readable description */
|
|
1119
|
+
description: string;
|
|
1120
|
+
/** Whether this parameter must be provided (default: false) */
|
|
1121
|
+
required?: boolean;
|
|
1122
|
+
/** Default value when not provided */
|
|
1123
|
+
default?: unknown;
|
|
1124
|
+
}
|
|
1897
1125
|
/**
|
|
1898
1126
|
* A reusable routine definition (template).
|
|
1899
1127
|
*
|
|
@@ -1921,6 +1149,8 @@ interface RoutineDefinition {
|
|
|
1921
1149
|
concurrency?: PlanConcurrency;
|
|
1922
1150
|
/** Whether the LLM can dynamically add/modify tasks during execution. Default: false */
|
|
1923
1151
|
allowDynamicTasks?: boolean;
|
|
1152
|
+
/** Input parameters this routine accepts (templates use {{param.name}}) */
|
|
1153
|
+
parameters?: RoutineParameter[];
|
|
1924
1154
|
/** Tags for categorization and filtering */
|
|
1925
1155
|
tags?: string[];
|
|
1926
1156
|
/** Author/creator */
|
|
@@ -1947,6 +1177,7 @@ interface RoutineDefinitionInput {
|
|
|
1947
1177
|
instructions?: string;
|
|
1948
1178
|
concurrency?: PlanConcurrency;
|
|
1949
1179
|
allowDynamicTasks?: boolean;
|
|
1180
|
+
parameters?: RoutineParameter[];
|
|
1950
1181
|
tags?: string[];
|
|
1951
1182
|
author?: string;
|
|
1952
1183
|
metadata?: Record<string, unknown>;
|
|
@@ -2724,6 +1955,14 @@ declare class ToolManager extends EventEmitter implements IToolExecutor, IDispos
|
|
|
2724
1955
|
* Register multiple tools at once
|
|
2725
1956
|
*/
|
|
2726
1957
|
registerMany(tools: ToolFunction[], options?: Omit<ToolOptions, 'conditions'>): void;
|
|
1958
|
+
/**
|
|
1959
|
+
* Register tools produced by a specific connector.
|
|
1960
|
+
* Sets `source: 'connector:<connectorName>'` (or `'connector:<name>:<accountId>'` for identity-bound tools)
|
|
1961
|
+
* so agent-level filtering can restrict which connector tools are visible to a given agent.
|
|
1962
|
+
*/
|
|
1963
|
+
registerConnectorTools(connectorName: string, tools: ToolFunction[], options?: Omit<ToolOptions, 'source'> & {
|
|
1964
|
+
accountId?: string;
|
|
1965
|
+
}): void;
|
|
2727
1966
|
/**
|
|
2728
1967
|
* Unregister a tool by name
|
|
2729
1968
|
*/
|
|
@@ -2801,6 +2040,12 @@ declare class ToolManager extends EventEmitter implements IToolExecutor, IDispos
|
|
|
2801
2040
|
* Get all enabled tools (sorted by priority)
|
|
2802
2041
|
*/
|
|
2803
2042
|
getEnabled(): ToolFunction[];
|
|
2043
|
+
/**
|
|
2044
|
+
* Get all enabled registrations (sorted by priority).
|
|
2045
|
+
* Includes full registration metadata (source, namespace, etc.)
|
|
2046
|
+
* for use in connector-aware filtering.
|
|
2047
|
+
*/
|
|
2048
|
+
getEnabledRegistrations(): ToolRegistration[];
|
|
2804
2049
|
/**
|
|
2805
2050
|
* Get all tools (enabled and disabled)
|
|
2806
2051
|
*/
|
|
@@ -2926,6 +2171,113 @@ declare class ToolManager extends EventEmitter implements IToolExecutor, IDispos
|
|
|
2926
2171
|
private estimateToolTokens;
|
|
2927
2172
|
}
|
|
2928
2173
|
|
|
2174
|
+
/**
|
|
2175
|
+
* Snapshot Types — Canonical, serializable representations of agent context state.
|
|
2176
|
+
*
|
|
2177
|
+
* Used by UI components (Hosea, v25, etc.) to render "Look Inside" panels
|
|
2178
|
+
* without reaching into plugin internals directly.
|
|
2179
|
+
*
|
|
2180
|
+
* Design: `plugins` is an array (not hardcoded fields) enabling auto-discovery
|
|
2181
|
+
* of new/custom plugins without code changes.
|
|
2182
|
+
*/
|
|
2183
|
+
|
|
2184
|
+
/**
|
|
2185
|
+
* Complete snapshot of an agent's context state.
|
|
2186
|
+
* Returned by `AgentContextNextGen.getSnapshot()` and `BaseAgent.getSnapshot()`.
|
|
2187
|
+
*/
|
|
2188
|
+
interface IContextSnapshot {
|
|
2189
|
+
/** Whether the context is available (not destroyed) */
|
|
2190
|
+
available: boolean;
|
|
2191
|
+
/** Agent ID */
|
|
2192
|
+
agentId: string;
|
|
2193
|
+
/** Model name */
|
|
2194
|
+
model: string;
|
|
2195
|
+
/** Feature flags */
|
|
2196
|
+
features: Required<ContextFeatures>;
|
|
2197
|
+
/** Token budget breakdown */
|
|
2198
|
+
budget: ContextBudget$1;
|
|
2199
|
+
/** Compaction strategy name */
|
|
2200
|
+
strategy: string;
|
|
2201
|
+
/** Number of messages in conversation history */
|
|
2202
|
+
messagesCount: number;
|
|
2203
|
+
/** Number of tool calls in conversation */
|
|
2204
|
+
toolCallsCount: number;
|
|
2205
|
+
/** System prompt (null if not set) */
|
|
2206
|
+
systemPrompt: string | null;
|
|
2207
|
+
/** All registered plugins with their current state */
|
|
2208
|
+
plugins: IPluginSnapshot[];
|
|
2209
|
+
/** All registered tools */
|
|
2210
|
+
tools: IToolSnapshot[];
|
|
2211
|
+
}
|
|
2212
|
+
/**
|
|
2213
|
+
* Snapshot of a single plugin's state.
|
|
2214
|
+
* `contents` is the raw data from `plugin.getContents()` (plugin-specific shape).
|
|
2215
|
+
* `formattedContent` is the human-readable string from `plugin.getContent()`.
|
|
2216
|
+
*/
|
|
2217
|
+
interface IPluginSnapshot {
|
|
2218
|
+
/** Plugin identifier (e.g., 'working_memory') */
|
|
2219
|
+
name: string;
|
|
2220
|
+
/** Human-readable display name (e.g., 'Working Memory') */
|
|
2221
|
+
displayName: string;
|
|
2222
|
+
/** Whether this plugin is active */
|
|
2223
|
+
enabled: boolean;
|
|
2224
|
+
/** Current token size of plugin content */
|
|
2225
|
+
tokenSize: number;
|
|
2226
|
+
/** Token size of plugin instructions */
|
|
2227
|
+
instructionsTokenSize: number;
|
|
2228
|
+
/** Whether this plugin supports compaction */
|
|
2229
|
+
compactable: boolean;
|
|
2230
|
+
/** Raw plugin data (entries, state, etc.) */
|
|
2231
|
+
contents: unknown;
|
|
2232
|
+
/** Human-readable formatted content (Markdown) */
|
|
2233
|
+
formattedContent: string | null;
|
|
2234
|
+
}
|
|
2235
|
+
/**
|
|
2236
|
+
* Snapshot of a single tool's registration state.
|
|
2237
|
+
*/
|
|
2238
|
+
interface IToolSnapshot {
|
|
2239
|
+
/** Tool name */
|
|
2240
|
+
name: string;
|
|
2241
|
+
/** Tool description */
|
|
2242
|
+
description: string;
|
|
2243
|
+
/** Whether the tool is currently enabled */
|
|
2244
|
+
enabled: boolean;
|
|
2245
|
+
/** Number of times this tool has been called */
|
|
2246
|
+
callCount: number;
|
|
2247
|
+
/** Tool namespace (if registered with one) */
|
|
2248
|
+
namespace?: string;
|
|
2249
|
+
}
|
|
2250
|
+
/**
|
|
2251
|
+
* Human-readable breakdown of the prepared context.
|
|
2252
|
+
* Used by "View Full Context" UI panels.
|
|
2253
|
+
*/
|
|
2254
|
+
interface IViewContextData {
|
|
2255
|
+
/** Whether the data is available */
|
|
2256
|
+
available: boolean;
|
|
2257
|
+
/** Ordered list of context components */
|
|
2258
|
+
components: IViewContextComponent[];
|
|
2259
|
+
/** Total estimated tokens across all components */
|
|
2260
|
+
totalTokens: number;
|
|
2261
|
+
/** All components concatenated (for "Copy All" functionality) */
|
|
2262
|
+
rawContext: string;
|
|
2263
|
+
}
|
|
2264
|
+
/**
|
|
2265
|
+
* A single component of the prepared context.
|
|
2266
|
+
*/
|
|
2267
|
+
interface IViewContextComponent {
|
|
2268
|
+
/** Component name (e.g., 'System Message', 'User Message', 'Tool Call: search') */
|
|
2269
|
+
name: string;
|
|
2270
|
+
/** Human-readable text content */
|
|
2271
|
+
content: string;
|
|
2272
|
+
/** Estimated token count for this component */
|
|
2273
|
+
tokenEstimate: number;
|
|
2274
|
+
}
|
|
2275
|
+
/**
|
|
2276
|
+
* Convert a plugin name to a human-readable display name.
|
|
2277
|
+
* e.g., 'working_memory' → 'Working Memory'
|
|
2278
|
+
*/
|
|
2279
|
+
declare function formatPluginDisplayName(name: string): string;
|
|
2280
|
+
|
|
2929
2281
|
/**
|
|
2930
2282
|
* Tool Permission Types
|
|
2931
2283
|
*
|
|
@@ -3629,12 +2981,14 @@ declare class AgentContextNextGen extends EventEmitter<ContextEvents> {
|
|
|
3629
2981
|
private readonly _agentId;
|
|
3630
2982
|
/** User ID for multi-user scenarios */
|
|
3631
2983
|
private _userId;
|
|
3632
|
-
/**
|
|
3633
|
-
private
|
|
2984
|
+
/** Auth identities this agent is scoped to (connector + optional accountId) */
|
|
2985
|
+
private _identities;
|
|
3634
2986
|
/** Storage backend */
|
|
3635
2987
|
private readonly _storage?;
|
|
3636
2988
|
/** Destroyed flag */
|
|
3637
2989
|
private _destroyed;
|
|
2990
|
+
/** Last thinking/reasoning content from the most recent assistant response */
|
|
2991
|
+
private _lastThinking;
|
|
3638
2992
|
/** Cached budget from last prepare() call */
|
|
3639
2993
|
private _cachedBudget;
|
|
3640
2994
|
/** Callback for beforeCompaction hook (set by Agent) */
|
|
@@ -3651,7 +3005,7 @@ declare class AgentContextNextGen extends EventEmitter<ContextEvents> {
|
|
|
3651
3005
|
private initializePlugins;
|
|
3652
3006
|
/**
|
|
3653
3007
|
* Validate that a strategy's required plugins are registered.
|
|
3654
|
-
*
|
|
3008
|
+
* Logs a warning if required plugins are missing — the strategy should degrade gracefully.
|
|
3655
3009
|
*/
|
|
3656
3010
|
private validateStrategyDependencies;
|
|
3657
3011
|
/**
|
|
@@ -3659,7 +3013,7 @@ declare class AgentContextNextGen extends EventEmitter<ContextEvents> {
|
|
|
3659
3013
|
* Merges with existing ToolContext to preserve other fields (memory, signal, taskId).
|
|
3660
3014
|
*
|
|
3661
3015
|
* Connector registry resolution order:
|
|
3662
|
-
* 1. If `
|
|
3016
|
+
* 1. If `identities` is set → filtered view showing only identity connectors
|
|
3663
3017
|
* 2. If access policy + userId → scoped view via Connector.scoped()
|
|
3664
3018
|
* 3. Otherwise → full global registry
|
|
3665
3019
|
*/
|
|
@@ -3678,10 +3032,10 @@ declare class AgentContextNextGen extends EventEmitter<ContextEvents> {
|
|
|
3678
3032
|
get userId(): string | undefined;
|
|
3679
3033
|
/** Set user ID. Automatically updates ToolContext for all tool executions. */
|
|
3680
3034
|
set userId(value: string | undefined);
|
|
3681
|
-
/** Get the
|
|
3682
|
-
get
|
|
3683
|
-
/** Set
|
|
3684
|
-
set
|
|
3035
|
+
/** Get the auth identities this agent is scoped to (undefined = all visible connectors) */
|
|
3036
|
+
get identities(): AuthIdentity[] | undefined;
|
|
3037
|
+
/** Set auth identities. Updates ToolContext.connectorRegistry and identity-aware descriptions. */
|
|
3038
|
+
set identities(value: AuthIdentity[] | undefined);
|
|
3685
3039
|
/** Get/set system prompt */
|
|
3686
3040
|
get systemPrompt(): string | undefined;
|
|
3687
3041
|
set systemPrompt(value: string | undefined);
|
|
@@ -3693,6 +3047,11 @@ declare class AgentContextNextGen extends EventEmitter<ContextEvents> {
|
|
|
3693
3047
|
get sessionId(): string | null;
|
|
3694
3048
|
/** Get storage (null if not configured) */
|
|
3695
3049
|
get storage(): IContextStorage | null;
|
|
3050
|
+
/**
|
|
3051
|
+
* Get the last thinking/reasoning content from the most recent assistant response.
|
|
3052
|
+
* Updated on every assistant response, always available regardless of persistence setting.
|
|
3053
|
+
*/
|
|
3054
|
+
get lastThinking(): string | null;
|
|
3696
3055
|
/** Get max context tokens */
|
|
3697
3056
|
get maxContextTokens(): number;
|
|
3698
3057
|
/** Get response reserve tokens */
|
|
@@ -3942,6 +3301,31 @@ declare class AgentContextNextGen extends EventEmitter<ContextEvents> {
|
|
|
3942
3301
|
* Get the current strategy name.
|
|
3943
3302
|
*/
|
|
3944
3303
|
get strategy(): string;
|
|
3304
|
+
/**
|
|
3305
|
+
* Get a complete, serializable snapshot of the context state.
|
|
3306
|
+
*
|
|
3307
|
+
* Returns all data needed by UI "Look Inside" panels without reaching
|
|
3308
|
+
* into plugin internals. Plugin data is auto-discovered from the plugin
|
|
3309
|
+
* registry — new/custom plugins appear automatically.
|
|
3310
|
+
*
|
|
3311
|
+
* @param toolStats - Optional tool usage stats (from ToolManager.getStats())
|
|
3312
|
+
* @returns Serializable context snapshot
|
|
3313
|
+
*/
|
|
3314
|
+
getSnapshot(toolStats?: {
|
|
3315
|
+
mostUsed?: Array<{
|
|
3316
|
+
name: string;
|
|
3317
|
+
count: number;
|
|
3318
|
+
}>;
|
|
3319
|
+
}): Promise<IContextSnapshot>;
|
|
3320
|
+
/**
|
|
3321
|
+
* Get a human-readable breakdown of the prepared context.
|
|
3322
|
+
*
|
|
3323
|
+
* Calls `prepare()` internally, then maps each InputItem to a named
|
|
3324
|
+
* component with content text and token estimate. Used by "View Full Context" UIs.
|
|
3325
|
+
*
|
|
3326
|
+
* @returns View context data with components and raw text for "Copy All"
|
|
3327
|
+
*/
|
|
3328
|
+
getViewContext(): Promise<IViewContextData>;
|
|
3945
3329
|
/**
|
|
3946
3330
|
* Generate unique ID.
|
|
3947
3331
|
*/
|
|
@@ -4100,11 +3484,11 @@ interface BaseAgentConfig {
|
|
|
4100
3484
|
/** User ID for multi-user scenarios. Flows to ToolContext automatically for all tool executions. */
|
|
4101
3485
|
userId?: string;
|
|
4102
3486
|
/**
|
|
4103
|
-
* Restrict this agent to
|
|
4104
|
-
*
|
|
3487
|
+
* Restrict this agent to specific auth identities (connector + optional account alias).
|
|
3488
|
+
* Each identity produces its own tool set (e.g., microsoft_work_api, microsoft_personal_api).
|
|
4105
3489
|
* When not set, all connectors visible to the current userId are available.
|
|
4106
3490
|
*/
|
|
4107
|
-
|
|
3491
|
+
identities?: AuthIdentity[];
|
|
4108
3492
|
/** Tools available to the agent */
|
|
4109
3493
|
tools?: ToolFunction[];
|
|
4110
3494
|
/** Provide a pre-configured ToolManager (advanced) */
|
|
@@ -4284,13 +3668,13 @@ declare abstract class BaseAgent<TConfig extends BaseAgentConfig = BaseAgentConf
|
|
|
4284
3668
|
*/
|
|
4285
3669
|
set userId(value: string | undefined);
|
|
4286
3670
|
/**
|
|
4287
|
-
* Get the
|
|
3671
|
+
* Get the auth identities this agent is scoped to (undefined = all visible connectors).
|
|
4288
3672
|
*/
|
|
4289
|
-
get
|
|
3673
|
+
get identities(): AuthIdentity[] | undefined;
|
|
4290
3674
|
/**
|
|
4291
|
-
*
|
|
3675
|
+
* Set auth identities at runtime. Updates ToolContext.connectorRegistry and tool descriptions.
|
|
4292
3676
|
*/
|
|
4293
|
-
set
|
|
3677
|
+
set identities(value: AuthIdentity[] | undefined);
|
|
4294
3678
|
/**
|
|
4295
3679
|
* Permission management. Returns ToolPermissionManager for approval control.
|
|
4296
3680
|
*/
|
|
@@ -4298,8 +3682,11 @@ declare abstract class BaseAgent<TConfig extends BaseAgentConfig = BaseAgentConf
|
|
|
4298
3682
|
/**
|
|
4299
3683
|
* Add a tool to the agent.
|
|
4300
3684
|
* Tools are registered with AgentContext (single source of truth).
|
|
3685
|
+
*
|
|
3686
|
+
* @param tool - The tool function to register
|
|
3687
|
+
* @param options - Optional registration options (namespace, source, priority, etc.)
|
|
4301
3688
|
*/
|
|
4302
|
-
addTool(tool: ToolFunction): void;
|
|
3689
|
+
addTool(tool: ToolFunction, options?: ToolOptions): void;
|
|
4303
3690
|
/**
|
|
4304
3691
|
* Remove a tool from the agent.
|
|
4305
3692
|
* Tools are unregistered from AgentContext (single source of truth).
|
|
@@ -4322,6 +3709,25 @@ declare abstract class BaseAgent<TConfig extends BaseAgentConfig = BaseAgentConf
|
|
|
4322
3709
|
* always sees up-to-date tool descriptions.
|
|
4323
3710
|
*/
|
|
4324
3711
|
protected getEnabledToolDefinitions(): FunctionToolDefinition[];
|
|
3712
|
+
/**
|
|
3713
|
+
* List available models from the provider's API.
|
|
3714
|
+
* Useful for discovering models dynamically (e.g., Ollama local models).
|
|
3715
|
+
*/
|
|
3716
|
+
listModels(): Promise<string[]>;
|
|
3717
|
+
/**
|
|
3718
|
+
* Get a complete, serializable snapshot of the agent's context state.
|
|
3719
|
+
*
|
|
3720
|
+
* Convenience method that auto-wires tool usage stats from ToolManager.
|
|
3721
|
+
* Used by UI "Look Inside" panels.
|
|
3722
|
+
*/
|
|
3723
|
+
getSnapshot(): Promise<IContextSnapshot>;
|
|
3724
|
+
/**
|
|
3725
|
+
* Get a human-readable breakdown of the prepared context.
|
|
3726
|
+
*
|
|
3727
|
+
* Convenience method that delegates to AgentContextNextGen.
|
|
3728
|
+
* Used by "View Full Context" UI panels.
|
|
3729
|
+
*/
|
|
3730
|
+
getViewContext(): Promise<IViewContextData>;
|
|
4325
3731
|
/**
|
|
4326
3732
|
* Get the provider for LLM calls.
|
|
4327
3733
|
* Returns the single shared provider instance.
|
|
@@ -4462,6 +3868,14 @@ interface AgentConfig$1 extends BaseAgentConfig {
|
|
|
4462
3868
|
temperature?: number;
|
|
4463
3869
|
/** Maximum iterations for tool calling loop */
|
|
4464
3870
|
maxIterations?: number;
|
|
3871
|
+
/** Vendor-agnostic thinking/reasoning configuration */
|
|
3872
|
+
thinking?: {
|
|
3873
|
+
enabled: boolean;
|
|
3874
|
+
/** Budget in tokens for thinking (Anthropic & Google) */
|
|
3875
|
+
budgetTokens?: number;
|
|
3876
|
+
/** Reasoning effort level (OpenAI) */
|
|
3877
|
+
effort?: 'low' | 'medium' | 'high';
|
|
3878
|
+
};
|
|
4465
3879
|
/** Vendor-specific options (e.g., Google's thinkingLevel: 'low' | 'high') */
|
|
4466
3880
|
vendorOptions?: Record<string, unknown>;
|
|
4467
3881
|
/**
|
|
@@ -4759,6 +4173,8 @@ interface ExecuteRoutineOptions {
|
|
|
4759
4173
|
model?: string;
|
|
4760
4174
|
/** Additional tools — only used when creating a new agent (no `agent` provided) */
|
|
4761
4175
|
tools?: ToolFunction[];
|
|
4176
|
+
/** Input parameter values for parameterized routines */
|
|
4177
|
+
inputs?: Record<string, unknown>;
|
|
4762
4178
|
/** Hooks — applied to agent for the duration of routine execution.
|
|
4763
4179
|
* For new agents: baked in at creation. For existing agents: registered before
|
|
4764
4180
|
* execution and unregistered after. */
|
|
@@ -9680,6 +9096,49 @@ declare class InMemoryHistoryStorage implements IHistoryStorage {
|
|
|
9680
9096
|
restoreState(state: SerializedHistoryState): Promise<void>;
|
|
9681
9097
|
}
|
|
9682
9098
|
|
|
9099
|
+
/**
|
|
9100
|
+
* Routine Control Flow — map, fold, until handlers + template resolution
|
|
9101
|
+
*
|
|
9102
|
+
* Control flow tasks delegate to executeRoutine() recursively with the shared agent,
|
|
9103
|
+
* using ICM keys (__map_item, __map_index, etc.) to pass iteration state.
|
|
9104
|
+
*/
|
|
9105
|
+
|
|
9106
|
+
/** Well-known ICM/WM keys used by the routine execution framework. */
|
|
9107
|
+
declare const ROUTINE_KEYS: {
|
|
9108
|
+
/** Plan overview with task statuses (ICM) */
|
|
9109
|
+
readonly PLAN: "__routine_plan";
|
|
9110
|
+
/** Dependency results location guide (ICM) */
|
|
9111
|
+
readonly DEPS: "__routine_deps";
|
|
9112
|
+
/** Prefix for per-dependency result keys (ICM/WM) */
|
|
9113
|
+
readonly DEP_RESULT_PREFIX: "__dep_result_";
|
|
9114
|
+
/** Current map/fold item (ICM) */
|
|
9115
|
+
readonly MAP_ITEM: "__map_item";
|
|
9116
|
+
/** Current map/fold index, 0-based (ICM) */
|
|
9117
|
+
readonly MAP_INDEX: "__map_index";
|
|
9118
|
+
/** Total items in map/fold (ICM) */
|
|
9119
|
+
readonly MAP_TOTAL: "__map_total";
|
|
9120
|
+
/** Running fold accumulator (ICM) */
|
|
9121
|
+
readonly FOLD_ACCUMULATOR: "__fold_accumulator";
|
|
9122
|
+
/** Prefix for large dep results stored in WM findings tier */
|
|
9123
|
+
readonly WM_DEP_FINDINGS_PREFIX: "findings/__dep_result_";
|
|
9124
|
+
};
|
|
9125
|
+
interface ControlFlowResult {
|
|
9126
|
+
completed: boolean;
|
|
9127
|
+
result?: unknown;
|
|
9128
|
+
error?: string;
|
|
9129
|
+
}
|
|
9130
|
+
/**
|
|
9131
|
+
* Resolve template placeholders in text.
|
|
9132
|
+
*
|
|
9133
|
+
* Supported namespaces:
|
|
9134
|
+
* - {{param.name}} → inputs[name]
|
|
9135
|
+
* - {{map.item}} / {{map.index}} / {{map.total}} → ICM keys
|
|
9136
|
+
* - {{fold.accumulator}} → ICM key
|
|
9137
|
+
*
|
|
9138
|
+
* Non-string values are JSON.stringify'd. Unresolved templates are left as-is.
|
|
9139
|
+
*/
|
|
9140
|
+
declare function resolveTemplates(text: string, inputs: Record<string, unknown>, icmPlugin: InContextMemoryPluginNextGen | null): string;
|
|
9141
|
+
|
|
9683
9142
|
/**
|
|
9684
9143
|
* FilePersistentInstructionsStorage - File-based storage for persistent instructions
|
|
9685
9144
|
*
|
|
@@ -10313,6 +9772,7 @@ declare class StreamState {
|
|
|
10313
9772
|
model: string;
|
|
10314
9773
|
createdAt: number;
|
|
10315
9774
|
private textBuffers;
|
|
9775
|
+
private reasoningBuffers;
|
|
10316
9776
|
private toolCallBuffers;
|
|
10317
9777
|
private completedToolCalls;
|
|
10318
9778
|
private toolResults;
|
|
@@ -10337,6 +9797,22 @@ declare class StreamState {
|
|
|
10337
9797
|
* Get all accumulated text (all items concatenated)
|
|
10338
9798
|
*/
|
|
10339
9799
|
getAllText(): string;
|
|
9800
|
+
/**
|
|
9801
|
+
* Accumulate reasoning delta for a specific item
|
|
9802
|
+
*/
|
|
9803
|
+
accumulateReasoningDelta(itemId: string, delta: string): void;
|
|
9804
|
+
/**
|
|
9805
|
+
* Get complete accumulated reasoning for an item
|
|
9806
|
+
*/
|
|
9807
|
+
getCompleteReasoning(itemId: string): string;
|
|
9808
|
+
/**
|
|
9809
|
+
* Get all accumulated reasoning (all items concatenated)
|
|
9810
|
+
*/
|
|
9811
|
+
getAllReasoning(): string;
|
|
9812
|
+
/**
|
|
9813
|
+
* Check if stream has any accumulated reasoning
|
|
9814
|
+
*/
|
|
9815
|
+
hasReasoning(): boolean;
|
|
10340
9816
|
/**
|
|
10341
9817
|
* Start accumulating tool call arguments
|
|
10342
9818
|
*/
|
|
@@ -10441,6 +9917,7 @@ declare class StreamState {
|
|
|
10441
9917
|
model: string;
|
|
10442
9918
|
createdAt: number;
|
|
10443
9919
|
textBuffers: Map<string, string[]>;
|
|
9920
|
+
reasoningBuffers: Map<string, string[]>;
|
|
10444
9921
|
toolCallBuffers: Map<string, ToolCallBuffer>;
|
|
10445
9922
|
completedToolCalls: ToolCall[];
|
|
10446
9923
|
toolResults: Map<string, any>;
|
|
@@ -10485,6 +9962,23 @@ declare class StreamHelpers {
|
|
|
10485
9962
|
* Accumulate text from stream into a single string
|
|
10486
9963
|
*/
|
|
10487
9964
|
static accumulateText(stream: AsyncIterableIterator<StreamEvent>): Promise<string>;
|
|
9965
|
+
/**
|
|
9966
|
+
* Get only reasoning/thinking deltas from stream
|
|
9967
|
+
* Filters out all other event types
|
|
9968
|
+
*/
|
|
9969
|
+
static thinkingOnly(stream: AsyncIterableIterator<StreamEvent>): AsyncIterableIterator<string>;
|
|
9970
|
+
/**
|
|
9971
|
+
* Get both text and thinking deltas from stream
|
|
9972
|
+
* Yields tagged objects so consumers can distinguish them
|
|
9973
|
+
*/
|
|
9974
|
+
static textAndThinking(stream: AsyncIterableIterator<StreamEvent>): AsyncIterableIterator<{
|
|
9975
|
+
type: 'text' | 'thinking';
|
|
9976
|
+
delta: string;
|
|
9977
|
+
}>;
|
|
9978
|
+
/**
|
|
9979
|
+
* Accumulate all thinking/reasoning content from stream into a single string
|
|
9980
|
+
*/
|
|
9981
|
+
static accumulateThinking(stream: AsyncIterableIterator<StreamEvent>): Promise<string>;
|
|
10488
9982
|
/**
|
|
10489
9983
|
* Buffer stream events into batches
|
|
10490
9984
|
*/
|
|
@@ -10781,9 +10275,10 @@ declare abstract class BaseTextProvider extends BaseProvider implements ITextPro
|
|
|
10781
10275
|
*/
|
|
10782
10276
|
protected normalizeInputToString(input: string | any[]): string;
|
|
10783
10277
|
/**
|
|
10784
|
-
* List available models
|
|
10278
|
+
* List available models from the provider's API.
|
|
10279
|
+
* Default returns empty array; providers override when they have SDK support.
|
|
10785
10280
|
*/
|
|
10786
|
-
listModels
|
|
10281
|
+
listModels(): Promise<string[]>;
|
|
10787
10282
|
/**
|
|
10788
10283
|
* Clean up provider resources (circuit breaker listeners, etc.)
|
|
10789
10284
|
* Should be called when the provider is no longer needed.
|
|
@@ -10911,6 +10406,8 @@ interface GenericAPIToolOptions {
|
|
|
10911
10406
|
description?: string;
|
|
10912
10407
|
/** User ID for multi-user OAuth */
|
|
10913
10408
|
userId?: string;
|
|
10409
|
+
/** Account alias for multi-account OAuth (baked into tool name and context) */
|
|
10410
|
+
accountId?: string;
|
|
10914
10411
|
/** Permission config for the tool */
|
|
10915
10412
|
permission?: ToolPermissionConfig$1;
|
|
10916
10413
|
}
|
|
@@ -10939,6 +10436,8 @@ interface GenericAPICallResult {
|
|
|
10939
10436
|
interface ConnectorToolsOptions {
|
|
10940
10437
|
/** Optional scoped registry for access-controlled connector lookup */
|
|
10941
10438
|
registry?: IConnectorRegistry;
|
|
10439
|
+
/** Account alias for multi-account OAuth. When set, tools are prefixed with accountId and context is bound. */
|
|
10440
|
+
accountId?: string;
|
|
10942
10441
|
}
|
|
10943
10442
|
/**
|
|
10944
10443
|
* ConnectorTools - Main API for vendor-dependent tools
|
|
@@ -11082,6 +10581,34 @@ declare class ConnectorTools {
|
|
|
11082
10581
|
*/
|
|
11083
10582
|
private static maintainCacheSize;
|
|
11084
10583
|
private static resolveConnector;
|
|
10584
|
+
/**
|
|
10585
|
+
* Generate tools for a set of auth identities.
|
|
10586
|
+
* Each identity gets its own tool set with unique name prefixes.
|
|
10587
|
+
*
|
|
10588
|
+
* @param identities - Array of auth identities
|
|
10589
|
+
* @param userId - Optional user ID for multi-user OAuth
|
|
10590
|
+
* @param options - Optional registry for scoped connector lookup
|
|
10591
|
+
* @returns Map of identity key to tool array
|
|
10592
|
+
*
|
|
10593
|
+
* @example
|
|
10594
|
+
* ```typescript
|
|
10595
|
+
* const toolsByIdentity = ConnectorTools.forIdentities([
|
|
10596
|
+
* { connector: 'microsoft', accountId: 'work' },
|
|
10597
|
+
* { connector: 'microsoft', accountId: 'personal' },
|
|
10598
|
+
* { connector: 'github' },
|
|
10599
|
+
* ]);
|
|
10600
|
+
* // Keys: 'microsoft:work', 'microsoft:personal', 'github'
|
|
10601
|
+
* ```
|
|
10602
|
+
*/
|
|
10603
|
+
static forIdentities(identities: AuthIdentity[], userId?: string, options?: {
|
|
10604
|
+
registry?: IConnectorRegistry;
|
|
10605
|
+
}): Map<string, ToolFunction[]>;
|
|
10606
|
+
/**
|
|
10607
|
+
* Wrap a tool to inject accountId into ToolContext at execute time.
|
|
10608
|
+
* This allows identity-bound tools to use the correct account without
|
|
10609
|
+
* modifying every service tool factory.
|
|
10610
|
+
*/
|
|
10611
|
+
private static bindAccountId;
|
|
11085
10612
|
private static createGenericAPITool;
|
|
11086
10613
|
}
|
|
11087
10614
|
|
|
@@ -11131,43 +10658,56 @@ declare class OAuthManager {
|
|
|
11131
10658
|
* Automatically refreshes if expired
|
|
11132
10659
|
*
|
|
11133
10660
|
* @param userId - User identifier for multi-user support (optional)
|
|
10661
|
+
* @param accountId - Account alias for multi-account support (optional)
|
|
11134
10662
|
*/
|
|
11135
|
-
getToken(userId?: string): Promise<string>;
|
|
10663
|
+
getToken(userId?: string, accountId?: string): Promise<string>;
|
|
11136
10664
|
/**
|
|
11137
10665
|
* Force refresh the token
|
|
11138
10666
|
*
|
|
11139
10667
|
* @param userId - User identifier for multi-user support (optional)
|
|
10668
|
+
* @param accountId - Account alias for multi-account support (optional)
|
|
11140
10669
|
*/
|
|
11141
|
-
refreshToken(userId?: string): Promise<string>;
|
|
10670
|
+
refreshToken(userId?: string, accountId?: string): Promise<string>;
|
|
11142
10671
|
/**
|
|
11143
10672
|
* Check if current token is valid
|
|
11144
10673
|
*
|
|
11145
10674
|
* @param userId - User identifier for multi-user support (optional)
|
|
10675
|
+
* @param accountId - Account alias for multi-account support (optional)
|
|
11146
10676
|
*/
|
|
11147
|
-
isTokenValid(userId?: string): Promise<boolean>;
|
|
10677
|
+
isTokenValid(userId?: string, accountId?: string): Promise<boolean>;
|
|
11148
10678
|
/**
|
|
11149
10679
|
* Start authorization flow (Authorization Code only)
|
|
11150
10680
|
* Returns URL for user to visit
|
|
11151
10681
|
*
|
|
11152
10682
|
* @param userId - User identifier for multi-user support (optional)
|
|
10683
|
+
* @param accountId - Account alias for multi-account support (optional)
|
|
11153
10684
|
* @returns Authorization URL for the user to visit
|
|
11154
10685
|
*/
|
|
11155
|
-
startAuthFlow(userId?: string): Promise<string>;
|
|
10686
|
+
startAuthFlow(userId?: string, accountId?: string): Promise<string>;
|
|
11156
10687
|
/**
|
|
11157
10688
|
* Handle OAuth callback (Authorization Code only)
|
|
11158
10689
|
* Call this with the callback URL after user authorizes
|
|
11159
10690
|
*
|
|
11160
10691
|
* @param callbackUrl - Full callback URL with code and state parameters
|
|
11161
10692
|
* @param userId - Optional user identifier (can be extracted from state if embedded)
|
|
10693
|
+
* @param accountId - Optional account alias (can be extracted from state if embedded)
|
|
11162
10694
|
*/
|
|
11163
|
-
handleCallback(callbackUrl: string, userId?: string): Promise<void>;
|
|
10695
|
+
handleCallback(callbackUrl: string, userId?: string, accountId?: string): Promise<void>;
|
|
11164
10696
|
/**
|
|
11165
10697
|
* Revoke token (if supported by provider)
|
|
11166
10698
|
*
|
|
11167
10699
|
* @param revocationUrl - Optional revocation endpoint URL
|
|
11168
10700
|
* @param userId - User identifier for multi-user support (optional)
|
|
10701
|
+
* @param accountId - Account alias for multi-account support (optional)
|
|
10702
|
+
*/
|
|
10703
|
+
revokeToken(revocationUrl?: string, userId?: string, accountId?: string): Promise<void>;
|
|
10704
|
+
/**
|
|
10705
|
+
* List account aliases for a user (Authorization Code only)
|
|
10706
|
+
*
|
|
10707
|
+
* @param userId - User identifier (optional)
|
|
10708
|
+
* @returns Array of account aliases (e.g., ['work', 'personal'])
|
|
11169
10709
|
*/
|
|
11170
|
-
|
|
10710
|
+
listAccounts(userId?: string): Promise<string[]>;
|
|
11171
10711
|
private validateConfig;
|
|
11172
10712
|
}
|
|
11173
10713
|
|
|
@@ -11190,6 +10730,10 @@ declare class MemoryStorage implements ITokenStorage {
|
|
|
11190
10730
|
* Get number of stored tokens
|
|
11191
10731
|
*/
|
|
11192
10732
|
size(): number;
|
|
10733
|
+
/**
|
|
10734
|
+
* List all storage keys (for account enumeration)
|
|
10735
|
+
*/
|
|
10736
|
+
listKeys(): Promise<string[]>;
|
|
11193
10737
|
}
|
|
11194
10738
|
|
|
11195
10739
|
/**
|
|
@@ -11214,6 +10758,11 @@ declare class FileStorage implements ITokenStorage {
|
|
|
11214
10758
|
getToken(key: string): Promise<StoredToken$1 | null>;
|
|
11215
10759
|
deleteToken(key: string): Promise<void>;
|
|
11216
10760
|
hasToken(key: string): Promise<boolean>;
|
|
10761
|
+
/**
|
|
10762
|
+
* List all storage keys by decrypting each token file and reading _storageKey.
|
|
10763
|
+
* Falls back to returning hashed filenames for tokens stored before multi-account support.
|
|
10764
|
+
*/
|
|
10765
|
+
listKeys(): Promise<string[]>;
|
|
11217
10766
|
/**
|
|
11218
10767
|
* List all token keys (for debugging)
|
|
11219
10768
|
*/
|
|
@@ -11236,7 +10785,7 @@ declare class FileStorage implements ITokenStorage {
|
|
|
11236
10785
|
/**
|
|
11237
10786
|
* Fetch with automatic authentication using connector's configured auth scheme
|
|
11238
10787
|
*
|
|
11239
|
-
* Same API as standard fetch(), but with additional authProvider and optional userId parameters.
|
|
10788
|
+
* Same API as standard fetch(), but with additional authProvider and optional userId/accountId parameters.
|
|
11240
10789
|
* Authentication is handled automatically based on the connector's configuration:
|
|
11241
10790
|
* - Bearer tokens (GitHub, Slack, Stripe)
|
|
11242
10791
|
* - Bot tokens (Discord)
|
|
@@ -11247,6 +10796,7 @@ declare class FileStorage implements ITokenStorage {
|
|
|
11247
10796
|
* @param options - Standard fetch options (DO NOT set Authorization header - it's added automatically)
|
|
11248
10797
|
* @param authProvider - Name of registered connector (e.g., 'github', 'slack')
|
|
11249
10798
|
* @param userId - Optional user identifier for multi-user support (omit for single-user mode)
|
|
10799
|
+
* @param accountId - Optional account alias for multi-account OAuth (e.g., 'work', 'personal')
|
|
11250
10800
|
* @returns Promise<Response> - Same as standard fetch
|
|
11251
10801
|
*
|
|
11252
10802
|
* @example Single-user mode:
|
|
@@ -11259,37 +10809,28 @@ declare class FileStorage implements ITokenStorage {
|
|
|
11259
10809
|
* const data = await response.json();
|
|
11260
10810
|
* ```
|
|
11261
10811
|
*
|
|
11262
|
-
* @example
|
|
11263
|
-
* ```typescript
|
|
11264
|
-
* const response = await authenticatedFetch(
|
|
11265
|
-
* '/user/repos', // Resolves to https://api.github.com/user/repos
|
|
11266
|
-
* { method: 'GET' },
|
|
11267
|
-
* 'github'
|
|
11268
|
-
* );
|
|
11269
|
-
* const repos = await response.json();
|
|
11270
|
-
* ```
|
|
11271
|
-
*
|
|
11272
|
-
* @example Multi-user mode:
|
|
10812
|
+
* @example Multi-account mode:
|
|
11273
10813
|
* ```typescript
|
|
11274
10814
|
* const response = await authenticatedFetch(
|
|
11275
|
-
* '/
|
|
10815
|
+
* 'https://graph.microsoft.com/v1.0/me',
|
|
11276
10816
|
* { method: 'GET' },
|
|
11277
|
-
* '
|
|
11278
|
-
* '
|
|
10817
|
+
* 'microsoft',
|
|
10818
|
+
* 'alice',
|
|
10819
|
+
* 'work' // Use Alice's work Microsoft account
|
|
11279
10820
|
* );
|
|
11280
|
-
* const repos = await response.json();
|
|
11281
10821
|
* ```
|
|
11282
10822
|
*/
|
|
11283
|
-
declare function authenticatedFetch(url: string | URL, options: RequestInit | undefined, authProvider: string, userId?: string): Promise<Response>;
|
|
10823
|
+
declare function authenticatedFetch(url: string | URL, options: RequestInit | undefined, authProvider: string, userId?: string, accountId?: string): Promise<Response>;
|
|
11284
10824
|
/**
|
|
11285
|
-
* Create an authenticated fetch function bound to a specific connector and optionally a user
|
|
10825
|
+
* Create an authenticated fetch function bound to a specific connector and optionally a user/account
|
|
11286
10826
|
*
|
|
11287
10827
|
* Useful for creating reusable fetch functions for a specific API and/or user.
|
|
11288
10828
|
* Uses connector's configured auth scheme (Bearer, Bot, Basic, custom headers).
|
|
11289
10829
|
*
|
|
11290
10830
|
* @param authProvider - Name of registered connector
|
|
11291
10831
|
* @param userId - Optional user identifier to bind to (omit for single-user mode)
|
|
11292
|
-
* @
|
|
10832
|
+
* @param accountId - Optional account alias for multi-account OAuth (e.g., 'work', 'personal')
|
|
10833
|
+
* @returns Fetch function bound to that connector (and user/account)
|
|
11293
10834
|
*
|
|
11294
10835
|
* @example Single-user mode:
|
|
11295
10836
|
* ```typescript
|
|
@@ -11300,27 +10841,17 @@ declare function authenticatedFetch(url: string | URL, options: RequestInit | un
|
|
|
11300
10841
|
* const emails = await msftFetch('https://graph.microsoft.com/v1.0/me/messages');
|
|
11301
10842
|
* ```
|
|
11302
10843
|
*
|
|
11303
|
-
* @example
|
|
11304
|
-
* ```typescript
|
|
11305
|
-
* const githubFetch = createAuthenticatedFetch('github');
|
|
11306
|
-
*
|
|
11307
|
-
* // Relative URLs resolved against connector's baseURL
|
|
11308
|
-
* const repos = await githubFetch('/user/repos');
|
|
11309
|
-
* const issues = await githubFetch('/user/issues');
|
|
11310
|
-
* ```
|
|
11311
|
-
*
|
|
11312
|
-
* @example Multi-user mode:
|
|
10844
|
+
* @example Multi-account mode:
|
|
11313
10845
|
* ```typescript
|
|
11314
|
-
* // Create fetch
|
|
11315
|
-
* const
|
|
11316
|
-
* const
|
|
10846
|
+
* // Create fetch for Alice's work Microsoft account
|
|
10847
|
+
* const workFetch = createAuthenticatedFetch('microsoft', 'alice', 'work');
|
|
10848
|
+
* const personalFetch = createAuthenticatedFetch('microsoft', 'alice', 'personal');
|
|
11317
10849
|
*
|
|
11318
|
-
*
|
|
11319
|
-
* const
|
|
11320
|
-
* const bobRepos = await bobFetch('/user/repos');
|
|
10850
|
+
* const workEmails = await workFetch('/me/messages');
|
|
10851
|
+
* const personalEmails = await personalFetch('/me/messages');
|
|
11321
10852
|
* ```
|
|
11322
10853
|
*/
|
|
11323
|
-
declare function createAuthenticatedFetch(authProvider: string, userId?: string): (url: string | URL, options?: RequestInit) => Promise<Response>;
|
|
10854
|
+
declare function createAuthenticatedFetch(authProvider: string, userId?: string, accountId?: string): (url: string | URL, options?: RequestInit) => Promise<Response>;
|
|
11324
10855
|
|
|
11325
10856
|
/**
|
|
11326
10857
|
* Tool Generator - Auto-generate tools for registered connectors
|
|
@@ -13491,6 +13022,7 @@ interface MicrosoftFetchOptions {
|
|
|
13491
13022
|
method?: string;
|
|
13492
13023
|
body?: unknown;
|
|
13493
13024
|
userId?: string;
|
|
13025
|
+
accountId?: string;
|
|
13494
13026
|
queryParams?: Record<string, string | number | boolean>;
|
|
13495
13027
|
accept?: string;
|
|
13496
13028
|
}
|
|
@@ -13554,7 +13086,7 @@ declare function isTeamsMeetingUrl(input: string): boolean;
|
|
|
13554
13086
|
* @returns The resolved meeting ID and optional subject
|
|
13555
13087
|
* @throws Error if the URL cannot be resolved or input is empty
|
|
13556
13088
|
*/
|
|
13557
|
-
declare function resolveMeetingId(connector: Connector, input: string, prefix: string, effectiveUserId?: string): Promise<{
|
|
13089
|
+
declare function resolveMeetingId(connector: Connector, input: string, prefix: string, effectiveUserId?: string, effectiveAccountId?: string): Promise<{
|
|
13558
13090
|
meetingId: string;
|
|
13559
13091
|
subject?: string;
|
|
13560
13092
|
}>;
|
|
@@ -14100,7 +13632,7 @@ declare const desktopTools: (ToolFunction<DesktopScreenshotArgs, DesktopScreensh
|
|
|
14100
13632
|
* AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
|
|
14101
13633
|
*
|
|
14102
13634
|
* Generated by: scripts/generate-tool-registry.ts
|
|
14103
|
-
* Generated at: 2026-02-
|
|
13635
|
+
* Generated at: 2026-02-25T20:33:26.091Z
|
|
14104
13636
|
*
|
|
14105
13637
|
* To regenerate: npm run generate:tools
|
|
14106
13638
|
*/
|
|
@@ -14721,4 +14253,4 @@ declare class ProviderConfigAgent {
|
|
|
14721
14253
|
reset(): void;
|
|
14722
14254
|
}
|
|
14723
14255
|
|
|
14724
|
-
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 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, 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 IUserInfoStorage, type IVideoModelDescription, type IVideoProvider, 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, 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 };
|
|
14256
|
+
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 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, 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, 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 ISTTModelDescription, 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 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 RoutineExecutionStatus, type RoutineParameter, 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, 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, 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 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 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, resolveTemplates, retryWithBackoff, sanitizeToolName, setMediaOutputHandler, setMediaStorage, setMetricsCollector, simpleTokenEstimator, toConnectorOptions, toolRegistry, index as tools, updateTaskStatus, validatePath, writeFile };
|