omnara 0.4.0 → 0.5.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.
@@ -4,5 +4,6 @@ export interface OrchestratorOptions {
4
4
  workspaceId?: string;
5
5
  userSessionId?: string;
6
6
  agentSessionId?: string;
7
+ worktreeName?: string;
7
8
  }
8
9
  export declare function runAgentOrchestrator(options?: OrchestratorOptions): Promise<void>;
@@ -15,6 +15,7 @@ export declare class DaemonClient {
15
15
  path: string;
16
16
  initialPrompt?: string;
17
17
  userSessionId?: string;
18
+ worktreeName?: string;
18
19
  }): Promise<LaunchWorkspaceResult | null>;
19
20
  private getEndpoint;
20
21
  private request;
@@ -23,6 +23,7 @@ export interface LaunchWorkspacePayload {
23
23
  path: string;
24
24
  initialPrompt?: string;
25
25
  userSessionId?: string;
26
+ worktreeName?: string;
26
27
  }
27
28
  export interface LaunchWorkspaceSuccessPayload {
28
29
  user_session_id: string;
@@ -34,6 +34,7 @@ export declare class MachineSupervisor {
34
34
  path: string;
35
35
  initialPrompt?: string;
36
36
  userSessionId?: string;
37
+ worktreeName?: string;
37
38
  }): Promise<LaunchWorkspaceResult>;
38
39
  stop(status: Exclude<MachineMessageSchema.MachineStatus, 'ONLINE'>): Promise<void>;
39
40
  private runLoop;
@@ -15,6 +15,8 @@ export interface SessionLaunchSpec {
15
15
  workspaceConfig?: WorkspaceConfig | null;
16
16
  initialPrompt?: string | null;
17
17
  metadata?: Record<string, unknown> | null;
18
+ /** Name for the worktree/branch. If null/undefined, no worktree is created. */
19
+ worktreeName?: string | null;
18
20
  }
19
21
  export declare class SessionManager {
20
22
  private readonly backendUrl;
@@ -1,14 +1,17 @@
1
- import type { McpServerConfig } from '@anthropic-ai/claude-agent-sdk';
1
+ import { type McpServerConfig } from '@anthropic-ai/claude-agent-sdk';
2
2
  import { type AgentClient } from './ai-client.js';
3
3
  import { Session } from './session.js';
4
4
  import { WorkerManager } from './worker-manager.js';
5
+ import { WorktreeManager } from './utils/worktree-manager.js';
5
6
  import type { InboundMessage } from './orchestrator-types.js';
6
7
  import type { ControlMessageSchema, MessageEnvelope } from '@omnara/shared-js/schemas';
7
8
  interface AgentOrchestratorDependencies {
8
9
  createMainClient?: () => AgentClient;
9
10
  createWorkerClient?: (mcpServers?: Record<string, McpServerConfig>, cwd?: string) => AgentClient;
10
11
  workerManager?: WorkerManager;
12
+ worktreeManager?: WorktreeManager;
11
13
  repoPath?: string;
14
+ worktreeName?: string;
12
15
  }
13
16
  type OrchestratorControlMessage = {
14
17
  type: 'session_init';
@@ -29,22 +32,48 @@ export interface AgentOrchestratorInputChannel {
29
32
  export declare class AgentOrchestrator {
30
33
  private readonly aiClient;
31
34
  private readonly workerManager;
35
+ private readonly worktreeManager;
36
+ private readonly workerMcpServer;
32
37
  private readonly clients;
33
38
  private readonly toolUseMap;
34
39
  private readonly completionsManager;
35
40
  private session;
36
41
  private started;
37
42
  private mainSessionId;
43
+ private sessionSettings;
44
+ private worktreeName;
45
+ private worktreePath;
38
46
  readonly voiceSessionIds: Set<string>;
39
47
  constructor(dependencies?: AgentOrchestratorDependencies);
40
48
  ensureSessionExists(requestedSessionId: string): Session;
41
49
  getWorkerManager(): WorkerManager;
50
+ getWorktreeManager(): WorktreeManager;
42
51
  setMainCodingSessionId(sessionId: string): void;
43
52
  addClient(output: AgentOrchestratorOutputChannel): AgentOrchestratorInputChannel;
44
53
  start(): Promise<void>;
54
+ private initializeWorktree;
55
+ getWorktreeName(): string | null;
56
+ getWorktreePath(): string | null;
45
57
  stop(): Promise<void>;
46
58
  cancel(): Promise<void>;
47
59
  getCompletions(request: ControlMessageSchema.CompletionsRequest): Promise<ControlMessageSchema.CompletionsResponse>;
60
+ handleSettingsChange(req: ControlMessageSchema.SessionSettingsRequest): Promise<ControlMessageSchema.SessionSettingsResponse>;
61
+ handleGitWrite(req: ControlMessageSchema.GitWriteRequest): Promise<ControlMessageSchema.GitWriteResponse>;
62
+ /**
63
+ * Generate a commit message using the session's conversation context + diff.
64
+ * Falls back to a basic diff-only approach if no session is available.
65
+ */
66
+ private generateCommitMessageFromSession;
67
+ /**
68
+ * Generate a GitHub compare URL for creating a PR from the given branch.
69
+ * Parses the origin remote URL and constructs the compare link.
70
+ */
71
+ private generateCompareUrl;
72
+ private applySessionSettings;
73
+ /**
74
+ * Build hooks for agent mode that stage changes after Edit/Write tools
75
+ */
76
+ private buildAgentModeHooks;
48
77
  private bindSession;
49
78
  private handleSessionControl;
50
79
  private handleSessionMessage;
@@ -2,20 +2,31 @@ import { type Options, type SDKMessage, type SDKUserMessage } from '@anthropic-a
2
2
  export interface AIClientConfig {
3
3
  defaults?: Partial<Options>;
4
4
  }
5
+ export type ModelType = 'haiku' | 'sonnet' | 'opus';
6
+ export declare const MODEL_MAP: Record<ModelType, string>;
5
7
  export interface AgentClient {
6
8
  isGenerating(): boolean;
7
9
  streamUserMessage(prompt: string | AsyncIterable<SDKUserMessage>, overrides?: Partial<Options>): AsyncIterable<SDKMessage>;
8
10
  cancel(): Promise<void>;
11
+ setModel(model: ModelType): void;
12
+ getModel(): ModelType;
13
+ setOptions(options: Partial<Options>): void;
14
+ getOptions(): Options;
9
15
  }
10
16
  export declare const BASE_ALLOWED_ORCHESTRATOR_TOOLS: readonly ["Glob", "Grep", "LS", "Read", "WebFetch", "WebSearch", "TodoWrite"];
11
17
  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
18
  export declare class AIClient implements AgentClient {
13
- private readonly baseOptions;
19
+ private baseOptions;
14
20
  private query?;
21
+ private currentModel;
15
22
  constructor(config?: AIClientConfig);
16
23
  streamUserMessage(prompt: string | AsyncIterable<SDKUserMessage>, overrides?: Partial<Options>): AsyncIterable<SDKMessage>;
17
24
  private createQuery;
18
25
  cancel(): Promise<void>;
19
26
  isGenerating(): boolean;
27
+ setModel(model: ModelType): void;
28
+ getModel(): ModelType;
29
+ setOptions(options: Partial<Options>): void;
30
+ getOptions(): Options;
20
31
  private ensureWorkingDirectory;
21
32
  }