Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix(ruflo-mods): capabilityProbe counts session.measure, agent.spawn and plugin.register only where the options hook them (#3805)

Dragan Spiridonovfff705bb3acb
diff --git a/plugins/ruflo-mods/hooks/probe/index.ts b/plugins/ruflo-mods/hooks/probe/index.ts
index 6d7788ce8c..39f5298ab9 100644
--- a/plugins/ruflo-mods/hooks/probe/index.ts
+++ b/plugins/ruflo-mods/hooks/probe/index.ts
@@ -30,10 +30,17 @@ const MAX_LINE = 240
* statically (it refuses a wrapped or aliased `on`), so the list is kept here
* and a test fails when it drifts from the `on('<event>', ...)` calls in hooks/.
*/
-const ALWAYS = ['agent.spawn', 'command.run', 'engine.create', 'plugin.register', 'prompt.submit', 'session.end', 'session.measure', 'session.start', 'tool.call', 'tool.check', 'turn.complete'] as const
+const ALWAYS = ['command.run', 'engine.create', 'prompt.submit', 'session.end', 'session.start', 'tool.call', 'tool.check', 'turn.complete'] as const
-export function registeredEvents(opts: Pick<ModOptions, 'toolHints' | 'agentTrim' | 'deliveryScreen'> & Partial<Pick<ModOptions, 'compactCarry'>>): string[] {
+type EventOptions = Pick<ModOptions, 'toolHints' | 'agentTrim' | 'deliveryScreen'> &
+ Partial<Pick<ModOptions, 'compactCarry' | 'costBudgetUsd' | 'costHardStop' | 'sessionRollup' | 'modTrust'>>
+
+export function registeredEvents(opts: EventOptions): string[] {
const names: string[] = [...ALWAYS]
+ // Registered only under these options, so "never fired" is not reported for an event the mod did not hook.
+ if (opts.modTrust !== 'off') names.push('plugin.register')
+ if (opts.costBudgetUsd !== undefined) names.push('session.measure')
+ if ((opts.costBudgetUsd !== undefined && opts.costHardStop) || opts.sessionRollup || opts.agentTrim) names.push('agent.spawn')
if (opts.toolHints) names.push('tool.describe')
if (opts.agentTrim) names.push('agent.offer')
if (opts.deliveryScreen) names.push('session.receive', 'session.send')
diff --git a/plugins/ruflo-mods/tests/probe.test.ts b/plugins/ruflo-mods/tests/probe.test.ts
index 5d1692c634..6a63fc714f 100644
--- a/plugins/ruflo-mods/tests/probe.test.ts
+++ b/plugins/ruflo-mods/tests/probe.test.ts
@@ -28,9 +28,22 @@ describe('capability probe, pure (ADR-451 item 5)', () => {
expect(off).not.toContain('tool.describe')
expect(off).toContain('tool.check')
expect(registeredEvents({ toolHints: true, agentTrim: true, deliveryScreen: true, compactCarry: true })).toEqual(
- [...off, 'tool.describe', 'agent.offer', 'session.receive', 'session.send', 'session.compact'].sort(),
+ [...off, 'tool.describe', 'agent.offer', 'agent.spawn', 'session.receive', 'session.send', 'session.compact'].sort(),
)
})
+
+ test('events hooked only under an option are counted only under it', () => {
+ const base = { toolHints: false, agentTrim: false, deliveryScreen: false }
+ const off = registeredEvents(base)
+ for (const e of ['session.measure', 'agent.spawn']) expect(off).not.toContain(e)
+ expect(off).toContain('plugin.register')
+ expect(registeredEvents({ ...base, modTrust: 'off' })).not.toContain('plugin.register')
+ expect(registeredEvents({ ...base, costBudgetUsd: 5 })).toContain('session.measure')
+ expect(registeredEvents({ ...base, costBudgetUsd: 5 })).not.toContain('agent.spawn')
+ expect(registeredEvents({ ...base, costBudgetUsd: 5, costHardStop: true })).toContain('agent.spawn')
+ expect(registeredEvents({ ...base, costHardStop: true })).not.toContain('agent.spawn')
+ expect(registeredEvents({ ...base, sessionRollup: true })).toContain('agent.spawn')
+ })
})
describe('capabilityProbe option (ADR-451 item 5)', () => {