opencode-orchestrator 0.5.12 → 0.5.17

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.
Files changed (85) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +437 -92
  3. package/dist/agents/subagents/librarian.d.ts +10 -0
  4. package/dist/agents/subagents/researcher.d.ts +11 -0
  5. package/dist/core/agents/concurrency.d.ts +2 -6
  6. package/dist/core/agents/config.d.ts +1 -1
  7. package/dist/core/agents/consts/index.d.ts +4 -0
  8. package/dist/core/agents/consts/task-status.const.d.ts +12 -0
  9. package/dist/core/agents/interfaces/concurrency-config.interface.d.ts +9 -0
  10. package/dist/core/agents/interfaces/index.d.ts +6 -3
  11. package/dist/core/agents/interfaces/{parallel-task.d.ts → parallel-task.interface.d.ts} +4 -8
  12. package/dist/core/agents/interfaces/resume-input.interface.d.ts +17 -0
  13. package/dist/core/agents/interfaces/task-progress.interface.d.ts +9 -0
  14. package/dist/core/agents/manager/event-handler.d.ts +34 -0
  15. package/dist/core/agents/manager/index.d.ts +10 -0
  16. package/dist/core/agents/manager/task-cleaner.d.ts +17 -0
  17. package/dist/core/agents/manager/task-launcher.d.ts +20 -0
  18. package/dist/core/agents/manager/task-poller.d.ts +26 -0
  19. package/dist/core/agents/manager/task-resumer.d.ts +18 -0
  20. package/dist/core/agents/manager.d.ts +11 -29
  21. package/dist/core/agents/task-store.d.ts +29 -3
  22. package/dist/core/agents/types/index.d.ts +1 -1
  23. package/dist/core/agents/types/parallel-task-status.type.d.ts +4 -0
  24. package/dist/core/bus/event-bus.d.ts +53 -0
  25. package/dist/core/bus/index.d.ts +19 -0
  26. package/dist/core/bus/interfaces.d.ts +34 -0
  27. package/dist/core/bus/types.d.ts +12 -0
  28. package/dist/core/cache/constants.d.ts +6 -0
  29. package/dist/core/cache/document-cache.d.ts +6 -0
  30. package/dist/core/cache/index.d.ts +4 -0
  31. package/dist/core/cache/interfaces.d.ts +53 -0
  32. package/dist/core/cache/operations.d.ts +36 -0
  33. package/dist/core/cache/utils.d.ts +20 -0
  34. package/dist/core/loop/formatters.d.ts +16 -0
  35. package/dist/core/loop/interfaces.d.ts +34 -0
  36. package/dist/core/loop/parser.d.ts +8 -0
  37. package/dist/core/loop/stats.d.ts +24 -0
  38. package/dist/core/loop/todo-enforcer.d.ts +9 -0
  39. package/dist/core/notification/event-integration.d.ts +7 -0
  40. package/dist/core/notification/presets.d.ts +14 -0
  41. package/dist/core/notification/toast-core.d.ts +28 -0
  42. package/dist/core/notification/toast.d.ts +9 -0
  43. package/dist/core/notification/types.d.ts +19 -0
  44. package/dist/core/orchestrator/types/task-status.d.ts +2 -2
  45. package/dist/core/progress/calculator.d.ts +11 -0
  46. package/dist/core/progress/formatters.d.ts +20 -0
  47. package/dist/core/progress/interfaces.d.ts +54 -0
  48. package/dist/core/progress/store.d.ts +28 -0
  49. package/dist/core/progress/tracker.d.ts +11 -0
  50. package/dist/core/queue/async-queue.d.ts +46 -0
  51. package/dist/core/queue/async-utils.d.ts +20 -0
  52. package/dist/core/queue/index.d.ts +8 -0
  53. package/dist/core/queue/work-pool.d.ts +19 -0
  54. package/dist/core/recovery/auto-recovery.d.ts +9 -0
  55. package/dist/core/recovery/constants.d.ts +6 -0
  56. package/dist/core/recovery/handler.d.ts +27 -0
  57. package/dist/core/recovery/interfaces.d.ts +63 -0
  58. package/dist/core/recovery/patterns.d.ts +8 -0
  59. package/dist/core/session/interfaces.d.ts +53 -0
  60. package/dist/core/session/shared-context.d.ts +8 -0
  61. package/dist/core/session/store.d.ts +44 -0
  62. package/dist/core/session/summary.d.ts +7 -0
  63. package/dist/core/task/interfaces.d.ts +54 -0
  64. package/dist/core/task/parser.d.ts +8 -0
  65. package/dist/core/task/scheduler.d.ts +12 -0
  66. package/dist/core/task/store.d.ts +32 -0
  67. package/dist/core/task/summary.d.ts +7 -0
  68. package/dist/core/task/task-decomposer.d.ts +10 -0
  69. package/dist/index.d.ts +56 -2
  70. package/dist/index.js +2605 -690
  71. package/dist/scripts/postinstall.js +0 -0
  72. package/dist/scripts/preuninstall.js +0 -0
  73. package/dist/shared/agent.d.ts +2 -0
  74. package/dist/shared/constants.d.ts +56 -3
  75. package/dist/shared/event-types.d.ts +77 -0
  76. package/dist/tools/background-cmd/list.d.ts +2 -2
  77. package/dist/tools/parallel/delegate-task.d.ts +3 -0
  78. package/dist/tools/web/cache-docs.d.ts +21 -0
  79. package/dist/tools/web/codesearch.d.ts +19 -0
  80. package/dist/tools/web/index.d.ts +9 -0
  81. package/dist/tools/web/webfetch.d.ts +19 -0
  82. package/dist/tools/web/websearch.d.ts +17 -0
  83. package/package.json +74 -73
  84. package/dist/core/agents/types/parallel-task-status.d.ts +0 -4
  85. /package/dist/core/agents/interfaces/{launch-input.d.ts → launch-input.interface.d.ts} +0 -0
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Todo Enforcer Interfaces
3
+ */
4
+ /**
5
+ * Todo item status
6
+ */
7
+ export type TodoStatus = "pending" | "in_progress" | "completed" | "cancelled";
8
+ /**
9
+ * Todo item priority
10
+ */
11
+ export type TodoPriority = "high" | "medium" | "low";
12
+ /**
13
+ * Todo item structure
14
+ */
15
+ export interface Todo {
16
+ id: string;
17
+ content: string;
18
+ status: TodoStatus;
19
+ priority: TodoPriority;
20
+ parentId?: string;
21
+ createdAt: Date;
22
+ completedAt?: Date;
23
+ }
24
+ /**
25
+ * Todo statistics
26
+ */
27
+ export interface TodoStats {
28
+ total: number;
29
+ pending: number;
30
+ inProgress: number;
31
+ completed: number;
32
+ cancelled: number;
33
+ percentComplete: number;
34
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Todo Parser - Parse todo data from session
3
+ */
4
+ import type { Todo } from "./interfaces.js";
5
+ /**
6
+ * Parse todos from session todo list
7
+ */
8
+ export declare function parseTodos(todoData: unknown): Todo[];
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Todo Stats - Statistics and queries
3
+ */
4
+ import type { Todo, TodoStats } from "./interfaces.js";
5
+ /**
6
+ * Get count of incomplete todos
7
+ */
8
+ export declare function getIncompleteCount(todos: Todo[]): number;
9
+ /**
10
+ * Check if there's remaining work
11
+ */
12
+ export declare function hasRemainingWork(todos: Todo[]): boolean;
13
+ /**
14
+ * Get next pending todo (highest priority first)
15
+ */
16
+ export declare function getNextPending(todos: Todo[]): Todo | undefined;
17
+ /**
18
+ * Calculate todo statistics
19
+ */
20
+ export declare function getStats(todos: Todo[]): TodoStats;
21
+ /**
22
+ * Check if mission is complete based on todos
23
+ */
24
+ export declare function isMissionComplete(todos: Todo[]): boolean;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Todo Enforcer
3
+ *
4
+ * Ensures all todos are completed before stopping
5
+ */
6
+ export type { Todo, TodoStats, TodoStatus, TodoPriority } from "./interfaces.js";
7
+ export { parseTodos } from "./parser.js";
8
+ export { getIncompleteCount, hasRemainingWork, getNextPending, getStats, isMissionComplete, } from "./stats.js";
9
+ export { formatProgress, generateContinuationPrompt, generateCompletionMessage, } from "./formatters.js";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Event Bus Integration - Auto-subscribe to events
3
+ */
4
+ /**
5
+ * Auto-subscribe to events and show toasts
6
+ */
7
+ export declare function enableAutoToasts(): () => void;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Toast Presets - Common notification messages
3
+ */
4
+ export declare const presets: {
5
+ taskStarted: (taskId: string, agent: string) => import("./types.js").ToastMessage;
6
+ taskCompleted: (taskId: string, agent: string) => import("./types.js").ToastMessage;
7
+ taskFailed: (taskId: string, error: string) => import("./types.js").ToastMessage;
8
+ allTasksComplete: (count: number) => import("./types.js").ToastMessage;
9
+ missionComplete: (summary: string) => import("./types.js").ToastMessage;
10
+ documentCached: (filename: string) => import("./types.js").ToastMessage;
11
+ researchStarted: (topic: string) => import("./types.js").ToastMessage;
12
+ warningRateLimited: () => import("./types.js").ToastMessage;
13
+ errorRecovery: (action: string) => import("./types.js").ToastMessage;
14
+ };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Toast Core - Core notification functions
3
+ */
4
+ import type { ToastMessage, ToastOptions } from "./types.js";
5
+ /**
6
+ * Register a notification handler
7
+ */
8
+ export declare function onToast(handler: (toast: ToastMessage) => void): () => void;
9
+ /**
10
+ * Show a toast notification
11
+ */
12
+ export declare function show(options: ToastOptions): ToastMessage;
13
+ /**
14
+ * Dismiss a toast
15
+ */
16
+ export declare function dismiss(toastId: string): void;
17
+ /**
18
+ * Get active (non-dismissed) toasts
19
+ */
20
+ export declare function getActive(): ToastMessage[];
21
+ /**
22
+ * Get toast history
23
+ */
24
+ export declare function getHistory(limit?: number): ToastMessage[];
25
+ /**
26
+ * Clear all toasts
27
+ */
28
+ export declare function clear(): void;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Toast Notification System
3
+ *
4
+ * Provides notifications for task events, completions, errors
5
+ */
6
+ export type { ToastVariant, ToastMessage, ToastOptions } from "./types.js";
7
+ export { show, dismiss, getActive, getHistory, clear, onToast } from "./toast-core.js";
8
+ export { presets } from "./presets.js";
9
+ export { enableAutoToasts } from "./event-integration.js";
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Toast Types
3
+ */
4
+ export type ToastVariant = "info" | "success" | "warning" | "error";
5
+ export interface ToastMessage {
6
+ id: string;
7
+ title: string;
8
+ message: string;
9
+ variant: ToastVariant;
10
+ timestamp: Date;
11
+ duration: number;
12
+ dismissed: boolean;
13
+ }
14
+ export interface ToastOptions {
15
+ title: string;
16
+ message: string;
17
+ variant?: ToastVariant;
18
+ duration?: number;
19
+ }
@@ -1,4 +1,4 @@
1
1
  /**
2
- * TaskStatus - Status of a task in the DAG
2
+ * Task Status - Re-export from central location
3
3
  */
4
- export type TaskStatus = "pending" | "running" | "completed" | "failed";
4
+ export { TASK_STATUS, ParallelTaskStatus as TaskStatus } from "../../../shared/constants.js";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Progress Calculator - Rate and estimation calculations
3
+ */
4
+ /**
5
+ * Calculate rate (items per minute)
6
+ */
7
+ export declare function calculateRate(sessionId: string): number;
8
+ /**
9
+ * Estimate remaining time in ms
10
+ */
11
+ export declare function estimateRemaining(sessionId: string): number | undefined;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Progress Formatting Utilities
3
+ */
4
+ import type { ProgressSnapshot } from "./interfaces.js";
5
+ /**
6
+ * Format elapsed time
7
+ */
8
+ export declare function formatElapsed(ms: number): string;
9
+ /**
10
+ * Format progress bar
11
+ */
12
+ export declare function formatProgressBar(percentage: number, width?: number): string;
13
+ /**
14
+ * Get formatted progress string
15
+ */
16
+ export declare function formatSnapshot(snapshot: ProgressSnapshot): string;
17
+ /**
18
+ * Get compact progress string (for inline display)
19
+ */
20
+ export declare function formatCompact(snapshot: ProgressSnapshot): string;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Progress Tracker Interfaces
3
+ */
4
+ /**
5
+ * Todo progress data
6
+ */
7
+ export interface TodoProgress {
8
+ total: number;
9
+ completed: number;
10
+ pending: number;
11
+ percentage: number;
12
+ }
13
+ /**
14
+ * Task progress data
15
+ */
16
+ export interface TaskProgress {
17
+ total: number;
18
+ running: number;
19
+ completed: number;
20
+ failed: number;
21
+ percentage: number;
22
+ }
23
+ /**
24
+ * Step progress data
25
+ */
26
+ export interface StepProgress {
27
+ current: number;
28
+ max: number;
29
+ }
30
+ /**
31
+ * Progress snapshot at a point in time
32
+ */
33
+ export interface ProgressSnapshot {
34
+ sessionId: string;
35
+ timestamp: Date;
36
+ todos: TodoProgress;
37
+ tasks: TaskProgress;
38
+ steps: StepProgress;
39
+ startedAt: Date;
40
+ elapsedMs: number;
41
+ }
42
+ /**
43
+ * Input data for recording a snapshot
44
+ */
45
+ export interface SnapshotInput {
46
+ todoTotal?: number;
47
+ todoCompleted?: number;
48
+ taskTotal?: number;
49
+ taskRunning?: number;
50
+ taskCompleted?: number;
51
+ taskFailed?: number;
52
+ currentStep?: number;
53
+ maxSteps?: number;
54
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Progress Store - Session data management
3
+ */
4
+ import type { ProgressSnapshot, SnapshotInput } from "./interfaces.js";
5
+ /**
6
+ * Start tracking a session
7
+ */
8
+ export declare function startSession(sessionId: string): void;
9
+ /**
10
+ * Get session start time
11
+ */
12
+ export declare function getSessionStart(sessionId: string): Date | undefined;
13
+ /**
14
+ * Record a progress snapshot
15
+ */
16
+ export declare function recordSnapshot(sessionId: string, data: SnapshotInput): ProgressSnapshot;
17
+ /**
18
+ * Get latest snapshot
19
+ */
20
+ export declare function getLatest(sessionId: string): ProgressSnapshot | undefined;
21
+ /**
22
+ * Get progress history
23
+ */
24
+ export declare function getHistory(sessionId: string, limit?: number): ProgressSnapshot[];
25
+ /**
26
+ * Clear session data
27
+ */
28
+ export declare function clearSession(sessionId: string): void;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Progress Tracker Module
3
+ *
4
+ * Tracks progress of sessions, tasks, and todos
5
+ */
6
+ export type { TodoProgress, TaskProgress, StepProgress, ProgressSnapshot, SnapshotInput, } from "./interfaces.js";
7
+ export { startSession, getSessionStart, recordSnapshot, getLatest, getHistory, clearSession, } from "./store.js";
8
+ export { formatElapsed, formatProgressBar, formatSnapshot, } from "./formatters.js";
9
+ export { calculateRate, estimateRemaining, } from "./calculator.js";
10
+ export declare function format(sessionId: string): string;
11
+ export declare function formatCompact(sessionId: string): string;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * AsyncQueue - Async iterable queue
3
+ *
4
+ * Useful for producer/consumer patterns
5
+ */
6
+ export declare class AsyncQueue<T> implements AsyncIterable<T> {
7
+ private queue;
8
+ private resolvers;
9
+ private closed;
10
+ /**
11
+ * Push an item to the queue
12
+ */
13
+ push(item: T): void;
14
+ /**
15
+ * Get the next item (blocks if empty)
16
+ */
17
+ next(): Promise<T>;
18
+ /**
19
+ * Try to get an item without blocking
20
+ */
21
+ tryNext(): T | undefined;
22
+ /**
23
+ * Check if queue is empty
24
+ */
25
+ isEmpty(): boolean;
26
+ /**
27
+ * Get current queue length
28
+ */
29
+ get length(): number;
30
+ /**
31
+ * Close the queue (no more items can be added)
32
+ */
33
+ close(): void;
34
+ /**
35
+ * Check if queue is closed
36
+ */
37
+ isClosed(): boolean;
38
+ /**
39
+ * Clear all items
40
+ */
41
+ clear(): void;
42
+ /**
43
+ * Async iterator support
44
+ */
45
+ [Symbol.asyncIterator](): AsyncGenerator<T, void, unknown>;
46
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Async Utilities - Retry, timeout, debounce
3
+ */
4
+ /**
5
+ * Retry with exponential backoff
6
+ */
7
+ export declare function retryWithBackoff<T>(fn: () => Promise<T>, options?: {
8
+ maxRetries?: number;
9
+ initialDelay?: number;
10
+ maxDelay?: number;
11
+ backoffFactor?: number;
12
+ }): Promise<T>;
13
+ /**
14
+ * Timeout wrapper
15
+ */
16
+ export declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, errorMessage?: string): Promise<T>;
17
+ /**
18
+ * Debounce async function
19
+ */
20
+ export declare function debounceAsync<T extends (...args: any[]) => Promise<any>>(fn: T, delayMs: number): T;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * AsyncQueue & Work Pool
3
+ *
4
+ * Utilities for async iteration and concurrent work processing
5
+ */
6
+ export { AsyncQueue } from "./async-queue.js";
7
+ export { workPool, workPoolWithResults, processBatches } from "./work-pool.js";
8
+ export { retryWithBackoff, withTimeout, debounceAsync } from "./async-utils.js";
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Work Pool - Concurrent task execution utilities
3
+ */
4
+ /**
5
+ * Work Pool - Concurrent task execution with limit
6
+ *
7
+ * @param concurrency - Maximum concurrent tasks
8
+ * @param items - Items to process
9
+ * @param fn - Processing function
10
+ */
11
+ export declare function workPool<T>(concurrency: number, items: T[], fn: (item: T, index: number) => Promise<void>): Promise<void>;
12
+ /**
13
+ * Work Pool with results - Returns results in order
14
+ */
15
+ export declare function workPoolWithResults<T, R>(concurrency: number, items: T[], fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
16
+ /**
17
+ * Batch processing - Process items in batches
18
+ */
19
+ export declare function processBatches<T, R>(items: T[], batchSize: number, fn: (batch: T[]) => Promise<R[]>): Promise<R[]>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Auto Recovery System
3
+ *
4
+ * Automatically handles and recovers from common errors
5
+ */
6
+ export type { RecoveryAction, ErrorContext, ErrorPattern, RecoveryRecord, RecoveryStats, } from "./interfaces.js";
7
+ export { MAX_RETRIES, BASE_DELAY, MAX_HISTORY } from "./constants.js";
8
+ export { errorPatterns } from "./patterns.js";
9
+ export { handleError, withRecovery, getStats, getHistory, clearSession, } from "./handler.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Recovery Constants
3
+ */
4
+ export declare const MAX_RETRIES = 3;
5
+ export declare const BASE_DELAY = 1000;
6
+ export declare const MAX_HISTORY = 100;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Recovery Handler - Core error handling logic
3
+ */
4
+ import type { ErrorContext, RecoveryAction, RecoveryRecord, RecoveryStats } from "./interfaces.js";
5
+ /**
6
+ * Handle an error and determine recovery action
7
+ */
8
+ export declare function handleError(context: ErrorContext): RecoveryAction;
9
+ /**
10
+ * Execute a function with auto-recovery
11
+ */
12
+ export declare function withRecovery<T>(sessionId: string, fn: () => Promise<T>, options?: {
13
+ maxRetries?: number;
14
+ onRetry?: (action: RecoveryAction) => void;
15
+ }): Promise<T>;
16
+ /**
17
+ * Get recovery statistics
18
+ */
19
+ export declare function getStats(): RecoveryStats;
20
+ /**
21
+ * Get recent recovery history
22
+ */
23
+ export declare function getHistory(limit?: number): RecoveryRecord[];
24
+ /**
25
+ * Clear error counts for a session
26
+ */
27
+ export declare function clearSession(sessionId: string): void;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Auto Recovery Interfaces & Types
3
+ */
4
+ /**
5
+ * Recovery action types
6
+ */
7
+ export type RecoveryAction = {
8
+ type: "retry";
9
+ delay: number;
10
+ attempt: number;
11
+ } | {
12
+ type: "skip";
13
+ reason: string;
14
+ } | {
15
+ type: "escalate";
16
+ to: string;
17
+ reason: string;
18
+ } | {
19
+ type: "resume";
20
+ sessionId: string;
21
+ } | {
22
+ type: "compact";
23
+ reason: string;
24
+ } | {
25
+ type: "abort";
26
+ reason: string;
27
+ };
28
+ /**
29
+ * Error context for recovery
30
+ */
31
+ export interface ErrorContext {
32
+ sessionId: string;
33
+ taskId?: string;
34
+ agent?: string;
35
+ error: Error;
36
+ attempt: number;
37
+ timestamp: Date;
38
+ }
39
+ /**
40
+ * Error pattern definition
41
+ */
42
+ export interface ErrorPattern {
43
+ pattern: RegExp | string;
44
+ category: string;
45
+ handler: (context: ErrorContext) => RecoveryAction;
46
+ }
47
+ /**
48
+ * Recovery history entry
49
+ */
50
+ export interface RecoveryRecord {
51
+ context: ErrorContext;
52
+ action: RecoveryAction;
53
+ timestamp: Date;
54
+ }
55
+ /**
56
+ * Recovery statistics
57
+ */
58
+ export interface RecoveryStats {
59
+ totalRecoveries: number;
60
+ byCategory: Record<string, number>;
61
+ byAction: Record<string, number>;
62
+ successRate: number;
63
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Error Patterns - Recovery strategies for common errors
3
+ */
4
+ import type { ErrorPattern } from "./interfaces.js";
5
+ /**
6
+ * Error patterns and their recovery strategies
7
+ */
8
+ export declare const errorPatterns: ErrorPattern[];
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Shared Context Interfaces
3
+ */
4
+ /**
5
+ * Cached document reference
6
+ */
7
+ export interface SharedDocument {
8
+ url: string;
9
+ filename: string;
10
+ title: string;
11
+ cachedAt: Date;
12
+ }
13
+ /**
14
+ * Research finding
15
+ */
16
+ export interface SharedFinding {
17
+ id: string;
18
+ content: string;
19
+ source: string;
20
+ timestamp: Date;
21
+ category: "pattern" | "api" | "config" | "warning" | "decision";
22
+ }
23
+ /**
24
+ * Decision record
25
+ */
26
+ export interface SharedDecision {
27
+ id: string;
28
+ question: string;
29
+ answer: string;
30
+ rationale: string;
31
+ decidedAt: Date;
32
+ }
33
+ /**
34
+ * Complete shared context
35
+ */
36
+ export interface SharedContext {
37
+ sessionId: string;
38
+ parentId?: string;
39
+ documents: Map<string, SharedDocument>;
40
+ findings: SharedFinding[];
41
+ decisions: Map<string, SharedDecision>;
42
+ createdAt: Date;
43
+ updatedAt: Date;
44
+ }
45
+ /**
46
+ * Context statistics
47
+ */
48
+ export interface ContextStats {
49
+ totalContexts: number;
50
+ totalDocuments: number;
51
+ totalFindings: number;
52
+ totalDecisions: number;
53
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Session Shared Context
3
+ *
4
+ * Enables context sharing between parent and child sessions
5
+ */
6
+ export type { SharedDocument, SharedFinding, SharedDecision, SharedContext, ContextStats, } from "./interfaces.js";
7
+ export { create, get, getMerged, addDocument, addFinding, addDecision, getChildren, clear, clearAll, getStats, } from "./store.js";
8
+ export { getSummary } from "./summary.js";
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Context Store - Session context data management
3
+ */
4
+ import type { SharedContext, SharedDocument, SharedFinding, SharedDecision, ContextStats } from "./interfaces.js";
5
+ /**
6
+ * Create a new shared context for a session
7
+ */
8
+ export declare function create(sessionId: string, parentId?: string): SharedContext;
9
+ /**
10
+ * Get shared context for a session
11
+ */
12
+ export declare function get(sessionId: string): SharedContext | undefined;
13
+ /**
14
+ * Get merged context (includes parent context)
15
+ */
16
+ export declare function getMerged(sessionId: string): SharedContext | undefined;
17
+ /**
18
+ * Add a document to the shared context
19
+ */
20
+ export declare function addDocument(sessionId: string, doc: SharedDocument): void;
21
+ /**
22
+ * Add a finding to the shared context
23
+ */
24
+ export declare function addFinding(sessionId: string, finding: Omit<SharedFinding, "id" | "timestamp">): void;
25
+ /**
26
+ * Record a decision
27
+ */
28
+ export declare function addDecision(sessionId: string, decision: Omit<SharedDecision, "id" | "decidedAt">): void;
29
+ /**
30
+ * Get all child session IDs
31
+ */
32
+ export declare function getChildren(parentId: string): string[];
33
+ /**
34
+ * Clear context for a session
35
+ */
36
+ export declare function clear(sessionId: string): void;
37
+ /**
38
+ * Clear all contexts
39
+ */
40
+ export declare function clearAll(): void;
41
+ /**
42
+ * Get stats
43
+ */
44
+ export declare function getStats(): ContextStats;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Context Summary - Generate prompt summaries
3
+ */
4
+ /**
5
+ * Get context summary for injection into prompts
6
+ */
7
+ export declare function getSummary(sessionId: string): string;