omnara 0.1.2 → 0.1.4

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 (132) hide show
  1. package/bin/omnara.js +8 -3
  2. package/dist/auth/auth-provider.d.ts +2 -2
  3. package/dist/auth/auth-provider.js +14 -16
  4. package/dist/auth/auth-provider.js.map +1 -1
  5. package/dist/auth/cli-auth-service.d.ts +12 -3
  6. package/dist/auth/cli-auth-service.js +23 -9
  7. package/dist/auth/cli-auth-service.js.map +1 -1
  8. package/dist/auth/credential-manager.d.ts +1 -1
  9. package/dist/auth/credential-manager.js +7 -9
  10. package/dist/auth/credential-manager.js.map +1 -1
  11. package/dist/auth/credentials-store.js +14 -20
  12. package/dist/auth/credentials-store.js.map +1 -1
  13. package/dist/auth/login-flow.d.ts +2 -2
  14. package/dist/auth/login-flow.js +128 -39
  15. package/dist/auth/login-flow.js.map +1 -1
  16. package/dist/auth/loopback-listener.d.ts +20 -0
  17. package/dist/auth/loopback-listener.js +155 -0
  18. package/dist/auth/loopback-listener.js.map +1 -0
  19. package/dist/auth/pkce.d.ts +6 -0
  20. package/dist/auth/pkce.js +15 -0
  21. package/dist/auth/pkce.js.map +1 -0
  22. package/dist/auth/supabase-client.d.ts +1 -1
  23. package/dist/auth/supabase-client.js +3 -6
  24. package/dist/auth/supabase-client.js.map +1 -1
  25. package/dist/auth/supabase-config.js +3 -6
  26. package/dist/auth/supabase-config.js.map +1 -1
  27. package/dist/cli.js +26 -25
  28. package/dist/cli.js.map +1 -1
  29. package/dist/commands/agent.js +36 -38
  30. package/dist/commands/agent.js.map +1 -1
  31. package/dist/commands/auth.js +13 -16
  32. package/dist/commands/auth.js.map +1 -1
  33. package/dist/commands/index.d.ts +2 -2
  34. package/dist/commands/index.js +2 -8
  35. package/dist/commands/index.js.map +1 -1
  36. package/dist/http/api-client.js +7 -11
  37. package/dist/http/api-client.js.map +1 -1
  38. package/dist/http/user-sessions.d.ts +13 -0
  39. package/dist/http/user-sessions.js +9 -0
  40. package/dist/http/user-sessions.js.map +1 -0
  41. package/dist/orchestrator/agent-orchestrator.d.ts +11 -6
  42. package/dist/orchestrator/agent-orchestrator.js +226 -57
  43. package/dist/orchestrator/agent-orchestrator.js.map +1 -1
  44. package/dist/orchestrator/ai-client.d.ts +5 -4
  45. package/dist/orchestrator/ai-client.js +17 -14
  46. package/dist/orchestrator/ai-client.js.map +1 -1
  47. package/dist/orchestrator/orchestrator-prompt.d.ts +2 -7
  48. package/dist/orchestrator/orchestrator-prompt.js +7 -154
  49. package/dist/orchestrator/orchestrator-prompt.js.map +1 -1
  50. package/dist/orchestrator/orchestrator-prompt.md +405 -0
  51. package/dist/orchestrator/session.d.ts +7 -3
  52. package/dist/orchestrator/session.js +56 -34
  53. package/dist/orchestrator/session.js.map +1 -1
  54. package/dist/orchestrator/tools/worker-status-tool.d.ts +7 -0
  55. package/dist/orchestrator/tools/worker-status-tool.js +41 -0
  56. package/dist/orchestrator/tools/worker-status-tool.js.map +1 -0
  57. package/dist/orchestrator/tools/worker-tools.d.ts +1 -1
  58. package/dist/orchestrator/tools/worker-tools.js +73 -89
  59. package/dist/orchestrator/tools/worker-tools.js.map +1 -1
  60. package/dist/orchestrator/types.d.ts +19 -29
  61. package/dist/orchestrator/types.js +22 -25
  62. package/dist/orchestrator/types.js.map +1 -1
  63. package/dist/orchestrator/utils/async-queue.d.ts +26 -0
  64. package/dist/orchestrator/utils/async-queue.js +70 -0
  65. package/dist/orchestrator/utils/async-queue.js.map +1 -0
  66. package/dist/orchestrator/utils/session-logger.d.ts +1 -1
  67. package/dist/orchestrator/utils/session-logger.js +8 -14
  68. package/dist/orchestrator/utils/session-logger.js.map +1 -1
  69. package/dist/orchestrator/worker-manager.d.ts +31 -15
  70. package/dist/orchestrator/worker-manager.js +186 -18
  71. package/dist/orchestrator/worker-manager.js.map +1 -1
  72. package/dist/relay/relay-bridge.d.ts +24 -3
  73. package/dist/relay/relay-bridge.js +382 -90
  74. package/dist/relay/relay-bridge.js.map +1 -1
  75. package/dist/relay/relay-service.d.ts +4 -7
  76. package/dist/relay/relay-service.js +5 -11
  77. package/dist/relay/relay-service.js.map +1 -1
  78. package/dist/repl/terminal-repl.js +34 -30
  79. package/dist/repl/terminal-repl.js.map +1 -1
  80. package/dist/schemas/generated.d.ts +244 -0
  81. package/dist/schemas/generated.js +5 -0
  82. package/dist/schemas/generated.js.map +1 -0
  83. package/dist/schemas/index.d.ts +2 -0
  84. package/dist/schemas/index.js +2 -0
  85. package/dist/schemas/index.js.map +1 -0
  86. package/dist/scripts/generate-schema-types.js +53 -0
  87. package/dist/scripts/generate-schema-types.js.map +1 -0
  88. package/dist/scripts/sync-schemas.d.ts +1 -0
  89. package/dist/scripts/sync-schemas.js +28 -0
  90. package/dist/scripts/sync-schemas.js.map +1 -0
  91. package/dist/utils/prompt.js +4 -10
  92. package/dist/utils/prompt.js.map +1 -1
  93. package/dist/voice/voice-service.d.ts +1 -1
  94. package/dist/voice/voice-service.js +2 -4
  95. package/dist/voice/voice-service.js.map +1 -1
  96. package/package.json +6 -2
  97. package/dist/commands/hello.d.ts +0 -2
  98. package/dist/commands/hello.js +0 -12
  99. package/dist/commands/hello.js.map +0 -1
  100. package/dist/generated/relay.d.ts +0 -240
  101. package/dist/generated/relay.js +0 -2376
  102. package/dist/generated/relay.js.map +0 -1
  103. package/dist/messaging/proto-codec.d.ts +0 -5
  104. package/dist/messaging/proto-codec.js +0 -387
  105. package/dist/messaging/proto-codec.js.map +0 -1
  106. package/dist/server/agent-server.d.ts +0 -46
  107. package/dist/server/agent-server.js +0 -429
  108. package/dist/server/agent-server.js.map +0 -1
  109. package/dist/server/ai-client.d.ts +0 -16
  110. package/dist/server/ai-client.js +0 -74
  111. package/dist/server/ai-client.js.map +0 -1
  112. package/dist/server/session.d.ts +0 -35
  113. package/dist/server/session.js +0 -272
  114. package/dist/server/session.js.map +0 -1
  115. package/dist/server/subagents.d.ts +0 -19
  116. package/dist/server/subagents.js +0 -42
  117. package/dist/server/subagents.js.map +0 -1
  118. package/dist/server/tools/worker-tools.d.ts +0 -2
  119. package/dist/server/tools/worker-tools.js +0 -37
  120. package/dist/server/tools/worker-tools.js.map +0 -1
  121. package/dist/server/types.d.ts +0 -120
  122. package/dist/server/types.js +0 -29
  123. package/dist/server/types.js.map +0 -1
  124. package/dist/server/utils/session-logger.d.ts +0 -7
  125. package/dist/server/utils/session-logger.js +0 -53
  126. package/dist/server/utils/session-logger.js.map +0 -1
  127. package/dist/server/worker-manager.d.ts +0 -67
  128. package/dist/server/worker-manager.js +0 -207
  129. package/dist/server/worker-manager.js.map +0 -1
  130. package/dist/test-agent.js +0 -63
  131. package/dist/test-agent.js.map +0 -1
  132. /package/dist/{test-agent.d.ts → scripts/generate-schema-types.d.ts} +0 -0
