add hw2
This commit is contained in:
38
node_modules/@zenuml/core/.kiro/hooks/README.md
generated
vendored
Normal file
38
node_modules/@zenuml/core/.kiro/hooks/README.md
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# Kiro Agent Hooks
|
||||
|
||||
This directory contains custom hooks that automatically execute when specific events occur in Kiro.
|
||||
|
||||
## Session Sound Notification Hook
|
||||
|
||||
**File:** `session-sound-notification.json` and `session-sound-notification.js`
|
||||
|
||||
**Purpose:** Plays system sounds to notify you when:
|
||||
|
||||
- An AI session completes
|
||||
- User input is required to continue
|
||||
- An error occurs
|
||||
|
||||
**Sounds Used (macOS):**
|
||||
|
||||
- **Session Complete:** Glass.aiff - A pleasant chime when tasks finish
|
||||
- **Input Required:** Sosumi.aiff - An attention-getting sound when you need to respond
|
||||
- **Error:** Basso.aiff - A distinctive sound for errors
|
||||
- **Default:** Ping.aiff - Fallback sound
|
||||
|
||||
**Configuration:**
|
||||
The hook is enabled by default and will auto-execute. You can disable it by setting `"enabled": false` in the JSON configuration file.
|
||||
|
||||
**Platform Notes:**
|
||||
|
||||
- Currently optimized for macOS using the `afplay` command
|
||||
- Uses built-in system sounds located in `/System/Library/Sounds/`
|
||||
- For other platforms, the sound files and playback command would need to be adjusted
|
||||
|
||||
## Managing Hooks
|
||||
|
||||
You can:
|
||||
|
||||
1. View current hooks in the Kiro Explorer under "Agent Hooks"
|
||||
2. Use Command Palette → "Open Kiro Hook UI" to create new hooks
|
||||
3. Edit hook files directly in this directory
|
||||
4. Enable/disable hooks by modifying the `enabled` property
|
||||
44
node_modules/@zenuml/core/.kiro/hooks/session-sound-notification.js
generated
vendored
Normal file
44
node_modules/@zenuml/core/.kiro/hooks/session-sound-notification.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Session Sound Notification Hook
|
||||
* Plays a sound when sessions end or user input is required
|
||||
*/
|
||||
|
||||
const playSound = (soundType = 'default') => {
|
||||
// For macOS, we can use the 'afplay' command to play system sounds
|
||||
const sounds = {
|
||||
default: '/System/Library/Sounds/Ping.aiff',
|
||||
complete: '/System/Library/Sounds/Glass.aiff',
|
||||
attention: '/System/Library/Sounds/Sosumi.aiff',
|
||||
error: '/System/Library/Sounds/Basso.aiff'
|
||||
};
|
||||
|
||||
const soundFile = sounds[soundType] || sounds.default;
|
||||
|
||||
try {
|
||||
// Use afplay to play the sound on macOS
|
||||
require('child_process').exec(`afplay "${soundFile}"`, (error) => {
|
||||
if (error) {
|
||||
console.log('Could not play sound:', error.message);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.log('Sound playback failed:', err.message);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
onSessionEnd: () => {
|
||||
console.log('🔊 Session completed - playing completion sound');
|
||||
playSound('complete');
|
||||
},
|
||||
|
||||
onUserInputRequired: () => {
|
||||
console.log('🔊 User input needed - playing attention sound');
|
||||
playSound('attention');
|
||||
},
|
||||
|
||||
onError: () => {
|
||||
console.log('🔊 Error occurred - playing error sound');
|
||||
playSound('error');
|
||||
}
|
||||
};
|
||||
23
node_modules/@zenuml/core/.kiro/hooks/session-sound-notification.json
generated
vendored
Normal file
23
node_modules/@zenuml/core/.kiro/hooks/session-sound-notification.json
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "Session Sound Notification",
|
||||
"description": "Plays a sound when a session ends or user input is needed",
|
||||
"triggers": [
|
||||
{
|
||||
"event": "session.end",
|
||||
"description": "Triggered when an AI session completes"
|
||||
},
|
||||
{
|
||||
"event": "user.input.required",
|
||||
"description": "Triggered when the AI needs user input to continue"
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"type": "system.sound",
|
||||
"sound": "notification",
|
||||
"description": "Play system notification sound"
|
||||
}
|
||||
],
|
||||
"enabled": true,
|
||||
"autoExecute": true
|
||||
}
|
||||
Reference in New Issue
Block a user