@locusai/sdk 0.4.3 → 0.4.5

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 (93) hide show
  1. package/dist/agent/artifact-syncer.d.ts +1 -1
  2. package/dist/agent/artifact-syncer.d.ts.map +1 -1
  3. package/dist/agent/artifact-syncer.js +1 -1
  4. package/dist/agent/codebase-indexer-service.d.ts +2 -2
  5. package/dist/agent/codebase-indexer-service.d.ts.map +1 -1
  6. package/dist/agent/codebase-indexer-service.js +1 -1
  7. package/dist/agent/index.d.ts +5 -5
  8. package/dist/agent/index.d.ts.map +1 -1
  9. package/dist/agent/index.js +5 -5
  10. package/dist/agent/sprint-planner.d.ts +2 -2
  11. package/dist/agent/sprint-planner.d.ts.map +1 -1
  12. package/dist/agent/sprint-planner.js +25 -19
  13. package/dist/agent/task-executor.d.ts +2 -2
  14. package/dist/agent/task-executor.d.ts.map +1 -1
  15. package/dist/agent/task-executor.js +12 -8
  16. package/dist/agent/worker.d.ts.map +1 -1
  17. package/dist/agent/worker.js +32 -25
  18. package/dist/ai/anthropic-client.js +1 -1
  19. package/dist/ai/claude-runner.d.ts +1 -0
  20. package/dist/ai/claude-runner.d.ts.map +1 -1
  21. package/dist/ai/claude-runner.js +25 -4
  22. package/dist/ai/index.d.ts +2 -2
  23. package/dist/ai/index.d.ts.map +1 -1
  24. package/dist/ai/index.js +2 -2
  25. package/dist/core/index.d.ts +3 -3
  26. package/dist/core/index.d.ts.map +1 -1
  27. package/dist/core/index.js +3 -3
  28. package/dist/core/indexer.d.ts.map +1 -1
  29. package/dist/core/indexer.js +20 -0
  30. package/dist/core/prompt-builder.d.ts +1 -1
  31. package/dist/core/prompt-builder.d.ts.map +1 -1
  32. package/dist/core/prompt-builder.js +24 -28
  33. package/dist/events.d.ts +1 -1
  34. package/dist/events.d.ts.map +1 -1
  35. package/dist/index-node.d.ts +6 -6
  36. package/dist/index-node.d.ts.map +1 -1
  37. package/dist/index-node.js +6 -6
  38. package/dist/index.d.ts +18 -18
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +18 -18
  41. package/dist/modules/auth.d.ts +1 -1
  42. package/dist/modules/auth.d.ts.map +1 -1
  43. package/dist/modules/auth.js +1 -1
  44. package/dist/modules/base.d.ts +1 -1
  45. package/dist/modules/base.d.ts.map +1 -1
  46. package/dist/modules/ci.d.ts +1 -1
  47. package/dist/modules/ci.d.ts.map +1 -1
  48. package/dist/modules/ci.js +1 -1
  49. package/dist/modules/docs.d.ts +1 -1
  50. package/dist/modules/docs.d.ts.map +1 -1
  51. package/dist/modules/docs.js +1 -1
  52. package/dist/modules/invitations.d.ts +1 -1
  53. package/dist/modules/invitations.d.ts.map +1 -1
  54. package/dist/modules/invitations.js +1 -1
  55. package/dist/modules/organizations.d.ts +1 -1
  56. package/dist/modules/organizations.d.ts.map +1 -1
  57. package/dist/modules/organizations.js +1 -1
  58. package/dist/modules/sprints.d.ts +1 -1
  59. package/dist/modules/sprints.d.ts.map +1 -1
  60. package/dist/modules/sprints.js +1 -1
  61. package/dist/modules/tasks.d.ts +1 -1
  62. package/dist/modules/tasks.d.ts.map +1 -1
  63. package/dist/modules/tasks.js +1 -1
  64. package/dist/modules/workspaces.d.ts +1 -1
  65. package/dist/modules/workspaces.d.ts.map +1 -1
  66. package/dist/modules/workspaces.js +1 -1
  67. package/dist/orchestrator.js +2 -2
  68. package/package.json +2 -2
  69. package/src/agent/artifact-syncer.ts +2 -2
  70. package/src/agent/codebase-indexer-service.ts +3 -3
  71. package/src/agent/index.ts +5 -5
  72. package/src/agent/sprint-planner.ts +31 -23
  73. package/src/agent/task-executor.ts +18 -10
  74. package/src/agent/worker.ts +41 -32
  75. package/src/ai/anthropic-client.ts +1 -1
  76. package/src/ai/claude-runner.ts +30 -4
  77. package/src/ai/index.ts +2 -2
  78. package/src/core/index.ts +3 -3
  79. package/src/core/indexer.ts +20 -0
  80. package/src/core/prompt-builder.ts +24 -33
  81. package/src/events.ts +1 -1
  82. package/src/index-node.ts +6 -6
  83. package/src/index.ts +19 -19
  84. package/src/modules/auth.ts +1 -1
  85. package/src/modules/base.ts +1 -1
  86. package/src/modules/ci.ts +1 -1
  87. package/src/modules/docs.ts +1 -1
  88. package/src/modules/invitations.ts +1 -1
  89. package/src/modules/organizations.ts +1 -1
  90. package/src/modules/sprints.ts +1 -1
  91. package/src/modules/tasks.ts +1 -1
  92. package/src/modules/workspaces.ts +1 -1
  93. package/src/orchestrator.ts +2 -2
