Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/agents/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { getIterationTrailingMessage } from '../config/hintConfig.js';
import { getRateLimitForModel } from '../config/rateLimits.js';
import { getRetryConfig } from '../config/retryConfig.js';
import { EditFile } from '../gadgets/EditFile.js';
import { Finish } from '../gadgets/Finish.js';
import { ListDirectory } from '../gadgets/ListDirectory.js';
import { ReadFile } from '../gadgets/ReadFile.js';
import { Sleep } from '../gadgets/Sleep.js';
Expand Down Expand Up @@ -303,6 +304,8 @@ function createAgentBuilderWithGadgets(
// new GetMyRecentActivity(), // Temporarily disabled
new AddChecklistToCard(),
new UpdateChecklistItem(),
// Session control
new Finish(),
];

const allGadgets = auEnabled ? [...baseGadgets, auList, auRead] : baseGadgets;
Expand Down
21 changes: 21 additions & 0 deletions src/gadgets/Finish.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Gadget, TaskCompletionSignal, z } from 'llmist';

export class Finish extends Gadget({
name: 'Finish',
description:
'Call this gadget when you have completed all tasks and want to end the session. This should be your final gadget call.',
schema: z.object({
comment: z.string().min(1).describe('A brief summary of what was accomplished'),
}),
examples: [
{
params: { comment: 'Created PR with all requested changes and tests passing' },
output: 'Session ended: Created PR with all requested changes and tests passing',
comment: 'End session after completing all work',
},
],
}) {
override execute(params: this['params']): never {
throw new TaskCompletionSignal(params.comment);
}
}