Skip to content

[chat] adding plan/update plan blocks for threads#115

Open
visyat wants to merge 1 commit intomainfrom
chat/plans
Open

[chat] adding plan/update plan blocks for threads#115
visyat wants to merge 1 commit intomainfrom
chat/plans

Conversation

@visyat
Copy link
Collaborator

@visyat visyat commented Feb 25, 2026

Adding basic post, edit, and task update operations for thread plans – unlocks the plan/task blocks in Slack for agent threads (status updates).

const plan = await thread.postPlan({
  initialMessage: "Starting...",
});
const result = await agent.generate({
  toolChoice: "required",
  prompt: message.text,
  onStepFinish: async (step) => {
    const { title: stepTitle, details: stepDetails } =
      getStepTaskTitleAndDetails(step);
    if (step.finishReason === "tool-calls") {
      // Single addTask: marks current complete and adds next in one edit (no flash).
      await plan.addTask({
        title: stepTitle,
        children: stepDetails.length > 0 ? stepDetails : undefined,
      });
    } else {
      await plan.updateTask({
        status: "complete",
        output: stepDetails.length > 0 ? stepDetails : undefined,
      });
    }
  },
  onFinish: async () => {
    await plan.complete({
      completeMessage: "AI finished",
    });
  },
});

@vercel
Copy link
Contributor

vercel bot commented Feb 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
chat Ignored Ignored Open in v0 Feb 25, 2026 11:29pm

@github-actions
Copy link
Contributor

Preview Branch Testing

To test this PR with real webhook traffic:

  1. Go to /settings on the production deployment
  2. Enter this PR's Vercel preview URL
  3. Save — all webhook requests will now be proxied to this preview

To disable: Clear the URL on the settings page.

updateChain: Promise<void>;
}

class PlanMessageImpl implements PlanMessage {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this and related code into a new file?


it("should render plan/task blocks and update in-place", async () => {
chat.onNewMention(async (thread) => {
const plan = await thread.postPlan({ initialMessage: "Working..." });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before doing this: Are there other things like it?

We have avoided postX APIs so far.

Should we make a Plan. Then post it. And use regular edit. And eventually slack adapter can do its thing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants