@locusai/cli 0.15.5 → 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 -359
  2. package/bin/locus.js +865 -1658
  3. package/package.json +4 -4
@@ -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,102 +14333,6 @@ var init_auth = __esm(() => {
14343
14333
  });
14344
14334
  });
14345
14335
 
14346
- // ../shared/src/models/autonomy.ts
14347
- var RiskLevel, ChangeCategory, AutonomyRuleSchema;
14348
- var init_autonomy = __esm(() => {
14349
- init_zod();
14350
- ((RiskLevel2) => {
14351
- RiskLevel2["LOW"] = "LOW";
14352
- RiskLevel2["HIGH"] = "HIGH";
14353
- })(RiskLevel ||= {});
14354
- ((ChangeCategory2) => {
14355
- ChangeCategory2["FIX"] = "FIX";
14356
- ChangeCategory2["REFACTOR"] = "REFACTOR";
14357
- ChangeCategory2["STYLE"] = "STYLE";
14358
- ChangeCategory2["DEPENDENCY"] = "DEPENDENCY";
14359
- ChangeCategory2["FEATURE"] = "FEATURE";
14360
- ChangeCategory2["ARCHITECTURE"] = "ARCHITECTURE";
14361
- ChangeCategory2["DATABASE"] = "DATABASE";
14362
- ChangeCategory2["AUTH"] = "AUTH";
14363
- ChangeCategory2["API"] = "API";
14364
- })(ChangeCategory ||= {});
14365
- AutonomyRuleSchema = exports_external.object({
14366
- category: exports_external.enum(ChangeCategory),
14367
- riskLevel: exports_external.enum(RiskLevel),
14368
- autoExecute: exports_external.boolean()
14369
- });
14370
- });
14371
-
14372
- // ../shared/src/models/aws-instance.ts
14373
- var InstanceAction, AwsCredentialsSchema, IntegrationSchema, AwsInstanceSchema, CreateAwsInstanceSchema, UpdateAwsInstanceSchema, SaveAwsCredentialsSchema, ProvisionAwsInstanceSchema, InstanceActionBodySchema, InstanceIdParamSchema, CIDR_REGEX, UpdateSecurityRulesSchema;
14374
- var init_aws_instance = __esm(() => {
14375
- init_zod();
14376
- init_common();
14377
- init_enums();
14378
- ((InstanceAction2) => {
14379
- InstanceAction2["START"] = "START";
14380
- InstanceAction2["STOP"] = "STOP";
14381
- InstanceAction2["TERMINATE"] = "TERMINATE";
14382
- })(InstanceAction ||= {});
14383
- AwsCredentialsSchema = exports_external.object({
14384
- accessKeyId: exports_external.string().min(1),
14385
- secretAccessKey: exports_external.string().min(1),
14386
- region: exports_external.enum(AwsRegion).default("us-east-1" /* US_EAST_1 */)
14387
- });
14388
- IntegrationSchema = exports_external.object({
14389
- name: exports_external.string(),
14390
- config: exports_external.record(exports_external.string(), exports_external.string())
14391
- });
14392
- AwsInstanceSchema = BaseEntitySchema.extend({
14393
- workspaceId: exports_external.uuid(),
14394
- instanceId: exports_external.string(),
14395
- status: exports_external.enum(InstanceStatus),
14396
- instanceType: exports_external.enum(["t3.micro", "t3.small", "t3.medium"]),
14397
- region: exports_external.enum(AwsRegion).default("us-east-1" /* US_EAST_1 */),
14398
- publicIp: exports_external.string().nullable().optional(),
14399
- launchTime: exports_external.union([exports_external.date(), exports_external.number()]).nullable().optional(),
14400
- repoUrl: exports_external.string().nullable().optional(),
14401
- integrations: exports_external.array(IntegrationSchema).default([])
14402
- });
14403
- CreateAwsInstanceSchema = exports_external.object({
14404
- workspaceId: exports_external.uuid(),
14405
- instanceType: exports_external.enum(["t3.micro", "t3.small", "t3.medium"]).default("t3.micro"),
14406
- region: exports_external.enum(AwsRegion).default("us-east-1" /* US_EAST_1 */),
14407
- repoUrl: exports_external.string().optional(),
14408
- integrations: exports_external.array(IntegrationSchema).optional().default([])
14409
- });
14410
- UpdateAwsInstanceSchema = exports_external.object({
14411
- status: exports_external.enum(InstanceStatus).optional(),
14412
- instanceType: exports_external.enum(["t3.micro", "t3.small", "t3.medium"]).optional(),
14413
- publicIp: exports_external.string().nullable().optional(),
14414
- launchTime: exports_external.union([exports_external.date(), exports_external.number()]).nullable().optional(),
14415
- repoUrl: exports_external.string().nullable().optional(),
14416
- integrations: exports_external.array(IntegrationSchema).optional()
14417
- });
14418
- SaveAwsCredentialsSchema = exports_external.object({
14419
- accessKeyId: exports_external.string().min(16),
14420
- secretAccessKey: exports_external.string().min(1),
14421
- region: exports_external.string().default("us-east-1")
14422
- });
14423
- ProvisionAwsInstanceSchema = exports_external.object({
14424
- repoUrl: exports_external.string().min(1),
14425
- githubToken: exports_external.string().min(1),
14426
- instanceType: exports_external.enum(["t3.micro", "t3.small", "t3.medium"]).default("t3.small"),
14427
- integrations: exports_external.array(IntegrationSchema).optional().default([])
14428
- });
14429
- InstanceActionBodySchema = exports_external.object({
14430
- action: exports_external.nativeEnum(InstanceAction)
14431
- });
14432
- InstanceIdParamSchema = exports_external.object({
14433
- workspaceId: exports_external.string().uuid("Invalid Workspace ID"),
14434
- instanceId: exports_external.string().uuid("Invalid Instance ID")
14435
- });
14436
- CIDR_REGEX = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,2}$/;
14437
- UpdateSecurityRulesSchema = exports_external.object({
14438
- allowedIps: exports_external.array(exports_external.string().regex(CIDR_REGEX, "Invalid CIDR format (e.g. 1.2.3.4/32)"))
14439
- });
14440
- });
14441
-
14442
14336
  // ../shared/src/models/ci.ts
