gui: remove dead createSession method

This commit is contained in:
Levi Neely 2026-08-03 10:43:09 +02:00
parent 3fd7907359
commit c25bb2870c
2 changed files with 0 additions and 67 deletions

View File

@ -493,72 +493,6 @@ QStringList Ollie9pClient::getAvailableModels(const QString &backend) const
return it.value().toStringList();
}
bool Ollie9pClient::createSession(const QString &cwd, const QString &name, const QString &backend, const QString &model, const QString &agent, const QString &remote, const QString &agentAlias)
{
if (cwd.isEmpty()) return false;
// Step 1: Create the session (name only) using rdwr (write then read back result)
QString sessName = name;
{
QProcess proc;
QStringList args = {"-a", serverAddr(), "rdwr", "session/new"};
proc.start(ninepBin(), args);
proc.waitForStarted(3000);
QString input = "name=" + sessName + "\n";
proc.write(input.toUtf8());
proc.closeWriteChannel();
proc.waitForFinished(5000);
if (proc.exitCode() != 0) {
QString err = QString::fromUtf8(proc.readAllStandardError()).trimmed();
if (err.isEmpty())
err = QString::fromUtf8(proc.readAllStandardOutput()).trimmed();
qDebug() << "createSession (step 1) failed:" << err;
return false;
}
// Read the returned session name (auto-generated if blank)
QByteArray out = proc.readAllStandardOutput().trimmed();
if (!out.isEmpty())
sessName = QString::fromUtf8(out);
}
// Step 2: Create the agent within the session using rdwr
{
QStringList agentArgs;
agentArgs << "cwd=" + cwd;
if (!backend.isEmpty()) agentArgs << "backend=" + backend;
if (!model.isEmpty()) agentArgs << "model=" + model;
if (!agent.isEmpty()) agentArgs << "agent=" + agent;
if (!remote.isEmpty()) agentArgs << "remote=" + remote;
if (!agentAlias.isEmpty()) agentArgs << "name=" + agentAlias;
QProcess proc;
QStringList args = {"-a", serverAddr(), "rdwr", "session/" + sessName + "/agent/new"};
proc.start(ninepBin(), args);
proc.waitForStarted(3000);
QString input = agentArgs.join(" ") + "\n";
proc.write(input.toUtf8());
proc.closeWriteChannel();
proc.waitForFinished(5000);
if (proc.exitCode() != 0) {
QString err = QString::fromUtf8(proc.readAllStandardError()).trimmed();
if (err.isEmpty())
err = QString::fromUtf8(proc.readAllStandardOutput()).trimmed();
qDebug() << "createSession (step 2) failed:" << err;
// Clean up the session
QProcess killProc;
killProc.start(ninepBin(), {"-a", serverAddr(), "write", "session/" + sessName + "/ctl"});
killProc.waitForStarted(3000);
killProc.write("kill");
killProc.closeWriteChannel();
killProc.waitForFinished(3000);
return false;
}
}
return true;
}
bool Ollie9pClient::createQuickSession()
{
QProcess proc;

View File

@ -84,7 +84,6 @@ public:
Q_INVOKABLE void loadRootBackends();
Q_INVOKABLE void loadRootAgents();
Q_INVOKABLE QStringList getAvailableModels(const QString &backend) const;
Q_INVOKABLE bool createSession(const QString &cwd, const QString &name, const QString &backend, const QString &model, const QString &agent, const QString &remote, const QString &agentAlias);
Q_INVOKABLE bool createQuickSession();
Q_INVOKABLE QString createAgent(const QString &sessionId, const QString &cwd, const QString &backend, const QString &model, const QString &agent, const QString &remote, const QString &agentAlias);
Q_INVOKABLE bool killAgent(const QString &sessionId, const QString &agentId);