oh-my-codex 0.3.8 → 0.3.10

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 (131) hide show
  1. package/dist/cli/__tests__/doctor-team.test.js +58 -0
  2. package/dist/cli/__tests__/doctor-team.test.js.map +1 -1
  3. package/dist/cli/__tests__/index.test.js +3 -3
  4. package/dist/cli/__tests__/index.test.js.map +1 -1
  5. package/dist/cli/__tests__/lifecycle-notifications.test.d.ts +2 -0
  6. package/dist/cli/__tests__/lifecycle-notifications.test.d.ts.map +1 -0
  7. package/dist/cli/__tests__/lifecycle-notifications.test.js +48 -0
  8. package/dist/cli/__tests__/lifecycle-notifications.test.js.map +1 -0
  9. package/dist/cli/doctor.js +28 -0
  10. package/dist/cli/doctor.js.map +1 -1
  11. package/dist/cli/index.d.ts.map +1 -1
  12. package/dist/cli/index.js +41 -1
  13. package/dist/cli/index.js.map +1 -1
  14. package/dist/config/__tests__/models.test.d.ts +2 -0
  15. package/dist/config/__tests__/models.test.d.ts.map +1 -0
  16. package/dist/config/__tests__/models.test.js +69 -0
  17. package/dist/config/__tests__/models.test.js.map +1 -0
  18. package/dist/config/models.d.ts +24 -0
  19. package/dist/config/models.d.ts.map +1 -0
  20. package/dist/config/models.js +53 -0
  21. package/dist/config/models.js.map +1 -0
  22. package/dist/hooks/__tests__/notify-hook-team-leader-nudge.test.js +221 -36
  23. package/dist/hooks/__tests__/notify-hook-team-leader-nudge.test.js.map +1 -1
  24. package/dist/mcp/__tests__/state-paths.test.js +21 -1
  25. package/dist/mcp/__tests__/state-paths.test.js.map +1 -1
  26. package/dist/mcp/__tests__/state-server-team-tools.test.js +53 -1
  27. package/dist/mcp/__tests__/state-server-team-tools.test.js.map +1 -1
  28. package/dist/mcp/state-paths.d.ts +1 -0
  29. package/dist/mcp/state-paths.d.ts.map +1 -1
  30. package/dist/mcp/state-paths.js +34 -1
  31. package/dist/mcp/state-paths.js.map +1 -1
  32. package/dist/mcp/state-server.d.ts.map +1 -1
  33. package/dist/mcp/state-server.js +46 -11
  34. package/dist/mcp/state-server.js.map +1 -1
  35. package/dist/notifications/__tests__/config.test.d.ts +2 -0
  36. package/dist/notifications/__tests__/config.test.d.ts.map +1 -0
  37. package/dist/notifications/__tests__/config.test.js +186 -0
  38. package/dist/notifications/__tests__/config.test.js.map +1 -0
  39. package/dist/notifications/__tests__/dispatcher.test.d.ts +2 -0
  40. package/dist/notifications/__tests__/dispatcher.test.d.ts.map +1 -0
  41. package/dist/notifications/__tests__/dispatcher.test.js +202 -0
  42. package/dist/notifications/__tests__/dispatcher.test.js.map +1 -0
  43. package/dist/notifications/__tests__/formatter.test.d.ts +2 -0
  44. package/dist/notifications/__tests__/formatter.test.d.ts.map +1 -0
  45. package/dist/notifications/__tests__/formatter.test.js +103 -0
  46. package/dist/notifications/__tests__/formatter.test.js.map +1 -0
  47. package/dist/notifications/__tests__/notifier.test.d.ts +2 -0
  48. package/dist/notifications/__tests__/notifier.test.d.ts.map +1 -0
  49. package/dist/notifications/__tests__/notifier.test.js +104 -0
  50. package/dist/notifications/__tests__/notifier.test.js.map +1 -0
  51. package/dist/notifications/__tests__/profiles.test.d.ts +2 -0
  52. package/dist/notifications/__tests__/profiles.test.d.ts.map +1 -0
  53. package/dist/notifications/__tests__/profiles.test.js +404 -0
  54. package/dist/notifications/__tests__/profiles.test.js.map +1 -0
  55. package/dist/notifications/__tests__/reply-listener.test.d.ts +2 -0
  56. package/dist/notifications/__tests__/reply-listener.test.d.ts.map +1 -0
  57. package/dist/notifications/__tests__/reply-listener.test.js +58 -0
  58. package/dist/notifications/__tests__/reply-listener.test.js.map +1 -0
  59. package/dist/notifications/__tests__/session-registry.test.d.ts +2 -0
  60. package/dist/notifications/__tests__/session-registry.test.d.ts.map +1 -0
  61. package/dist/notifications/__tests__/session-registry.test.js +147 -0
  62. package/dist/notifications/__tests__/session-registry.test.js.map +1 -0
  63. package/dist/notifications/__tests__/tmux-detector.test.d.ts +2 -0
  64. package/dist/notifications/__tests__/tmux-detector.test.d.ts.map +1 -0
  65. package/dist/notifications/__tests__/tmux-detector.test.js +77 -0
  66. package/dist/notifications/__tests__/tmux-detector.test.js.map +1 -0
  67. package/dist/notifications/__tests__/tmux.test.d.ts +2 -0
  68. package/dist/notifications/__tests__/tmux.test.d.ts.map +1 -0
  69. package/dist/notifications/__tests__/tmux.test.js +86 -0
  70. package/dist/notifications/__tests__/tmux.test.js.map +1 -0
  71. package/dist/notifications/config.d.ts +44 -0
  72. package/dist/notifications/config.d.ts.map +1 -0
  73. package/dist/notifications/config.js +407 -0
  74. package/dist/notifications/config.js.map +1 -0
  75. package/dist/notifications/dispatcher.d.ts +15 -0
  76. package/dist/notifications/dispatcher.d.ts.map +1 -0
  77. package/dist/notifications/dispatcher.js +410 -0
  78. package/dist/notifications/dispatcher.js.map +1 -0
  79. package/dist/notifications/formatter.d.ts +14 -0
  80. package/dist/notifications/formatter.d.ts.map +1 -0
  81. package/dist/notifications/formatter.js +134 -0
  82. package/dist/notifications/formatter.js.map +1 -0
  83. package/dist/notifications/index.d.ts +32 -0
  84. package/dist/notifications/index.d.ts.map +1 -0
  85. package/dist/notifications/index.js +93 -0
  86. package/dist/notifications/index.js.map +1 -0
  87. package/dist/notifications/reply-listener.d.ts +47 -0
  88. package/dist/notifications/reply-listener.d.ts.map +1 -0
  89. package/dist/notifications/reply-listener.js +656 -0
  90. package/dist/notifications/reply-listener.js.map +1 -0
  91. package/dist/notifications/session-registry.d.ts +26 -0
  92. package/dist/notifications/session-registry.d.ts.map +1 -0
  93. package/dist/notifications/session-registry.js +275 -0
  94. package/dist/notifications/session-registry.js.map +1 -0
  95. package/dist/notifications/tmux-detector.d.ts +17 -0
  96. package/dist/notifications/tmux-detector.d.ts.map +1 -0
  97. package/dist/notifications/tmux-detector.js +77 -0
  98. package/dist/notifications/tmux-detector.js.map +1 -0
  99. package/dist/notifications/tmux.d.ts +28 -0
  100. package/dist/notifications/tmux.d.ts.map +1 -0
  101. package/dist/notifications/tmux.js +203 -0
  102. package/dist/notifications/tmux.js.map +1 -0
  103. package/dist/notifications/types.d.ts +181 -0
  104. package/dist/notifications/types.d.ts.map +1 -0
  105. package/dist/notifications/types.js +9 -0
  106. package/dist/notifications/types.js.map +1 -0
  107. package/dist/team/__tests__/runtime.test.js +54 -2
  108. package/dist/team/__tests__/runtime.test.js.map +1 -1
  109. package/dist/team/__tests__/state.test.js +30 -0
  110. package/dist/team/__tests__/state.test.js.map +1 -1
  111. package/dist/team/__tests__/worker-bootstrap.test.js +59 -1
  112. package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
  113. package/dist/team/runtime.d.ts +2 -2
  114. package/dist/team/runtime.d.ts.map +1 -1
  115. package/dist/team/runtime.js +50 -23
  116. package/dist/team/runtime.js.map +1 -1
  117. package/dist/team/state.d.ts +1 -1
  118. package/dist/team/state.d.ts.map +1 -1
  119. package/dist/team/state.js +5 -0
  120. package/dist/team/state.js.map +1 -1
  121. package/dist/team/tmux-session.d.ts.map +1 -1
  122. package/dist/team/tmux-session.js +53 -10
  123. package/dist/team/tmux-session.js.map +1 -1
  124. package/dist/team/worker-bootstrap.d.ts +12 -0
  125. package/dist/team/worker-bootstrap.d.ts.map +1 -1
  126. package/dist/team/worker-bootstrap.js +37 -0
  127. package/dist/team/worker-bootstrap.js.map +1 -1
  128. package/package.json +1 -1
  129. package/prompts/planner.md +3 -3
  130. package/scripts/notify-hook.js +137 -7
  131. package/skills/team/SKILL.md +3 -1
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Notification System - Public API
3
+ *
4
+ * Multi-platform lifecycle notifications for oh-my-codex.
5
+ * Sends notifications to Discord, Telegram, Slack, and generic webhooks
6
+ * on session lifecycle events.
7
+ *
8
+ * Usage:
9
+ * import { notifyLifecycle } from '../notifications/index.js';
10
+ * await notifyLifecycle('session-start', { sessionId, projectPath, ... });
11
+ */
12
+ export type { NotificationEvent, NotificationPlatform, FullNotificationConfig, FullNotificationPayload, NotificationResult, DispatchResult, DiscordNotificationConfig, DiscordBotNotificationConfig, TelegramNotificationConfig, SlackNotificationConfig, WebhookNotificationConfig, EventNotificationConfig, ReplyConfig, NotificationProfilesConfig, NotificationsBlock, } from "./types.js";
13
+ export { dispatchNotifications, sendDiscord, sendDiscordBot, sendTelegram, sendSlack, sendWebhook, } from "./dispatcher.js";
14
+ export { formatNotification, formatSessionStart, formatSessionStop, formatSessionEnd, formatSessionIdle, formatAskUserQuestion, } from "./formatter.js";
15
+ export { getCurrentTmuxSession, getCurrentTmuxPaneId, getTeamTmuxSessions, formatTmuxInfo, } from "./tmux.js";
16
+ export { getNotificationConfig, isEventEnabled, getEnabledPlatforms, getReplyConfig, getReplyListenerPlatformConfig, resolveProfileConfig, listProfiles, getActiveProfileName, } from "./config.js";
17
+ export { registerMessage, loadAllMappings, lookupByMessageId, removeSession, removeMessagesByPane, pruneStale, } from "./session-registry.js";
18
+ export type { SessionMapping } from "./session-registry.js";
19
+ export { startReplyListener, stopReplyListener, getReplyListenerStatus, isDaemonRunning, sanitizeReplyInput, } from "./reply-listener.js";
20
+ export { notify, loadNotificationConfig } from "./notifier.js";
21
+ export type { NotificationConfig, NotificationPayload } from "./notifier.js";
22
+ import type { NotificationEvent, FullNotificationPayload, DispatchResult } from "./types.js";
23
+ /**
24
+ * High-level notification function for lifecycle events.
25
+ *
26
+ * Reads config, checks if the event is enabled, formats the message,
27
+ * and dispatches to all configured platforms. Non-blocking, swallows errors.
28
+ */
29
+ export declare function notifyLifecycle(event: NotificationEvent, data: Partial<FullNotificationPayload> & {
30
+ sessionId: string;
31
+ }, profileName?: string): Promise<DispatchResult | null>;
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,YAAY,EACV,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,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AE,MAAM,CAAA;CAAE,EAC9D,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAuEhC"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Notification System - Public API
3
+ *
4
+ * Multi-platform lifecycle notifications for oh-my-codex.
5
+ * Sends notifications to Discord, Telegram, Slack, and generic webhooks
6
+ * on session lifecycle events.
7
+ *
8
+ * Usage:
9
+ * import { notifyLifecycle } from '../notifications/index.js';
10
+ * await notifyLifecycle('session-start', { sessionId, projectPath, ... });
11
+ */
12
+ export { dispatchNotifications, sendDiscord, sendDiscordBot, sendTelegram, sendSlack, sendWebhook, } from "./dispatcher.js";
13
+ export { formatNotification, formatSessionStart, formatSessionStop, formatSessionEnd, formatSessionIdle, formatAskUserQuestion, } from "./formatter.js";
14
+ export { getCurrentTmuxSession, getCurrentTmuxPaneId, getTeamTmuxSessions, formatTmuxInfo, } from "./tmux.js";
15
+ export { getNotificationConfig, isEventEnabled, getEnabledPlatforms, getReplyConfig, getReplyListenerPlatformConfig, resolveProfileConfig, listProfiles, getActiveProfileName, } from "./config.js";
16
+ export { registerMessage, loadAllMappings, lookupByMessageId, removeSession, removeMessagesByPane, pruneStale, } from "./session-registry.js";
17
+ export { startReplyListener, stopReplyListener, getReplyListenerStatus, isDaemonRunning, sanitizeReplyInput, } from "./reply-listener.js";
18
+ // Re-export the legacy notifier for backward compatibility
19
+ export { notify, loadNotificationConfig } from "./notifier.js";
20
+ import { getNotificationConfig, isEventEnabled } from "./config.js";
21
+ import { formatNotification } from "./formatter.js";
22
+ import { dispatchNotifications } from "./dispatcher.js";
23
+ import { getCurrentTmuxSession } from "./tmux.js";
24
+ import { basename } from "path";
25
+ /**
26
+ * High-level notification function for lifecycle events.
27
+ *
28
+ * Reads config, checks if the event is enabled, formats the message,
29
+ * and dispatches to all configured platforms. Non-blocking, swallows errors.
30
+ */
31
+ export async function notifyLifecycle(event, data, profileName) {
32
+ try {
33
+ const config = getNotificationConfig(profileName);
34
+ if (!config || !isEventEnabled(config, event)) {
35
+ return null;
36
+ }
37
+ const { getCurrentTmuxPaneId } = await import("./tmux.js");
38
+ const payload = {
39
+ event,
40
+ sessionId: data.sessionId,
41
+ message: "",
42
+ timestamp: data.timestamp || new Date().toISOString(),
43
+ tmuxSession: data.tmuxSession ?? getCurrentTmuxSession() ?? undefined,
44
+ tmuxPaneId: data.tmuxPaneId ?? getCurrentTmuxPaneId() ?? undefined,
45
+ projectPath: data.projectPath,
46
+ projectName: data.projectName ||
47
+ (data.projectPath ? basename(data.projectPath) : undefined),
48
+ modesUsed: data.modesUsed,
49
+ contextSummary: data.contextSummary,
50
+ durationMs: data.durationMs,
51
+ agentsSpawned: data.agentsSpawned,
52
+ agentsCompleted: data.agentsCompleted,
53
+ reason: data.reason,
54
+ activeMode: data.activeMode,
55
+ iteration: data.iteration,
56
+ maxIterations: data.maxIterations,
57
+ question: data.question,
58
+ incompleteTasks: data.incompleteTasks,
59
+ };
60
+ payload.message = data.message || formatNotification(payload);
61
+ const result = await dispatchNotifications(config, event, payload);
62
+ if (result.anySuccess && payload.tmuxPaneId) {
63
+ try {
64
+ const { registerMessage } = await import("./session-registry.js");
65
+ for (const r of result.results) {
66
+ if (r.success &&
67
+ r.messageId &&
68
+ (r.platform === "discord-bot" || r.platform === "telegram")) {
69
+ registerMessage({
70
+ platform: r.platform,
71
+ messageId: r.messageId,
72
+ sessionId: payload.sessionId,
73
+ tmuxPaneId: payload.tmuxPaneId,
74
+ tmuxSessionName: payload.tmuxSession || "",
75
+ event: payload.event,
76
+ createdAt: new Date().toISOString(),
77
+ projectPath: payload.projectPath,
78
+ });
79
+ }
80
+ }
81
+ }
82
+ catch {
83
+ // Non-fatal: reply correlation is best-effort
84
+ }
85
+ }
86
+ return result;
87
+ }
88
+ catch (error) {
89
+ console.error("[notifications] Error:", error instanceof Error ? error.message : error);
90
+ return null;
91
+ }
92
+ }
93
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAoBH,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,SAAS,EACT,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,8BAA8B,EAC9B,oBAAoB,EACpB,YAAY,EACZ,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,UAAU,GACX,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAE7B,2DAA2D;AAC3D,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAQ/D,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAwB,MAAM,aAAa,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,KAAwB,EACxB,IAA8D,EAC9D,WAAoB;IAEpB,IAAI,C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ply Listener Daemon
3
+ *
4
+ * Background daemon that polls Discord and Telegram for replies to notification messages,
5
+ * sanitizes input, verifies the target pane, and injects reply text via sendToPane().
6
+ *
7
+ * Security considerations:
8
+ * - State/PID/log files use restrictive permissions (0600)
9
+ * - Bot tokens stored in state file, NOT in environment variables
10
+ * - Two-layer input sanitization (sanitizeReplyInput + sanitizeForTmux)
11
+ * - Pane verification via analyzePaneContent before every injection
12
+ * - Authorization: only configured user IDs (Discord) / chat ID (Telegram) can inject
13
+ * - Rate limiting to prevent spam/abuse
14
+ */
15
+ import type { ReplyConfig } from './types.js';
16
+ export interface ReplyListenerState {
17
+ isRunning: boolean;
18
+ pid: number | null;
19
+ startedAt: string | null;
20
+ lastPollAt: string | null;
21
+ telegramLastUpdateId: number | null;
22
+ discordLastMessageId: string | null;
23
+ messagesInjected: number;
24
+ errors: number;
25
+ lastError?: string;
26
+ }
27
+ export interface ReplyListenerDaemonConfig extends ReplyConfig {
28
+ telegramBotToken?: string;
29
+ telegramChatId?: string;
30
+ discordBotToken?: string;
31
+ discordChannelId?: string;
32
+ discordMention?: string;
33
+ }
34
+ export interface DaemonResponse {
35
+ success: boolean;
36
+ message: string;
37
+ state?: ReplyListenerState;
38
+ error?: string;
39
+ }
40
+ export declare function isDaemonRunning(): boolean;
41
+ export declare function sanitizeReplyInput(text: string): string;
42
+ declare function pollLoop(): Promise<void>;
43
+ export declare function startReplyListener(config: ReplyListenerDaemonConfig): DaemonResponse;
44
+ export declare function stopReplyListener(): DaemonResponse;
45
+ export declare function getReplyListenerStatus(): DaemonResponse;
46
+ export { pollLoop };
47
+ //# sourceMappingURL=reply-listener.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reply-listener.d.ts","sourceRoot":"","sources":["../../src/notifications/reply-listener.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAoBH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAyB9C,MAAM,WAAW,kBAAkB;IACjC,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