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

974 B
Raw Blame
import type { PluginOptions } from 'claude-code'

export type Mode = 'off' | 'learn' | 'notify' | 'enforce'
export const MODES: readonly Mode[] = ['off', 'learn', 'notify', 'enforce']

/** The plugin's `userConfig`, validated: a bad value is the default (learn, graduate on). */
export type ModOptions = {
  readonly mode: Mode
  readonly autoGraduate: boolean
}

// BEGIN SHARED FLAG (generated by scripts/sync-mod-screen.mjs; edit plugins/ruflo-agentdb/hooks/options.ts)
export const flag = (value: unknown, fallback: boolean) =>
  value === true || value === 'true' || value === 'on' ? true : value === false || value === 'false' || value === 'off' ? false : fallback
// END SHARED FLAG

export const asMode = (value: unknown): Mode | undefined => MODES.find(m => m === value)

export function readOptions(options: PluginOptions | undefined): ModOptions {
  const o = options ?? {}
  return { mode: asMode(o.mode) ?? 'learn', autoGraduate: flag(o.autoGraduate, true) }
}