deleteModel method

Future<int> deleteModel(
  1. SyniModelSpec model
)

Permanently removes model from the device: frees the engine + worker isolate, then deletes the GGUF and its sibling tokenizer.json from disk, reclaiming the ~1.1 GB the install occupies. Resets installState to SyniNotInstalled so a subsequent install re-downloads.

Unlike uninstall (which only frees the in-memory engine), this is a genuine storage-reclaiming delete. Returns the number of bytes freed. Throws SyniInstallException if a model file cannot be removed; the engine is still disposed and state is left as SyniNotInstalled in that case so the agent isn't stuck.

Implementation

Future<int> deleteModel(SyniModelSpec model) async {
  await _runtime.dispose();
  _persona = null;
  try {
    return await _installer.deleteModel(model);
  } finally {
    _state.add(const SyniNotInstalled());
  }
}