@locusai/cli 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.
Files changed (3) hide show
  1. package/bin/agent/worker.js +134 -260
  2. package/bin/locus.js +796 -859
  3. package/package.json +4 -3
@@ -13949,7 +13949,7 @@ var init_constants = __esm(() => {
13949
13949
  });
13950
13950
 
13951
13951
  // ../shared/src/enums.ts
13952
- var UserRole, MembershipRole, TaskStatus, TaskPriority, AssigneeRole, SprintStatus, InstanceStatus, AwsRegion, EventType;
13952
+ var UserRole, MembershipRole, TaskStatus, TaskPriority, AssigneeRole, SprintStatus, EventType;
13953
13953
  var init_enums = __esm(() => {
13954
13954
  ((UserRole2) => {
13955
13955
  UserRole2["USER"] = "USER";
@@ -13986,16 +13986,6 @@ var init_enums = __esm(() => {
13986
13986
  SprintStatus2["ACTIVE"] = "ACTIVE";
13987
13987
  SprintStatus2["COMPLETED"] = "COMPLETED";
13988
13988
  })(SprintStatus ||= {});
13989
- ((InstanceStatus2) => {
13990
- InstanceStatus2["PROVISIONING"] = "PROVISIONING";
13991
- InstanceStatus2["RUNNING"] = "RUNNING";
13992
- InstanceStatus2["STOPPED"] = "STOPPED";
13993
- InstanceStatus2["TERMINATED"] = "TERMINATED";
13994
- InstanceStatus2["ERROR"] = "ERROR";
13995
- })(InstanceStatus ||= {});
13996
- ((AwsRegion2) => {
13997
- AwsRegion2["US_EAST_1"] = "us-east-1";
13998
- })(AwsRegion ||= {});
13999
13989
  ((EventType2) => {
14000
13990
  EventType2["TASK_CREATED"] = "TASK_CREATED";
14001
13991
  EventType2["TASK_UPDATED"] = "TASK_UPDATED";
@@ -14343,76 +14333,6 @@ var init_auth = __esm(() => {
14343
14333
  });
14344
14334
  });
14345
14335
 
14346
- // ../shared/src/models/aws-instance.ts
14347
- var InstanceAction, AwsCredentialsSchema, IntegrationSchema, AwsInstanceSchema, CreateAwsInstanceSchema, UpdateAwsInstanceSchema, SaveAwsCredentialsSchema, ProvisionAwsInstanceSchema, InstanceActionBodySchema, InstanceIdParamSchema, CIDR_REGEX, UpdateSecurityRulesSchema;
14348
- var init_aws_instance = __esm(() => {
14349
- init_zod();
14350
- init_common();
14351
- init_enums();
14352
- ((InstanceAction2) => {
14353
- InstanceAction2["START"] = "START";
14354
- InstanceAction2["STOP"] = "STOP";
14355
- InstanceAction2["TERMINATE"] = "TERMINATE";
14356
- })(InstanceAction ||= {});
14357
- AwsCredentialsSchema = exports_external.object({
14358
- accessKeyId: exports_external.string().min(1),
14359
- secretAccessKey: exports_external.string().min(1),
14360
- region: exports_external.enum(AwsRegion).default("us-east-1" /* US_EAST_1 */)
14361
- });
14362
- IntegrationSchema = exports_external.object({
14363
- name: exports_external.string(),
14364
- config: exports_external.record(exports_external.string(), exports_external.string())
14365
- });
14366
- AwsInstanceSchema = BaseEntitySchema.extend({
14367
- workspaceId: exports_external.uuid(),
14368
- instanceId: exports_external.string(),
14369
- status: exports_external.enum(InstanceStatus),
14370
- instanceType: exports_external.enum(["t3.micro", "t3.small", "t3.medium"]),
14371
- region: exports_external.enum(AwsRegion).default("us-east-1" /* US_EAST_1 */),
14372
- publicIp: exports_external.string().nullable().optional(),
14373
- launchTime: exports_external.union([exports_external.date(), exports_external.number()]).nullable().optional(),
14374
- repoUrl: exports_external.string().nullable().optional(),
14375
- integrations: exports_external.array(IntegrationSchema).default([])
14376
- });
14377
- CreateAwsInstanceSchema = exports_external.object({
14378
- workspaceId: exports_external.uuid(),
14379
- instanceType: exports_external.enum(["t3.micro", "t3.small", "t3.medium"]).default("t3.micro"),
14380
- region: exports_external.enum(AwsRegion).default("us-east-1" /* US_EAST_1 */),
14381
- repoUrl: exports_external.string().optional(),
14382
- integrations: exports_external.array(IntegrationSchema).optional().default([])
14383
- });
14384
- UpdateAwsInstanceSchema = exports_external.object({
14385
- status: exports_external.enum(InstanceStatus).optional(),
14386
- instanceType: exports_external.enum(["t3.micro", "t3.small", "t3.medium"]).optional(),
14387
- publicIp: exports_external.string().nullable().optional(),
14388
- launchTime: exports_external.union([exports_external.date(), exports_external.number()]).nullable().optional(),
14389
- repoUrl: exports_external.string().nullable().optional(),
14390
- integrations: exports_external.array(IntegrationSchema).optional()
14391
- });
14392
- SaveAwsCredentialsSchema = exports_external.object({
14393
- accessKeyId: exports_external.string().min(16),
14394
- secretAccessKey: exports_external.string().min(1),
14395
- region: exports_external.string().default("us-east-1")
14396
- });
14397
- ProvisionAwsInstanceSchema = exports_external.object({
14398
- repoUrl: exports_external.string().min(1),
14399
- githubToken: exports_external.string().min(1),
14400
- instanceType: exports_external.enum(["t3.micro", "t3.small", "t3.medium"]).default("t3.small"),
14401
- integrations: exports_external.array(IntegrationSchema).optional().default([])
14402
- });
14403
- InstanceActionBodySchema = exports_external.object({
14404
- action: exports_external.nativeEnum(InstanceAction)
14405
- });
14406
- InstanceIdParamSchema = exports_external.object({
14407
- workspaceId: exports_external.string().uuid("Invalid Workspace ID"),
14408
- instanceId: exports_external.string().uuid("Invalid Instance ID")
14409
- });
14410
- CIDR_REGEX = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,2}$/;
14411
- UpdateSecurityRulesSchema = exports_external.object({
14412
- allowedIps: exports_external.array(exports_external.string().regex(CIDR_REGEX, "Invalid CIDR format (e.g. 1.2.3.4/32)"))
14413
- });
14414
- });
14415
-
14416
14336
  // ../shared/src/models/ci.ts
14417
14337
  var RecordCiSchema;
14418
14338
  var init_ci = __esm(() => {
@@ -14800,7 +14720,6 @@ var init_models = __esm(() => {
14800
14720
  init_activity();
14801
14721
  init_agent();
14802
14722
  init_auth();
14803
- init_aws_instance();
14804
14723
  init_ci();
14805
14724
  init_doc();
14806
14725
  init_doc_group();
@@ -15560,6 +15479,112 @@ var init_resolve_bin = __esm(() => {
15560
15479
  ENV_VARS_TO_STRIP = ["ANTHROPIC_API_KEY", "OPENAI_API_KEY"];
15561
15480
  });
15562
15481
 
15482
+ // ../sdk/src/ai/claude-stream-parser.ts
15483
+ class ClaudeStreamParser {
15484
+ activeTools = new Map;
15485
+ parseLineToChunk(line) {
15486
+ if (!line.trim())
15487
+ return null;
15488
+ try {
15489
+ const item = JSON.parse(line);
15490
+ return this.processItemToChunk(item);
15491
+ } catch {
15492
+ return null;
15493
+ }
15494
+ }
15495
+ parseLine(line, log) {
15496
+ if (!line.trim())
15497
+ return null;
15498
+ try {
15499
+ const item = JSON.parse(line);
15500
+ return this.processItem(item, log);
15501
+ } catch {
15502
+ return null;
15503
+ }
15504
+ }
15505
+ processItemToChunk(item) {
15506
+ if (item.type === "result") {
15507
+ return { type: "result", content: item.result || "" };
15508
+ }
15509
+ if (item.type === "stream_event" && item.event) {
15510
+ return this.handleEventToChunk(item.event);
15511
+ }
15512
+ return null;
15513
+ }
15514
+ handleEventToChunk(event) {
15515
+ const { type, delta, content_block, index } = event;
15516
+ if (type === "content_block_delta" && delta?.type === "text_delta") {
15517
+ return { type: "text_delta", content: delta.text || "" };
15518
+ }
15519
+ if (type === "content_block_delta" && delta?.type === "input_json_delta" && delta.partial_json !== undefined && index !== undefined) {
15520
+ const activeTool = this.activeTools.get(index);
15521
+ if (activeTool) {
15522
+ activeTool.parameterJson += delta.partial_json;
15523
+ }
15524
+ return null;
15525
+ }
15526
+ if (type === "content_block_start" && content_block) {
15527
+ if (content_block.type === "tool_use" && content_block.name) {
15528
+ if (index !== undefined) {
15529
+ this.activeTools.set(index, {
15530
+ name: content_block.name,
15531
+ id: content_block.id,
15532
+ index,
15533
+ parameterJson: "",
15534
+ startTime: Date.now()
15535
+ });
15536
+ }
15537
+ return {
15538
+ type: "tool_use",
15539
+ tool: content_block.name,
15540
+ id: content_block.id
15541
+ };
15542
+ }
15543
+ if (content_block.type === "thinking") {
15544
+ return { type: "thinking" };
15545
+ }
15546
+ }
15547
+ if (type === "content_block_stop" && index !== undefined) {
15548
+ const activeTool = this.activeTools.get(index);
15549
+ if (activeTool?.parameterJson) {
15550
+ try {
15551
+ const parameters = JSON.parse(activeTool.parameterJson);
15552
+ return {
15553
+ type: "tool_parameters",
15554
+ tool: activeTool.name,
15555
+ id: activeTool.id,
15556
+ parameters
15557
+ };
15558
+ } catch {}
15559
+ }
15560
+ return null;
15561
+ }
15562
+ return null;
15563
+ }
15564
+ processItem(item, log) {
15565
+ if (item.type === "result") {
15566
+ return item.result || "";
15567
+ }
15568
+ if (item.type === "stream_event" && item.event) {
15569
+ this.handleEvent(item.event, log);
15570
+ }
15571
+ return null;
15572
+ }
15573
+ handleEvent(event, log) {
15574
+ const { type, content_block } = event;
15575
+ if (type === "content_block_start" && content_block) {
15576
+ if (content_block.type === "tool_use" && content_block.name) {
15577
+ log?.(`
15578
+ ${c.primary("[Claude]")} ${c.bold(`Running ${content_block.name}...`)}
15579
+ `, "info");
15580
+ }
15581
+ }
15582
+ }
15583
+ }
15584
+ var init_claude_stream_parser = __esm(() => {
15585
+ init_colors();
15586
+ });
15587
+
15563
15588
  // ../sdk/src/ai/claude-runner.ts
15564
15589
  import { spawn } from "node:child_process";
15565
15590
  import { resolve } from "node:path";
@@ -15570,7 +15595,6 @@ class ClaudeRunner {
15570
15595
  projectPath;
15571
15596
  eventEmitter;
15572
15597
  currentToolName;
15573
- activeTools = new Map;
15574
15598
  activeProcess = null;
15575
15599
  aborted = false;
15576
15600
  timeoutMs;
@@ -15605,7 +15629,7 @@ class ClaudeRunner {
15605
15629
  }
15606
15630
  if (!isLastAttempt) {
15607
15631
  const delay = Math.pow(2, attempt) * 1000;
15608
- console.warn(`Claude CLI attempt ${attempt} failed: ${err.message}. Retrying in ${delay}ms...`);
15632
+ this.log?.(`Claude CLI attempt ${attempt} failed: ${err.message}. Retrying in ${delay}ms...`, "warn");
15609
15633
  await new Promise((resolve2) => setTimeout(resolve2, delay));
15610
15634
  }
15611
15635
  }
@@ -15645,6 +15669,7 @@ class ClaudeRunner {
15645
15669
  }
15646
15670
  async* runStream(prompt) {
15647
15671
  this.aborted = false;
15672
+ const parser = new ClaudeStreamParser;
15648
15673
  const args = this.buildCliArgs();
15649
15674
  const env = getAugmentedEnv({
15650
15675
  FORCE_COLOR: "1",
@@ -15705,7 +15730,7 @@ class ClaudeRunner {
15705
15730
  `);
15706
15731
  buffer = lines.pop() || "";
15707
15732
  for (const line of lines) {
15708
- const chunk = this.parseStreamLineToChunk(line);
15733
+ const chunk = parser.parseLineToChunk(line);
15709
15734
  if (chunk) {
15710
15735
  if (chunk.type === "result") {
15711
15736
  lastResultContent = chunk.content;
@@ -15814,77 +15839,9 @@ class ClaudeRunner {
15814
15839
  break;
15815
15840
  }
15816
15841
  }
15817
- parseStreamLineToChunk(line) {
15818
- if (!line.trim())
15819
- return null;
15820
- try {
15821
- const item = JSON.parse(line);
15822
- return this.processStreamItemToChunk(item);
15823
- } catch {
15824
- return null;
15825
- }
15826
- }
15827
- processStreamItemToChunk(item) {
15828
- if (item.type === "result") {
15829
- return { type: "result", content: item.result || "" };
15830
- }
15831
- if (item.type === "stream_event" && item.event) {
15832
- return this.handleEventToChunk(item.event);
15833
- }
15834
- return null;
15835
- }
15836
- handleEventToChunk(event) {
15837
- const { type, delta, content_block, index } = event;
15838
- if (type === "content_block_delta" && delta?.type === "text_delta") {
15839
- return { type: "text_delta", content: delta.text || "" };
15840
- }
15841
- if (type === "content_block_delta" && delta?.type === "input_json_delta" && delta.partial_json !== undefined && index !== undefined) {
15842
- const activeTool = this.activeTools.get(index);
15843
- if (activeTool) {
15844
- activeTool.parameterJson += delta.partial_json;
15845
- }
15846
- return null;
15847
- }
15848
- if (type === "content_block_start" && content_block) {
15849
- if (content_block.type === "tool_use" && content_block.name) {
15850
- if (index !== undefined) {
15851
- this.activeTools.set(index, {
15852
- name: content_block.name,
15853
- id: content_block.id,
15854
- index,
15855
- parameterJson: "",
15856
- startTime: Date.now()
15857
- });
15858
- }
15859
- return {
15860
- type: "tool_use",
15861
- tool: content_block.name,
15862
- id: content_block.id
15863
- };
15864
- }
15865
- if (content_block.type === "thinking") {
15866
- return { type: "thinking" };
15867
- }
15868
- }
15869
- if (type === "content_block_stop" && index !== undefined) {
15870
- const activeTool = this.activeTools.get(index);
15871
- if (activeTool?.parameterJson) {
15872
- try {
15873
- const parameters = JSON.parse(activeTool.parameterJson);
15874
- return {
15875
- type: "tool_parameters",
15876
- tool: activeTool.name,
15877
- id: activeTool.id,
15878
- parameters
15879
- };
15880
- } catch {}
15881
- }
15882
- return null;
15883
- }
15884
- return null;
15885
- }
15886
15842
  executeRun(prompt) {
15887
15843
  this.aborted = false;
15844
+ const parser = new ClaudeStreamParser;
15888
15845
  return new Promise((resolve2, reject) => {
15889
15846
  const args = this.buildCliArgs();
15890
15847
  const env = getAugmentedEnv({
@@ -15907,7 +15864,7 @@ class ClaudeRunner {
15907
15864
  `);
15908
15865
  buffer = lines.pop() || "";
15909
15866
  for (const line of lines) {
15910
- const result = this.handleStreamLine(line);
15867
+ const result = parser.parseLine(line, this.log);
15911
15868
  if (result)
15912
15869
  finalResult = result;
15913
15870
  }
@@ -15948,35 +15905,6 @@ class ClaudeRunner {
15948
15905
  claude.stdin.end();
15949
15906
  });
15950
15907
  }
15951
- handleStreamLine(line) {
15952
- if (!line.trim())
15953
- return null;
15954
- try {
15955
- const item = JSON.parse(line);
15956
- return this.processStreamItem(item);
15957
- } catch {
15958
- return null;
15959
- }
15960
- }
15961
- processStreamItem(item) {
15962
- if (item.type === "result") {
15963
- return item.result || "";
15964
- }
15965
- if (item.type === "stream_event" && item.event) {
15966
- this.handleEvent(item.event);
15967
- }
15968
- return null;
15969
- }
15970
- handleEvent(event) {
15971
- const { type, content_block } = event;
15972
- if (type === "content_block_start" && content_block) {
15973
- if (content_block.type === "tool_use" && content_block.name) {
15974
- this.log?.(`
15975
- ${c.primary("[Claude]")} ${c.bold(`Running ${content_block.name}...`)}
15976
- `, "info");
15977
- }
15978
- }
15979
- }
15980
15908
  shouldSuppressLine(line) {
15981
15909
  const infoLogRegex = /^\[\d{2}:\d{2}:\d{2}\]\s\[.*?\]\sℹ\s*$/;
15982
15910
  return infoLogRegex.test(line.trim());
@@ -15990,8 +15918,8 @@ ${c.primary("[Claude]")} ${c.bold(`Running ${content_block.name}...`)}
15990
15918
  var DEFAULT_TIMEOUT_MS;
15991
15919
  var init_claude_runner = __esm(() => {
15992
15920
  init_config();
15993
- init_colors();
15994
15921
  init_resolve_bin();
15922
+ init_claude_stream_parser();
15995
15923
  DEFAULT_TIMEOUT_MS = 60 * 60 * 1000;
15996
15924
  });
15997
15925
 
@@ -16043,7 +15971,7 @@ class CodexRunner {
16043
15971
  }
16044
15972
  if (attempt < maxRetries) {
16045
15973
  const delay = Math.pow(2, attempt) * 1000;
16046
- console.warn(`Codex CLI attempt ${attempt} failed: ${lastError.message}. Retrying in ${delay}ms...`);
15974
+ this.log?.(`Codex CLI attempt ${attempt} failed: ${lastError.message}. Retrying in ${delay}ms...`, "warn");
16047
15975
  await this.sleep(delay);
16048
15976
  }
16049
15977
  }
@@ -16335,6 +16263,20 @@ var init_codex_runner = __esm(() => {
16335
16263
  });
16336
16264
 
16337
16265
  // ../sdk/src/ai/factory.ts
16266
+ function createWorkerLogger(agentId, prefix) {
16267
+ const tag = prefix ? `${prefix}:${agentId.slice(-8)}` : agentId.slice(-8);
16268
+ return (message, level = "info") => {
16269
+ const timestamp = new Date().toISOString().split("T")[1]?.slice(0, 8) ?? "";
16270
+ const colorFn = {
16271
+ info: c.cyan,
16272
+ success: c.green,
16273
+ warn: c.yellow,
16274
+ error: c.red
16275
+ }[level];
16276
+ const icon = { info: "ℹ", success: "✓", warn: "⚠", error: "✗" }[level];
16277
+ console.log(`${c.dim(`[${timestamp}]`)} ${c.bold(`[${tag}]`)} ${colorFn(`${icon} ${message}`)}`);
16278
+ };
16279
+ }
16338
16280
  function createAiRunner(provider, config2) {
16339
16281
  const resolvedProvider = provider ?? PROVIDER.CLAUDE;
16340
16282
  const model = config2.model ?? DEFAULT_MODEL[resolvedProvider];
@@ -16351,6 +16293,7 @@ function createAiRunner(provider, config2) {
16351
16293
  }
16352
16294
  var init_factory = __esm(() => {
16353
16295
  init_config();
16296
+ init_colors();
16354
16297
  init_claude_runner();
16355
16298
  init_codex_runner();
16356
16299
  });
@@ -31554,49 +31497,6 @@ var init_docs = __esm(() => {
31554
31497
  };
31555
31498
  });
31556
31499
 
31557
- // ../sdk/src/modules/instances.ts
31558
- var InstancesModule;
31559
- var init_instances = __esm(() => {
31560
- InstancesModule = class InstancesModule extends BaseModule {
31561
- async list(workspaceId) {
31562
- const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-instances`);
31563
- return data.instances;
31564
- }
31565
- async get(workspaceId, instanceId) {
31566
- const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-instances/${instanceId}`);
31567
- return data.instance;
31568
- }
31569
- async provision(workspaceId, body) {
31570
- const { data } = await this.api.post(`/workspaces/${workspaceId}/aws-instances`, body);
31571
- return data.instance;
31572
- }
31573
- async performAction(workspaceId, instanceId, action) {
31574
- const { data } = await this.api.post(`/workspaces/${workspaceId}/aws-instances/${instanceId}/actions`, { action });
31575
- return data.instance;
31576
- }
31577
- async sync(workspaceId, instanceId) {
31578
- const { data } = await this.api.post(`/workspaces/${workspaceId}/aws-instances/${instanceId}/sync`);
31579
- return data.instance;
31580
- }
31581
- async checkUpdates(workspaceId, instanceId) {
31582
- const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-instances/${instanceId}/updates`);
31583
- return data.update;
31584
- }
31585
- async applyUpdate(workspaceId, instanceId) {
31586
- const { data } = await this.api.post(`/workspaces/${workspaceId}/aws-instances/${instanceId}/updates`);
31587
- return data.update;
31588
- }
31589
- async getSecurity(workspaceId, instanceId) {
31590
- const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-instances/${instanceId}/security`);
31591
- return data.rules;
31592
- }
31593
- async updateSecurity(workspaceId, instanceId, body) {
31594
- const { data } = await this.api.put(`/workspaces/${workspaceId}/aws-instances/${instanceId}/security`, body);
31595
- return data.rules;
31596
- }
31597
- };
31598
- });
31599
-
31600
31500
  // ../sdk/src/modules/invitations.ts
31601
31501
  var InvitationsModule;
31602
31502
  var init_invitations = __esm(() => {
@@ -31829,17 +31729,6 @@ var init_workspaces = __esm(() => {
31829
31729
  async deleteApiKey(workspaceId, keyId) {
31830
31730
  await this.api.delete(`/workspaces/${workspaceId}/api-keys/${keyId}`);
31831
31731
  }
31832
- async getAwsCredentials(workspaceId) {
31833
- const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-credentials`);
31834
- return data.credential;
31835
- }
31836
- async saveAwsCredentials(workspaceId, body) {
31837
- const { data } = await this.api.put(`/workspaces/${workspaceId}/aws-credentials`, body);
31838
- return data.credential;
31839
- }
31840
- async deleteAwsCredentials(workspaceId) {
31841
- await this.api.delete(`/workspaces/${workspaceId}/aws-credentials`);
31842
- }
31843
31732
  };
31844
31733
  });
31845
31734
 
@@ -31888,7 +31777,6 @@ class LocusClient {
31888
31777
  invitations;
31889
31778
  docs;
31890
31779
  ci;
31891
- instances;
31892
31780
  constructor(config2) {
31893
31781
  this.emitter = new LocusEmitter;
31894
31782
  this.api = axios_default.create({
@@ -31908,7 +31796,6 @@ class LocusClient {
31908
31796
  this.invitations = new InvitationsModule(this.api, this.emitter);
31909
31797
  this.docs = new DocsModule(this.api, this.emitter);
31910
31798
  this.ci = new CiModule(this.api, this.emitter);
31911
- this.instances = new InstancesModule(this.api, this.emitter);
31912
31799
  if (config2.retryOptions) {
31913
31800
  this.setupRetryInterceptor(config2.retryOptions);
31914
31801
  }
@@ -31974,7 +31861,6 @@ var init_src2 = __esm(() => {
31974
31861
  init_auth2();
31975
31862
  init_ci2();
31976
31863
  init_docs();
31977
- init_instances();
31978
31864
  init_invitations();
31979
31865
  init_organizations();
31980
31866
  init_sprints();
@@ -31985,7 +31871,6 @@ var init_src2 = __esm(() => {
31985
31871
  init_auth2();
31986
31872
  init_ci2();
31987
31873
  init_docs();
31988
- init_instances();
31989
31874
  init_invitations();
31990
31875
  init_organizations();
31991
31876
  init_sprints();
@@ -32826,9 +32711,11 @@ class AgentWorker {
32826
32711
  currentTaskId = null;
32827
32712
  completedTaskList = [];
32828
32713
  taskSummaries = [];
32714
+ log;
32829
32715
  constructor(config2) {
32830
32716
  this.config = config2;
32831
32717
  const projectPath = config2.projectPath || process.cwd();
32718
+ this.log = createWorkerLogger(config2.agentId);
32832
32719
  this.client = new LocusClient({
32833
32720
  baseUrl: config2.apiBase,
32834
32721
  token: config2.apiKey,
@@ -32839,7 +32726,6 @@ class AgentWorker {
32839
32726
  factor: 2
32840
32727
  }
32841
32728
  });
32842
- const log = this.log.bind(this);
32843
32729
  if (!isGitAvailable()) {
32844
32730
  this.log("git is not installed — branch management will not work", "error");
32845
32731
  }
@@ -32850,29 +32736,18 @@ class AgentWorker {
32850
32736
  this.aiRunner = createAiRunner(provider, {
32851
32737
  projectPath,
32852
32738
  model: config2.model,
32853
- log,
32739
+ log: this.log,
32854
32740
  reasoningEffort: config2.reasoningEffort
32855
32741
  });
32856
32742
  this.taskExecutor = new TaskExecutor({
32857
32743
  aiRunner: this.aiRunner,
32858
32744
  projectPath,
32859
- log
32745
+ log: this.log
32860
32746
  });
32861
- this.gitWorkflow = new GitWorkflow(config2, log);
32747
+ this.gitWorkflow = new GitWorkflow(config2, this.log);
32862
32748
  const providerLabel = provider === "codex" ? "Codex" : "Claude";
32863
32749
  this.log(`Using ${providerLabel} CLI for all phases`, "info");
32864
32750
  }
32865
- log(message, level = "info") {
32866
- const timestamp = new Date().toISOString().split("T")[1]?.slice(0, 8) ?? "";
32867
- const colorFn = {
32868
- info: c.cyan,
32869
- success: c.green,
32870
- warn: c.yellow,
32871
- error: c.red
32872
- }[level];
32873
- const prefix = { info: "ℹ", success: "✓", warn: "⚠", error: "✗" }[level];
32874
- console.log(`${c.dim(`[${timestamp}]`)} ${c.bold(`[${this.config.agentId.slice(-8)}]`)} ${colorFn(`${prefix} ${message}`)}`);
32875
- }
32876
32751
  async getActiveSprint() {
32877
32752
  try {
32878
32753
  if (this.config.sprintId) {
@@ -33049,7 +32924,6 @@ var init_worker = __esm(() => {
33049
32924
  init_config();
33050
32925
  init_git_utils();
33051
32926
  init_src2();
33052
- init_colors();
33053
32927
  init_git_workflow();
33054
32928
  init_task_executor();
33055
32929
  workerEntrypoint = process.argv[1]?.split(/[\\/]/).pop();