rpg-combat-pi-01/.pi/extensions/yak-mode-gate.ts
Willem van den Ende ba0903714c refactor: replace number health with Health value object in MagicalObject
- MagicalObject: internal #health and #maxHealth now Health type
- HealingObject: constructor, create, and heal use Health value object
- MagicalWeapon: constructor, create, and use use Health value object
- DamageDealer and Healer interfaces: health: number -> health: Health
- magical-objects.spec.ts: all assertions use .health.value
- Run npm run checks: 0 errors, 70 tests passing
2026-06-14 13:35:44 +01:00

21 lines
664 B
TypeScript

import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
import { isToolCallEventType } from '@earendil-works/pi-coding-agent';
export default function (pi: ExtensionAPI) {
pi.on('tool_call', async (event, ctx) => {
if (!isToolCallEventType('bash', event)) return;
const cmd = event.input.command || '';
const isYxCommand = cmd.includes('yx ');
// Allow yaks in interactive mode, block in print mode (sub-agents)
if (isYxCommand && ctx.mode === 'print') {
return {
block: true,
reason:
'yx commands are disabled in print mode. Sub-agents must focus on domain work only.',
};
}
});
}