oh-my-codex 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/README.de.md +7 -2
  2. package/README.es.md +7 -2
  3. package/README.fr.md +7 -2
  4. package/README.it.md +7 -2
  5. package/README.ja.md +7 -2
  6. package/README.ko.md +7 -2
  7. package/README.md +61 -11
  8. package/README.pt.md +7 -2
  9. package/README.ru.md +7 -2
  10. package/README.tr.md +7 -2
  11. package/README.vi.md +7 -2
  12. package/README.zh-TW.md +366 -0
  13. package/README.zh.md +7 -2
  14. package/dist/cli/__tests__/index.test.js +70 -4
  15. package/dist/cli/__tests__/index.test.js.map +1 -1
  16. package/dist/cli/__tests__/setup-skills-overwrite.test.js +100 -1
  17. package/dist/cli/__tests__/setup-skills-overwrite.test.js.map +1 -1
  18. package/dist/cli/__tests__/team.test.js +219 -1
  19. package/dist/cli/__tests__/team.test.js.map +1 -1
  20. package/dist/cli/catalog-contract.d.ts.map +1 -1
  21. package/dist/cli/catalog-contract.js +8 -2
  22. package/dist/cli/catalog-contract.js.map +1 -1
  23. package/dist/cli/index.d.ts +7 -1
  24. package/dist/cli/index.d.ts.map +1 -1
  25. package/dist/cli/index.js +58 -12
  26. package/dist/cli/index.js.map +1 -1
  27. package/dist/cli/setup.d.ts.map +1 -1
  28. package/dist/cli/setup.js +50 -17
  29. package/dist/cli/setup.js.map +1 -1
  30. package/dist/cli/team.d.ts.map +1 -1
  31. package/dist/cli/team.js +257 -0
  32. package/dist/cli/team.js.map +1 -1
  33. package/dist/config/__tests__/models.test.js +11 -11
  34. package/dist/config/__tests__/models.test.js.map +1 -1
  35. package/dist/config/models.d.ts +4 -3
  36. package/dist/config/models.d.ts.map +1 -1
  37. package/dist/config/models.js +6 -5
  38. package/dist/config/models.js.map +1 -1
  39. package/dist/hooks/__tests__/keyword-detector.test.js +46 -3
  40. package/dist/hooks/__tests__/keyword-detector.test.js.map +1 -1
  41. package/dist/hooks/__tests__/notify-hook-all-workers-idle.test.js +23 -7
  42. package/dist/hooks/__tests__/notify-hook-all-workers-idle.test.js.map +1 -1
  43. package/dist/hooks/__tests__/notify-hook-team-dispatch.test.js +176 -1
  44. package/dist/hooks/__tests__/notify-hook-team-dispatch.test.js.map +1 -1
  45. package/dist/hooks/__tests__/notify-hook-team-leader-nudge.test.js +61 -1
  46. package/dist/hooks/__tests__/notify-hook-team-leader-nudge.test.js.map +1 -1
  47. package/dist/hooks/__tests__/notify-hook-worker-idle.test.js +17 -7
  48. package/dist/hooks/__tests__/notify-hook-worker-idle.test.js.map +1 -1
  49. package/dist/hooks/__tests__/openclaw-setup-contract.test.js +26 -16
  50. package/dist/hooks/__tests__/openclaw-setup-contract.test.js.map +1 -1
  51. package/dist/hooks/keyword-detector.d.ts +2 -1
  52. package/dist/hooks/keyword-detector.d.ts.map +1 -1
  53. package/dist/hooks/keyword-detector.js +41 -4
  54. package/dist/hooks/keyword-detector.js.map +1 -1
  55. package/dist/hooks/keyword-registry.d.ts.map +1 -1
  56. package/dist/hooks/keyword-registry.js +5 -0
  57. package/dist/hooks/keyword-registry.js.map +1 -1
  58. package/dist/mcp/__tests__/path-traversal.test.js +9 -227
  59. package/dist/mcp/__tests__/path-traversal.test.js.map +1 -1
  60. package/dist/mcp/__tests__/state-server-schema.test.js +16 -20
  61. package/dist/mcp/__tests__/state-server-schema.test.js.map +1 -1
  62. package/dist/mcp/__tests__/state-server-team-tools.test.js +30 -487
  63. package/dist/mcp/__tests__/state-server-team-tools.test.js.map +1 -1
  64. package/dist/mcp/state-server.d.ts +179 -0
  65. package/dist/mcp/state-server.d.ts.map +1 -1
  66. package/dist/mcp/state-server.js +217 -1111
  67. package/dist/mcp/state-server.js.map +1 -1
  68. package/dist/mcp/team-server.d.ts.map +1 -1
  69. package/dist/mcp/team-server.js +28 -7
  70. package/dist/mcp/team-server.js.map +1 -1
  71. package/dist/notifications/__tests__/dispatch-cooldown.test.d.ts +5 -0
  72. package/dist/notifications/__tests__/dispatch-cooldown.test.d.ts.map +1 -0
  73. package/dist/notifications/__tests__/dispatch-cooldown.test.js +100 -0
  74. package/dist/notifications/__tests__/dispatch-cooldown.test.js.map +1 -0
  75. package/dist/notifications/__tests__/temp-mode.test.d.ts +2 -0
  76. package/dist/notifications/__tests__/temp-mode.test.d.ts.map +1 -0
  77. package/dist/notifications/__tests__/temp-mode.test.js +172 -0
  78. package/dist/notifications/__tests__/temp-mode.test.js.map +1 -0
  79. package/dist/notifications/config.d.ts.map +1 -1
  80. package/dist/notifications/config.js +59 -6
  81. package/dist/notifications/config.js.map +1 -1
  82. package/dist/notifications/dispatch-cooldown.d.ts +36 -0
  83. package/dist/notifications/dispatch-cooldown.d.ts.map +1 -0
  84. package/dist/notifications/dispatch-cooldown.js +109 -0
  85. package/dist/notifications/dispatch-cooldown.js.map +1 -0
  86. package/dist/notifications/index.d.ts +5 -0
  87. package/dist/notifications/index.d.ts.map +1 -1
  88. package/dist/notifications/index.js +39 -8
  89. package/dist/notifications/index.js.map +1 -1
  90. package/dist/notifications/temp-contract.d.ts +22 -0
  91. package/dist/notifications/temp-contract.d.ts.map +1 -0
  92. package/dist/notifications/temp-contract.js +147 -0
  93. package/dist/notifications/temp-contract.js.map +1 -0
  94. package/dist/notifications/types.d.ts +18 -0
  95. package/dist/notifications/types.d.ts.map +1 -1
  96. package/dist/openclaw/__tests__/config.test.js +81 -0
  97. package/dist/openclaw/__tests__/config.test.js.map +1 -1
  98. package/dist/openclaw/__tests__/dispatcher.test.js +50 -7
  99. package/dist/openclaw/__tests__/dispatcher.test.js.map +1 -1
  100. package/dist/openclaw/config.d.ts +4 -0
  101. package/dist/openclaw/config.d.ts.map +1 -1
  102. package/dist/openclaw/config.js +110 -16
  103. package/dist/openclaw/config.js.map +1 -1
  104. package/dist/openclaw/dispatcher.d.ts +10 -4
  105. package/dist/openclaw/dispatcher.d.ts.map +1 -1
  106. package/dist/openclaw/dispatcher.js +40 -10
  107. package/dist/openclaw/dispatcher.js.map +1 -1
  108. package/dist/openclaw/types.d.ts +5 -1
  109. package/dist/openclaw/types.d.ts.map +1 -1
  110. package/dist/team/__tests__/api-interop.test.d.ts +2 -0
  111. package/dist/team/__tests__/api-interop.test.d.ts.map +1 -0
  112. package/dist/team/__tests__/api-interop.test.js +1052 -0
  113. package/dist/team/__tests__/api-interop.test.js.map +1 -0
  114. package/dist/team/__tests__/mcp-comm.test.js +30 -0
  115. package/dist/team/__tests__/mcp-comm.test.js.map +1 -1
  116. package/dist/team/__tests__/runtime-cli.test.js +6 -0
  117. package/dist/team/__tests__/runtime-cli.test.js.map +1 -1
  118. package/dist/team/__tests__/runtime.test.js +52 -22
  119. package/dist/team/__tests__/runtime.test.js.map +1 -1
  120. package/dist/team/__tests__/tmux-claude-workers-demo.test.d.ts +2 -0
  121. package/dist/team/__tests__/tmux-claude-workers-demo.test.d.ts.map +1 -0
  122. package/dist/team/__tests__/tmux-claude-workers-demo.test.js +190 -0
  123. package/dist/team/__tests__/tmux-claude-workers-demo.test.js.map +1 -0
  124. package/dist/team/__tests__/tmux-session.test.js +45 -2
  125. package/dist/team/__tests__/tmux-session.test.js.map +1 -1
  126. package/dist/team/__tests__/worker-bootstrap.test.js +20 -12
  127. package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
  128. package/dist/team/api-interop.d.ts +19 -0
  129. package/dist/team/api-interop.d.ts.map +1 -0
  130. package/dist/team/api-interop.js +578 -0
  131. package/dist/team/api-interop.js.map +1 -0
  132. package/dist/team/mcp-comm.d.ts.map +1 -1
  133. package/dist/team/mcp-comm.js +26 -0
  134. package/dist/team/mcp-comm.js.map +1 -1
  135. package/dist/team/runtime-cli.d.ts +3 -0
  136. package/dist/team/runtime-cli.d.ts.map +1 -1
  137. package/dist/team/runtime-cli.js +24 -2
  138. package/dist/team/runtime-cli.js.map +1 -1
  139. package/dist/team/runtime.d.ts.map +1 -1
  140. package/dist/team/runtime.js +67 -11
  141. package/dist/team/runtime.js.map +1 -1
  142. package/dist/team/scaling.js.map +1 -1
  143. package/dist/team/state/types.d.ts +1 -1
  144. package/dist/team/state/types.d.ts.map +1 -1
  145. package/dist/team/state.d.ts +1 -1
  146. package/dist/team/state.d.ts.map +1 -1
  147. package/dist/team/tmux-session.d.ts +1 -1
  148. package/dist/team/tmux-session.d.ts.map +1 -1
  149. package/dist/team/tmux-session.js +17 -5
  150. package/dist/team/tmux-session.js.map +1 -1
  151. package/dist/team/worker-bootstrap.d.ts.map +1 -1
  152. package/dist/team/worker-bootstrap.js +48 -19
  153. package/dist/team/worker-bootstrap.js.map +1 -1
  154. package/package.json +1 -1
  155. package/scripts/demo-claude-workers.sh +241 -0
  156. package/scripts/demo-team-e2e.sh +179 -0
  157. package/scripts/notify-hook/team-dispatch.js +186 -12
  158. package/scripts/notify-hook/team-leader-nudge.js +42 -2
  159. package/scripts/notify-hook/team-worker.js +63 -4
  160. package/skills/configure-notifications/SKILL.md +193 -185
  161. package/skills/omx-setup/SKILL.md +1 -1
  162. package/skills/team/SKILL.md +47 -5
  163. package/skills/worker/SKILL.md +40 -10
  164. package/templates/AGENTS.md +7 -3
  165. package/templates/catalog-manifest.json +26 -3
  166. package/skills/configure-discord/SKILL.md +0 -256
  167. package/skills/configure-openclaw/SKILL.md +0 -264
  168. package/skills/configure-slack/SKILL.md +0 -226
  169. package/skills/configure-telegram/SKILL.md +0 -232
