@locusai/sdk 0.16.2 → 0.18.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 (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 -42
  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 -40
  22. package/dist/agent/worker.d.ts.map +0 -1
  23. package/dist/agent/worker.js +0 -2792
  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 -35
  27. package/dist/ai/claude-runner.d.ts.map +0 -1
  28. package/dist/ai/claude-stream-parser.d.ts +0 -41
  29. package/dist/ai/claude-stream-parser.d.ts.map +0 -1
  30. package/dist/ai/codex-runner.d.ts +0 -38
  31. package/dist/ai/codex-runner.d.ts.map +0 -1
  32. package/dist/ai/factory.d.ts +0 -26
  33. package/dist/ai/factory.d.ts.map +0 -1
  34. package/dist/ai/index.d.ts +0 -8
  35. package/dist/ai/index.d.ts.map +0 -1
  36. package/dist/ai/runner.d.ts +0 -23
  37. package/dist/ai/runner.d.ts.map +0 -1
  38. package/dist/core/config.d.ts +0 -58
  39. package/dist/core/config.d.ts.map +0 -1
  40. package/dist/core/index.d.ts +0 -4
  41. package/dist/core/index.d.ts.map +0 -1
  42. package/dist/core/indexer.d.ts +0 -31
  43. package/dist/core/indexer.d.ts.map +0 -1
  44. package/dist/core/prompt-builder.d.ts +0 -14
  45. package/dist/core/prompt-builder.d.ts.map +0 -1
  46. package/dist/discussion/agents/facilitator-prompt.d.ts +0 -13
  47. package/dist/discussion/agents/facilitator-prompt.d.ts.map +0 -1
  48. package/dist/discussion/discussion-facilitator.d.ts +0 -67
  49. package/dist/discussion/discussion-facilitator.d.ts.map +0 -1
  50. package/dist/discussion/discussion-manager.d.ts +0 -59
  51. package/dist/discussion/discussion-manager.d.ts.map +0 -1
  52. package/dist/discussion/discussion-types.d.ts +0 -89
  53. package/dist/discussion/discussion-types.d.ts.map +0 -1
  54. package/dist/discussion/index.d.ts +0 -5
  55. package/dist/discussion/index.d.ts.map +0 -1
  56. package/dist/events.d.ts +0 -22
  57. package/dist/events.d.ts.map +0 -1
  58. package/dist/exec/context-tracker.d.ts +0 -183
  59. package/dist/exec/context-tracker.d.ts.map +0 -1
  60. package/dist/exec/event-emitter.d.ts +0 -117
  61. package/dist/exec/event-emitter.d.ts.map +0 -1
  62. package/dist/exec/events.d.ts +0 -171
  63. package/dist/exec/events.d.ts.map +0 -1
  64. package/dist/exec/exec-session.d.ts +0 -164
  65. package/dist/exec/exec-session.d.ts.map +0 -1
  66. package/dist/exec/history-manager.d.ts +0 -153
  67. package/dist/exec/history-manager.d.ts.map +0 -1
  68. package/dist/exec/index.d.ts +0 -7
  69. package/dist/exec/index.d.ts.map +0 -1
  70. package/dist/exec/types.d.ts +0 -130
  71. package/dist/exec/types.d.ts.map +0 -1
  72. package/dist/git/git-utils.d.ts +0 -31
  73. package/dist/git/git-utils.d.ts.map +0 -1
  74. package/dist/git/index.d.ts +0 -3
  75. package/dist/git/index.d.ts.map +0 -1
  76. package/dist/git/pr-service.d.ts +0 -66
  77. package/dist/git/pr-service.d.ts.map +0 -1
  78. package/dist/index-node.d.ts +0 -22
  79. package/dist/index-node.d.ts.map +0 -1
  80. package/dist/index-node.js +0 -5607
  81. package/dist/index.d.ts +0 -37
  82. package/dist/index.d.ts.map +0 -1
  83. package/dist/index.js +0 -559
  84. package/dist/modules/auth.d.ts +0 -23
  85. package/dist/modules/auth.d.ts.map +0 -1
  86. package/dist/modules/base.d.ts +0 -8
  87. package/dist/modules/base.d.ts.map +0 -1
  88. package/dist/modules/ci.d.ts +0 -8
  89. package/dist/modules/ci.d.ts.map +0 -1
  90. package/dist/modules/docs.d.ts +0 -14
  91. package/dist/modules/docs.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 -44
  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 -34
  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,37 +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 { InvitationsModule } from "./modules/invitations.js";
6
- import { OrganizationsModule } from "./modules/organizations.js";
7
- import { SprintsModule } from "./modules/sprints.js";
8
- import { TasksModule } from "./modules/tasks.js";
9
- import { WorkspacesModule } from "./modules/workspaces.js";
10
- export type { Discussion, DiscussionInsight, DiscussionMessage, } from "./discussion/discussion-types.js";
11
- export { DiscussionInsightSchema, DiscussionMessageSchema, DiscussionSchema, } from "./discussion/discussion-types.js";
12
- export * from "./events.js";
13
- export * from "./modules/auth.js";
14
- export * from "./modules/ci.js";
15
- export * from "./modules/docs.js";
16
- export * from "./modules/invitations.js";
17
- export * from "./modules/organizations.js";
18
- export * from "./modules/sprints.js";
19
- export * from "./modules/tasks.js";
20
- export * from "./modules/workspaces.js";
21
- export declare class LocusClient {
22
- private readonly api;
23
- readonly emitter: LocusEmitter;
24
- readonly auth: AuthModule;
25
- readonly tasks: TasksModule;
26
- readonly sprints: SprintsModule;
27
- readonly workspaces: WorkspacesModule;
28
- readonly organizations: OrganizationsModule;
29
- readonly invitations: InvitationsModule;
30
- readonly docs: DocsModule;
31
- readonly ci: CiModule;
32
- constructor(config: LocusConfig);
33
- private setupRetryInterceptor;
34
- private setupInterceptors;
35
- setToken(token: string | null): void;
36
- }
37
- //# 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,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,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;gBAEjB,MAAM,EAAE,WAAW;IA6B/B,OAAO,CAAC,qBAAqB;IAmC7B,OAAO,CAAC,iBAAiB;IAmDlB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAOrC"}
package/dist/index.js DELETED
@@ -1,559 +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/invitations.ts
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
- });
184
-
185
- // src/modules/organizations.ts
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
- });
224
-
225
- // src/modules/sprints.ts
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
- });
266
-
267
- // src/modules/tasks.ts
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
- });
321
-
322
- // src/modules/workspaces.ts
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
- });
393
-
394
- // src/discussion/discussion-types.ts
395
- var import_zod, DiscussionMessageSchema, DiscussionInsightSchema, DiscussionSchema;
396
- var init_discussion_types = __esm(() => {
397
- import_zod = require("zod");
398
- DiscussionMessageSchema = import_zod.z.object({
399
- role: import_zod.z.enum(["user", "assistant"]),
400
- content: import_zod.z.string(),
401
- timestamp: import_zod.z.number()
402
- });
403
- DiscussionInsightSchema = import_zod.z.object({
404
- id: import_zod.z.string(),
405
- type: import_zod.z.enum(["decision", "requirement", "idea", "concern", "learning"]),
406
- title: import_zod.z.string(),
407
- content: import_zod.z.string(),
408
- tags: import_zod.z.array(import_zod.z.string()).default([]),
409
- createdAt: import_zod.z.string()
410
- });
411
- DiscussionSchema = import_zod.z.object({
412
- id: import_zod.z.string(),
413
- title: import_zod.z.string(),
414
- topic: import_zod.z.string(),
415
- status: import_zod.z.enum(["active", "completed", "archived"]).default("active"),
416
- messages: import_zod.z.array(DiscussionMessageSchema).default([]),
417
- insights: import_zod.z.array(DiscussionInsightSchema).default([]),
418
- createdAt: import_zod.z.string(),
419
- updatedAt: import_zod.z.string(),
420
- metadata: import_zod.z.object({
421
- model: import_zod.z.string(),
422
- provider: import_zod.z.string()
423
- })
424
- });
425
- });
426
-
427
- // src/index.ts
428
- var exports_src = {};
429
- __export(exports_src, {
430
- WorkspacesModule: () => WorkspacesModule,
431
- TasksModule: () => TasksModule,
432
- SprintsModule: () => SprintsModule,
433
- OrganizationsModule: () => OrganizationsModule,
434
- LocusEvent: () => LocusEvent,
435
- LocusEmitter: () => LocusEmitter,
436
- LocusClient: () => LocusClient,
437
- InvitationsModule: () => InvitationsModule,
438
- DocsModule: () => DocsModule,
439
- DiscussionSchema: () => DiscussionSchema,
440
- DiscussionMessageSchema: () => DiscussionMessageSchema,
441
- DiscussionInsightSchema: () => DiscussionInsightSchema,
442
- CiModule: () => CiModule,
443
- AuthModule: () => AuthModule
444
- });
445
- module.exports = __toCommonJS(exports_src);
446
-
447
- class LocusClient {
448
- api;
449
- emitter;
450
- auth;
451
- tasks;
452
- sprints;
453
- workspaces;
454
- organizations;
455
- invitations;
456
- docs;
457
- ci;
458
- constructor(config) {
459
- this.emitter = new LocusEmitter;
460
- this.api = import_axios.default.create({
461
- baseURL: config.baseUrl,
462
- timeout: config.timeout || 60000,
463
- headers: {
464
- "Content-Type": "application/json",
465
- ...config.token ? { Authorization: `Bearer ${config.token}` } : {}
466
- }
467
- });
468
- this.setupInterceptors();
469
- this.auth = new AuthModule(this.api, this.emitter);
470
- this.tasks = new TasksModule(this.api, this.emitter);
471
- this.sprints = new SprintsModule(this.api, this.emitter);
472
- this.workspaces = new WorkspacesModule(this.api, this.emitter);
473
- this.organizations = new OrganizationsModule(this.api, this.emitter);
474
- this.invitations = new InvitationsModule(this.api, this.emitter);
475
- this.docs = new DocsModule(this.api, this.emitter);
476
- this.ci = new CiModule(this.api, this.emitter);
477
- if (config.retryOptions) {
478
- this.setupRetryInterceptor(config.retryOptions);
479
- }
480
- }
481
- setupRetryInterceptor(retryOptions) {
482
- this.api.interceptors.response.use(undefined, async (error) => {
483
- const config = error.config;
484
- if (!config || !retryOptions) {
485
- return Promise.reject(error);
486
- }
487
- config._retryCount = config._retryCount || 0;
488
- const maxRetries = retryOptions.maxRetries ?? 3;
489
- const shouldRetry = config._retryCount < maxRetries && (retryOptions.retryCondition ? retryOptions.retryCondition(error) : !error.response || error.response.status >= 500);
490
- if (shouldRetry) {
491
- config._retryCount++;
492
- const delay = Math.min((retryOptions.initialDelay ?? 1000) * Math.pow(retryOptions.factor ?? 2, config._retryCount - 1), retryOptions.maxDelay ?? 5000);
493
- await new Promise((resolve) => setTimeout(resolve, delay));
494
- return this.api(config);
495
- }
496
- return Promise.reject(error);
497
- });
498
- }
499
- setupInterceptors() {
500
- this.api.interceptors.response.use((response) => {
501
- if (response.data && typeof response.data === "object" && "data" in response.data) {
502
- response.data = response.data.data;
503
- }
504
- return response;
505
- }, (error) => {
506
- const status = error.response?.status;
507
- let message;
508
- if (error.response?.data?.error?.message && typeof error.response.data.error.message === "string") {
509
- message = error.response.data.error.message;
510
- } else if (error.response?.data?.message && typeof error.response.data.message === "string") {
511
- message = error.response.data.message;
512
- } else if (error.message && typeof error.message === "string") {
513
- message = error.message;
514
- } else {
515
- message = "An error occurred";
516
- }
517
- const enhancedError = new Error(message);
518
- enhancedError.name = `HTTP${status || "Error"}`;
519
- if (status === 401) {
520
- this.emitter.emit("TOKEN_EXPIRED" /* TOKEN_EXPIRED */);
521
- this.emitter.emit("AUTH_ERROR" /* AUTH_ERROR */, enhancedError);
522
- } else {
523
- this.emitter.emit("REQUEST_ERROR" /* REQUEST_ERROR */, enhancedError);
524
- }
525
- return Promise.reject(enhancedError);
526
- });
527
- }
528
- setToken(token) {
529
- if (token) {
530
- this.api.defaults.headers.common.Authorization = `Bearer ${token}`;
531
- } else {
532
- delete this.api.defaults.headers.common.Authorization;
533
- }
534
- }
535
- }
536
- var import_axios;
537
- var init_src = __esm(() => {
538
- init_events();
539
- init_auth();
540
- init_ci();
541
- init_docs();
542
- init_invitations();
543
- init_organizations();
544
- init_sprints();
545
- init_tasks();
546
- init_workspaces();
547
- init_discussion_types();
548
- import_axios = __toESM(require("axios"));
549
- init_events();
550
- init_auth();
551
- init_ci();
552
- init_docs();
553
- init_invitations();
554
- init_organizations();
555
- init_sprints();
556
- init_tasks();
557
- init_workspaces();
558
- });
559
- 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"}
@@ -1,8 +0,0 @@
1
- import { AxiosInstance } from "axios";
2
- import { LocusEmitter } from "../events.js";
3
- export declare abstract class BaseModule {
4
- protected readonly api: AxiosInstance;
5
- protected readonly emitter: LocusEmitter;
6
- constructor(api: AxiosInstance, emitter: LocusEmitter);
7
- }
8
- //# sourceMappingURL=base.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/modules/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,8BAAsB,UAAU;IAE5B,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,aAAa;IACrC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,YAAY;gBADrB,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,YAAY;CAE3C"}
@@ -1,8 +0,0 @@
1
- import { ReportCiResult } from "@locusai/shared";
2
- import { BaseModule } from "./base.js";
3
- export declare class CiModule extends BaseModule {
4
- report(body: ReportCiResult): Promise<{
5
- success: boolean;
6
- }>;
7
- }
8
- //# sourceMappingURL=ci.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ci.d.ts","sourceRoot":"","sources":["../../src/modules/ci.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,qBAAa,QAAS,SAAQ,UAAU;IAChC,MAAM,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CAOlE"}
@@ -1,14 +0,0 @@
1
- import { CreateDoc, CreateDocGroup, Doc, DocGroup, UpdateDoc, UpdateDocGroup } from "@locusai/shared";
2
- import { BaseModule } from "./base.js";
3
- export declare class DocsModule extends BaseModule {
4
- create(workspaceId: string, body: CreateDoc): Promise<Doc>;
5
- list(workspaceId: string): Promise<Doc[]>;
6
- getById(id: string, workspaceId: string): Promise<Doc>;
7
- update(id: string, workspaceId: string, body: UpdateDoc): Promise<Doc>;
8
- delete(id: string, workspaceId: string): Promise<void>;
9
- listGroups(workspaceId: string): Promise<DocGroup[]>;
10
- createGroup(workspaceId: string, body: CreateDocGroup): Promise<DocGroup>;
11
- updateGroup(id: string, workspaceId: string, body: UpdateDocGroup): Promise<DocGroup>;
12
- deleteGroup(id: string, workspaceId: string): Promise<void>;
13
- }
14
- //# sourceMappingURL=docs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/modules/docs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,cAAc,EACd,GAAG,EACH,QAAQ,EAKR,SAAS,EACT,cAAc,EACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,qBAAa,UAAW,SAAQ,UAAU;IAClC,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC;IAQ1D,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAOzC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAOtD,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC;IAQtE,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKtD,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAOpD,WAAW,CACf,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,QAAQ,CAAC;IAQd,WAAW,CACf,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,QAAQ,CAAC;IAQd,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGlE"}
@@ -1,10 +0,0 @@
1
- import { AcceptInvitation, AcceptInvitationResponse, CreateInvitation, Invitation, InvitationResponse } from "@locusai/shared";
2
- import { BaseModule } from "./base.js";
3
- export declare class InvitationsModule extends BaseModule {
4
- create(orgId: string, body: CreateInvitation): Promise<Invitation>;
5
- list(orgId: string): Promise<Invitation[]>;
6
- verify(token: string): Promise<InvitationResponse>;
7
- accept(body: AcceptInvitation): Promise<AcceptInvitationResponse>;
8
- revoke(orgId: string, id: string): Promise<void>;
9
- }
10
- //# sourceMappingURL=invitations.d.ts.map