@locusai/sdk 0.2.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 (105) hide show
  1. package/dist/agent/artifact-syncer.d.ts +17 -0
  2. package/dist/agent/artifact-syncer.d.ts.map +1 -0
  3. package/dist/agent/artifact-syncer.js +77 -0
  4. package/dist/agent/codebase-indexer-service.d.ts +18 -0
  5. package/dist/agent/codebase-indexer-service.d.ts.map +1 -0
  6. package/dist/agent/codebase-indexer-service.js +55 -0
  7. package/dist/agent/index.d.ts +6 -0
  8. package/dist/agent/index.d.ts.map +1 -0
  9. package/dist/agent/index.js +5 -0
  10. package/dist/agent/sprint-planner.d.ts +17 -0
  11. package/dist/agent/sprint-planner.d.ts.map +1 -0
  12. package/dist/agent/sprint-planner.js +62 -0
  13. package/dist/agent/task-executor.d.ts +24 -0
  14. package/dist/agent/task-executor.d.ts.map +1 -0
  15. package/dist/agent/task-executor.js +56 -0
  16. package/dist/agent/worker.d.ts +37 -0
  17. package/dist/agent/worker.d.ts.map +1 -0
  18. package/dist/agent/worker.js +232 -0
  19. package/dist/ai/anthropic-client.d.ts +33 -0
  20. package/dist/ai/anthropic-client.d.ts.map +1 -0
  21. package/dist/ai/anthropic-client.js +70 -0
  22. package/dist/ai/claude-runner.d.ts +7 -0
  23. package/dist/ai/claude-runner.d.ts.map +1 -0
  24. package/dist/ai/claude-runner.js +43 -0
  25. package/dist/ai/index.d.ts +3 -0
  26. package/dist/ai/index.d.ts.map +1 -0
  27. package/dist/ai/index.js +2 -0
  28. package/dist/core/config.d.ts +10 -0
  29. package/dist/core/config.d.ts.map +1 -0
  30. package/dist/core/config.js +15 -0
  31. package/dist/core/index.d.ts +4 -0
  32. package/dist/core/index.d.ts.map +1 -0
  33. package/dist/core/index.js +3 -0
  34. package/dist/core/indexer.d.ts +18 -0
  35. package/dist/core/indexer.d.ts.map +1 -0
  36. package/dist/core/indexer.js +73 -0
  37. package/dist/core/prompt-builder.d.ts +8 -0
  38. package/dist/core/prompt-builder.d.ts.map +1 -0
  39. package/dist/core/prompt-builder.js +87 -0
  40. package/dist/events.d.ts +20 -0
  41. package/dist/events.d.ts.map +1 -0
  42. package/dist/events.js +15 -0
  43. package/dist/index-node.d.ts +14 -0
  44. package/dist/index-node.d.ts.map +1 -0
  45. package/dist/index-node.js +18 -0
  46. package/dist/index.d.ts +34 -0
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +101 -0
  49. package/dist/modules/auth.d.ts +14 -0
  50. package/dist/modules/auth.d.ts.map +1 -0
  51. package/dist/modules/auth.js +23 -0
  52. package/dist/modules/base.d.ts +8 -0
  53. package/dist/modules/base.d.ts.map +1 -0
  54. package/dist/modules/base.js +8 -0
  55. package/dist/modules/ci.d.ts +8 -0
  56. package/dist/modules/ci.d.ts.map +1 -0
  57. package/dist/modules/ci.js +7 -0
  58. package/dist/modules/docs.d.ts +14 -0
  59. package/dist/modules/docs.d.ts.map +1 -0
  60. package/dist/modules/docs.js +38 -0
  61. package/dist/modules/invitations.d.ts +10 -0
  62. package/dist/modules/invitations.d.ts.map +1 -0
  63. package/dist/modules/invitations.js +22 -0
  64. package/dist/modules/organizations.d.ts +24 -0
  65. package/dist/modules/organizations.d.ts.map +1 -0
  66. package/dist/modules/organizations.js +39 -0
  67. package/dist/modules/sprints.d.ts +13 -0
  68. package/dist/modules/sprints.d.ts.map +1 -0
  69. package/dist/modules/sprints.js +34 -0
  70. package/dist/modules/tasks.d.ts +24 -0
  71. package/dist/modules/tasks.d.ts.map +1 -0
  72. package/dist/modules/tasks.js +56 -0
  73. package/dist/modules/workspaces.d.ts +21 -0
  74. package/dist/modules/workspaces.d.ts.map +1 -0
  75. package/dist/modules/workspaces.js +49 -0
  76. package/dist/orchestrator.d.ts +90 -0
  77. package/dist/orchestrator.d.ts.map +1 -0
  78. package/dist/orchestrator.js +326 -0
  79. package/package.json +53 -0
  80. package/src/agent/artifact-syncer.ts +111 -0
  81. package/src/agent/codebase-indexer-service.ts +71 -0
  82. package/src/agent/index.ts +5 -0
  83. package/src/agent/sprint-planner.ts +78 -0
  84. package/src/agent/task-executor.ts +77 -0
  85. package/src/agent/worker.ts +299 -0
  86. package/src/ai/anthropic-client.ts +93 -0
  87. package/src/ai/claude-runner.ts +49 -0
  88. package/src/ai/index.ts +2 -0
  89. package/src/core/config.ts +21 -0
  90. package/src/core/index.ts +3 -0
  91. package/src/core/indexer.ts +91 -0
  92. package/src/core/prompt-builder.ts +100 -0
  93. package/src/events.ts +32 -0
  94. package/src/index-node.ts +20 -0
  95. package/src/index.ts +119 -0
  96. package/src/modules/auth.ts +48 -0
  97. package/src/modules/base.ts +9 -0
  98. package/src/modules/ci.ts +12 -0
  99. package/src/modules/docs.ts +84 -0
  100. package/src/modules/invitations.ts +45 -0
  101. package/src/modules/organizations.ts +90 -0
  102. package/src/modules/sprints.ts +69 -0
  103. package/src/modules/tasks.ts +110 -0
  104. package/src/modules/workspaces.ts +94 -0
  105. package/src/orchestrator.ts +430 -0