@@ -1,226 +0,0 @@
1
- ---
2
- name: configure-slack
3
- description: Configure Slack webhook notifications via natural language
4
- triggers:
5
- - "configure slack"
6
- - "setup slack"
7
- - "slack notifications"
8
- - "slack webhook"
9
- ---
10
-
11
- # Configure Slack Notifications
12
-
13
- Set up Slack notifications so OMX can ping you when sessions end, need input, or complete background tasks.
14
-
15
- ## How This Skill Works
16
-
17
- This is an interactive, natural-language configuration skill. Walk the user through setup by asking questions with AskUserQuestion. Write the result to `~/.codex/.omx-config.json`.
18
-
19
- ## Step 1: Detect Existing Configuration
20
-
21
- ```bash
22
- CONFIG_FILE="$HOME/.codex/.omx-config.json"
23
-
24
- if [ -f "$CONFIG_FILE" ]; then
25
- HAS_SLACK=$(jq -r '.notifications.slack.enabled // false' "$CONFIG_FILE" 2>/dev/null)
26
- WEBHOOK_URL=$(jq -r '.notifications.slack.webhookUrl // empty' "$CONFIG_FILE" 2>/dev/null)
27
- CHANNEL=$(jq -r '.notifications.slack.channel // empty' "$CONFIG_FILE" 2>/dev/null)
28
- USERNAME=$(jq -r '.notifications.slack.username // empty' "$CONFIG_FILE" 2>/dev/null)
29
- MENTION=$(jq -r '.notifications.slack.mention // empty' "$CONFIG_FILE" 2>/dev/null)
30
-
31
- if [ "$HAS_SLACK" = "true" ]; then
32
- echo "EXISTING_CONFIG=true"
33
- [ -n "$WEBHOOK_URL" ] && echo "WEBHOOK_URL=$WEBHOOK_URL"
34
- [ -n "$CHANNEL" ] && echo "CHANNEL=$CHANNEL"
35
- [ -n "$USERNAME" ] && echo "USERNAME=$USERNAME"
36
- [ -n "$MENTION" ] && echo "MENTION=$MENTION"
37
- else
38
- echo "EXISTING_CONFIG=false"
39
- fi
40
- else
41
- echo "NO_CONFIG_FILE"
42
- fi
43
- ```
44
-
45
- If existing config is found, show the user what's currently configured and ask if they want to update or reconfigure.
46
-
47
- ## Step 2: Collect Webhook URL
48
-
49
- Use AskUserQuestion:
50
-
51
- **Question:** "Paste your Slack Incoming Webhook URL. To create one: Go to api.slack.com/apps > Your App > Incoming Webhooks > Add New Webhook to Workspace > Copy URL"
52
-
53
- The user will type their webhook URL in the "Other" field.
54
-
55
- **Validate** the URL:
56
- - Must start with `https://hooks.slack.com/services/` or `https://hooks.slack.com/workflows/`
57
- - If invalid, explain the format and ask again
58
-
59
- ## Step 3: Configure Channel (Optional)
60
-
61
- Use AskUserQuestion:
62
-
63
- **Question:** "Which Slack channel should receive notifications? (Optional — leave blank to use the webhook's default channel)"
64
-
65
- **Options:**
66
- 1. **Use webhook default** - The channel configured in the Slack app integration
67
- 2. **Specify a channel** - Enter a channel name (e.g. `#dev-alerts`) or channel ID
68
-
69
- Note: Overriding the channel requires the webhook to have permission for that channel.
70
-
71
- ## Step 4: Configure Mention (Optional)
72
-
73
- Use AskUserQuestion:
74
-
75
- **Question:** "Would you like notifications to mention (ping) someone?"
76
-
77
- **Options:**
78
- 1. **Yes, mention a user** - Tag a user with `<@UXXXXXXXX>`
79
- 2. **Yes, mention a channel** - Tag everyone with `<!channel>` or `<!here>`
80
- 3. **No mentions** - Just post the message without pinging anyone
81
-
82
- ### If user wants to mention a user:
83
-
84
- Ask: "What is the Slack member ID to mention? (Click the user's profile > More > Copy member ID)"
85
-
86
- Format: `<@UXXXXXXXX>` (e.g. `<@U012AB3CD>`)
87
-
88
- ### If user wants a channel mention:
89
-
90
- Choose between:
91
- - `<!channel>` — notifies all channel members regardless of online status
92
- - `<!here>` — notifies only currently active channel members
93
-
94
- ## Step 5: Configure Display Name (Optional)
95
-
96
- Use AskUserQuestion:
97
-
98
- **Question:** "Custom bot display name in Slack? (Shows as the message sender)"
99
-
100
- **Options:**
101
- 1. **OMX (default)** - Display as "OMX"
102
- 2. **Codex CLI** - Display as "Codex CLI"
103
- 3. **Custom** - Enter a custom name
104
-
105
- ## Step 6: Configure Events
106
-
107
- Use AskUserQuestion with multiSelect:
108
-
109
- **Question:** "Which events should trigger Slack notifications?"
110
-
111
- **Options (multiSelect: true):**
112
- 1. **Session end (Recommended)** - When a Codex session finishes
113
- 2. **Input needed** - When Codex is waiting for your response (great for long-running tasks)
114
- 3. **Session start** - When a new session begins
115
- 4. **Session continuing** - When a persistent mode keeps the session alive
116
-
117
- Default selection: session-end + ask-user-question.
118
-
119
- ## Step 7: Write Configuration
120
-
121
- Read the existing config, merge the new Slack settings, and write back:
122
-
123
- ```bash
124
- CONFIG_FILE="$HOME/.codex/.omx-config.json"
125
- mkdir -p "$(dirname "$CONFIG_FILE")"
126
-
127
- if [ -f "$CONFIG_FILE" ]; then
128
- EXISTING=$(cat "$CONFIG_FILE")
129
- else
130
- EXISTING='{}'
131
- fi
132
-
133
- # WEBHOOK_URL, CHANNEL, MENTION, USERNAME are collected from user
134
- echo "$EXISTING" | jq \
135
- --arg url "$WEBHOOK_URL" \
136
- --arg channel "$CHANNEL" \
137
- --arg mention "$MENTION" \
138
- --arg username "$USERNAME" \
139
- '.notifications = (.notifications // {enabled: true}) |
140
- .notifications.enabled = true |
141
- .notifications.slack = {
142
- enabled: true,
143
- webhookUrl: $url,
144
- channel: (if $channel == "" then null else $channel end),
145
- mention: (if $mention == "" then null else $mention end),
146
- username: (if $username == "" then null else $username end)
147
- }' > "$CONFIG_FILE"
148
- ```
149
-
150
- ### Add event-specific config if user didn't select all events:
151
-
152
- For each event NOT selected, disable it:
153
-
154
- ```bash
155
- # Example: disable session-start if not selected
156
- echo "$(cat "$CONFIG_FILE")" | jq \
157
- '.notifications.events = (.notifications.events // {}) |
158
- .notifications.events["session-start"] = {enabled: false}' > "$CONFIG_FILE"
159
- ```
160
-
161
- ## Step 8: Test the Configuration
162
-
163
- After writing config, offer to send a test notification:
164
-
165
- Use AskUserQuestion:
166
-
167
- **Question:** "Send a test notification to verify the setup?"
168
-
169
- **Options:**
170
- 1. **Yes, test now (Recommended)** - Send a test message to your Slack channel
171
- 2. **No, I'll test later** - Skip testing
172
-
173
- ### If testing:
174
-
175
- ```bash
176
- RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" \
177
- -H "Content-Type: application/json" \
178
- -d "{\"text\": \"${MENTION:+$MENTION\\n}OMX test notification - Slack is configured!\", \"username\": \"${USERNAME:-OMX}\"}" \
179
- "$WEBHOOK_URL")
180
-
181
- if [ "$RESPONSE" = "200" ]; then
182
- echo "Test notification sent successfully!"
183
- else
184
- echo "Failed (HTTP $RESPONSE). Check the webhook URL and channel permissions."
185
- fi
186
- ```
187
-
188
- Report success or failure. Common issues:
189
- - **400 Bad Request**: Malformed JSON or invalid channel override
190
- - **403 Forbidden**: Channel override not permitted by the webhook
191
- - **404 Not Found**: Webhook URL is invalid or revoked — regenerate it in Slack
192
-
193
- ## Step 9: Confirm
194
-
195
- Display the final configuration summary:
196
-
197
- ```
198
- Slack Notifications Configured!
199
-
200
- Webhook: https://hooks.slack.com/services/...
201
- Channel: #dev-alerts (or "webhook default")
202
- Mention: <!channel> (or "none")
203
- Username: OMX
204
- Events: session-end, ask-user-question
205
-
206
- Config saved to: ~/.codex/.omx-config.json
207
-
208
- You can also set these via environment variables:
209
- OMX_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...
210
- OMX_SLACK_MENTION=<!channel>
211
-
212
- To reconfigure: /configure-slack
213
- To configure Discord: /configure-discord
214
- To configure Telegram: /configure-telegram
215
- ```
216
-
217
- ## Environment Variable Alternative
218
-
219
- Users can skip this wizard entirely by setting env vars in their shell profile:
220
-
221
- ```bash
222
- export OMX_SLACK_WEBHOOK_URL="https://hooks.slack.com/services/..."
223
- export OMX_SLACK_MENTION="<!channel>" # optional
224
- ```
225
-
226
- Env vars are auto-detected by the notification system without needing `.omx-config.json`.
@@ -1,232 +0,0 @@
1
- ---
2
- name: configure-telegram
3
- description: Configure Telegram bot notifications via natural language
4
- triggers:
5
- - "configure telegram"
6
- - "setup telegram"
7
- - "telegram notifications"
8
- - "telegram bot"
9
- ---
10
-
11
- # Configure Telegram Notifications
12
-
13
- Set up Telegram notifications so OMX can message you when sessions end, need input, or complete background tasks.
14
-
15
- ## How This Skill Works
16
-
17
- This is an interactive, natural-language configuration skill. Walk the user through setup by asking questions with AskUserQuestion. Write the result to `~/.codex/.omx-config.json`.
18
-
19
- ## Step 1: Detect Existing Configuration
20
-
21
- ```bash
22
- CONFIG_FILE="$HOME/.codex/.omx-config.json"
23
-
24
- if [ -f "$CONFIG_FILE" ]; then
25
- HAS_TELEGRAM=$(jq -r '.notifications.telegram.enabled // false' "$CONFIG_FILE" 2>/dev/null)
26
- CHAT_ID=$(jq -r '.notifications.telegram.chatId // empty' "$CONFIG_FILE" 2>/dev/null)
27
- PARSE_MODE=$(jq -r '.notifications.telegram.parseMode // "Markdown"' "$CONFIG_FILE" 2>/dev/null)
28
-
29
- if [ "$HAS_TELEGRAM" = "true" ]; then
30
- echo "EXISTING_CONFIG=true"
31
- echo "CHAT_ID=$CHAT_ID"
32
- echo "PARSE_MODE=$PARSE_MODE"
33
- else
34
- echo "EXISTING_CONFIG=false"
35
- fi
36
- else
37
- echo "NO_CONFIG_FILE"
38
- fi
39
- ```
40
-
41
- If existing config is found, show the user what's currently configured and ask if they want to update or reconfigure.
42
-
43
- ## Step 2: Create a Telegram Bot
44
-
45
- Guide the user through creating a bot if they don't have one:
46
-
47
- ```
48
- To set up Telegram notifications, you need a Telegram bot token and your chat ID.
49
-
50
- CREATE A BOT (if you don't have one):
51
- 1. Open Telegram and search for @BotFather
52
- 2. Send /newbot
53
- 3. Choose a name (e.g., "My OMX Notifier")
54
- 4. Choose a username (e.g., "my_omc_bot")
55
- 5. BotFather will give you a token like: 123456789:ABCdefGHIjklMNOpqrsTUVwxyz
56
-
57
- GET YOUR CHAT ID:
58
- 1. Start a chat with your new bot (send /start)
59
- 2. Visit: https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates
60
- 3. Look for "chat":{"id":YOUR_CHAT_ID}
61
- - Personal chat IDs are positive numbers (e.g., 123456789)
62
- - Group chat IDs are negative numbers (e.g., -1001234567890)
63
- ```
64
-
65
- ## Step 3: Collect Bot Token
66
-
67
- Use AskUserQuestion:
68
-
69
- **Question:** "Paste your Telegram bot token (from @BotFather)"
70
-
71
- The user will type their token in the "Other" field.
72
-
73
- **Validate** the token:
74
- - Must match pattern: `digits:alphanumeric` (e.g., `123456789:ABCdefGHI...`)
75
- - If invalid, explain the format and ask again
76
-
77
- ## Step 4: Collect Chat ID
78
-
79
- Use AskUserQuestion:
80
-
81
- **Question:** "Paste your Telegram chat ID (the number from getUpdates API)"
82
-
83
- The user will type their chat ID in the "Other" field.
84
-
85
- **Validate** the chat ID:
86
- - Must be a number (positive for personal, negative for groups)
87
- - If invalid, offer to help them find it:
88
-
89
- ```bash
90
- # Help user find their chat ID
91
- BOT_TOKEN="USER_PROVIDED_TOKEN"
92
- echo "Fetching recent messages to find your chat ID..."
93
- curl -s "https://api.telegram.org/bot${BOT_TOKEN}/getUpdates" | jq '.result[-1].message.chat.id // .result[-1].message.from.id // "No messages found - send /start to your bot first"'
94
- ```
95
-
96
- ## Step 5: Choose Parse Mode
97
-
98
- Use AskUserQuestion:
99
-
100
- **Question:** "Which message format do you prefer?"
101
-
102
- **Options:**
103
- 1. **Markdown (Recommended)** - Bold, italic, code blocks with Markdown syntax
104
- 2. **HTML** - Bold, italic, code with HTML tags
105
-
106
- ## Step 6: Configure Events
107
-
108
- Use AskUserQuestion with multiSelect:
109
-
110
- **Question:** "Which events should trigger Telegram notifications?"
111
-
112
- **Options (multiSelect: true):**
113
- 1. **Session end (Recommended)** - When a Codex session finishes
114
- 2. **Input needed** - When Codex is waiting for your response (great for long-running tasks)
115
- 3. **Session start** - When a new session begins
116
- 4. **Session continuing** - When a persistent mode keeps the session alive
117
-
118
- Default selection: session-end + ask-user-question.
119
-
120
- ## Step 7: Write Configuration
121
-
122
- Read the existing config, merge the new Telegram settings, and write back:
123
-
124
- ```bash
125
- CONFIG_FILE="$HOME/.codex/.omx-config.json"
126
- mkdir -p "$(dirname "$CONFIG_FILE")"
127
-
128
- if [ -f "$CONFIG_FILE" ]; then
129
- EXISTING=$(cat "$CONFIG_FILE")
130
- else
131
- EXISTING='{}'
132
- fi
133
-
134
- # BOT_TOKEN, CHAT_ID, PARSE_MODE are collected from user
135
- echo "$EXISTING" | jq \
136
- --arg token "$BOT_TOKEN" \
137
- --arg chatId "$CHAT_ID" \
138
- --arg parseMode "$PARSE_MODE" \
139
- '.notifications = (.notifications // {enabled: true}) |
140
- .notifications.enabled = true |
141
- .notifications.telegram = {
142
- enabled: true,
143
- botToken: $token,
144
- chatId: $chatId,
145
- parseMode: $parseMode
146
- }' > "$CONFIG_FILE"
147
- ```
148
-
149
- ### Add event-specific config if user didn't select all events:
150
-
151
- For each event NOT selected, disable it:
152
-
153
- ```bash
154
- # Example: disable session-start if not selected
155
- echo "$(cat "$CONFIG_FILE")" | jq \
156
- '.notifications.events = (.notifications.events // {}) |
157
- .notifications.events["session-start"] = {enabled: false}' > "$CONFIG_FILE"
158
- ```
159
-
160
- ## Step 8: Test the Configuration
161
-
162
- After writing config, offer to send a test notification:
163
-
164
- Use AskUserQuestion:
165
-
166
- **Question:** "Send a test notification to verify the setup?"
167
-
168
- **Options:**
169
- 1. **Yes, test now (Recommended)** - Send a test message to your Telegram chat
170
- 2. **No, I'll test later** - Skip testing
171
-
172
- ### If testing:
173
-
174
- ```bash
175
- BOT_TOKEN="USER_PROVIDED_TOKEN"
176
- CHAT_ID="USER_PROVIDED_CHAT_ID"
177
- PARSE_MODE="Markdown"
178
-
179
- RESPONSE=$(curl -s -w "\n%{http_code}" \
180
- "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \
181
- -d "chat_id=${CHAT_ID}" \
182
- -d "parse_mode=${PARSE_MODE}" \
183
- -d "text=OMX test notification - Telegram is configured!")
184
-
185
- HTTP_CODE=$(echo "$RESPONSE" | tail -1)
186
- BODY=$(echo "$RESPONSE" | head -1)
187
-
188
- if [ "$HTTP_CODE" = "200" ]; then
189
- echo "Test notification sent successfully!"
190
- else
191
- echo "Failed (HTTP $HTTP_CODE):"
192
- echo "$BODY" | jq -r '.description // "Unknown error"' 2>/dev/null || echo "$BODY"
193
- fi
194
- ```
195
-
196
- Report success or failure. Common issues:
197
- - **401 Unauthorized**: Bot token is invalid
198
- - **400 Bad Request: chat not found**: Chat ID is wrong, or user hasn't sent `/start` to the bot
199
- - **Network error**: Check connectivity to api.telegram.org
200
-
201
- ## Step 9: Confirm
202
-
203
- Display the final configuration summary:
204
-
205
- ```
206
- Telegram Notifications Configured!
207
-
208
- Bot: @your_bot_username
209
- Chat ID: 123456789
210
- Format: Markdown
211
- Events: session-end, ask-user-question
212
-
213
- Config saved to: ~/.codex/.omx-config.json
214
-
215
- You can also set these via environment variables:
216
- OMX_TELEGRAM_BOT_TOKEN=123456789:ABCdefGHI...
217
- OMX_TELEGRAM_CHAT_ID=123456789
218
-
219
- To reconfigure: /configure-telegram
220
- To configure Discord: /configure-discord
221
- ```
222
-
223
- ## Environment Variable Alternative
224
-
225
- Users can skip this wizard entirely by setting env vars in their shell profile:
226
-
227
- ```bash
228
- export OMX_TELEGRAM_BOT_TOKEN="123456789:ABCdefGHIjklMNOpqrsTUVwxyz"
229
- export OMX_TELEGRAM_CHAT_ID="123456789"
230
- ```
231
-
232
- Env vars are auto-detected by the notification system without needing `.omx-config.json`.