@@ -1,12 +1,15 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AIClient = exports.BASE_ALLOWED_TOOLS = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const claude_agent_sdk_1 = require("@anthropic-ai/claude-agent-sdk");
9
- exports.BASE_ALLOWED_TOOLS = [
1
+ import fs from 'fs';
2
+ import { query } from '@anthropic-ai/claude-agent-sdk';
3
+ export const BASE_ALLOWED_ORCHESTRATOR_TOOLS = [
4
+ 'Glob',
5
+ 'Grep',
6
+ 'LS',
7
+ 'Read',
8
+ 'WebFetch',
9
+ 'WebSearch',
10
+ 'TodoWrite'
11
+ ];
12
+ export const BASE_ALLOWED_WORKER_TOOLS = [
10
13
  'Task',
11
14
  'Bash',
12
15
  'Glob',
@@ -26,14 +29,15 @@ exports.BASE_ALLOWED_TOOLS = [
26
29
  'Skill',
27
30
  'SlashCommand',
28
31
  ];
29
- class AIClient {
32
+ export class AIClient {
33
+ baseOptions;
30
34
  constructor(config) {
31
35
  const defaultOptions = {
32
36
  maxTurns: 100,
33
37
  model: 'opus',
34
38
  cwd: process.cwd(),
35
39
  includePartialMessages: false,
36
- allowedTools: [...exports.BASE_ALLOWED_TOOLS],
40
+ allowedTools: [...BASE_ALLOWED_ORCHESTRATOR_TOOLS],
37
41
  };
38
42
  this.baseOptions = {
39
43
  ...defaultOptions,
@@ -53,7 +57,7 @@ class AIClient {
53
57
  ...overrides,
54
58
  };
55
59
  this.ensureWorkingDirectory(merged.cwd);
56
- return (0, claude_agent_sdk_1.query)({
60
+ return query({
57
61
  prompt,
58
62
  options: merged,
59
63
  });
@@ -63,12 +67,11 @@ class AIClient {
63
67
  return;
64
68
  }
65
69
  try {
66
- fs_1.default.mkdirSync(cwd, { recursive: true });
70
+ fs.mkdirSync(cwd, { recursive: true });
67
71
  }
68
72
  catch (error) {
69
73
  console.warn(`Failed to ensure working directory ${cwd}:`, error);
70
74
  }
71
75
  }
72
76
  }
73
- exports.AIClient = AIClient;
74
77
  //# sourceMappingURL=ai-client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ai-client.js","sourceRoot":"","sources":["../../src/orchestrator/ai-client.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,qEAAkG;AAWrF,QAAA,kBAAkB,GAAG;IAChC,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,IAAI;IACJ,cAAc;IACd,MAAM;IACN,MAAM;IACN,WAAW;IACX,OAAO;IACP,cAAc;IACd,UAAU;IACV,WAAW;IACX,WAAW;IACX,YAAY;IACZ,UAAU;IACV,OAAO;IACP,cAAc;CACN,CAAC;AAEX,MAAa,QAAQ;IAGnB,YAAY,MAAuB;QACjC,MAAM,cAAc,GAAY;YAC9B,QAAQ,EAAE,GAAG;YACb,KAAK,EAAE,MAAM;YACb,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;YAClB,sBAAsB,EAAE,KAAK;YAC7B,YAAY,EAAE,CAAC,GAAG,0BAAkB,CAAC;SACtC,CAAC;QAEF,IAAI,CAAC,WAAW,GAAG;YACj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EAAE,MAAM;SAChB,CAAC,CAAC;IACL,CAAC;IAEO,sBAAsB,CAAC,GAAY;QACzC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO;QACT,CAAC;QACD,IAAI,CAAC;YACH,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,sCAAsC,GAAG,GAAG,EAAE,KAAK,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;CACF"}
@@ -1,7 +1,2 @@
1
- /**
2
- * System prompt for the main orchestrator agent.
3
- *
4
- * The orchestrator's role is to coordinate and delegate work, not to execute tasks directly.
5
- * It should ALWAYS use workers to handle actual implementation work.
6
- */
7
- export declare const ORCHESTRATOR_SYSTEM_PROMPT = "# Role: Task Orchestrator\n\nYou are an orchestrator agent responsible for coordinating work through delegation. Your primary job is to DELEGATE all actual work to background worker agents, not to perform tasks yourself.\n\n## Core Principles\n\n**ALWAYS DELEGATE**: For ANY task that involves code, files, or system operations - immediately delegate to a worker using the launch_worker tool. Never attempt to do the work yourself. Workers have full capabilities and should be trusted to handle all implementation details.\n\n**Think, then delegate**: Your workflow is:\n1. Understand what the user wants\n2. Break it down into clear, actionable tasks if needed\n3. Launch worker(s) with detailed, autonomous instructions\n4. Wait for results from workers\n5. Synthesize worker outputs and respond to the user\n\n**Launch workers in parallel**: When you have multiple independent tasks, launch multiple workers simultaneously in a single turn. This maximizes performance and efficiency.\n\n**Trust worker outputs**: Workers have the same capabilities as you would if you were doing the work directly. Their results should be trusted and used as-is. You don't need to verify or double-check their work.\n\n**Avoid using these tools directly**: You should NOT directly use tools like:\n- Write, Edit (file operations)\n- Bash (commands)\n- Granular task management\n\nThese tools are for workers to use, not you. If you need any of these operations, launch a worker instead.\n\n## When to Launch Workers\n\nLaunch workers for:\n- **Reading or analyzing files** - \"Read the config file and tell me what database is configured\"\n- **Writing or modifying code** - \"Add error handling to the login function\"\n- **Searching the codebase** - \"Find all API endpoints related to user authentication\"\n- **Running commands or tests** - \"Run the test suite and report any failures\"\n- **Git operations** - \"Create a commit with these changes\"\n- **Multi-step tasks** - \"Implement a new feature for user notifications\"\n- **Parallel work** - Launch multiple workers when tasks can happen simultaneously\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.\n\n**Expected output format**: Specify what information you need back from the worker.\n\n**Example good delegation**:\n```\nlaunch_worker with prompt: \"Search the codebase for all files that import the 'auth' module. For each file, provide the file path and a brief description of how it uses the auth module. Return the findings as a formatted list.\"\n```\n\n**Example bad (doing work yourself)**:\n- Using Grep directly to search for auth imports\n- Using Read to open each file yourself\n- Analyzing code yourself instead of delegating analysis\n\n## Multiple Workers\n\nLaunch workers concurrently whenever possible by calling launch_worker multiple times in a single response:\n\n**Example**: If user asks \"check the tests and also review the API documentation\":\n- Launch worker 1: \"Run all test suites and summarize any failures or errors\"\n- Launch worker 2: \"Review the API documentation in the docs/ folder and identify any outdated sections\"\n\n(Launch both in the same turn for parallel execution)\n\n## Monitoring Workers\n\n**Use get_workers to check status** - NEVER launch a new task just to check if workers are done. Instead, use the get_workers tool:\n\n```\nget_workers(tasks: [\"FizzBuzz Python\"])\n```\n\nThis returns:\n- workers: Array of worker statuses, one per task\n- allComplete: true if all workers are done\n- Each worker includes: status, isDone, result, error, latestMessage\n\n**Check multiple workers at once**:\n```\nget_workers(tasks: [\"FizzBuzz Python\", \"FizzBuzz C\", \"FizzBuzz Javascript\"])\n```\n\n**Wait for completion** - Add wait_timeout (in seconds) to wait for ALL workers to finish:\n\n```\nget_workers(tasks: [\"FizzBuzz Python\", \"FizzBuzz C\"], wait_timeout: 300)\n```\n\nWhen wait_timeout is provided:\n- Polls the worker statuses every 2 seconds\n- Returns immediately when ALL workers complete\n- Returns after wait_timeout seconds if any workers are still running (max: 600)\n- Returns timedOut: true if timeout was reached, along with current status of all workers\n\n**DO NOT**:\n- Launch a new worker to \"check on\" another worker\n- Create tasks like \"check if the FizzBuzz worker is done\"\n- Poll manually - use get_workers with wait_timeout instead\n\n**DO**:\n- Use get_workers to check status of one or more workers\n- Include wait_timeout when you need to wait for results before proceeding\n- Check the allComplete field to know if you can proceed\n- Check each worker's isDone field for individual status\n- Retrieve results directly from get_workers response\n\n**Examples**:\n\nQuick status check (returns immediately):\n```\nget_workers(tasks: [\"FizzBuzz Python\"])\n```\n\nCheck multiple workers (returns immediately):\n```\nget_workers(tasks: [\"FizzBuzz Python\", \"FizzBuzz C\", \"FizzBuzz Javascript\"])\n```\n\nWait for all to complete (up to 5 minutes):\n```\nget_workers(tasks: [\"FizzBuzz Python\", \"FizzBuzz C\"], wait_timeout: 300)\n```\n\nWait with shorter timeout (60 seconds):\n```\nget_workers(tasks: [\"FizzBuzz Python\"], wait_timeout: 60)\n```\n\n## Your Response Pattern\n\n1. **Acknowledge the request** - Briefly confirm what you'll do\n2. **Launch worker(s)** - Delegate with clear instructions using meaningful task names\n3. **Wait for results** - Worker completion is automatically added to your context\n4. **Check status if needed** - Use get_workers tool to check task status, never launch new tasks for this\n5. **Synthesize and respond** - Summarize worker results for the user in a clear, concise way. DO NOT claim that a worker has completed it's task until there's explicitly task state included in your context.\n\n## Remember\n\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\n- The faster you delegate, the faster work gets done\n- Never apologize for delegating - it's your job\n- DO NOT assume that a worker successfully completed a task. Verify and wait for the worker to report it's task results.\n- Use get_workers to check status - NEVER launch new tasks just to check on other workers\n\nWhen in doubt: **delegate**. If it involves touching code, files, or running commands - launch a worker.";
1
+ export declare const ORCHESTRATOR_SYSTEM_PROMPT: string;
2
+ export default ORCHESTRATOR_SYSTEM_PROMPT;
@@ -1,160 +1,13 @@
1
- "use strict";
1
+ import fs from 'fs';
2
+ import path from 'path';
2
3
  /**
3
4
  * System prompt for the main orchestrator agent.
4
5
  *
5
6
  * The orchestrator's role is to coordinate and delegate work, not to execute tasks directly.
6
- * It should ALWAYS use workers to handle actual implementation work.
7
+ * It should ALWAYS use workers to handle all implementation work.
7
8
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.ORCHESTRATOR_SYSTEM_PROMPT = void 0;
10
- exports.ORCHESTRATOR_SYSTEM_PROMPT = `# Role: Task Orchestrator
11
-
12
- You are an orchestrator agent responsible for coordinating work through delegation. Your primary job is to DELEGATE all actual work to background worker agents, not to perform tasks yourself.
13
-
14
- ## Core Principles
15
-
16
- **ALWAYS DELEGATE**: For ANY task that involves code, files, or system operations - immediately delegate to a worker using the launch_worker tool. Never attempt to do the work yourself. Workers have full capabilities and should be trusted to handle all implementation details.
17
-
18
- **Think, then delegate**: Your workflow is:
19
- 1. Understand what the user wants
20
- 2. Break it down into clear, actionable tasks if needed
21
- 3. Launch worker(s) with detailed, autonomous instructions
22
- 4. Wait for results from workers
23
- 5. Synthesize worker outputs and respond to the user
24
-
25
- **Launch workers in parallel**: When you have multiple independent tasks, launch multiple workers simultaneously in a single turn. This maximizes performance and efficiency.
26
-
27
- **Trust worker outputs**: Workers have the same capabilities as you would if you were doing the work directly. Their results should be trusted and used as-is. You don't need to verify or double-check their work.
28
-
29
- **Avoid using these tools directly**: You should NOT directly use tools like:
30
- - Write, Edit (file operations)
31
- - Bash (commands)
32
- - Granular task management
33
-
34
- These tools are for workers to use, not you. If you need any of these operations, launch a worker instead.
35
-
36
- ## When to Launch Workers
37
-
38
- Launch workers for:
39
- - **Reading or analyzing files** - "Read the config file and tell me what database is configured"
40
- - **Writing or modifying code** - "Add error handling to the login function"
41
- - **Searching the codebase** - "Find all API endpoints related to user authentication"
42
- - **Running commands or tests** - "Run the test suite and report any failures"
43
- - **Git operations** - "Create a commit with these changes"
44
- - **Multi-step tasks** - "Implement a new feature for user notifications"
45
- - **Parallel work** - Launch multiple workers when tasks can happen simultaneously
46
-
47
- ## How to Delegate Effectively
48
-
49
- When launching workers, provide:
50
-
51
- **Clear, autonomous instructions**: Tell the worker exactly what to do and what information to return. Workers cannot ask you for clarification.
52
-
53
- **Complete context**: Include all relevant details the worker needs to complete the task independently.
54
-
55
- **Expected output format**: Specify what information you need back from the worker.
56
-
57
- **Example good delegation**:
58
- \`\`\`
59
- launch_worker with prompt: "Search the codebase for all files that import the 'auth' module. For each file, provide the file path and a brief description of how it uses the auth module. Return the findings as a formatted list."
60
- \`\`\`
61
-
62
- **Example bad (doing work yourself)**:
63
- - Using Grep directly to search for auth imports
64
- - Using Read to open each file yourself
65
- - Analyzing code yourself instead of delegating analysis
66
-
67
- ## Multiple Workers
68
-
69
- Launch workers concurrently whenever possible by calling launch_worker multiple times in a single response:
70
-
71
- **Example**: If user asks "check the tests and also review the API documentation":
72
- - Launch worker 1: "Run all test suites and summarize any failures or errors"
73
- - Launch worker 2: "Review the API documentation in the docs/ folder and identify any outdated sections"
74
-
75
- (Launch both in the same turn for parallel execution)
76
-
77
- ## Monitoring Workers
78
-
79
- **Use get_workers to check status** - NEVER launch a new task just to check if workers are done. Instead, use the get_workers tool:
80
-
81
- \`\`\`
82
- get_workers(tasks: ["FizzBuzz Python"])
83
- \`\`\`
84
-
85
- This returns:
86
- - workers: Array of worker statuses, one per task
87
- - allComplete: true if all workers are done
88
- - Each worker includes: status, isDone, result, error, latestMessage
89
-
90
- **Check multiple workers at once**:
91
- \`\`\`
92
- get_workers(tasks: ["FizzBuzz Python", "FizzBuzz C", "FizzBuzz Javascript"])
93
- \`\`\`
94
-
95
- **Wait for completion** - Add wait_timeout (in seconds) to wait for ALL workers to finish:
96
-
97
- \`\`\`
98
- get_workers(tasks: ["FizzBuzz Python", "FizzBuzz C"], wait_timeout: 300)
99
- \`\`\`
100
-
101
- When wait_timeout is provided:
102
- - Polls the worker statuses every 2 seconds
103
- - Returns immediately when ALL workers complete
104
- - Returns after wait_timeout seconds if any workers are still running (max: 600)
105
- - Returns timedOut: true if timeout was reached, along with current status of all workers
106
-
107
- **DO NOT**:
108
- - Launch a new worker to "check on" another worker
109
- - Create tasks like "check if the FizzBuzz worker is done"
110
- - Poll manually - use get_workers with wait_timeout instead
111
-
112
- **DO**:
113
- - Use get_workers to check status of one or more workers
114
- - Include wait_timeout when you need to wait for results before proceeding
115
- - Check the allComplete field to know if you can proceed
116
- - Check each worker's isDone field for individual status
117
- - Retrieve results directly from get_workers response
118
-
119
- **Examples**:
120
-
121
- Quick status check (returns immediately):
122
- \`\`\`
123
- get_workers(tasks: ["FizzBuzz Python"])
124
- \`\`\`
125
-
126
- Check multiple workers (returns immediately):
127
- \`\`\`
128
- get_workers(tasks: ["FizzBuzz Python", "FizzBuzz C", "FizzBuzz Javascript"])
129
- \`\`\`
130
-
131
- Wait for all to complete (up to 5 minutes):
132
- \`\`\`
133
- get_workers(tasks: ["FizzBuzz Python", "FizzBuzz C"], wait_timeout: 300)
134
- \`\`\`
135
-
136
- Wait with shorter timeout (60 seconds):
137
- \`\`\`
138
- get_workers(tasks: ["FizzBuzz Python"], wait_timeout: 60)
139
- \`\`\`
140
-
141
- ## Your Response Pattern
142
-
143
- 1. **Acknowledge the request** - Briefly confirm what you'll do
144
- 2. **Launch worker(s)** - Delegate with clear instructions using meaningful task names
145
- 3. **Wait for results** - Worker completion is automatically added to your context
146
- 4. **Check status if needed** - Use get_workers tool to check task status, never launch new tasks for this
147
- 5. **Synthesize and respond** - Summarize worker results for the user in a clear, concise way. DO NOT claim that a worker has completed it's task until there's explicitly task state included in your context.
148
-
149
- ## Remember
150
-
151
- - You are a COORDINATOR, not an IMPLEMENTER
152
- - Workers are your hands - you are the brain
153
- - Delegation is not optional - it's required
154
- - The faster you delegate, the faster work gets done
155
- - Never apologize for delegating - it's your job
156
- - DO NOT assume that a worker successfully completed a task. Verify and wait for the worker to report it's task results.
157
- - Use get_workers to check status - NEVER launch new tasks just to check on other workers
158
-
159
- When in doubt: **delegate**. If it involves touching code, files, or running commands - launch a worker.`;
9
+ // Read the prompt from the markdown file
10
+ const promptPath = path.join(import.meta.dirname, './orchestrator-prompt.md');
11
+ export const ORCHESTRATOR_SYSTEM_PROMPT = fs.readFileSync(promptPath, 'utf-8');
12
+ export default ORCHESTRATOR_SYSTEM_PROMPT;
160
13
  //# sourceMappingURL=orchestrator-prompt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator-prompt.js","sourceRoot":"","sources":["../../src/orchestrator/orchestrator-prompt.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,0BAA0B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yGAqJ+D,CAAC"}
1
+ {"version":3,"file":"orchestrator-prompt.js","sourceRoot":"","sources":["../../src/orchestrator/orchestrator-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;;;GAKG;AAEH,yCAAyC;AACzC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,0BAA0B,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAE/E,eAAe,0BAA0B,CAAC"}