gui: pass session cwd as plumb wdir for relative path resolution

Plumb messages now include the current session's cwd as wdir.
Added sessionCwd() helper to ChatPane and ChatBlockDelegate.
Updated plumber.plumb() to accept optional wdir parameter.
This commit is contained in:
Levi Neely 2026-10-08 15:44:39 +02:00
parent 5add387cc8
commit 5bf29198ff
3 changed files with 20 additions and 6 deletions

View File

@ -253,7 +253,7 @@ Column {
// B3: Plumb selection (no context menu) // B3: Plumb selection (no context menu)
var sel = mainTextEdit.selectedText var sel = mainTextEdit.selectedText
if (sel && sel.trim() !== "" && plumber.available()) { if (sel && sel.trim() !== "" && plumber.available()) {
plumber.plumb(sel.trim()) plumber.plumb(sel.trim(), sessionCwd())
} }
mouse.accepted = true mouse.accepted = true
} }
@ -332,6 +332,13 @@ Column {
return false return false
} }
// Get current session's working directory for plumb basedir
function sessionCwd() {
if (!ollie.activeSessionId) return ""
var cfg = ollie.readSessionConfig(ollie.activeSessionId)
return cfg ? (cfg.cwd || "") : ""
}
// Text segment component // Text segment component
Component { Component {
id: textComponent id: textComponent
@ -392,7 +399,7 @@ Column {
// B3: Plumb selection (no context menu) // B3: Plumb selection (no context menu)
var sel = textEdit.selectedText var sel = textEdit.selectedText
if (sel && sel.trim() !== "" && plumber.available()) { if (sel && sel.trim() !== "" && plumber.available()) {
plumber.plumb(sel.trim()) plumber.plumb(sel.trim(), sessionCwd())
} }
mouse.accepted = true mouse.accepted = true
} }
@ -501,7 +508,7 @@ Column {
// B3: Plumb selection (no context menu) // B3: Plumb selection (no context menu)
var sel = sourceEdit.selectedText var sel = sourceEdit.selectedText
if (sel && sel.trim() !== "" && plumber.available()) { if (sel && sel.trim() !== "" && plumber.available()) {
plumber.plumb(sel.trim()) plumber.plumb(sel.trim(), sessionCwd())
} }
mouse.accepted = true mouse.accepted = true
} }

View File

@ -37,6 +37,13 @@ Item {
scrollToBottom() scrollToBottom()
} }
// Get current session's working directory for plumb basedir
function sessionCwd() {
if (!ollie.activeSessionId) return ""
var cfg = ollie.readSessionConfig(ollie.activeSessionId)
return cfg ? (cfg.cwd || "") : ""
}
Component.onCompleted: { Component.onCompleted: {
loadChat() loadChat()
scrollToBottom() scrollToBottom()
@ -499,7 +506,7 @@ Item {
// B3: Plumb selection (no context menu) // B3: Plumb selection (no context menu)
var sel = promptInput.selectedText var sel = promptInput.selectedText
if (sel && sel.trim() !== "" && plumber.available()) { if (sel && sel.trim() !== "" && plumber.available()) {
plumber.plumb(sel.trim()) plumber.plumb(sel.trim(), sessionCwd())
} }
} }
} }

View File

@ -56,8 +56,8 @@ public:
Q_INVOKABLE bool available() const; Q_INVOKABLE bool available() const;
// Legacy compatibility aliases // Legacy compatibility aliases
Q_INVOKABLE void plumb(const QString &text) { send(text); } Q_INVOKABLE void plumb(const QString &text, const QString &wdir = QString()) { send(text, wdir); }
Q_INVOKABLE void plumbTo(const QString &text, const QString &dst) { sendTo(text, dst); } Q_INVOKABLE void plumbTo(const QString &text, const QString &dst, const QString &wdir = QString()) { sendTo(text, dst, wdir); }
/*! /*!
* Start the edit-port reader thread. Safe to call once; further calls are * Start the edit-port reader thread. Safe to call once; further calls are