@locusai/cli 0.14.5 → 0.15.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.
@@ -14343,6 +14343,32 @@ var init_auth = __esm(() => {
14343
14343
  });
14344
14344
  });
14345
14345
 
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
+
14346
14372
  // ../shared/src/models/aws-instance.ts
14347
14373
  var InstanceAction, AwsCredentialsSchema, IntegrationSchema, AwsInstanceSchema, CreateAwsInstanceSchema, UpdateAwsInstanceSchema, SaveAwsCredentialsSchema, ProvisionAwsInstanceSchema, InstanceActionBodySchema, InstanceIdParamSchema, CIDR_REGEX, UpdateSecurityRulesSchema;
14348
14374
  var init_aws_instance = __esm(() => {
@@ -14661,6 +14687,49 @@ var init_sprint = __esm(() => {
14661
14687
  });
14662
14688
  });
14663
14689
 
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
+
14664
14733
  // ../shared/src/models/task.ts
14665
14734
  var AcceptanceItemSchema, TaskSchema, CreateTaskSchema, UpdateTaskSchema, AddCommentSchema, DispatchTaskSchema, TaskIdParamSchema, TaskQuerySchema, TaskResponseSchema, TasksResponseSchema;
14666
14735
  var init_task = __esm(() => {
@@ -14800,6 +14869,7 @@ var init_models = __esm(() => {
14800
14869
  init_activity();
14801
14870
  init_agent();
14802
14871
  init_auth();
14872
+ init_autonomy();
14803
14873
  init_aws_instance();
14804
14874
  init_ci();
14805
14875
  init_doc();
@@ -14807,6 +14877,7 @@ var init_models = __esm(() => {
14807
14877
  init_invitation();
14808
14878
  init_organization();
14809
14879
  init_sprint();
14880
+ init_suggestion();
14810
14881
  init_task();
14811
14882
  init_user();
14812
14883
  init_workspace();
@@ -15572,6 +15643,7 @@ class ClaudeRunner {
15572
15643
  currentToolName;
15573
15644
  activeTools = new Map;
15574
15645
  activeProcess = null;
15646
+ aborted = false;
15575
15647
  timeoutMs;
15576
15648
  constructor(projectPath, model = DEFAULT_MODEL[PROVIDER.CLAUDE], log, timeoutMs) {
15577
15649
  this.model = model;
@@ -15584,6 +15656,7 @@ class ClaudeRunner {
15584
15656
  }
15585
15657
  abort() {
15586
15658
  if (this.activeProcess && !this.activeProcess.killed) {
15659
+ this.aborted = true;
15587
15660
  this.activeProcess.kill("SIGTERM");
15588
15661
  this.activeProcess = null;
15589
15662
  }
@@ -15642,6 +15715,7 @@ class ClaudeRunner {
15642
15715
  return args;
15643
15716
  }
15644
15717
  async* runStream(prompt) {
15718
+ this.aborted = false;
15645
15719
  const args = this.buildCliArgs();
15646
15720
  const env = getAugmentedEnv({
15647
15721
  FORCE_COLOR: "1",
@@ -15736,7 +15810,7 @@ class ClaudeRunner {
15736
15810
  process.stderr.write(`${stderrBuffer}
15737
15811
  `);
15738
15812
  }
15739
- if (code !== 0 && !errorMessage) {
15813
+ if (code !== 0 && !errorMessage && !this.aborted) {
15740
15814
  const detail = stderrFull.trim() || lastResultContent.trim();
15741
15815
  errorMessage = this.createExecutionError(code, detail).message;
15742
15816
  this.eventEmitter?.emitErrorOccurred(errorMessage, `EXIT_${code}`);
@@ -15881,6 +15955,7 @@ class ClaudeRunner {
15881
15955
  return null;
15882
15956
  }
15883
15957
  executeRun(prompt) {
15958
+ this.aborted = false;
15884
15959
  return new Promise((resolve2, reject) => {
15885
15960
  const args = this.buildCliArgs();
15886
15961
  const env = getAugmentedEnv({
@@ -15933,7 +16008,7 @@ class ClaudeRunner {
15933
16008
  }
15934
16009
  process.stdout.write(`
15935
16010
  `);
15936
- if (code === 0) {
16011
+ if (code === 0 || this.aborted) {
15937
16012
  resolve2(finalResult);
15938
16013
  } else {
15939
16014
  const detail = errorOutput.trim() || finalResult.trim();
@@ -16004,6 +16079,7 @@ class CodexRunner {
16004
16079
  log;
16005
16080
  reasoningEffort;
16006
16081
  activeProcess = null;
16082
+ aborted = false;
16007
16083
  eventEmitter;
16008
16084
  currentToolName;
16009
16085
  timeoutMs;
@@ -16019,11 +16095,13 @@ class CodexRunner {
16019
16095
  }
16020
16096
  abort() {
16021
16097
  if (this.activeProcess && !this.activeProcess.killed) {
16098
+ this.aborted = true;
16022
16099
  this.activeProcess.kill("SIGTERM");
16023
16100
  this.activeProcess = null;
16024
16101
  }
16025
16102
  }
16026
16103
  async run(prompt) {
16104
+ this.aborted = false;
16027
16105
  const maxRetries = 3;
16028
16106
  let lastError = null;
16029
16107
  for (let attempt = 1;attempt <= maxRetries; attempt++) {
@@ -16139,7 +16217,7 @@ class CodexRunner {
16139
16217
  });
16140
16218
  codex.on("close", (code) => {
16141
16219
  this.activeProcess = null;
16142
- if (code === 0) {
16220
+ if (code === 0 || this.aborted) {
16143
16221
  const result = this.readOutput(outputPath, finalOutput);
16144
16222
  this.cleanupTempFile(outputPath);
16145
16223
  if (result && finalContent.trim().length === 0) {
@@ -16252,7 +16330,7 @@ class CodexRunner {
16252
16330
  });
16253
16331
  codex.on("close", (code) => {
16254
16332
  this.activeProcess = null;
16255
- if (code === 0) {
16333
+ if (code === 0 || this.aborted) {
16256
16334
  const result = this.readOutput(outputPath, output);
16257
16335
  this.cleanupTempFile(outputPath);
16258
16336
  resolve2(result);
@@ -31698,6 +31776,29 @@ var init_sprints = __esm(() => {
31698
31776
  };
31699
31777
  });
31700
31778
 
31779
+ // ../sdk/src/modules/suggestions.ts
31780
+ var SuggestionsModule;
31781
+ var init_suggestions = __esm(() => {
31782
+ SuggestionsModule = class SuggestionsModule extends BaseModule {
31783
+ async create(workspaceId, data) {
31784
+ const { data: res } = await this.api.post(`/workspaces/${workspaceId}/suggestions`, data);
31785
+ return res.suggestion;
31786
+ }
31787
+ async list(workspaceId, params) {
31788
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/suggestions`, { params });
31789
+ return data.suggestions;
31790
+ }
31791
+ async get(workspaceId, id) {
31792
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/suggestions/${id}`);
31793
+ return data.suggestion;
31794
+ }
31795
+ async updateStatus(workspaceId, id, status) {
31796
+ const { data } = await this.api.patch(`/workspaces/${workspaceId}/suggestions/${id}/status`, status);
31797
+ return data.suggestion;
31798
+ }
31799
+ };
31800
+ });
31801
+
31701
31802
  // ../sdk/src/modules/tasks.ts
31702
31803
  var TasksModule;
31703
31804
  var init_tasks = __esm(() => {
@@ -31882,6 +31983,7 @@ class LocusClient {
31882
31983
  docs;
31883
31984
  ci;
31884
31985
  instances;
31986
+ suggestions;
31885
31987
  constructor(config2) {
31886
31988
  this.emitter = new LocusEmitter;
31887
31989
  this.api = axios_default.create({
@@ -31902,6 +32004,7 @@ class LocusClient {
31902
32004
  this.docs = new DocsModule(this.api, this.emitter);
31903
32005
  this.ci = new CiModule(this.api, this.emitter);
31904
32006
  this.instances = new InstancesModule(this.api, this.emitter);
32007
+ this.suggestions = new SuggestionsModule(this.api, this.emitter);
31905
32008
  if (config2.retryOptions) {
31906
32009
  this.setupRetryInterceptor(config2.retryOptions);
31907
32010
  }
@@ -31971,6 +32074,7 @@ var init_src2 = __esm(() => {
31971
32074
  init_invitations();
31972
32075
  init_organizations();
31973
32076
  init_sprints();
32077
+ init_suggestions();
31974
32078
  init_tasks();
31975
32079
  init_workspaces();
31976
32080
  init_discussion_types();
@@ -31982,6 +32086,7 @@ var init_src2 = __esm(() => {
31982
32086
  init_invitations();
31983
32087
  init_organizations();
31984
32088
  init_sprints();
32089
+ init_suggestions();
31985
32090
  init_tasks();
31986
32091
  init_workspaces();
31987
32092
  });