55import type { OpenCodeMessageContext , OpenCodeOptions , PromptPart , SlackContext } from "./types" ;
66import { getSlackActionApiUrl } from "@/config" ;
77
8- export function buildSlackSystemPrompt ( slack ?: SlackContext ) : string {
8+ export function buildSystemPrompt ( slack ?: SlackContext ) : string {
99 const lines = [
1010 "COMMUNICATION STYLE:" ,
1111 "- Be concise and conversational - this is chat, not documentation" ,
@@ -23,46 +23,46 @@ export function buildSlackSystemPrompt(slack?: SlackContext): string {
2323 "- Prefer: git commit --author=\"$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\" -m \"...\"" ,
2424 "- Use GH_TOKEN for gh commands when available; fall back to git commands when GH_TOKEN is not set." ,
2525 "" ,
26- "SLACK CONTEXT:" ,
2726 ] ;
2827
2928 if ( slack ) {
29+ lines . push ( "SLACK CONTEXT:" ) ;
3030 lines . push ( `- Channel: ${ slack . channelId } ` ) ;
3131 lines . push ( `- Thread: ${ slack . threadId } ` ) ;
3232 lines . push ( `- User: <@${ slack . userId } >` ) ;
3333 if ( slack . hasGitHubToken !== undefined ) {
3434 lines . push ( `- GitHub token available: ${ slack . hasGitHubToken ? "yes" : "no" } ` ) ;
3535 }
36- }
3736
38- lines . push ( "" ) ;
39- lines . push ( "SLACK ACTIONS:" ) ;
40- if ( slack ?. hasCustomSlackTool ) {
41- lines . push ( "- Use `ode_action` tool for Slack actions (messages, reactions, thread history, questions, uploads)." ) ;
42- } else {
43- const baseUrl = slack ?. odeSlackApiUrl ?? getSlackActionApiUrl ( ) ;
44- lines . push ( "- Use bash + curl to call the Ode Slack API." ) ;
45- lines . push ( `- Endpoint: ${ baseUrl } /action` ) ;
46- lines . push ( "- Payload: {\"action\":\"post_message\",\"channelId\":\"...\",\"threadId\":\"...\",\"messageId\":\"...\",\"text\":\"...\"}" ) ;
37+ lines . push ( "" ) ;
38+ lines . push ( "SLACK ACTIONS:" ) ;
39+ if ( slack . hasCustomSlackTool ) {
40+ lines . push ( "- Use `ode_action` tool for Slack actions (messages, reactions, thread history, questions, uploads)." ) ;
41+ } else {
42+ const baseUrl = slack . odeSlackApiUrl ?? getSlackActionApiUrl ( ) ;
43+ lines . push ( "- Use bash + curl to call the Ode Slack API." ) ;
44+ lines . push ( `- Endpoint: ${ baseUrl } /action` ) ;
45+ lines . push ( "- Payload: {\"action\":\"post_message\",\"channelId\":\"...\",\"threadId\":\"...\",\"messageId\":\"...\",\"text\":\"...\"}" ) ;
46+ }
47+ lines . push ( "- Supported actions: post_message, add_reaction, get_thread_messages, ask_user, get_user_info, upload_file." ) ;
48+ lines . push ( "- Required fields: channelId; threadId for thread actions; messageId + emoji for reactions; userId for get_user_info." ) ;
49+ lines . push ( "- add_reaction schema: { action: \"add_reaction\", channelId: string, messageId: string, emoji: \"thumbsup\" | \"eyes\" | \"ok_hand\" }" ) ;
50+ lines . push ( "- You can use any tool available via bash, curl" ) ;
51+ lines . push ( "" ) ;
52+ lines . push ( "IMPORTANT: Your text output is automatically posted to Slack." ) ;
53+ lines . push ( "- When asking the user to choose options, you can send an ask_user Slack action, do NOT also output text - the buttons are enough." ) ;
54+ lines . push ( "- Only output text OR use a messaging tool, never both." ) ;
55+ lines . push ( "" ) ;
56+ lines . push ( "FORMATTING:" ) ;
57+ lines . push ( "- Slack uses *bold* and _italic_ (not **bold** or *italic*)" ) ;
58+ lines . push ( "- Use ` for inline code and ``` for code blocks" ) ;
59+ lines . push ( "- Keep responses readable on mobile screens" ) ;
60+ lines . push ( "" ) ;
61+ lines . push ( "TASK LISTS:" ) ;
62+ lines . push ( "- When sharing tasks, put each item on its own line" ) ;
63+ lines . push ( "- Use four states: * not started, ♻️ in progress, ✅ done, 🚫 cancelled" ) ;
64+ lines . push ( "- If you include a task list, keep the tasks you have done at the top of the response" ) ;
4765 }
48- lines . push ( "- Supported actions: post_message, add_reaction, get_thread_messages, ask_user, get_user_info, upload_file." ) ;
49- lines . push ( "- Required fields: channelId; threadId for thread actions; messageId + emoji for reactions; userId for get_user_info." ) ;
50- lines . push ( "- add_reaction schema: { action: \"add_reaction\", channelId: string, messageId: string, emoji: \"thumbsup\" | \"eyes\" | \"ok_hand\" }" ) ;
51- lines . push ( "- You can use any tool available via bash, curl" ) ;
52- lines . push ( "" ) ;
53- lines . push ( "IMPORTANT: Your text output is automatically posted to Slack." ) ;
54- lines . push ( "- When asking the user to choose options, you can send an ask_user Slack action, do NOT also output text - the buttons are enough." ) ;
55- lines . push ( "- Only output text OR use a messaging tool, never both." ) ;
56- lines . push ( "" ) ;
57- lines . push ( "FORMATTING:" ) ;
58- lines . push ( "- Slack uses *bold* and _italic_ (not **bold** or *italic*)" ) ;
59- lines . push ( "- Use ` for inline code and ``` for code blocks" ) ;
60- lines . push ( "- Keep responses readable on mobile screens" ) ;
61- lines . push ( "" ) ;
62- lines . push ( "TASK LISTS:" ) ;
63- lines . push ( "- When sharing tasks, put each item on its own line" ) ;
64- lines . push ( "- Use four states: * not started, ♻️ in progress, ✅ done, 🚫 cancelled" ) ;
65- lines . push ( "- If you include a task list, keep the tasks you have done at the top of the response" ) ;
6666
6767 return lines . join ( "\n" ) ;
6868}
0 commit comments