omnara 0.2.4 → 0.3.0

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 (33) hide show
  1. package/bin/omnara.js +5 -0
  2. package/dist/auth/auth-provider.d.ts +2 -0
  3. package/dist/auth/credential-manager.d.ts +5 -1
  4. package/dist/auth/credentials-store.d.ts +2 -1
  5. package/dist/auth/supabase-client.d.ts +1 -1
  6. package/dist/cli.js +2378 -2937
  7. package/dist/cli.js.map +4 -4
  8. package/dist/commands/index.d.ts +1 -0
  9. package/dist/commands/kill.d.ts +2 -0
  10. package/dist/daemon/daemon-launcher.d.ts +7 -0
  11. package/dist/daemon/paths.d.ts +7 -0
  12. package/dist/daemon/session-runner.d.ts +1 -1
  13. package/dist/env/env-mode.d.ts +2 -0
  14. package/dist/orchestrator/agent-orchestrator.d.ts +39 -44
  15. package/dist/orchestrator/ai-client.d.ts +7 -6
  16. package/dist/orchestrator/orchestrator-types.d.ts +3 -2
  17. package/dist/orchestrator/session.d.ts +59 -38
  18. package/dist/orchestrator/tools/worker-tools.d.ts +2 -0
  19. package/dist/orchestrator/utils/envelope-utils.d.ts +13 -0
  20. package/dist/orchestrator/utils/index.d.ts +1 -2
  21. package/dist/orchestrator/utils/worker-events.d.ts +7 -0
  22. package/dist/orchestrator/utils/worktree-manager.d.ts +21 -146
  23. package/dist/orchestrator/worker-manager.d.ts +44 -99
  24. package/dist/orchestrator/worker-types.d.ts +23 -0
  25. package/dist/relay/relay-bridge.d.ts +2 -10
  26. package/dist/utils/logger.d.ts +15 -0
  27. package/instrument.mjs +14 -0
  28. package/package.json +6 -2
  29. package/scripts/test-preinstall.js +0 -1
  30. package/dist/daemon/file-logger.d.ts +0 -24
  31. package/dist/daemon/session-log-manager.d.ts +0 -10
  32. package/dist/orchestrator/tools/worker-status-tool.d.ts +0 -7
  33. package/dist/orchestrator/utils/async-queue.d.ts +0 -26
@@ -1,3 +1,4 @@
1
1
  export { runAgentOrchestrator, type OrchestratorOptions } from './agent.js';
2
2
  export { buildAuthCommand } from './auth.js';
3
3
  export { buildDaemonCommand } from './daemon.js';
4
+ export { buildKillCommand } from './kill.js';
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function buildKillCommand(): Command;
@@ -28,3 +28,10 @@ export declare function startDaemon(options?: StartDaemonOptions): Promise<boole
28
28
  export declare function stopDaemon(options?: StopDaemonOptions): Promise<boolean>;
29
29
  export declare function showDaemonStatus(options?: StatusOptions): Promise<void>;
30
30
  export declare function killAllDaemonProcesses(options?: KillAllOptions): Promise<void>;
31
+ export declare function killDaemonByState(options?: {
32
+ logger?: Logger;
33
+ dev?: boolean;
34
+ }): Promise<void>;
35
+ export declare function killSessionsByRegistry(options?: {
36
+ logger?: Logger;
37
+ }): Promise<void>;
@@ -1,3 +1,10 @@
1
+ export declare function getDaemonPaths(devOverride?: boolean): {
2
+ homeDir: string;
3
+ configPath: string;
4
+ statePath: string;
5
+ daemonLogDir: string;
6
+ userSessionLogRoot: string;
7
+ };
1
8
  export declare const OMNARA_HOME_DIR: string;
2
9
  export declare const DAEMON_CONFIG_PATH: string;
3
10
  export declare const DAEMON_STATE_PATH: string;
@@ -1,6 +1,6 @@
1
- import type { Logger } from '../utils/logger.js';
2
1
  import type { WorkspaceConfig } from '@omnara/shared-js/schemas';