@@ -1,4 +1,4 @@
1
- import type { LocusClient } from "../index";
1
+ import type { LocusClient } from "../index.js";
2
2
  export interface ArtifactSyncerDeps {
3
3
  client: LocusClient;
4
4
  workspaceId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"artifact-syncer.d.ts","sourceRoot":"","sources":["../../src/agent/artifact-syncer.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,WAAW,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;CAC/E;AAED;;GAEG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,kBAAkB;YAE9B,yBAAyB;IA8BjC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAwD5B"}
1
+ {"version":3,"file":"artifact-syncer.d.ts","sourceRoot":"","sources":["../../src/agent/artifact-syncer.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,WAAW,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;CAC/E;AAED;;GAEG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,kBAAkB;YAE9B,yBAAyB;IA8BjC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAwD5B"}
@@ -1,6 +1,6 @@
1
1
  import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, } from "node:fs";
2
2
  import { join } from "node:path";
3
- import { getLocusPath } from "../core/config";
3
+ import { getLocusPath } from "../core/config.js";
4
4
  /**
5
5
  * Handles syncing local artifacts to the platform
6
6
  */
@@ -1,5 +1,5 @@
1
- import type { AnthropicClient } from "../ai/anthropic-client";
2
- import type { ClaudeRunner } from "../ai/claude-runner";
1
+ import type { AnthropicClient } from "../ai/anthropic-client.js";
2
+ import type { ClaudeRunner } from "../ai/claude-runner.js";
3
3
  export interface CodebaseIndexerServiceDeps {
4
4
  anthropicClient: AnthropicClient | null;
5
5
  claudeRunner: ClaudeRunner;
@@ -1 +1 @@
1
- {"version":3,"file":"codebase-indexer-service.d.ts","sourceRoot":"","sources":["../../src/agent/codebase-indexer-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD,MAAM,WAAW,0BAA0B;IACzC,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;IACxC,YAAY,EAAE,YAAY,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;CAC/E;AAED;;GAEG;AACH,qBAAa,sBAAsB;IAGrB,OAAO,CAAC,IAAI;IAFxB,OAAO,CAAC,OAAO,CAAkB;gBAEb,IAAI,EAAE,0BAA0B;IAI9C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAiD/B"}
1
+ {"version":3,"file":"codebase-indexer-service.d.ts","sourceRoot":"","sources":["../../src/agent/codebase-indexer-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG3D,MAAM,WAAW,0BAA0B;IACzC,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;IACxC,YAAY,EAAE,YAAY,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;CAC/E;AAED;;GAEG;AACH,qBAAa,sBAAsB;IAGrB,OAAO,CAAC,IAAI;IAFxB,OAAO,CAAC,OAAO,CAAkB;gBAEb,IAAI,EAAE,0BAA0B;IAI9C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAiD/B"}
@@ -1,4 +1,4 @@
1
- import { CodebaseIndexer } from "../core/indexer";
1
+ import { CodebaseIndexer } from "../core/indexer.js";
2
2
  /**
3
3
  * Handles codebase indexing with AI analysis
4
4
  */
@@ -1,6 +1,6 @@
1
- export { ArtifactSyncer } from "./artifact-syncer";
2
- export { CodebaseIndexerService } from "./codebase-indexer-service";
3
- export { SprintPlanner } from "./sprint-planner";
4
- export { TaskExecutor } from "./task-executor";
5
- export { AgentWorker, type WorkerConfig } from "./worker";
1
+ export { ArtifactSyncer } from "./artifact-syncer.js";
2
+ export { CodebaseIndexerService } from "./codebase-indexer-service.js";
3
+ export { SprintPlanner } from "./sprint-planner.js";
4
+ export { TaskExecutor } from "./task-executor.js";
5
+ export { AgentWorker, type WorkerConfig } from "./worker.js";
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC"}
@@ -1,5 +1,5 @@
1
- export { ArtifactSyncer } from "./artifact-syncer";
2
- export { CodebaseIndexerService } from "./codebase-indexer-service";
3
- export { SprintPlanner } from "./sprint-planner";
4
- export { TaskExecutor } from "./task-executor";
5
- export { AgentWorker } from "./worker";
1
+ export { ArtifactSyncer } from "./artifact-syncer.js";
2
+ export { CodebaseIndexerService } from "./codebase-indexer-service.js";
3
+ export { SprintPlanner } from "./sprint-planner.js";
4
+ export { TaskExecutor } from "./task-executor.js";
5
+ export { AgentWorker } from "./worker.js";
@@ -1,6 +1,6 @@
1
1
  import type { Sprint, Task } from "@locusai/shared";
2
- import type { AnthropicClient } from "../ai/anthropic-client";
3
- import type { ClaudeRunner } from "../ai/claude-runner";
2
+ import type { AnthropicClient } from "../ai/anthropic-client.js";
3
+ import type { ClaudeRunner } from "../ai/claude-runner.js";
4
4
  export interface SprintPlannerDeps {
5
5
  anthropicClient: AnthropicClient | null;
6
6
  claudeRunner: ClaudeRunner;
@@ -1 +1 @@
1
- {"version":3,"file":"sprint-planner.d.ts","sourceRoot":"","sources":["../../src/agent/sprint-planner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;IACxC,YAAY,EAAE,YAAY,CAAC;IAC3B,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;CAC/E;AAED;;GAEG;AACH,qBAAa,aAAa;IACZ,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,iBAAiB;IAErC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;CA6DjE"}
1
+ {"version":3,"file":"sprint-planner.d.ts","sourceRoot":"","sources":["../../src/agent/sprint-planner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;IACxC,YAAY,EAAE,YAAY,CAAC;IAC3B,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;CAC/E;AAED;;GAEG;AACH,qBAAa,aAAa;IACZ,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,iBAAiB;IAErC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;CAqEjE"}
@@ -8,14 +8,15 @@ export class SprintPlanner {
8
8
  }
9
9
  async planSprint(sprint, tasks) {
10
10
  this.deps.log(`Planning sprint: ${sprint.name}`, "info");
11
- const taskList = tasks
12
- .map((t) => `- [${t.id}] ${t.title}: ${t.description || "No description"}`)
13
- .join("\n");
14
- let plan;
15
- if (this.deps.anthropicClient) {
16
- // Use Anthropic SDK with caching for faster planning
17
- const systemPrompt = `You are an expert project manager and lead engineer specialized in sprint planning and task prioritization.`;
18
- const userPrompt = `# Sprint Planning: ${sprint.name}
11
+ try {
12
+ const taskList = tasks
13
+ .map((t) => `- [${t.id}] ${t.title}: ${t.description || "No description"}`)
14
+ .join("\n");
15
+ let plan;
16
+ if (this.deps.anthropicClient) {
17
+ // Use Anthropic SDK with caching for faster planning
18
+ const systemPrompt = `You are an expert project manager and lead engineer specialized in sprint planning and task prioritization.`;
19
+ const userPrompt = `# Sprint Planning: ${sprint.name}
19
20
 
20
21
  ## Tasks
21
22
  ${taskList}
@@ -30,14 +31,14 @@ ${taskList}
30
31
  - Do NOT create any files on the filesystem during this planning phase.
31
32
  - Avoid using absolute local paths (e.g., /Users/...) in your output. Use relative paths starting from the project root if necessary.
32
33
  - Your output will be saved as the official sprint mindmap on the server.`;
33
- plan = await this.deps.anthropicClient.run({
34
- systemPrompt,
35
- userPrompt,
36
- });
37
- }
38
- else {
39
- // Fallback to Claude CLI
40
- const planningPrompt = `# Sprint Planning: ${sprint.name}
34
+ plan = await this.deps.anthropicClient.run({
35
+ systemPrompt,
36
+ userPrompt,
37
+ });
38
+ }
39
+ else {
40
+ // Fallback to Claude CLI
41
+ const planningPrompt = `# Sprint Planning: ${sprint.name}
41
42
 
42
43
  You are an expert project manager and lead engineer. You need to create a mindmap and execution plan for the following tasks in this sprint.
43
44
 
@@ -54,9 +55,14 @@ ${taskList}
54
55
  - Do NOT create any files on the filesystem during this planning phase.
55
56
  - Avoid using absolute local paths (e.g., /Users/...) in your output. Use relative paths starting from the project root if necessary.
56
57
  - Your output will be saved as the official sprint mindmap on the server.`;
57
- plan = await this.deps.claudeRunner.run(planningPrompt, true);
58
+ plan = await this.deps.claudeRunner.run(planningPrompt, true);
59
+ }
60
+ this.deps.log("Sprint mindmap generated and posted to server.", "success");
61
+ return plan;
62
+ }
63
+ catch (error) {
64
+ this.deps.log(`Sprint planning failed: ${error}`, "error");
65
+ return sprint.mindmap || "";
58
66
  }
59
- this.deps.log("Sprint mindmap generated and posted to server.", "success");
60
- return plan;
61
67
  }
62
68
  }
@@ -1,6 +1,6 @@
1
1
  import type { Task } from "@locusai/shared";
2
- import type { AnthropicClient } from "../ai/anthropic-client";
3
- import type { ClaudeRunner } from "../ai/claude-runner";
2
+ import type { AnthropicClient } from "../ai/anthropic-client.js";
3
+ import type { ClaudeRunner } from "../ai/claude-runner.js";
4
4
  export interface TaskExecutorDeps {
5
5
  anthropicClient: AnthropicClient | null;
6
6
  claudeRunner: ClaudeRunner;
@@ -1 +1 @@
1
- {"version":3,"file":"task-executor.d.ts","sourceRoot":"","sources":["../../src/agent/task-executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;IACxC,YAAY,EAAE,YAAY,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;CAC/E;AAED;;GAEG;AACH,qBAAa,YAAY;IAGX,OAAO,CAAC,IAAI;IAFxB,OAAO,CAAC,aAAa,CAAgB;gBAEjB,IAAI,EAAE,gBAAgB;IAI1C,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIpC,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAiD1E"}
1
+ {"version":3,"file":"task-executor.d.ts","sourceRoot":"","sources":["../../src/agent/task-executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG3D,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;IACxC,YAAY,EAAE,YAAY,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;CAC/E;AAED;;GAEG;AACH,qBAAa,YAAY;IAGX,OAAO,CAAC,IAAI;IAFxB,OAAO,CAAC,aAAa,CAAgB;gBAEjB,IAAI,EAAE,gBAAgB;IAI1C,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIpC,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAyD1E"}
@@ -1,4 +1,4 @@
1
- import { PromptBuilder } from "../core/prompt-builder";
1
+ import { PromptBuilder } from "../core/prompt-builder.js";
2
2
  /**
3
3
  * Handles task execution with two-phase approach (planning + execution)
4
4
  */
@@ -19,7 +19,7 @@ export class TaskExecutor {
19
19
  basePrompt = `## Sprint Context\n${this.deps.sprintPlan}\n\n${basePrompt}`;
20
20
  }
21
21
  try {
22
- let plan;
22
+ let plan = "";
23
23
  if (this.deps.anthropicClient) {
24
24
  // Phase 1: Planning (using Anthropic SDK with caching)
25
25
  this.deps.log("Phase 1: Planning (Anthropic SDK)...", "info");
@@ -32,14 +32,18 @@ export class TaskExecutor {
32
32
  });
33
33
  }
34
34
  else {
35
- // Phase 1: Planning (using Claude CLI)
36
- this.deps.log("Phase 1: Planning (Claude CLI)...", "info");
37
- const planningPrompt = `${basePrompt}\n\n## Phase 1: Planning\nAnalyze and create a detailed plan for THIS SPECIFIC TASK. Do NOT execute changes yet.`;
38
- plan = await this.deps.claudeRunner.run(planningPrompt, true);
35
+ this.deps.log("Skipping Phase 1: Planning (No Anthropic API Key)...", "info");
39
36
  }
40
37
  // Phase 2: Execution (always using Claude CLI for agentic tools)
41
- this.deps.log("Plan generated. Starting Phase 2: Execution...", "info");
42
- const executionPrompt = `${basePrompt}\n\n## Phase 2: Execution\nBased on the plan, execute the task:\n\n${plan}\n\nWhen finished, output: <promise>COMPLETE</promise>`;
38
+ this.deps.log("Starting Execution...", "info");
39
+ let executionPrompt = basePrompt;
40
+ if (plan) {
41
+ executionPrompt += `\n\n## Phase 2: Execution\nBased on the plan, execute the task:\n\n${plan}`;
42
+ }
43
+ else {
44
+ executionPrompt += `\n\n## Execution\nExecute the task directly.`;
45
+ }
46
+ executionPrompt += `\n\nWhen finished, output: <promise>COMPLETE</promise>`;
43
47
  const output = await this.deps.claudeRunner.run(executionPrompt);
44
48
  const success = output.includes("<promise>COMPLETE</promise>");
45
49
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/agent/worker.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,qBAAa,WAAW;IAmBV,OAAO,CAAC,MAAM;IAlB1B,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,eAAe,CAAyB;IAGhD,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,cAAc,CAAyB;IAC/C,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,YAAY,CAAe;IAGnC,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,QAAQ,CAAM;IACtB,OAAO,CAAC,QAAQ,CAAM;IACtB,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,UAAU,CAAuB;gBAErB,MAAM,EAAE,YAAY;IAqExC,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAgB;YAe5D,eAAe;YAcf,WAAW;YAiBX,WAAW;IAqBnB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA+F3B"}
1
+ {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/agent/worker.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,qBAAa,WAAW;IAmBV,OAAO,CAAC,MAAM;IAlB1B,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,eAAe,CAAyB;IAGhD,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,cAAc,CAAyB;IAC/C,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,YAAY,CAAe;IAGnC,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,QAAQ,CAAM;IACtB,OAAO,CAAC,QAAQ,CAAM;IACtB,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,UAAU,CAAuB;gBAErB,MAAM,EAAE,YAAY;IAqExC,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAgB;YAe5D,eAAe;YAcf,WAAW;YAiBX,WAAW;IAqBnB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAwG3B"}
@@ -1,11 +1,11 @@
1
- import { AnthropicClient } from "../ai/anthropic-client";
2
- import { ClaudeRunner } from "../ai/claude-runner";
3
- import { LocusClient } from "../index";
4
- import { c } from "../utils/colors";
5
- import { ArtifactSyncer } from "./artifact-syncer";
6
- import { CodebaseIndexerService } from "./codebase-indexer-service";
7
- import { SprintPlanner } from "./sprint-planner";
8
- import { TaskExecutor } from "./task-executor";
1
+ import { AnthropicClient } from "../ai/anthropic-client.js";
2
+ import { ClaudeRunner } from "../ai/claude-runner.js";
3
+ import { LocusClient } from "../index.js";
4
+ import { c } from "../utils/colors.js";
5
+ import { ArtifactSyncer } from "./artifact-syncer.js";
6
+ import { CodebaseIndexerService } from "./codebase-indexer-service.js";
7
+ import { SprintPlanner } from "./sprint-planner.js";
8
+ import { TaskExecutor } from "./task-executor.js";
9
9
  /**
10
10
  * Main agent worker that orchestrates task execution
11
11
  * Delegates responsibilities to specialized services
@@ -116,14 +116,14 @@ export class AgentWorker {
116
116
  }
117
117
  }
118
118
  async executeTask(task) {
119
- // Reindex codebase before execution to ensure fresh context
120
- await this.indexerService.reindex();
121
119
  // Fetch full task details to get comments/feedback
122
120
  const fullTask = await this.client.tasks.getById(task.id, this.config.workspaceId);
123
121
  // Update task executor with current sprint plan
124
122
  this.taskExecutor.updateSprintPlan(this.sprintPlan);
125
123
  // Execute the task
126
124
  const result = await this.taskExecutor.execute(fullTask);
125
+ // Reindex codebase after execution to ensure fresh context
126
+ await this.indexerService.reindex();
127
127
  return result;
128
128
  }
129
129
  async run() {
@@ -143,23 +143,30 @@ export class AgentWorker {
143
143
  const mindmapDate = sprint.mindmapUpdatedAt
144
144
  ? new Date(sprint.mindmapUpdatedAt)
145
145
  : new Date(0);
146
- const needsPlanning = !sprint.mindmap ||
147
- sprint.mindmap.trim() === "" ||
148
- latestTaskCreation > mindmapDate;
149
- if (needsPlanning) {
150
- if (sprint.mindmap && latestTaskCreation > mindmapDate) {
151
- this.log("New tasks have been added to the sprint since last mindmap. Regenerating...", "warn");
152
- }
153
- this.sprintPlan = await this.sprintPlanner.planSprint(sprint, tasks);
154
- // Save mindmap to server
155
- await this.client.sprints.update(sprint.id, this.config.workspaceId, {
156
- mindmap: this.sprintPlan,
157
- mindmapUpdatedAt: new Date(),
158
- });
146
+ // Skip mindmap generation if there's only one task
147
+ if (tasks.length <= 1) {
148
+ this.log("Skipping mindmap generation (only one task in sprint).", "info");
149
+ this.sprintPlan = null;
159
150
  }
160
151
  else {
161
- this.log("Using existing sprint mindmap.", "info");
162
- this.sprintPlan = sprint.mindmap ?? null;
152
+ const needsPlanning = !sprint.mindmap ||
153
+ sprint.mindmap.trim() === "" ||
154
+ latestTaskCreation > mindmapDate;
155
+ if (needsPlanning) {
156
+ if (sprint.mindmap && latestTaskCreation > mindmapDate) {
157
+ this.log("New tasks have been added to the sprint since last mindmap. Regenerating...", "warn");
158
+ }
159
+ this.sprintPlan = await this.sprintPlanner.planSprint(sprint, tasks);
160
+ // Save mindmap to server
161
+ await this.client.sprints.update(sprint.id, this.config.workspaceId, {
162
+ mindmap: this.sprintPlan,
163
+ mindmapUpdatedAt: new Date(),
164
+ });
165
+ }
166
+ else {
167
+ this.log("Using existing sprint mindmap.", "info");
168
+ this.sprintPlan = sprint.mindmap ?? null;
169
+ }
163
170
  }
164
171
  }
165
172
  else {
@@ -1,5 +1,5 @@
1
1
  import Anthropic from "@anthropic-ai/sdk";
2
- import { DEFAULT_MODEL } from "../core/config";
2
+ import { DEFAULT_MODEL } from "../core/config.js";
3
3
  /**
4
4
  * Anthropic Client with Prompt Caching Support
5
5
  *
@@ -3,5 +3,6 @@ export declare class ClaudeRunner {
3
3
  private model;
4
4
  constructor(projectPath: string, model?: string);
5
5
  run(prompt: string, _isPlanning?: boolean): Promise<string>;
6
+ private executeRun;
6
7
  }
7
8
  //# sourceMappingURL=claude-runner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"claude-runner.d.ts","sourceRoot":"","sources":["../../src/ai/claude-runner.ts"],"names":[],"mappings":"AAGA,qBAAa,YAAY;IAErB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,KAAK;gBADL,WAAW,EAAE,MAAM,EACnB,KAAK,GAAE,MAAsB;IAGvC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,UAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;CAkD1D"}
1
+ {"version":3,"file":"claude-runner.d.ts","sourceRoot":"","sources":["../../src/ai/claude-runner.ts"],"names":[],"mappings":"AAGA,qBAAa,YAAY;IAErB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,KAAK;gBADL,WAAW,EAAE,MAAM,EACnB,KAAK,GAAE,MAAsB;IAGjC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,UAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAyB/D,OAAO,CAAC,UAAU;CAmDnB"}
@@ -1,5 +1,5 @@
1
1
  import { spawn } from "node:child_process";
2
- import { DEFAULT_MODEL } from "../core/config";
2
+ import { DEFAULT_MODEL } from "../core/config.js";
3
3
  export class ClaudeRunner {
4
4
  projectPath;
5
5
  model;
@@ -7,7 +7,27 @@ export class ClaudeRunner {
7
7
  this.projectPath = projectPath;
8
8
  this.model = model;
9
9
  }
10
- run(prompt, _isPlanning = false) {
10
+ async run(prompt, _isPlanning = false) {
11
+ const maxRetries = 3;
12
+ let lastError = null;
13
+ for (let attempt = 1; attempt <= maxRetries; attempt++) {
14
+ try {
15
+ return await this.executeRun(prompt);
16
+ }
17
+ catch (error) {
18
+ const err = error;
19
+ lastError = err;
20
+ const isLastAttempt = attempt === maxRetries;
21
+ if (!isLastAttempt) {
22
+ const delay = Math.pow(2, attempt) * 1000; // 2s, 4s, 8s
23
+ console.warn(`Claude CLI attempt ${attempt} failed: ${err.message}. Retrying in ${delay}ms...`);
24
+ await new Promise((resolve) => setTimeout(resolve, delay));
25
+ }
26
+ }
27
+ }
28
+ throw lastError || new Error("Claude CLI failed after multiple attempts");
29
+ }
30
+ executeRun(prompt) {
11
31
  return new Promise((resolve, reject) => {
12
32
  const args = [
13
33
  "--dangerously-skip-permissions",
@@ -25,11 +45,12 @@ export class ClaudeRunner {
25
45
  let errorOutput = "";
26
46
  claude.stdout.on("data", (data) => {
27
47
  output += data.toString();
28
- process.stdout.write(data.toString());
48
+ // Only write to stdout if we're not retrying or if logic dictates
49
+ // process.stdout.write(data.toString());
29
50
  });
30
51
  claude.stderr.on("data", (data) => {
31
52
  errorOutput += data.toString();
32
- process.stderr.write(data.toString());
53
+ // process.stderr.write(data.toString());
33
54
  });
34
55
  claude.on("error", (err) => reject(new Error(`Failed to start Claude CLI (shell: true): ${err.message}. Please ensure the 'claude' command is available in your PATH.`)));
35
56
  claude.on("close", (code) => {
@@ -1,3 +1,3 @@
1
- export { AnthropicClient } from "./anthropic-client";
2
- export { ClaudeRunner } from "./claude-runner";
1
+ export { AnthropicClient } from "./anthropic-client.js";
2
+ export { ClaudeRunner } from "./claude-runner.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/ai/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { AnthropicClient } from "./anthropic-client";
2
- export { ClaudeRunner } from "./claude-runner";
1
+ export { AnthropicClient } from "./anthropic-client.js";
2
+ export { ClaudeRunner } from "./claude-runner.js";
@@ -1,4 +1,4 @@
1
- export { DEFAULT_MODEL, getLocusPath, LOCUS_CONFIG } from "./config";
2
- export { type CodebaseIndex, CodebaseIndexer } from "./indexer";
3
- export { PromptBuilder } from "./prompt-builder";
1
+ export { DEFAULT_MODEL, getLocusPath, LOCUS_CONFIG } from "./config.js";
2
+ export { type CodebaseIndex, CodebaseIndexer } from "./indexer.js";
3
+ export { PromptBuilder } from "./prompt-builder.js";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,EAAE,KAAK,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,KAAK,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,3 +1,3 @@
1
- export { DEFAULT_MODEL, getLocusPath, LOCUS_CONFIG } from "./config";
2
- export { CodebaseIndexer } from "./indexer";
3
- export { PromptBuilder } from "./prompt-builder";
1
+ export { DEFAULT_MODEL, getLocusPath, LOCUS_CONFIG } from "./config.js";
2
+ export { CodebaseIndexer } from "./indexer.js";
3
+ export { PromptBuilder } from "./prompt-builder.js";
@@ -1 +1 @@
1
- {"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../../src/core/indexer.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAS;gBAEd,WAAW,EAAE,MAAM;IAK/B;;;OAGG;IACG,KAAK,CACT,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,EACtC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,GACxD,OAAO,CAAC,aAAa,CAAC;IAkEzB,SAAS,IAAI,aAAa,GAAG,IAAI;IAWjC,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;CAOtC"}
1
+ {"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../../src/core/indexer.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAS;gBAEd,WAAW,EAAE,MAAM;IAK/B;;;OAGG;IACG,KAAK,CACT,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,EACtC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,GACxD,OAAO,CAAC,aAAa,CAAC;IAsFzB,SAAS,IAAI,aAAa,GAAG,IAAI;IAWjC,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;CAOtC"}
@@ -19,10 +19,30 @@ export class CodebaseIndexer {
19
19
  if (onProgress)
20
20
  onProgress("Generating file tree...");
21
21
  // 1. Get a comprehensive but clean file tree
22
+ const gitmodulesPath = join(this.projectPath, ".gitmodules");
23
+ const submoduleIgnores = [];
24
+ if (existsSync(gitmodulesPath)) {
25
+ try {
26
+ const content = readFileSync(gitmodulesPath, "utf-8");
27
+ const lines = content.split("\n");
28
+ for (const line of lines) {
29
+ const match = line.match(/^\s*path\s*=\s*(.*)$/);
30
+ const path = match?.[1]?.trim();
31
+ if (path) {
32
+ submoduleIgnores.push(`${path}/**`);
33
+ submoduleIgnores.push(`**/${path}/**`);
34
+ }
35
+ }
36
+ }
37
+ catch {
38
+ // Fallback if .gitmodules exists but can't be read or parsed
39
+ }
40
+ }
22
41
  const files = await globby(["**/*"], {
23
42
  cwd: this.projectPath,
24
43
  gitignore: true,
25
44
  ignore: [
45
+ ...submoduleIgnores,
26
46
  "**/node_modules/**",
27
47
  "**/dist/**",
28
48
  "**/build/**",
@@ -3,6 +3,6 @@ export declare class PromptBuilder {
3
3
  private projectPath;
4
4
  constructor(projectPath: string);
5
5
  build(task: Task): Promise<string>;
6
- private formatIndex;
6
+ roleToText(role: Task["assigneeRole"]): string | null;
7
7
  }
8
8
  //# sourceMappingURL=prompt-builder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-builder.d.ts","sourceRoot":"","sources":["../../src/core/prompt-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAIvC,qBAAa,aAAa;IACZ,OAAO,CAAC,WAAW;gBAAX,WAAW,EAAE,MAAM;IAEjC,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IAmExC,OAAO,CAAC,WAAW;CAwBpB"}
1
+ {"version":3,"file":"prompt-builder.d.ts","sourceRoot":"","sources":["../../src/core/prompt-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAGrD,qBAAa,aAAa;IACZ,OAAO,CAAC,WAAW;gBAAX,WAAW,EAAE,MAAM;IAEjC,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IA+DxC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,MAAM,GAAG,IAAI;CAoBtD"}
@@ -1,5 +1,6 @@
1
1
  import { existsSync, readFileSync } from "node:fs";
2
- import { getLocusPath } from "./config";
2
+ import { AssigneeRole } from "@locusai/shared";
3
+ import { getLocusPath } from "./config.js";
3
4
  export class PromptBuilder {
4
5
  projectPath;
5
6
  constructor(projectPath) {
@@ -7,8 +8,9 @@ export class PromptBuilder {
7
8
  }
8
9
  async build(task) {
9
10
  let prompt = `# Task: ${task.title}\n\n`;
10
- if (task.assigneeRole) {
11
- prompt += `## Role\nYou are acting as a ${task.assigneeRole} engineer.\n\n`;
11
+ const roleText = this.roleToText(task.assigneeRole);
12
+ if (roleText) {
13
+ prompt += `## Role\nYou are acting as a ${roleText}.\n\n`;
12
14
  }
13
15
  prompt += `## Description\n${task.description || "No description provided."}\n\n`;
14
16
  // 1. Add CLAUDE.md context
@@ -25,14 +27,7 @@ export class PromptBuilder {
25
27
  // 2. Add Codebase Index context
26
28
  const indexPath = getLocusPath(this.projectPath, "indexFile");
27
29
  if (existsSync(indexPath)) {
28
- try {
29
- const indexContent = readFileSync(indexPath, "utf-8");
30
- const index = JSON.parse(indexContent);
31
- prompt += this.formatIndex(index, task);
32
- }
33
- catch (err) {
34
- console.warn(`Warning: Could not read codebase index: ${err}`);
35
- }
30
+ prompt += `## Codebase Overview\nThere is an index file in the .locus/codebase-index.json and if you need you can check it.\n\n`;
36
31
  }
37
32
  // 3. Add Documents
38
33
  if (task.docs && task.docs.length > 0) {
@@ -51,9 +46,10 @@ export class PromptBuilder {
51
46
  }
52
47
  // 5. Add Comments & Feedback
53
48
  if (task.comments && task.comments.length > 0) {
49
+ const comments = task.comments.slice(0, 5);
54
50
  prompt += `## Task History & Feedback\n`;
55
51
  prompt += `Review the following comments for context or rejection feedback:\n\n`;
56
- for (const comment of task.comments) {
52
+ for (const comment of comments) {
57
53
  const date = new Date(comment.createdAt).toLocaleString();
58
54
  prompt += `### ${comment.author} (${date})\n${comment.text}\n\n`;
59
55
  }
@@ -65,23 +61,23 @@ export class PromptBuilder {
65
61
  4. When finished successfully, output: <promise>COMPLETE</promise>\n`;
66
62
  return prompt;
67
63
  }
68
- formatIndex(index, task) {
69
- let section = `## Codebase Overview\nThis codebase has been indexed to help you navigate.\n\n`;
70
- // Structural directories
71
- const structuralDirs = Object.entries(index.responsibilities || {})
72
- .filter(([path]) => !path.includes(".") || path.split("/").length <= 2)
73
- .slice(0, 15);
74
- if (structuralDirs.length > 0) {
75
- section += `### Project Structure\n${structuralDirs.map(([p, d]) => `- \`${p}\`: ${d}`).join("\n")}\n\n`;
64
+ roleToText(role) {
65
+ if (!role) {
66
+ return null;
76
67
  }
77
- // Relevant symbols
78
- const keywords = `${task.title} ${task.description}`.toLowerCase();
79
- const symbols = Object.entries(index.symbols || {})
80
- .filter(([symbol]) => keywords.includes(symbol.toLowerCase()))
81
- .slice(0, 10);
82
- if (symbols.length > 0) {
83
- section += `### Potentially Relevant Symbols\n${symbols.map(([s, f]) => `- \`${s}\` is defined in: ${Array.isArray(f) ? f.join(", ") : f}`).join("\n")}\n\n`;
68
+ switch (role) {
69
+ case AssigneeRole.BACKEND:
70
+ return "Backend Engineer";
71
+ case AssigneeRole.FRONTEND:
72
+ return "Frontend Engineer";
73
+ case AssigneeRole.PM:
74
+ return "Product Manager";
75
+ case AssigneeRole.QA:
76
+ return "QA Engineer";
77
+ case AssigneeRole.DESIGN:
78
+ return "Product Designer";
79
+ default:
80
+ return "engineer";
84
81
  }
85
- return section;
86
82
  }
87
83
  }
package/dist/events.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter } from "events";
2
- import { RetryOptions } from "./utils/retry";
2
+ import { RetryOptions } from "./utils/retry.js";
3
3
  export declare enum LocusEvent {
4
4
  TOKEN_EXPIRED = "TOKEN_EXPIRED",
5
5
  AUTH_ERROR = "AUTH_ERROR",
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,oBAAY,UAAU;IACpB,aAAa,kBAAkB;IAC/B,UAAU,eAAe;IACzB,aAAa,kBAAkB;CAChC;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,qBAAa,YAAa,SAAQ,YAAY;IAC5C,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,aAAa,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAC/D,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI;IACxE,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,aAAa,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI;IAQ3E,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,aAAa,GAAG,OAAO;IAC9C,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO;IACzD,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO;CAI7D"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,oBAAY,UAAU;IACpB,aAAa,kBAAkB;IAC/B,UAAU,eAAe;IACzB,aAAa,kBAAkB;CAChC;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,qBAAa,YAAa,SAAQ,YAAY;IAC5C,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,aAAa,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAC/D,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI;IACxE,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,aAAa,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI;IAQ3E,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,aAAa,GAAG,OAAO;IAC9C,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO;IACzD,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO;CAI7D"}
@@ -6,10 +6,10 @@
6
6
  * These modules use Node.js APIs (fs, child_process, etc.)
7
7
  * and will break in browser environments
8
8
  */
9
- export * from "./agent";
10
- export * from "./ai";
11
- export * from "./core";
12
- export * from "./index";
13
- export { AgentOrchestrator, type OrchestratorConfig } from "./orchestrator";
14
- export { c } from "./utils/colors";
9
+ export * from "./agent/index.js";
10
+ export * from "./ai/index.js";
11
+ export * from "./core/index.js";
12
+ export * from "./index.js";
13
+ export { AgentOrchestrator, type OrchestratorConfig } from "./orchestrator.js";
14
+ export { c } from "./utils/colors.js";
15
15
  //# sourceMappingURL=index-node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../src/index-node.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,cAAc,SAAS,CAAC;AAExB,cAAc,MAAM,CAAC;AAErB,cAAc,QAAQ,CAAC;AAEvB,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAG5E,OAAO,EAAE,CAAC,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../src/index-node.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,cAAc,kBAAkB,CAAC;AAEjC,cAAc,eAAe,CAAC;AAE9B,cAAc,iBAAiB,CAAC;AAEhC,cAAc,YAAY,CAAC;AAG3B,OAAO,EAAE,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG/E,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC"}