new chatlistview component, file attachments, performance & primitive test
C++ / fmt (pull_request) Failing after 5s
C++ / build (pull_request) Failing after 9s
C++ / clang-tidy (pull_request) Failing after 10s
JS/TS / fmt (pull_request) Failing after 11s
JS/TS / lint (pull_request) Successful in 9s
Python / static (pull_request) Failing after 31s
Rust / build (pull_request) Successful in 49s
Python / verify (pull_request) Successful in 1m37s
Rust / fmt (pull_request) Successful in 27s
Rust / clippy (pull_request) Successful in 58s
C++ / fmt (pull_request) Failing after 5s
C++ / build (pull_request) Failing after 9s
C++ / clang-tidy (pull_request) Failing after 10s
JS/TS / fmt (pull_request) Failing after 11s
JS/TS / lint (pull_request) Successful in 9s
Python / static (pull_request) Failing after 31s
Rust / build (pull_request) Successful in 49s
Python / verify (pull_request) Successful in 1m37s
Rust / fmt (pull_request) Successful in 27s
Rust / clippy (pull_request) Successful in 58s
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
#include "tool.hpp"
|
||||
|
||||
#include <QList>
|
||||
#include <QPointer>
|
||||
#include <QStringList>
|
||||
|
||||
class QProcess;
|
||||
class QTimer;
|
||||
|
||||
namespace ZShell::llm {
|
||||
|
||||
class LlmClient;
|
||||
|
||||
class ShellTool : public LlmTool {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ShellTool(LlmClient* client, QObject* parent = nullptr);
|
||||
~ShellTool() override;
|
||||
|
||||
QString name() const override;
|
||||
QString description() const override;
|
||||
QJsonObject parameters() const override;
|
||||
void execute(
|
||||
const QString& toolCallId,
|
||||
const QJsonObject& args,
|
||||
int outputBudgetChars,
|
||||
std::function<void(const QJsonObject& result)> done) override;
|
||||
void cancel() override;
|
||||
|
||||
static constexpr int DefaultTimeoutSeconds = 60;
|
||||
static constexpr int MaxTimeoutSeconds = 300;
|
||||
|
||||
private:
|
||||
struct Job {
|
||||
QPointer<QProcess> process;
|
||||
QPointer<QTimer> timer;
|
||||
int timeoutSeconds = DefaultTimeoutSeconds;
|
||||
int outputBudgetChars = 0;
|
||||
std::function<void(const QJsonObject&)> done;
|
||||
QString startError;
|
||||
bool timedOut = false;
|
||||
bool cancelled = false;
|
||||
bool finished = false;
|
||||
};
|
||||
|
||||
static QStringList sandboxArguments(const QString& workspace);
|
||||
|
||||
void finishJob(Job* job);
|
||||
|
||||
QPointer<LlmClient> m_client;
|
||||
QList<Job*> m_jobs;
|
||||
};
|
||||
|
||||
} // namespace ZShell::llm
|
||||
Reference in New Issue
Block a user