Improve auto-loop event emission and add ntfy notifications (#821)

This commit is contained in:
gsxdsm
2026-03-01 00:12:22 -08:00
committed by GitHub
parent 63b0a4fb38
commit 57bcb2802d
53 changed files with 4620 additions and 255 deletions

View File

@@ -172,8 +172,13 @@ export type {
EventHookHttpMethod,
EventHookShellAction,
EventHookHttpAction,
EventHookNtfyAction,
EventHookAction,
EventHook,
EventHookContext,
// Ntfy notification types
NtfyAuthenticationType,
NtfyEndpointConfig,
// Feature template types
FeatureTemplate,
// Claude-compatible provider types (new)

View File

@@ -12,7 +12,9 @@ export type NotificationType =
| 'feature_waiting_approval'
| 'feature_verified'
| 'spec_regeneration_complete'
| 'agent_complete';
| 'agent_complete'
| 'feature_error'
| 'auto_mode_error';
/**
* Notification - A single notification entry

View File

@@ -747,6 +747,49 @@ export type EventHookTrigger =
/** HTTP methods supported for webhook requests */
export type EventHookHttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH';
/**
* NtfyAuthenticationType - Authentication methods for ntfy.sh
*
* - 'none': No authentication (default for public topics)
* - 'basic': Username and password authentication
* - 'token': Access token authentication
*/
export type NtfyAuthenticationType = 'none' | 'basic' | 'token';
/**
* NtfyEndpointConfig - Configuration for a ntfy.sh notification endpoint
*
* Stores reusable ntfy.sh server configuration that can be referenced
* by multiple event hooks. Supports custom servers (self-hosted),
* authentication, and notification customization.
*/
export interface NtfyEndpointConfig {
/** Unique identifier for this endpoint configuration */
id: string;
/** Display name (e.g., "Personal Phone", "Team Channel") */
name: string;
/** Server URL (default: https://ntfy.sh) */
serverUrl: string;
/** Topic name (required, no spaces) */
topic: string;
/** Authentication type */
authType: NtfyAuthenticationType;
/** Username for basic auth (required if authType === 'basic') */
username?: string;
/** Password for basic auth (required if authType === 'basic') */
password?: string;
/** Access token (required if authType === 'token') */
token?: string;
/** Default tags for notifications (comma-separated emoji codes) */
defaultTags?: string;
/** Default emoji for notifications (emoji or shortcode) */
defaultEmoji?: string;
/** Default click action URL (auto-populated with server URL) */
defaultClickUrl?: string;
/** Whether this endpoint is enabled */
enabled: boolean;
}
/**
* EventHookShellAction - Configuration for executing a shell command
*
@@ -778,8 +821,32 @@ export interface EventHookHttpAction {
body?: string;
}
/**
* EventHookNtfyAction - Configuration for sending ntfy.sh push notifications
*
* Uses a pre-configured ntfy.sh endpoint from the global settings.
* Supports variable substitution in title and body.
*/
export interface EventHookNtfyAction {
type: 'ntfy';
/** ID of the NtfyEndpointConfig to use */
endpointId: string;
/** Notification title (supports {{variable}} substitution, defaults to event name) */
title?: string;
/** Notification body/message (supports {{variable}} substitution) */
body?: string;
/** Tags for this specific notification (comma-separated, overrides endpoint default) */
tags?: string;
/** Emoji for this specific notification (overrides endpoint default) */
emoji?: string;
/** Click action URL (overrides endpoint default, supports {{variable}} substitution) */
clickUrl?: string;
/** Priority level (1=min, 3=default, 5=max/urgent) */
priority?: 1 | 2 | 3 | 4 | 5;
}
/** Union type for all hook action configurations */
export type EventHookAction = EventHookShellAction | EventHookHttpAction;
export type EventHookAction = EventHookShellAction | EventHookHttpAction | EventHookNtfyAction;
/**
* EventHook - Configuration for a single event hook
@@ -818,6 +885,31 @@ export const EVENT_HOOK_TRIGGER_LABELS: Record<EventHookTrigger, string> = {
auto_mode_error: 'Auto mode paused due to error',
};
/**
* EventHookContext - Context variables available for substitution in event hooks
*
* These variables can be used in shell commands, HTTP bodies, and ntfy notifications
* using the {{variableName}} syntax.
*/
export interface EventHookContext {
/** ID of the feature (if applicable) */
featureId?: string;
/** Title/name of the feature (if applicable) */
featureName?: string;
/** Absolute path to the project */
projectPath?: string;
/** Name of the project (derived from path) */
projectName?: string;
/** Error message (only for error events) */
error?: string;
/** Error type/classification (only for error events) */
errorType?: string;
/** ISO timestamp when the event occurred */
timestamp: string;
/** The event type that triggered the hook */
eventType: EventHookTrigger;
}
const DEFAULT_CODEX_AUTO_LOAD_AGENTS = false;
const DEFAULT_CODEX_SANDBOX_MODE: CodexSandboxMode = 'workspace-write';
const DEFAULT_CODEX_APPROVAL_POLICY: CodexApprovalPolicy = 'on-request';
@@ -1398,6 +1490,14 @@ export interface GlobalSettings {
*/
eventHooks?: EventHook[];
// Ntfy.sh Notification Endpoints
/**
* Configured ntfy.sh notification endpoints for push notifications.
* These endpoints can be referenced by event hooks to send notifications.
* @see NtfyEndpointConfig for configuration details
*/
ntfyEndpoints?: NtfyEndpointConfig[];
// Feature Templates Configuration
/**
* Feature templates for quick task creation from the Add Feature dropdown
@@ -1823,6 +1923,8 @@ export const DEFAULT_GLOBAL_SETTINGS: GlobalSettings = {
subagentsSources: ['user', 'project'],
// Event hooks
eventHooks: [],
// Ntfy.sh notification endpoints
ntfyEndpoints: [],
// Feature templates
featureTemplates: DEFAULT_FEATURE_TEMPLATES,
// New provider system