@locusai/sdk 0.9.18 → 0.10.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 (40) hide show
  1. package/dist/agent/git-workflow.d.ts +44 -0
  2. package/dist/agent/git-workflow.d.ts.map +1 -0
  3. package/dist/agent/index.d.ts +2 -0
  4. package/dist/agent/index.d.ts.map +1 -1
  5. package/dist/agent/reviewer-worker.d.ts.map +1 -1
  6. package/dist/agent/worker-cli.d.ts +6 -0
  7. package/dist/agent/worker-cli.d.ts.map +1 -0
  8. package/dist/agent/worker-types.d.ts +44 -0
  9. package/dist/agent/worker-types.d.ts.map +1 -0
  10. package/dist/agent/worker.d.ts +12 -48
  11. package/dist/agent/worker.d.ts.map +1 -1
  12. package/dist/agent/worker.js +1026 -847
  13. package/dist/ai/claude-runner.d.ts.map +1 -1
  14. package/dist/index-node.d.ts +1 -1
  15. package/dist/index-node.d.ts.map +1 -1
  16. package/dist/index-node.js +1660 -1133
  17. package/dist/index.js +363 -316
  18. package/dist/orchestrator/agent-pool.d.ts +59 -0
  19. package/dist/orchestrator/agent-pool.d.ts.map +1 -0
  20. package/dist/orchestrator/execution.d.ts +55 -0
  21. package/dist/orchestrator/execution.d.ts.map +1 -0
  22. package/dist/orchestrator/index.d.ts +91 -0
  23. package/dist/orchestrator/index.d.ts.map +1 -0
  24. package/dist/orchestrator/tier-merge.d.ts +50 -0
  25. package/dist/orchestrator/tier-merge.d.ts.map +1 -0
  26. package/dist/orchestrator/types.d.ts +45 -0
  27. package/dist/orchestrator/types.d.ts.map +1 -0
  28. package/dist/planning/agents/cross-task-reviewer.d.ts.map +1 -1
  29. package/dist/planning/agents/sprint-organizer.d.ts.map +1 -1
  30. package/dist/planning/plan-manager.d.ts.map +1 -1
  31. package/dist/planning/sprint-plan.d.ts +2 -0
  32. package/dist/planning/sprint-plan.d.ts.map +1 -1
  33. package/dist/project/knowledge-base.d.ts +4 -5
  34. package/dist/project/knowledge-base.d.ts.map +1 -1
  35. package/dist/utils/resolve-bin.d.ts +3 -0
  36. package/dist/utils/resolve-bin.d.ts.map +1 -1
  37. package/dist/worktree/worktree-manager.d.ts.map +1 -1
  38. package/package.json +2 -2
  39. package/dist/orchestrator.d.ts +0 -124
  40. package/dist/orchestrator.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -38,42 +38,26 @@ var __export = (target, all) => {
38
38
  set: (newValue) => all[name] = () => newValue
39
39
  });
40
40
  };
41
-
42
- // src/index.ts
43
- var exports_src = {};
44
- __export(exports_src, {
45
- WorkspacesModule: () => WorkspacesModule,
46
- TasksModule: () => TasksModule,
47
- SprintsModule: () => SprintsModule,
48
- OrganizationsModule: () => OrganizationsModule,
49
- LocusEvent: () => LocusEvent,
50
- LocusEmitter: () => LocusEmitter,
51
- LocusClient: () => LocusClient,
52
- InvitationsModule: () => InvitationsModule,
53
- DocsModule: () => DocsModule,
54
- CiModule: () => CiModule,
55
- AuthModule: () => AuthModule
56
- });
57
- module.exports = __toCommonJS(exports_src);
58
- var import_axios = __toESM(require("axios"));
41
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
59
42
 
60
43
  // src/events.ts
