opencode-orchestrator 0.5.16 → 0.5.18
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 +360 -24
- package/dist/agents/subagents/librarian.d.ts +10 -0
- package/dist/agents/subagents/researcher.d.ts +11 -0
- package/dist/core/agents/concurrency.d.ts +2 -6
- package/dist/core/agents/config.d.ts +1 -1
- package/dist/core/agents/consts/index.d.ts +4 -0
- package/dist/core/agents/consts/task-status.const.d.ts +12 -0
- package/dist/core/agents/interfaces/concurrency-config.interface.d.ts +9 -0
- package/dist/core/agents/interfaces/index.d.ts +6 -3
- package/dist/core/agents/interfaces/{parallel-task.d.ts → parallel-task.interface.d.ts} +4 -8
- package/dist/core/agents/interfaces/resume-input.interface.d.ts +17 -0
- package/dist/core/agents/interfaces/task-progress.interface.d.ts +9 -0
- package/dist/core/agents/manager/event-handler.d.ts +34 -0
- package/dist/core/agents/manager/index.d.ts +10 -0
- package/dist/core/agents/manager/task-cleaner.d.ts +17 -0
- package/dist/core/agents/manager/task-launcher.d.ts +20 -0
- package/dist/core/agents/manager/task-poller.d.ts +26 -0
- package/dist/core/agents/manager/task-resumer.d.ts +18 -0
- package/dist/core/agents/manager.d.ts +11 -29
- package/dist/core/agents/task-store.d.ts +29 -3
- package/dist/core/agents/types/index.d.ts +1 -1
- package/dist/core/agents/types/parallel-task-status.type.d.ts +4 -0
- package/dist/core/bus/event-bus.d.ts +53 -0
- package/dist/core/bus/index.d.ts +19 -0
- package/dist/core/bus/interfaces.d.ts +34 -0
- package/dist/core/bus/types.d.ts +12 -0
- package/dist/core/cache/constants.d.ts +6 -0
- package/dist/core/cache/document-cache.d.ts +6 -0
- package/dist/core/cache/index.d.ts +4 -0
- package/dist/core/cache/interfaces.d.ts +53 -0
- package/dist/core/cache/operations.d.ts +36 -0
- package/dist/core/cache/utils.d.ts +20 -0
- package/dist/core/loop/formatters.d.ts +16 -0
- package/dist/core/loop/interfaces.d.ts +34 -0
- package/dist/core/loop/parser.d.ts +8 -0
- package/dist/core/loop/stats.d.ts +24 -0
- package/dist/core/loop/todo-enforcer.d.ts +9 -0
- package/dist/core/notification/event-integration.d.ts +7 -0
- package/dist/core/notification/presets.d.ts +14 -0
- package/dist/core/notification/toast-core.d.ts +28 -0
- package/dist/core/notification/toast.d.ts +9 -0
- package/dist/core/notification/types.d.ts +19 -0
- package/dist/core/orchestrator/types/task-status.d.ts +2 -2
- package/dist/core/progress/calculator.d.ts +11 -0
- package/dist/core/progress/formatters.d.ts +20 -0
- package/dist/core/progress/interfaces.d.ts +54 -0
- package/dist/core/progress/store.d.ts +28 -0
- package/dist/core/progress/tracker.d.ts +11 -0
- package/dist/core/queue/async-queue.d.ts +46 -0
- package/dist/core/queue/async-utils.d.ts +20 -0
- package/dist/core/queue/index.d.ts +8 -0
- package/dist/core/queue/work-pool.d.ts +19 -0
- package/dist/core/recovery/auto-recovery.d.ts +9 -0
- package/dist/core/recovery/constants.d.ts +6 -0
- package/dist/core/recovery/handler.d.ts +27 -0
- package/dist/core/recovery/interfaces.d.ts +63 -0
- package/dist/core/recovery/patterns.d.ts +8 -0
- package/dist/core/session/interfaces.d.ts +53 -0
- package/dist/core/session/shared-context.d.ts +8 -0
- package/dist/core/session/store.d.ts +44 -0
- package/dist/core/session/summary.d.ts +7 -0
- package/dist/core/task/interfaces.d.ts +54 -0
- package/dist/core/task/parser.d.ts +8 -0
- package/dist/core/task/scheduler.d.ts +12 -0
- package/dist/core/task/store.d.ts +32 -0
- package/dist/core/task/summary.d.ts +7 -0
- package/dist/core/task/task-decomposer.d.ts +10 -0
- package/dist/index.d.ts +2 -133
- package/dist/index.js +2600 -675
- package/dist/shared/agent.d.ts +2 -0
- package/dist/shared/constants.d.ts +56 -3
- package/dist/shared/event-types.d.ts +77 -0
- package/dist/tools/background-cmd/list.d.ts +2 -2
- package/dist/tools/parallel/delegate-task.d.ts +3 -0
- package/dist/tools/web/cache-docs.d.ts +21 -0
- package/dist/tools/web/codesearch.d.ts +19 -0
- package/dist/tools/web/index.d.ts +9 -0
- package/dist/tools/web/webfetch.d.ts +19 -0
- package/dist/tools/web/websearch.d.ts +17 -0
- package/package.json +8 -7
- package/dist/core/agents/types/parallel-task-status.d.ts +0 -4
- /package/dist/core/agents/interfaces/{launch-input.d.ts → launch-input.interface.d.ts} +0 -0
|
@@ -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
|
-
*
|
|
2
|
+
* Task Status - Re-export from central location
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
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,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,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,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task Decomposer Interfaces
|
|
3
|
+
*/
|
|
4
|
+
import { TASK_STATUS, ParallelTaskStatus } from "../../shared/constants.js";
|
|
5
|
+
export { TASK_STATUS };
|
|
6
|
+
export type TaskStatus = ParallelTaskStatus;
|
|
7
|
+
/**
|
|
8
|
+
* Single task node
|
|
9
|
+
*/
|
|
10
|
+
export interface TaskNode {
|
|
11
|
+
id: string;
|
|
12
|
+
description: string;
|
|
13
|
+
level: number;
|
|
14
|
+
parent?: string;
|
|
15
|
+
children: string[];
|
|
16
|
+
status: TaskStatus;
|
|
17
|
+
agent?: string;
|
|
18
|
+
parallelGroup?: string;
|
|
19
|
+
dependsOn: string[];
|
|
20
|
+
createdAt: Date;
|
|
21
|
+
startedAt?: Date;
|
|
22
|
+
completedAt?: Date;
|
|
23
|
+
result?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Complete task hierarchy
|
|
27
|
+
*/
|
|
28
|
+
export interface TaskHierarchy {
|
|
29
|
+
rootId: string;
|
|
30
|
+
nodes: Map<string, TaskNode>;
|
|
31
|
+
parallelGroups: Map<string, string[]>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Task progress statistics
|
|
35
|
+
*/
|
|
36
|
+
export interface TaskProgress {
|
|
37
|
+
total: number;
|
|
38
|
+
pending: number;
|
|
39
|
+
running: number;
|
|
40
|
+
completed: number;
|
|
41
|
+
failed: number;
|
|
42
|
+
percentage: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Task creation input
|
|
46
|
+
*/
|
|
47
|
+
export interface TaskInput {
|
|
48
|
+
description: string;
|
|
49
|
+
level: number;
|
|
50
|
+
parentId?: string;
|
|
51
|
+
agent?: string;
|
|
52
|
+
parallelGroup?: string;
|
|
53
|
+
dependsOn?: string[];
|
|
54
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task Parser - Parse hierarchy from Architect output
|
|
3
|
+
*/
|
|
4
|
+
import type { TaskHierarchy } from "./interfaces.js";
|
|
5
|
+
/**
|
|
6
|
+
* Parse task hierarchy from text (Architect output)
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseFromText(sessionId: string, text: string): TaskHierarchy;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task Scheduler - Execution order and dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { TaskNode } from "./interfaces.js";
|
|
5
|
+
/**
|
|
6
|
+
* Get next executable tasks (respecting dependencies)
|
|
7
|
+
*/
|
|
8
|
+
export declare function getNextTasks(sessionId: string): TaskNode[];
|
|
9
|
+
/**
|
|
10
|
+
* Get parallel group tasks that can run together
|
|
11
|
+
*/
|
|
12
|
+
export declare function getParallelBatch(sessionId: string, groupId: string): TaskNode[];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task Store - Hierarchy data management
|
|
3
|
+
*/
|
|
4
|
+
import type { TaskNode, TaskHierarchy, TaskInput, TaskStatus, TaskProgress } from "./interfaces.js";
|
|
5
|
+
/**
|
|
6
|
+
* Create a new task hierarchy
|
|
7
|
+
*/
|
|
8
|
+
export declare function create(sessionId: string, rootDescription: string): TaskHierarchy;
|
|
9
|
+
/**
|
|
10
|
+
* Get hierarchy for session
|
|
11
|
+
*/
|
|
12
|
+
export declare function getHierarchy(sessionId: string): TaskHierarchy | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Add a task node
|
|
15
|
+
*/
|
|
16
|
+
export declare function addTask(sessionId: string, task: TaskInput): TaskNode;
|
|
17
|
+
/**
|
|
18
|
+
* Update task status
|
|
19
|
+
*/
|
|
20
|
+
export declare function updateStatus(sessionId: string, taskId: string, status: TaskStatus, result?: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Clear hierarchy
|
|
23
|
+
*/
|
|
24
|
+
export declare function clear(sessionId: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* Check if all tasks are complete
|
|
27
|
+
*/
|
|
28
|
+
export declare function isComplete(sessionId: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Get progress statistics
|
|
31
|
+
*/
|
|
32
|
+
export declare function getProgress(sessionId: string): TaskProgress;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task Decomposer
|
|
3
|
+
*
|
|
4
|
+
* Automatically decomposes complex tasks into hierarchical subtasks
|
|
5
|
+
*/
|
|
6
|
+
export type { TaskStatus, TaskNode, TaskHierarchy, TaskProgress, TaskInput, } from "./interfaces.js";
|
|
7
|
+
export { create, getHierarchy, addTask, updateStatus, clear, isComplete, getProgress, } from "./store.js";
|
|
8
|
+
export { getNextTasks, getParallelBatch, } from "./scheduler.js";
|
|
9
|
+
export { parseFromText } from "./parser.js";
|
|
10
|
+
export { getSummary } from "./summary.js";
|