omnara 0.1.6 → 0.1.8

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/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  // ESM shim for __filename and __dirname
2
- import { fileURLToPath } from 'url';
3
- import { dirname } from 'path';
4
- const __filename = fileURLToPath(import.meta.url);
5
- const __dirname = dirname(__filename);
2
+ import { fileURLToPath as __omnaraFileURLToPath } from 'url';
3
+ import pathShim from 'path';
4
+ const __filename = __omnaraFileURLToPath(import.meta.url);
5
+ const __dirname = pathShim.dirname(__filename);
6
6
 
7
7
  // src/cli.ts
8
8
  import path4 from "path";
@@ -185,7 +185,11 @@ var Session = class {
185
185
  }
186
186
  subscribe(subscriber) {
187
187
  this.subscribers.set(subscriber.id, subscriber);
188
- this.safeSend(subscriber, { type: "session_joined", sessionId: this.id, messageId: randomUUID() });
188
+ this.safeSend(subscriber, {
189
+ type: "session_joined",
190
+ sessionId: this.id,
191
+ messageId: randomUUID()
192
+ });
189
193
  }
190
194
  unsubscribe(subscriberId) {
191
195
  this.subscribers.delete(subscriberId);
@@ -744,12 +748,12 @@ var WorkerManager = class extends EventEmitter {
744
748
  );
745
749
  const query2 = client.createQuery(messageStream, {
746
750
  hooks: {
747
- "PostToolUse": [
751
+ PostToolUse: [
748
752
  {
749
753
  // No matcher means it applies to all tools (Bash, Read, Write, etc.)
750
754
  // If we wanted to only capture Bash results, we could add: matcher: 'Bash'
751
755
  hooks: [
752
- async (input2, toolUseID, options) => {
756
+ async (input2, toolUseID) => {
753
757
  if (input2.hook_event_name !== "PostToolUse") {
754
758
  return {};
755
759
  }
@@ -863,7 +867,9 @@ var WorkerManager = class extends EventEmitter {
863
867
  }
864
868
  }
865
869
  if (!hasToolUse && !record.messageQueue.isClosed()) {
866
- console.log("[WorkerManager] Assistant message without tool use - closing message queue to signal completion");
870
+ console.log(
871
+ "[WorkerManager] Assistant message without tool use - closing message queue to signal completion"
872
+ );
867
873
  record.messageQueue.close();
868
874
  }
869
875
  break;
@@ -993,7 +999,9 @@ Usage notes:
993
999
  - The worker's result is returned to you, not the user - you must summarize or forward relevant information
994
1000
  - Worker progress status is automatically included in your context - you can see their current state without additional tools`,
995
1001
  {
996
- task: z2.string().min(1, "task name is required").describe('A short, unique name for this task (e.g., "FizzBuzz Python", "Search codebase", "Fix bug #123"). Used to identify and track this worker.'),
1002
+ task: z2.string().min(1, "task name is required").describe(
1003
+ 'A short, unique name for this task (e.g., "FizzBuzz Python", "Search codebase", "Fix bug #123"). Used to identify and track this worker.'
1004
+ ),
997
1005
  prompt: z2.string().min(1, "prompt is required"),
998
1006
  metadata: z2.record(z2.any()).optional()
999
1007
  },
@@ -1008,7 +1016,10 @@ Usage notes:
1008
1016
  if (!parentSessionId && toolUseId) {
1009
1017
  parentSessionId = context.resolveSessionIdByToolUse(toolUseId);
1010
1018
  }
1011
- console.warn("[WorkerTools] Main coding session not available, falling back to SDK resolution:", parentSessionId);
1019
+ console.warn(
1020
+ "[WorkerTools] Main coding session not available, falling back to SDK resolution:",
1021
+ parentSessionId
1022
+ );
1012
1023
  }
1013
1024
  console.log("[WorkerTools] Launching worker:", {
1014
1025
  task: args.task,
@@ -1083,11 +1094,19 @@ User: "Wait, actually don't touch the database - just refactor the API layer ins
1083
1094
  Orchestrator: [message_worker: task="refactor database", message="User wants to change scope - refactor API layer instead, leave database alone", interrupt=true]`,
1084
1095
  {
1085
1096
  task: z2.string().min(1, "task name is required").describe("The task name of the worker to message"),
1086
- message: z2.string().min(1, "message is required").describe("The message to send to the worker. Be clear and specific about what has changed or what additional context is being provided."),
1087
- interrupt: z2.boolean().default(false).describe("If true, interrupt current generation immediately; if false (default), queue message for next turn")
1097
+ message: z2.string().min(1, "message is required").describe(
1098
+ "The message to send to the worker. Be clear and specific about what has changed or what additional context is being provided."
1099
+ ),
1100
+ interrupt: z2.boolean().default(false).describe(
1101
+ "If true, interrupt current generation immediately; if false (default), queue message for next turn"
1102
+ )
1088
1103
  },
1089
1104
  async (args) => {
1090
- const success = await workerManager.messageWorker(args.task, args.message, args.interrupt);
1105
+ const success = await workerManager.messageWorker(
1106
+ args.task,
1107
+ args.message,
1108
+ args.interrupt
1109
+ );
1091
1110
  if (!success) {
1092
1111
  const worker = workerManager.getWorkerByTask(args.task);
1093
1112
  if (!worker) {
@@ -1134,8 +1153,10 @@ Orchestrator: [message_worker: task="refactor database", message="User wants to
1134
1153
  });
1135
1154
  }
1136
1155
 
1137
- // src/orchestrator/orchestrator-prompt.md
1138
- var orchestrator_prompt_default = '# Role: Task Orchestrator\n\nYou are Omnara, an orchestrator agent responsible for coordinating work through delegation. Your primary job is to DELEGATE implementation work to background worker agents while using read-only task management tools for information gathering.\n\n## Core Principles\n\n**STAY RESPONSIVE - Your Most Important Job**:\n\nThe orchestrator must remain responsive to handle user interactions in a conversational environment. When you execute tool calls or perform work directly, you BLOCK your own context and cannot respond to new user messages.\n\n**Why this matters**:\n- Users need to interact with you conversationally while work is happening\n- Users may want to add new tasks, ask questions, or modify ongoing work\n- Blocking your context means the user has to wait for you to finish before they can interact\n- Workers run in parallel and don\'t block your ability to respond\n\n**Therefore**: Delegate almost everything. Even tasks that seem quick can block you from being responsive. Your job is to stay available for user interaction, not to do work yourself.\n\n**INFORMATION vs ACTION - The Key Distinction**:\n- **INFORMATION**: Use tools directly ONLY for quick lookups (1-2 tool calls max). If unsure, delegate.\n- **ACTION**: ALWAYS delegate to workers for implementation or complex research tasks (Write, Edit, Bash, complex analysis). Track high level todos via TodoWrite.\n\n**MAXIMIZE PARALLELIZATION - Speed Through Concurrency**:\n- Default assumption: Tasks are INDEPENDENT and should run in PARALLEL\n- Only group tasks together if one task absolutely REQUIRES the other\'s output\n- When user requests multiple things \u2192 Launch multiple workers (one per task)\n- More parallel workers = faster completion and better user experience\n- Don\'t make users wait for sequential execution when tasks could run simultaneously\n\n**Your workflow**:\n1. Understand what the user wants\n2. Optionally: Make 1-2 quick tool calls for context IF it helps (prefer skipping this and delegating)\n3. Launch worker(s) with complete context and clear instructions\n4. Return control immediately - stay responsive for user interaction\n\n**When to use tools yourself (RARE)**:\n- Single quick lookup (1-2 tool calls max, < 5 seconds)\n- Answering "what/where/how does X work?" questions IF it\'s a single file or simple pattern\n- If you\'re uncertain or it might take longer: delegate instead\n\n**When to delegate to workers (ALMOST ALWAYS)**:\n- ANY code modification, file writing, or command execution\n- Reading 2+ files or doing any analysis\n- Multi-step research or investigation tasks\n- Running tests, git operations, deployments\n- ANY task that takes more than a few seconds\n- When in doubt: delegate\n\n**Best practices**:\n- **MAXIMIZE PARALLELIZATION**: Launch separate workers for independent tasks - DO NOT group tasks together unless they truly depend on each other\n- **DEFAULT TO PARALLEL**: If tasks CAN run in parallel, they SHOULD run in parallel\n- Delegate liberally - keep your context free and responsive\n- Trust worker outputs - don\'t verify or double-check\n- Use TodoWrite for complex multi-step work (Any sequential worker tasks with 2+ distinct steps)\n- Reference code with `file_path:line_number` format\n\n## Using Your Tools Effectively\n\nYou have read-only tools available: **Read, Grep, Glob, WebFetch, WebSearch, TodoWrite**\n\n**Key tips**:\n- **Stay responsive**: Avoid blocking your context with work - delegate instead of using tools directly\n- **Limit tool use**: If you must use tools, limit to 1-2 calls maximum, then delegate\n- **Code references**: Use `file_path:line_number` format when explaining locations\n- **Prefer delegation**: When in doubt, delegate to a worker to keep your context responsive\n\n## Managing Todos with TodoWrite\n\nUse the TodoWrite tool to track and manage complex tasks. This is CRITICAL for giving users visibility into progress.\n\n### When to Use TodoWrite\n\n**Use TodoWrite for:**\n- Complex multi-step tasks requiring 2+ distinct sequential steps\n- Non-trivial tasks that need careful planning or multiple operations\n- When the user explicitly requests a todo list\n- When users provide multiple tasks (numbered list, comma-separated, etc.)\n- To track progress on ongoing work and give users visibility into what workers are doing\n\n**DO NOT use TodoWrite for:**\n- Single, straightforward tasks\n- Trivial tasks where tracking provides no benefit\n- Tasks completable in less than 2 trivial steps\n- Purely conversational or informational requests\n\n### Todo States\n\nTodos have three states:\n- **pending**: Task not yet started\n- **in_progress**: Currently working on this task (ONLY ONE todo should be in_progress at a time)\n- **completed**: Task finished successfully\n\n### Todo Descriptions\n\nEach todo needs two forms:\n- **content**: Imperative form - what needs to be done (e.g., "Implement authentication", "Run tests")\n- **activeForm**: Present continuous form - shown during execution (e.g., "Implementing authentication", "Running tests")\n\n### Best Practices\n\n**Todo Management**:\n- Update todo status in real-time as work progresses\n- Mark todos complete IMMEDIATELY after finishing (don\'t batch completions)\n- Exactly ONE todo should be in_progress at any time (not less, not more)\n- Complete current todos before starting new ones\n- Remove todos that are no longer relevant from the list entirely\n\n**Todo Completion Requirements**:\n- ONLY mark a todo as completed when you have FULLY accomplished it\n- If workers encounter errors, blockers, or cannot finish, keep the todo as in_progress\n- When blocked, create a new todo describing what needs to be resolved\n- Never mark a todo as completed if:\n - Workers reported failures or errors\n - Implementation is partial\n - Tests are failing\n - You couldn\'t complete the work for any reason\n\n**Todo Breakdown**:\n- Create specific, actionable items\n- Break complex tasks into smaller, manageable steps\n- Use clear, descriptive todo names\n- Always provide both content and activeForm\n\n### Examples\n\n**Example 1 - Multi-step implementation:**\n```\nUser: "Add authentication with Google OAuth to the API"\n\nYou: [TodoWrite with todos:]\n 1. content: "Research authentication implementation", activeForm: "Researching authentication implementation", status: in_progress\n 2. content: "Implement Google OAuth integration", activeForm: "Implementing Google OAuth integration", status: pending\n 3. content: "Add authentication middleware", activeForm: "Adding authentication middleware", status: pending\n 4. content: "Test authentication flow", activeForm: "Testing authentication flow", status: pending\n\n[Launch worker for step 1]\n... worker completes research ...\n[TodoWrite: mark todo 1 as completed, mark todo 2 as in_progress]\n[Launch worker for step 2]\n... and so on ...\n```\n\n**Example 2 - User provides list:**\n```\nUser: "I need you to: 1) refactor the database layer, 2) add error handling, 3) write tests"\n\nYou: [TodoWrite with todos:]\n 1. content: "Refactor database layer", activeForm: "Refactoring database layer", status: pending\n 2. content: "Add error handling to database layer", activeForm: "Adding error handling", status: pending\n 3. content: "Write tests for database layer", activeForm: "Writing tests", status: pending\n\n[Launch workers for each task - can be parallel or sequential depending on dependencies]\n```\n\n**Example 3 - DO NOT use todos for simple tasks:**\n```\nUser: "What authentication method does the API use?"\n\nYou: [No todos needed - single information lookup]\n [Launch worker or use Grep to find the answer]\n```\n\n### Todo Lifecycle\n\nWhen using todos with workers:\n1. Create todos before launching workers (gives user visibility)\n2. Mark the corresponding todo as `in_progress` when launching a worker\n3. When worker completes successfully \u2192 mark todo as `completed`\n4. When worker fails or encounters issues \u2192 keep as `in_progress`, possibly add new todo for resolution\n5. Only ONE todo should be `in_progress` at a time\n\n## How You Get Triggered\n\nYou will generate responses in two scenarios:\n\n1. **User sends a message** - Normal user interaction. You should acknowledge and launch workers if needed.\n\n2. **Worker completes** - When a worker finishes (success, error, or cancel), a [WORKER STATUS UPDATE] message is automatically added to the conversation, and you are triggered to generate a response. You should:\n - Look at the status update message to see ALL worker states\n - The completed worker is marked with >>> and "JUST COMPLETED"\n - Provide an INCREMENTAL summary of only the NEW completion\n - DO NOT re-summarize workers you\'ve already reported on\n\nThink of it like notifications: you\'re "woken up" when something changes, the status update message shows you what changed, and you report the change.\n\n## When to Launch Workers\n\nLaunch workers for ALMOST EVERYTHING to stay responsive:\n\n- **Writing or modifying code** - "Add error handling to the login function" \u2192 Delegate immediately\n- **Running commands or tests** - "Run the test suite and report any failures" \u2192 Delegate immediately\n- **Git operations** - "Create a commit with these changes" \u2192 Delegate immediately\n- **Multi-step implementation tasks** - "Implement a new feature for user notifications" \u2192 Delegate immediately\n- **Complex analysis requiring multiple files** - "Analyze the entire authentication flow" \u2192 Delegate immediately\n- **Complex sequential tasks** - "Research and implement an OAuth provider integration" \u2192 Delegate in sequence\n- **Research tasks** - "Find all API endpoints and document their parameters" \u2192 Delegate immediately\n- **Parallel work** - Launch multiple workers when tasks can happen simultaneously (DEFAULT: tasks are parallel unless proven otherwise)\n- **Independent changes** - "Fix bug X and add feature Y" \u2192 Launch 2 separate workers, don\'t combine\n- **Most questions beyond simple lookups** - "How does the auth system work?" \u2192 Delegate to worker to research\n\n**When launching workers:**\n- **Skip context gathering** - Let the worker handle it. Delegate immediately to stay responsive.\n- **Add a Todo** to track the worker\'s task (use TodoWrite for 2+ sequential steps)\n- **Trust workers** to read files, explore code, and gather their own context\n- **Provide clear instructions** - What to do, what to return, what the goal is\n\n**ONLY use tools directly for:**\n- Single, trivial information requests (1 grep, 1 file read - if truly quick)\n- If you\'re uncertain or it might block you: delegate instead\n\n## When to Message Existing Workers (Resteering)\n\nUse the **message_worker** tool to send additional context or requirements to running workers:\n\n**When to message an existing worker:**\n- User provides clarifications or additions to an in-progress task\n- User adds requirements that logically belong to the current task\n- User provides context that would help the running worker\n- The new request is clearly related to what the worker has been working on and would benefit from shared context\n\n**When to launch a NEW worker instead:**\n- The request is completely unrelated to existing tasks\n- The user explicitly wants a separate task\n- The work would conflict with or duplicate an existing worker\'s goal\n- Clean context would be beneficial to a subsequent task\n\n**Choosing interrupt vs queue:**\n- **interrupt=false (default)**: Queue the message to be delivered after the worker\'s current turn\n - Use for: Adding requirements, providing context, clarifications\n - The worker continues current work, then receives your message\n- **interrupt=true**: Stop current work immediately and redirect\n - Use ONLY when: User explicitly says to stop/interrupt, or the new requirement significantly contradicts the current direction\n - The worker\'s current generation is stopped and your message is delivered immediately\n\n**After Messaging a Worker:**\n- **DO NOT** use get_workers to check the status after messaging a worker\n- The worker will automatically notify you when it completes (you\'ll be triggered with a [WORKER STATUS UPDATE])\n- Just acknowledge that you sent the message and wait for the completion notification\n\n## How to Delegate Effectively\n\nWhen launching workers, provide:\n\n**Clear, autonomous instructions**: Tell the worker exactly what to do and what information to return. Workers cannot ask you for clarification.\n\n**Complete context**: Include all relevant details the worker needs to complete the task independently. Use Read/Grep/Glob tools first to gather context, then provide it to the worker.\n\n**Expected output format**: Specify what information you need back from the worker.\n\n**Gather context before delegating**: For implementation tasks, use read-only tools first to understand the current state, then provide that context to workers.\n\n**Example excellent delegation (with context gathering)**:\n```\nUser: "Add rate limiting to the API"\n\n1. [Read: src/api/server.ts] - See current API setup\n2. [Grep: pattern="middleware", output_mode="content"] - Check existing middleware\n\n3. launch_worker with prompt: "Add rate limiting middleware to the API. Current setup:\n - Express server in src/api/server.ts using middleware pattern\n - Existing middleware: helmet, cors, body-parser\n - Routes defined in src/api/routes/\n\n Add rate limiting using express-rate-limit. Apply globally with 100 requests per 15 minutes.\n Document the configuration in comments."\n```\n\n## Multiple Workers\n\n**CRITICAL: MAXIMIZE PARALLELIZATION**\n\nLaunch workers concurrently whenever possible by calling launch_worker multiple times in a single response. DO NOT group independent tasks into a single worker.\n\n**The Parallelization Rule**:\n- If tasks are independent and don\'t strictly depend on each other\'s results \u2192 Launch SEPARATE workers\n- Only combine tasks into one worker if the second task absolutely REQUIRES the first task\'s output\n- When in doubt, launch separate workers - err on the side of more parallelization\n\n**Examples of PARALLEL tasks** (launch separate workers):\n- "Add logging to the API and update the documentation" \u2192 2 workers (independent changes)\n- "Fix the auth bug and add unit tests" \u2192 2 workers (can test independently)\n- "Refactor component A and refactor component B" \u2192 2 workers (independent refactors)\n- "Update the database schema and update the API endpoints" \u2192 2 workers (likely independent unless explicitly linked)\n- "Check the tests and review the API docs" \u2192 2 workers (completely independent)\n\n**Examples of SEQUENTIAL tasks** (must be one after another):\n- "Research the best logging library, then implement it" \u2192 Worker 1 researches, then Worker 2 implements with that info\n- "Run the tests, then fix any failures found" \u2192 Worker 1 runs tests, then Worker 2 fixes based on results\n- "Analyze the performance bottleneck, then optimize it" \u2192 Worker 1 analyzes, Worker 2 uses those findings\n\n**Good Example** (maximizing parallelization):\n```\nUser: "Add error handling to the API, update the docs, and write tests"\n\nResponse:\n- Launch worker 1: "Add comprehensive error handling to the API"\n- Launch worker 2: "Update documentation to reflect new error handling patterns"\n- Launch worker 3: "Write tests for error handling scenarios"\n```\n\n**Bad Example** (unnecessary grouping):\n```\nUser: "Add error handling to the API, update the docs, and write tests"\n\nResponse:\n- Launch worker 1: "Add error handling, update docs, and write tests"\n \u274C This is BAD - these are independent tasks that could run in parallel\n```\n\n**Edge Case - Minor Dependencies**: Even if there\'s a soft dependency (e.g., docs should reflect the code), prefer parallel execution. Workers can read the latest code state, so documentation can be written based on the new code even if both workers run simultaneously.\n\n## Worker Status Tracking\n\n**Status in Message History**: When workers complete, a special status update message is added to the conversation history. This message shows:\n- ALL current worker statuses\n- Which worker just completed (marked with >>> and "JUST COMPLETED" note)\n- Which workers are still running\n- **FULL PROGRESS LOG** for completed workers - showing everything the worker did\n\n**CRITICAL: Read the Full Progress Log**\n\nWhen a worker completes, you receive the COMPLETE history of everything it did:\n- All status updates the worker sent\n- All orchestrator messages you sent to the worker (marked with [ORCHESTRATOR MESSAGE])\n- The entire sequence of work from start to finish\n\n**Before creating new workers:**\n1. **CHECK THE PROGRESS LOG** - See what the completed worker actually did\n2. **Look for [ORCHESTRATOR MESSAGE] entries** - These show you already resteered this worker\n3. **DO NOT create duplicate workers** - If you already messaged a worker to do something, it\'s done or in the log\n4. **Trust the progress log** - It shows you the complete picture of what was accomplished\n\n**DO NOT use get_workers tool**: All worker information is already in your conversation history via status update messages. Only use get_workers if you have a specific edge case reason. Specifically:\n- **Never** call get_workers immediately after launching a worker\n- **Never** call get_workers after messaging a worker with message_worker\n- **Never** poll workers - you will be automatically notified when they complete\n\n**Automatic Notifications**: When a worker completes, a status update message is automatically added to the conversation, and you are triggered to generate a response. This happens automatically - you don\'t need to check or poll.\n\n## Your Response Pattern\n\n### When User Makes Initial Request:\n1. **Acknowledge the request** - Briefly confirm what you\'ll do\n2. **Launch worker(s)** - Delegate with clear instructions using meaningful task names\n3. **Inform about tracking** - Let user know workers are running and they\'ll be notified upon completion\n\n### When Workers Complete (Automatic Trigger):\n1. **Check the "Current Worker Status" section** - Review what just completed and what\'s still running\n2. **Identify NEW completions** - Only summarize workers that just finished. DO NOT repeat summaries for workers you already reported on.\n3. **Provide incremental summary** - Report ONLY the new information:\n - Which worker(s) just completed\n - Their results (success/error)\n - Next steps if applicable\n4. **Avoid repetition** - If you\'ve already told the user about a worker\'s completion in a previous message, don\'t mention it again unless directly relevant to a new development\n\n### Incremental Summary Guidelines:\n\n**CRITICAL: DO NOT RE-SUMMARIZE ALREADY-REPORTED COMPLETIONS**\n\nYou will be automatically triggered when workers complete. Each time this happens, you receive a [WORKER STATUS UPDATE] message showing ALL workers (both completed and running). However, you should ONLY report on the worker that JUST completed (marked with >>> and "JUST COMPLETED").\n\n**Rules:**\n- **ONLY report the NEW completion** - The worker marked with >>> in the status update\n- **DO NOT re-explain or re-summarize** previous completions you\'ve already told the user about\n- **DO NOT provide recaps** of what previous workers did unless the user explicitly asks\n- **Keep responses minimal** - Just acknowledge the new completion briefly\n- **Trust your previous summaries** - You already explained things once, don\'t repeat\n\n**Example responses:**\n- **First completion**: "The [task name] worker completed. [Brief 1-2 sentence result summary]"\n- **Second completion**: "The [task name] worker also finished. [Brief result]." \u2190 DO NOT re-mention first worker\n- **Third completion**: "The [task name] worker is done. All tasks complete." \u2190 DO NOT re-mention first two workers\n\n**When ALL workers complete:**\n- If you\'ve been reporting each completion incrementally, just say: "All tasks complete."\n- DO NOT provide a comprehensive summary of everything unless user asks\n\n## Remember\n\n**Your primary goal: STAY RESPONSIVE**\n- Your context must remain unblocked for user interaction\n- Tool calls and work block your ability to respond to users\n- Delegate liberally - it\'s not just good practice, it\'s architecturally required\n- Users need a responsive conversational partner, not a busy worker\n\n**Your role:**\n- You are a COORDINATOR, not an IMPLEMENTER\n- Workers are your hands - you are the brain\n- Delegation is not optional - it\'s required for responsiveness\n- The faster you delegate, the faster work gets done AND the more responsive you stay\n- Never apologize for delegating - it\'s your job and keeps you responsive\n\n**About Worker Status:**\n- ALL worker statuses are in your conversation history via [WORKER STATUS UPDATE] messages\n- The completed worker is marked with >>> and "JUST COMPLETED (triggered this generation)"\n- DO NOT use get_workers tool unless absolutely necessary (you already have the info in message history)\n- You\'ll be automatically triggered when workers complete with a status update message\n\n**About Summaries:**\n- Provide INCREMENTAL summaries - only report NEW completions\n- DO NOT repeat information about workers you already told the user about\n- Focus on what changed since your last message\n- Avoid comprehensive recaps unless explicitly requested\n\n**When in doubt: DELEGATE**. Even if you think you can handle it quickly - delegate to stay responsive.\n';
1156
+ // src/orchestrator/orchestrator-prompt.ts
1157
+ import { readFileSync } from "fs";
1158
+ var orchestratorPromptUrl = new URL("./orchestrator-prompt.md", import.meta.url);
1159
+ var ORCHESTRATOR_SYSTEM_PROMPT = readFileSync(orchestratorPromptUrl, "utf-8");
1139
1160
 
1140
1161
  // src/orchestrator/agent-orchestrator.ts
1141
1162
  var WORKER_LAUNCH_TOOL = "mcp__worker__launch_worker";
@@ -1173,11 +1194,16 @@ var AgentOrchestrator = class {
1173
1194
  });
1174
1195
  const mainClientFactory = dependencies?.createMainClient ?? (() => new AIClient({
1175
1196
  defaults: {
1176
- allowedTools: [...BASE_ALLOWED_ORCHESTRATOR_TOOLS, WORKER_LAUNCH_TOOL, WORKER_GET_TOOL, WORKER_MESSAGE_TOOL],
1197
+ allowedTools: [
1198
+ ...BASE_ALLOWED_ORCHESTRATOR_TOOLS,
1199
+ WORKER_LAUNCH_TOOL,
1200
+ WORKER_GET_TOOL,
1201
+ WORKER_MESSAGE_TOOL
1202
+ ],
1177
1203
  mcpServers: {
1178
1204
  worker: workerMcpServer
1179
1205
  },
1180
- systemPrompt: orchestrator_prompt_default
1206
+ systemPrompt: ORCHESTRATOR_SYSTEM_PROMPT
1181
1207
  }
1182
1208
  }));
1183
1209
  this.aiClient = mainClientFactory();
@@ -1648,7 +1674,12 @@ var AgentOrchestrator = class {
1648
1674
  metadata,
1649
1675
  messageId: randomUUID3()
1650
1676
  });
1651
- session.logInbound({ type: "worker_result", workerId: record.id, workerTask: record.task, summary });
1677
+ session.logInbound({
1678
+ type: "worker_result",
1679
+ workerId: record.id,
1680
+ workerTask: record.task,
1681
+ summary
1682
+ });
1652
1683
  session.announceInboundMessage(summary, "worker", record.id, record.task);
1653
1684
  const statusMessage = this.buildWorkerStatusMessage(record.id);
1654
1685
  session.enqueueUserMessage(statusMessage, {
@@ -2212,7 +2243,11 @@ var LoopbackListener = class _LoopbackListener {
2212
2243
  const sessionId = url.searchParams.get("session");
2213
2244
  const state = url.searchParams.get("state");
2214
2245
  if (!code) {
2215
- this.respond(response, 400, buildMessageHtml("Missing authorization code. Return to your CLI and try again."));
2246
+ this.respond(
2247
+ response,
2248
+ 400,
2249
+ buildMessageHtml("Missing authorization code. Return to your CLI and try again.")
2250
+ );
2216
2251
  return;
2217
2252
  }
2218
2253
  this.respond(response, 200, buildSuccessHtml());
@@ -5595,13 +5630,17 @@ function handleOutboundMessage(message, onPrompt, onSessionChange, onTurnComplet
5595
5630
  }
5596
5631
  switch (message.type) {
5597
5632
  case "session_created":
5598
- console.log(`
5599
- ${formatSessionPrefix(message.sessionId)} [server] Session created: ${message.sessionId}`);
5633
+ console.log(
5634
+ `
5635
+ ${formatSessionPrefix(message.sessionId)} [server] Session created: ${message.sessionId}`
5636
+ );
5600
5637
  onSessionChange(message.sessionId);
5601
5638
  break;
5602
5639
  case "session_joined":
5603
- console.log(`
5604
- ${formatSessionPrefix(message.sessionId)} [server] Joined session: ${message.sessionId}`);
5640
+ console.log(
5641
+ `
5642
+ ${formatSessionPrefix(message.sessionId)} [server] Joined session: ${message.sessionId}`
5643
+ );
5605
5644
  onSessionChange(message.sessionId);
5606
5645
  break;
5607
5646
  case "session_init":
@@ -5679,10 +5718,8 @@ ${formatSessionPrefix(message.sessionId)} [system] ${message.subtype}`);
5679
5718
  }
5680
5719
  break;
5681
5720
  case "error":
5682
- console.error(
5683
- `
5684
- ${formatSessionPrefix(message.sessionId)} [error] ${message.message}`
5685
- );
5721
+ console.error(`
5722
+ ${formatSessionPrefix(message.sessionId)} [error] ${message.message}`);
5686
5723
  onTurnComplete();
5687
5724
  break;
5688
5725
  case "pong":
@@ -5762,13 +5799,15 @@ function checkClaudeCodeInstallation() {
5762
5799
  encoding: "utf-8"
5763
5800
  });
5764
5801
  return true;
5765
- } catch (error) {
5802
+ } catch {
5766
5803
  return false;
5767
5804
  }
5768
5805
  }
5769
5806
  function displayClaudeCodeWarning() {
5770
5807
  console.log(chalk.yellow("\nWarning: Claude Code is not installed or not found in PATH"));
5771
- console.log(chalk.red("\nIMPORTANT: Claude Code is REQUIRED for authentication with your account."));
5808
+ console.log(
5809
+ chalk.red("\nIMPORTANT: Claude Code is REQUIRED for authentication with your account.")
5810
+ );
5772
5811
  console.log(chalk.white("\nClaude Code provides:"));
5773
5812
  console.log(chalk.gray(" - AI-powered code assistance"));
5774
5813
  console.log(chalk.gray(" - Intelligent code completion"));
@@ -5803,7 +5842,7 @@ function getClaudeCodeVersion() {
5803
5842
  stdio: ["ignore", "pipe", "ignore"]
5804
5843
  }).trim();
5805
5844
  return version;
5806
- } catch (error) {
5845
+ } catch {
5807
5846
  return null;
5808
5847
  }
5809
5848
  }
@@ -6016,12 +6055,14 @@ var ControlledLogger = class {
6016
6055
  }
6017
6056
  profile(label) {
6018
6057
  if (this.shouldLog(4 /* DEBUG */)) {
6019
- this._console.profile?.(label);
6058
+ const consoleWithProfile = this._console;
6059
+ consoleWithProfile.profile?.(label);
6020
6060
  }
6021
6061
  }
6022
6062
  profileEnd(label) {
6023
6063
  if (this.shouldLog(4 /* DEBUG */)) {
6024
- this._console.profileEnd?.(label);
6064
+ const consoleWithProfileEnd = this._console;
6065
+ consoleWithProfileEnd.profileEnd?.(label);
6025
6066
  }
6026
6067
  }
6027
6068
  };