@locusai/sdk 0.16.1 → 0.16.2
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.
- package/dist/agent/reviewer-worker.d.ts +2 -1
- package/dist/agent/reviewer-worker.d.ts.map +1 -1
- package/dist/agent/worker.d.ts +2 -1
- package/dist/agent/worker.d.ts.map +1 -1
- package/dist/agent/worker.js +134 -179
- package/dist/ai/claude-runner.d.ts +0 -7
- package/dist/ai/claude-runner.d.ts.map +1 -1
- package/dist/ai/claude-stream-parser.d.ts +41 -0
- package/dist/ai/claude-stream-parser.d.ts.map +1 -0
- package/dist/ai/codex-runner.d.ts.map +1 -1
- package/dist/ai/factory.d.ts +11 -0
- package/dist/ai/factory.d.ts.map +1 -1
- package/dist/ai/index.d.ts +3 -1
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/discussion/discussion-facilitator.d.ts.map +1 -1
- package/dist/index-node.js +146 -201
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -59
- package/dist/modules/workspaces.d.ts +0 -15
- package/dist/modules/workspaces.d.ts.map +1 -1
- package/dist/planning/planning-meeting.d.ts +2 -1
- package/dist/planning/planning-meeting.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/modules/instances.d.ts +0 -46
- package/dist/modules/instances.d.ts.map +0 -1
package/dist/index-node.js
CHANGED
|
@@ -156,49 +156,6 @@ var init_docs = __esm(() => {
|
|
|
156
156
|
};
|
|
157
157
|
});
|
|
158
158
|
|
|
159
|
-
// src/modules/instances.ts
|
|
160
|
-
var InstancesModule;
|
|
161
|
-
var init_instances = __esm(() => {
|
|
162
|
-
InstancesModule = class InstancesModule extends BaseModule {
|
|
163
|
-
async list(workspaceId) {
|
|
164
|
-
const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-instances`);
|
|
165
|
-
return data.instances;
|
|
166
|
-
}
|
|
167
|
-
async get(workspaceId, instanceId) {
|
|
168
|
-
const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-instances/${instanceId}`);
|
|
169
|
-
return data.instance;
|
|
170
|
-
}
|
|
171
|
-
async provision(workspaceId, body) {
|
|
172
|
-
const { data } = await this.api.post(`/workspaces/${workspaceId}/aws-instances`, body);
|
|
173
|
-
return data.instance;
|
|
174
|
-
}
|
|
175
|
-
async performAction(workspaceId, instanceId, action) {
|
|
176
|
-
const { data } = await this.api.post(`/workspaces/${workspaceId}/aws-instances/${instanceId}/actions`, { action });
|
|
177
|
-
return data.instance;
|
|
178
|
-
}
|
|
179
|
-
async sync(workspaceId, instanceId) {
|
|
180
|
-
const { data } = await this.api.post(`/workspaces/${workspaceId}/aws-instances/${instanceId}/sync`);
|
|
181
|
-
return data.instance;
|
|
182
|
-
}
|
|
183
|
-
async checkUpdates(workspaceId, instanceId) {
|
|
184
|
-
const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-instances/${instanceId}/updates`);
|
|
185
|
-
return data.update;
|
|
186
|
-
}
|
|
187
|
-
async applyUpdate(workspaceId, instanceId) {
|
|
188
|
-
const { data } = await this.api.post(`/workspaces/${workspaceId}/aws-instances/${instanceId}/updates`);
|
|
189
|
-
return data.update;
|
|
190
|
-
}
|
|
191
|
-
async getSecurity(workspaceId, instanceId) {
|
|
192
|
-
const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-instances/${instanceId}/security`);
|
|
193
|
-
return data.rules;
|
|
194
|
-
}
|
|
195
|
-
async updateSecurity(workspaceId, instanceId, body) {
|
|
196
|
-
const { data } = await this.api.put(`/workspaces/${workspaceId}/aws-instances/${instanceId}/security`, body);
|
|
197
|
-
return data.rules;
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
});
|
|
201
|
-
|
|
202
159
|
// src/modules/invitations.ts
|
|
203
160
|
var InvitationsModule;
|
|
204
161
|
var init_invitations = __esm(() => {
|
|
@@ -431,17 +388,6 @@ var init_workspaces = __esm(() => {
|
|
|
431
388
|
async deleteApiKey(workspaceId, keyId) {
|
|
432
389
|
await this.api.delete(`/workspaces/${workspaceId}/api-keys/${keyId}`);
|
|
433
390
|
}
|
|
434
|
-
async getAwsCredentials(workspaceId) {
|
|
435
|
-
const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-credentials`);
|
|
436
|
-
return data.credential;
|
|
437
|
-
}
|
|
438
|
-
async saveAwsCredentials(workspaceId, body) {
|
|
439
|
-
const { data } = await this.api.put(`/workspaces/${workspaceId}/aws-credentials`, body);
|
|
440
|
-
return data.credential;
|
|
441
|
-
}
|
|
442
|
-
async deleteAwsCredentials(workspaceId) {
|
|
443
|
-
await this.api.delete(`/workspaces/${workspaceId}/aws-credentials`);
|
|
444
|
-
}
|
|
445
391
|
};
|
|
446
392
|
});
|
|
447
393
|
|
|
@@ -489,7 +435,6 @@ __export(exports_src, {
|
|
|
489
435
|
LocusEmitter: () => LocusEmitter,
|
|
490
436
|
LocusClient: () => LocusClient,
|
|
491
437
|
InvitationsModule: () => InvitationsModule,
|
|
492
|
-
InstancesModule: () => InstancesModule,
|
|
493
438
|
DocsModule: () => DocsModule,
|
|
494
439
|
DiscussionSchema: () => DiscussionSchema,
|
|
495
440
|
DiscussionMessageSchema: () => DiscussionMessageSchema,
|
|
@@ -510,7 +455,6 @@ class LocusClient {
|
|
|
510
455
|
invitations;
|
|
511
456
|
docs;
|
|
512
457
|
ci;
|
|
513
|
-
instances;
|
|
514
458
|
constructor(config) {
|
|
515
459
|
this.emitter = new LocusEmitter;
|
|
516
460
|
this.api = import_axios.default.create({
|
|
@@ -530,7 +474,6 @@ class LocusClient {
|
|
|
530
474
|
this.invitations = new InvitationsModule(this.api, this.emitter);
|
|
531
475
|
this.docs = new DocsModule(this.api, this.emitter);
|
|
532
476
|
this.ci = new CiModule(this.api, this.emitter);
|
|
533
|
-
this.instances = new InstancesModule(this.api, this.emitter);
|
|
534
477
|
if (config.retryOptions) {
|
|
535
478
|
this.setupRetryInterceptor(config.retryOptions);
|
|
536
479
|
}
|
|
@@ -596,7 +539,6 @@ var init_src = __esm(() => {
|
|
|
596
539
|
init_auth();
|
|
597
540
|
init_ci();
|
|
598
541
|
init_docs();
|
|
599
|
-
init_instances();
|
|
600
542
|
init_invitations();
|
|
601
543
|
init_organizations();
|
|
602
544
|
init_sprints();
|
|
@@ -608,7 +550,6 @@ var init_src = __esm(() => {
|
|
|
608
550
|
init_auth();
|
|
609
551
|
init_ci();
|
|
610
552
|
init_docs();
|
|
611
|
-
init_instances();
|
|
612
553
|
init_invitations();
|
|
613
554
|
init_organizations();
|
|
614
555
|
init_sprints();
|
|
@@ -874,6 +815,112 @@ var init_resolve_bin = __esm(() => {
|
|
|
874
815
|
ENV_VARS_TO_STRIP = ["ANTHROPIC_API_KEY", "OPENAI_API_KEY"];
|
|
875
816
|
});
|
|
876
817
|
|
|
818
|
+
// src/ai/claude-stream-parser.ts
|
|
819
|
+
class ClaudeStreamParser {
|
|
820
|
+
activeTools = new Map;
|
|
821
|
+
parseLineToChunk(line) {
|
|
822
|
+
if (!line.trim())
|
|
823
|
+
return null;
|
|
824
|
+
try {
|
|
825
|
+
const item = JSON.parse(line);
|
|
826
|
+
return this.processItemToChunk(item);
|
|
827
|
+
} catch {
|
|
828
|
+
return null;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
parseLine(line, log) {
|
|
832
|
+
if (!line.trim())
|
|
833
|
+
return null;
|
|
834
|
+
try {
|
|
835
|
+
const item = JSON.parse(line);
|
|
836
|
+
return this.processItem(item, log);
|
|
837
|
+
} catch {
|
|
838
|
+
return null;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
processItemToChunk(item) {
|
|
842
|
+
if (item.type === "result") {
|
|
843
|
+
return { type: "result", content: item.result || "" };
|
|
844
|
+
}
|
|
845
|
+
if (item.type === "stream_event" && item.event) {
|
|
846
|
+
return this.handleEventToChunk(item.event);
|
|
847
|
+
}
|
|
848
|
+
return null;
|
|
849
|
+
}
|
|
850
|
+
handleEventToChunk(event) {
|
|
851
|
+
const { type, delta, content_block, index } = event;
|
|
852
|
+
if (type === "content_block_delta" && delta?.type === "text_delta") {
|
|
853
|
+
return { type: "text_delta", content: delta.text || "" };
|
|
854
|
+
}
|
|
855
|
+
if (type === "content_block_delta" && delta?.type === "input_json_delta" && delta.partial_json !== undefined && index !== undefined) {
|
|
856
|
+
const activeTool = this.activeTools.get(index);
|
|
857
|
+
if (activeTool) {
|
|
858
|
+
activeTool.parameterJson += delta.partial_json;
|
|
859
|
+
}
|
|
860
|
+
return null;
|
|
861
|
+
}
|
|
862
|
+
if (type === "content_block_start" && content_block) {
|
|
863
|
+
if (content_block.type === "tool_use" && content_block.name) {
|
|
864
|
+
if (index !== undefined) {
|
|
865
|
+
this.activeTools.set(index, {
|
|
866
|
+
name: content_block.name,
|
|
867
|
+
id: content_block.id,
|
|
868
|
+
index,
|
|
869
|
+
parameterJson: "",
|
|
870
|
+
startTime: Date.now()
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
return {
|
|
874
|
+
type: "tool_use",
|
|
875
|
+
tool: content_block.name,
|
|
876
|
+
id: content_block.id
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
if (content_block.type === "thinking") {
|
|
880
|
+
return { type: "thinking" };
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
if (type === "content_block_stop" && index !== undefined) {
|
|
884
|
+
const activeTool = this.activeTools.get(index);
|
|
885
|
+
if (activeTool?.parameterJson) {
|
|
886
|
+
try {
|
|
887
|
+
const parameters = JSON.parse(activeTool.parameterJson);
|
|
888
|
+
return {
|
|
889
|
+
type: "tool_parameters",
|
|
890
|
+
tool: activeTool.name,
|
|
891
|
+
id: activeTool.id,
|
|
892
|
+
parameters
|
|
893
|
+
};
|
|
894
|
+
} catch {}
|
|
895
|
+
}
|
|
896
|
+
return null;
|
|
897
|
+
}
|
|
898
|
+
return null;
|
|
899
|
+
}
|
|
900
|
+
processItem(item, log) {
|
|
901
|
+
if (item.type === "result") {
|
|
902
|
+
return item.result || "";
|
|
903
|
+
}
|
|
904
|
+
if (item.type === "stream_event" && item.event) {
|
|
905
|
+
this.handleEvent(item.event, log);
|
|
906
|
+
}
|
|
907
|
+
return null;
|
|
908
|
+
}
|
|
909
|
+
handleEvent(event, log) {
|
|
910
|
+
const { type, content_block } = event;
|
|
911
|
+
if (type === "content_block_start" && content_block) {
|
|
912
|
+
if (content_block.type === "tool_use" && content_block.name) {
|
|
913
|
+
log?.(`
|
|
914
|
+
${c.primary("[Claude]")} ${c.bold(`Running ${content_block.name}...`)}
|
|
915
|
+
`, "info");
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
var init_claude_stream_parser = __esm(() => {
|
|
921
|
+
init_colors();
|
|
922
|
+
});
|
|
923
|
+
|
|
877
924
|
// src/ai/claude-runner.ts
|
|
878
925
|
class ClaudeRunner {
|
|
879
926
|
model;
|
|
@@ -881,7 +928,6 @@ class ClaudeRunner {
|
|
|
881
928
|
projectPath;
|
|
882
929
|
eventEmitter;
|
|
883
930
|
currentToolName;
|
|
884
|
-
activeTools = new Map;
|
|
885
931
|
activeProcess = null;
|
|
886
932
|
aborted = false;
|
|
887
933
|
timeoutMs;
|
|
@@ -916,7 +962,7 @@ class ClaudeRunner {
|
|
|
916
962
|
}
|
|
917
963
|
if (!isLastAttempt) {
|
|
918
964
|
const delay = Math.pow(2, attempt) * 1000;
|
|
919
|
-
|
|
965
|
+
this.log?.(`Claude CLI attempt ${attempt} failed: ${err.message}. Retrying in ${delay}ms...`, "warn");
|
|
920
966
|
await new Promise((resolve2) => setTimeout(resolve2, delay));
|
|
921
967
|
}
|
|
922
968
|
}
|
|
@@ -956,6 +1002,7 @@ class ClaudeRunner {
|
|
|
956
1002
|
}
|
|
957
1003
|
async* runStream(prompt) {
|
|
958
1004
|
this.aborted = false;
|
|
1005
|
+
const parser = new ClaudeStreamParser;
|
|
959
1006
|
const args = this.buildCliArgs();
|
|
960
1007
|
const env = getAugmentedEnv({
|
|
961
1008
|
FORCE_COLOR: "1",
|
|
@@ -1016,7 +1063,7 @@ class ClaudeRunner {
|
|
|
1016
1063
|
`);
|
|
1017
1064
|
buffer = lines.pop() || "";
|
|
1018
1065
|
for (const line of lines) {
|
|
1019
|
-
const chunk =
|
|
1066
|
+
const chunk = parser.parseLineToChunk(line);
|
|
1020
1067
|
if (chunk) {
|
|
1021
1068
|
if (chunk.type === "result") {
|
|
1022
1069
|
lastResultContent = chunk.content;
|
|
@@ -1125,77 +1172,9 @@ class ClaudeRunner {
|
|
|
1125
1172
|
break;
|
|
1126
1173
|
}
|
|
1127
1174
|
}
|
|
1128
|
-
parseStreamLineToChunk(line) {
|
|
1129
|
-
if (!line.trim())
|
|
1130
|
-
return null;
|
|
1131
|
-
try {
|
|
1132
|
-
const item = JSON.parse(line);
|
|
1133
|
-
return this.processStreamItemToChunk(item);
|
|
1134
|
-
} catch {
|
|
1135
|
-
return null;
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
processStreamItemToChunk(item) {
|
|
1139
|
-
if (item.type === "result") {
|
|
1140
|
-
return { type: "result", content: item.result || "" };
|
|
1141
|
-
}
|
|
1142
|
-
if (item.type === "stream_event" && item.event) {
|
|
1143
|
-
return this.handleEventToChunk(item.event);
|
|
1144
|
-
}
|
|
1145
|
-
return null;
|
|
1146
|
-
}
|
|
1147
|
-
handleEventToChunk(event) {
|
|
1148
|
-
const { type, delta, content_block, index } = event;
|
|
1149
|
-
if (type === "content_block_delta" && delta?.type === "text_delta") {
|
|
1150
|
-
return { type: "text_delta", content: delta.text || "" };
|
|
1151
|
-
}
|
|
1152
|
-
if (type === "content_block_delta" && delta?.type === "input_json_delta" && delta.partial_json !== undefined && index !== undefined) {
|
|
1153
|
-
const activeTool = this.activeTools.get(index);
|
|
1154
|
-
if (activeTool) {
|
|
1155
|
-
activeTool.parameterJson += delta.partial_json;
|
|
1156
|
-
}
|
|
1157
|
-
return null;
|
|
1158
|
-
}
|
|
1159
|
-
if (type === "content_block_start" && content_block) {
|
|
1160
|
-
if (content_block.type === "tool_use" && content_block.name) {
|
|
1161
|
-
if (index !== undefined) {
|
|
1162
|
-
this.activeTools.set(index, {
|
|
1163
|
-
name: content_block.name,
|
|
1164
|
-
id: content_block.id,
|
|
1165
|
-
index,
|
|
1166
|
-
parameterJson: "",
|
|
1167
|
-
startTime: Date.now()
|
|
1168
|
-
});
|
|
1169
|
-
}
|
|
1170
|
-
return {
|
|
1171
|
-
type: "tool_use",
|
|
1172
|
-
tool: content_block.name,
|
|
1173
|
-
id: content_block.id
|
|
1174
|
-
};
|
|
1175
|
-
}
|
|
1176
|
-
if (content_block.type === "thinking") {
|
|
1177
|
-
return { type: "thinking" };
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
if (type === "content_block_stop" && index !== undefined) {
|
|
1181
|
-
const activeTool = this.activeTools.get(index);
|
|
1182
|
-
if (activeTool?.parameterJson) {
|
|
1183
|
-
try {
|
|
1184
|
-
const parameters = JSON.parse(activeTool.parameterJson);
|
|
1185
|
-
return {
|
|
1186
|
-
type: "tool_parameters",
|
|
1187
|
-
tool: activeTool.name,
|
|
1188
|
-
id: activeTool.id,
|
|
1189
|
-
parameters
|
|
1190
|
-
};
|
|
1191
|
-
} catch {}
|
|
1192
|
-
}
|
|
1193
|
-
return null;
|
|
1194
|
-
}
|
|
1195
|
-
return null;
|
|
1196
|
-
}
|
|
1197
1175
|
executeRun(prompt) {
|
|
1198
1176
|
this.aborted = false;
|
|
1177
|
+
const parser = new ClaudeStreamParser;
|
|
1199
1178
|
return new Promise((resolve2, reject) => {
|
|
1200
1179
|
const args = this.buildCliArgs();
|
|
1201
1180
|
const env = getAugmentedEnv({
|
|
@@ -1218,7 +1197,7 @@ class ClaudeRunner {
|
|
|
1218
1197
|
`);
|
|
1219
1198
|
buffer = lines.pop() || "";
|
|
1220
1199
|
for (const line of lines) {
|
|
1221
|
-
const result =
|
|
1200
|
+
const result = parser.parseLine(line, this.log);
|
|
1222
1201
|
if (result)
|
|
1223
1202
|
finalResult = result;
|
|
1224
1203
|
}
|
|
@@ -1259,35 +1238,6 @@ class ClaudeRunner {
|
|
|
1259
1238
|
claude.stdin.end();
|
|
1260
1239
|
});
|
|
1261
1240
|
}
|
|
1262
|
-
handleStreamLine(line) {
|
|
1263
|
-
if (!line.trim())
|
|
1264
|
-
return null;
|
|
1265
|
-
try {
|
|
1266
|
-
const item = JSON.parse(line);
|
|
1267
|
-
return this.processStreamItem(item);
|
|
1268
|
-
} catch {
|
|
1269
|
-
return null;
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1272
|
-
processStreamItem(item) {
|
|
1273
|
-
if (item.type === "result") {
|
|
1274
|
-
return item.result || "";
|
|
1275
|
-
}
|
|
1276
|
-
if (item.type === "stream_event" && item.event) {
|
|
1277
|
-
this.handleEvent(item.event);
|
|
1278
|
-
}
|
|
1279
|
-
return null;
|
|
1280
|
-
}
|
|
1281
|
-
handleEvent(event) {
|
|
1282
|
-
const { type, content_block } = event;
|
|
1283
|
-
if (type === "content_block_start" && content_block) {
|
|
1284
|
-
if (content_block.type === "tool_use" && content_block.name) {
|
|
1285
|
-
this.log?.(`
|
|
1286
|
-
${c.primary("[Claude]")} ${c.bold(`Running ${content_block.name}...`)}
|
|
1287
|
-
`, "info");
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
1241
|
shouldSuppressLine(line) {
|
|
1292
1242
|
const infoLogRegex = /^\[\d{2}:\d{2}:\d{2}\]\s\[.*?\]\sℹ\s*$/;
|
|
1293
1243
|
return infoLogRegex.test(line.trim());
|
|
@@ -1301,8 +1251,8 @@ ${c.primary("[Claude]")} ${c.bold(`Running ${content_block.name}...`)}
|
|
|
1301
1251
|
var import_node_child_process, import_node_path3, DEFAULT_TIMEOUT_MS;
|
|
1302
1252
|
var init_claude_runner = __esm(() => {
|
|
1303
1253
|
init_config();
|
|
1304
|
-
init_colors();
|
|
1305
1254
|
init_resolve_bin();
|
|
1255
|
+
init_claude_stream_parser();
|
|
1306
1256
|
import_node_child_process = require("node:child_process");
|
|
1307
1257
|
import_node_path3 = require("node:path");
|
|
1308
1258
|
DEFAULT_TIMEOUT_MS = 60 * 60 * 1000;
|
|
@@ -1350,7 +1300,7 @@ class CodexRunner {
|
|
|
1350
1300
|
}
|
|
1351
1301
|
if (attempt < maxRetries) {
|
|
1352
1302
|
const delay = Math.pow(2, attempt) * 1000;
|
|
1353
|
-
|
|
1303
|
+
this.log?.(`Codex CLI attempt ${attempt} failed: ${lastError.message}. Retrying in ${delay}ms...`, "warn");
|
|
1354
1304
|
await this.sleep(delay);
|
|
1355
1305
|
}
|
|
1356
1306
|
}
|
|
@@ -1647,6 +1597,20 @@ var init_codex_runner = __esm(() => {
|
|
|
1647
1597
|
});
|
|
1648
1598
|
|
|
1649
1599
|
// src/ai/factory.ts
|
|
1600
|
+
function createWorkerLogger(agentId, prefix) {
|
|
1601
|
+
const tag = prefix ? `${prefix}:${agentId.slice(-8)}` : agentId.slice(-8);
|
|
1602
|
+
return (message, level = "info") => {
|
|
1603
|
+
const timestamp = new Date().toISOString().split("T")[1]?.slice(0, 8) ?? "";
|
|
1604
|
+
const colorFn = {
|
|
1605
|
+
info: c.cyan,
|
|
1606
|
+
success: c.green,
|
|
1607
|
+
warn: c.yellow,
|
|
1608
|
+
error: c.red
|
|
1609
|
+
}[level];
|
|
1610
|
+
const icon = { info: "ℹ", success: "✓", warn: "⚠", error: "✗" }[level];
|
|
1611
|
+
console.log(`${c.dim(`[${timestamp}]`)} ${c.bold(`[${tag}]`)} ${colorFn(`${icon} ${message}`)}`);
|
|
1612
|
+
};
|
|
1613
|
+
}
|
|
1650
1614
|
function createAiRunner(provider, config) {
|
|
1651
1615
|
const resolvedProvider = provider ?? PROVIDER.CLAUDE;
|
|
1652
1616
|
const model = config.model ?? DEFAULT_MODEL[resolvedProvider];
|
|
@@ -1661,8 +1625,10 @@ function createAiRunner(provider, config) {
|
|
|
1661
1625
|
return new ClaudeRunner(config.projectPath, model, config.log, config.timeoutMs);
|
|
1662
1626
|
}
|
|
1663
1627
|
}
|
|
1628
|
+
var noopLogger = () => {};
|
|
1664
1629
|
var init_factory = __esm(() => {
|
|
1665
1630
|
init_config();
|
|
1631
|
+
init_colors();
|
|
1666
1632
|
init_claude_runner();
|
|
1667
1633
|
init_codex_runner();
|
|
1668
1634
|
});
|
|
@@ -2595,9 +2561,11 @@ class AgentWorker {
|
|
|
2595
2561
|
currentTaskId = null;
|
|
2596
2562
|
completedTaskList = [];
|
|
2597
2563
|
taskSummaries = [];
|
|
2564
|
+
log;
|
|
2598
2565
|
constructor(config) {
|
|
2599
2566
|
this.config = config;
|
|
2600
2567
|
const projectPath = config.projectPath || process.cwd();
|
|
2568
|
+
this.log = createWorkerLogger(config.agentId);
|
|
2601
2569
|
this.client = new LocusClient({
|
|
2602
2570
|
baseUrl: config.apiBase,
|
|
2603
2571
|
token: config.apiKey,
|
|
@@ -2608,7 +2576,6 @@ class AgentWorker {
|
|
|
2608
2576
|
factor: 2
|
|
2609
2577
|
}
|
|
2610
2578
|
});
|
|
2611
|
-
const log = this.log.bind(this);
|
|
2612
2579
|
if (!isGitAvailable()) {
|
|
2613
2580
|
this.log("git is not installed — branch management will not work", "error");
|
|
2614
2581
|
}
|
|
@@ -2619,29 +2586,18 @@ class AgentWorker {
|
|
|
2619
2586
|
this.aiRunner = createAiRunner(provider, {
|
|
2620
2587
|
projectPath,
|
|
2621
2588
|
model: config.model,
|
|
2622
|
-
log,
|
|
2589
|
+
log: this.log,
|
|
2623
2590
|
reasoningEffort: config.reasoningEffort
|
|
2624
2591
|
});
|
|
2625
2592
|
this.taskExecutor = new TaskExecutor({
|
|
2626
2593
|
aiRunner: this.aiRunner,
|
|
2627
2594
|
projectPath,
|
|
2628
|
-
log
|
|
2595
|
+
log: this.log
|
|
2629
2596
|
});
|
|
2630
|
-
this.gitWorkflow = new GitWorkflow(config, log);
|
|
2597
|
+
this.gitWorkflow = new GitWorkflow(config, this.log);
|
|
2631
2598
|
const providerLabel = provider === "codex" ? "Codex" : "Claude";
|
|
2632
2599
|
this.log(`Using ${providerLabel} CLI for all phases`, "info");
|
|
2633
2600
|
}
|
|
2634
|
-
log(message, level = "info") {
|
|
2635
|
-
const timestamp = new Date().toISOString().split("T")[1]?.slice(0, 8) ?? "";
|
|
2636
|
-
const colorFn = {
|
|
2637
|
-
info: c.cyan,
|
|
2638
|
-
success: c.green,
|
|
2639
|
-
warn: c.yellow,
|
|
2640
|
-
error: c.red
|
|
2641
|
-
}[level];
|
|
2642
|
-
const prefix = { info: "ℹ", success: "✓", warn: "⚠", error: "✗" }[level];
|
|
2643
|
-
console.log(`${c.dim(`[${timestamp}]`)} ${c.bold(`[${this.config.agentId.slice(-8)}]`)} ${colorFn(`${prefix} ${message}`)}`);
|
|
2644
|
-
}
|
|
2645
2601
|
async getActiveSprint() {
|
|
2646
2602
|
try {
|
|
2647
2603
|
if (this.config.sprintId) {
|
|
@@ -2817,7 +2773,6 @@ var init_worker = __esm(() => {
|
|
|
2817
2773
|
init_config();
|
|
2818
2774
|
init_git_utils();
|
|
2819
2775
|
init_src();
|
|
2820
|
-
init_colors();
|
|
2821
2776
|
init_git_workflow();
|
|
2822
2777
|
init_task_executor();
|
|
2823
2778
|
import_shared3 = require("@locusai/shared");
|
|
@@ -2842,6 +2797,7 @@ __export(exports_index_node, {
|
|
|
2842
2797
|
plannedTasksToCreatePayloads: () => plannedTasksToCreatePayloads,
|
|
2843
2798
|
parseSprintPlanFromAI: () => parseSprintPlanFromAI,
|
|
2844
2799
|
parseJsonWithSchema: () => parseJsonWithSchema,
|
|
2800
|
+
noopLogger: () => noopLogger,
|
|
2845
2801
|
isValidModelForProvider: () => isValidModelForProvider,
|
|
2846
2802
|
getRemoteUrl: () => getRemoteUrl,
|
|
2847
2803
|
getModelsForProvider: () => getModelsForProvider,
|
|
@@ -2851,6 +2807,7 @@ __export(exports_index_node, {
|
|
|
2851
2807
|
getAgentArtifactsPath: () => getAgentArtifactsPath,
|
|
2852
2808
|
extractJsonFromLLMOutput: () => extractJsonFromLLMOutput,
|
|
2853
2809
|
detectRemoteProvider: () => detectRemoteProvider,
|
|
2810
|
+
createWorkerLogger: () => createWorkerLogger,
|
|
2854
2811
|
createAiRunner: () => createAiRunner,
|
|
2855
2812
|
c: () => c,
|
|
2856
2813
|
buildSummaryPrompt: () => buildSummaryPrompt,
|
|
@@ -2876,7 +2833,6 @@ __export(exports_index_node, {
|
|
|
2876
2833
|
LOCUS_GITIGNORE_PATTERNS: () => LOCUS_GITIGNORE_PATTERNS,
|
|
2877
2834
|
LOCUS_CONFIG: () => LOCUS_CONFIG,
|
|
2878
2835
|
InvitationsModule: () => InvitationsModule,
|
|
2879
|
-
InstancesModule: () => InstancesModule,
|
|
2880
2836
|
HistoryManager: () => HistoryManager,
|
|
2881
2837
|
GitWorkflow: () => GitWorkflow,
|
|
2882
2838
|
ExecSession: () => ExecSession,
|
|
@@ -2894,6 +2850,7 @@ __export(exports_index_node, {
|
|
|
2894
2850
|
CodexRunner: () => CodexRunner,
|
|
2895
2851
|
CodebaseIndexerService: () => CodebaseIndexerService,
|
|
2896
2852
|
CodebaseIndexer: () => CodebaseIndexer,
|
|
2853
|
+
ClaudeStreamParser: () => ClaudeStreamParser,
|
|
2897
2854
|
ClaudeRunner: () => ClaudeRunner,
|
|
2898
2855
|
CiModule: () => CiModule,
|
|
2899
2856
|
CODEX_MODELS: () => CODEX_MODELS,
|
|
@@ -3564,7 +3521,6 @@ class PrService {
|
|
|
3564
3521
|
|
|
3565
3522
|
// src/agent/reviewer-worker.ts
|
|
3566
3523
|
init_src();
|
|
3567
|
-
init_colors();
|
|
3568
3524
|
function resolveProvider2(value) {
|
|
3569
3525
|
if (!value || value.startsWith("--"))
|
|
3570
3526
|
return PROVIDER.CLAUDE;
|
|
@@ -3582,9 +3538,11 @@ class ReviewerWorker {
|
|
|
3582
3538
|
currentTaskId = null;
|
|
3583
3539
|
maxReviews = 50;
|
|
3584
3540
|
reviewsCompleted = 0;
|
|
3541
|
+
log;
|
|
3585
3542
|
constructor(config) {
|
|
3586
3543
|
this.config = config;
|
|
3587
3544
|
const projectPath = config.projectPath || process.cwd();
|
|
3545
|
+
this.log = createWorkerLogger(config.agentId, "R");
|
|
3588
3546
|
this.client = new LocusClient({
|
|
3589
3547
|
baseUrl: config.apiBase,
|
|
3590
3548
|
token: config.apiKey,
|
|
@@ -3595,28 +3553,16 @@ class ReviewerWorker {
|
|
|
3595
3553
|
factor: 2
|
|
3596
3554
|
}
|
|
3597
3555
|
});
|
|
3598
|
-
const log = this.log.bind(this);
|
|
3599
3556
|
const provider = config.provider ?? PROVIDER.CLAUDE;
|
|
3600
3557
|
this.aiRunner = createAiRunner(provider, {
|
|
3601
3558
|
projectPath,
|
|
3602
3559
|
model: config.model,
|
|
3603
|
-
log
|
|
3560
|
+
log: this.log
|
|
3604
3561
|
});
|
|
3605
|
-
this.prService = new PrService(projectPath, log);
|
|
3562
|
+
this.prService = new PrService(projectPath, this.log);
|
|
3606
3563
|
const providerLabel = provider === "codex" ? "Codex" : "Claude";
|
|
3607
3564
|
this.log(`Reviewer agent using ${providerLabel} CLI`, "info");
|
|
3608
3565
|
}
|
|
3609
|
-
log(message, level = "info") {
|
|
3610
|
-
const timestamp = new Date().toISOString().split("T")[1]?.slice(0, 8) ?? "";
|
|
3611
|
-
const colorFn = {
|
|
3612
|
-
info: c.cyan,
|
|
3613
|
-
success: c.green,
|
|
3614
|
-
warn: c.yellow,
|
|
3615
|
-
error: c.red
|
|
3616
|
-
}[level];
|
|
3617
|
-
const prefix = { info: "ℹ", success: "✓", warn: "⚠", error: "✗" }[level];
|
|
3618
|
-
console.log(`${c.dim(`[${timestamp}]`)} ${c.bold(`[R:${this.config.agentId.slice(-8)}]`)} ${colorFn(`${prefix} ${message}`)}`);
|
|
3619
|
-
}
|
|
3620
3566
|
getNextUnreviewedPr() {
|
|
3621
3567
|
const prs = this.prService.listUnreviewedLocusPrs();
|
|
3622
3568
|
return prs.length > 0 ? prs[0] : null;
|
|
@@ -3773,6 +3719,7 @@ init_task_executor();
|
|
|
3773
3719
|
init_worker();
|
|
3774
3720
|
// src/ai/index.ts
|
|
3775
3721
|
init_claude_runner();
|
|
3722
|
+
init_claude_stream_parser();
|
|
3776
3723
|
init_codex_runner();
|
|
3777
3724
|
init_factory();
|
|
3778
3725
|
// src/core/index.ts
|
|
@@ -3928,6 +3875,7 @@ ${insightsText.trimEnd()}
|
|
|
3928
3875
|
</discussion_summary>`;
|
|
3929
3876
|
}
|
|
3930
3877
|
// src/discussion/discussion-facilitator.ts
|
|
3878
|
+
init_factory();
|
|
3931
3879
|
init_config();
|
|
3932
3880
|
var import_node_fs7 = require("node:fs");
|
|
3933
3881
|
class DiscussionFacilitator {
|
|
@@ -3941,9 +3889,7 @@ class DiscussionFacilitator {
|
|
|
3941
3889
|
this.projectPath = config.projectPath;
|
|
3942
3890
|
this.aiRunner = config.aiRunner;
|
|
3943
3891
|
this.discussionManager = config.discussionManager;
|
|
3944
|
-
this.log = config.log ??
|
|
3945
|
-
return;
|
|
3946
|
-
});
|
|
3892
|
+
this.log = config.log ?? noopLogger;
|
|
3947
3893
|
this.provider = config.provider;
|
|
3948
3894
|
this.model = config.model;
|
|
3949
3895
|
}
|
|
@@ -5536,6 +5482,7 @@ class PlanManager {
|
|
|
5536
5482
|
}
|
|
5537
5483
|
}
|
|
5538
5484
|
// src/planning/planning-meeting.ts
|
|
5485
|
+
init_factory();
|
|
5539
5486
|
init_config();
|
|
5540
5487
|
var import_node_fs11 = require("node:fs");
|
|
5541
5488
|
var import_node_path12 = require("node:path");
|
|
@@ -5617,9 +5564,7 @@ class PlanningMeeting {
|
|
|
5617
5564
|
constructor(config) {
|
|
5618
5565
|
this.projectPath = config.projectPath;
|
|
5619
5566
|
this.aiRunner = config.aiRunner;
|
|
5620
|
-
this.log = config.log ??
|
|
5621
|
-
return;
|
|
5622
|
-
});
|
|
5567
|
+
this.log = config.log ?? noopLogger;
|
|
5623
5568
|
}
|
|
5624
5569
|
async run(directive, feedback) {
|
|
5625
5570
|
this.log("Planning sprint...", "info");
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { LocusConfig, LocusEmitter } from "./events.js";
|
|
|
2
2
|
import { AuthModule } from "./modules/auth.js";
|
|
3
3
|
import { CiModule } from "./modules/ci.js";
|
|
4
4
|
import { DocsModule } from "./modules/docs.js";
|
|
5
|
-
import { InstancesModule } from "./modules/instances.js";
|
|
6
5
|
import { InvitationsModule } from "./modules/invitations.js";
|
|
7
6
|
import { OrganizationsModule } from "./modules/organizations.js";
|
|
8
7
|
import { SprintsModule } from "./modules/sprints.js";
|
|
@@ -14,7 +13,6 @@ export * from "./events.js";
|
|
|
14
13
|
export * from "./modules/auth.js";
|
|
15
14
|
export * from "./modules/ci.js";
|
|
16
15
|
export * from "./modules/docs.js";
|
|
17
|
-
export * from "./modules/instances.js";
|
|
18
16
|
export * from "./modules/invitations.js";
|
|
19
17
|
export * from "./modules/organizations.js";
|
|
20
18
|
export * from "./modules/sprints.js";
|
|
@@ -31,7 +29,6 @@ export declare class LocusClient {
|
|
|
31
29
|
readonly invitations: InvitationsModule;
|
|
32
30
|
readonly docs: DocsModule;
|
|
33
31
|
readonly ci: CiModule;
|
|
34
|
-
readonly instances: InstancesModule;
|
|
35
32
|
constructor(config: LocusConfig);
|
|
36
33
|
private setupRetryInterceptor;
|
|
37
34
|
private setupInterceptors;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAc,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAc,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAI3D,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,kCAAkC,CAAC;AAE1C,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AAExC,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgB;IACpC,SAAgB,OAAO,EAAE,YAAY,CAAC;IAEtC,SAAgB,IAAI,EAAE,UAAU,CAAC;IACjC,SAAgB,KAAK,EAAE,WAAW,CAAC;IACnC,SAAgB,OAAO,EAAE,aAAa,CAAC;IACvC,SAAgB,UAAU,EAAE,gBAAgB,CAAC;IAC7C,SAAgB,aAAa,EAAE,mBAAmB,CAAC;IACnD,SAAgB,WAAW,EAAE,iBAAiB,CAAC;IAC/C,SAAgB,IAAI,EAAE,UAAU,CAAC;IACjC,SAAgB,EAAE,EAAE,QAAQ,CAAC;gBAEjB,MAAM,EAAE,WAAW;IA6B/B,OAAO,CAAC,qBAAqB;IAmC7B,OAAO,CAAC,iBAAiB;IAmDlB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAOrC"}
|