61
- var import_events = require("events");
62
- var LocusEvent;
63
- ((LocusEvent2) => {
64
- LocusEvent2["TOKEN_EXPIRED"] = "TOKEN_EXPIRED";
65
- LocusEvent2["AUTH_ERROR"] = "AUTH_ERROR";
66
- LocusEvent2["REQUEST_ERROR"] = "REQUEST_ERROR";
67
- })(LocusEvent ||= {});
68
-
69
- class LocusEmitter extends import_events.EventEmitter {
70
- on(event, listener) {
71
- return super.on(event, listener);
72
- }
73
- emit(event, ...args) {
74
- return super.emit(event, ...args);
75
- }
76
- }
44
+ var import_events, LocusEvent, LocusEmitter;
45
+ var init_events = __esm(() => {
46
+ import_events = require("events");
47
+ ((LocusEvent2) => {
48
+ LocusEvent2["TOKEN_EXPIRED"] = "TOKEN_EXPIRED";
49
+ LocusEvent2["AUTH_ERROR"] = "AUTH_ERROR";
50
+ LocusEvent2["REQUEST_ERROR"] = "REQUEST_ERROR";
51
+ })(LocusEvent ||= {});
52
+ LocusEmitter = class LocusEmitter extends import_events.EventEmitter {
53
+ on(event, listener) {
54
+ return super.on(event, listener);
55
+ }
56
+ emit(event, ...args) {
57
+ return super.emit(event, ...args);
58
+ }
59
+ };
60
+ });
77
61
 
78
62
  // src/modules/base.ts
