@locusai/sdk 0.16.1 → 0.18.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.
Files changed (133) hide show
  1. package/PACKAGE_GUIDE.md +269 -0
  2. package/package.json +28 -28
  3. package/dist/agent/codebase-indexer-service.d.ts +0 -17
  4. package/dist/agent/codebase-indexer-service.d.ts.map +0 -1
  5. package/dist/agent/document-fetcher.d.ts +0 -23
  6. package/dist/agent/document-fetcher.d.ts.map +0 -1
  7. package/dist/agent/git-workflow.d.ts +0 -59
  8. package/dist/agent/git-workflow.d.ts.map +0 -1
  9. package/dist/agent/index.d.ts +0 -9
  10. package/dist/agent/index.d.ts.map +0 -1
  11. package/dist/agent/review-service.d.ts +0 -21
  12. package/dist/agent/review-service.d.ts.map +0 -1
  13. package/dist/agent/reviewer-worker.d.ts +0 -41
  14. package/dist/agent/reviewer-worker.d.ts.map +0 -1
  15. package/dist/agent/task-executor.d.ts +0 -26
  16. package/dist/agent/task-executor.d.ts.map +0 -1
  17. package/dist/agent/worker-cli.d.ts +0 -6
  18. package/dist/agent/worker-cli.d.ts.map +0 -1
  19. package/dist/agent/worker-types.d.ts +0 -36
  20. package/dist/agent/worker-types.d.ts.map +0 -1
  21. package/dist/agent/worker.d.ts +0 -39
  22. package/dist/agent/worker.d.ts.map +0 -1
  23. package/dist/agent/worker.js +0 -2837
  24. package/dist/ai/__tests__/factory.test.d.ts +0 -2
  25. package/dist/ai/__tests__/factory.test.d.ts.map +0 -1
  26. package/dist/ai/claude-runner.d.ts +0 -42
  27. package/dist/ai/claude-runner.d.ts.map +0 -1
  28. package/dist/ai/codex-runner.d.ts +0 -38
  29. package/dist/ai/codex-runner.d.ts.map +0 -1
  30. package/dist/ai/factory.d.ts +0 -15
  31. package/dist/ai/factory.d.ts.map +0 -1
  32. package/dist/ai/index.d.ts +0 -6
  33. package/dist/ai/index.d.ts.map +0 -1
  34. package/dist/ai/runner.d.ts +0 -23
  35. package/dist/ai/runner.d.ts.map +0 -1
  36. package/dist/core/config.d.ts +0 -58
  37. package/dist/core/config.d.ts.map +0 -1
  38. package/dist/core/index.d.ts +0 -4
  39. package/dist/core/index.d.ts.map +0 -1
  40. package/dist/core/indexer.d.ts +0 -31
  41. package/dist/core/indexer.d.ts.map +0 -1
  42. package/dist/core/prompt-builder.d.ts +0 -14
  43. package/dist/core/prompt-builder.d.ts.map +0 -1
  44. package/dist/discussion/agents/facilitator-prompt.d.ts +0 -13
  45. package/dist/discussion/agents/facilitator-prompt.d.ts.map +0 -1
  46. package/dist/discussion/discussion-facilitator.d.ts +0 -67
  47. package/dist/discussion/discussion-facilitator.d.ts.map +0 -1
  48. package/dist/discussion/discussion-manager.d.ts +0 -59
  49. package/dist/discussion/discussion-manager.d.ts.map +0 -1
  50. package/dist/discussion/discussion-types.d.ts +0 -89
  51. package/dist/discussion/discussion-types.d.ts.map +0 -1
  52. package/dist/discussion/index.d.ts +0 -5
  53. package/dist/discussion/index.d.ts.map +0 -1
  54. package/dist/events.d.ts +0 -22
  55. package/dist/events.d.ts.map +0 -1
  56. package/dist/exec/context-tracker.d.ts +0 -183
  57. package/dist/exec/context-tracker.d.ts.map +0 -1
  58. package/dist/exec/event-emitter.d.ts +0 -117
  59. package/dist/exec/event-emitter.d.ts.map +0 -1
  60. package/dist/exec/events.d.ts +0 -171
  61. package/dist/exec/events.d.ts.map +0 -1
  62. package/dist/exec/exec-session.d.ts +0 -164
  63. package/dist/exec/exec-session.d.ts.map +0 -1
  64. package/dist/exec/history-manager.d.ts +0 -153
  65. package/dist/exec/history-manager.d.ts.map +0 -1
  66. package/dist/exec/index.d.ts +0 -7
  67. package/dist/exec/index.d.ts.map +0 -1
  68. package/dist/exec/types.d.ts +0 -130
  69. package/dist/exec/types.d.ts.map +0 -1
  70. package/dist/git/git-utils.d.ts +0 -31
  71. package/dist/git/git-utils.d.ts.map +0 -1
  72. package/dist/git/index.d.ts +0 -3
  73. package/dist/git/index.d.ts.map +0 -1
  74. package/dist/git/pr-service.d.ts +0 -66
  75. package/dist/git/pr-service.d.ts.map +0 -1
  76. package/dist/index-node.d.ts +0 -22
  77. package/dist/index-node.d.ts.map +0 -1
  78. package/dist/index-node.js +0 -5662
  79. package/dist/index.d.ts +0 -40
  80. package/dist/index.d.ts.map +0 -1
  81. package/dist/index.js +0 -618
  82. package/dist/modules/auth.d.ts +0 -23
  83. package/dist/modules/auth.d.ts.map +0 -1
  84. package/dist/modules/base.d.ts +0 -8
  85. package/dist/modules/base.d.ts.map +0 -1
  86. package/dist/modules/ci.d.ts +0 -8
  87. package/dist/modules/ci.d.ts.map +0 -1
  88. package/dist/modules/docs.d.ts +0 -14
  89. package/dist/modules/docs.d.ts.map +0 -1
  90. package/dist/modules/instances.d.ts +0 -46
  91. package/dist/modules/instances.d.ts.map +0 -1
  92. package/dist/modules/invitations.d.ts +0 -10
  93. package/dist/modules/invitations.d.ts.map +0 -1
  94. package/dist/modules/organizations.d.ts +0 -24
  95. package/dist/modules/organizations.d.ts.map +0 -1
  96. package/dist/modules/sprints.d.ts +0 -14
  97. package/dist/modules/sprints.d.ts.map +0 -1
  98. package/dist/modules/tasks.d.ts +0 -25
  99. package/dist/modules/tasks.d.ts.map +0 -1
  100. package/dist/modules/workspaces.d.ts +0 -59
  101. package/dist/modules/workspaces.d.ts.map +0 -1
  102. package/dist/orchestrator/index.d.ts +0 -85
  103. package/dist/orchestrator/index.d.ts.map +0 -1
  104. package/dist/orchestrator/types.d.ts +0 -36
  105. package/dist/orchestrator/types.d.ts.map +0 -1
  106. package/dist/planning/agents/architect.d.ts +0 -1
  107. package/dist/planning/agents/architect.d.ts.map +0 -1
  108. package/dist/planning/agents/cross-task-reviewer.d.ts +0 -1
  109. package/dist/planning/agents/cross-task-reviewer.d.ts.map +0 -1
  110. package/dist/planning/agents/planner.d.ts +0 -20
  111. package/dist/planning/agents/planner.d.ts.map +0 -1
  112. package/dist/planning/agents/sprint-organizer.d.ts +0 -1
  113. package/dist/planning/agents/sprint-organizer.d.ts.map +0 -1
  114. package/dist/planning/agents/tech-lead.d.ts +0 -1
  115. package/dist/planning/agents/tech-lead.d.ts.map +0 -1
  116. package/dist/planning/index.d.ts +0 -4
  117. package/dist/planning/index.d.ts.map +0 -1
  118. package/dist/planning/plan-manager.d.ts +0 -51
  119. package/dist/planning/plan-manager.d.ts.map +0 -1
  120. package/dist/planning/planning-meeting.d.ts +0 -33
  121. package/dist/planning/planning-meeting.d.ts.map +0 -1
  122. package/dist/planning/sprint-plan.d.ts +0 -51
  123. package/dist/planning/sprint-plan.d.ts.map +0 -1
  124. package/dist/utils/colors.d.ts +0 -62
  125. package/dist/utils/colors.d.ts.map +0 -1
  126. package/dist/utils/json-extractor.d.ts +0 -10
  127. package/dist/utils/json-extractor.d.ts.map +0 -1
  128. package/dist/utils/resolve-bin.d.ts +0 -15
  129. package/dist/utils/resolve-bin.d.ts.map +0 -1
  130. package/dist/utils/retry.d.ts +0 -8
  131. package/dist/utils/retry.d.ts.map +0 -1
  132. package/dist/utils/structured-output.d.ts +0 -14
  133. package/dist/utils/structured-output.d.ts.map +0 -1
