Repository navigation
feat(nuxi): move coding tasks into Slack code channels #2669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { openCodeChannel } from 'eve/channels/slack' | ||
| import { defineDynamic, defineTool } from 'eve/tools' | ||
| import { z } from 'zod' | ||
| import slack from '../channels/slack.js' | ||
| import { canUseGithubTools } from '../lib/github.js' | ||
| import { resolveContext } from '../lib/identity/context.js' | ||
|
|
||
| // Slack only, for the people who can use the `coder` subagent: a code channel is where its coding | ||
| // work happens, one channel and one session per task. | ||
| export default defineDynamic(async (ctx) => { | ||
| const auth = ctx.session.auth.current | ||
| if (resolveContext(auth).surface !== 'slack') return null | ||
| if (!(await ctx.memo(ctx.turn?.id ?? null, () => canUseGithubTools(auth)))) return null | ||
|
|
||
| return defineTool({ | ||
| description: [ | ||
| 'Move this Slack conversation into a new code channel before handing a coding task on nuxt.com to `coder`, such as a fix, a feature, or an investigation with long output.', | ||
| 'Answer in place when one message answers the request. Call it once per request; Slack links the new channel here and invites the person who asked, so afterward reply in one short sentence at most and continue the work in the channel.', | ||
| 'If it returns unavailable, such as when this already is a code channel, or Slack refuses, continue here and quote the reason without guessing its cause. Don\'t call it again for the same request, but do when the person asks you to try again, since the Slack setup may have changed.' | ||
| ].join(' '), | ||
| inputSchema: z.object({ | ||
| message: z.string().describe('The task and where to start. The channel sees the conversation so far.'), | ||
| name: z.string().max(80).describe('A short title, such as `Fix the useFetch example`.') | ||
| }), | ||
| async execute({ message, name }, toolCtx) { | ||
| return await openCodeChannel(toolCtx, slack, message, { name }) | ||
| } | ||
| }) | ||
| }) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.