refactor: remove slug params from API calls — Tracker resolves actor from auth
This commit is contained in:
parent
fa9f280bdd
commit
4b3e4d6195
@ -90,7 +90,7 @@ export function createTaskTools(ctx: ToolContext): ToolDefinition<any>[] {
|
||||
parameters: UpdateTaskParams,
|
||||
async execute(_id: string, params: any) {
|
||||
const { task_id, ...fields } = params;
|
||||
await ctx.trackerClient.updateTask(task_id, fields, ctx.agentSlug);
|
||||
await ctx.trackerClient.updateTask(task_id, fields);
|
||||
return ok(`Task ${task_id} updated`);
|
||||
},
|
||||
},
|
||||
@ -101,7 +101,7 @@ export function createTaskTools(ctx: ToolContext): ToolDefinition<any>[] {
|
||||
parameters: TakeTaskParams,
|
||||
async execute(_id: string, params: any) {
|
||||
ctx.selfAssignedTasks.add(params.task_id);
|
||||
await ctx.trackerClient.takeTask(params.task_id, ctx.agentSlug);
|
||||
await ctx.trackerClient.takeTask(params.task_id);
|
||||
return ok(`Task ${params.task_id} taken by ${ctx.agentSlug}`);
|
||||
},
|
||||
},
|
||||
@ -111,7 +111,7 @@ export function createTaskTools(ctx: ToolContext): ToolDefinition<any>[] {
|
||||
description: 'Reject an assigned task with a reason. Task returns to backlog.',
|
||||
parameters: RejectTaskParams,
|
||||
async execute(_id: string, params: any) {
|
||||
await ctx.trackerClient.rejectTask(params.task_id, ctx.agentSlug, params.reason);
|
||||
await ctx.trackerClient.rejectTask(params.task_id, params.reason);
|
||||
return ok(`Task ${params.task_id} rejected: ${params.reason}`);
|
||||
},
|
||||
},
|
||||
@ -121,7 +121,7 @@ export function createTaskTools(ctx: ToolContext): ToolDefinition<any>[] {
|
||||
description: 'Subscribe to task notifications (become a watcher).',
|
||||
parameters: WatchTaskParams,
|
||||
async execute(_id: string, params: any) {
|
||||
await ctx.trackerClient.watchTask(params.task_id, ctx.agentSlug);
|
||||
await ctx.trackerClient.watchTask(params.task_id);
|
||||
return ok(`Now watching task ${params.task_id}`);
|
||||
},
|
||||
},
|
||||
|
||||
@ -62,28 +62,27 @@ export class TrackerClient {
|
||||
return this.request('POST', `/api/v1/tasks?project_slug=${encodeURIComponent(projectSlug)}`, task);
|
||||
}
|
||||
|
||||
async updateTask(taskId: string, fields: Record<string, unknown>, actor?: string): Promise<void> {
|
||||
this.log.info({ taskId, fields, actor }, 'Updating task');
|
||||
const qs = actor ? `?actor=${encodeURIComponent(actor)}` : '';
|
||||
await this.request('PATCH', `/api/v1/tasks/${taskId}${qs}`, fields);
|
||||
async updateTask(taskId: string, fields: Record<string, unknown>): Promise<void> {
|
||||
this.log.info({ taskId, fields }, 'Updating task');
|
||||
await this.request('PATCH', `/api/v1/tasks/${taskId}`, fields);
|
||||
}
|
||||
|
||||
async deleteTask(taskId: string): Promise<void> {
|
||||
await this.request('DELETE', `/api/v1/tasks/${taskId}`);
|
||||
}
|
||||
|
||||
async takeTask(taskId: string, slug: string): Promise<void> {
|
||||
this.log.info({ taskId, slug }, 'Taking task');
|
||||
await this.request('POST', `/api/v1/tasks/${taskId}/take?slug=${encodeURIComponent(slug)}`);
|
||||
async takeTask(taskId: string): Promise<void> {
|
||||
this.log.info({ taskId }, 'Taking task');
|
||||
await this.request('POST', `/api/v1/tasks/${taskId}/take`);
|
||||
}
|
||||
|
||||
async rejectTask(taskId: string, slug: string, reason?: string): Promise<void> {
|
||||
this.log.info({ taskId, slug, reason }, 'Rejecting task');
|
||||
await this.request('POST', `/api/v1/tasks/${taskId}/reject`, { slug, reason });
|
||||
async rejectTask(taskId: string, reason?: string): Promise<void> {
|
||||
this.log.info({ taskId, reason }, 'Rejecting task');
|
||||
await this.request('POST', `/api/v1/tasks/${taskId}/reject`, { reason });
|
||||
}
|
||||
|
||||
async watchTask(taskId: string, slug: string): Promise<void> {
|
||||
await this.request('POST', `/api/v1/tasks/${taskId}/watch?slug=${encodeURIComponent(slug)}`);
|
||||
async watchTask(taskId: string): Promise<void> {
|
||||
await this.request('POST', `/api/v1/tasks/${taskId}/watch`);
|
||||
}
|
||||
|
||||
// --- Steps (checklist inside task) ---
|
||||
|
||||
Loading…
Reference in New Issue
Block a user