@locusai/sdk 0.10.5 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/agent/git-workflow.d.ts +37 -23
  2. package/dist/agent/git-workflow.d.ts.map +1 -1
  3. package/dist/agent/worker-cli.d.ts.map +1 -1
  4. package/dist/agent/worker-types.d.ts +0 -10
  5. package/dist/agent/worker-types.d.ts.map +1 -1
  6. package/dist/agent/worker.d.ts +8 -8
  7. package/dist/agent/worker.d.ts.map +1 -1
  8. package/dist/agent/worker.js +255 -802
  9. package/dist/ai/codex-runner.d.ts.map +1 -1
  10. package/dist/core/config.d.ts +1 -1
  11. package/dist/core/config.d.ts.map +1 -1
  12. package/dist/index-node.d.ts +0 -1
  13. package/dist/index-node.d.ts.map +1 -1
  14. package/dist/index-node.js +783 -1532
  15. package/dist/orchestrator/agent-pool.d.ts +1 -58
  16. package/dist/orchestrator/agent-pool.d.ts.map +1 -1
  17. package/dist/orchestrator/execution.d.ts +1 -54
  18. package/dist/orchestrator/execution.d.ts.map +1 -1
  19. package/dist/orchestrator/index.d.ts +25 -31
  20. package/dist/orchestrator/index.d.ts.map +1 -1
  21. package/dist/orchestrator/tier-merge.d.ts +1 -49
  22. package/dist/orchestrator/tier-merge.d.ts.map +1 -1
  23. package/dist/orchestrator/types.d.ts +0 -11
  24. package/dist/orchestrator/types.d.ts.map +1 -1
  25. package/dist/planning/agents/architect.d.ts.map +1 -1
  26. package/dist/planning/agents/cross-task-reviewer.d.ts +2 -6
  27. package/dist/planning/agents/cross-task-reviewer.d.ts.map +1 -1
  28. package/dist/planning/agents/sprint-organizer.d.ts +1 -1
  29. package/dist/planning/agents/sprint-organizer.d.ts.map +1 -1
  30. package/dist/planning/agents/tech-lead.d.ts.map +1 -1
  31. package/dist/planning/sprint-plan.d.ts +0 -2
  32. package/dist/planning/sprint-plan.d.ts.map +1 -1
  33. package/dist/worktree/index.d.ts +1 -2
  34. package/dist/worktree/index.d.ts.map +1 -1
  35. package/dist/worktree/worktree-config.d.ts +1 -59
  36. package/dist/worktree/worktree-config.d.ts.map +1 -1
  37. package/dist/worktree/worktree-manager.d.ts +1 -115
  38. package/dist/worktree/worktree-manager.d.ts.map +1 -1
  39. package/package.json +2 -2
  40. package/dist/agent/__tests__/orchestrator.cleanup.test.d.ts +0 -2
  41. package/dist/agent/__tests__/orchestrator.cleanup.test.d.ts.map +0 -1
  42. package/dist/agent/__tests__/worker.no-changes.test.d.ts +0 -2
  43. package/dist/agent/__tests__/worker.no-changes.test.d.ts.map +0 -1
@@ -1,45 +1,59 @@
1
1
  import type { Task } from "@locusai/shared";
2
2
  import type { LogFn } from "../ai/factory.js";
3
- import { TaskExecutor } from "./task-executor.js";
4
3
  import type { CommitPushResult, WorkerConfig } from "./worker-types.js";
5
4
  /**
6
- * Handles the git side of task execution:
7
- * - Creating per-task worktrees
8
- * - Committing and pushing changes
9
- * - Creating pull requests
10
- * - Cleaning up worktrees
5
+ * Handles the git side of task execution with a single-branch workflow:
6
+ * - Creates one branch for the entire run
7
+ * - Commits and pushes after each task
8
+ * - Opens a PR when all tasks are done
9
+ * - Checks out the base branch after PR creation
11
10
  */