79
63
  class BaseModule {
@@ -86,304 +70,344 @@ class BaseModule {
86
70
  }
87
71
 
88
72
  // src/modules/auth.ts
89
- class AuthModule extends BaseModule {
90
- async getProfile() {
91
- const { data } = await this.api.get("/auth/me");
92
- return data;
93
- }
94
- async getApiKeyInfo() {
95
- const { data } = await this.api.get("/auth/api-key");
96
- return data;
97
- }
98
- async requestRegisterOtp(email) {
99
- const { data } = await this.api.post("/auth/register-otp", { email });
100
- return data;
101
- }
102
- async requestLoginOtp(email) {
103
- const { data } = await this.api.post("/auth/login-otp", { email });
104
- return data;
105
- }
106
- async verifyLogin(body) {
107
- const { data } = await this.api.post("/auth/verify-login", body);
108
- return data;
109
- }
110
- async completeRegistration(body) {
111
- const { data } = await this.api.post("/auth/complete-registration", body);
112
- return data;
113
- }
114
- async deleteAccount() {
115
- const { data } = await this.api.delete("/auth/account");
116
- return data;
117
- }
118
- }
73
+ var AuthModule;
74
+ var init_auth = __esm(() => {
75
+ AuthModule = class AuthModule extends BaseModule {
76
+ async getProfile() {
77
+ const { data } = await this.api.get("/auth/me");
78
+ return data;
79
+ }
80
+ async getApiKeyInfo() {
81
+ const { data } = await this.api.get("/auth/api-key");
82
+ return data;
83
+ }
84
+ async requestRegisterOtp(email) {
85
+ const { data } = await this.api.post("/auth/register-otp", { email });
86
+ return data;
87
+ }
88
+ async requestLoginOtp(email) {
89
+ const { data } = await this.api.post("/auth/login-otp", { email });
90
+ return data;
91
+ }
92
+ async verifyLogin(body) {
93
+ const { data } = await this.api.post("/auth/verify-login", body);
94
+ return data;
95
+ }
96
+ async completeRegistration(body) {
97
+ const { data } = await this.api.post("/auth/complete-registration", body);
98
+ return data;
99
+ }
100
+ async deleteAccount() {
101
+ const { data } = await this.api.delete("/auth/account");
102
+ return data;
103
+ }
104
+ };
105
+ });
119
106
 
120
107
  // src/modules/ci.ts
121
- class CiModule extends BaseModule {
122
- async report(body) {
123
- const { data } = await this.api.post("/ci/report", body);
124
- return data;
125
- }
126
- }
108
+ var CiModule;
109
+ var init_ci = __esm(() => {
110
+ CiModule = class CiModule extends BaseModule {
111
+ async report(body) {
112
+ const { data } = await this.api.post("/ci/report", body);
113
+ return data;
114
+ }
115
+ };
116
+ });
127
117
 
128
118
  // src/modules/docs.ts
129
- class DocsModule extends BaseModule {
130
- async create(workspaceId, body) {
131
- const { data } = await this.api.post(`/workspaces/${workspaceId}/docs`, body);
132
- return data.doc;
133
- }
134
- async list(workspaceId) {
135
- const { data } = await this.api.get(`/workspaces/${workspaceId}/docs`);
136
- return data.docs;
137
- }
138
- async getById(id, workspaceId) {
139
- const { data } = await this.api.get(`/workspaces/${workspaceId}/docs/${id}`);
140
- return data.doc;
141
- }
142
- async update(id, workspaceId, body) {
143
- const { data } = await this.api.put(`/workspaces/${workspaceId}/docs/${id}`, body);
144
- return data.doc;
145
- }
146
- async delete(id, workspaceId) {
147
- await this.api.delete(`/workspaces/${workspaceId}/docs/${id}`);
148
- }
149
- async listGroups(workspaceId) {
150
- const { data } = await this.api.get(`/workspaces/${workspaceId}/doc-groups`);
151
- return data.groups;
152
- }
153
- async createGroup(workspaceId, body) {
154
- const { data } = await this.api.post(`/workspaces/${workspaceId}/doc-groups`, body);
155
- return data.group;
156
- }
157
- async updateGroup(id, workspaceId, body) {
158
- const { data } = await this.api.patch(`/workspaces/${workspaceId}/doc-groups/${id}`, body);
159
- return data.group;
160
- }
161
- async deleteGroup(id, workspaceId) {
162
- await this.api.delete(`/workspaces/${workspaceId}/doc-groups/${id}`);
163
- }
164
- }
119
+ var DocsModule;
120
+ var init_docs = __esm(() => {
121
+ DocsModule = class DocsModule extends BaseModule {
122
+ async create(workspaceId, body) {
123
+ const { data } = await this.api.post(`/workspaces/${workspaceId}/docs`, body);
124
+ return data.doc;
125
+ }
126
+ async list(workspaceId) {
127
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/docs`);
128
+ return data.docs;
129
+ }
130
+ async getById(id, workspaceId) {
131
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/docs/${id}`);
132
+ return data.doc;
133
+ }
134
+ async update(id, workspaceId, body) {
135
+ const { data } = await this.api.put(`/workspaces/${workspaceId}/docs/${id}`, body);
136
+ return data.doc;
137
+ }
138
+ async delete(id, workspaceId) {
139
+ await this.api.delete(`/workspaces/${workspaceId}/docs/${id}`);
140
+ }
141
+ async listGroups(workspaceId) {
142
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/doc-groups`);
143
+ return data.groups;
144
+ }
145
+ async createGroup(workspaceId, body) {
146
+ const { data } = await this.api.post(`/workspaces/${workspaceId}/doc-groups`, body);
147
+ return data.group;
148
+ }
149
+ async updateGroup(id, workspaceId, body) {
150
+ const { data } = await this.api.patch(`/workspaces/${workspaceId}/doc-groups/${id}`, body);
151
+ return data.group;
152
+ }
153
+ async deleteGroup(id, workspaceId) {
154
+ await this.api.delete(`/workspaces/${workspaceId}/doc-groups/${id}`);
155
+ }
156
+ };
157
+ });
165
158
 
166
159
  // src/modules/invitations.ts
167
- class InvitationsModule extends BaseModule {
168
- async create(orgId, body) {
169
- const { data } = await this.api.post(`/org/${orgId}/invitations`, body);
170
- return data.invitation;
171
- }
172
- async list(orgId) {
173
- const { data } = await this.api.get(`/org/${orgId}/invitations`);
174
- return data.invitations;
175
- }
176
- async verify(token) {
177
- const { data } = await this.api.get(`/invitations/verify/${token}`);
178
- return data;
179
- }
180
- async accept(body) {
181
- const { data } = await this.api.post("/invitations/accept", body);
182
- return data;
183
- }
184
- async revoke(orgId, id) {
185
- await this.api.delete(`/org/${orgId}/invitations/${id}`);
186
- }
187
- }
160
+ var InvitationsModule;
161
+ var init_invitations = __esm(() => {
162
+ InvitationsModule = class InvitationsModule extends BaseModule {
163
+ async create(orgId, body) {
164
+ const { data } = await this.api.post(`/org/${orgId}/invitations`, body);
165
+ return data.invitation;
166
+ }
167
+ async list(orgId) {
168
+ const { data } = await this.api.get(`/org/${orgId}/invitations`);
169
+ return data.invitations;
170
+ }
171
+ async verify(token) {
172
+ const { data } = await this.api.get(`/invitations/verify/${token}`);
173
+ return data;
174
+ }
175
+ async accept(body) {
176
+ const { data } = await this.api.post("/invitations/accept", body);
177
+ return data;
178
+ }
179
+ async revoke(orgId, id) {
180
+ await this.api.delete(`/org/${orgId}/invitations/${id}`);
181
+ }
182
+ };
183
+ });
188
184
 
189
185
  // src/modules/organizations.ts
190
- class OrganizationsModule extends BaseModule {
191
- async list() {
192
- const { data } = await this.api.get("/organizations");
193
- return data.organizations;
194
- }
195
- async getById(id) {
196
- const { data } = await this.api.get(`/organizations/${id}`);
197
- return data.organization;
198
- }
199
- async listMembers(id) {
200
- const { data } = await this.api.get(`/organizations/${id}/members`);
201
- return data.members;
202
- }
203
- async addMember(id, body) {
204
- const { data } = await this.api.post(`/organizations/${id}/members`, body);
205
- return data.membership;
206
- }
207
- async removeMember(orgId, userId) {
208
- await this.api.delete(`/organizations/${orgId}/members/${userId}`);
209
- }
210
- async delete(orgId) {
211
- await this.api.delete(`/organizations/${orgId}`);
212
- }
213
- async listApiKeys(orgId) {
214
- const { data } = await this.api.get(`/organizations/${orgId}/api-keys`);
215
- return data.apiKeys;
216
- }
217
- async createApiKey(orgId, name) {
218
- const { data } = await this.api.post(`/organizations/${orgId}/api-keys`, { name });
219
- return data.apiKey;
220
- }
221
- async deleteApiKey(orgId, keyId) {
222
- await this.api.delete(`/organizations/${orgId}/api-keys/${keyId}`);
223
- }
224
- }
186
+ var OrganizationsModule;
187
+ var init_organizations = __esm(() => {
188
+ OrganizationsModule = class OrganizationsModule extends BaseModule {
189
+ async list() {
190
+ const { data } = await this.api.get("/organizations");
191
+ return data.organizations;
192
+ }
193
+ async getById(id) {
194
+ const { data } = await this.api.get(`/organizations/${id}`);
195
+ return data.organization;
196
+ }
197
+ async listMembers(id) {
198
+ const { data } = await this.api.get(`/organizations/${id}/members`);
199
+ return data.members;
200
+ }
201
+ async addMember(id, body) {
202
+ const { data } = await this.api.post(`/organizations/${id}/members`, body);
203
+ return data.membership;
204
+ }
205
+ async removeMember(orgId, userId) {
206
+ await this.api.delete(`/organizations/${orgId}/members/${userId}`);
207
+ }
208
+ async delete(orgId) {
209
+ await this.api.delete(`/organizations/${orgId}`);
210
+ }
211
+ async listApiKeys(orgId) {
212
+ const { data } = await this.api.get(`/organizations/${orgId}/api-keys`);
213
+ return data.apiKeys;
214
+ }
215
+ async createApiKey(orgId, name) {
216
+ const { data } = await this.api.post(`/organizations/${orgId}/api-keys`, { name });
217
+ return data.apiKey;
218
+ }
219
+ async deleteApiKey(orgId, keyId) {
220
+ await this.api.delete(`/organizations/${orgId}/api-keys/${keyId}`);
221
+ }
222
+ };
223
+ });
225
224
 
226
225
  // src/modules/sprints.ts
227
- class SprintsModule extends BaseModule {
228
- async list(workspaceId) {
229
- const { data } = await this.api.get(`/workspaces/${workspaceId}/sprints`);
230
- return data.sprints;
231
- }
232
- async getActive(workspaceId) {
233
- const { data } = await this.api.get(`/workspaces/${workspaceId}/sprints/active`);
234
- return data.sprint;
235
- }
236
- async getById(id, workspaceId) {
237
- const { data } = await this.api.get(`/workspaces/${workspaceId}/sprints/${id}`);
238
- return data.sprint;
239
- }
240
- async create(workspaceId, body) {
241
- const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints`, body);
242
- return data.sprint;
243
- }
244
- async update(id, workspaceId, body) {
245
- const { data } = await this.api.patch(`/workspaces/${workspaceId}/sprints/${id}`, body);
246
- return data.sprint;
247
- }
248
- async delete(id, workspaceId) {
249
- await this.api.delete(`/workspaces/${workspaceId}/sprints/${id}`);
250
- }
251
- async start(id, workspaceId) {
252
- const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints/${id}/start`);
253
- return data.sprint;
254
- }
255
- async complete(id, workspaceId) {
256
- const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints/${id}/complete`);
257
- return data.sprint;
258
- }
259
- async triggerAIPlanning(id, workspaceId) {
260
- const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints/${id}/trigger-ai-planning`);
261
- return data.sprint;
262
- }
263
- }
226
+ var SprintsModule;
227
+ var init_sprints = __esm(() => {
228
+ SprintsModule = class SprintsModule extends BaseModule {
229
+ async list(workspaceId) {
230
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/sprints`);
231
+ return data.sprints;
232
+ }
233
+ async getActive(workspaceId) {
234
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/sprints/active`);
235
+ return data.sprint;
236
+ }
237
+ async getById(id, workspaceId) {
238
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/sprints/${id}`);
239
+ return data.sprint;
240
+ }
241
+ async create(workspaceId, body) {
242
+ const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints`, body);
243
+ return data.sprint;
244
+ }
245
+ async update(id, workspaceId, body) {
246
+ const { data } = await this.api.patch(`/workspaces/${workspaceId}/sprints/${id}`, body);
247
+ return data.sprint;
248
+ }
249
+ async delete(id, workspaceId) {
250
+ await this.api.delete(`/workspaces/${workspaceId}/sprints/${id}`);
251
+ }
252
+ async start(id, workspaceId) {
253
+ const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints/${id}/start`);
254
+ return data.sprint;
255
+ }
256
+ async complete(id, workspaceId) {
257
+ const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints/${id}/complete`);
258
+ return data.sprint;
259
+ }
260
+ async triggerAIPlanning(id, workspaceId) {
261
+ const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints/${id}/trigger-ai-planning`);
262
+ return data.sprint;
263
+ }
264
+ };
265
+ });
264
266
 
