@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.
- package/dist/index-node.js +1590 -20
- package/dist/index.js +429 -121
- package/dist/orchestrator.d.ts.map +1 -1
- package/package.json +12 -23
- package/dist/agent/artifact-syncer.js +0 -77
- package/dist/agent/codebase-indexer-service.js +0 -55
- package/dist/agent/index.js +0 -5
- package/dist/agent/sprint-planner.js +0 -68
- package/dist/agent/task-executor.js +0 -60
- package/dist/agent/worker.js +0 -252
- package/dist/ai/anthropic-client.js +0 -70
- package/dist/ai/claude-runner.js +0 -71
- package/dist/ai/index.js +0 -2
- package/dist/core/config.js +0 -15
- package/dist/core/index.js +0 -3
- package/dist/core/indexer.js +0 -113
- package/dist/core/prompt-builder.js +0 -83
- package/dist/events.js +0 -15
- package/dist/modules/auth.js +0 -23
- package/dist/modules/base.js +0 -8
- package/dist/modules/ci.js +0 -7
- package/dist/modules/docs.js +0 -38
- package/dist/modules/invitations.js +0 -22
- package/dist/modules/organizations.js +0 -39
- package/dist/modules/sprints.js +0 -34
- package/dist/modules/tasks.js +0 -56
- package/dist/modules/workspaces.js +0 -49
- package/dist/orchestrator.js +0 -356
- package/dist/utils/colors.js +0 -54
- package/dist/utils/retry.js +0 -37
- package/src/agent/artifact-syncer.ts +0 -111
- package/src/agent/codebase-indexer-service.ts +0 -71
- package/src/agent/index.ts +0 -5
- package/src/agent/sprint-planner.ts +0 -86
- package/src/agent/task-executor.ts +0 -85
- package/src/agent/worker.ts +0 -322
- package/src/ai/anthropic-client.ts +0 -93
- package/src/ai/claude-runner.ts +0 -86
- package/src/ai/index.ts +0 -2
- package/src/core/config.ts +0 -21
- package/src/core/index.ts +0 -3
- package/src/core/indexer.ts +0 -131
- package/src/core/prompt-builder.ts +0 -91
- package/src/events.ts +0 -35
- package/src/index-node.ts +0 -23
- package/src/index.ts +0 -159
- package/src/modules/auth.ts +0 -48
- package/src/modules/base.ts +0 -9
- package/src/modules/ci.ts +0 -12
- package/src/modules/docs.ts +0 -84
- package/src/modules/invitations.ts +0 -45
- package/src/modules/organizations.ts +0 -90
- package/src/modules/sprints.ts +0 -69
- package/src/modules/tasks.ts +0 -110
- package/src/modules/workspaces.ts +0 -94
- package/src/orchestrator.ts +0 -473
- package/src/utils/colors.ts +0 -63
- 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
|
-
}
|
package/src/modules/sprints.ts
DELETED
|
@@ -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
|
-
}
|
package/src/modules/tasks.ts
DELETED
|
@@ -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
|
-
}
|