12
11
  export declare class GitWorkflow {
13
12
  private config;
14
13
  private log;
14
+ private projectPath;
15
+ private branchName;
16
+ private baseBranch;
15
17
  private ghUsername;
16
- private worktreeManager;
17
- private prService;
18
- constructor(config: WorkerConfig, log: LogFn, ghUsername: string | null);
18
+ constructor(config: WorkerConfig, log: LogFn);
19
19
  /**
20
- * Create a per-task worktree and return an executor configured for it.
21
- * Falls back to the default executor if worktrees are disabled.
20
+ * Create a development branch for the run.
21
+ * Called once at the start of execution.
22
22
  */
23
- createTaskWorktree(task: Task, defaultExecutor: TaskExecutor): {
24
- worktreePath: string | null;
25
- baseBranch: string | null;
26
- baseCommitHash: string | null;
27
- executor: TaskExecutor;
28
- };
23
+ createBranch(sprintId?: string): string;
24
+ /**
25
+ * Commit changes for a completed task and push to remote.
26
+ */
27
+ commitAndPush(task: Task): CommitPushResult;
29
28
  /**
30
- * Commit changes in a task worktree and optionally push to remote.
29
+ * Push the current branch to remote.
31
30
  */
32
- commitAndPush(worktreePath: string, task: Task, baseBranch?: string, baseCommitHash?: string): CommitPushResult;
31
+ private pushBranch;
33
32
  /**
34
- * Create a pull request for a completed task.
33
+ * Create a pull request for the development branch.
34
+ * Called once after all tasks are done.
35
35
  */
36
- createPullRequest(task: Task, branch: string, summary?: string, baseBranch?: string): {
36
+ createPullRequest(completedTasks: Array<{
37
+ title: string;
38
+ id: string;
39
+ }>, summaries: string[]): {
37
40
  url: string | null;
38
41
  error?: string;
39
42
  };
40
43
  /**
41
- * Clean up a task-specific worktree.
44
+ * Checkout the base branch after the run is complete.
45
+ */
46
+ checkoutBaseBranch(): void;
47
+ /**
48
+ * Get the current branch name.
49
+ */
50
+ getBranchName(): string | null;
51
+ /**
52
+ * Get the base branch name.
42
53
  */
43
- cleanupWorktree(worktreePath: string | null, keepBranch: boolean): void;
54
+ getBaseBranch(): string | null;
55
+ private getBaseCommit;
56
+ private buildPrBody;
57
+ private gitExec;
44
58
  }
45
59
  //# sourceMappingURL=git-workflow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"git-workflow.d.ts","sourceRoot":"","sources":["../../src/agent/git-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAK9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAExE;;;;;;GAMG;AACH,qBAAa,WAAW;IAKpB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,UAAU;IANpB,OAAO,CAAC,eAAe,CAAyB;IAChD,OAAO,CAAC,SAA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IACzC,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,UAAU,CAAgB;gBAGxB,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,KAAK;IASpB;;;OAGG;IACH,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IAoCvC;;OAEG;IACH,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,gBAAgB;IAkF3C;;OAEG;IACH,OAAO,CAAC,UAAU;IAuDlB;;;OAGG;IACH,iBAAiB,CACf,cAAc,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,EACpD,SAAS,EAAE,MAAM,EAAE,GAClB;QAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IA4DzC;;OAEG;IACH,kBAAkB,IAAI,IAAI;IAc1B;;OAEG;IACH,aAAa,IAAI,MAAM,GAAG,IAAI;IAI9B;;OAEG;IACH,aAAa,IAAI,MAAM,GAAG,IAAI;IAI9B,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,WAAW;IA4BnB,OAAO,CAAC,OAAO;CAOhB"}
@@ -1 +1 @@
1
- {"version":3,"file":"worker-cli.d.ts","sourceRoot":"","sources":["../../src/agent/worker-cli.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAgBtD;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,YAAY,CAoC5D"}
1
+ {"version":3,"file":"worker-cli.d.ts","sourceRoot":"","sources":["../../src/agent/worker-cli.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAgBtD;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,YAAY,CAgC5D"}
@@ -16,14 +16,6 @@ export interface WorkerConfig {
16
16
  model?: string;
17
17
  /** AI provider */
18
18
  provider?: AiProvider;
19
- /** When running in a worktree, this is the path to the main repo for progress updates */
20
- mainProjectPath?: string;
21
- /** Whether to use per-task worktrees for isolation */
22
- useWorktrees?: boolean;
23
- /** Whether to push branches to remote after committing */
24
- autoPush?: boolean;
25
- /** Base branch for worktree creation and PR targeting (set by orchestrator for tier-based execution) */
26
- baseBranch?: string;
27
19
  }
28
20
  export interface CommitPushResult {
29
21
  branch: string | null;
@@ -37,8 +29,6 @@ export interface TaskResult {
37
29
  success: boolean;
38
30
  summary: string;
39
31
  branch?: string;
40
- prUrl?: string;
41
- prError?: string;
42
32
  noChanges?: boolean;
43
33
  }
44
34
  //# sourceMappingURL=worker-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker-types.d.ts","sourceRoot":"","sources":["../../src/agent/worker-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,YAAY;IAC3B,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc;IACd,MAAM,EAAE,MAAM,CAAC;IACf,eAAe;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB;IAClB,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,yFAAyF;IACzF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sDAAsD;IACtD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wGAAwG;IACxG,UAAU,CAAC,EAAE,MAAM,CAAC;CACr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C,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
@@ -1,14 +1,15 @@
1
1
  import type { WorkerConfig } from "./worker-types.js";
2
2
  export type { WorkerConfig } from "./worker-types.js";
3
3
  /**
4
- * Main agent worker that claims and executes tasks.
4
+ * Main agent worker that claims and executes tasks sequentially.
5
5
  *
6
6
  * Responsibilities:
7
+ * - Creating a single branch for the run
7
8
  * - Claiming tasks from the API via dispatch
8
9
  * - Executing tasks using the AI runner
9
- * - Delegating git operations (worktree, commit, push, PR) to `GitWorkflow`
10
- * - Reporting task status back to the API
11
- * - Heartbeat reporting to the orchestrator
10
+ * - Committing and pushing after each task
11
+ * - Opening a PR when all tasks are done
12
+ * - Checking out the base branch after completion
12
13
  */
13
14
  export declare class AgentWorker {
14
15
  private config;
@@ -21,21 +22,20 @@ export declare class AgentWorker {
21
22
  private tasksCompleted;
22
23
  private heartbeatInterval;
23
24
  private currentTaskId;
24
- private currentWorktreePath;
25
- private postCleanupDelayMs;
25
+ private completedTaskList;
26
+ private taskSummaries;
26
27
  constructor(config: WorkerConfig);
27
28
  log(message: string, level?: "info" | "success" | "warn" | "error"): void;
28
29
  private getActiveSprint;
29
30
  private getNextTask;
30
31
  /**
31
- * Execute a single task: create worktree -> run AI -> commit -> push -> PR.
32
+ * Execute a single task in the current branch.
32
33
  */
33
34
  private executeTask;
34
35
  private updateProgress;
35
36
  private startHeartbeat;
36
37
  private stopHeartbeat;
37
38
  private sendHeartbeat;
38
- private delayAfterCleanup;
39
39
  run(): Promise<void>;
40
40
  }
41
41
  //# sourceMappingURL=worker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/agent/worker.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK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