265
267
  // src/modules/tasks.ts
266
- var import_shared = require("@locusai/shared");
267
- class TasksModule extends BaseModule {
268
- async list(workspaceId, options) {
269
- const { data } = await this.api.get(`/workspaces/${workspaceId}/tasks`);
270
- let tasks = data.tasks;
271
- if (options?.sprintId) {
272
- tasks = tasks.filter((t) => t.sprintId === options.sprintId);
273
- }
274
- if (options?.status) {
275
- const statuses = Array.isArray(options.status) ? options.status : [options.status];
276
- tasks = tasks.filter((t) => statuses.includes(t.status));
277
- }
278
- return tasks;
279
- }
280
- async getAvailable(workspaceId, sprintId) {
281
- const tasks = await this.list(workspaceId, {
282
- sprintId
283
- });
284
- return tasks.filter((t) => t.status === import_shared.TaskStatus.BACKLOG || t.status === import_shared.TaskStatus.IN_PROGRESS && !t.assignedTo);
285
- }
286
- async getById(id, workspaceId) {
287
- const { data } = await this.api.get(`/workspaces/${workspaceId}/tasks/${id}`);
288
- return data.task;
289
- }
290
- async create(workspaceId, body) {
291
- const { data } = await this.api.post(`/workspaces/${workspaceId}/tasks`, body);
292
- return data.task;
293
- }
294
- async update(id, workspaceId, body) {
295
- const { data } = await this.api.patch(`/workspaces/${workspaceId}/tasks/${id}`, body);
296
- return data.task;
297
- }
298
- async delete(id, workspaceId) {
299
- await this.api.delete(`/workspaces/${workspaceId}/tasks/${id}`);
300
- }
301
- async getBacklog(workspaceId) {
302
- const { data } = await this.api.get(`/workspaces/${workspaceId}/tasks/backlog`);
303
- return data.tasks;
304
- }
305
- async addComment(id, workspaceId, body) {
306
- const { data } = await this.api.post(`/workspaces/${workspaceId}/tasks/${id}/comment`, body);
307
- return data.comment;
308
- }
309
- async batchUpdate(ids, workspaceId, updates) {
310
- await this.api.patch(`/workspaces/${workspaceId}/tasks/batch`, {
311
- ids,
312
- updates
313
- });
314
- }
315
- }
268
+ var import_shared, TasksModule;
269
+ var init_tasks = __esm(() => {
270
+ import_shared = require("@locusai/shared");
271
+ TasksModule = class TasksModule extends BaseModule {
272
+ async list(workspaceId, options) {
273
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/tasks`);
274
+ let tasks = data.tasks;
275
+ if (options?.sprintId) {
276
+ tasks = tasks.filter((t) => t.sprintId === options.sprintId);
277
+ }
278
+ if (options?.status) {
279
+ const statuses = Array.isArray(options.status) ? options.status : [options.status];
280
+ tasks = tasks.filter((t) => statuses.includes(t.status));
281
+ }
282
+ return tasks;
283
+ }
284
+ async getAvailable(workspaceId, sprintId) {
285
+ const tasks = await this.list(workspaceId, {
286
+ sprintId
287
+ });
288
+ return tasks.filter((t) => t.status === import_shared.TaskStatus.BACKLOG || t.status === import_shared.TaskStatus.IN_PROGRESS && !t.assignedTo);
289
+ }
290
+ async getById(id, workspaceId) {
291
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/tasks/${id}`);
292
+ return data.task;
293
+ }
294
+ async create(workspaceId, body) {
295
+ const { data } = await this.api.post(`/workspaces/${workspaceId}/tasks`, body);
296
+ return data.task;
297
+ }
298
+ async update(id, workspaceId, body) {
299
+ const { data } = await this.api.patch(`/workspaces/${workspaceId}/tasks/${id}`, body);
300
+ return data.task;
301
+ }
302
+ async delete(id, workspaceId) {
303
+ await this.api.delete(`/workspaces/${workspaceId}/tasks/${id}`);
304
+ }
305
+ async getBacklog(workspaceId) {
306
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/tasks/backlog`);
307
+ return data.tasks;
308
+ }
309
+ async addComment(id, workspaceId, body) {
310
+ const { data } = await this.api.post(`/workspaces/${workspaceId}/tasks/${id}/comment`, body);
311
+ return data.comment;
312
+ }
313
+ async batchUpdate(ids, workspaceId, updates) {
314
+ await this.api.patch(`/workspaces/${workspaceId}/tasks/batch`, {
315
+ ids,
316
+ updates
317
+ });
318
+ }
319
+ };
320
+ });
316
321
 
317
322
  // src/modules/workspaces.ts
318
- class WorkspacesModule extends BaseModule {
319
- async listAll() {
320
- const { data } = await this.api.get("/workspaces");
321
- return data.workspaces;
322
- }
323
- async listByOrg(orgId) {
324
- const { data } = await this.api.get(`/workspaces/org/${orgId}`);
325
- return data.workspaces;
326
- }
327
- async create(body) {
328
- const { orgId, ...bodyWithoutOrgId } = body;
329
- const { data } = await this.api.post(`/workspaces/org/${orgId}`, bodyWithoutOrgId);
330
- return data.workspace;
331
- }
332
- async createWithAutoOrg(body) {
333
- const { data } = await this.api.post("/workspaces", body);
334
- return data.workspace;
335
- }
336
- async getById(id) {
337
- const { data } = await this.api.get(`/workspaces/${id}`);
338
- return data.workspace;
339
- }
340
- async update(id, body) {
341
- const { data } = await this.api.put(`/workspaces/${id}`, body);
342
- return data.workspace;
343
- }
344
- async delete(id) {
345
- await this.api.delete(`/workspaces/${id}`);
346
- }
347
- async getStats(id) {
348
- const { data } = await this.api.get(`/workspaces/${id}/stats`);
349
- return data;
350
- }
351
- async getActivity(id, limit) {
352
- const { data } = await this.api.get(`/workspaces/${id}/activity`, {
353
- params: { limit }
354
- });
355
- return data.activity;
356
- }
357
- async dispatch(id, workerId, sprintId) {
358
- const { data } = await this.api.post(`/workspaces/${id}/dispatch`, { workerId, sprintId });
359
- return data.task;
360
- }
361
- async heartbeat(workspaceId, agentId, currentTaskId, status) {
362
- const { data } = await this.api.post(`/workspaces/${workspaceId}/agents/heartbeat`, {
363
- agentId,
364
- currentTaskId: currentTaskId ?? null,
365
- status: status ?? "WORKING"
366
- });
367
- return data.agent;
368
- }
369
- async getAgents(workspaceId) {
370
- const { data } = await this.api.get(`/workspaces/${workspaceId}/agents`);
371
- return data.agents;
372
- }
373
- async listApiKeys(workspaceId) {
374
- const { data } = await this.api.get(`/workspaces/${workspaceId}/api-keys`);
375
- return data.apiKeys;
376
- }
377
- async createApiKey(workspaceId, name) {
378
- const { data } = await this.api.post(`/workspaces/${workspaceId}/api-keys`, { name });
379
- return data.apiKey;
380
- }
381
- async deleteApiKey(workspaceId, keyId) {
382
- await this.api.delete(`/workspaces/${workspaceId}/api-keys/${keyId}`);
383
- }
384
- }
323
+ var WorkspacesModule;
324
+ var init_workspaces = __esm(() => {
325
+ WorkspacesModule = class WorkspacesModule extends BaseModule {
326
+ async listAll() {
327
+ const { data } = await this.api.get("/workspaces");
328
+ return data.workspaces;
329
+ }
330
+ async listByOrg(orgId) {
331
+ const { data } = await this.api.get(`/workspaces/org/${orgId}`);
332
+ return data.workspaces;
333
+ }
334
+ async create(body) {
335
+ const { orgId, ...bodyWithoutOrgId } = body;
336
+ const { data } = await this.api.post(`/workspaces/org/${orgId}`, bodyWithoutOrgId);
337
+ return data.workspace;
338
+ }
339
+ async createWithAutoOrg(body) {
340
+ const { data } = await this.api.post("/workspaces", body);
341
+ return data.workspace;
342
+ }
343
+ async getById(id) {
344
+ const { data } = await this.api.get(`/workspaces/${id}`);
345
+ return data.workspace;
346
+ }
347
+ async update(id, body) {
348
+ const { data } = await this.api.put(`/workspaces/${id}`, body);
349
+ return data.workspace;
350
+ }
351
+ async delete(id) {
352
+ await this.api.delete(`/workspaces/${id}`);
353
+ }
354
+ async getStats(id) {
355
+ const { data } = await this.api.get(`/workspaces/${id}/stats`);
356
+ return data;
357
+ }
358
+ async getActivity(id, limit) {
359
+ const { data } = await this.api.get(`/workspaces/${id}/activity`, {
360
+ params: { limit }
361
+ });
362
+ return data.activity;
363
+ }
364
+ async dispatch(id, workerId, sprintId) {
365
+ const { data } = await this.api.post(`/workspaces/${id}/dispatch`, { workerId, sprintId });
366
+ return data.task;
367
+ }
368
+ async heartbeat(workspaceId, agentId, currentTaskId, status) {
369
+ const { data } = await this.api.post(`/workspaces/${workspaceId}/agents/heartbeat`, {
370
+ agentId,
371
+ currentTaskId: currentTaskId ?? null,
372
+ status: status ?? "WORKING"
373
+ });
374
+ return data.agent;
375
+ }
376
+ async getAgents(workspaceId) {
377
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/agents`);
378
+ return data.agents;
379
+ }
380
+ async listApiKeys(workspaceId) {
381
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/api-keys`);
382
+ return data.apiKeys;
383
+ }
384
+ async createApiKey(workspaceId, name) {
385
+ const { data } = await this.api.post(`/workspaces/${workspaceId}/api-keys`, { name });
386
+ return data.apiKey;
387
+ }
388
+ async deleteApiKey(workspaceId, keyId) {
389
+ await this.api.delete(`/workspaces/${workspaceId}/api-keys/${keyId}`);
390
+ }
391
+ };
392
+ });
385
393
 
386
394
  // src/index.ts
395
+ var exports_src = {};
396
+ __export(exports_src, {
397
+ WorkspacesModule: () => WorkspacesModule,
398
+ TasksModule: () => TasksModule,
399
+ SprintsModule: () => SprintsModule,
400
+ OrganizationsModule: () => OrganizationsModule,
401
+ LocusEvent: () => LocusEvent,
402
+ LocusEmitter: () => LocusEmitter,
403
+ LocusClient: () => LocusClient,
404
+ InvitationsModule: () => InvitationsModule,
405
+ DocsModule: () => DocsModule,
406
+ CiModule: () => CiModule,
407
+ AuthModule: () => AuthModule
408
+ });
409
+ module.exports = __toCommonJS(exports_src);
410
+
387
411
  class LocusClient {
388
412
  api;
389
413
  emitter;
@@ -473,3 +497,26 @@ class LocusClient {
473
497
  }
474
498
  }
475
499
  }
500
+ var import_axios;
501
+ var init_src = __esm(() => {
502
+ init_events();
503
+ init_auth();
504
+ init_ci();
505
+ init_docs();
506
+ init_invitations();
507
+ init_organizations();
508
+ init_sprints();
509
+ init_tasks();
510
+ init_workspaces();
511
+ import_axios = __toESM(require("axios"));
512
+ init_events();
513
+ init_auth();
514
+ init_ci();
515
+ init_docs();
516
+ init_invitations();
517
+ init_organizations();
518
+ init_sprints();
519
+ init_tasks();
520
+ init_workspaces();
521
+ });
522
+ init_src();