Skip to content

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

Open
visyat wants to merge 12 commits intomainfrom
chat/plans
Open

[chat] adding plan/update plan blocks for threads#115
visyat wants to merge 12 commits 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 = new Plan({ initialMessage: "Starting..." });
await thread.post(plan);

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.

Project Deployment Actions Updated (UTC)
chat Ready Ready Preview, Comment, Open in v0 Mar 6, 2026 10:56pm
chat-sdk-nextjs-chat Ready Ready Preview, Comment, Open in v0 Mar 6, 2026 10:56pm

@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.

Resolved merge conflicts by keeping both sets of changes:
- adapter-slack/src/index.ts: kept both parseMarkdown and StreamingMarkdownRenderer imports
- chat/src/thread.ts: kept both plan imports and StreamingMarkdownRenderer import
- chat/src/thread.test.ts: kept both postPlan tests and subscribe/unsubscribe tests

Made-with: Cursor
#191)

* feat: refactor adapter-slack and types based on Malte's comments

Move PostableObject to dedicated file, update type exports, add fallback posts, and make PostableObject generic.

Slack-Thread: https://vercel.slack.com/archives/C0977L169MW/p1772755978706959?thread_ts=1772755978.706959&cid=C0977L169MW
Co-authored-by: Vishal Yathish <135551666+visyat@users.noreply.github.com>

* fix: fallback path for PostableObject and clean up exports

- Plan mutations (addTask, updateTask, complete) now work in fallback
  mode by using editMessage with fallback text instead of no-oping
- Revert Slack adapter to throw on unsupported kinds (caller handles
  fallback, so adapter-level fallback strings are unnecessary)
- Remove redundant re-exports of isPostableObject/PostableObject from
  plan.ts — export from canonical postable-object.ts only
- Stop exporting POSTABLE_OBJECT symbol (internal implementation detail)
- Fix nested ternary lint error in getFallbackText
- Add tests for fallback post/edit path

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: v0 <v0[bot]@users.noreply.github.com>
Co-authored-by: Hayden Bleasel <hello@haydenbleasel.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…object kinds

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@haydenbleasel
Copy link
Member

@cramforce approved and merged @visyat's branch changes, resolved your comments, updated against main

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.

3 participants