@locusai/sdk 0.16.1 → 0.18.1

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 (133) hide show
  1. package/PACKAGE_GUIDE.md +269 -0
  2. package/package.json +28 -28
  3. package/dist/agent/codebase-indexer-service.d.ts +0 -17
  4. package/dist/agent/codebase-indexer-service.d.ts.map +0 -1
  5. package/dist/agent/document-fetcher.d.ts +0 -23
  6. package/dist/agent/document-fetcher.d.ts.map +0 -1
  7. package/dist/agent/git-workflow.d.ts +0 -59
  8. package/dist/agent/git-workflow.d.ts.map +0 -1
  9. package/dist/agent/index.d.ts +0 -9
  10. package/dist/agent/index.d.ts.map +0 -1
  11. package/dist/agent/review-service.d.ts +0 -21
  12. package/dist/agent/review-service.d.ts.map +0 -1
  13. package/dist/agent/reviewer-worker.d.ts +0 -41
  14. package/dist/agent/reviewer-worker.d.ts.map +0 -1
  15. package/dist/agent/task-executor.d.ts +0 -26
  16. package/dist/agent/task-executor.d.ts.map +0 -1
  17. package/dist/agent/worker-cli.d.ts +0 -6
  18. package/dist/agent/worker-cli.d.ts.map +0 -1
  19. package/dist/agent/worker-types.d.ts +0 -36
  20. package/dist/agent/worker-types.d.ts.map +0 -1
  21. package/dist/agent/worker.d.ts +0 -39
  22. package/dist/agent/worker.d.ts.map +0 -1
  23. package/dist/agent/worker.js +0 -2837
  24. package/dist/ai/__tests__/factory.test.d.ts +0 -2
  25. package/dist/ai/__tests__/factory.test.d.ts.map +0 -1
  26. package/dist/ai/claude-runner.d.ts +0 -42
  27. package/dist/ai/claude-runner.d.ts.map +0 -1
  28. package/dist/ai/codex-runner.d.ts +0 -38
  29. package/dist/ai/codex-runner.d.ts.map +0 -1
  30. package/dist/ai/factory.d.ts +0 -15
  31. package/dist/ai/factory.d.ts.map +0 -1
  32. package/dist/ai/index.d.ts +0 -6
  33. package/dist/ai/index.d.ts.map +0 -1
  34. package/dist/ai/runner.d.ts +0 -23
  35. package/dist/ai/runner.d.ts.map +0 -1
  36. package/dist/core/config.d.ts +0 -58
  37. package/dist/core/config.d.ts.map +0 -1
  38. package/dist/core/index.d.ts +0 -4
  39. package/dist/core/index.d.ts.map +0 -1
  40. package/dist/core/indexer.d.ts +0 -31
  41. package/dist/core/indexer.d.ts.map +0 -1
  42. package/dist/core/prompt-builder.d.ts +0 -14
  43. package/dist/core/prompt-builder.d.ts.map +0 -1
  44. package/dist/discussion/agents/facilitator-prompt.d.ts +0 -13
  45. package/dist/discussion/agents/facilitator-prompt.d.ts.map +0 -1
  46. package/dist/discussion/discussion-facilitator.d.ts +0 -67
  47. package/dist/discussion/discussion-facilitator.d.ts.map +0 -1
  48. package/dist/discussion/discussion-manager.d.ts +0 -59
  49. package/dist/discussion/discussion-manager.d.ts.map +0 -1
  50. package/dist/discussion/discussion-types.d.ts +0 -89
  51. package/dist/discussion/discussion-types.d.ts.map +0 -1
  52. package/dist/discussion/index.d.ts +0 -5
  53. package/dist/discussion/index.d.ts.map +0 -1
  54. package/dist/events.d.ts +0 -22
  55. package/dist/events.d.ts.map +0 -1
  56. package/dist/exec/context-tracker.d.ts +0 -183
  57. package/dist/exec/context-tracker.d.ts.map +0 -1
  58. package/dist/exec/event-emitter.d.ts +0 -117
  59. package/dist/exec/event-emitter.d.ts.map +0 -1
  60. package/dist/exec/events.d.ts +0 -171
  61. package/dist/exec/events.d.ts.map +0 -1
  62. package/dist/exec/exec-session.d.ts +0 -164
  63. package/dist/exec/exec-session.d.ts.map +0 -1
  64. package/dist/exec/history-manager.d.ts +0 -153
  65. package/dist/exec/history-manager.d.ts.map +0 -1
  66. package/dist/exec/index.d.ts +0 -7
  67. package/dist/exec/index.d.ts.map +0 -1
  68. package/dist/exec/types.d.ts +0 -130
  69. package/dist/exec/types.d.ts.map +0 -1
  70. package/dist/git/git-utils.d.ts +0 -31
  71. package/dist/git/git-utils.d.ts.map +0 -1
  72. package/dist/git/index.d.ts +0 -3
  73. package/dist/git/index.d.ts.map +0 -1
  74. package/dist/git/pr-service.d.ts +0 -66
  75. package/dist/git/pr-service.d.ts.map +0 -1
  76. package/dist/index-node.d.ts +0 -22
  77. package/dist/index-node.d.ts.map +0 -1
  78. package/dist/index-node.js +0 -5662
  79. package/dist/index.d.ts +0 -40
  80. package/dist/index.d.ts.map +0 -1
  81. package/dist/index.js +0 -618
  82. package/dist/modules/auth.d.ts +0 -23
  83. package/dist/modules/auth.d.ts.map +0 -1
  84. package/dist/modules/base.d.ts +0 -8
  85. package/dist/modules/base.d.ts.map +0 -1
  86. package/dist/modules/ci.d.ts +0 -8
  87. package/dist/modules/ci.d.ts.map +0 -1
  88. package/dist/modules/docs.d.ts +0 -14
  89. package/dist/modules/docs.d.ts.map +0 -1
  90. package/dist/modules/instances.d.ts +0 -46
  91. package/dist/modules/instances.d.ts.map +0 -1
  92. package/dist/modules/invitations.d.ts +0 -10
  93. package/dist/modules/invitations.d.ts.map +0 -1
  94. package/dist/modules/organizations.d.ts +0 -24
  95. package/dist/modules/organizations.d.ts.map +0 -1
  96. package/dist/modules/sprints.d.ts +0 -14
  97. package/dist/modules/sprints.d.ts.map +0 -1
  98. package/dist/modules/tasks.d.ts +0 -25
  99. package/dist/modules/tasks.d.ts.map +0 -1
  100. package/dist/modules/workspaces.d.ts +0 -59
  101. package/dist/modules/workspaces.d.ts.map +0 -1
  102. package/dist/orchestrator/index.d.ts +0 -85
  103. package/dist/orchestrator/index.d.ts.map +0 -1
  104. package/dist/orchestrator/types.d.ts +0 -36
  105. package/dist/orchestrator/types.d.ts.map +0 -1
  106. package/dist/planning/agents/architect.d.ts +0 -1
  107. package/dist/planning/agents/architect.d.ts.map +0 -1
  108. package/dist/planning/agents/cross-task-reviewer.d.ts +0 -1
  109. package/dist/planning/agents/cross-task-reviewer.d.ts.map +0 -1
  110. package/dist/planning/agents/planner.d.ts +0 -20
  111. package/dist/planning/agents/planner.d.ts.map +0 -1
  112. package/dist/planning/agents/sprint-organizer.d.ts +0 -1
  113. package/dist/planning/agents/sprint-organizer.d.ts.map +0 -1
  114. package/dist/planning/agents/tech-lead.d.ts +0 -1
  115. package/dist/planning/agents/tech-lead.d.ts.map +0 -1
  116. package/dist/planning/index.d.ts +0 -4
  117. package/dist/planning/index.d.ts.map +0 -1
  118. package/dist/planning/plan-manager.d.ts +0 -51
  119. package/dist/planning/plan-manager.d.ts.map +0 -1
  120. package/dist/planning/planning-meeting.d.ts +0 -33
  121. package/dist/planning/planning-meeting.d.ts.map +0 -1
  122. package/dist/planning/sprint-plan.d.ts +0 -51
  123. package/dist/planning/sprint-plan.d.ts.map +0 -1
  124. package/dist/utils/colors.d.ts +0 -62
  125. package/dist/utils/colors.d.ts.map +0 -1
  126. package/dist/utils/json-extractor.d.ts +0 -10
  127. package/dist/utils/json-extractor.d.ts.map +0 -1
  128. package/dist/utils/resolve-bin.d.ts +0 -15
  129. package/dist/utils/resolve-bin.d.ts.map +0 -1
  130. package/dist/utils/retry.d.ts +0 -8
  131. package/dist/utils/retry.d.ts.map +0 -1
  132. package/dist/utils/structured-output.d.ts +0 -14
  133. package/dist/utils/structured-output.d.ts.map +0 -1
@@ -0,0 +1,269 @@
1
+ # Locus Package Author Guide
2
+
3
+ This guide explains how to build, test, and publish a community package for
4
+ the [Locus](https://github.com/locusai/locus) CLI.
5
+
6
+ ---
7
+
8
+ ## Naming convention
9
+
10
+ All Locus packages must be published to npm with the prefix `locus-`:
11
+
12
+ | Short name | npm package name |
13
+ |------------|-------------------|
14
+ | `telegram` | `locus-telegram` |
15
+ | `slack` | `locus-slack` |
16
+ | `jira` | `locus-jira` |
17
+
18
+ Scoped packages (e.g. `@myorg/locus-telegram`) are also accepted and will be
19
+ used as-is.
20
+
21
+ ---
22
+
23
+ ## `package.json` manifest format
24
+
25
+ Every Locus package **must** include a `"locus"` field in its `package.json`.
26
+ This field tells the Locus CLI how to display and invoke your package.
27
+
28
+ ```jsonc
29
+ {
30
+ "name": "locus-telegram",
31
+ "version": "1.0.0",
32
+ "description": "Remote-control Locus via Telegram",
33
+ "bin": {
34
+ "locus-telegram": "./bin/locus-telegram.js"
35
+ },
36
+
37
+ // Required: Locus package manifest
38
+ "locus": {
39
+ "displayName": "Telegram",
40
+ "description": "Remote-control your Locus agent from Telegram",
41
+ "commands": ["telegram"],
42
+ "version": "1.0.0"
43
+ }
44
+ }
45
+ ```
46
+
47
+ | Field | Type | Description |
48
+ |---------------|------------|------------------------------------------------------------------|
49
+ | `displayName` | `string` | Human-readable name shown in `locus packages list`. |
50
+ | `description` | `string` | One-line description shown in `locus packages list`. |
51
+ | `commands` | `string[]` | Sub-commands contributed. Used in `locus pkg <name>` dispatch. |
52
+ | `version` | `string` | Semver version — should mirror the npm package version. |
53
+
54
+ ---
55
+
56
+ ## Binary entry point
57
+
58
+ Your package must expose a binary. Locus discovers it via
59
+ `~/.locus/packages/node_modules/.bin/locus-<name>` after installation.
60
+
61
+ In `package.json`:
62
+
63
+ ```json
64
+ "bin": {
65
+ "locus-telegram": "./bin/locus-telegram.js"
66
+ }
67
+ ```
68
+
69
+ The binary should be executable Node.js (shebang `#!/usr/bin/env node`).
70
+
71
+ When invoked via `locus pkg telegram [args...]`, the remaining args are
72
+ forwarded to your binary verbatim.
73
+
74
+ ---
75
+
76
+ ## Using `@locusai/sdk`
77
+
78
+ Install the SDK as a dev dependency (it is a peer contract, not bundled):
79
+
80
+ ```sh
81
+ npm install --save-dev @locusai/sdk
82
+ ```
83
+
84
+ ### Reading project config
85
+
86
+ ```ts
87
+ import { readLocusConfig } from "@locusai/sdk";
88
+
89
+ // Reads ~/.locus/config.json + ./.locus/config.json and merges them.
90
+ const config = readLocusConfig();
91
+
92
+ console.log(config.github.owner); // "myorg"
93
+ console.log(config.ai.model); // "claude-sonnet-4-6"
94
+ ```
95
+
96
+ ### Invoking `locus` sub-commands
97
+
98
+ ```ts
99
+ import { invokeLocus, invokeLocusStream } from "@locusai/sdk";
100
+
101
+ // Captured output (blocking)
102
+ const result = await invokeLocus(["run", "42"]);
103
+ if (result.exitCode !== 0) {
104
+ console.error("locus run failed:", result.stderr);
105
+ }
106
+
107
+ // Streaming (non-blocking)
108
+ const child = invokeLocusStream(["run", "42"]);
109
+ child.stdout?.on("data", (chunk: Buffer) => process.stdout.write(chunk));
110
+ child.on("exit", (code) => console.log("exited with", code));
111
+ ```
112
+
113
+ ### Structured logger
114
+
115
+ ```ts
116
+ import { createLogger } from "@locusai/sdk";
117
+
118
+ const logger = createLogger("telegram");
119
+
120
+ logger.info("Bot started");
121
+ logger.warn("Rate limit approaching", { remaining: 5 });
122
+ logger.error("Connection failed", { code: 503 });
123
+ logger.debug("Raw update", { update_id: 12345 }); // only shown with LOCUS_DEBUG=1
124
+ ```
125
+
126
+ Output uses the same prefix symbols as the Locus CLI (`●`, `⚠`, `✗`, `⋯`).
127
+
128
+ ---
129
+
130
+ ## Minimal end-to-end example
131
+
132
+ Below is a complete minimal Locus package (`locus-hello`).
133
+
134
+ ### Directory structure
135
+
136
+ ```
137
+ locus-hello/
138
+ ├── bin/
139
+ │ └── locus-hello.js
140
+ ├── src/
141
+ │ └── index.ts
142
+ ├── package.json
143
+ └── tsconfig.json
144
+ ```
145
+
146
+ ### `package.json`
147
+
148
+ ```json
149
+ {
150
+ "name": "locus-hello",
151
+ "version": "1.0.0",
152
+ "description": "Example Locus package",
153
+ "type": "module",
154
+ "bin": {
155
+ "locus-hello": "./bin/locus-hello.js"
156
+ },
157
+ "locus": {
158
+ "displayName": "Hello",
159
+ "description": "A minimal example Locus package",
160
+ "commands": ["hello"],
161
+ "version": "1.0.0"
162
+ },
163
+ "scripts": {
164
+ "build": "tsc"
165
+ },
166
+ "devDependencies": {
167
+ "@locusai/sdk": "^0.1.0",
168
+ "typescript": "^5.0.0"
169
+ }
170
+ }
171
+ ```
172
+
173
+ ### `src/index.ts`
174
+
175
+ ```ts
176
+ import { createLogger, readLocusConfig } from "@locusai/sdk";
177
+
178
+ const logger = createLogger("hello");
179
+
180
+ export async function run(): Promise<void> {
181
+ const config = readLocusConfig();
182
+ logger.info(`Hello from locus-hello! Repo: ${config.github.owner}/${config.github.repo}`);
183
+ }
184
+ ```
185
+
186
+ ### `bin/locus-hello.js`
187
+
188
+ ```js
189
+ #!/usr/bin/env node
190
+ import "../dist/index.js";
191
+
192
+ const { run } = await import("../dist/index.js");
193
+ await run();
194
+ ```
195
+
196
+ Make it executable:
197
+
198
+ ```sh
199
+ chmod +x bin/locus-hello.js
200
+ ```
201
+
202
+ ---
203
+
204
+ ## Testing locally with `npm link`
205
+
206
+ 1. Build your package:
207
+
208
+ ```sh
209
+ npm run build
210
+ ```
211
+
212
+ 2. Link it globally:
213
+
214
+ ```sh
215
+ npm link
216
+ ```
217
+
218
+ 3. Install it into Locus's packages directory:
219
+
220
+ ```sh
221
+ locus install locus-hello
222
+ ```
223
+
224
+ Or, for a faster dev loop, symlink directly:
225
+
226
+ ```sh
227
+ mkdir -p ~/.locus/packages/node_modules
228
+ ln -s $(pwd) ~/.locus/packages/node_modules/locus-hello
229
+ mkdir -p ~/.locus/packages/node_modules/.bin
230
+ ln -s $(pwd)/bin/locus-hello.js ~/.locus/packages/node_modules/.bin/locus-hello
231
+ ```
232
+
233
+ 4. Run your package:
234
+
235
+ ```sh
236
+ locus pkg hello
237
+ ```
238
+
239
+ ---
240
+
241
+ ## Publishing to npm
242
+
243
+ 1. Make sure the `"locus"` field is present in your `package.json`.
244
+ 2. Ensure the binary listed in `"bin"` is executable.
245
+ 3. Build your package.
246
+ 4. Publish:
247
+
248
+ ```sh
249
+ npm publish --access public
250
+ ```
251
+
252
+ After publishing, users can install your package with:
253
+
254
+ ```sh
255
+ locus install hello # short name (locus-hello)
256
+ locus install locus-hello
257
+ ```
258
+
259
+ ---
260
+
261
+ ## Checklist before publishing
262
+
263
+ - [ ] Package name starts with `locus-` (or is scoped)
264
+ - [ ] `"locus"` field present in `package.json` with all required keys
265
+ - [ ] Binary listed in `"bin"` exists and has the shebang line
266
+ - [ ] Binary is executable (`chmod +x`)
267
+ - [ ] Package builds cleanly with no TypeScript errors
268
+ - [ ] Tested locally with `locus pkg <name>`
269
+ - [ ] `README.md` explains what the package does and how to configure it
package/package.json CHANGED
@@ -1,44 +1,44 @@
1
1
  {
2
2
  "name": "@locusai/sdk",
3
- "version": "0.16.1",
3
+ "version": "0.18.1",
4
+ "description": "SDK for building Locus-compatible community packages",
4
5
  "type": "module",
5
- "main": "./src/index.ts",
6
- "types": "./src/index.ts",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
7
9
  "exports": {
8
10
  ".": {
9
- "types": "./src/index.ts",
10
- "development": "./src/index.ts",
11
- "import": "./src/index.ts",
12
- "default": "./src/index.ts"
13
- },
14
- "./node": {
15
- "types": "./src/index-node.ts",
16
- "development": "./src/index-node.ts",
17
- "import": "./src/index-node.ts",
18
- "default": "./src/index-node.ts"
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.cjs"
18
+ }
19
19
  }
20
20
  },
21
21
  "files": [
22
22
  "dist",
23
+ "PACKAGE_GUIDE.md",
23
24
  "README.md"
24
25
  ],
25
26
  "scripts": {
26
- "build": "bun build ./src/index.ts ./src/index-node.ts ./src/agent/worker.ts --outdir ./dist --target node --format cjs --external axios --external events --external globby --external @locusai/shared --external zod && tsc -p tsconfig.build.json --emitDeclarationOnly",
27
- "dev": "tsc --watch",
28
- "lint": "biome lint .",
29
- "test": "bun test",
27
+ "build": "bun build ./src/index.ts --outdir ./dist --target node --format esm && bun build ./src/index.ts --outfile ./dist/index.cjs --target node --format cjs && tsc -p tsconfig.build.json --emitDeclarationOnly",
30
28
  "typecheck": "tsc --noEmit",
31
- "clean": "rm -rf node_modules"
32
- },
33
- "dependencies": {
34
- "@locusai/shared": "^0.16.1",
35
- "axios": "^1.13.2",
36
- "events": "^3.3.0",
37
- "globby": "^14.0.2",
38
- "zod": "^4.3.6"
29
+ "lint": "biome lint .",
30
+ "format": "biome format --write .",
31
+ "clean": "rm -rf dist node_modules"
39
32
  },
40
- "devDependencies": {
41
- "typescript": "^5.8.3",
42
- "@types/node": "^22.10.7"
33
+ "keywords": [
34
+ "locus",
35
+ "sdk",
36
+ "package",
37
+ "plugin",
38
+ "community"
39
+ ],
40
+ "license": "MIT",
41
+ "engines": {
42
+ "node": ">=18"
43
43
  }
44
44
  }
@@ -1,17 +0,0 @@
1
- import { LogFn } from "../ai/factory.js";
2
- import type { AiRunner } from "../ai/runner.js";
3
- export interface CodebaseIndexerServiceDeps {
4
- aiRunner: AiRunner;
5
- projectPath: string;
6
- log: LogFn;
7
- }
8
- /**
9
- * Handles codebase indexing with AI analysis
10
- */
11
- export declare class CodebaseIndexerService {
12
- private deps;
13
- private indexer;
14
- constructor(deps: CodebaseIndexerServiceDeps);
15
- reindex(force?: boolean): Promise<void>;
16
- }
17
- //# sourceMappingURL=codebase-indexer-service.d.ts.map
@@ -1 +0,0 @@
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;CAmD5C"}
@@ -1,23 +0,0 @@
1
- import type { LogFn } from "../ai/factory.js";
2
- import type { LocusClient } from "../index.js";
3
- export interface DocumentFetcherDeps {
4
- client: LocusClient;
5
- workspaceId: string;
6
- projectPath: string;
7
- log: LogFn;
8
- }
9
- /**
10
- * Fetches documents from the platform to local storage.
11
- * One-way sync: server -> local only.
12
- * Artifacts are NOT synced to cloud (they remain local-only).
13
- */
14
- export declare class DocumentFetcher {
15
- private deps;
16
- constructor(deps: DocumentFetcherDeps);
17
- /**
18
- * Fetches documents from the server and saves them locally.
19
- * Documents are organized by group name in .locus/documents/{groupName}/
20
- */
21
- fetch(): Promise<void>;
22
- }
23
- //# sourceMappingURL=document-fetcher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"document-fetcher.d.ts","sourceRoot":"","sources":["../../src/agent/document-fetcher.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,WAAW,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,KAAK,CAAC;CACZ;AAED;;;;GAIG;AACH,qBAAa,eAAe;IACd,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,mBAAmB;IAE7C;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CA6D7B"}
@@ -1,59 +0,0 @@
1
- import type { Task } from "@locusai/shared";
2
- import type { LogFn } from "../ai/factory.js";
3
- import type { CommitPushResult, WorkerConfig } from "./worker-types.js";
4
- /**
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
10
- */
11
- export declare class GitWorkflow {
12
- private config;
13
- private log;
14
- private projectPath;
15
- private branchName;
16
- private baseBranch;
17
- private ghUsername;
18
- constructor(config: WorkerConfig, log: LogFn);
19
- /**
20
- * Create a development branch for the run.
21
- * Called once at the start of execution.
22
- */
23
- createBranch(sprintId?: string): string;
24
- /**
25
- * Commit changes for a completed task and push to remote.
26
- */
27
- commitAndPush(task: Task): CommitPushResult;
28
- /**
29
- * Push the current branch to remote.
30
- */
31
- private pushBranch;
32
- /**
33
- * Create a pull request for the development branch.
34
- * Called once after all tasks are done.
35
- */
36
- createPullRequest(completedTasks: Array<{
37
- title: string;
38
- id: string;
39
- }>, summaries: string[]): {
40
- url: string | null;
41
- error?: string;
42
- };
43
- /**
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.
53
- */
54
- getBaseBranch(): string | null;
55
- private getBaseCommit;
56
- private buildPrBody;
57
- private gitExec;
58
- }
59
- //# sourceMappingURL=git-workflow.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-workflow.d.ts","sourceRoot":"","sources":["../../src/agent/git-workflow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAO9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAExE;;;;;;GAMG;AACH,qBAAa,WAAW;IAOpB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,GAAG;IAPb,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAuB;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;IAmCvC;;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,9 +0,0 @@
1
- export { CodebaseIndexerService } from "./codebase-indexer-service.js";
2
- export { DocumentFetcher } from "./document-fetcher.js";
3
- export { GitWorkflow } from "./git-workflow.js";
4
- export { ReviewService, type ReviewServiceDeps } from "./review-service.js";
5
- export { type ReviewerConfig, ReviewerWorker, } from "./reviewer-worker.js";
6
- export { TaskExecutor } from "./task-executor.js";
7
- export { AgentWorker, type WorkerConfig } from "./worker.js";
8
- export type { CommitPushResult, TaskResult } from "./worker-types.js";
9
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EACL,KAAK,cAAc,EACnB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAC7D,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,21 +0,0 @@
1
- import type { Sprint } from "@locusai/shared";
2
- import { LogFn } from "../ai/factory.js";
3
- import type { AiRunner } from "../ai/runner.js";
4
- export interface ReviewServiceDeps {
5
- aiRunner: AiRunner;
6
- projectPath: string;
7
- log: LogFn;
8
- }
9
- /**
10
- * Reviews staged git changes and produces a markdown report.
11
- */
12
- export declare class ReviewService {
13
- private deps;
14
- constructor(deps: ReviewServiceDeps);
15
- /**
16
- * Stages all changes and runs an AI review on the diff.
17
- * Returns a markdown review report, or null if there are no changes.
18
- */
19
- reviewStagedChanges(sprint: Sprint | null): Promise<string | null>;
20
- }
21
- //# sourceMappingURL=review-service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"review-service.d.ts","sourceRoot":"","sources":["../../src/agent/review-service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,KAAK,CAAC;CACZ;AAED;;GAEG;AACH,qBAAa,aAAa;IACZ,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,iBAAiB;IAE3C;;;OAGG;IACG,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAoEzE"}
@@ -1,41 +0,0 @@
1
- import type { AiProvider } from "../ai/runner.js";
2
- export interface ReviewerConfig {
3
- agentId: string;
4
- workspaceId: string;
5
- sprintId?: string;
6
- apiBase: string;
7
- projectPath: string;
8
- apiKey: string;
9
- model?: string;
10
- provider?: AiProvider;
11
- }
12
- /**
13
- * Reviewer agent that discovers open Locus PRs directly from GitHub,
14
- * reviews the PR diff via AI, and posts review comments.
15
- * Skips PRs that already have a Locus review.
16
- */
17
- export declare class ReviewerWorker {
18
- private config;
19
- private client;
20
- private aiRunner;
21
- private prService;
22
- private heartbeatInterval;
23
- private currentTaskId;
24
- private maxReviews;
25
- private reviewsCompleted;
26
- constructor(config: ReviewerConfig);
27
- log(message: string, level?: "info" | "success" | "warn" | "error"): void;
28
- /**
29
- * Discover the next unreviewed Locus PR from GitHub.
30
- */
31
- private getNextUnreviewedPr;
32
- /**
33
- * Review a PR using AI and post the review on GitHub.
34
- */
35
- private reviewPr;
36
- private startHeartbeat;
37
- private stopHeartbeat;
38
- private sendHeartbeat;
39
- run(): Promise<void>;
40
- }
41
- //# sourceMappingURL=reviewer-worker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reviewer-worker.d.ts","sourceRoot":"","sources":["../../src/agent/reviewer-worker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAY,MAAM,iBAAiB,CAAC;AAa5D,MAAM,WAAW,cAAc;IAC7B,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,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,UAAU,CAAC;CACvB;AAED;;;;GAIG;AACH,qBAAa,cAAc;IASb,OAAO,CAAC,MAAM;IAR1B,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,iBAAiB,CAA+C;IACxE,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,gBAAgB,CAAK;gBAET,MAAM,EAAE,cAAc;IA4B1C,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAgB;IAe1E;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAU3B;;OAEG;YACW,QAAQ;IAiFtB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,aAAa;IAgBf,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAiE3B"}
@@ -1,26 +0,0 @@
1
- import type { Task } from "@locusai/shared";
2
- import { LogFn } from "../ai/factory.js";
3
- import type { AiRunner } from "../ai/runner.js";
4
- export interface TaskExecutorDeps {
5
- aiRunner: AiRunner;
6
- projectPath: string;
7
- log: LogFn;
8
- }
9
- /**
10
- * Handles direct task execution (single-pass, no separate planning phase)
11
- */
12
- export declare class TaskExecutor {
13
- private deps;
14
- private promptBuilder;
15
- constructor(deps: TaskExecutorDeps);
16
- execute(task: Task): Promise<{
17
- success: boolean;
18
- summary: string;
19
- }>;
20
- /**
21
- * Extract a concise summary from the agent's raw output.
22
- * Takes the last non-empty paragraph, truncated to 500 chars.
23
- */
24
- private extractSummary;
25
- }
26
- //# sourceMappingURL=task-executor.d.ts.map
@@ -1 +0,0 @@
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,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGhD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,KAAK,CAAC;CACZ;AAED;;GAEG;AACH,qBAAa,YAAY;IAGX,OAAO,CAAC,IAAI;IAFxB,OAAO,CAAC,aAAa,CAAgB;gBAEjB,IAAI,EAAE,gBAAgB;IAIpC,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAezE;;;OAGG;IACH,OAAO,CAAC,cAAc;CAoBvB"}
@@ -1,6 +0,0 @@
1
- import type { WorkerConfig } from "./worker-types.js";
2
- /**
3
- * Parse CLI arguments into a WorkerConfig.
4
- */
5
- export declare function parseWorkerArgs(argv: string[]): WorkerConfig;
6
- //# sourceMappingURL=worker-cli.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,36 +0,0 @@
1
- import type { AiProvider } from "../ai/runner.js";
2
- export interface WorkerConfig {
3
- /** Unique identifier for the agent */
4
- agentId: string;
5
- /** Unique identifier for the workspace */
6
- workspaceId: string;
7
- /** Unique identifier for the sprint */
8
- sprintId?: string;
9
- /** Base URL for the API */
10
- apiBase: string;
11
- /** Path to the project */
12
- projectPath: string;
13
- /** API key */
14
- apiKey: string;
15
- /** AI model */
16
- model?: string;
17
- /** AI provider */
18
- provider?: AiProvider;
19
- /** Reasoning effort level for Codex models (e.g. "low", "medium", "high") */
20
- reasoningEffort?: string;
21
- }
22
- export interface CommitPushResult {
23
- branch: string | null;
24
- pushed: boolean;
25
- pushFailed: boolean;
26
- pushError?: string;
27
- skipReason?: string;
28
- noChanges?: boolean;
29
- }
30
- export interface TaskResult {
31
- success: boolean;
32
- summary: string;
33
- branch?: string;
34
- noChanges?: boolean;
35
- }
36
- //# sourceMappingURL=worker-types.d.ts.map
@@ -1 +0,0 @@
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,6EAA6E;IAC7E,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,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,39 +0,0 @@
1
- import type { WorkerConfig } from "./worker-types.js";
2
- export type { WorkerConfig } from "./worker-types.js";
3
- /**
4
- * Main agent worker that claims and executes tasks sequentially.
5
- *
6
- * Responsibilities:
7
- * - Creating a single branch for the run
8
- * - Claiming tasks from the API via dispatch
9
- * - Executing tasks using the AI runner
10
- * - Committing and pushing after each task
11
- * - Opening a PR when all tasks are done
12
- * - Checking out the base branch after completion
13
- */
14
- export declare class AgentWorker {
15
- private config;
16
- private client;
17
- private aiRunner;
18
- private taskExecutor;
19
- private gitWorkflow;
20
- private maxTasks;
21
- private tasksCompleted;
22
- private heartbeatInterval;
23
- private currentTaskId;
24
- private completedTaskList;
25
- private taskSummaries;
26
- constructor(config: WorkerConfig);
27
- log(message: string, level?: "info" | "success" | "warn" | "error"): void;
28
- private getActiveSprint;
29
- private getNextTask;
30
- /**
31
- * Execute a single task in the current branch.
32
- */
33
- private executeTask;
34
- private startHeartbeat;
35
- private stopHeartbeat;
36
- private sendHeartbeat;
37
- run(): Promise<void>;
38
- }
39
- //# sourceMappingURL=worker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/agent/worker.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAc,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGlE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;;;;;;;;;GAUG;AACH,qBAAa,WAAW;IAgBV,OAAO,CAAC,MAAM;IAf1B,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,WAAW,CAAc;IAGjC,OAAO,CAAC,QAAQ,CAAM;IACtB,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,iBAAiB,CAA+C;IACxE,OAAO,CAAC,aAAa,CAAuB;IAG5C,OAAO,CAAC,iBAAiB,CAA4C;IACrE,OAAO,CAAC,aAAa,CAAgB;gBAEjB,MAAM,EAAE,YAAY;IAqDxC,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAgB;YAmB5D,eAAe;YAcf,WAAW;IAgDzB;;OAEG;YACW,WAAW;IAoCzB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,aAAa;IAoBf,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA4I3B"}