package/dist/index.d.ts DELETED
@@ -1,40 +0,0 @@
1
- import { LocusConfig, LocusEmitter } from "./events.js";
2
- import { AuthModule } from "./modules/auth.js";
3
- import { CiModule } from "./modules/ci.js";
4
- import { DocsModule } from "./modules/docs.js";
5
- import { InstancesModule } from "./modules/instances.js";
6
- import { InvitationsModule } from "./modules/invitations.js";
7
- import { OrganizationsModule } from "./modules/organizations.js";
8
- import { SprintsModule } from "./modules/sprints.js";
9
- import { TasksModule } from "./modules/tasks.js";
10
- import { WorkspacesModule } from "./modules/workspaces.js";
11
- export type { Discussion, DiscussionInsight, DiscussionMessage, } from "./discussion/discussion-types.js";
12
- export { DiscussionInsightSchema, DiscussionMessageSchema, DiscussionSchema, } from "./discussion/discussion-types.js";
13
- export * from "./events.js";
14
- export * from "./modules/auth.js";
15
- export * from "./modules/ci.js";
16
- export * from "./modules/docs.js";
17
- export * from "./modules/instances.js";
18
- export * from "./modules/invitations.js";
19
- export * from "./modules/organizations.js";
20
- export * from "./modules/sprints.js";
21
- export * from "./modules/tasks.js";
22
- export * from "./modules/workspaces.js";
23
- export declare class LocusClient {
24
- private readonly api;
25
- readonly emitter: LocusEmitter;
26
- readonly auth: AuthModule;
27
- readonly tasks: TasksModule;
28
- readonly sprints: SprintsModule;
29
- readonly workspaces: WorkspacesModule;
30
- readonly organizations: OrganizationsModule;
31
- readonly invitations: InvitationsModule;
32
- readonly docs: DocsModule;
33
- readonly ci: CiModule;
34
- readonly instances: InstancesModule;
35
- constructor(config: LocusConfig);
36
- private setupRetryInterceptor;
37
- private setupInterceptors;
38
- setToken(token: string | null): void;
39
- }
40
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAc,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAI3D,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,kCAAkC,CAAC;AAE1C,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AAExC,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgB;IACpC,SAAgB,OAAO,EAAE,YAAY,CAAC;IAEtC,SAAgB,IAAI,EAAE,UAAU,CAAC;IACjC,SAAgB,KAAK,EAAE,WAAW,CAAC;IACnC,SAAgB,OAAO,EAAE,aAAa,CAAC;IACvC,SAAgB,UAAU,EAAE,gBAAgB,CAAC;IAC7C,SAAgB,aAAa,EAAE,mBAAmB,CAAC;IACnD,SAAgB,WAAW,EAAE,iBAAiB,CAAC;IAC/C,SAAgB,IAAI,EAAE,UAAU,CAAC;IACjC,SAAgB,EAAE,EAAE,QAAQ,CAAC;IAC7B,SAAgB,SAAS,EAAE,eAAe,CAAC;gBAE/B,MAAM,EAAE,WAAW;IA8B/B,OAAO,CAAC,qBAAqB;IAmC7B,OAAO,CAAC,iBAAiB;IAmDlB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAOrC"}
package/dist/index.js DELETED
@@ -1,618 +0,0 @@
1
- var __create = Object.create;
2
- var __getProtoOf = Object.getPrototypeOf;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __toESM = (mod, isNodeMode, target) => {
8
- target = mod != null ? __create(__getProtoOf(mod)) : {};
9
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
- for (let key of __getOwnPropNames(mod))
11
- if (!__hasOwnProp.call(to, key))
12
- __defProp(to, key, {
13
- get: () => mod[key],
14
- enumerable: true
15
- });
16
- return to;
17
- };
18
- var __moduleCache = /* @__PURE__ */ new WeakMap;
19
- var __toCommonJS = (from) => {
20
- var entry = __moduleCache.get(from), desc;
21
- if (entry)
22
- return entry;
23
- entry = __defProp({}, "__esModule", { value: true });
24
- if (from && typeof from === "object" || typeof from === "function")
25
- __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
26
- get: () => from[key],
27
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
28
- }));
29
- __moduleCache.set(from, entry);
30
- return entry;
31
- };
32
- var __export = (target, all) => {
33
- for (var name in all)
34
- __defProp(target, name, {
35
- get: all[name],
36
- enumerable: true,
37
- configurable: true,
38
- set: (newValue) => all[name] = () => newValue
39
- });
40
- };
41
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
42
-
43
- // src/events.ts
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
- });
61
-
62
- // src/modules/base.ts
63
- class BaseModule {
64
- api;
65
- emitter;
66
- constructor(api, emitter) {
67
- this.api = api;
68
- this.emitter = emitter;
69
- }
70
- }
71
-
72
- // src/modules/auth.ts
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
- });
106
-
107
- // src/modules/ci.ts
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
- });
117
-
118
- // src/modules/docs.ts
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
- });
158
-
159
- // src/modules/instances.ts
160
- var InstancesModule;
161
- var init_instances = __esm(() => {
162
- InstancesModule = class InstancesModule extends BaseModule {
163
- async list(workspaceId) {
164
- const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-instances`);
165
- return data.instances;
166
- }
167
- async get(workspaceId, instanceId) {
168
- const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-instances/${instanceId}`);
169
- return data.instance;
170
- }
171
- async provision(workspaceId, body) {
172
- const { data } = await this.api.post(`/workspaces/${workspaceId}/aws-instances`, body);
173
- return data.instance;
174
- }
175
- async performAction(workspaceId, instanceId, action) {
176
- const { data } = await this.api.post(`/workspaces/${workspaceId}/aws-instances/${instanceId}/actions`, { action });
177
- return data.instance;
178
- }
179
- async sync(workspaceId, instanceId) {
180
- const { data } = await this.api.post(`/workspaces/${workspaceId}/aws-instances/${instanceId}/sync`);
181
- return data.instance;
182
- }
183
- async checkUpdates(workspaceId, instanceId) {
184
- const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-instances/${instanceId}/updates`);
185
- return data.update;
186
- }
187
- async applyUpdate(workspaceId, instanceId) {
188
- const { data } = await this.api.post(`/workspaces/${workspaceId}/aws-instances/${instanceId}/updates`);
189
- return data.update;
190
- }
191
- async getSecurity(workspaceId, instanceId) {
192
- const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-instances/${instanceId}/security`);
193
- return data.rules;
194
- }
195
- async updateSecurity(workspaceId, instanceId, body) {
196
- const { data } = await this.api.put(`/workspaces/${workspaceId}/aws-instances/${instanceId}/security`, body);
197
- return data.rules;
198
- }
199
- };
200
- });
201
-
202
- // src/modules/invitations.ts
203
- var InvitationsModule;
204
- var init_invitations = __esm(() => {
205
- InvitationsModule = class InvitationsModule extends BaseModule {
206
- async create(orgId, body) {
207
- const { data } = await this.api.post(`/org/${orgId}/invitations`, body);
208
- return data.invitation;
209
- }
210
- async list(orgId) {
211
- const { data } = await this.api.get(`/org/${orgId}/invitations`);
212
- return data.invitations;
213
- }
214
- async verify(token) {
215
- const { data } = await this.api.get(`/invitations/verify/${token}`);
216
- return data;
217
- }
218
- async accept(body) {
219
- const { data } = await this.api.post("/invitations/accept", body);
220
- return data;
221
- }
222
- async revoke(orgId, id) {
223
- await this.api.delete(`/org/${orgId}/invitations/${id}`);
224
- }
225
- };
226
- });
227
-
228
- // src/modules/organizations.ts
229
- var OrganizationsModule;
230
- var init_organizations = __esm(() => {
231
- OrganizationsModule = class OrganizationsModule extends BaseModule {
232
- async list() {
233
- const { data } = await this.api.get("/organizations");
234
- return data.organizations;
235
- }
236
- async getById(id) {
237
- const { data } = await this.api.get(`/organizations/${id}`);
238
- return data.organization;
239
- }
240
- async listMembers(id) {
241
- const { data } = await this.api.get(`/organizations/${id}/members`);
242
- return data.members;
243
- }
244
- async addMember(id, body) {
245
- const { data } = await this.api.post(`/organizations/${id}/members`, body);
246
- return data.membership;
247
- }
248
- async removeMember(orgId, userId) {
249
- await this.api.delete(`/organizations/${orgId}/members/${userId}`);
250
- }
251
- async delete(orgId) {
252
- await this.api.delete(`/organizations/${orgId}`);
253
- }
254
- async listApiKeys(orgId) {
255
- const { data } = await this.api.get(`/organizations/${orgId}/api-keys`);
256
- return data.apiKeys;
257
- }
258
- async createApiKey(orgId, name) {
259
- const { data } = await this.api.post(`/organizations/${orgId}/api-keys`, { name });
260
- return data.apiKey;
261
- }
262
- async deleteApiKey(orgId, keyId) {
263
- await this.api.delete(`/organizations/${orgId}/api-keys/${keyId}`);
264
- }
265
- };
266
- });
267
-
268
- // src/modules/sprints.ts
269
- var SprintsModule;
270
- var init_sprints = __esm(() => {
271
- SprintsModule = class SprintsModule extends BaseModule {
272
- async list(workspaceId) {
273
- const { data } = await this.api.get(`/workspaces/${workspaceId}/sprints`);
274
- return data.sprints;
275
- }
276
- async getActive(workspaceId) {
277
- const { data } = await this.api.get(`/workspaces/${workspaceId}/sprints/active`);
278
- return data.sprint;
279
- }
280
- async getById(id, workspaceId) {
281
- const { data } = await this.api.get(`/workspaces/${workspaceId}/sprints/${id}`);
282
- return data.sprint;
283
- }
284
- async create(workspaceId, body) {
285
- const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints`, body);
286
- return data.sprint;
287
- }
288
- async update(id, workspaceId, body) {
289
- const { data } = await this.api.patch(`/workspaces/${workspaceId}/sprints/${id}`, body);
290
- return data.sprint;
291
- }
292
- async delete(id, workspaceId) {
293
- await this.api.delete(`/workspaces/${workspaceId}/sprints/${id}`);
294
- }
295
- async start(id, workspaceId) {
296
- const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints/${id}/start`);
297
- return data.sprint;
298
- }
299
- async complete(id, workspaceId) {
300
- const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints/${id}/complete`);
301
- return data.sprint;
302
- }
303
- async triggerAIPlanning(id, workspaceId) {
304
- const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints/${id}/trigger-ai-planning`);
305
- return data.sprint;
306
- }
307
- };
308
- });
309
-
310
- // src/modules/tasks.ts
311
- var import_shared, TasksModule;
312
- var init_tasks = __esm(() => {
313
- import_shared = require("@locusai/shared");
314
- TasksModule = class TasksModule extends BaseModule {
315
- async list(workspaceId, options) {
316
- const { data } = await this.api.get(`/workspaces/${workspaceId}/tasks`);
317
- let tasks = data.tasks;
318
- if (options?.sprintId) {
319
- tasks = tasks.filter((t) => t.sprintId === options.sprintId);
320
- }
321
- if (options?.status) {
322
- const statuses = Array.isArray(options.status) ? options.status : [options.status];
323
- tasks = tasks.filter((t) => statuses.includes(t.status));
324
- }
325
- return tasks;
326
- }
327
- async getAvailable(workspaceId, sprintId) {
328
- const tasks = await this.list(workspaceId, {
329
- sprintId
330
- });
331
- return tasks.filter((t) => t.status === import_shared.TaskStatus.BACKLOG || t.status === import_shared.TaskStatus.IN_PROGRESS && !t.assignedTo);
332
- }
333
- async getById(id, workspaceId) {
334
- const { data } = await this.api.get(`/workspaces/${workspaceId}/tasks/${id}`);
335
- return data.task;
336
- }
337
- async create(workspaceId, body) {
338
- const { data } = await this.api.post(`/workspaces/${workspaceId}/tasks`, body);
339
- return data.task;
340
- }
341
- async update(id, workspaceId, body) {
342
- const { data } = await this.api.patch(`/workspaces/${workspaceId}/tasks/${id}`, body);
343
- return data.task;
344
- }
345
- async delete(id, workspaceId) {
346
- await this.api.delete(`/workspaces/${workspaceId}/tasks/${id}`);
347
- }
348
- async getBacklog(workspaceId) {
349
- const { data } = await this.api.get(`/workspaces/${workspaceId}/tasks/backlog`);
350
- return data.tasks;
351
- }
352
- async addComment(id, workspaceId, body) {
353
- const { data } = await this.api.post(`/workspaces/${workspaceId}/tasks/${id}/comment`, body);
354
- return data.comment;
355
- }
356
- async batchUpdate(ids, workspaceId, updates) {
357
- await this.api.patch(`/workspaces/${workspaceId}/tasks/batch`, {
358
- ids,
359
- updates
360
- });
361
- }
362
- };
363
- });
364
-
365
- // src/modules/workspaces.ts
366
- var WorkspacesModule;
367
- var init_workspaces = __esm(() => {
368
- WorkspacesModule = class WorkspacesModule extends BaseModule {
369
- async listAll() {
370
- const { data } = await this.api.get("/workspaces");
371
- return data.workspaces;
372
- }
373
- async listByOrg(orgId) {
374
- const { data } = await this.api.get(`/workspaces/org/${orgId}`);
375
- return data.workspaces;
376
- }
377
- async create(body) {
378
- const { orgId, ...bodyWithoutOrgId } = body;
379
- const { data } = await this.api.post(`/workspaces/org/${orgId}`, bodyWithoutOrgId);
380
- return data.workspace;
381
- }
382
- async createWithAutoOrg(body) {
383
- const { data } = await this.api.post("/workspaces", body);
384
- return data.workspace;
385
- }
386
- async getById(id) {
387
- const { data } = await this.api.get(`/workspaces/${id}`);
388
- return data.workspace;
389
- }
390
- async update(id, body) {
391
- const { data } = await this.api.put(`/workspaces/${id}`, body);
392
- return data.workspace;
393
- }
394
- async delete(id) {
395
- await this.api.delete(`/workspaces/${id}`);
396
- }
397
- async getStats(id) {
398
- const { data } = await this.api.get(`/workspaces/${id}/stats`);
399
- return data;
400
- }
401
- async getActivity(id, limit) {
402
- const { data } = await this.api.get(`/workspaces/${id}/activity`, {
403
- params: { limit }
404
- });
405
- return data.activity;
406
- }
407
- async dispatch(id, workerId, sprintId) {
408
- const { data } = await this.api.post(`/workspaces/${id}/dispatch`, { workerId, sprintId });
409
- return data.task;
410
- }
411
- async heartbeat(workspaceId, agentId, currentTaskId, status) {
412
- const { data } = await this.api.post(`/workspaces/${workspaceId}/agents/heartbeat`, {
413
- agentId,
414
- currentTaskId: currentTaskId ?? null,
415
- status: status ?? "WORKING"
416
- });
417
- return data.agent;
418
- }
419
- async getAgents(workspaceId) {
420
- const { data } = await this.api.get(`/workspaces/${workspaceId}/agents`);
421
- return data.agents;
422
- }
423
- async listApiKeys(workspaceId) {
424
- const { data } = await this.api.get(`/workspaces/${workspaceId}/api-keys`);
425
- return data.apiKeys;
426
- }
427
- async createApiKey(workspaceId, name) {
428
- const { data } = await this.api.post(`/workspaces/${workspaceId}/api-keys`, { name });
429
- return data.apiKey;
430
- }
431
- async deleteApiKey(workspaceId, keyId) {
432
- await this.api.delete(`/workspaces/${workspaceId}/api-keys/${keyId}`);
433
- }
434
- async getAwsCredentials(workspaceId) {
435
- const { data } = await this.api.get(`/workspaces/${workspaceId}/aws-credentials`);
436
- return data.credential;
437
- }
438
- async saveAwsCredentials(workspaceId, body) {
439
- const { data } = await this.api.put(`/workspaces/${workspaceId}/aws-credentials`, body);
440
- return data.credential;
441
- }
442
- async deleteAwsCredentials(workspaceId) {
443
- await this.api.delete(`/workspaces/${workspaceId}/aws-credentials`);
444
- }
445
- };
446
- });
447
-
448
- // src/discussion/discussion-types.ts
449
- var import_zod, DiscussionMessageSchema, DiscussionInsightSchema, DiscussionSchema;
450
- var init_discussion_types = __esm(() => {
451
- import_zod = require("zod");
452
- DiscussionMessageSchema = import_zod.z.object({
453
- role: import_zod.z.enum(["user", "assistant"]),
454
- content: import_zod.z.string(),
455
- timestamp: import_zod.z.number()
456
- });
457
- DiscussionInsightSchema = import_zod.z.object({
458
- id: import_zod.z.string(),
459
- type: import_zod.z.enum(["decision", "requirement", "idea", "concern", "learning"]),
460
- title: import_zod.z.string(),
461
- content: import_zod.z.string(),
462
- tags: import_zod.z.array(import_zod.z.string()).default([]),
463
- createdAt: import_zod.z.string()
464
- });
465
- DiscussionSchema = import_zod.z.object({
466
- id: import_zod.z.string(),
467
- title: import_zod.z.string(),
468
- topic: import_zod.z.string(),
469
- status: import_zod.z.enum(["active", "completed", "archived"]).default("active"),
470
- messages: import_zod.z.array(DiscussionMessageSchema).default([]),
471
- insights: import_zod.z.array(DiscussionInsightSchema).default([]),
472
- createdAt: import_zod.z.string(),
473
- updatedAt: import_zod.z.string(),
474
- metadata: import_zod.z.object({
475
- model: import_zod.z.string(),
476
- provider: import_zod.z.string()
477
- })
478
- });
479
- });
480
-
481
- // src/index.ts
482
- var exports_src = {};
483
- __export(exports_src, {
484
- WorkspacesModule: () => WorkspacesModule,
485
- TasksModule: () => TasksModule,
486
- SprintsModule: () => SprintsModule,
487
- OrganizationsModule: () => OrganizationsModule,
488
- LocusEvent: () => LocusEvent,
489
- LocusEmitter: () => LocusEmitter,
490
- LocusClient: () => LocusClient,
491
- InvitationsModule: () => InvitationsModule,
492
- InstancesModule: () => InstancesModule,
493
- DocsModule: () => DocsModule,
494
- DiscussionSchema: () => DiscussionSchema,
495
- DiscussionMessageSchema: () => DiscussionMessageSchema,
496
- DiscussionInsightSchema: () => DiscussionInsightSchema,
497
- CiModule: () => CiModule,
498
- AuthModule: () => AuthModule
499
- });
500
- module.exports = __toCommonJS(exports_src);
501
-
502
- class LocusClient {
503
- api;
504
- emitter;
505
- auth;
506
- tasks;
507
- sprints;
508
- workspaces;
509
- organizations;
510
- invitations;
511
- docs;
512
- ci;
513
- instances;
514
- constructor(config) {
515
- this.emitter = new LocusEmitter;
516
- this.api = import_axios.default.create({
517
- baseURL: config.baseUrl,
518
- timeout: config.timeout || 60000,
519
- headers: {
520
- "Content-Type": "application/json",
521
- ...config.token ? { Authorization: `Bearer ${config.token}` } : {}
522
- }
523
- });
524
- this.setupInterceptors();
525
- this.auth = new AuthModule(this.api, this.emitter);
526
- this.tasks = new TasksModule(this.api, this.emitter);
527
- this.sprints = new SprintsModule(this.api, this.emitter);
528
- this.workspaces = new WorkspacesModule(this.api, this.emitter);
529
- this.organizations = new OrganizationsModule(this.api, this.emitter);
530
- this.invitations = new InvitationsModule(this.api, this.emitter);
531
- this.docs = new DocsModule(this.api, this.emitter);
532
- this.ci = new CiModule(this.api, this.emitter);
533
- this.instances = new InstancesModule(this.api, this.emitter);
534
- if (config.retryOptions) {
535
- this.setupRetryInterceptor(config.retryOptions);
536
- }
537
- }
538
- setupRetryInterceptor(retryOptions) {
539
- this.api.interceptors.response.use(undefined, async (error) => {
540
- const config = error.config;
541
- if (!config || !retryOptions) {
542
- return Promise.reject(error);
543
- }
544
- config._retryCount = config._retryCount || 0;
545
- const maxRetries = retryOptions.maxRetries ?? 3;
546
- const shouldRetry = config._retryCount < maxRetries && (retryOptions.retryCondition ? retryOptions.retryCondition(error) : !error.response || error.response.status >= 500);
547
- if (shouldRetry) {
548
- config._retryCount++;
549
- const delay = Math.min((retryOptions.initialDelay ?? 1000) * Math.pow(retryOptions.factor ?? 2, config._retryCount - 1), retryOptions.maxDelay ?? 5000);
550
- await new Promise((resolve) => setTimeout(resolve, delay));
551
- return this.api(config);
552
- }
553
- return Promise.reject(error);
554
- });
555
- }
556
- setupInterceptors() {
557
- this.api.interceptors.response.use((response) => {
558
- if (response.data && typeof response.data === "object" && "data" in response.data) {
559
- response.data = response.data.data;
560
- }
561
- return response;
562
- }, (error) => {
563
- const status = error.response?.status;
564
- let message;
565
- if (error.response?.data?.error?.message && typeof error.response.data.error.message === "string") {
566
- message = error.response.data.error.message;
567
- } else if (error.response?.data?.message && typeof error.response.data.message === "string") {
568
- message = error.response.data.message;
569
- } else if (error.message && typeof error.message === "string") {
570
- message = error.message;
571
- } else {
572
- message = "An error occurred";
573
- }
574
- const enhancedError = new Error(message);
575
- enhancedError.name = `HTTP${status || "Error"}`;
576
- if (status === 401) {
577
- this.emitter.emit("TOKEN_EXPIRED" /* TOKEN_EXPIRED */);
578
- this.emitter.emit("AUTH_ERROR" /* AUTH_ERROR */, enhancedError);
579
- } else {
580
- this.emitter.emit("REQUEST_ERROR" /* REQUEST_ERROR */, enhancedError);
581
- }
582
- return Promise.reject(enhancedError);
583
- });
584
- }
585
- setToken(token) {
586
- if (token) {
587
- this.api.defaults.headers.common.Authorization = `Bearer ${token}`;
588
- } else {
589
- delete this.api.defaults.headers.common.Authorization;
590
- }
591
- }
592
- }
593
- var import_axios;
594
- var init_src = __esm(() => {
595
- init_events();
596
- init_auth();
597
- init_ci();
598
- init_docs();
599
- init_instances();
600
- init_invitations();
601
- init_organizations();
602
- init_sprints();
603
- init_tasks();
604
- init_workspaces();
605
- init_discussion_types();
606
- import_axios = __toESM(require("axios"));
607
- init_events();
608
- init_auth();
609
- init_ci();
610
- init_docs();
611
- init_instances();
612
- init_invitations();
613
- init_organizations();
614
- init_sprints();
615
- init_tasks();
616
- init_workspaces();
617
- });
618
- init_src();
@@ -1,23 +0,0 @@
1
- import { CompleteRegistration, LoginResponse, User, VerifyOtp } from "@locusai/shared";
2
- import { BaseModule } from "./base.js";
3
- export declare class AuthModule extends BaseModule {
4
- getProfile(): Promise<User>;
5
- getApiKeyInfo(): Promise<{
6
- authType: string;
7
- workspaceId?: string;
8
- orgId?: string;
9
- apiKeyName: string;
10
- }>;
11
- requestRegisterOtp(email: string): Promise<{
12
- success: boolean;
13
- }>;
14
- requestLoginOtp(email: string): Promise<{
15
- success: boolean;
16
- }>;
17
- verifyLogin(body: VerifyOtp): Promise<LoginResponse>;
18
- completeRegistration(body: CompleteRegistration): Promise<LoginResponse>;
19
- deleteAccount(): Promise<{
20
- success: boolean;
21
- }>;
22
- }
23
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/modules/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,IAAI,EACJ,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,qBAAa,UAAW,SAAQ,UAAU;IAClC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAK3B,aAAa,IAAI,OAAO,CAAC;QAC7B,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IAKI,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAQhE,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAQ7D,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC;IAQpD,oBAAoB,CACxB,IAAI,EAAE,oBAAoB,GACzB,OAAO,CAAC,aAAa,CAAC;IAQnB,aAAa,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CAMrD"}