@@ -0,0 +1,14 @@
1
+ import { CompleteRegistration, LoginResponse, User, VerifyOtp } from "@locusai/shared";
2
+ import { BaseModule } from "./base";
3
+ export declare class AuthModule extends BaseModule {
4
+ getMe(): Promise<User>;
5
+ requestRegisterOtp(email: string): Promise<{
6
+ success: boolean;
7
+ }>;
8
+ requestLoginOtp(email: string): Promise<{
9
+ success: boolean;
10
+ }>;
11
+ verifyLogin(body: VerifyOtp): Promise<LoginResponse>;
12
+ completeRegistration(body: CompleteRegistration): Promise<LoginResponse>;
13
+ }
14
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
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,QAAQ,CAAC;AAEpC,qBAAa,UAAW,SAAQ,UAAU;IAClC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAKtB,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;CAO1B"}
@@ -0,0 +1,23 @@
1
+ import { BaseModule } from "./base";
2
+ export class AuthModule extends BaseModule {
3
+ async getMe() {
4
+ const { data } = await this.api.get("/auth/me");
5
+ return data;
6
+ }
7
+ async requestRegisterOtp(email) {
8
+ const { data } = await this.api.post("/auth/register-otp", { email });
9
+ return data;
10
+ }
11
+ async requestLoginOtp(email) {
12
+ const { data } = await this.api.post("/auth/login-otp", { email });
13
+ return data;
14
+ }
15
+ async verifyLogin(body) {
16
+ const { data } = await this.api.post("/auth/verify-login", body);
17
+ return data;
18
+ }
19
+ async completeRegistration(body) {
20
+ const { data } = await this.api.post("/auth/complete-registration", body);
21
+ return data;
22
+ }
23
+ }
@@ -0,0 +1,8 @@
1
+ import { AxiosInstance } from "axios";
2
+ import { LocusEmitter } from "../events";
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
@@ -0,0 +1 @@
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,WAAW,CAAC;AAEzC,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"}
@@ -0,0 +1,8 @@
1
+ export class BaseModule {
2
+ api;
3
+ emitter;
4
+ constructor(api, emitter) {
5
+ this.api = api;
6
+ this.emitter = emitter;
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ import { ReportCiResult } from "@locusai/shared";
2
+ import { BaseModule } from "./base";
3
+ export declare class CiModule extends BaseModule {
4
+ report(body: ReportCiResult): Promise<{
5
+ success: boolean;
6
+ }>;
7
+ }
8
+ //# sourceMappingURL=ci.d.ts.map
@@ -0,0 +1 @@
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,QAAQ,CAAC;AAEpC,qBAAa,QAAS,SAAQ,UAAU;IAChC,MAAM,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CAOlE"}
@@ -0,0 +1,7 @@
1
+ import { BaseModule } from "./base";
2
+ export class CiModule extends BaseModule {
3
+ async report(body) {
4
+ const { data } = await this.api.post("/ci/report", body);
5
+ return data;
6
+ }
7
+ }
@@ -0,0 +1,14 @@
1
+ import { CreateDoc, CreateDocGroup, Doc, DocGroup, UpdateDoc, UpdateDocGroup } from "@locusai/shared";
2
+ import { BaseModule } from "./base";
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
@@ -0,0 +1 @@
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,QAAQ,CAAC;AAEpC,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"}
@@ -0,0 +1,38 @@
1
+ import { BaseModule } from "./base";
2
+ export class DocsModule extends BaseModule {
3
+ async create(workspaceId, body) {
4
+ const { data } = await this.api.post(`/workspaces/${workspaceId}/docs`, body);
5
+ return data.doc;
6
+ }
7
+ async list(workspaceId) {
8
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/docs`);
9
+ return data.docs;
10
+ }
11
+ async getById(id, workspaceId) {
12
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/docs/${id}`);
13
+ return data.doc;
14
+ }
15
+ async update(id, workspaceId, body) {
16
+ const { data } = await this.api.put(`/workspaces/${workspaceId}/docs/${id}`, body);
17
+ return data.doc;
18
+ }
19
+ async delete(id, workspaceId) {
20
+ await this.api.delete(`/workspaces/${workspaceId}/docs/${id}`);
21
+ }
22
+ // Group Management
23
+ async listGroups(workspaceId) {
24
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/doc-groups`);
25
+ return data.groups;
26
+ }
27
+ async createGroup(workspaceId, body) {
28
+ const { data } = await this.api.post(`/workspaces/${workspaceId}/doc-groups`, body);
29
+ return data.group;
30
+ }
31
+ async updateGroup(id, workspaceId, body) {
32
+ const { data } = await this.api.patch(`/workspaces/${workspaceId}/doc-groups/${id}`, body);
33
+ return data.group;
34
+ }
35
+ async deleteGroup(id, workspaceId) {
36
+ await this.api.delete(`/workspaces/${workspaceId}/doc-groups/${id}`);
37
+ }
38
+ }
@@ -0,0 +1,10 @@
1
+ import { AcceptInvitation, AcceptInvitationResponse, CreateInvitation, Invitation, InvitationResponse } from "@locusai/shared";
2
+ import { BaseModule } from "./base";
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invitations.d.ts","sourceRoot":"","sources":["../../src/modules/invitations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAEnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,qBAAa,iBAAkB,SAAQ,UAAU;IACzC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IAQlE,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAO1C,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAOlD,MAAM,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAQjE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGvD"}
@@ -0,0 +1,22 @@
1
+ import { BaseModule } from "./base";
2
+ export class InvitationsModule extends BaseModule {
3
+ async create(orgId, body) {
4
+ const { data } = await this.api.post(`/org/${orgId}/invitations`, body);
5
+ return data.invitation;
6
+ }
7
+ async list(orgId) {
8
+ const { data } = await this.api.get(`/org/${orgId}/invitations`);
9
+ return data.invitations;
10
+ }
11
+ async verify(token) {
12
+ const { data } = await this.api.get(`/invitations/verify/${token}`);
13
+ return data;
14
+ }
15
+ async accept(body) {
16
+ const { data } = await this.api.post("/invitations/accept", body);
17
+ return data;
18
+ }
19
+ async revoke(orgId, id) {
20
+ await this.api.delete(`/org/${orgId}/invitations/${id}`);
21
+ }
22
+ }
@@ -0,0 +1,24 @@
1
+ import { AddMember, MembershipWithUser, Organization } from "@locusai/shared";
2
+ import { BaseModule } from "./base";
3
+ export interface ApiKey {
4
+ id: string;
5
+ organizationId: string;
6
+ name: string;
7
+ key: string;
8
+ active: boolean;
9
+ lastUsedAt: string | null;
10
+ createdAt: string;
11
+ updatedAt: string;
12
+ }
13
+ export declare class OrganizationsModule extends BaseModule {
14
+ list(): Promise<Organization[]>;
15
+ getById(id: string): Promise<Organization>;
16
+ listMembers(id: string): Promise<MembershipWithUser[]>;
17
+ addMember(id: string, body: AddMember): Promise<MembershipWithUser>;
18
+ removeMember(orgId: string, userId: string): Promise<void>;
19
+ delete(orgId: string): Promise<void>;
20
+ listApiKeys(orgId: string): Promise<ApiKey[]>;
21
+ createApiKey(orgId: string, name: string): Promise<ApiKey>;
22
+ deleteApiKey(orgId: string, keyId: string): Promise<void>;
23
+ }
24
+ //# sourceMappingURL=organizations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.d.ts","sourceRoot":"","sources":["../../src/modules/organizations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,kBAAkB,EAElB,YAAY,EAGb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAUD,qBAAa,mBAAoB,SAAQ,UAAU;IAC3C,IAAI,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAM/B,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAO1C,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAOtD,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAQnE,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1D,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAO7C,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ1D,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGhE"}
@@ -0,0 +1,39 @@
1
+ import { BaseModule } from "./base";
2
+ export class OrganizationsModule extends BaseModule {
3
+ async list() {
4
+ const { data } = await this.api.get("/organizations");
5
+ return data.organizations;
6
+ }
7
+ async getById(id) {
8
+ const { data } = await this.api.get(`/organizations/${id}`);
9
+ return data.organization;
10
+ }
11
+ async listMembers(id) {
12
+ const { data } = await this.api.get(`/organizations/${id}/members`);
13
+ return data.members;
14
+ }
15
+ async addMember(id, body) {
16
+ const { data } = await this.api.post(`/organizations/${id}/members`, body);
17
+ return data.membership;
18
+ }
19
+ async removeMember(orgId, userId) {
20
+ await this.api.delete(`/organizations/${orgId}/members/${userId}`);
21
+ }
22
+ async delete(orgId) {
23
+ await this.api.delete(`/organizations/${orgId}`);
24
+ }
25
+ // ============================================================================
26
+ // API Key Management
27
+ // ============================================================================
28
+ async listApiKeys(orgId) {
29
+ const { data } = await this.api.get(`/organizations/${orgId}/api-keys`);
30
+ return data.apiKeys;
31
+ }
32
+ async createApiKey(orgId, name) {
33
+ const { data } = await this.api.post(`/organizations/${orgId}/api-keys`, { name });
34
+ return data.apiKey;
35
+ }
36
+ async deleteApiKey(orgId, keyId) {
37
+ await this.api.delete(`/organizations/${orgId}/api-keys/${keyId}`);
38
+ }
39
+ }
@@ -0,0 +1,13 @@
1
+ import { CreateSprint, Sprint, UpdateSprint } from "@locusai/shared";
2
+ import { BaseModule } from "./base";
3
+ export declare class SprintsModule extends BaseModule {
4
+ list(workspaceId: string): Promise<Sprint[]>;
5
+ getActive(workspaceId: string): Promise<Sprint>;
6
+ getById(id: string, workspaceId: string): Promise<Sprint>;
7
+ create(workspaceId: string, body: CreateSprint): Promise<Sprint>;
8
+ update(id: string, workspaceId: string, body: UpdateSprint): Promise<Sprint>;
9
+ delete(id: string, workspaceId: string): Promise<void>;
10
+ start(id: string, workspaceId: string): Promise<Sprint>;
11
+ complete(id: string, workspaceId: string): Promise<Sprint>;
12
+ }
13
+ //# sourceMappingURL=sprints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sprints.d.ts","sourceRoot":"","sources":["../../src/modules/sprints.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,MAAM,EAGN,YAAY,EACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,qBAAa,aAAc,SAAQ,UAAU;IACrC,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAO5C,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAO/C,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOzD,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAQhE,MAAM,CACV,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,YAAY,GACjB,OAAO,CAAC,MAAM,CAAC;IAQZ,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItD,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOvD,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAMjE"}
@@ -0,0 +1,34 @@
1
+ import { BaseModule } from "./base";
2
+ export class SprintsModule extends BaseModule {
3
+ async list(workspaceId) {
4
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/sprints`);
5
+ return data.sprints;
6
+ }
7
+ async getActive(workspaceId) {
8
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/sprints/active`);
9
+ return data.sprint;
10
+ }
11
+ async getById(id, workspaceId) {
12
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/sprints/${id}`);
13
+ return data.sprint;
14
+ }
15
+ async create(workspaceId, body) {
16
+ const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints`, body);
17
+ return data.sprint;
18
+ }
19
+ async update(id, workspaceId, body) {
20
+ const { data } = await this.api.patch(`/workspaces/${workspaceId}/sprints/${id}`, body);
21
+ return data.sprint;
22
+ }
23
+ async delete(id, workspaceId) {
24
+ await this.api.delete(`/workspaces/${workspaceId}/sprints/${id}`);
25
+ }
26
+ async start(id, workspaceId) {
27
+ const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints/${id}/start`);
28
+ return data.sprint;
29
+ }
30
+ async complete(id, workspaceId) {
31
+ const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints/${id}/complete`);
32
+ return data.sprint;
33
+ }
34
+ }
@@ -0,0 +1,24 @@
1
+ import { AddComment, Comment, CreateTask, Task, TaskStatus, UpdateTask } from "@locusai/shared";
2
+ import { BaseModule } from "./base";
3
+ export interface TaskListOptions {
4
+ sprintId?: string;
5
+ status?: TaskStatus | TaskStatus[];
6
+ }
7
+ export declare class TasksModule extends BaseModule {
8
+ /**
9
+ * List all tasks in a workspace, optionally filtered
10
+ */
11
+ list(workspaceId: string, options?: TaskListOptions): Promise<Task[]>;
12
+ /**
13
+ * Get available tasks for an agent to work on.
14
+ * Returns tasks in BACKLOG or IN_PROGRESS (unassigned) status.
15
+ */
16
+ getAvailable(workspaceId: string, sprintId?: string): Promise<Task[]>;
17
+ getById(id: string, workspaceId: string): Promise<Task>;
18
+ create(workspaceId: string, body: CreateTask): Promise<Task>;
19
+ update(id: string, workspaceId: string, body: UpdateTask): Promise<Task>;
20
+ delete(id: string, workspaceId: string): Promise<void>;
21
+ getBacklog(workspaceId: string): Promise<Task[]>;
22
+ addComment(id: string, workspaceId: string, body: AddComment): Promise<Comment>;
23
+ }
24
+ //# sourceMappingURL=tasks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/modules/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,OAAO,EAEP,UAAU,EACV,IAAI,EAEJ,UAAU,EAEV,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,UAAU,GAAG,UAAU,EAAE,CAAC;CACpC;AAED,qBAAa,WAAY,SAAQ,UAAU;IACzC;;OAEG;IACG,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAsB3E;;;OAGG;IACG,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAYrE,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOvD,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ5D,MAAM,CACV,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,IAAI,CAAC;IAQV,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItD,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAOhD,UAAU,CACd,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,OAAO,CAAC;CAOpB"}
@@ -0,0 +1,56 @@
1
+ import { TaskStatus, } from "@locusai/shared";
2
+ import { BaseModule } from "./base";
3
+ export class TasksModule extends BaseModule {
4
+ /**
5
+ * List all tasks in a workspace, optionally filtered
6
+ */
7
+ async list(workspaceId, options) {
8
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/tasks`);
9
+ let tasks = data.tasks;
10
+ // Client-side filtering (API doesn't support query params yet)
11
+ if (options?.sprintId) {
12
+ tasks = tasks.filter((t) => t.sprintId === options.sprintId);
13
+ }
14
+ if (options?.status) {
15
+ const statuses = Array.isArray(options.status)
16
+ ? options.status
17
+ : [options.status];
18
+ tasks = tasks.filter((t) => statuses.includes(t.status));
19
+ }
20
+ return tasks;
21
+ }
22
+ /**
23
+ * Get available tasks for an agent to work on.
24
+ * Returns tasks in BACKLOG or IN_PROGRESS (unassigned) status.
25
+ */
26
+ async getAvailable(workspaceId, sprintId) {
27
+ const tasks = await this.list(workspaceId, {
28
+ sprintId,
29
+ });
30
+ return tasks.filter((t) => t.status === TaskStatus.BACKLOG ||
31
+ (t.status === TaskStatus.IN_PROGRESS && !t.assignedTo));
32
+ }
33
+ async getById(id, workspaceId) {
34
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/tasks/${id}`);
35
+ return data.task;
36
+ }
37
+ async create(workspaceId, body) {
38
+ const { data } = await this.api.post(`/workspaces/${workspaceId}/tasks`, body);
39
+ return data.task;
40
+ }
41
+ async update(id, workspaceId, body) {
42
+ const { data } = await this.api.patch(`/workspaces/${workspaceId}/tasks/${id}`, body);
43
+ return data.task;
44
+ }
45
+ async delete(id, workspaceId) {
46
+ await this.api.delete(`/workspaces/${workspaceId}/tasks/${id}`);
47
+ }
48
+ async getBacklog(workspaceId) {
49
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/tasks/backlog`);
50
+ return data.tasks;
51
+ }
52
+ async addComment(id, workspaceId, body) {
53
+ const { data } = await this.api.post(`/workspaces/${workspaceId}/tasks/${id}/comment`, body);
54
+ return data.comment;
55
+ }
56
+ }
@@ -0,0 +1,21 @@
1
+ import { CreateWorkspace, Event, Task, UpdateWorkspace, Workspace, WorkspaceStats } from "@locusai/shared";
2
+ import { BaseModule } from "./base";
3
+ export declare class WorkspacesModule extends BaseModule {
4
+ listAll(): Promise<Workspace[]>;
5
+ listByOrg(orgId: string): Promise<Workspace[]>;
6
+ create(body: CreateWorkspace & {
7
+ orgId: string;
8
+ }): Promise<Workspace>;
9
+ createWithAutoOrg(body: CreateWorkspace): Promise<Workspace>;
10
+ getById(id: string): Promise<Workspace>;
11
+ update(id: string, body: UpdateWorkspace): Promise<Workspace>;
12
+ delete(id: string): Promise<void>;
13
+ getStats(id: string): Promise<WorkspaceStats>;
14
+ getActivity(id: string, limit?: number): Promise<Event[]>;
15
+ /**
16
+ * Dispatch a task from the workspace backlog to an agent.
17
+ * Atomically moves a task from BACKLOG to IN_PROGRESS and assigns it.
18
+ */
19
+ dispatch(id: string, workerId: string, sprintId?: string): Promise<Task>;
20
+ }
21
+ //# sourceMappingURL=workspaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspaces.d.ts","sourceRoot":"","sources":["../../src/modules/workspaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,KAAK,EACL,IAAI,EAEJ,eAAe,EACf,SAAS,EAET,cAAc,EAEf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,qBAAa,gBAAiB,SAAQ,UAAU;IACxC,OAAO,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAK/B,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAO9C,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,SAAS,CAAC;IASrE,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC;IAQ5D,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAKvC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC;IAQ7D,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjC,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAO7C,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAU/D;;;OAGG;IACG,QAAQ,CACZ,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC;CAOjB"}
@@ -0,0 +1,49 @@
1
+ import { BaseModule } from "./base";
2
+ export class WorkspacesModule extends BaseModule {
3
+ async listAll() {
4
+ const { data } = await this.api.get("/workspaces");
5
+ return data.workspaces;
6
+ }
7
+ async listByOrg(orgId) {
8
+ const { data } = await this.api.get(`/workspaces/org/${orgId}`);
9
+ return data.workspaces;
10
+ }
11
+ async create(body) {
12
+ const { orgId, ...bodyWithoutOrgId } = body;
13
+ const { data } = await this.api.post(`/workspaces/org/${orgId}`, bodyWithoutOrgId);
14
+ return data.workspace;
15
+ }
16
+ async createWithAutoOrg(body) {
17
+ const { data } = await this.api.post("/workspaces", body);
18
+ return data.workspace;
19
+ }
20
+ async getById(id) {
21
+ const { data } = await this.api.get(`/workspaces/${id}`);
22
+ return data.workspace;
23
+ }
24
+ async update(id, body) {
25
+ const { data } = await this.api.put(`/workspaces/${id}`, body);
26
+ return data.workspace;
27
+ }
28
+ async delete(id) {
29
+ await this.api.delete(`/workspaces/${id}`);
30
+ }
31
+ async getStats(id) {
32
+ const { data } = await this.api.get(`/workspaces/${id}/stats`);
33
+ return data;
34
+ }
35
+ async getActivity(id, limit) {
36
+ const { data } = await this.api.get(`/workspaces/${id}/activity`, {
37
+ params: { limit },
38
+ });
39
+ return data.activity;
40
+ }
41
+ /**
42
+ * Dispatch a task from the workspace backlog to an agent.
43
+ * Atomically moves a task from BACKLOG to IN_PROGRESS and assigns it.
44
+ */
45
+ async dispatch(id, workerId, sprintId) {
46
+ const { data } = await this.api.post(`/workspaces/${id}/dispatch`, { workerId, sprintId });
47
+ return data.task;
48
+ }
49
+ }
@@ -0,0 +1,90 @@
1
+ import { ChildProcess } from "node:child_process";
2
+ import { Task } from "@locusai/shared";
3
+ import { EventEmitter } from "events";
4
+ export interface AgentConfig {
5
+ id: string;
6
+ maxConcurrentTasks: number;
7
+ }
8
+ export interface AgentState {
9
+ id: string;
10
+ status: "IDLE" | "WORKING" | "COMPLETED" | "FAILED";
11
+ currentTaskId: string | null;
12
+ tasksCompleted: number;
13
+ tasksFailed: number;
14
+ lastHeartbeat: Date;
15
+ process?: ChildProcess;
16
+ }
17
+ export interface OrchestratorConfig {
18
+ workspaceId: string;
19
+ sprintId: string;
20
+ apiBase: string;
21
+ maxIterations: number;
22
+ projectPath: string;
23
+ apiKey: string;
24
+ anthropicApiKey?: string;
25
+ model?: string;
26
+ }
27
+ export declare class AgentOrchestrator extends EventEmitter {
28
+ private client;
29
+ private config;
30
+ private agents;
31
+ private isRunning;
32
+ private processedTasks;
33
+ private resolvedSprintId;
34
+ constructor(config: OrchestratorConfig);
35
+ /**
36
+ * Resolve the sprint ID - use provided or find active sprint
37
+ */
38
+ private resolveSprintId;
39
+ /**
40
+ * Start the orchestrator with N agents
41
+ */
42
+ start(): Promise<void>;
43
+ /**
44
+ * Main orchestration loop - runs 1 agent continuously
45
+ */
46
+ private orchestrationLoop;
47
+ /**
48
+ * Spawn a single agent process
49
+ */
50
+ private spawnAgent;
51
+ /**
52
+ * Reap completed agents
53
+ */
54
+ private reapAgents;
55
+ /**
56
+ * Get available tasks in sprint
57
+ */
58
+ private getAvailableTasks;
59
+ /**
60
+ * Assign task to agent
61
+ */
62
+ assignTaskToAgent(agentId: string): Promise<Task | null>;
63
+ /**
64
+ * Mark task as completed by agent
65
+ */
66
+ completeTask(taskId: string, agentId: string, summary?: string): Promise<void>;
67
+ /**
68
+ * Mark task as failed
69
+ */
70
+ failTask(taskId: string, agentId: string, error: string): Promise<void>;
71
+ /**
72
+ * Stop orchestrator
73
+ */
74
+ stop(): Promise<void>;
75
+ /**
76
+ * Cleanup - kill all agent processes
77
+ */
78
+ private cleanup;
79
+ /**
80
+ * Get orchestrator stats
81
+ */
82
+ getStats(): {
83
+ activeAgents: number;
84
+ processedTasks: number;
85
+ totalTasksCompleted: number;
86
+ totalTasksFailed: number;
87
+ };
88
+ private sleep;
89
+ }
90
+ //# sourceMappingURL=orchestrator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../src/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAS,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAE,IAAI,EAA4B,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IACpD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,iBAAkB,SAAQ,YAAY;IACjD,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,MAAM,CAAsC;IACpD,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,cAAc,CAA0B;IAChD,OAAO,CAAC,gBAAgB,CAAuB;gBAEnC,MAAM,EAAE,kBAAkB;IAStC;;OAEG;YACW,eAAe;IAsB7B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAkB5B;;OAEG;YACW,iBAAiB;IA4C/B;;OAEG;YACW,UAAU;IAqGxB;;OAEG;YACW,UAAU;IAKxB;;OAEG;YACW,iBAAiB;IAc/B;;OAEG;IACG,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IA2C9D;;OAEG;IACG,YAAY,CAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IA4BhB;;OAEG;IACG,QAAQ,CACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC;IAyBhB;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B;;OAEG;YACW,OAAO;IAWrB;;OAEG;IACH,QAAQ;;;;;;IAeR,OAAO,CAAC,KAAK;CAGd"}