3
2
  import { DirectoryRegistry } from './directory-registry.js';
3
+ import { type Logger } from '../utils/logger.js';
4
4
  export interface SessionManagerOptions {
5
5
  backendUrl: string;
6
6
  frontendUrl?: string;
@@ -0,0 +1,2 @@
1
+ export declare function isDevEnv(): boolean;
2
+ export declare function getOmnaraHome(devOverride?: boolean): string;
@@ -1,79 +1,74 @@
1
+ import type { McpServerConfig } from '@anthropic-ai/claude-agent-sdk';
1
2
  import { type AgentClient } from './ai-client.js';
2
3
  import { Session } from './session.js';
3
4
  import { WorkerManager } from './worker-manager.js';
4
- import type { InboundMessage, OutboundMessage } from './orchestrator-types.js';
5
- import { type McpServerConfig } from '@anthropic-ai/claude-agent-sdk';
6
- import type { ControlMessageSchema } from '@omnara/shared-js/schemas';
5
+ import type { InboundMessage } from './orchestrator-types.js';
6
+ import type { ControlMessageSchema, MessageEnvelope } from '@omnara/shared-js/schemas';
7
7
  interface AgentOrchestratorDependencies {
8
8
  createMainClient?: () => AgentClient;
9
9
  createWorkerClient?: (mcpServers?: Record<string, McpServerConfig>, cwd?: string) => AgentClient;
10
10
  workerManager?: WorkerManager;
11
11
  repoPath?: string;
12
- worktreesEnabled?: boolean;
13
- worktreesBaseRef?: string;
14
12
  }
15
- export interface AgentOrchestratorClientAdapter {
16
- send: (message: OutboundMessage) => void;
13
+ type OrchestratorControlMessage = {
14
+ type: 'session_init';
15
+ sessionId: string;
16
+ parentSessionId?: string | null;
17
+ metadata?: Record<string, unknown>;
18
+ };
19
+ export interface AgentOrchestratorOutputChannel {
20
+ sendEnvelope: (message: MessageEnvelope) => Promise<void> | void;
21
+ sendControl?: (message: OrchestratorControlMessage) => Promise<void> | void;
17
22
  canSend?: () => boolean;
18
23
  close?: () => void;
19
24
  }
20
- export interface AgentOrchestratorConnection {
21
- id: string;
25
+ export interface AgentOrchestratorInputChannel {
22
26
  dispatch(message: InboundMessage): void;
23
27
  disconnect(): void;
24
28
  }
25
29
  export declare class AgentOrchestrator {
26
- private readonly completionsManager;
27
30
  private readonly aiClient;
28
31
  private readonly workerManager;
29
- private readonly sessions;
30
32
  private readonly clients;
31
33
  private readonly toolUseMap;
32
- private mainCodingSessionId;
33
- readonly voiceSessionIds: Set<string>;
34
- private readonly workerSessionIds;
34
+ private readonly completionsManager;
35
+ private session;
35
36
  private started;
37
+ private mainSessionId;
38
+ readonly voiceSessionIds: Set<string>;
36
39
  constructor(dependencies?: AgentOrchestratorDependencies);
37
- ensureSessionExists(sessionId: string): Session;
38
- getSession(sessionId: string): Session | undefined;
40
+ ensureSessionExists(requestedSessionId: string): Session;
39
41
  getWorkerManager(): WorkerManager;
40
42
  setMainCodingSessionId(sessionId: string): void;
41
- addClient(adapter: AgentOrchestratorClientAdapter): AgentOrchestratorConnection;
43
+ addClient(output: AgentOrchestratorOutputChannel): AgentOrchestratorInputChannel;
42
44
  start(): Promise<void>;
43
45
  stop(): Promise<void>;
44
46
  cancel(): Promise<void>;
45
- private handleDisconnect;
47
+ getCompletions(request: ControlMessageSchema.CompletionsRequest): Promise<ControlMessageSchema.CompletionsResponse>;
48
+ private bindSession;
49
+ private handleSessionControl;
50
+ private handleSessionMessage;
51
+ private handleSessionComplete;
52
+ private handleWorkerMessage;
53
+ private handleWorkerComplete;
54
+ private emitSessionInit;
55
+ private enqueueWorkerSummary;
46
56
  private handleClientMessage;
47
57
  private handleSessionInit;
48
58
  private handleChatMessage;
49
- private handleJoin;
50
- private handleLeave;
51
59
  private handleCancelWorker;
52
- /**
53
- * Route a user message directly to a worker's message queue.
54
- * This allows users to send messages to subagent sessions from the frontend.
55
- */
56
- private routeMessageToWorker;
57
- private createSession;
58
- private registerToolUse;
60
+ private broadcastEnvelope;
61
+ private broadcastControl;
62
+ private sendToConnection;
63
+ private forwardEnvelope;
64
+ private shouldMirrorToMain;
65
+ private mirrorEnvelope;
66
+ private trackToolUse;
59
67
  private consumeToolUse;
60
- private handleSessionEmpty;
61
- private registerWorkerListeners;
62
- private broadcastAgentProgress;
63
- private buildAgentProgress;
64
- private handleWorkerSessionStart;
65
- private handleWorkerMessage;
66
- private handleWorkerCompletion;
67
- private buildWorkerSummary;
68
- /**
69
- * Build a comprehensive worker status message showing ALL workers,
70
- * with special highlighting for the worker that triggered this generation.
71
- */
72
- private buildWorkerStatusMessage;
73
- private broadcastToAll;
74
68
  private findSessionIdBySdkSession;
75
- private sendToConnection;
76
- getCompletions(request: ControlMessageSchema.CompletionsRequest): Promise<ControlMessageSchema.CompletionsResponse>;
69
+ private buildSystemPrompt;
70
+ private buildCurrentWorkerStatus;
71
+ private escapeXml;
77
72
  }
78
73
  export declare function startAgentOrchestrator(dependencies?: AgentOrchestratorDependencies): Promise<AgentOrchestrator>;
79
- export {};
74
+ export type { OrchestratorControlMessage };
@@ -1,20 +1,21 @@
1
- import { type Options, type Query, type SDKMessage, type SDKUserMessage } from '@anthropic-ai/claude-agent-sdk';
1
+ import { type Options, type SDKMessage, type SDKUserMessage } from '@anthropic-ai/claude-agent-sdk';
2
2
  export interface AIClientConfig {
3
3
  defaults?: Partial<Options>;
4
4
  }
5
5
  export interface AgentClient {
6
- streamUserMessage(prompt: string, overrides?: Partial<Options>): AsyncIterable<SDKMessage>;
7
- createQuery(prompt: string | AsyncIterable<SDKUserMessage>, overrides?: Partial<Options>): Query;
6
+ isGenerating(): boolean;
7
+ streamUserMessage(prompt: string | AsyncIterable<SDKUserMessage>, overrides?: Partial<Options>): AsyncIterable<SDKMessage>;
8
8
  cancel(): Promise<void>;
9
9
  }
10
10
  export declare const BASE_ALLOWED_ORCHESTRATOR_TOOLS: readonly ["Glob", "Grep", "LS", "Read", "WebFetch", "WebSearch", "TodoWrite"];
11
11
  export declare const BASE_ALLOWED_WORKER_TOOLS: readonly ["Task", "Bash", "Glob", "Grep", "LS", "ExitPlanMode", "Read", "Edit", "MultiEdit", "Write", "NotebookEdit", "WebFetch", "TodoWrite", "WebSearch", "BashOutput", "KillBash", "Skill", "SlashCommand"];
12
12
  export declare class AIClient implements AgentClient {
13
13
  private readonly baseOptions;
14
- private runningQuery?;
14
+ private query?;
15
15
  constructor(config?: AIClientConfig);
16
- streamUserMessage(prompt: string, overrides?: Partial<Options>): AsyncIterable<SDKMessage>;
17
- createQuery(prompt: string | AsyncIterable<SDKUserMessage>, overrides?: Partial<Options>): Query;
16
+ streamUserMessage(prompt: string | AsyncIterable<SDKUserMessage>, overrides?: Partial<Options>): AsyncIterable<SDKMessage>;
17
+ private createQuery;
18
18
  cancel(): Promise<void>;
19
+ isGenerating(): boolean;
19
20
  private ensureWorkingDirectory;
20
21
  }
@@ -14,14 +14,14 @@ export declare const inboundMessageSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
14
14
  senderId: z.ZodOptional<z.ZodString>;
15
15
  senderKind: z.ZodOptional<z.ZodEnum<["user", "agent_session"]>>;
16
16
  }, "strip", z.ZodTypeAny, {
17
- type: "chat";
18
17
  text: string;
18
+ type: "chat";
19
19
  sessionId?: string | undefined;
20
20
  senderId?: string | undefined;
21
21
  senderKind?: "user" | "agent_session" | undefined;
22
22
  }, {
23
- type: "chat";
24
23
  text: string;
24
+ type: "chat";
25
25
  sessionId?: string | undefined;
26
26
  senderId?: string | undefined;
27
27
  senderKind?: "user" | "agent_session" | undefined;
@@ -101,6 +101,7 @@ export type OutboundMessage = {
101
101
  origin?: 'user' | 'worker';
102
102
  workerId?: string;
103
103
  workerTask?: string;
104
+ metadata?: Record<string, unknown>;
104
105
  messageId?: string;
105
106
  } | {
106
107
  type: 'assistant_text';
@@ -1,41 +1,62 @@
1
+ import { type SDKUserMessage } from '@anthropic-ai/claude-agent-sdk';
1
2
  import type { AgentClient } from './ai-client.js';
2
- import type { SessionSubscriber } from './orchestrator-types.js';
3
- type StreamEvent = {
4
- type: string;
5
- [key: string]: unknown;
6
- };
7
- type ToolUseCallback = (toolUseId: string, sessionId: string) => void;
8
- export declare class Session {
9
- readonly id: string;
10
- private readonly aiClient;
11
- private readonly subscribers;
12
- private readonly onEmpty;
13
- private readonly onToolUse?;
14
- private readonly logger;
15
- private sdkSessionId;
16
- private inflight;
17
- private lastActivity;
18
- constructor(id: string, aiClient: AgentClient, onEmpty: (sessionId: string) => void, onToolUse?: ToolUseCallback);
19
- announceInboundMessage(text: string, origin?: 'user' | 'worker', workerId?: string, workerTask?: string): void;
20
- get lastActiveAt(): number;
21
- get sdkSessionIdentifier(): string | null;
22
- subscribe(subscriber: SessionSubscriber): void;
23
- unsubscribe(subscriberId: string): void;
24
- hasSubscribers(): boolean;
25
- close(): void;
26
- enqueueUserMessage(text: string, metadata?: {
27
- triggeredBy?: string;
28
- workerId?: string;
29
- workerTask?: string;
30
- }): void;
31
- handleStreamEvent(event: StreamEvent): void;
32
- private processUserMessage;
33
- private routeSdkMessage;
34
- private handleAssistantMessage;
35
- private handleResultMessage;
36
- private handleSystemMessage;
37
- logInbound(payload: unknown): void;
38
- private broadcast;
39
- private safeSend;
3
+ import type { MessageEnvelope, MessageEnvelopeSchema } from '@omnara/shared-js/schemas';
4
+ interface UserTextSender extends MessageEnvelopeSchema.SenderRef {
5
+ kind: 'user';
6
+ }
7
+ interface UserTextPayload extends MessageEnvelopeSchema.MessagePayload {
8
+ content: MessageEnvelopeSchema.TextContent;
9
+ }
10
+ export interface UserTextEnvelope extends MessageEnvelope {
11
+ sender: UserTextSender;
12
+ payload: UserTextPayload;
13
+ }
14
+ interface CompletePayload extends MessageEnvelopeSchema.MessagePayload {
15
+ content: MessageEnvelopeSchema.AgentCompleteContent;
16
+ }
17
+ export interface CompleteMessageEnvelope extends MessageEnvelope {
18
+ payload: CompletePayload;
19
+ }
20
+ export interface SessionInitNotification {
21
+ type: 'session_init';
22
+ sessionId: string;
23
+ parentSessionId: string | null;
24
+ metadata?: Record<string, unknown>;
25
+ }
26
+ interface SessionOptions {
27
+ parentSessionId?: string | null;
28
+ metadata?: Record<string, unknown>;
29
+ sessionType?: string;
30
+ summarize?: boolean;
31
+ }
32
+ export declare class Session implements AsyncIterable<SDKUserMessage> {
33
+ id: string;
34
+ private ai;
35
+ sdkSessionIdentifier?: string;
36
+ private envelopeSubscribers;
37
+ private sessionInitSubscribers;
38
+ private queue;
39
+ private generating;
40
+ private announcementPromise;
41
+ private announced;
42
+ private shouldSummarize;
43
+ private systemPromptProvider?;
44
+ private readonly sessionInitControl;
45
+ constructor(id: string, ai: AgentClient, options?: SessionOptions);
46
+ enqueue(message: UserTextEnvelope): void;
47
+ [Symbol.asyncIterator](): AsyncIterator<SDKUserMessage>;
48
+ private generate;
49
+ private startGenerate;
50
+ private captureSdkSessionId;
51
+ private collectAssistantSummaryBlocks;
52
+ private buildCompletionEnvelope;
53
+ private summarize;
54
+ private emitProgress;
55
+ onEnvelope(cb: (msg: MessageEnvelope) => void | Promise<void>): void;
56
+ onSessionInit(cb: (control: SessionInitNotification) => void | Promise<void>): void;
57
+ setSystemPromptProvider(provider: () => string | Promise<string>): void;
58
+ cancel(): Promise<void>;
59
+ private dispatchEnvelope;
60
+ private emitSessionInit;
40
61
  }
41
62
  export {};
@@ -1,4 +1,6 @@
1
1
  import type { WorkerManager } from '../worker-manager.js';
2
+ export declare const WORKER_LAUNCH_TOOL = "mcp__worker__launch_worker";
3
+ export declare const WORKER_MESSAGE_TOOL = "mcp__worker__message_worker";
2
4
  interface WorkerMcpContext {
3
5
  resolveSessionIdBySdk: (sdkSessionId?: string) => string | undefined;
4
6
  resolveSessionIdByToolUse: (toolUseId: string) => string | undefined;
@@ -0,0 +1,13 @@
1
+ import type { SDKMessage } from '@anthropic-ai/claude-agent-sdk';
2
+ import type { MessageEnvelope, MessageEnvelopeSchema } from '@omnara/shared-js/schemas';
3
+ type TextBlock = {
4
+ type: 'text';
5
+ text: string;
6
+ };
7
+ export declare function createEnvelope(sessionId: string, content: MessageEnvelopeSchema.Content, senderId?: string, metadata?: Record<string, unknown>, payloadMetadata?: Record<string, unknown>): MessageEnvelope;
8
+ export declare function toMessageEnvelopes(message: SDKMessage, sessionId: string): MessageEnvelope[];
9
+ export declare function normalizeToolArguments(input: unknown): Record<string, unknown>;
10
+ export declare function normalizeToolResult(output: unknown): Record<string, unknown>;
11
+ export declare function isTextBlock(block: unknown): block is TextBlock;
12
+ export declare function extractTextDelta(message: SDKMessage): string | null;
13
+ export {};
@@ -1,3 +1,2 @@
1
- export { WorktreeManager, WorktreeError, type WorktreeManagerOptions, type WorktreeInfo, } from './worktree-manager.js';
2
- export { AsyncQueue } from './async-queue.js';
1
+ export { WorktreeManager } from './worktree-manager.js';
3
2
  export type { SessionLogger } from './session-logger.js';
@@ -0,0 +1,7 @@
1
+ import type { WorkerRecord } from '../worker-types.js';
2
+ import type { OutboundMessage } from '../orchestrator-types.js';
3
+ export declare function formatWorkerSummary(record: WorkerRecord, override?: string): string;
4
+ export declare function createWorkerProgressMessage(record: WorkerRecord): OutboundMessage;
5
+ export declare function createWorkerCompletionMessage(record: WorkerRecord, summary: string): OutboundMessage;
6
+ export declare function buildWorkerCompletionPrompt(record: WorkerRecord): string;
7
+ export declare function buildAgentCompletionMessage(resultText: string | null, summary: string, errorText: string | null): string;
@@ -1,153 +1,27 @@
1
1
  import { type SimpleGit } from 'simple-git';
2
- /**
3
- * Configuration options for WorktreeManager
4
- */
5
- export interface WorktreeManagerOptions {
6
- /**
7
- * The root directory of the git repository
8
- */
9
- repoPath: string;
10
- /**
11
- * Base directory for worktrees (default: .omnara/worktrees)
12
- */
13
- worktreeBasePath?: string;
14
- /**
15
- * Whether worktrees are enabled (default: false)
16
- */
17
- enabled?: boolean;
18
- /**
19
- * Base ref to use when creating new branches (optional)
20
- */
21
- base_ref?: string;
22
- }
23
- /**
24
- * Information about a created worktree
25
- */
26
- export interface WorktreeInfo {
27
- /**
28
- * Unique identifier for the worker
29
- */
30
- workerId: string;
31
- /**
32
- * Semantic name for the worktree (e.g., "main-feature", "bugfix-auth")
33
- */
34
- worktreeName: string;
35
- /**
36
- * Absolute path to the worktree directory
37
- */
38
- worktreePath: string;
39
- /**
40
- * Name of the branch created for this worktree
41
- */
42
- branchName: string;
43
- /**
44
- * Timestamp when the worktree was created
45
- */
46
- createdAt: Date;
47
- }
48
- /**
49
- * Error thrown when worktree operations fail
50
- */
51
- export declare class WorktreeError extends Error {
52
- readonly workerId: string;
53
- readonly operation: string;
54
- readonly cause?: Error | undefined;
55
- constructor(message: string, workerId: string, operation: string, cause?: Error | undefined);
56
- }
57
- /**
58
- * Manages git worktrees for worker isolation
59
- *
60
- * This class handles the lifecycle of git worktrees, ensuring each worker
61
- * operates in an isolated environment. It provides methods for creating,
62
- * managing, and cleaning up worktrees.
63
- *
64
- * @example
65
- * ```typescript
66
- * const manager = new WorktreeManager({ repoPath: '/path/to/repo' });
67
- * const info = await manager.createWorktree('worker-123', 'main-feature');
68
- * // Worker operates in info.worktreePath
69
- * await manager.removeWorktree('worker-123');
70
- * ```
71
- */
2
+ import type { WorkspaceConfigSchema } from '@omnara/shared-js/schemas';
72
3
  export declare class WorktreeManager {
4
+ private repoPath;
73
5
  readonly git: SimpleGit;
74
- private readonly repoPath;
75
- private readonly worktreeBasePath;
76
- private readonly activeWorktrees;
77
- private readonly enabled;
78
- private readonly base_ref?;
79
- private readonly creationQueue;
80
- private isProcessingQueue;
81
- private readonly worktreesByName;
82
- constructor(options: WorktreeManagerOptions);
83
- /**
84
- * Find a valid base ref to use when creating new branches
85
- * Tries in order: configured base_ref, main, master, origin/HEAD
86
- * @returns The first valid ref found, or undefined if none exist
87
- */
88
- findValidBaseRef(): Promise<string | undefined>;
89
- /**
90
- * Validate that the repoPath is a git repository
91
- * Logs an error if worktrees are enabled but not in a git repository
92
- */
93
- private validateGitRepository;
94
- /**
95
- * Check if worktrees are enabled
96
- */
97
- isEnabled(): boolean;
98
- /**
99
- * Creates a new worktree for the specified worker
100
- *
101
- * This method uses a sequential queue to ensure that worktree creation
102
- * happens one at a time, eliminating race conditions when multiple workers
103
- * request the same worktree simultaneously.
104
- *
105
- * @param workerId - Unique identifier for the worker
106
- * @param worktreeName - Semantic name for the worktree (e.g., "main-feature", "bugfix-auth")
107
- * @returns Information about the created worktree
108
- * @throws {WorktreeError} If worktree creation fails
109
- */
110
- createWorktree(workerId: string, worktreeName: string): Promise<WorktreeInfo>;
111
- /**
112
- * Processes the creation queue sequentially
113
- * Ensures only one worktree creation happens at a time
114
- */
115
- private processCreationQueue;
6
+ private repoName;
7
+ private readonly worktrees;
8
+ private worktreeUsers;
9
+ private worktreeBasePath;
10
+ constructor(repoPath: string);
11
+ getWorktreeConfig(): Promise<WorkspaceConfigSchema.WorktreeSettings | undefined>;
12
+ getWorktreeDirectory(worktreeName: string, workerId: string): Promise<string>;
116
13
  /**
117
14
  * Internal method that performs the actual worktree creation
118
15
  * This should only be called by processCreationQueue
119
16
  */
120
- private doCreateWorktree;
121
- /**
122
- * Removes a worktree for the specified worker
123
- *
124
- * @param workerId - Unique identifier for the worker
125
- * @param force - Force removal even if there are uncommitted changes
126
- * @throws {WorktreeError} If worktree removal fails
127
- */
128
- removeWorktree(workerId: string, force?: boolean): Promise<void>;
129
- /**
130
- * Gets information about a worker's worktree
131
- *
132
- * @param workerId - Unique identifier for the worker
133
- * @returns Worktree information or undefined if not found
134
- */
135
- getWorktreeInfo(workerId: string): WorktreeInfo | undefined;
136
- /**
137
- * Lists all active worktrees managed by this instance
138
- *
139
- * @returns Array of worktree information
140
- */
141
- listActiveWorktrees(): WorktreeInfo[];
142
- /**
143
- * Cleans up all active worktrees
144
- *
145
- * This method should be called during application shutdown to ensure
146
- * all worktrees are properly cleaned up.
147
- *
148
- * @param force - Force removal even if there are uncommitted changes
149
- */
17
+ private createWorktree;
18
+ removeWorktreeUser(worktreeName: string, workerId: string, force?: boolean): Promise<void>;
150
19
  cleanupAll(force?: boolean): Promise<void>;
20
+ listActiveWorktrees(): Array<{
21
+ worktreeName: string;
22
+ branchName: string;
23
+ worktreePath: string;
24
+ }>;
151
25
  /**
152
26
  * Parses the output of 'git worktree list --porcelain'
153
27
  *
@@ -156,9 +30,10 @@ export declare class WorktreeManager {
156
30
  */
157
31
  private parseWorktreeList;
158
32
  /**
159
- * Checks if the repository is in a clean state for worktree operations
160
- *
161
- * @returns True if repository is clean
33
+ * Find a valid base ref to use when creating new branches
34
+ * Tries in order: configured base_ref, main, master, origin/HEAD
35
+ * @returns The first valid ref found, or undefined if none exist
162
36
  */
163
- isRepositoryClean(): Promise<boolean>;
37
+ private findValidBaseRef;
38
+ commitChanges(worktreeName?: string, message?: string): Promise<void>;
164
39
  }