Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 65 additions & 2 deletions packages/agents-a365-notifications/src/agent-notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import {
USER_CREATED_LIFECYCLE_EVENT,
USER_WORKLOAD_ONBOARDING_LIFECYCLE_EVENT,
USER_DELETED_LIFECYCLE_EVENT,
USER_UNDELETED_LIFECYCLE_EVENT,
USER_UPDATED_LIFECYCLE_EVENT,
USER_MANAGER_UPDATED_LIFECYCLE_EVENT
} from './constants';

/**
Expand Down Expand Up @@ -280,6 +283,57 @@ function onAgenticUserIdentityDeletedNotification(
onLifecycleNotificationInternal(this, USER_DELETED_LIFECYCLE_EVENT, handler, rank, autoSignInHandlers);
}

/**
* Registers a route handler for user identity undeleted lifecycle notifications.
*
* @param this - The agent application
* @param handler - The notification handler
* @param rank - Rank order in which to evaluate this
* @param autoSignInHandlers - handlers
*/
function onAgenticUserIdentityUndeletedNotification(
this: AgentApplication<TurnState>,
handler: AgentNotificationHandler<TurnState>,
rank = 32767,
autoSignInHandlers?: string[]
): void {
onLifecycleNotificationInternal(this, USER_UNDELETED_LIFECYCLE_EVENT, handler, rank, autoSignInHandlers);
}

/**
* Registers a route handler for user identity updated lifecycle notifications.
*
* @param this - The agent application
* @param handler - The notification handler
* @param rank - Rank order in which to evaluate this
* @param autoSignInHandlers - handlers
*/
function onAgenticUserIdentityUpdatedNotification(
this: AgentApplication<TurnState>,
handler: AgentNotificationHandler<TurnState>,
rank = 32767,
autoSignInHandlers?: string[]
): void {
onLifecycleNotificationInternal(this, USER_UPDATED_LIFECYCLE_EVENT, handler, rank, autoSignInHandlers);
}

/**
* Registers a route handler for user manager updated lifecycle notifications.
*
* @param this - The agent application
* @param handler - The notification handler
* @param rank - Rank order in which to evaluate this
* @param autoSignInHandlers - handlers
*/
function onAgenticUserManagerUpdatedNotification(
this: AgentApplication<TurnState>,
handler: AgentNotificationHandler<TurnState>,
rank = 32767,
autoSignInHandlers?: string[]
): void {
onLifecycleNotificationInternal(this, USER_MANAGER_UPDATED_LIFECYCLE_EVENT, handler, rank, autoSignInHandlers);
}

/**
* Checks if the given channel ID is an agentic channel.
*/
Expand Down Expand Up @@ -307,7 +361,10 @@ function isValidLifecycleEvent(lifecycleEvent: string): boolean {
const validLifecycleEvents = [
USER_CREATED_LIFECYCLE_EVENT,
USER_WORKLOAD_ONBOARDING_LIFECYCLE_EVENT,
USER_DELETED_LIFECYCLE_EVENT
USER_DELETED_LIFECYCLE_EVENT,
USER_UNDELETED_LIFECYCLE_EVENT,
USER_UPDATED_LIFECYCLE_EVENT,
USER_MANAGER_UPDATED_LIFECYCLE_EVENT
];
return validLifecycleEvents.includes(lifecycleEvent.toLowerCase());
}
Expand All @@ -323,6 +380,9 @@ declare module '@microsoft/agents-hosting' {
onAgenticUserCreatedNotification(routeHandler: AgentNotificationHandler<TState>, rank?: number, autoSignInHandlers?: string[]): void;
onAgenticUserWorkloadOnboardingNotification(routeHandler: AgentNotificationHandler<TState>, rank?: number, autoSignInHandlers?: string[]): void;
onAgenticUserDeletedNotification(routeHandler: AgentNotificationHandler<TState>, rank?: number, autoSignInHandlers?: string[]): void;
onAgenticUserUndeletedNotification(routeHandler: AgentNotificationHandler<TState>, rank?: number, autoSignInHandlers?: string[]): void;
onAgenticUserUpdatedNotification(routeHandler: AgentNotificationHandler<TState>, rank?: number, autoSignInHandlers?: string[]): void;
onAgenticUserManagerUpdatedNotification(routeHandler: AgentNotificationHandler<TState>, rank?: number, autoSignInHandlers?: string[]): void;
}
}

Expand All @@ -334,4 +394,7 @@ AgentApplication.prototype.onAgenticPowerPointNotification = onAgenticPowerPoint
AgentApplication.prototype.onLifecycleNotification = onLifecycleNotification;
AgentApplication.prototype.onAgenticUserCreatedNotification = onAgenticUserIdentityCreatedNotification;
AgentApplication.prototype.onAgenticUserWorkloadOnboardingNotification = onAgenticUserWorkloadOnboardingNotification;
AgentApplication.prototype.onAgenticUserDeletedNotification = onAgenticUserIdentityDeletedNotification;
AgentApplication.prototype.onAgenticUserDeletedNotification = onAgenticUserIdentityDeletedNotification;
AgentApplication.prototype.onAgenticUserUndeletedNotification = onAgenticUserIdentityUndeletedNotification;
AgentApplication.prototype.onAgenticUserUpdatedNotification = onAgenticUserIdentityUpdatedNotification;
AgentApplication.prototype.onAgenticUserManagerUpdatedNotification = onAgenticUserManagerUpdatedNotification;
5 changes: 4 additions & 1 deletion packages/agents-a365-notifications/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ export const AGENTS_POWERPOINT_SUBCHANNEL = 'agents:powerpoint';
export const AGENT_LIFECYCLE = 'agentlifecycle';
export const USER_CREATED_LIFECYCLE_EVENT = 'agenticuseridentitycreated';
export const USER_WORKLOAD_ONBOARDING_LIFECYCLE_EVENT = 'agenticuserworkloadonboardingupdated';
export const USER_DELETED_LIFECYCLE_EVENT = 'agenticuserdeleted';
export const USER_DELETED_LIFECYCLE_EVENT = 'agenticuserdeleted';
export const USER_UNDELETED_LIFECYCLE_EVENT = 'agenticuserundeleted';
export const USER_UPDATED_LIFECYCLE_EVENT = 'agenticuseridentityupdated';
export const USER_MANAGER_UPDATED_LIFECYCLE_EVENT = 'agenticusermanagerupdated';
Loading