@locusai/sdk 0.4.5 → 0.4.9

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 (58) hide show
  1. package/dist/index-node.js +1590 -20
  2. package/dist/index.js +429 -121
  3. package/dist/orchestrator.d.ts.map +1 -1
  4. package/package.json +12 -23
  5. package/dist/agent/artifact-syncer.js +0 -77
  6. package/dist/agent/codebase-indexer-service.js +0 -55
  7. package/dist/agent/index.js +0 -5
  8. package/dist/agent/sprint-planner.js +0 -68
  9. package/dist/agent/task-executor.js +0 -60
  10. package/dist/agent/worker.js +0 -252
  11. package/dist/ai/anthropic-client.js +0 -70
  12. package/dist/ai/claude-runner.js +0 -71
  13. package/dist/ai/index.js +0 -2
  14. package/dist/core/config.js +0 -15
  15. package/dist/core/index.js +0 -3
  16. package/dist/core/indexer.js +0 -113
  17. package/dist/core/prompt-builder.js +0 -83
  18. package/dist/events.js +0 -15
  19. package/dist/modules/auth.js +0 -23
  20. package/dist/modules/base.js +0 -8
  21. package/dist/modules/ci.js +0 -7
  22. package/dist/modules/docs.js +0 -38
  23. package/dist/modules/invitations.js +0 -22
  24. package/dist/modules/organizations.js +0 -39
  25. package/dist/modules/sprints.js +0 -34
  26. package/dist/modules/tasks.js +0 -56
  27. package/dist/modules/workspaces.js +0 -49
  28. package/dist/orchestrator.js +0 -356
  29. package/dist/utils/colors.js +0 -54
  30. package/dist/utils/retry.js +0 -37
  31. package/src/agent/artifact-syncer.ts +0 -111
  32. package/src/agent/codebase-indexer-service.ts +0 -71
  33. package/src/agent/index.ts +0 -5
  34. package/src/agent/sprint-planner.ts +0 -86
  35. package/src/agent/task-executor.ts +0 -85
  36. package/src/agent/worker.ts +0 -322
  37. package/src/ai/anthropic-client.ts +0 -93
  38. package/src/ai/claude-runner.ts +0 -86
  39. package/src/ai/index.ts +0 -2
  40. package/src/core/config.ts +0 -21
  41. package/src/core/index.ts +0 -3
  42. package/src/core/indexer.ts +0 -131
  43. package/src/core/prompt-builder.ts +0 -91
  44. package/src/events.ts +0 -35
  45. package/src/index-node.ts +0 -23
  46. package/src/index.ts +0 -159
  47. package/src/modules/auth.ts +0 -48
  48. package/src/modules/base.ts +0 -9
  49. package/src/modules/ci.ts +0 -12
  50. package/src/modules/docs.ts +0 -84
  51. package/src/modules/invitations.ts +0 -45
  52. package/src/modules/organizations.ts +0 -90
  53. package/src/modules/sprints.ts +0 -69
  54. package/src/modules/tasks.ts +0 -110
  55. package/src/modules/workspaces.ts +0 -94
  56. package/src/orchestrator.ts +0 -473
  57. package/src/utils/colors.ts +0 -63
  58. package/src/utils/retry.ts +0 -56
@@ -1,90 +0,0 @@
1
- import {
2
- AddMember,
3
- MembershipResponse,
4
- MembershipWithUser,
5
- MembersResponse,
6
- Organization,
7
- OrganizationResponse,
8
- OrganizationsResponse,
9
- } from "@locusai/shared";
10
- import { BaseModule } from "./base.js";
11
-
12
- export interface ApiKey {
13
- id: string;
14
- organizationId: string;
15
- name: string;
16
- key: string;
17
- active: boolean;
18
- lastUsedAt: string | null;
19
- createdAt: string;
20
- updatedAt: string;
21
- }
22
-
23
- interface ApiKeysResponse {
24
- apiKeys: ApiKey[];
25
- }
26
-
27
- interface ApiKeyResponse {
28
- apiKey: ApiKey;
29
- }
30
-
31
- export class OrganizationsModule extends BaseModule {
32
- async list(): Promise<Organization[]> {
33
- const { data } =
34
- await this.api.get<OrganizationsResponse>("/organizations");
35
- return data.organizations;
36
- }
37
-
38
- async getById(id: string): Promise<Organization> {
39
- const { data } = await this.api.get<OrganizationResponse>(
40
- `/organizations/${id}`
41
- );
42
- return data.organization;
43
- }
44
-
45
- async listMembers(id: string): Promise<MembershipWithUser[]> {
46
- const { data } = await this.api.get<MembersResponse>(
47
- `/organizations/${id}/members`
48
- );
49
- return data.members;
50
- }
51
-
52
- async addMember(id: string, body: AddMember): Promise<MembershipWithUser> {
53
- const { data } = await this.api.post<MembershipResponse>(
54
- `/organizations/${id}/members`,
55
- body
56
- );
57
- return data.membership;
58
- }
59
-
60
- async removeMember(orgId: string, userId: string): Promise<void> {
61
- await this.api.delete(`/organizations/${orgId}/members/${userId}`);
62
- }
63
-
64
- async delete(orgId: string): Promise<void> {
65
- await this.api.delete(`/organizations/${orgId}`);
66
- }
67
-
68
- // ============================================================================
69
- // API Key Management
70
- // ============================================================================
71
-
72
- async listApiKeys(orgId: string): Promise<ApiKey[]> {
73
- const { data } = await this.api.get<ApiKeysResponse>(
74
- `/organizations/${orgId}/api-keys`
75
- );
76
- return data.apiKeys;
77
- }
78
-
79
- async createApiKey(orgId: string, name: string): Promise<ApiKey> {
80
- const { data } = await this.api.post<ApiKeyResponse>(
81
- `/organizations/${orgId}/api-keys`,
82
- { name }
83
- );
84
- return data.apiKey;
85
- }
86
-
87
- async deleteApiKey(orgId: string, keyId: string): Promise<void> {
88
- await this.api.delete(`/organizations/${orgId}/api-keys/${keyId}`);
89
- }
90
- }
@@ -1,69 +0,0 @@
1
- import {
2
- CreateSprint,
3
- Sprint,
4
- SprintResponse,
5
- SprintsResponse,
6
- UpdateSprint,
7
- } from "@locusai/shared";
8
- import { BaseModule } from "./base.js";
9
-
10
- export class SprintsModule extends BaseModule {
11
- async list(workspaceId: string): Promise<Sprint[]> {
12
- const { data } = await this.api.get<SprintsResponse>(
13
- `/workspaces/${workspaceId}/sprints`
14
- );
15
- return data.sprints;
16
- }
17
-
18
- async getActive(workspaceId: string): Promise<Sprint> {
19
- const { data } = await this.api.get<SprintResponse>(
20
- `/workspaces/${workspaceId}/sprints/active`
21
- );
22
- return data.sprint;
23
- }
24
-
25
- async getById(id: string, workspaceId: string): Promise<Sprint> {
26
- const { data } = await this.api.get<SprintResponse>(
27
- `/workspaces/${workspaceId}/sprints/${id}`
28
- );
29
- return data.sprint;
30
- }
31
-
32
- async create(workspaceId: string, body: CreateSprint): Promise<Sprint> {
33
- const { data } = await this.api.post<SprintResponse>(
34
- `/workspaces/${workspaceId}/sprints`,
35
- body
36
- );
37
- return data.sprint;
38
- }
39
-
40
- async update(
41
- id: string,
42
- workspaceId: string,
43
- body: UpdateSprint
44
- ): Promise<Sprint> {
45
- const { data } = await this.api.patch<SprintResponse>(
46
- `/workspaces/${workspaceId}/sprints/${id}`,
47
- body
48
- );
49
- return data.sprint;
50
- }
51
-
52
- async delete(id: string, workspaceId: string): Promise<void> {
53
- await this.api.delete(`/workspaces/${workspaceId}/sprints/${id}`);
54
- }
55
-
56
- async start(id: string, workspaceId: string): Promise<Sprint> {
57
- const { data } = await this.api.post<SprintResponse>(
58
- `/workspaces/${workspaceId}/sprints/${id}/start`
59
- );
60
- return data.sprint;
61
- }
62
-
63
- async complete(id: string, workspaceId: string): Promise<Sprint> {
64
- const { data } = await this.api.post<SprintResponse>(
65
- `/workspaces/${workspaceId}/sprints/${id}/complete`
66
- );
67
- return data.sprint;
68
- }
69
- }
@@ -1,110 +0,0 @@
1
- import {
2
- AddComment,
3
- Comment,
4
- CommentResponse,
5
- CreateTask,
6
- Task,
7
- TaskResponse,
8
- TaskStatus,
9
- TasksResponse,
10
- UpdateTask,
11
- } from "@locusai/shared";
12
- import { BaseModule } from "./base.js";
13
-
14
- export interface TaskListOptions {
15
- sprintId?: string;
16
- status?: TaskStatus | TaskStatus[];
17
- }
18
-
19
- export class TasksModule extends BaseModule {
20
- /**
21
- * List all tasks in a workspace, optionally filtered
22
- */
23
- async list(workspaceId: string, options?: TaskListOptions): Promise<Task[]> {
24
- const { data } = await this.api.get<TasksResponse>(
25
- `/workspaces/${workspaceId}/tasks`
26
- );
27
-
28
- let tasks = data.tasks;
29
-
30
- // Client-side filtering (API doesn't support query params yet)
31
- if (options?.sprintId) {
32
- tasks = tasks.filter((t) => t.sprintId === options.sprintId);
33
- }
34
-
35
- if (options?.status) {
36
- const statuses = Array.isArray(options.status)
37
- ? options.status
38
- : [options.status];
39
- tasks = tasks.filter((t) => statuses.includes(t.status as TaskStatus));
40
- }
41
-
42
- return tasks;
43
- }
44
-
45
- /**
46
- * Get available tasks for an agent to work on.
47
- * Returns tasks in BACKLOG or IN_PROGRESS (unassigned) status.
48
- */
49
- async getAvailable(workspaceId: string, sprintId?: string): Promise<Task[]> {
50
- const tasks = await this.list(workspaceId, {
51
- sprintId,
52
- });
53
-
54
- return tasks.filter(
55
- (t) =>
56
- t.status === TaskStatus.BACKLOG ||
57
- (t.status === TaskStatus.IN_PROGRESS && !t.assignedTo)
58
- );
59
- }
60
-
61
- async getById(id: string, workspaceId: string): Promise<Task> {
62
- const { data } = await this.api.get<TaskResponse>(
63
- `/workspaces/${workspaceId}/tasks/${id}`
64
- );
65
- return data.task;
66
- }
67
-
68
- async create(workspaceId: string, body: CreateTask): Promise<Task> {
69
- const { data } = await this.api.post<TaskResponse>(
70
- `/workspaces/${workspaceId}/tasks`,
71
- body
72
- );
73
- return data.task;
74
- }
75
-
76
- async update(
77
- id: string,
78
- workspaceId: string,
79
- body: UpdateTask
80
- ): Promise<Task> {
81
- const { data } = await this.api.patch<TaskResponse>(
82
- `/workspaces/${workspaceId}/tasks/${id}`,
83
- body
84
- );
85
- return data.task;
86
- }
87
-
88
- async delete(id: string, workspaceId: string): Promise<void> {
89
- await this.api.delete(`/workspaces/${workspaceId}/tasks/${id}`);
90
- }
91
-
92
- async getBacklog(workspaceId: string): Promise<Task[]> {
93
- const { data } = await this.api.get<TasksResponse>(
94
- `/workspaces/${workspaceId}/tasks/backlog`
95
- );
96
- return data.tasks;
97
- }
98
-
99
- async addComment(
100
- id: string,
101
- workspaceId: string,
102
- body: AddComment
103
- ): Promise<Comment> {
104
- const { data } = await this.api.post<CommentResponse>(
105
- `/workspaces/${workspaceId}/tasks/${id}/comment`,
106
- body
107
- );
108
- return data.comment;
109
- }
110
- }
@@ -1,94 +0,0 @@
1
- import {
2
- ActivityResponse,
3
- CreateWorkspace,
4
- Event,
5
- Task,
6
- TaskResponse,
7
- UpdateWorkspace,
8
- Workspace,
9
- WorkspaceResponse,
10
- WorkspaceStats,
11
- WorkspacesResponse,
12
- } from "@locusai/shared";
13
- import { BaseModule } from "./base.js";
14
-
15
- export class WorkspacesModule extends BaseModule {
16
- async listAll(): Promise<Workspace[]> {
17
- const { data } = await this.api.get<WorkspacesResponse>("/workspaces");
18
- return data.workspaces;
19
- }
20
-
21
- async listByOrg(orgId: string): Promise<Workspace[]> {
22
- const { data } = await this.api.get<WorkspacesResponse>(
23
- `/workspaces/org/${orgId}`
24
- );
25
- return data.workspaces;
26
- }
27
-
28
- async create(body: CreateWorkspace & { orgId: string }): Promise<Workspace> {
29
- const { orgId, ...bodyWithoutOrgId } = body;
30
- const { data } = await this.api.post<WorkspaceResponse>(
31
- `/workspaces/org/${orgId}`,
32
- bodyWithoutOrgId
33
- );
34
- return data.workspace;
35
- }
36
-
37
- async createWithAutoOrg(body: CreateWorkspace): Promise<Workspace> {
38
- const { data } = await this.api.post<WorkspaceResponse>(
39
- "/workspaces",
40
- body
41
- );
42
- return data.workspace;
43
- }
44
-
45
- async getById(id: string): Promise<Workspace> {
46
- const { data } = await this.api.get<WorkspaceResponse>(`/workspaces/${id}`);
47
- return data.workspace;
48
- }
49
-
50
- async update(id: string, body: UpdateWorkspace): Promise<Workspace> {
51
- const { data } = await this.api.put<WorkspaceResponse>(
52
- `/workspaces/${id}`,
53
- body
54
- );
55
- return data.workspace;
56
- }
57
-
58
- async delete(id: string): Promise<void> {
59
- await this.api.delete(`/workspaces/${id}`);
60
- }
61
-
62
- async getStats(id: string): Promise<WorkspaceStats> {
63
- const { data } = await this.api.get<WorkspaceStats>(
64
- `/workspaces/${id}/stats`
65
- );
66
- return data;
67
- }
68
-
69
- async getActivity(id: string, limit?: number): Promise<Event[]> {
70
- const { data } = await this.api.get<ActivityResponse>(
71
- `/workspaces/${id}/activity`,
72
- {
73
- params: { limit },
74
- }
75
- );
76
- return data.activity;
77
- }
78
-
79
- /**
80
- * Dispatch a task from the workspace backlog to an agent.
81
- * Atomically moves a task from BACKLOG to IN_PROGRESS and assigns it.
82
- */
83
- async dispatch(
84
- id: string,
85
- workerId: string,
86
- sprintId?: string
87
- ): Promise<Task> {
88
- const { data } = await this.api.post<TaskResponse>(
89
- `/workspaces/${id}/dispatch`,
90
- { workerId, sprintId }
91
- );
92
- return data.task;
93
- }
94
- }