@locusai/sdk 0.9.16 → 0.9.18

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.
@@ -1 +1 @@
1
- {"version":3,"file":"codebase-indexer-service.d.ts","sourceRoot":"","sources":["../../src/agent/codebase-indexer-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGhD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,KAAK,CAAC;CACZ;AAED;;GAEG;AACH,qBAAa,sBAAsB;IAGrB,OAAO,CAAC,IAAI;IAFxB,OAAO,CAAC,OAAO,CAAkB;gBAEb,IAAI,EAAE,0BAA0B;IAI9C,OAAO,CAAC,KAAK,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CA2C5C"}
1
+ {"version":3,"file":"codebase-indexer-service.d.ts","sourceRoot":"","sources":["../../src/agent/codebase-indexer-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAIhD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,KAAK,CAAC;CACZ;AAED;;GAEG;AACH,qBAAa,sBAAsB;IAGrB,OAAO,CAAC,IAAI;IAFxB,OAAO,CAAC,OAAO,CAAkB;gBAEb,IAAI,EAAE,0BAA0B;IAI9C,OAAO,CAAC,KAAK,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CA2C5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"git-utils.d.ts","sourceRoot":"","sources":["../../src/git/git-utils.ts"],"names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MAAM,GAAG,MAAM,CAM5D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,MAAM,SAAW,GAChB,MAAM,CAsCR"}
@@ -17,5 +17,6 @@ export { AgentOrchestrator, type AgentState, type OrchestratorConfig, } from "./
17
17
  export * from "./planning/index.js";
18
18
  export { KnowledgeBase } from "./project/knowledge-base.js";
19
19
  export { c } from "./utils/colors.js";
20
+ export { extractJsonFromLLMOutput } from "./utils/json-extractor.js";
20
21
  export * from "./worktree/index.js";
21
22
  //# 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,kBAAkB,CAAC;AAEjC,cAAc,eAAe,CAAC;AAE9B,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,cAAc,iBAAiB,CAAC;AAEhC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,YAAY,CAAC;AAE3B,OAAO,EACL,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,kBAAkB,GACxB,MAAM,mBAAmB,CAAC;AAE3B,cAAc,qBAAqB,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAEtC,cAAc,qBAAqB,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;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,cAAc,iBAAiB,CAAC;AAEhC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,YAAY,CAAC;AAE3B,OAAO,EACL,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,kBAAkB,GACxB,MAAM,mBAAmB,CAAC;AAE3B,cAAc,qBAAqB,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,cAAc,qBAAqB,CAAC"}
@@ -2882,6 +2882,7 @@ __export(exports_index_node, {
2882
2882
  getDefaultBranch: () => getDefaultBranch,
2883
2883
  getCurrentBranch: () => getCurrentBranch,
2884
2884
  getAgentArtifactsPath: () => getAgentArtifactsPath,
2885
+ extractJsonFromLLMOutput: () => extractJsonFromLLMOutput,
2885
2886
  detectRemoteProvider: () => detectRemoteProvider,
2886
2887
  createAiRunner: () => createAiRunner,
2887
2888
  c: () => c,
@@ -3148,6 +3149,51 @@ class CodebaseIndexer {
3148
3149
  }
3149
3150
  }
3150
3151
 
3152
+ // src/utils/json-extractor.ts
3153
+ function extractJsonFromLLMOutput(raw) {
3154
+ const trimmed = raw.trim();
3155
+ const codeBlockMatch = trimmed.match(/```(?:json)?\s*\n?([\s\S]*?)\n?```/);
3156
+ if (codeBlockMatch) {
3157
+ return codeBlockMatch[1]?.trim() || "";
3158
+ }
3159
+ if (trimmed.startsWith("{")) {
3160
+ return trimmed;
3161
+ }
3162
+ const startIdx = trimmed.indexOf("{");
3163
+ if (startIdx === -1) {
3164
+ return trimmed;
3165
+ }
3166
+ let depth = 0;
3167
+ let inString = false;
3168
+ let escaped = false;
3169
+ for (let i = startIdx;i < trimmed.length; i++) {
3170
+ const ch = trimmed[i];
3171
+ if (escaped) {
3172
+ escaped = false;
3173
+ continue;
3174
+ }
3175
+ if (ch === "\\") {
3176
+ escaped = true;
3177
+ continue;
3178
+ }
3179
+ if (ch === '"') {
3180
+ inString = !inString;
3181
+ continue;
3182
+ }
3183
+ if (inString)
3184
+ continue;
3185
+ if (ch === "{")
3186
+ depth++;
3187
+ else if (ch === "}") {
3188
+ depth--;
3189
+ if (depth === 0) {
3190
+ return trimmed.slice(startIdx, i + 1);
3191
+ }
3192
+ }
3193
+ }
3194
+ return trimmed.slice(startIdx);
3195
+ }
3196
+
3151
3197
  // src/agent/codebase-indexer-service.ts
3152
3198
  class CodebaseIndexerService {
3153
3199
  deps;
@@ -3173,11 +3219,12 @@ ${tree}
3173
3219
 
3174
3220
  Return ONLY valid JSON, no markdown formatting.`;
3175
3221
  const response = await this.deps.aiRunner.run(prompt);
3176
- const jsonMatch = response.match(/\{[\s\S]*\}/);
3177
- if (jsonMatch) {
3178
- return JSON.parse(jsonMatch[0]);
3222
+ const jsonStr = extractJsonFromLLMOutput(response);
3223
+ try {
3224
+ return JSON.parse(jsonStr);
3225
+ } catch {
3226
+ return { symbols: {}, responsibilities: {}, lastIndexed: "" };
3179
3227
  }
3180
- return { symbols: {}, responsibilities: {}, lastIndexed: "" };
3181
3228
  }, force);
3182
3229
  if (index === null) {
3183
3230
  this.deps.log("No changes detected, skipping reindex", "info");
@@ -4805,12 +4852,11 @@ function plannedTasksToCreatePayloads(plan, sprintId) {
4805
4852
  }));
4806
4853
  }
4807
4854
  function parseSprintPlanFromAI(raw, directive) {
4808
- let jsonStr = raw.trim();
4809
- const jsonMatch = jsonStr.match(/```(?:json)?\s*\n?([\s\S]*?)\n?```/);
4810
- if (jsonMatch) {
4811
- jsonStr = jsonMatch[1]?.trim() || "";
4855
+ const jsonStr = extractJsonFromLLMOutput(raw);
4856
+ let parsed = JSON.parse(jsonStr);
4857
+ if (parsed.revisedPlan) {
4858
+ parsed = parsed.revisedPlan;
4812
4859
  }
4813
- const parsed = JSON.parse(jsonStr);
4814
4860
  const now = new Date().toISOString();
4815
4861
  const id = `plan-${Date.now()}`;
4816
4862
  const tasks2 = (parsed.tasks || []).map((t, i) => ({
@@ -5007,14 +5053,29 @@ Review and refine the Tech Lead's breakdown:
5007
5053
 
5008
5054
  1. **Ordering** — Order tasks so that foundational work comes first. Tasks that produce outputs consumed by later tasks must appear earlier in the list. Foundation tasks (schemas, config, shared code) must be listed before tasks that build on them. The array index IS the execution order.
5009
5055
  2. **Risk Assessment** — Flag tasks that are risky, underestimated, or have unknowns.
5010
- 3. **Task Splitting** — If a task is too large (would take more than a day), split it.
5011
- 4. **Task Merging** — If two tasks are trivially small and related, merge them.
5012
- 5. **Complexity Scoring** — Rate each task 1-5 (1=trivial, 5=very complex).
5013
- 6. **Missing Tasks** — Add any tasks the Tech Lead missed (database migrations, configuration, testing, etc.).
5056
+ 3. **Task Merging** — If two tasks are trivially small and related, merge them.
5057
+ 4. **Complexity Scoring** — Rate each task 1-5 (1=trivial, 5=very complex).
5058
+ 5. **Missing Tasks** — Add any tasks the Tech Lead missed (database migrations, configuration, testing, etc.).
5059
+
5060
+ ## CRITICAL: Task Isolation & Overlap Detection
5061
+
5062
+ Tasks are executed by INDEPENDENT agents on SEPARATE git branches that get merged together. Each agent has NO knowledge of what other agents are doing. You MUST enforce these rules:
5063
+
5064
+ 1. **Detect overlapping file modifications.** For each task, mentally list the files it will touch. If two tasks modify the same file (especially config files like app.module.ts, configuration.ts, package.json, or shared modules), they WILL cause merge conflicts. You must either:
5065
+ - **Merge them** into a single task, OR
5066
+ - **Move the shared file changes** into one foundational task that runs and merges first
5067
+
5068
+ 2. **Detect duplicated work.** If two tasks both introduce the same environment variable, config field, dependency, helper function, or module registration — that is duplicated work. Consolidate it into ONE task.
5069
+
5070
+ 3. **Do NOT split tasks that share code changes.** Even if a task is large, do NOT split it if the subtasks would both need to modify the same files. A single larger self-contained task is far better than two smaller conflicting tasks. Only split tasks when the parts are truly independent (touch completely different files and modules).
5071
+
5072
+ 4. **Validate self-containment.** Each task must include ALL changes it needs to function: config, schema, module registration, implementation, and tests. A task must NOT assume another concurrent task will provide something it needs.
5073
+
5074
+ 5. **Flag high-conflict zones.** In your risk assessment, specifically call out any remaining cases where tasks might touch the same files, and explain why it's unavoidable and how merge conflicts can be minimized.
5014
5075
 
5015
5076
  ## Output Format
5016
5077
 
5017
- Respond with ONLY a JSON object (no markdown code blocks, no explanation):
5078
+ Your entire response must be a single JSON object no text before it, no text after it, no markdown code blocks, no explanation. Start your response with the "{" character:
5018
5079
 
5019
5080
  {
5020
5081
  "tasks": [
@@ -5040,6 +5101,116 @@ Respond with ONLY a JSON object (no markdown code blocks, no explanation):
5040
5101
  return prompt;
5041
5102
  }
5042
5103
 
5104
+ // src/planning/agents/cross-task-reviewer.ts
5105
+ function buildCrossTaskReviewerPrompt(input) {
5106
+ let prompt = `# Role: Cross-Task Reviewer (Architect + Engineer + Planner)
5107
+
5108
+ You are a combined Architect, Senior Engineer, and Sprint Planner performing a FINAL review of a sprint plan. Your sole focus is ensuring that tasks are fully isolated and will not conflict when executed by independent agents on separate git branches.
5109
+
5110
+ ## Context
5111
+
5112
+ In this system, each task is executed by an independent AI agent that:
5113
+ - Works on its own git branch (worktree)
5114
+ - Has NO knowledge of what other agents are working on
5115
+ - Cannot see changes made by other concurrent agents
5116
+ - Its branch will be merged into main after completion
5117
+
5118
+ This means that if two tasks modify the same file, add the same dependency, or introduce the same config variable — they WILL cause merge conflicts and duplicated code.
5119
+
5120
+ ## CEO Directive
5121
+ > ${input.directive}
5122
+ `;
5123
+ if (input.feedback) {
5124
+ prompt += `
5125
+ ## CEO Feedback on Previous Plan
5126
+ > ${input.feedback}
5127
+
5128
+ IMPORTANT: Ensure the reviewed plan still addresses this feedback.
5129
+ `;
5130
+ }
5131
+ prompt += `
5132
+ ## Project Context
5133
+ ${input.projectContext || "No project context available."}
5134
+
5135
+ ## Sprint Plan to Review
5136
+ ${input.sprintOrganizerOutput}
5137
+
5138
+ ## Your Review Checklist
5139
+
5140
+ Go through EACH pair of tasks and check for:
5141
+
5142
+ ### 1. File Overlap Analysis
5143
+ For each task, list the files it will likely modify. Then check:
5144
+ - Do any two tasks modify the same file? (e.g., app.module.ts, configuration.ts, package.json, shared DTOs)
5145
+ - If yes: MERGE those tasks or move shared changes to a foundational task
5146
+
5147
+ ### 2. Duplicated Work Detection
5148
+ Check if multiple tasks:
5149
+ - Add the same environment variable or config field
5150
+ - Install or configure the same dependency
5151
+ - Register the same module or provider
5152
+ - Create the same helper function, guard, interceptor, or middleware
5153
+ - Add the same import to a shared file
5154
+ If yes: consolidate into ONE task
5155
+
5156
+ ### 3. Self-Containment Validation
5157
+ For each task, verify:
5158
+ - Does it include ALL config/env changes it needs?
5159
+ - Does it include ALL module registrations it needs?
5160
+ - Does it include ALL dependency installations it needs?
5161
+ - Can it be completed without ANY output from concurrent tasks?
5162
+
5163
+ ### 4. Merge Conflict Risk Zones
5164
+ Identify the highest-risk files (files that multiple tasks might touch) and ensure only ONE task modifies each.
5165
+
5166
+ ## Output Format
5167
+
5168
+ Your entire response must be a single JSON object — no text before it, no text after it, no markdown code blocks, no explanation. Start your response with the "{" character:
5169
+
5170
+ {
5171
+ "hasIssues": true | false,
5172
+ "issues": [
5173
+ {
5174
+ "type": "file_overlap" | "duplicated_work" | "not_self_contained" | "merge_conflict_risk",
5175
+ "description": "string describing the specific issue",
5176
+ "affectedTasks": ["Task Title 1", "Task Title 2"],
5177
+ "resolution": "string describing how to fix it (merge, move, consolidate)"
5178
+ }
5179
+ ],
5180
+ "revisedPlan": {
5181
+ "name": "string (2-4 words)",
5182
+ "goal": "string (1 paragraph)",
5183
+ "estimatedDays": 3,
5184
+ "tasks": [
5185
+ {
5186
+ "title": "string",
5187
+ "description": "string",
5188
+ "assigneeRole": "BACKEND | FRONTEND | QA | PM | DESIGN",
5189
+ "priority": "CRITICAL | HIGH | MEDIUM | LOW",
5190
+ "labels": ["string"],
5191
+ "acceptanceCriteria": ["string"],
5192
+ "complexity": 3
5193
+ }
5194
+ ],
5195
+ "risks": [
5196
+ {
5197
+ "description": "string",
5198
+ "mitigation": "string",
5199
+ "severity": "low | medium | high"
5200
+ }
5201
+ ]
5202
+ }
5203
+ }
5204
+
5205
+ IMPORTANT:
5206
+ - If hasIssues is true, the revisedPlan MUST contain the corrected task list with issues resolved (tasks merged, duplicated work consolidated, etc.)
5207
+ - If hasIssues is false, the revisedPlan should be identical to the input plan (no changes needed)
5208
+ - The revisedPlan is ALWAYS required — it becomes the final plan
5209
+ - When merging tasks, combine their acceptance criteria and update descriptions to cover all consolidated work
5210
+ - Prefer fewer, larger, self-contained tasks over many small conflicting ones`;
5211
+ return prompt;
5212
+ }
5213
+
5043
5214
  // src/planning/agents/sprint-organizer.ts
5044
5215
  function buildSprintOrganizerPrompt(input) {
5045
5216
  let prompt = `# Role: Sprint Organizer
@@ -5078,9 +5249,18 @@ Guidelines:
5078
5249
  - Ensure acceptance criteria are specific and testable
5079
5250
  - Keep the sprint focused — if it's too large (>12 tasks), consider reducing scope
5080
5251
 
5252
+ ## CRITICAL: Task Isolation Validation
5253
+
5254
+ Before finalizing, validate that EVERY task is fully self-contained and conflict-free:
5255
+
5256
+ 1. **No two tasks should modify the same file.** If they do, merge them or restructure so shared changes live in one foundational task.
5257
+ 2. **No duplicated work.** Each env var, config field, dependency, module import, or helper function must be introduced by exactly ONE task.
5258
+ 3. **Each task is independently executable.** An agent working on task N must be able to complete it without knowing what tasks N-1 or N+1 are doing. The only exception is foundational tasks that are merged BEFORE dependent tasks start.
5259
+ 4. **Prefer fewer, larger self-contained tasks over many small overlapping ones.** Do not split a task if the parts would conflict with each other.
5260
+
5081
5261
  ## Output Format
5082
5262
 
5083
- Respond with ONLY a JSON object (no markdown code blocks, no explanation):
5263
+ Your entire response must be a single JSON object no text before it, no text after it, no markdown code blocks, no explanation. Start your response with the "{" character:
5084
5264
 
5085
5265
  {
5086
5266
  "name": "string (2-4 words)",
@@ -5149,9 +5329,19 @@ Think about:
5149
5329
  - What the right granularity is (not too big, not too small)
5150
5330
  - What risks or unknowns exist
5151
5331
 
5332
+ ## CRITICAL: Task Isolation Rules
5333
+
5334
+ Tasks will be executed by INDEPENDENT agents on SEPARATE git branches that get merged together. Each agent has NO knowledge of what other agents are doing. Therefore:
5335
+
5336
+ 1. **No shared work across tasks.** If two tasks both need the same config variable, helper function, database migration, or module setup, that shared work MUST be consolidated into ONE task (or placed into a dedicated foundational task that runs first and is merged before others start).
5337
+ 2. **Each task must be fully self-contained.** A task must include ALL the code changes it needs to work — from config to implementation to tests. It should NOT assume that another task in the same sprint will create something it depends on.
5338
+ 3. **Do NOT split tasks if they share code changes.** If implementing feature A and feature B both require modifying the same file or adding the same dependency/config, they should be ONE task — even if that makes the task larger. A bigger self-contained task is better than two smaller conflicting tasks.
5339
+ 4. **Think about file-level conflicts.** Two tasks modifying the same file (e.g., app.module.ts, configuration.ts, package.json) will cause git merge conflicts. Minimize this by bundling related changes together.
5340
+ 5. **Environment variables, configs, and shared modules are high-conflict zones.** If a task introduces a new env var, config schema field, or module import, NO other task should touch that same file unless absolutely necessary.
5341
+
5152
5342
  ## Output Format
5153
5343
 
5154
- Respond with ONLY a JSON object (no markdown code blocks, no explanation):
5344
+ Your entire response must be a single JSON object no text before it, no text after it, no markdown code blocks, no explanation. Start your response with the "{" character:
5155
5345
 
5156
5346
  {
5157
5347
  "tasks": [
@@ -5184,7 +5374,7 @@ class PlanningMeeting {
5184
5374
  async run(directive, feedback) {
5185
5375
  const projectContext = this.getProjectContext();
5186
5376
  const codebaseIndex = this.getCodebaseIndex();
5187
- this.log("Phase 1/3: Tech Lead analyzing directive...", "info");
5377
+ this.log("Phase 1/4: Tech Lead analyzing directive...", "info");
5188
5378
  const techLeadPrompt = buildTechLeadPrompt({
5189
5379
  directive,
5190
5380
  projectContext,
@@ -5193,7 +5383,7 @@ class PlanningMeeting {
5193
5383
  });
5194
5384
  const techLeadOutput = await this.aiRunner.run(techLeadPrompt);
5195
5385
  this.log("Tech Lead phase complete.", "success");
5196
- this.log("Phase 2/3: Architect refining task breakdown...", "info");
5386
+ this.log("Phase 2/4: Architect refining task breakdown...", "info");
5197
5387
  const architectPrompt = buildArchitectPrompt({
5198
5388
  directive,
5199
5389
  projectContext,
@@ -5202,7 +5392,7 @@ class PlanningMeeting {
5202
5392
  });
5203
5393
  const architectOutput = await this.aiRunner.run(architectPrompt);
5204
5394
  this.log("Architect phase complete.", "success");
5205
- this.log("Phase 3/3: Sprint Organizer finalizing plan...", "info");
5395
+ this.log("Phase 3/4: Sprint Organizer finalizing plan...", "info");
5206
5396
  const sprintOrganizerPrompt = buildSprintOrganizerPrompt({
5207
5397
  directive,
5208
5398
  architectOutput,
@@ -5210,7 +5400,16 @@ class PlanningMeeting {
5210
5400
  });
5211
5401
  const sprintOrganizerOutput = await this.aiRunner.run(sprintOrganizerPrompt);
5212
5402
  this.log("Sprint Organizer phase complete.", "success");
5213
- const plan = parseSprintPlanFromAI(sprintOrganizerOutput, directive);
5403
+ this.log("Phase 4/4: Cross-Task Review checking for conflicts and overlaps...", "info");
5404
+ const crossTaskReviewerPrompt = buildCrossTaskReviewerPrompt({
5405
+ directive,
5406
+ projectContext,
5407
+ sprintOrganizerOutput,
5408
+ feedback
5409
+ });
5410
+ const crossTaskReviewOutput = await this.aiRunner.run(crossTaskReviewerPrompt);
5411
+ this.log("Cross-Task Review phase complete.", "success");
5412
+ const plan = parseSprintPlanFromAI(crossTaskReviewOutput, directive);
5214
5413
  if (feedback) {
5215
5414
  plan.feedback = feedback;
5216
5415
  }
@@ -5219,7 +5418,8 @@ class PlanningMeeting {
5219
5418
  phaseOutputs: {
5220
5419
  techLead: techLeadOutput,
5221
5420
  architect: architectOutput,
5222
- sprintOrganizer: sprintOrganizerOutput
5421
+ sprintOrganizer: sprintOrganizerOutput,
5422
+ crossTaskReview: crossTaskReviewOutput
5223
5423
  }
5224
5424
  };
5225
5425
  }
@@ -1 +1 @@
1
- {"version":3,"file":"architect.d.ts","sourceRoot":"","sources":["../../../src/planning/agents/architect.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CA+DlE"}
1
+ {"version":3,"file":"architect.d.ts","sourceRoot":"","sources":["../../../src/planning/agents/architect.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CA8ElE"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Cross-Task Reviewer Agent Persona
3
+ *
4
+ * Phase 4 (final) of the planning meeting. Reviews the Sprint Organizer's
5
+ * finalized plan specifically for task isolation issues: overlapping file
6
+ * modifications, duplicated work, shared dependencies, and merge conflict risks.
7
+ *
8
+ * This is a brainstorming review where the architect, engineer, and planner
9
+ * perspectives are combined to catch issues that would cause conflicts when
10
+ * tasks are executed by independent agents on separate git branches.
11
+ */
12
+ export interface CrossTaskReviewerInput {
13
+ directive: string;
14
+ projectContext: string;
15
+ sprintOrganizerOutput: string;
16
+ feedback?: string;
17
+ }
18
+ export declare function buildCrossTaskReviewerPrompt(input: CrossTaskReviewerInput): string;
19
+ //# sourceMappingURL=cross-task-reviewer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cross-task-reviewer.d.ts","sourceRoot":"","sources":["../../../src/planning/agents/cross-task-reviewer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,sBAAsB,GAC5B,MAAM,CA8GR"}
@@ -1 +1 @@
1
- {"version":3,"file":"sprint-organizer.d.ts","sourceRoot":"","sources":["../../../src/planning/agents/sprint-organizer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,oBAAoB,GAC1B,MAAM,CAoER"}
1
+ {"version":3,"file":"sprint-organizer.d.ts","sourceRoot":"","sources":["../../../src/planning/agents/sprint-organizer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,oBAAoB,GAC1B,MAAM,CA6ER"}
@@ -1 +1 @@
1
- {"version":3,"file":"tech-lead.d.ts","sourceRoot":"","sources":["../../../src/planning/agents/tech-lead.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CA6DhE"}
1
+ {"version":3,"file":"tech-lead.d.ts","sourceRoot":"","sources":["../../../src/planning/agents/tech-lead.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAuEhE"}
@@ -1,6 +1,6 @@
1
1
  import type { AiRunner } from "../ai/runner.js";
2
2
  import { type SprintPlan } from "./sprint-plan.js";
3
- export type PlanningPhase = "tech-lead" | "architect" | "sprint-organizer" | "complete";
3
+ export type PlanningPhase = "tech-lead" | "architect" | "sprint-organizer" | "cross-task-review" | "complete";
4
4
  export interface PlanningMeetingConfig {
5
5
  projectPath: string;
6
6
  aiRunner: AiRunner;
@@ -13,13 +13,14 @@ export interface PlanningMeetingResult {
13
13
  techLead: string;
14
14
  architect: string;
15
15
  sprintOrganizer: string;
16
+ crossTaskReview: string;
16
17
  };
17
18
  }
18
19
  /**
19
20
  * Orchestrates a multi-phase planning meeting where AI agent personas
20
21
  * collaborate to produce a sprint plan.
21
22
  *
22
- * Flow: CEO Directive → Tech Lead → Architect → Sprint Organizer → Sprint Plan
23
+ * Flow: CEO Directive → Tech Lead → Architect → Sprint Organizer → Cross-Task Review → Sprint Plan
23
24
  */
24
25
  export declare class PlanningMeeting {
25
26
  private projectPath;
@@ -1 +1 @@
1
- {"version":3,"file":"planning-meeting.d.ts","sourceRoot":"","sources":["../../src/planning/planning-meeting.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAMhD,OAAO,EAAyB,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE1E,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,WAAW,GACX,kBAAkB,GAClB,UAAU,CAAC;AAEf,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,GAAG,CAAC,EAAE,CACJ,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,KAC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E,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,CAAC;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CA+D7D;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,MAAM,GACf,UAAU,EAAE,CAgBd;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,GAChB,UAAU,CA0CZ"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Extract a JSON object string from LLM output that may contain
3
+ * surrounding prose, markdown code blocks, or other non-JSON text.
4
+ */
5
+ export declare function extractJsonFromLLMOutput(raw: string): string;
6
+ //# sourceMappingURL=json-extractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-extractor.d.ts","sourceRoot":"","sources":["../../src/utils/json-extractor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAuD5D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locusai/sdk",
3
- "version": "0.9.16",
3
+ "version": "0.9.18",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -30,7 +30,7 @@
30
30
  "clean": "rm -rf node_modules"
31
31
  },
32
32
  "dependencies": {
33
- "@locusai/shared": "^0.9.16",
33
+ "@locusai/shared": "^0.9.18",
34
34
  "axios": "^1.13.2",
35
35
  "events": "^3.3.0",
36
36
  "globby": "^14.0.2"