mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-05 23:19:43 +02:00
refactor: split types.ts into domain modules (phase 4, step 1)
Split 1,443-line types.ts into 14 focused domain files under src/types/: common.ts, session.ts, task.ts, app-state.ts, respawn.ts, ralph.ts, api.ts, lifecycle.ts, run-summary.ts, tools.ts, teams.ts, push.ts, plan.ts, and index.ts barrel. Moved PlanItem interface from plan-orchestrator.ts into types/plan.ts to break circular dependency. Original types.ts replaced with barrel re-export — zero changes to 36 import sites. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @fileoverview Common/shared type definitions
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interface for objects that hold resources requiring explicit cleanup.
|
||||
* Implementing classes should release timers, watchers, and other resources in dispose().
|
||||
*/
|
||||
export interface Disposable {
|
||||
/** Release all held resources. Safe to call multiple times. */
|
||||
dispose(): void;
|
||||
/** Whether this object has been disposed */
|
||||
readonly isDisposed: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration for buffer accumulator instances.
|
||||
* Used for terminal buffers, text output, and other size-limited string storage.
|
||||
*/
|
||||
export interface BufferConfig {
|
||||
/** Maximum buffer size in bytes before trimming */
|
||||
maxSize: number;
|
||||
/** Size to trim to when maxSize is exceeded */
|
||||
trimSize: number;
|
||||
/** Optional callback invoked when buffer is trimmed */
|
||||
onTrim?: (trimmedBytes: number) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resource types that can be registered for cleanup.
|
||||
*/
|
||||
export type CleanupResourceType = 'timer' | 'interval' | 'watcher' | 'listener' | 'stream';
|
||||
|
||||
/**
|
||||
* Registration entry for a cleanup resource.
|
||||
* Used by CleanupManager to track and dispose resources.
|
||||
*/
|
||||
export interface CleanupRegistration {
|
||||
/** Unique identifier for this registration */
|
||||
id: string;
|
||||
/** Type of resource */
|
||||
type: CleanupResourceType;
|
||||
/** Human-readable description for debugging */
|
||||
description: string;
|
||||
/** Cleanup function to call on dispose */
|
||||
cleanup: () => void;
|
||||
/** Timestamp when registered */
|
||||
registeredAt: number;
|
||||
}
|
||||
Reference in New Issue
Block a user