14443
14337
  var RecordCiSchema;
14444
14338
  var init_ci = __esm(() => {
@@ -14687,49 +14581,6 @@ var init_sprint = __esm(() => {
14687
14581
  });
14688
14582
  });
14689
14583
 
14690
- // ../shared/src/models/suggestion.ts
14691
- var SuggestionStatus, SuggestionType, SuggestionSchema, CreateSuggestionSchema, UpdateSuggestionStatusSchema;
14692
- var init_suggestion = __esm(() => {
14693
- init_zod();
14694
- ((SuggestionStatus2) => {
14695
- SuggestionStatus2["NEW"] = "NEW";
14696
- SuggestionStatus2["NOTIFIED"] = "NOTIFIED";
14697
- SuggestionStatus2["ACTED_ON"] = "ACTED_ON";
14698
- SuggestionStatus2["SKIPPED"] = "SKIPPED";
14699
- SuggestionStatus2["EXPIRED"] = "EXPIRED";
14700
- })(SuggestionStatus ||= {});
14701
- ((SuggestionType2) => {
14702
- SuggestionType2["CODE_FIX"] = "CODE_FIX";
14703
- SuggestionType2["DEPENDENCY_UPDATE"] = "DEPENDENCY_UPDATE";
14704
- SuggestionType2["NEXT_STEP"] = "NEXT_STEP";
14705
- SuggestionType2["REFACTOR"] = "REFACTOR";
14706
- SuggestionType2["TEST_FIX"] = "TEST_FIX";
14707
- })(SuggestionType ||= {});
14708
- SuggestionSchema = exports_external.object({
14709
- id: exports_external.string(),
14710
- type: exports_external.enum(SuggestionType),
14711
- status: exports_external.enum(SuggestionStatus),
14712
- title: exports_external.string(),
14713
- description: exports_external.string(),
14714
- jobRunId: exports_external.string().optional(),
14715
- workspaceId: exports_external.string(),
14716
- createdAt: exports_external.string(),
14717
- expiresAt: exports_external.string(),
14718
- metadata: exports_external.record(exports_external.string(), exports_external.any()).optional()
14719
- });
14720
- CreateSuggestionSchema = exports_external.object({
14721
- type: exports_external.enum(SuggestionType),
14722
- title: exports_external.string().min(1, "Title is required"),
14723
- description: exports_external.string().min(1, "Description is required"),
14724
- jobRunId: exports_external.string().uuid().optional(),
14725
- metadata: exports_external.record(exports_external.string(), exports_external.any()).optional(),
14726
- expiresAt: exports_external.string().optional()
14727
- });
14728
- UpdateSuggestionStatusSchema = exports_external.object({
14729
- status: exports_external.enum(SuggestionStatus)
14730
- });
14731
- });
14732
-
14733
14584
  // ../shared/src/models/task.ts
14734
14585
  var AcceptanceItemSchema, TaskSchema, CreateTaskSchema, UpdateTaskSchema, AddCommentSchema, DispatchTaskSchema, TaskIdParamSchema, TaskQuerySchema, TaskResponseSchema, TasksResponseSchema;
14735
14586
  var init_task = __esm(() => {
@@ -14869,15 +14720,12 @@ var init_models = __esm(() => {
14869
14720
  init_activity();
14870
14721
  init_agent();
14871
14722
  init_auth();
14872
- init_autonomy();
14873
- init_aws_instance();
14874
14723
  init_ci();
14875
14724
  init_doc();
14876
14725
  init_doc_group();
14877
14726
  init_invitation();
14878
14727
  init_organization();
14879
14728
  init_sprint();
14880
- init_suggestion();
14881
14729
  init_task();
14882
14730
  init_user();
14883
14731
  init_workspace();
@@ -15621,7 +15469,6 @@ var init_resolve_bin = __esm(() => {
15621
15469
  join2(homedir(), ".local", "bin"),
15622
15470
  join2(homedir(), ".npm", "bin"),
15623
15471
  join2(homedir(), ".npm-global", "bin"),
15624
- join2(homedir(), ".npm-packages", "bin"),
15625
15472
  join2(homedir(), ".yarn", "bin"),
15626
15473
  join2(homedir(), ".bun", "bin"),
15627
15474
  join2(homedir(), "Library", "pnpm"),
@@ -15632,6 +15479,112 @@ var init_resolve_bin = __esm(() => {
15632
15479
  ENV_VARS_TO_STRIP = ["ANTHROPIC_API_KEY", "OPENAI_API_KEY"];
15633
15480
  });
15634
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
+
15635
15588
  // ../sdk/src/ai/claude-runner.ts
15636
15589
  import { spawn } from "node:child_process";
15637
15590
  import { resolve } from "node:path";
@@ -15642,7 +15595,6 @@ class ClaudeRunner {
15642
15595
  projectPath;
15643
15596
  eventEmitter;
15644
15597
  currentToolName;
15645
- activeTools = new Map;
15646
15598
  activeProcess = null;
15647
15599
  aborted = false;
15648
15600
  timeoutMs;
@@ -15677,7 +15629,7 @@ class ClaudeRunner {
15677
15629
  }
15678
15630
  if (!isLastAttempt) {
15679
15631
  const delay = Math.pow(2, attempt) * 1000;
15680
- 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");
15681
15633
  await new Promise((resolve2) => setTimeout(resolve2, delay));
15682
15634
  }
15683
15635
  }
@@ -15717,6 +15669,7 @@ class ClaudeRunner {
15717
15669
  }
15718
15670
  async* runStream(prompt) {
15719
15671
  this.aborted = false;
15672
+ const parser = new ClaudeStreamParser;
15720
15673
  const args = this.buildCliArgs();
15721
15674
  const env = getAugmentedEnv({
15722
15675
  FORCE_COLOR: "1",
@@ -15777,7 +15730,7 @@ class ClaudeRunner {
15777
15730
  `);
15778
15731
  buffer = lines.pop() || "";
15779
15732
  for (const line of lines) {
15780
- const chunk = this.parseStreamLineToChunk(line);
15733
+ const chunk = parser.parseLineToChunk(line);
15781
15734
  if (chunk) {
15782
15735
  if (chunk.type === "result") {
15783
15736
  lastResultContent = chunk.content;
@@ -15886,77 +15839,9 @@ class ClaudeRunner {
15886
15839
  break;
15887
15840
  }
15888
15841
  }
15889
- parseStreamLineToChunk(line) {
15890
- if (!line.trim())
15891
- return null;
15892
- try {
15893
- const item = JSON.parse(line);
15894
- return this.processStreamItemToChunk(item);
15895
- } catch {
15896
- return null;
15897
- }
15898
- }
15899
- processStreamItemToChunk(item) {
15900
- if (item.type === "result") {
15901
- return { type: "result", content: item.result || "" };
15902
- }
15903
- if (item.type === "stream_event" && item.event) {
15904
- return this.handleEventToChunk(item.event);
15905
- }
15906
- return null;
15907
- }
15908
- handleEventToChunk(event) {
15909
- const { type, delta, content_block, index } = event;
15910
- if (type === "content_block_delta" && delta?.type === "text_delta") {
15911
- return { type: "text_delta", content: delta.text || "" };
15912
- }
15913
- if (type === "content_block_delta" && delta?.type === "input_json_delta" && delta.partial_json !== undefined && index !== undefined) {
15914
- const activeTool = this.activeTools.get(index);
15915
- if (activeTool) {
15916
- activeTool.parameterJson += delta.partial_json;
15917
- }
15918
- return null;
15919
- }
15920
- if (type === "content_block_start" && content_block) {
15921
- if (content_block.type === "tool_use" && content_block.name) {
15922
- if (index !== undefined) {
15923
- this.activeTools.set(index, {
15924
- name: content_block.name,
15925
- id: content_block.id,
15926
- index,
15927
- parameterJson: "",
15928
- startTime: Date.now()
15929
- });
15930
- }
15931
- return {
15932
- type: "tool_use",
15933
- tool: content_block.name,
15934
- id: content_block.id
15935
- };
15936
- }
15937
- if (content_block.type === "thinking") {
15938
- return { type: "thinking" };
15939
- }
15940
- }
15941
- if (type === "content_block_stop" && index !== undefined) {
15942
- const activeTool = this.activeTools.get(index);
15943
- if (activeTool?.parameterJson) {
15944
- try {
15945
- const parameters = JSON.parse(activeTool.parameterJson);
15946
- return {
15947
- type: "tool_parameters",
15948
- tool: activeTool.name,
15949
- id: activeTool.id,
15950
- parameters
15951
- };
15952
- } catch {}
15953
- }
15954
- return null;
15955
- }
15956
- return null;
15957
- }
15958
15842
  executeRun(prompt) {
15959
15843
  this.aborted = false;
15844
+ const parser = new ClaudeStreamParser;
15960
15845
  return new Promise((resolve2, reject) => {
15961
15846
  const args = this.buildCliArgs();
15962
15847
  const env = getAugmentedEnv({
@@ -15979,7 +15864,7 @@ class ClaudeRunner {
15979
15864
  `);
15980
15865
  buffer = lines.pop() || "";
15981
15866
  for (const line of lines) {
15982
- const result = this.handleStreamLine(line);
15867
+ const result = parser.parseLine(line, this.log);
15983
15868
  if (result)
15984
15869
  finalResult = result;
15985
15870
  }
@@ -16020,35 +15905,6 @@ class ClaudeRunner {
16020
15905
  claude.stdin.end();
16021
15906
  });
16022
15907
  }
16023
- handleStreamLine(line) {
16024
- if (!line.trim())
16025
- return null;
16026
- try {
16027
- const item = JSON.parse(line);
16028
- return this.processStreamItem(item);
16029
- } catch {
16030
- return null;
16031
- }
16032
- }
16033
- processStreamItem(item) {
16034
- if (item.type === "result") {
16035
- return item.result || "";
16036
- }
16037
- if (item.type === "stream_event" && item.event) {
16038
- this.handleEvent(item.event);
16039
- }
16040
- return null;
16041
- }
16042
- handleEvent(event) {
16043
- const { type, content_block } = event;
16044
- if (type === "content_block_start" && content_block) {
16045
- if (content_block.type === "tool_use" && content_block.name) {
16046
- this.log?.(`
16047
- ${c.primary("[Claude]")} ${c.bold(`Running ${content_block.name}...`)}
16048
- `, "info");
16049
- }
16050
- }
16051
- }
16052
15908
  shouldSuppressLine(line) {
16053
15909
  const infoLogRegex = /^\[\d{2}:\d{2}:\d{2}\]\s\[.*?\]\sℹ\s*$/;
16054
15910
  return infoLogRegex.test(line.trim());
@@ -16062,8 +15918,8 @@ ${c.primary("[Claude]")} ${c.bold(`Running ${content_block.name}...`)}
16062
15918
  var DEFAULT_TIMEOUT_MS;
16063
15919
  var init_claude_runner = __esm(() => {
16064
15920
  init_config();
16065
- init_colors();
16066
15921
  init_resolve_bin();
15922
+ init_claude_stream_parser();
16067
15923
  DEFAULT_TIMEOUT_MS = 60 * 60 * 1000;
16068
15924
  });
16069
15925
 
@@ -16115,7 +15971,7 @@ class CodexRunner {
16115
15971
  }
16116
15972
  if (attempt < maxRetries) {
16117
15973
  const delay = Math.pow(2, attempt) * 1000;
16118
- 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");
16119
15975
  await this.sleep(delay);
16120
15976
  }
16121
15977
  }
@@ -16407,6 +16263,20 @@ var init_codex_runner = __esm(() => {
16407
16263
  });
16408
16264
 
16409
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
+ }
16410
16280
  function createAiRunner(provider, config2) {
16411
16281
  const resolvedProvider = provider ?? PROVIDER.CLAUDE;
16412
16282
  const model = config2.model ?? DEFAULT_MODEL[resolvedProvider];
@@ -16423,6 +16293,7 @@ function createAiRunner(provider, config2) {
16423
16293
  }
16424
16294
  var init_factory = __esm(() => {
16425
16295
  init_config();
16296
+ init_colors();
16426
16297
  init_claude_runner();
16427
16298
  init_codex_runner();
16428
16299
  });
@@ -31626,49 +31497,6 @@ var init_docs = __esm(() => {
31626
31497
  };
31627
31498
  });
31628
31499
 
31629
- // ../sdk/src/modules/instances.ts
31630
- var InstancesModule;
31631
- var init_instances = __esm(() => {
31632
- InstancesModule = class InstancesModule extends BaseModule {
31633
- async list(workspaceId) {
31634
- const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-instances`);
31635
- return data.instances;
31636
- }
31637
- async get(workspaceId, instanceId) {
31638
- const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-instances/${instanceId}`);
31639
- return data.instance;
31640
- }
31641
- async provision(workspaceId, body) {
31642
- const { data } = await this.api.post(`/workspaces/${workspaceId}/aws-instances`, body);
31643
- return data.instance;
31644
- }
31645
- async performAction(workspaceId, instanceId, action) {
31646
- const { data } = await this.api.post(`/workspaces/${workspaceId}/aws-instances/${instanceId}/actions`, { action });
31647
- return data.instance;
31648
- }
31649
- async sync(workspaceId, instanceId) {
31650
- const { data } = await this.api.post(`/workspaces/${workspaceId}/aws-instances/${instanceId}/sync`);
31651
- return data.instance;
31652
- }
31653
- async checkUpdates(workspaceId, instanceId) {
31654
- const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-instances/${instanceId}/updates`);
31655
- return data.update;
31656
- }
31657
- async applyUpdate(workspaceId, instanceId) {
31658
- const { data } = await this.api.post(`/workspaces/${workspaceId}/aws-instances/${instanceId}/updates`);
31659
- return data.update;
31660
- }
31661
- async getSecurity(workspaceId, instanceId) {
31662
- const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-instances/${instanceId}/security`);
31663
- return data.rules;
31664
- }
31665
- async updateSecurity(workspaceId, instanceId, body) {
31666
- const { data } = await this.api.put(`/workspaces/${workspaceId}/aws-instances/${instanceId}/security`, body);
31667
- return data.rules;
31668
- }
31669
- };
31670
- });
31671
-
31672
31500
  // ../sdk/src/modules/invitations.ts
31673
31501
  var InvitationsModule;
31674
31502
  var init_invitations = __esm(() => {
@@ -31777,29 +31605,6 @@ var init_sprints = __esm(() => {
31777
31605
  };
31778
31606
  });
31779
31607
 
31780
- // ../sdk/src/modules/suggestions.ts
31781
- var SuggestionsModule;
31782
- var init_suggestions = __esm(() => {
31783
- SuggestionsModule = class SuggestionsModule extends BaseModule {
31784
- async create(workspaceId, data) {
31785
- const { data: res } = await this.api.post(`/workspaces/${workspaceId}/suggestions`, data);
31786
- return res.suggestion;
31787
- }
31788
- async list(workspaceId, params) {
31789
- const { data } = await this.api.get(`/workspaces/${workspaceId}/suggestions`, { params });
31790
- return data.suggestions;
31791
- }
31792
- async get(workspaceId, id) {
31793
- const { data } = await this.api.get(`/workspaces/${workspaceId}/suggestions/${id}`);
31794
- return data.suggestion;
31795
- }
31796
- async updateStatus(workspaceId, id, status) {
31797
- const { data } = await this.api.patch(`/workspaces/${workspaceId}/suggestions/${id}/status`, status);
31798
- return data.suggestion;
31799
- }
31800
- };
31801
- });
31802
-
31803
31608
  // ../sdk/src/modules/tasks.ts
31804
31609
  var TasksModule;
31805
31610
  var init_tasks = __esm(() => {
@@ -31924,17 +31729,6 @@ var init_workspaces = __esm(() => {
31924
31729
  async deleteApiKey(workspaceId, keyId) {
31925
31730
  await this.api.delete(`/workspaces/${workspaceId}/api-keys/${keyId}`);
31926
31731
  }
31927
- async getAwsCredentials(workspaceId) {
31928
- const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-credentials`);
31929
- return data.credential;
31930
- }
31931
- async saveAwsCredentials(workspaceId, body) {
31932
- const { data } = await this.api.put(`/workspaces/${workspaceId}/aws-credentials`, body);
31933
- return data.credential;
31934
- }
31935
- async deleteAwsCredentials(workspaceId) {
31936
- await this.api.delete(`/workspaces/${workspaceId}/aws-credentials`);
31937
- }
31938
31732
  };
31939
31733
  });
31940
31734
 
@@ -31983,8 +31777,6 @@ class LocusClient {
31983
31777
  invitations;
31984
31778
  docs;
31985
31779
  ci;
31986
- instances;
31987
- suggestions;
31988
31780
  constructor(config2) {
31989
31781
  this.emitter = new LocusEmitter;
31990
31782
  this.api = axios_default.create({
@@ -32004,8 +31796,6 @@ class LocusClient {
32004
31796
  this.invitations = new InvitationsModule(this.api, this.emitter);
32005
31797
  this.docs = new DocsModule(this.api, this.emitter);
32006
31798
  this.ci = new CiModule(this.api, this.emitter);
32007
- this.instances = new InstancesModule(this.api, this.emitter);
32008
- this.suggestions = new SuggestionsModule(this.api, this.emitter);
32009
31799
  if (config2.retryOptions) {
32010
31800
  this.setupRetryInterceptor(config2.retryOptions);
32011
31801
  }
@@ -32071,11 +31861,9 @@ var init_src2 = __esm(() => {
32071
31861
  init_auth2();
32072
31862
  init_ci2();
32073
31863
  init_docs();
32074
- init_instances();
32075
31864
  init_invitations();
32076
31865
  init_organizations();
32077
31866
  init_sprints();
32078
- init_suggestions();
32079
31867
  init_tasks();
32080
31868
  init_workspaces();
32081
31869
  init_discussion_types();
@@ -32083,11 +31871,9 @@ var init_src2 = __esm(() => {
32083
31871
  init_auth2();
32084
31872
  init_ci2();
32085
31873
  init_docs();
32086
- init_instances();
32087
31874
  init_invitations();
32088
31875
  init_organizations();
32089
31876
  init_sprints();
32090
- init_suggestions();
32091
31877
  init_tasks();
32092
31878
  init_workspaces();
32093
31879
  });
@@ -32925,9 +32711,11 @@ class AgentWorker {
32925
32711
  currentTaskId = null;
32926
32712
  completedTaskList = [];
32927
32713
  taskSummaries = [];
32714
+ log;
32928
32715
  constructor(config2) {
32929
32716
  this.config = config2;
32930
32717
  const projectPath = config2.projectPath || process.cwd();
32718
+ this.log = createWorkerLogger(config2.agentId);
32931
32719
  this.client = new LocusClient({
32932
32720
  baseUrl: config2.apiBase,
32933
32721
  token: config2.apiKey,
@@ -32938,7 +32726,6 @@ class AgentWorker {
32938
32726
  factor: 2
32939
32727
  }
32940
32728
  });
32941
- const log = this.log.bind(this);
32942
32729
  if (!isGitAvailable()) {
32943
32730
  this.log("git is not installed — branch management will not work", "error");
32944
32731
  }
@@ -32949,29 +32736,18 @@ class AgentWorker {
32949
32736
  this.aiRunner = createAiRunner(provider, {
32950
32737
  projectPath,
32951
32738
  model: config2.model,
32952
- log,
32739
+ log: this.log,
32953
32740
  reasoningEffort: config2.reasoningEffort
32954
32741
  });
32955
32742
  this.taskExecutor = new TaskExecutor({
32956
32743
  aiRunner: this.aiRunner,
32957
32744
  projectPath,
32958
- log
32745
+ log: this.log
32959
32746
  });
32960
- this.gitWorkflow = new GitWorkflow(config2, log);
32747
+ this.gitWorkflow = new GitWorkflow(config2, this.log);
32961
32748
  const providerLabel = provider === "codex" ? "Codex" : "Claude";
32962
32749
  this.log(`Using ${providerLabel} CLI for all phases`, "info");
32963
32750
  }
32964
- log(message, level = "info") {
32965
- const timestamp = new Date().toISOString().split("T")[1]?.slice(0, 8) ?? "";
32966
- const colorFn = {
32967
- info: c.cyan,
32968
- success: c.green,
32969
- warn: c.yellow,
32970
- error: c.red
32971
- }[level];
32972
- const prefix = { info: "ℹ", success: "✓", warn: "⚠", error: "✗" }[level];
32973
- console.log(`${c.dim(`[${timestamp}]`)} ${c.bold(`[${this.config.agentId.slice(-8)}]`)} ${colorFn(`${prefix} ${message}`)}`);
32974
- }
32975
32751
  async getActiveSprint() {
32976
32752
  try {
32977
32753
  if (this.config.sprintId) {
@@ -33148,7 +32924,6 @@ var init_worker = __esm(() => {
33148
32924
  init_config();
33149
32925
  init_git_utils();
33150
32926
  init_src2();
33151
- init_colors();
33152
32927
  init_git_workflow();
33153
32928
  init_task_executor();
33154
32929
  workerEntrypoint = process.argv[1]?.split(/[\\/]/).pop();